[RFA/pa-risc] Correct incorrect frame base

Joel Brobecker brobecker@adacore.com
Fri Dec 31 16:13:00 GMT 2004


hello,

I noticed a problem trying to print the value of a variable with
a program compiled with GNAT (based on GCC 3.2.3). The problem
comes from the fact that GDB does not compute the correct frame
base. I think this is related to the fact that the function frame
is larger than usual. Here is the what the assembly code looks
like:

    _ada_dbtest
            .PROC
            .CALLINFO FRAME=18880,CALLS,SAVE_RP,ENTRY_GR=3
            .ENTRY
            stw %r2,-20(%r30)
            copy %r3,%r1
            copy %r30,%r3
            stwm %r1,8128(%r30)
            addil L'10752,%r30
            ldo R'10752(%r1),%r30


As you see, the frame size as published in the unwind record
is 18880 bytes, and the frame is setup in 3 instructions:

            stwm %r1,8128(%r30)
            addil L'10752,%r30
            ldo R'10752(%r1),%r30

Unfortunately, a little oops in prologue_inst_adjust_sp()
made it miss the second instruction:

  /* addil high21,%r1; ldo low11,(%r1),%r30)
     save high bits in save_high21 for later use.  */
  if ((inst & 0xffe00000) == 0x28200000)

There is a small confusion in the source register for the addil
instruction. The actual sequence should be

            addil high21,%r30
            ldo low11(%r1),%r30

I think the confusion comes from the fact that the result of
the sum is stored in %r1.

Anyway, I replaced r1 by r30 in the check above, and that fixed
the problem.

2004-12-31  Joel Brobecker  <brobecker@gnat.com>

        * hppa-tdep.c (prologue_inst_adjust_sp): Fix small confusion
        in register number for ldil instruction.

Tested on HP/UX 11.00, no regression.
OK to apply?
-- 
Joel

PS: I will be away for 3 weeks starting Jan 3rd, so please apply this
    change for me if approved after I leave. Thank you!
-------------- next part --------------
Index: hppa-tdep.c
===================================================================
RCS file: /nile.c/cvs/Dev/gdb/gdb-6.3/gdb/hppa-tdep.c,v
retrieving revision 1.11
diff -u -p -r1.11 hppa-tdep.c
--- hppa-tdep.c	30 Dec 2004 07:10:36 -0000	1.11
+++ hppa-tdep.c	31 Dec 2004 13:18:54 -0000
@@ -1154,9 +1154,9 @@ prologue_inst_adjust_sp (unsigned long i
   if ((inst & 0xffe00008) == 0x73c00008)
     return (inst & 0x1 ? -1 << 13 : 0) | (((inst >> 4) & 0x3ff) << 3);
 
-  /* addil high21,%r1; ldo low11,(%r1),%r30)
+  /* addil high21,%r30; ldo low11,(%r1),%r30)
      save high bits in save_high21 for later use.  */
-  if ((inst & 0xffe00000) == 0x28200000)
+  if ((inst & 0xffe00000) == 0x2bc00000)
     {
       save_high21 = hppa_extract_21 (inst);
       return 0;


More information about the Gdb-patches mailing list