aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorJens Remus <jremus@linux.ibm.com>2023-12-20 11:34:15 +0100
committerAndreas Krebbel <krebbel@linux.ibm.com>2023-12-20 11:50:32 +0100
commitf96fe7f454bdd077abec2acc415f546bb5646189 (patch)
treeee9abf7a8ffe9b9d36236bab978e8a9da980062e /gas
parenta3fa108623c51846ff019fbcba9f483897d6f5f7 (diff)
downloadgdb-f96fe7f454bdd077abec2acc415f546bb5646189.zip
gdb-f96fe7f454bdd077abec2acc415f546bb5646189.tar.gz
gdb-f96fe7f454bdd077abec2acc415f546bb5646189.tar.bz2
s390: Optionally print instruction description in disassembly
Print instruction description as comment in disassembly with s390 architecture specific option "insndesc": - For objdump it can be enabled with option "-M insndesc" - In gdb it can be enabled with "set disassembler-options insndesc" Since comments are not column aligned the output can enhanced for readability by postprocessing using a filter such as "expand": ... | expand -t 8,16,24,32,40,80 Or when using in combination with objdump option --visualize-jumps: ... | expand | sed -e 's/ *#/\t#/' | expand -t 1,80 Note that the instruction descriptions add about 128 KB to s390-opc.o: s390-opc.o without instruction descriptions: 216368 bytes s390-opc.o with instruction descriptions : 348432 bytes binutils/ * NEWS: Mention new s390-specific disassembler option "insndesc". include/ * opcode/s390.h (struct s390_opcode): Add field to hold instruction description. opcodes/ * s390-mkopc.c: Copy instruction description from s390-opc.txt into generated operation code table s390-opc.tab. * s390-opc.c (s390_opformats): Provide NULL as description in .insn pseudo-mnemonics opcode table. * s390-dis.c: Add s390-specific disassembler option "insndesc" and optionally print the instruction description as comment in the disassembly when it is specified. gas/ * testsuite/gas/s390/s390.exp: Add new test disassembly test case "zarch-insndesc". * testsuite/gas/s390/zarch-insndesc.s: New test case for s390- specific disassembler option "insndesc". * testsuite/gas/s390/zarch-insndesc.d: Likewise. Signed-off-by: Jens Remus <jremus@linux.ibm.com> Reviewed-by: Andreas Krebbel <krebbel@linux.ibm.com>
Diffstat (limited to 'gas')
-rw-r--r--gas/testsuite/gas/s390/s390.exp1
-rw-r--r--gas/testsuite/gas/s390/zarch-insndesc.d17
-rw-r--r--gas/testsuite/gas/s390/zarch-insndesc.s10
3 files changed, 28 insertions, 0 deletions
diff --git a/gas/testsuite/gas/s390/s390.exp b/gas/testsuite/gas/s390/s390.exp
index 356fba9..86e2dd4 100644
--- a/gas/testsuite/gas/s390/s390.exp
+++ b/gas/testsuite/gas/s390/s390.exp
@@ -37,6 +37,7 @@ if [expr [istarget "s390-*-*"] || [istarget "s390x-*-*"]] then {
run_dump_test "zarch-operands" "{as -m64} {as -march=z9-109}"
run_dump_test "zarch-machine" "{as -m64} {as -march=z900}"
run_dump_test "zarch-optargs" "{as -m64} {as -march=arch12}"
+ run_dump_test "zarch-insndesc" "{as -m64}"
run_list_test "machine-parsing-1" ""
run_list_test "machine-parsing-2" ""
run_list_test "machine-parsing-3" ""
diff --git a/gas/testsuite/gas/s390/zarch-insndesc.d b/gas/testsuite/gas/s390/zarch-insndesc.d
new file mode 100644
index 0000000..9a121fb
--- /dev/null
+++ b/gas/testsuite/gas/s390/zarch-insndesc.d
@@ -0,0 +1,17 @@
+#name: s390x insndesc
+#objdump: -dr -M insndesc
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+.* <foo>:
+.*: b3 95 00 69 [ ]*cdfbr %f6,%r9 # convert from fixed 32 to long bfp
+ *([\da-f]+): 84 69 00 00 [ ]*brxh %r6,%r9,\1 <foo\+0x\1> # branch relative on index high
+.*: b2 99 5f ff [ ]*srnm 4095\(%r5\) # set rounding mode
+.*: b9 11 00 96 [ ]*lngfr %r9,%r6 # load negative 64<32
+.*: ec 67 92 1c 26 54 [ ]*rnsbgt %r6,%r7,18,28,38 # rotate then and selected bits and test results
+.*: ec 67 0c 8d 0e 5d [ ]*risbhgz %r6,%r7,12,13,14 # rotate then insert selected bits high and zero remaining bits
+.*: b3 96 37 59 [ ]*cxfbra %f5,3,%r9,7 # convert from 32 bit fixed to extended bfp with rounding mode
+.*: ec 67 0c 94 0e 59 [ ]*risbgnz %r6,%r7,12,20,14 # rotate then insert selected bits and zero remaining bits nocc
+.*: 07 07 [ ]*nopr %r7 # no operation
diff --git a/gas/testsuite/gas/s390/zarch-insndesc.s b/gas/testsuite/gas/s390/zarch-insndesc.s
new file mode 100644
index 0000000..e964315
--- /dev/null
+++ b/gas/testsuite/gas/s390/zarch-insndesc.s
@@ -0,0 +1,10 @@
+.text
+foo:
+ cdfbr %f6,%r9
+ brxh %r6,%r9,.
+ srnm 4095(%r5)
+ lngfr %r9,%r6
+ rnsbgt %r6,%r7,18,28,38
+ risbhgz %r6,%r7,12,13,14
+ cxfbra %f5,3,%r9,7
+ risbgnz %r6,%r7,12,20,14