Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: gdb-patches@sources.redhat.com
Subject: [RFA/pa-risc] Correct incorrect frame base
Date: Fri, 31 Dec 2004 16:13:00 -0000	[thread overview]
Message-ID: <20041231151415.GL1824@adacore.com> (raw)

[-- 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;

             reply	other threads:[~2004-12-31 15:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-31 16:13 Joel Brobecker [this message]
     [not found] ` <20041231161258.GA4437@nevyn.them.org>
2005-01-01 12:31   ` Joel Brobecker
2005-01-04  0:09 John David Anglin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041231151415.GL1824@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox