aboutsummaryrefslogtreecommitdiff
path: root/opcodes/ppc-dis.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-04-05 09:20:16 +1030
committerAlan Modra <amodra@gmail.com>2019-04-05 12:20:49 +1030
commitc2b1c2754526acff8aae2fe8f5a56c2dd11d0b7f (patch)
tree86c506f4975df44a54e4ab0398dc9118eef9100f /opcodes/ppc-dis.c
parent82477cd28aac011c884d75a429d47a0523cbac26 (diff)
downloadgdb-c2b1c2754526acff8aae2fe8f5a56c2dd11d0b7f.zip
gdb-c2b1c2754526acff8aae2fe8f5a56c2dd11d0b7f.tar.gz
gdb-c2b1c2754526acff8aae2fe8f5a56c2dd11d0b7f.tar.bz2
PowerPC disassembler: Don't emit trailing spaces
When an instruction has operands, the PowerPC disassembler prints spaces after the opcode so as to line up operands. If the operands are all optional and all default value, then no operands are printed, leaving trailing spaces. This patch fixes that. opcodes/ * ppc-dis.c (print_insn_powerpc): Delay printing spaces after opcode until first operand is output. gas/ * testsuite/gas/ppc/476.d: Remove trailing spaces. * testsuite/gas/ppc/a2.d: Likewise. * testsuite/gas/ppc/booke.d: Likewise. * testsuite/gas/ppc/booke_xcoff.d: Likewise. * testsuite/gas/ppc/e500.d: Likewise. * testsuite/gas/ppc/e500mc.d: Likewise. * testsuite/gas/ppc/e6500.d: Likewise. * testsuite/gas/ppc/htm.d: Likewise. * testsuite/gas/ppc/power6.d: Likewise. * testsuite/gas/ppc/power8.d: Likewise. * testsuite/gas/ppc/power9.d: Likewise. * testsuite/gas/ppc/vle.d: Likewise. ld/ * testsuite/ld-powerpc/tlsexe32.d: Remove trailing spaces. * testsuite/ld-powerpc/tlsopt5.d: Likewise. * testsuite/ld-powerpc/tlsopt5_32.d: Likewise.
Diffstat (limited to 'opcodes/ppc-dis.c')
-rw-r--r--opcodes/ppc-dis.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/opcodes/ppc-dis.c b/opcodes/ppc-dis.c
index dbcbcc9..f42d5b2 100644
--- a/opcodes/ppc-dis.c
+++ b/opcodes/ppc-dis.c
@@ -723,11 +723,13 @@ print_insn_powerpc (bfd_vma memaddr,
int need_comma;
int need_paren;
int skip_optional;
+ int spaces;
- if (opcode->operands[0] != 0)
- (*info->fprintf_func) (info->stream, "%-7s ", opcode->name);
- else
- (*info->fprintf_func) (info->stream, "%s", opcode->name);
+ (*info->fprintf_func) (info->stream, "%s", opcode->name);
+ /* gdb fprintf_func doesn't return count printed. */
+ spaces = 8 - strlen (opcode->name);
+ if (spaces <= 0)
+ spaces = 1;
/* Now extract and print the operands. */
need_comma = 0;
@@ -752,6 +754,11 @@ print_insn_powerpc (bfd_vma memaddr,
value = operand_value_powerpc (operand, insn, dialect);
+ if (spaces)
+ {
+ (*info->fprintf_func) (info->stream, "%*s", spaces, " ");
+ spaces = 0;
+ }
if (need_comma)
{
(*info->fprintf_func) (info->stream, ",");