public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug tdep/29867] [gdb/tdep, s390x -m31] FAIL: gdb.guile/scm-lazy-string.exp: ptr: print ptr
Date: Fri, 09 Dec 2022 13:25:47 +0000	[thread overview]
Message-ID: <bug-29867-4717-WSApPY84QY@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-29867-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=29867

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |arnez at linux dot ibm.com,
                   |                            |cel at us dot ibm.com,
                   |                            |ulrich.weigand at de dot ibm.com

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
The problem is in displaced stepping over insn:
...
│B+> 0x4005d2 <main+10>      larl    %r1,0x4006b0                              
             │...

In the failing case we have:
...
(gdb) si
(gdb) p /x $r1
$1 = 0x3ff804006b0
(gdb) 
...

In the passing case we have:
...
(gdb) si
(gdb) p /x $r1
$2 = 0x3ff004006b0
...

The difference comes from this code in s390_displaced_step_fixup:
...
  /* Handle LOAD ADDRESS RELATIVE LONG.  */
  else if (is_ril (insn, op1_larl, op2_larl, &r1, &i2))
    {
      /* Update PC.  */
      regcache_write_pc (regs, from + insnlen);
      /* Recompute output address in R1.  */
      regcache_cooked_write_unsigned (regs, S390_R0_REGNUM + r1,
                                      amode | (from + i2 * 2));
    }
...
where the "amode |" adds the 0x80000000.

Using this patch:
...
diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c
index d0dba7654bb..11b309dc817 100644
--- a/gdb/s390-tdep.c
+++ b/gdb/s390-tdep.c
@@ -557,7 +557,7 @@ s390_displaced_step_fixup (struct gdbarch *gdbarch,
       regcache_write_pc (regs, from + insnlen);
       /* Recompute output address in R1.  */
       regcache_cooked_write_unsigned (regs, S390_R0_REGNUM + r1,
-                                     amode | (from + i2 * 2));
+                                     (from + i2 * 2));
     }

   /* If we executed a breakpoint instruction, point PC right back at it.  */
...
the test-case passes.

I don't understand the architecture well enough to decide what the root cause
is and whether this patch addresses it.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  reply	other threads:[~2022-12-09 13:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-09 12:57 [Bug tdep/29867] New: " vries at gcc dot gnu.org
2022-12-09 13:25 ` vries at gcc dot gnu.org [this message]
2022-12-09 14:36 ` [Bug tdep/29867] " uweigand at gcc dot gnu.org
2022-12-10 14:42 ` vries at gcc dot gnu.org

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=bug-29867-4717-WSApPY84QY@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).