Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2012-06

Progress for mips debugging

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Pierre Free Pascal

the generated mips executable were really difficult to debug because the locals and parameters were not correctly displayed by GDB.

It turned out that it was not only our fault,
we use a different layout than GCC normally does.

GCC decreases $sp register a function entry,
saves registers (inclusing $s8 regsiter)
and then puts $sp into $s8.
We currently do this:
decrease $sp
save the registers
set $s8 to value of $sp before the initial decrease.

GDB was supposed to also support this, but there
is an error in the handling:
those interested can take a look at:
http://sourceware.org/ml/gdb-patches/2012-06/msg00395.html

To be able to correctly display
locals/parameters of procedures/functions
you will need to patch a recent GDB source with the following one line patch.
This patch should apply cleanly to current GDB CVS Head, but is probably usable for other sources too.

Please report if this does not allow you to display correctly local vars and parameters if using SVN
after revision 21588.

Pierre

Index: src/gdb/mips-tdep.c
=================================================================== RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.556
diff -u -p -r1.556 mips-tdep.c
--- src/gdb/mips-tdep.c 6 Jun 2012 21:34:12 -0000 1.556 +++ src/gdb/mips-tdep.c 10 Jun 2012 23:43:44 -0000 @@ -3226,6 +3226,7 @@ restart:

                (this_frame, gdbarch_num_regs (gdbarch) + 30);
              alloca_adjust = (unsigned) (frame_addr - (sp + low_word));

+ frame_offset -= low_word;
if (alloca_adjust > 0)
{
/* FP > SP + frame_size. This may be because of

Reply by email