]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
s390: Support for jump visualization in disassembly
authorJens Remus <jremus@linux.ibm.com>
Wed, 29 Nov 2023 20:44:34 +0000 (21:44 +0100)
committerNick Clifton <nickc@redhat.com>
Mon, 4 Dec 2023 17:13:33 +0000 (17:13 +0000)
commitc5306fed7d40717d9866524fb346ac2599f9769d
tree7ccf62c167807ced69a27aae18df57e1408b7610
parent86b775c51597816dcab29dd37522b505d043dc51
s390: Support for jump visualization in disassembly

Add support for jump visualization for the s390 architecture in
disassembly:

objdump -d --visualize-jumps ...

Annotate the (conditional) jump and branch relative instructions with
information required for jump visualization:
- jump: Unconditional jump / branch relative.
- condjump: Conditional jump / branch relative.
- jumpsr: Jump / branch relative to subroutine.

Unconditional jump and branch relative instructions are annotated as
jump.
Conditional jump and branch relative instructions, jump / branch
relative on count/index, and compare and jump / branch relative
instructions are annotated as condjump.
Jump and save (jas, jasl) and branch relative and save (bras, brasl)
instructions are annotated as jumpsr (jump to subroutine).

Provide instruction information required for jump visualization during
disassembly.
The instruction type is provided after determining the opcode.
For non-code it is set to dis_noninsn. Otherwise it defaults to
dis_nonbranch. No annotation is done for data reference instructions
(i.e. instruction types dis_dref and dis_dref2). Note that the
instruction type needs to be provided before printing of the
instruction, as it is used in print_address_func() to translate the
argument value into an address if it is assumed to be a PC-relative
offset. Note that this is never the case on s390, as
print_address_func() is only called with addresses and never with
offsets.
The target of the (conditional) jump and branch relative instructions
is provided during print, when the PC relative operand is decoded.

include/
* opcode/s390.h: Define opcode flags to annotate instruction
  class information for jump visualization:
  S390_INSTR_FLAG_CLASS_BRANCH, S390_INSTR_FLAG_CLASS_RELATIVE,
  S390_INSTR_FLAG_CLASS_CONDITIONAL, and
  S390_INSTR_FLAG_CLASS_SUBROUTINE.
  Define opcode flags mask S390_INSTR_FLAG_CLASS_MASK for above
  instruction class information.
  Define helpers for common instruction class flag combinations:
  S390_INSTR_FLAGS_CLASS_JUMP, S390_INSTR_FLAGS_CLASS_CONDJUMP,
  and S390_INSTR_FLAGS_CLASS_JUMPSR.

opcodes/
* s390-mkopc.c: Add opcode flags to annotate information
  for jump visualization: jump, condjump, and jumpsr.
* s390-opc.txt: Annotate (conditional) jump and branch relative
  instructions with information for jump visualization.
* s390-dis.c (print_insn_s390, s390_print_insn_with_opcode):
  Provide instruction information for jump visualization.

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
Reviewed-by: Andreas Krebbel <krebbel@linux.ibm.com>
binutils/NEWS
include/opcode/s390.h
opcodes/s390-dis.c
opcodes/s390-mkopc.c
opcodes/s390-opc.txt