Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Richard Earnshaw <rearnsha@arm.com>
To: Ulrich Weigand <uweigand@de.ibm.com>
Cc: dan@codesourcery.com, matthew.gretton-dann@arm.com,
	  gdb-patches@sourceware.org
Subject: Re: [rfa] ARM prologue parsing support for Thumb-2 instructions
Date: Fri, 08 Oct 2010 13:17:00 -0000	[thread overview]
Message-ID: <1286543854.29651.15.camel@e102346-lin.cambridge.arm.com> (raw)
In-Reply-To: <201010081254.o98CsxQj011545@d12av02.megacenter.de.ibm.com>


On Fri, 2010-10-08 at 14:54 +0200, Ulrich Weigand wrote:
> Daniel Jacobowitz wrote:
> > On Mon, Jul 19, 2010 at 12:59:05PM +0200, Ulrich Weigand wrote:
> > > > Trunk thumb_analyze_prologue does have support for Thumb-2.
> > > 
> > > Well, all the support for Thumb-2 I can see is in this block:
> > > 
> > >       else if ((insn & 0xe000) == 0xe000 && cache == NULL)
> > >         {
> > >           /* Only recognize 32-bit instructions for prologue skipping.  */
> > > 
> > > which, as the comment says, is active *only* if this routine is
> > > called from arm_skip_prologue (with cache == NULL), but not if the
> > > routine is called from arm_scan_prologue (with cache != NULL),
> > > which is what is used during unwinding.
> > 
> > IIRC, it would not be hard to fill in the missing pieces; I just
> > didn't need them at the time, and could not easily test them.  So
> > rather than risk them being wrong, I left them for later.
> 
> I've finally gotten around to finish my implementation of this.
> 
> The main part of this patch is support in thumb_analyze_prologue for
> various Thumb-2 instructions.  In addition, the patch improves support
> for optimized code by skipping unrecognized instructions instead of
> aborting the prologue scan, and by not relying on line number data to
> determine an upper bound for the end of the prologue.  (Both these
> changes are already in place for the ARM decoder; the patch simply
> brings them over to the Thumb decode as well.)
> 
> Finally, the patch adds support for a couple of more function calls
> that may happen within the prologue: __tls_get_addr and __aeabi_read_tp.
> 
> Tested on armv7l-linux-gnueabi with no regressions.
> 
> In addition, I've run a test with the following line disabled:
>   dwarf2_append_unwinders (gdbarch);
> This causes GDB to ignore DWARF CFI even if present, and always
> fall back to prologue parsing.  With GDB before this patch, that
> test introduces a large number of extra regressions.  *With* this
> patch, nearly all of those regressions are fixed again.  The
> following failures still remain:
> 
> FAIL: gdb.base/call-signal-resume.exp: backtrace
> FAIL: gdb.base/call-signal-resume.exp: dummy stack frame number
> FAIL: gdb.base/call-signal-resume.exp: continue to breakpoint at stop_two
> FAIL: gdb.base/call-signal-resume.exp: continue to receipt of signal
> FAIL: gdb.base/call-signal-resume.exp: continue to breakpoint at handle_signal
> FAIL: gdb.base/call-signal-resume.exp: continue to program exit
> 
> FAIL: gdb.base/foll-vfork.exp: (timeout) vfork parent follow, finish after tcatch vfork
> FAIL: gdb.base/foll-vfork.exp: vfork child follow, finish after tcatch vfork
> 
> FAIL: gdb.threads/attach-stopped.exp: threaded: attach2 to stopped bt
> FAIL: gdb.threads/attachstop-mt.exp: attach0 to sleeping bt
> FAIL: gdb.threads/attachstop-mt.exp: attach3 to stopped bt
> FAIL: gdb.threads/attachstop-mt.exp: attach4 to stopped bt
> FAIL: gdb.threads/pthreads.exp: check backtrace from thread 1
> FAIL: gdb.threads/pthreads.exp: check backtrace from thread 2
> FAIL: gdb.threads/pthreads.exp: apply backtrace command to all three threads
> 
> All these are caused by failures to parse the prologues of hand-written
> *ARM* assembler routines in glibc (system call handlers like nanosleep).
> These simply deviate too far from the usual rules (e.g. by intermixing
> stack saving/restoring of registers with conditional branches, or by
> temporarily saving registers into other registers instead of the stack)
> for the ARM prologue parser to be able to handle them.
> 
> It seems to me that there is not much sense in attempting to support
> even this type of code.  I guess we should strongly recommend to have
> (at least) glibc debuginfo files installed if you want to debug.
> 
> OK for mainline?
> 
> Bye,
> Ulrich
> 
> ChangeLog:
> 
> 	* arm-tdep.c (thumb_expand_immediate): New function.
> 	(thumb_instruction_changes_pc): Likewise.
> 	(thumb2_instruction_changes_pc): Likewise.
> 	(thumb_analyze_prologue): Handle 32-bit Thumb instructions during
> 	prologue parsing.  Improved support for optimized code.
> 	(thumb_scan_prologue): Do not reply on line-number information,
> 	use same heuristics as arm_scan_prologue insead.
> 	(skip_prologue_function): Accept functions
> 	"__tls_get_addr" and "__aeabi_read_tp".

OK.

R.



  reply	other threads:[~2010-10-08 13:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20100719141029.GI6088@caradoc.them.org>
2010-10-08 12:55 ` Ulrich Weigand
2010-10-08 13:17   ` Richard Earnshaw [this message]
2010-10-08 13:32     ` Ulrich Weigand
2010-10-08 13:28   ` Daniel Jacobowitz
2010-10-12 16:56     ` Ulrich Weigand
2010-10-12 20:12       ` Daniel Jacobowitz
2010-10-14 14:10         ` Ulrich Weigand

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=1286543854.29651.15.camel@e102346-lin.cambridge.arm.com \
    --to=rearnsha@arm.com \
    --cc=dan@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=matthew.gretton-dann@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