From: Mark Kettenis <mark.kettenis@xs4all.nl>
To: jan.kratochvil@redhat.com
Cc: gdb-patches@sourceware.org
Subject: Re: [patch] Stop runaway unwinding on stripped executables
Date: Fri, 16 Mar 2012 16:14:00 -0000 [thread overview]
Message-ID: <201203161614.q2GGEP8M030953@glazunov.sibelius.xs4all.nl> (raw)
In-Reply-To: <20120316144557.GA22309@host2.jankratochvil.net> (message from Jan Kratochvil on Fri, 16 Mar 2012 15:45:57 +0100)
> Date: Fri, 16 Mar 2012 15:45:57 +0100
> From: Jan Kratochvil <jan.kratochvil@redhat.com>
>
> On Fri, 16 Mar 2012 14:50:56 +0100, Mark Kettenis wrote:
> > In this particular example you're just getting lucky that you're hitting
> > __libc_start_main().
>
> In other cases they end up in 'start_thread' and its caller 'clone' which
> correctly undefines $pc and stops the unwinding.
I was more thinking about the unwinder failing somewhere halfway.
> > That probably wouldn't happen if you're somewhat deeper into the call stack
> > of the (stripped) program that you're trying to debug.
>
> I can only imagine code which does not use -fasynchronous-unwind-tables.
> But normal distros use it, therefore they can numerically unwind anything as
> well as with full debug info.
It's not obvious to me that -fasynchronous-unwind-tables is the
default everywhere and on all architectures. But if it is, than yes,
you have a much better chance of hitting __libc_start_main in your
backtrace.
> Sure the correct solution is to terminate unwinding in '_start'
> (like it is terminated in 'clone'), thanks for refreshing this idea.
Heh, that *is* clever!
> Still GDB could have this workaround for older code.
Not sure about that. It means more code that has to be maintained.
But then I'm not bothered by these long backtraces since they make it
immediately obvious things went off the rails for me.
> > But the implementation and actually the whole idea is *very*
> > glibc-specific.
>
> Yes, I was thinking about it, but glibc is neither arch nor OS specific.
> Where to put it into GDB better?
We have glibc-tdep.c, so sticking it in there, with an appropriate
gdbarch hook seems a logical place to me.
next prev parent reply other threads:[~2012-03-16 16:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-16 12:02 Jan Kratochvil
2012-03-16 13:51 ` Mark Kettenis
2012-03-16 14:46 ` Jan Kratochvil
2012-03-16 16:14 ` Mark Kettenis [this message]
2012-03-16 16:57 ` Jan Kratochvil
2012-03-16 19:28 ` cancel: " Jan Kratochvil
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201203161614.q2GGEP8M030953@glazunov.sibelius.xs4all.nl \
--to=mark.kettenis@xs4all.nl \
--cc=gdb-patches@sourceware.org \
--cc=jan.kratochvil@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox