On 01/19/2018 05:35 PM, Jakub Jelinek wrote: > On Fri, Jan 19, 2018 at 05:33:10PM -0600, Daniel Santos wrote: >> When stepping through tail-call restore stubs the debugger has to assume >> that rsp - 8 is the CFA, although it is not. This is because I did not >> explicitly add any .cfi directives. This patch adds them to the >> tail-call restore stubs, but this is new territory for me, so I would >> appreciate feedback. >> >> I've reg-tested on x86_64, but I still need to test on Solaris and >> Darwin. OK to commit after those tests? > I think you can't assume that the assembler supports .cfi_* directives. > While e.g. libgcc/config/i386/morestack.S uses them unconditionally, > it is guarded with: > if test "$libgcc_cv_cfi" = "yes"; then > tmake_file="${tmake_file} t-stack i386/t-stack-i386" > fi
Ah hah! That explains a lot. Yeah, I wasn't thinking all assemblers would support it but I saw them in the Solaris assembler manual and figured that they were maybe more widely supported than I had thought. > in config.host. E.g. cygwin.S has: > #ifdef HAVE_GAS_CFI_SECTIONS_DIRECTIVE > .cfi_sections .debug_frame > # define cfi_startproc() .cfi_startproc > # define cfi_endproc() .cfi_endproc > # define cfi_adjust_cfa_offset(X) .cfi_adjust_cfa_offset X > # define cfi_def_cfa_register(X) .cfi_def_cfa_register X > # define cfi_register(D,S) .cfi_register D, S > # ifdef __x86_64__ > # define cfi_push(X) .cfi_adjust_cfa_offset 8; .cfi_rel_offset X, 0 > # define cfi_pop(X) .cfi_adjust_cfa_offset -8; .cfi_restore X > # else > # define cfi_push(X) .cfi_adjust_cfa_offset 4; .cfi_rel_offset X, 0 > # define cfi_pop(X) .cfi_adjust_cfa_offset -4; .cfi_restore X > # endif > #else > # define cfi_startproc() > # define cfi_endproc() > # define cfi_adjust_cfa_offset(X) > # define cfi_def_cfa_register(X) > # define cfi_register(D,S) > # define cfi_push(X) > # define cfi_pop(X) > #endif /* HAVE_GAS_CFI_SECTIONS_DIRECTIVE */ > perhaps you need something similar or commonize that (though, without > .cfi_sections, you want the default). > > Jakub Thanks. I like the idea of commonizing the macros for consistency. As far as adding tests, I guess I would need to dig into lib/gcc-gdb-test.exp to figure out how to do that. Daniel