Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA/pa-risc] Correct incorrect frame base
@ 2004-12-31 16:13 Joel Brobecker
       [not found] ` <20041231161258.GA4437@nevyn.them.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Joel Brobecker @ 2004-12-31 16:13 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 1776 bytes --]

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!

[-- Attachment #2: ldil.diff --]
[-- Type: text/plain, Size: 769 bytes --]

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;

^ permalink raw reply	[flat|nested] 3+ messages in thread
* Re: [RFA/pa-risc] Correct incorrect frame base
@ 2005-01-04  0:09 John David Anglin
  0 siblings, 0 replies; 3+ messages in thread
From: John David Anglin @ 2005-01-04  0:09 UTC (permalink / raw)
  To: gdb-patches; +Cc: brobecker

For your info, GCC generates some wierd and wonderful code to load
the frame base on hppa64 when the frame size is larger than 0xffffffff.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-01-04  0:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-31 16:13 [RFA/pa-risc] Correct incorrect frame base Joel Brobecker
     [not found] ` <20041231161258.GA4437@nevyn.them.org>
2005-01-01 12:31   ` Joel Brobecker
2005-01-04  0:09 John David Anglin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox