This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, x86, libgcc] PR target/83917 Correct debug for -mcall-ms2sysv-xlogues stubs
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Daniel Santos <daniel dot santos at pobox dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>, Uros Bizjak <ubizjak at gmail dot com>, Jason Merril <jason at redhat dot com>, Cary Coutant <ccoutant at gmail dot com>, Ian Lance Taylor <ian at airs dot com>
- Date: Sat, 20 Jan 2018 00:35:19 +0100
- Subject: Re: [PATCH, x86, libgcc] PR target/83917 Correct debug for -mcall-ms2sysv-xlogues stubs
- Authentication-results: sourceware.org; auth=none
- References: <20180119233310.19670-1-daniel.santos@pobox.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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