From: Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
To: Ulrich Weigand <uweigand@de.ibm.com>
Cc: gdb@sourceware.org, Richard Earnshaw <rearnsha@arm.com>,
dan@codesourcery.com
Subject: Re: ARM prologue parsing support for Thumb-2 instructions?
Date: Mon, 19 Jul 2010 08:51:00 -0000 [thread overview]
Message-ID: <1279529477.3466.25.camel@e102319-lin.cambridge.arm.com> (raw)
In-Reply-To: <201007161703.o6GH3XoP011062@d12av02.megacenter.de.ibm.com>
Ulrich,
On Fri, 2010-07-16 at 18:03 +0100, Ulrich Weigand wrote:
> Hello,
>
> in testing GDB on an armv7l-linux-gnueabi board running Ubuntu
> Maverick
> I noticed serious problems with getting backtraces out of system
> libraries.
>
> Looking into this, it turns out that arm_analyze_prologue appears to
> have
> no support at all for decoding Thumb-2 instructions. (There is some
> support for Thumb-2 in arm_skip_prologue, but not for unwinding.)
If gdb is using arm_analyze_prologue and not thumb_analyze_prologue for
Thumb (1 or 2) code then gdb is not guessing the instruction state
correctly.
I submitted a patch earlier this year
(http://sourceware.org/ml/gdb-patches/2010-03/msg00168.html) to try to
improve gdb's heuristic for determining the instruction state which may
help - although in that particular use case it was for
single-stepping.
Note though that it may just not be possible to make a 100% accurate
statement without some form of debugging symbols present - just mapping
symbols ($a, $d, $t) would be enough for determining the instruction
set.
> Since Thumb-2 is the default code generation option on this system,
> this
> makes it just about impossible to backtrace out of any code that does
> not
> come with debug information.
Trunk thumb_analyze_prologue does have support for Thumb-2. However,
thumb_analyze_prologue will stop analyzing the prologue as soon as it
sees an instruction which it does not understand as part of a prologue
sequence. This is the opposite from arm_analyze_prologue, which knows
which non-prologue sequence instructions are safe to ignore and which
are not.
Fixing thumb_analyze_prologue to behave like arm_analyze_prologue is on
my list of things to do, but it is not going to happen immediately. So
if you want to have a go at fixing this please feel free.
A related issue with backtracing through system calls is that inline
syscalls in glibc corrupt the frame pointer (during the syscall) so that
if you try to backtrace when at a syscall you get garbage. This was
fixed in this glibc patch:
http://sourceware.org/ml/libc-ports/2010-04/msg00001.html.
Thanks,
Matt
--
Matthew Gretton-Dann
Principal Engineer - PDSW Tools
ARM Ltd
next prev parent reply other threads:[~2010-07-19 8:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-16 17:03 Ulrich Weigand
2010-07-16 19:37 ` Daniel Jacobowitz
2010-07-19 8:51 ` Matthew Gretton-Dann [this message]
2010-07-19 10:59 ` Ulrich Weigand
2010-07-19 14:10 ` Daniel Jacobowitz
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=1279529477.3466.25.camel@e102319-lin.cambridge.arm.com \
--to=matthew.gretton-dann@arm.com \
--cc=dan@codesourcery.com \
--cc=gdb@sourceware.org \
--cc=rearnsha@arm.com \
--cc=uweigand@de.ibm.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