[LLVMdev] operator overloading fails while debugging with gdb for i386
rengolin at systemcall.org
Mon Dec 3 01:07:52 PST 2012
On 2 December 2012 08:12, Mayur Pandey <mayurthebond at gmail.com> wrote:
> So is this just a coincidence for g++ that eax points to this address and
> gdb prints the right value on the command print sum(one,two)??
The code is small, and the structure is probably set at the end of the
block, so I think it's not that much of a coincidence.
Regardless of the specific value on that specific compilation unit,
you should never rely on behaviour of clobbered registers. That
function returns void, you should look up in the caller, where is the
address of the structure.
Does the code execute correctly? Does a printf on the sum outputs the
correct value? StrucRet is stable on Intel for years, I'd be surprised
id that didn't work.
However, it's possible that clang is messing up the position of the
structure in Dwarf, so I'd investigate the Dwarf emission first, since
your problem seems to bee with clang+gdb.
More information about the llvm-dev