This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [SH][PATCH] Disable ABI frame sniffer


On Fri, Nov 11, 2005 at 11:53:33AM +0000, Andrew STUBBS wrote:
> >See Mark's reply for more on this.  Had you said what your problem
> >really was, we could have saved a couple of back-and-forth exchanges;
> >I'm extremely familiar with the problem of finding clean ways to
> >terminate the backtrace.
> 
> OK, I'm listening. If we can get it so that both the 0xdeadbeef frames 
> (one which comes from the dwarf unwinder - see my posting yesterday) are 
> ignored then that would be a bonus.

What we need is to examine the alternatives for cleanly marking the end
of a stack frame - there are quite a few - and find one which will work
for your situation.

Here's the easiest, in that it only requires changing one of the three
pieces of software involved (runtime, compiler, debugger):

Instead of whatever C language routine you use to start threads, start
them using an assembly wrapper.  Have it set up a non-unwindable frame
using DWARF2 CFI as mentioned in one of my earlier postings in this
thread.  You can do this easily by marking the return address column as
undefined.  Then have it call the C thread start routine.  GDB will
cleanly terminate the backtrace right there  You'll have one more frame
in your stack, but it will be a real frame.

Other alternatives:
  - Add a GCC attribute to mark a function as "never called directly,
    not backtraceable" in the CFI.  Annotate the runtime library to
    mark the thread start routine with this attribute.  I'm not real
    fond of this solution, though.
  - Add a way for a sniffer to indicate "I do recognize how to unwind
    this frame, but I recognize it as the end of the stack" to solve
    the current off-by-one problem.  This could be quite nice...

-- 
Daniel Jacobowitz
CodeSourcery, LLC


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]