segfaults

Robert Clipsham robert at octarineparrot.com
Tue Feb 23 08:34:37 PST 2010


On 23/02/10 02:14, Ellery Newcomer wrote:
> Is there any decent way to figure out where segfaults are coming from?
>
> e.g. 200k lines of bad code converted from java
>
> I tried gdb, and it didn't seem to work too well.
>
> Die: DW_TAG_type_unit (abbrev 3, offset 0x6d)
> parent at offset: 0xb
> has children: FALSE
> attributes:
> DW_AT_byte_size (DW_FORM_data1) constant: 8
> Dwarf Error: Missing children for type unit [in module
> /home/ellery/dxl.exe]
> Missing separate debuginfos, use: debuginfo-install glibc-2.11.1-1.i686
>
>
> And I'm not proficient with gdb.
>
> dmd 1.056 / tango .99999 or whatever
>
> fedora linux

I'm no expert, but that looks like a dmd bug, can you reproduce with 
ldc? The actual segfault is probably to do with your code, but if gdb 
gives that then there's a problem with the debug info that dmd is 
writing. The only easy way to debug this if dmd's giving bad debug info 
is to use another compiler (I've never had issues using ldc and gdb with 
the patches from
http://dsource.org/projects/gdb-patches/ ). I'd suggest reporting a dmd 
bug too, but unless you can work this down to a test case then it'll 
probably just be ignored... If your code is open source then someone 
else could work it down, otherwise I can't see much use in reporting a 
bug that can't be reproduced.

Other options to try are compiling with -g, compiling with -gc and 
seeing if you manage to get a better result, printf() debugging, using 
another compiler, or compiling without debug info and getting a 
backtrace... providing the binary isn't stripped you should still be 
able to get function names, even if you can't get files/line numbers.


More information about the Digitalmars-d-learn mailing list