diff options
author | Jiong Wang <jiong.wang@arm.com> | 2017-04-26 14:05:03 +0100 |
---|---|---|
committer | Jiong Wang <jiong.wang@arm.com> | 2017-04-26 14:05:03 +0100 |
commit | b41c5a85a734b9ca813d4a314b66ef4b4b4d1b11 (patch) | |
tree | 2203099a235d7fbec6066ef8896d4d4ebab0292b /gdb/gdbarch.sh | |
parent | PR ld/21334: Always call `_bfd_elf_link_renumber_dynsyms' if required (diff) | |
download | binutils-gdb-b41c5a85a734b9ca813d4a314b66ef4b4b4d1b11.tar.gz binutils-gdb-b41c5a85a734b9ca813d4a314b66ef4b4b4d1b11.tar.bz2 binutils-gdb-b41c5a85a734b9ca813d4a314b66ef4b4b4d1b11.zip |
[gdbarch] New method "execute_dwarf_cfa_vendor_op" and migrate SPARC to it
Recently a feature called "return address signing" has been added to GCC to
prevent stack smash stack on AArch64. For details please refer:
https://gcc.gnu.org/ml/gcc-patches/2017-01/msg00376.html
GDB needs to be aware of this feature so it can restore the original return
address which is critical for unwinding.
On compiler side, whenever return address, i.e. LR register, is mangled or
restored by hardware instruction, compiler is expected to generate a
DW_CFA_AARCH64_negate_ra_state to toggle return address signing status.
DW_CFA_AARCH64_negate_ra_state is using the same CFI number and
therefore need to be multiplexed with DW_CFA_GNU_window_save which was designed
for SPARC.
A new gdbarch method "execute_dwarf_cfa_vendor_op" is introduced by this patch.
It's parameters has been restricted to those only needed by SPARC and AArch64
for multiplexing DW_CFA_GNU_window_save which is a CFI operation takes none
operand. Should any further DWARF CFI operation want to be multiplexed in the
future, the parameter list can be extended. Below is the current function
prototype.
typedef int (gdbarch_execute_dwarf_cfa_vendor_op_ftype)
(struct gdbarch *gdbarch, gdb_byte op, struct dwarf2_frame_state *fs);
DW_CFA_GNU_window_save support for SPARC is migrated to this new gdbarch
method by this patch.
gdb/
* gdbarch.sh: New gdbarch method execute_dwarf_cfa_vendor_op.
* gdbarch.c: Regenerated.
* gdbarch.h: Regenerated.
* dwarf2-frame.c (dwarf2_frame_state_alloc_regs): Made the
visibility external.
(execute_cfa_program): Call execute_dwarf_cfa_vendor_op for CFI
between DW_CFA_lo_user and DW_CFA_high_user inclusive.
(enum cfa_how_kind): Move to ...
(struct dwarf2_frame_state_reg_info): Likewise.
(struct dwarf2_frame_state): Likewise.
* dwarf2-frame.h: ... here.
(dwarf2_frame_state_alloc_regs): New declaration.
* sparc-tdep.c (sparc_execute_dwarf_cfa_vendor_op): New function.
(sparc32_gdbarch_init): Register execute_dwarf_cfa_vendor_op hook.
Diffstat (limited to 'gdb/gdbarch.sh')
-rwxr-xr-x | gdb/gdbarch.sh | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index a42dc437742..fa85f7cc91b 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -708,6 +708,9 @@ v:int:cannot_step_breakpoint:::0:0::0 v:int:have_nonsteppable_watchpoint:::0:0::0 F:int:address_class_type_flags:int byte_size, int dwarf2_addr_class:byte_size, dwarf2_addr_class M:const char *:address_class_type_flags_to_name:int type_flags:type_flags +# Execute vendor-specific DWARF Call Frame Instruction. OP is the instruction. +# FS are passed from the generic execute_cfa_program function. +m:bool:execute_dwarf_cfa_vendor_op:gdb_byte op, struct dwarf2_frame_state *fs:op, fs::default_execute_dwarf_cfa_vendor_op::0 # Return the appropriate type_flags for the supplied address class. # This function should return 1 if the address class was recognized and |