From: Tom de Vries Date: Thu, 19 Jan 2023 13:05:08 +0000 (+0100) Subject: [gdb/tdep, aarch64] Remove fp and sp reg aliases, add x31 reg alias X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ea2f6fad7e104fb65da6a438bb0ec753210f1e90;p=binutils-gdb.git [gdb/tdep, aarch64] Remove fp and sp reg aliases, add x31 reg alias In aarch64-tdep.c we find these register aliases: ... { /* 64-bit register names. */ {"fp", AARCH64_FP_REGNUM}, {"lr", AARCH64_LR_REGNUM}, {"sp", AARCH64_SP_REGNUM}, ... The sp alias is superfluous, because the canonical name of x31 is already sp. The fp alias is superfluous, because it's already taken by the default meaning of fp, assigned here in _initialize_frame_reg: ... user_reg_add_builtin ("fp", value_of_builtin_frame_fp_reg, NULL); ... Fix this by removing the fp and sp aliases. While we're at it, add an x31 alias for sp. Approved-By: Luis Machado Tested on aarch64-linux. PR tdep/30012 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30012 --- diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c index b576d3b9d99..7bf36d825c8 100644 --- a/gdb/aarch64-tdep.c +++ b/gdb/aarch64-tdep.c @@ -61,17 +61,20 @@ /* All possible aarch64 target descriptors. */ static std::unordered_map tdesc_aarch64_map; -/* The standard register names, and all the valid aliases for them. */ +/* The standard register names, and all the valid aliases for them. + We're not adding fp here, that name is already taken, see + _initialize_frame_reg. */ static const struct { const char *const name; int regnum; } aarch64_register_aliases[] = { - /* 64-bit register names. */ - {"fp", AARCH64_FP_REGNUM}, + /* Link register alias for x30. */ {"lr", AARCH64_LR_REGNUM}, - {"sp", AARCH64_SP_REGNUM}, + /* SP is the canonical name for x31 according to aarch64_r_register_names, + so we're adding an x31 alias for sp. */ + {"x31", AARCH64_SP_REGNUM}, /* specials */ {"ip0", AARCH64_X0_REGNUM + 16}, {"ip1", AARCH64_X0_REGNUM + 17}