Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] [aarch64] Remove handling of ADR/ADRP from prologue analyzer
@ 2022-08-17  8:33 Luis Machado via Gdb-patches
  2022-08-18 15:43 ` Luis Machado via Gdb-patches
  0 siblings, 1 reply; 2+ messages in thread
From: Luis Machado via Gdb-patches @ 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 via Gdb-patches
@ 2022-08-18 15:43 ` Luis Machado via Gdb-patches
  0 siblings, 0 replies; 2+ messages in thread
From: Luis Machado via Gdb-patches @ 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:44 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 via Gdb-patches
2022-08-18 15:43 ` Luis Machado via Gdb-patches

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