aboutsummaryrefslogtreecommitdiff
path: root/opcodes
diff options
context:
space:
mode:
authorclaziss <claziss@synopsys.com>2017-11-03 15:36:42 +0100
committerclaziss <claziss@synopsys.com>2017-11-03 15:36:54 +0100
commitfdddd2900f39584e7d6cee27127593fba2cb0cf2 (patch)
treee275e77f8026e669737a770701265b922620ec97 /opcodes
parent7605d944531519ddf9026bf059475a4347c83aa4 (diff)
downloadgdb-fdddd2900f39584e7d6cee27127593fba2cb0cf2.zip
gdb-fdddd2900f39584e7d6cee27127593fba2cb0cf2.tar.gz
gdb-fdddd2900f39584e7d6cee27127593fba2cb0cf2.tar.bz2
[ARC] Force the disassam to use the hexadecimal number for printing
Force printing of the short/signed values using hexadecimal representation via disassembler option. opcode/ 2017-11-03 Claudiu Zissulescu <claziss@synopsys.com> * arc-dis.c (print_hex): New variable. (parse_option): Check for hex option. (print_insn_arc): Use hexadecimal representation for short immediate values when requested. (print_arc_disassembler_options): Add hex option to the list. binutils/ 2017-11-03 Claudiu Zissulescu <claziss@synopsys.com> * doc/binutils.texi (ARC): Update disassembler options. * testsuite/binutils-all/arc/hexprint.s: New file. * testsuite/binutils-all/arc/objdump.exp: Test hex printing feature.
Diffstat (limited to 'opcodes')
-rw-r--r--opcodes/ChangeLog8
-rw-r--r--opcodes/arc-dis.c14
2 files changed, 21 insertions, 1 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index b5366b5..ecf548d 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,5 +1,13 @@
2017-11-03 Claudiu Zissulescu <claziss@synopsys.com>
+ * arc-dis.c (print_hex): New variable.
+ (parse_option): Check for hex option.
+ (print_insn_arc): Use hexadecimal representation for short
+ immediate values when requested.
+ (print_arc_disassembler_options): Add hex option to the list.
+
+2017-11-03 Claudiu Zissulescu <claziss@synopsys.com>
+
* arc-tbl.h (abss, abssh, adc, adcs, adds, aslacc, asls, aslsacc)
(asrs, asrsr, cbflyhf0r, cbflyhf1r, cmacchfr, cmacchnfr, cmachfr)
(cmachnfr, cmpychfr, cmpychnfr, cmpyhfmr, cmpyhfr, cmpyhnfr, divf)
diff --git a/opcodes/arc-dis.c b/opcodes/arc-dis.c
index 9bfcaee..7541b74 100644
--- a/opcodes/arc-dis.c
+++ b/opcodes/arc-dis.c
@@ -122,6 +122,9 @@ static linkclass decodelist = NULL;
static unsigned enforced_isa_mask = ARC_OPCODE_NONE;
+/* True if we want to print using only hex numbers. */
+static bfd_boolean print_hex = FALSE;
+
/* Macros section. */
#ifdef DEBUG
@@ -772,6 +775,8 @@ parse_option (const char *option)
add_to_decodelist (FLOAT, DP);
add_to_decodelist (FLOAT, CVT);
}
+ else if (CONST_STRNEQ (option, "hex"))
+ print_hex = TRUE;
else
fprintf (stderr, _("Unrecognised disassembler option: %s\n"), option);
}
@@ -1257,7 +1262,12 @@ print_insn_arc (bfd_vma memaddr,
if (rname && open_braket)
(*info->fprintf_func) (info->stream, "%s", rname);
else
- (*info->fprintf_func) (info->stream, "%d", value);
+ {
+ if (print_hex)
+ (*info->fprintf_func) (info->stream, "%#x", value);
+ else
+ (*info->fprintf_func) (info->stream, "%d", value);
+ }
}
else if (operand->flags & ARC_OPERAND_ADDRTYPE)
{
@@ -1368,6 +1378,8 @@ with -M switch (multiple options should be separated by commas):\n"));
fpus Recognize single precision FPU instructions.\n"));
fprintf (stream, _("\
fpud Recognize double precision FPU instructions.\n"));
+ fprintf (stream, _("\
+ hex Use only hexadecimal number to print immediates.\n"));
}
void arc_insn_decode (bfd_vma addr,