[fpc-devel] GDB barfs on FPC generated stabs.

Bruce Tulloch bruce at causal.com
Tue Sep 11 16:32:43 CEST 2007


I've managed to distill this problem into a trivial Lazarus project.

Unpack the tarball, and build this project as .compiled indicates.

Run it under gdb 6.6 with a break-point placed as commented.

Try and step into TChild.Create at this point - gdb SEGV.

Rebuild with DWARF2 and it run without crashing gdb.

At least that's what I'm seeing here (Debian Etch, FPC SVN 8427, GDB 6.6).

I hope this helps. I will try and isolate it further.

Cheers, Bruce.

Bruce Tulloch wrote:
> Hi Jonas,
> 
> Unfortunately GDB (6.6) still barfs on FPC (SVN 8427) generated stabs
> sometimes when performing a backtrace or printing certain objects in
> our application. As mentioned earlier, we'll do what we can to abstract
> the problem into the small demonstration program we can send you. For
> the time being we'll use DWARF2 as despite some remaining problems with
> that (reported in another email) it does not crash GDB.
> 
> Cheers, Bruce.
> 
> Bruce Tulloch wrote:
>> I have encountered a problem using GDB (6.4.90-debian) with FPC (2.0.4
>> or 2.1.4). In a nutshell, GDB sometimes barfs on FPC generated stabs.
>>
>> If the program is compiled with -g (stabs format) the debugger works
>> but attempts to print some data structures or produce a back-trace
>> can result in a SEGV in GDB (ie, GDB itself crashes).
>>
>> If the program is compiled with -gd (DBX format) or -gw (dwarf) GDB
>> works correctly without crashing but reference to source files that
>> are in directories other than the current directory have a (relative)
>> path prepended to the name which breaks other things (notably the
>> emacs/GUD and Lazarus front ends).
>>
>> By way of example, with GDB run in the (project home) directory
>>
>>   /home/bruce/vc/
>>
>> with dwarf symbols GDB reports:
>>
>>   (gdb) info source
>>   Current source file is src//Widget.pas
>>   Compilation directory is src/
>>   Located in /home/bruce/vc/src/Widget.pas
>>   Contains 637 lines.
>>   Source language is pascal.
>>   Compiled with unknown debugging format.
>>   Does not include preprocessor macro info.
>>
>> When the program is compiled with stabs I get:
>>
>>   (gdb) info source
>>   Current source file is Widget.pas
>>   Compilation directory is src/
>>   Located in /home/bruce/vc/src/Widget.pas
>>   Contains 637 lines.
>>   Source language is pascal.
>>   Compiled with stabs debugging format.
>>   Does not include preprocessor macro info.
>>
>> which is correct (but GDB is otherwise unusable due the stabs problem).
>>
>> My (2) questions are:
>>
>>  [1] has anyone else seen the GDB crashing problem when a program is
>>      compiled with stabs info?
>>
>>  [2] is the filename problem with dwarf encoded symbols an FPC bug or
>>      is there some configuration I'm missing somehere.
>>
>> Note that in all cases I've compiled the program (which is a port of a
>> a working Delphi application) with no optimizations or other bells and
>> whistles enabled.
>>
>> Many thanks for any advice about what I might be doing wrong.
>>
>> Otherwise consider this a bug report :-)
>>
>> Cheers, Bruce Tulloch.
>> _______________________________________________
>> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
>> http://lists.freepascal.org/mailman/listinfo/fpc-devel
>>
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gdb-stabs-bomb.tgz
Type: application/x-compressed
Size: 2318 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20070912/6478bcb2/attachment.bin>


More information about the fpc-devel mailing list