public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Luis Machado <luis.machado@arm.com>
To: <gdb-patches@sourceware.org>
Subject: [PATCH] [aarch64] Remove handling of ADR/ADRP from prologue analyzer
Date: Wed, 17 Aug 2022 09:33:34 +0100	[thread overview]
Message-ID: <20220817083334.139191-1-luis.machado@arm.com> (raw)

As reported by Tom in https://sourceware.org/pipermail/gdb-patches/2022-August/191357.html,
the aarch64 prologue analyzer considers the adrp instruction in the
gdb.dwarf2/dw2-dir-file-name.exp testcase to be part of a prologue.

The function has no prologue though, and it only loads the volatile variable
from memory.  GDB should not skip any instructions in this case.

Doing some archaeology, it seems handling for adr/adrp in prologues was
included with the original aarch64 port.  It might've been an oversight.

In the particular case of gdb.dwarf2/dw2-dir-file-name.exp, the analyzer skips
a couple instructions and leaves us in a nice spot where the address to the
variable "v" is already in w0. But no prologues exists.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29481
---
 gdb/aarch64-tdep.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
index f747ebda1ab..0385bc18632 100644
--- a/gdb/aarch64-tdep.c
+++ b/gdb/aarch64-tdep.c
@@ -354,14 +354,6 @@ aarch64_analyze_prologue (struct gdbarch *gdbarch,
 
 	  regs[rd] = pv_subtract (regs[rn], regs[rm]);
 	}
-      else if (inst.opcode->iclass == pcreladdr
-	       && inst.operands[1].type == AARCH64_OPND_ADDR_ADRP)
-	{
-	  gdb_assert (aarch64_num_of_operands (inst.opcode) == 2);
-	  gdb_assert (inst.operands[0].type == AARCH64_OPND_Rd);
-
-	  regs[inst.operands[0].reg.regno] = pv_unknown ();
-	}
       else if (inst.opcode->iclass == branch_imm)
 	{
 	  /* Stop analysis on branch.  */
-- 
2.25.1


             reply	other threads:[~2022-08-17  8:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-17  8:33 Luis Machado [this message]
2022-08-18 15:43 ` Luis Machado

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=20220817083334.139191-1-luis.machado@arm.com \
    --to=luis.machado@arm.com \
    --cc=gdb-patches@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).