]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
[gdb/tdep] Refactor amd64_get_unused_input_int_reg, part 1
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)
commit0907b3ea044e1593b1a4ff6c0dda6ca9d3643a0b
treefa57360b94a1e665219f313f045b30512baa45b9
parent9479e1deba8c30f7756f1d1d8a219d6ee0e570d9
[gdb/tdep] Refactor amd64_get_unused_input_int_reg, part 1

While reading amd64_get_unused_input_int_reg, I noticed that it first asserts,
then throws an internal_error if no unused register can be found.

Looking at the documentation of gdbarch_displaced_step_copy_insn, it seems
that a failure can be indicated less abruptly, by returning a nullptr.

Fix this by:
- returning -1 in case of failure to find an unused register in
  amd64_get_unused_input_int_reg, and
- propagating this to amd64_displaced_step_copy_insn.

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