[PATCH 0/2] Decouple ARM instruction decoding/relocating from GDB

Simon Marchi
2016-02-25T15:47:33Z

As part of the upcoming ARM fast tracepoint support, we need to have some code
in gdbserver that decodes the relocated instructions, to check whether they
need to be modified or not (whether the result of their execution depends on
their particular PC). Instead of writing new code from scratch, we should take
advantage of the code already written for the displaced stepping feature in
GDB, as AArch64 does. To make this possible, we first need to decouple the
instruction decoding part from GDB, so that the code can eventually be moved to
a shared location.

Patch 1 replaces the GDB-specific arguments of the instruction decoding
functions by a pointer to a structure/closure, so that different contexts can
provide different parameters.

Patch 2 refactors the functions in arm-tdep.c to isolate the instruction
decoding bits specific to displaced stepping in a single function. It renames
the other functions to show that they are not specific to displaced stepping
anymore.

Future patches will complete this work by implementing a visitor pattern
similar to AArch64 and moving the code to the arch/ directory.

Simon Marchi (2):
arm-tdep.c: Replace arguments to relocation functions by a structure
arm-tdep.c: Refactor displaced stepping relocation functions

gdb/arm-tdep.c | 947 +++++++++++++++++++++++++++------------------------------
1 file changed, 456 insertions(+), 491 deletions(-)

--
2.5.1