Pascal language for GDB ??? (long and technical)

Pierre Muller
Wed Jul 1 06:08:00 GMT 1998

  We now have two pascal compilers that use GDB (or RHIDE,
but RHIDE itself uses GDB) : GNU pascal and FPC.
(I am in the FPC development team and I wrote a great part of
the stabs debugging info support for FPC).

  GDB is a really powerful tool to debug programs
but there is still nothing about Pascal in GDB.

  This means that everyone which wants to use GDB
has to use C syntax to access the pascal variable.
But this is only the most obvious limitations,
there are several others which are more fundamental.

  - You cannot access Sets as it does not exist in C
(you might using modula language, but then you run
into other problems)

  - Global variables are not handled correctly (at least in FPC,
the reason is the following : 
  GDB does not use the assembler label that you can ship
with the stabs debugging info for a global variable,
instead it searches for a assembler label with just
an underscore added like for C vars !
  But in pascal each unit can have the same 
global variable so you need to add the unit name in the
assembler label to be able to handle this
=> GDB does not find them.
  Currently this is worked around in FPC by reporting to GDB that
all variables are static !!

  - Object implementation is a nightmare
(I do not know the current level of debug info for
objects in GPC but in FPC all is done
via C++ extensions of the stabs debugging
and this is really not easy and unreadable !!)

  - Pascal strings look ugly (this is easily fixed)

  - Overloading of ordinary functions is also not supported by C
so if you have several functions with the same name
you cannot set breakpoints to these functions
nor list them by name (you have to use file:line breakpoints)

  - Upper/lower does not matter in pascal but does in C
this also creates lots of problems !!

  For all the above reasons, I would really like to know
if there is already somebody working on the implementation of the 
language to GDB or if someone would be interested in 
trying to begin this with me.

   My big problem regarding this topic is that
I only started to learn C when I began to look into GDB's code
(probably not the easiest way to start !!)

   Any person interested can reply by news or mail !!

More information about the Gdb mailing list