[v4,2/2] RISC-V: Add partial instruction display tests

Message ID 20250107-fix_objdump_partial_insn-v4-2-5bca13284275@rivosinc.com
State New
Headers
Series RISC-V: Fix display of partial instructions |

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-arm success Test passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 fail Patch failed to apply

Commit Message

Charlie Jenkins Jan. 7, 2025, 9:35 p.m. UTC
  When objdump is specified with a stop address that ends up in the middle
of an instruction, the partial instruction is expected to be displayed.
These three tests check that the partial instruction is correctly
displayed when there are 1, 2, or 3 bytes of the instruction dumped.

Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
---
 gas/testsuite/gas/riscv/dis-partial-insn-byte.d  | 11 +++++++++++
 gas/testsuite/gas/riscv/dis-partial-insn-short.d | 11 +++++++++++
 gas/testsuite/gas/riscv/dis-partial-insn-word.d  | 11 +++++++++++
 gas/testsuite/gas/riscv/dis-partial-insn.s       |  2 ++
 4 files changed, 35 insertions(+)
  

Patch

diff --git a/gas/testsuite/gas/riscv/dis-partial-insn-byte.d b/gas/testsuite/gas/riscv/dis-partial-insn-byte.d
new file mode 100644
index 0000000000000000000000000000000000000000..f8c149ca881773a945d53ea92856375b7815a38e
--- /dev/null
+++ b/gas/testsuite/gas/riscv/dis-partial-insn-byte.d
@@ -0,0 +1,11 @@ 
+#as:
+#source: dis-partial-insn.s
+#objdump: --start-address 0 --stop-address 1 -d
+
+.*:[ 	]+file format .*
+
+
+Disassembly of section .text:
+
+0+000 <target>:
+[ 	]+0:[ 	]+13[ 	]+.byte[ 	]+0x13
diff --git a/gas/testsuite/gas/riscv/dis-partial-insn-short.d b/gas/testsuite/gas/riscv/dis-partial-insn-short.d
new file mode 100644
index 0000000000000000000000000000000000000000..4a7d6d98b82632f7b35b40327b192f4af33d42f0
--- /dev/null
+++ b/gas/testsuite/gas/riscv/dis-partial-insn-short.d
@@ -0,0 +1,11 @@ 
+#as:
+#source: dis-partial-insn.s
+#objdump: --start-address 0 --stop-address 2 -d
+
+.*:[ 	]+file format .*
+
+
+Disassembly of section .text:
+
+0+000 <target>:
+[ 	]+0:[ 	]+0013[ 	]+.short[ 	]+0x0013
diff --git a/gas/testsuite/gas/riscv/dis-partial-insn-word.d b/gas/testsuite/gas/riscv/dis-partial-insn-word.d
new file mode 100644
index 0000000000000000000000000000000000000000..2f52153075e77361a3dd3f1e3071949eb89c6fe6
--- /dev/null
+++ b/gas/testsuite/gas/riscv/dis-partial-insn-word.d
@@ -0,0 +1,11 @@ 
+#as:
+#source: dis-partial-insn.s
+#objdump: --start-address 0 --stop-address 3 -d
+
+.*:[ 	]+file format .*
+
+
+Disassembly of section .text:
+
+0+000 <target>:
+[ 	]+0:[ 	]+000013[ 	]+.word[ 	]+0x000013
diff --git a/gas/testsuite/gas/riscv/dis-partial-insn.s b/gas/testsuite/gas/riscv/dis-partial-insn.s
new file mode 100644
index 0000000000000000000000000000000000000000..99456883315ed914786d18cfc2623aa6fa99cc84
--- /dev/null
+++ b/gas/testsuite/gas/riscv/dis-partial-insn.s
@@ -0,0 +1,2 @@ 
+target:
+	nop