This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFA: add debug hook to unwinder
On Fri, Jun 12, 2009 at 06:36:41PM -0700, Ian Lance Taylor wrote:
> Tom Tromey <tromey@redhat.com> writes:
>
> >>>>>> "Ian" == Ian Lance Taylor <iant@google.com> writes:
> >
> >>> Hm, and if it is static then the compiler may as well change its calling
> >>> ABI (like for example IPA-SRA might remove the two unused params).
> >>> No idea how to prevent that while still having it being static though ...
> >
> > Ian> Does it matter? The compiler should not change the calling convention
> > Ian> if that convention is not represented correctly in the debug info. If
> > Ian> it is represented correctly in the debug info, gdb should be able to
> > Ian> find the arguments.
> >
> > If the optimizer notices that the arguments are unused, couldn't it
> > elect not to pass them? That would matter, because gdb uses (will use
> > -- the patch isn't in yet) the values to decide what to do.
>
> Makes sense. Pass them to the asm.
You can just use __attribute__((__used__)), then GCC shouldn't be changing
calling conventions.
BTW, does gdb really need debug info for anything other than finding
_Unwind_DebugHook in libgcc_s? I'm asking because at least most Linux
vendors AFAIK ship with libraries and binaries stripped and unless you are
debugging something in libgcc_s itself, you normally don't need its debug
info, so usually debug info for libgcc_s (when stripped to file) isn't
installed. Ensuring libgcc_s is stripped to file with eu-strip -g -f
libgcc_s.so.1.debug libgcc_s.so.1,
instead of just eu-strip -f libgcc_s.so.1.debug libgcc_s.so.1 is possible,
but not trivial, I wonder if it wouldn't be easier just to export
_Unwind_DebugHook symbol in libgcc_s.so.1's .dynsym, at @GCC_PRIVATE version
(so nothing can link against that symbol and it is clearly something not
supported for other programs (similarly how glibc uses @GLIBC_PRIVATE
symbols for its private APIs)).
Jakub