This is the mail archive of the gdb@sources.redhat.com 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: Thread backtrace termination


Daniel Jacobowitz wrote:
On Mon, Jul 11, 2005 at 05:20:55PM +0100, Jonathan Larmour wrote:

The two "global constructors keyed to cyg_scheduler_start" lines are bogus frame entries, although those also happened with GDB 6.1. The "corrupt stack" whinge is new, and is treated as an error, including terminating gdbinit scripts etc.


This is already changed in CVS.

Okay. I haven't seen that. It still looks like an error to me in frame.c.


BTW, my other web searches seem to indicate that a fair few (naive) people are thinking they are having stack corruption because GDB thinks there might be. That's unfortunate.

I'd be interested if someone could clarify to me what the termination conditions for a backtrace actually _are_. i.e. as an OS author, how do I initialise a thread context to persuade GDB to stop when it reaches the innermost frame.

In general there's no defined way to do this. If the start routine is written in assembly, take a look at the example I posted earlier this year of using dwarf2 unwind information to terminate a backtrace by marking the return address column as undefined. There's a matching GDB patch, which was committed to HEAD after 6.3.

I've had a search for this and not found anything. I'm probably just not using the right terms. Do you have a pointer, time frame or some search terms I can use to pin this down? Thanks.


For compiler-generated code there's really no useful way to do this.

I guess atleast now I know that, which saves me spending more time.


Wouldn't it make sense to make such a convention though, such as having a return address of 0?

Alternatively, how about adding a new command that allows you to define a set of entry point symbol names? People can then put an appropriate list for themselves or their OS in ~/.gdbinit. Or it can be pre-initialised by the OS support within GDB if there is one. e.g. nm-linux.h. Here's what I'm thinking of:

set entry-point-name-list main _start _entry

Although handling mangled symbols and multiple languages might be fun. I'm not an expert on such things.

Thanks,

Jifl
--
eCosCentric    http://www.eCosCentric.com/    The eCos and RedBoot experts
--["No sense being pessimistic, it wouldn't work anyway"]-- Opinions==mine


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