This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: Displaced stepping 0002: refactor and create some copy helpers
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: yao at codesourcery dot com (Yao Qi)
- Cc: gdb-patches at sourceware dot org
- Date: Mon, 28 Feb 2011 18:36:45 +0100 (CET)
- Subject: Re: Displaced stepping 0002: refactor and create some copy helpers
Yao Qi wrote:
> The patch continues to refactor code, in order to
> 1) make copy functions separated for ARM and Thumb,
I think it makes sense to split the copy functions into the part that actually
decodes the instruction and installs the target instruction (which depends on
ARM vs. Thumb), and the part that sets up registers and installs the cleanup etc.
(which only depends on the semantics of the instruction, not its encoding).
For symmetry, I'd then prefer if *all* copy functions were split up that way
(in the end, you'll probably need all of them anyway, since just about all
ARM instructions have an alternate encoding as Thumb/Thumb-2).
> 2) define some copy helper functions for some ARM and Thumb-2 instructions.
These look really awkward to me, what with the union and all those function
pointers ... It seems preferable to me to keep instruction decoding
between ARM and Thumb fully separate, even if this means we have a small
amount of duplication.
> -copy_unmodified (struct gdbarch *gdbarch, uint32_t insn,
> - const char *iname, struct displaced_step_closure *dsc)
> +arm_copy_unmodified (uint32_t insn, const char *iname,
> + struct displaced_step_closure *dsc)
Again for symmetry reasons, it's probably better if *all* copy_ functions
get the gdbarch, even if they currently don't need it.
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com