public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] [aarch64] Remove handling of ADR/ADRP from prologue analyzer
@ 2022-08-17  8:33 Luis Machado
  2022-08-18 15:43 ` Luis Machado
  0 siblings, 1 reply; 2+ messages in thread
From: Luis Machado @ 2022-08-17  8:33 UTC (permalink / raw)
  To: gdb-patches

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


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

* Re: [PATCH] [aarch64] Remove handling of ADR/ADRP from prologue analyzer
  2022-08-17  8:33 [PATCH] [aarch64] Remove handling of ADR/ADRP from prologue analyzer Luis Machado
@ 2022-08-18 15:43 ` Luis Machado
  0 siblings, 0 replies; 2+ messages in thread
From: Luis Machado @ 2022-08-18 15:43 UTC (permalink / raw)
  To: gdb-patches

On 8/17/22 09:33, Luis Machado via Gdb-patches wrote:
> 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.  */

Pushed now.

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

end of thread, other threads:[~2022-08-18 15:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-17  8:33 [PATCH] [aarch64] Remove handling of ADR/ADRP from prologue analyzer Luis Machado
2022-08-18 15:43 ` Luis Machado

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).