[llvm-commits] llvm-gcc: don't crash when emitting debug info for a field at a variable offset

Duncan Sands baldrick at free.fr
Thu Apr 12 02:19:42 PDT 2007


> If a field in a record is at a variable offset from
> the start of the record, then DebugInfo::getOrCreateType
> crashes at this line
>           MemberDesc->setOffset(int_bit_position(Member));
> since the bit-offset is not an integer constant.  Fixed
> by using 0 for the offset in this case - which is a cop
> out, but doing anything else seems hard.  This is what
> gcc does too.

After thinking about this some more, I reckon it's better
not to emit debug info for such fields at all.  What's the
point of be able to access a field if it's accessing the
wrong memory (which is what you get by using offset 0)?
My experience with gcc is that it's just confusing when,
in gdb, you print the contents of a struct and see a
bunch of fields with bogus values.  The attached patch
simply skips over fields at a variable offset.

Ciao,

Duncan.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: var_debug.diff
Type: text/x-diff
Size: 729 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20070412/c118d372/attachment.diff>


More information about the llvm-commits mailing list