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

Bruce Tulloch bruce at causal.com
Sun Sep 9 10:07:40 CEST 2007


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.



More information about the fpc-devel mailing list