[gdb/testsuite] Fix gdb.trace/entry-values.exp on riscv64-linux

Message ID 20240829144236.9530-1-tdevries@suse.de
State Committed
Headers
Series [gdb/testsuite] Fix gdb.trace/entry-values.exp on riscv64-linux |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Test passed

Commit Message

Tom de Vries Aug. 29, 2024, 2:42 p.m. UTC
  On riscv64-linux, with test-case gdb.trace/entry-values.exp I run into:
...
(gdb) disassemble bar^M
Dump of assembler code for function bar:^M
   0x0000000000000646 <+0>:     addi    sp,sp,-48^M
   0x0000000000000648 <+2>:     sd      ra,40(sp)^M
   0x000000000000064a <+4>:     sd      s0,32(sp)^M
   0x000000000000064c <+6>:     addi    s0,sp,48^M
   0x000000000000064e <+8>:     mv      a5,a0^M
   0x0000000000000650 <+10>:    sw      a5,-36(s0)^M
   0x0000000000000654 <+14>:    li      a5,2^M
   0x0000000000000656 <+16>:    sw      a5,-20(s0)^M
   0x000000000000065a <+20>:    lw      a4,-20(s0)^M
   0x000000000000065e <+24>:    lw      a5,-36(s0)^M
   0x0000000000000662 <+28>:    mv      a1,a4^M
   0x0000000000000664 <+30>:    mv      a0,a5^M
   0x0000000000000666 <+32>:    jal     0x628 <foo>^M
   0x000000000000066a <+36>:    mv      a5,a0^M
   0x000000000000066c <+38>:    mv      a0,a5^M
   0x000000000000066e <+40>:    ld      ra,40(sp)^M
   0x0000000000000670 <+42>:    ld      s0,32(sp)^M
   0x0000000000000672 <+44>:    addi    sp,sp,48^M
   0x0000000000000674 <+46>:    ret^M
End of assembler dump.^M
(gdb) FAIL: gdb.trace/entry-values.exp: disassemble bar
FAIL: gdb.trace/entry-values.exp: find the call or branch instruction offset in bar
...

Fix this by setting call_insn to jal for riscv64.

Tested on riscv64-linux and x86_64-linux.
---
 gdb/testsuite/gdb.trace/entry-values.exp | 2 ++
 1 file changed, 2 insertions(+)


base-commit: f2a15e7cde98af543a016090e4063180851a6d09
  

Comments

Tom de Vries Sept. 23, 2024, 5:51 a.m. UTC | #1
On 8/29/24 16:42, Tom de Vries wrote:
> On riscv64-linux, with test-case gdb.trace/entry-values.exp I run into:
> ...
> (gdb) disassemble bar^M
> Dump of assembler code for function bar:^M
>     0x0000000000000646 <+0>:     addi    sp,sp,-48^M
>     0x0000000000000648 <+2>:     sd      ra,40(sp)^M
>     0x000000000000064a <+4>:     sd      s0,32(sp)^M
>     0x000000000000064c <+6>:     addi    s0,sp,48^M
>     0x000000000000064e <+8>:     mv      a5,a0^M
>     0x0000000000000650 <+10>:    sw      a5,-36(s0)^M
>     0x0000000000000654 <+14>:    li      a5,2^M
>     0x0000000000000656 <+16>:    sw      a5,-20(s0)^M
>     0x000000000000065a <+20>:    lw      a4,-20(s0)^M
>     0x000000000000065e <+24>:    lw      a5,-36(s0)^M
>     0x0000000000000662 <+28>:    mv      a1,a4^M
>     0x0000000000000664 <+30>:    mv      a0,a5^M
>     0x0000000000000666 <+32>:    jal     0x628 <foo>^M
>     0x000000000000066a <+36>:    mv      a5,a0^M
>     0x000000000000066c <+38>:    mv      a0,a5^M
>     0x000000000000066e <+40>:    ld      ra,40(sp)^M
>     0x0000000000000670 <+42>:    ld      s0,32(sp)^M
>     0x0000000000000672 <+44>:    addi    sp,sp,48^M
>     0x0000000000000674 <+46>:    ret^M
> End of assembler dump.^M
> (gdb) FAIL: gdb.trace/entry-values.exp: disassemble bar
> FAIL: gdb.trace/entry-values.exp: find the call or branch instruction offset in bar
> ...
> 
> Fix this by setting call_insn to jal for riscv64.
> 

Pushed.

Thanks,
- Tom

> Tested on riscv64-linux and x86_64-linux.
> ---
>   gdb/testsuite/gdb.trace/entry-values.exp | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/gdb/testsuite/gdb.trace/entry-values.exp b/gdb/testsuite/gdb.trace/entry-values.exp
> index 3b358cc95cc..82ae5a8b273 100644
> --- a/gdb/testsuite/gdb.trace/entry-values.exp
> +++ b/gdb/testsuite/gdb.trace/entry-values.exp
> @@ -53,6 +53,8 @@ if { [istarget "arm*-*-*"] || [istarget "aarch64*-*-*"] } {
>       # returns.  The only exception is JALRC, in which case execution
>       # resumes from `insn1' instead.
>       set call_insn {jalrc|[jb]al[sxr]*[ \t][^\r\n]+\r\n}
> +} elseif { [istarget "riscv64*-*-*"] } {
> +    set call_insn jal
>   } else {
>       set call_insn "call"
>   }
> 
> base-commit: f2a15e7cde98af543a016090e4063180851a6d09
  

Patch

diff --git a/gdb/testsuite/gdb.trace/entry-values.exp b/gdb/testsuite/gdb.trace/entry-values.exp
index 3b358cc95cc..82ae5a8b273 100644
--- a/gdb/testsuite/gdb.trace/entry-values.exp
+++ b/gdb/testsuite/gdb.trace/entry-values.exp
@@ -53,6 +53,8 @@  if { [istarget "arm*-*-*"] || [istarget "aarch64*-*-*"] } {
     # returns.  The only exception is JALRC, in which case execution
     # resumes from `insn1' instead.
     set call_insn {jalrc|[jb]al[sxr]*[ \t][^\r\n]+\r\n}
+} elseif { [istarget "riscv64*-*-*"] } {
+    set call_insn jal
 } else {
     set call_insn "call"
 }