[patch 1/2] New gdbarch hook user_register_name

Yao Qi yao@codesourcery.com
Wed Dec 15 10:22:00 GMT 2010


Current GDB has a flexible mechanism adding standard register aliases by
backends, and register/alias name is used as a key to find the
corresponding register number.  However, this mechanism can't handle the
case if different registers have the same alias name.  It sounds a
little bit unreasonable, but 'fp' on ARM/Thumb is this case.

alias 'fp' is assumed to be r11, both in ARM mode and Thumb mode in
current GDB.  However, the expected (or correct) behavior is that 'fp'
is r11 on ARM mode, and 'fp' is r7 on Thumb mode, when user types 'p/x
$fp' in GDB.

Existing GDB can't meet such needs, so this patch is to refactor GDB a
little bit.  In this patch, a new gdbarch hook user_register_name is
added, and its default implementation is to look for register aliases in
user_regs_data, which is same as before in logic.  This patch should not
affect any functions of GDB.

Regression tested on x86_64-unknown-linux.  Comments?

Once this patch is applied, we leave more flexibility to backend to
determine what is the correct register number given a register alias.

-- 
Yao (齐尧)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gdbarch_user_register_name_p1.patch
Type: text/x-patch
Size: 7756 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20101215/dab89372/attachment.bin>


More information about the Gdb-patches mailing list