]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
[gdb/tdep] Add amd64-insn-decode selftest
authorTom de Vries <tdevries@suse.de>
Fri, 7 Mar 2025 08:25:33 +0000 (09:25 +0100)
committerTom de Vries <tdevries@suse.de>
Fri, 7 Mar 2025 08:25:33 +0000 (09:25 +0100)
commitbbb04932e6cab8aac83b3ab8d0d4aa5fae3356f9
tree95bd901050a498ff1d88a58ae08704633b9a51b7
parent0c1eecdfc6348ec9213ebbb42ddce78fc197a428
[gdb/tdep] Add amd64-insn-decode selftest

Add a selftest that checks the results of amd64_get_insn_details and related
functions for two basic instructions.

Add a parameter assumptions to amd64_get_used_input_int_regs, to make sure
that this selftest:
...
  /* INSN: add %eax,(%rcx).  */
  ...
  SELF_CHECK (amd64_get_used_input_int_regs (&details, false)
      == ((1 << EAX_REG_NUM) | (1 << ECX_REG_NUM)));
...
passes because it found the "%eax" in the insn, rather than passing because of
this assumption:
...
  /* Assume RAX is used.  If not, we'd have to detect opcodes that implicitly
     use RAX.  */
  used_regs_mask |= 1 << EAX_REG_NUM;
...

Tested on x86_64-linux.
gdb/amd64-tdep.c