This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch] New gdbarch method "dwarf_cfa_op" and migrate SPARC to it




On 19.4.2017 12:17, Jiong Wang wrote:
Hi,

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_GNU_window_save CFA instruction to toggle the LR signing status.
DW_CFA_GNU_window_save was introduced by SPARC for their register window
feature, here AArch64 want to multiplex this DWARF CFA instruction as
it's in vendor space.  So, a new gdbarch method, dwarf_cfa_op, is introduced.

Are you sure to reuse DW_CFA_GNU_window_save for AArch64 purposes? Because semantics of DW_CFA_GNU_window_save (implied from "window save") mean much more than just fiddling with return address. For example as you learned from dwarf2-frame.c, whole register window needs to be copied.


  SPARC-linux cross gdb build OK.

I have built gdb on sparc64-linux with your changes and no new regressions are introduced in the test suite. So the patch is ok w.r.t. this.

I.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]