This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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, x86, libgcc] PR target/83917 Correct debug for -mcall-ms2sysv-xlogues stubs


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
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


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