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: Unwinding stack past main() when it has another name


On Thu, 16 Jun 2005 12:16 am, Daniel Jacobowitz wrote:
> On Wed, Jun 15, 2005 at 10:46:37PM +1000, Hamish Rodda wrote:
> > Hi,
> >
> > I'm just curious if there's a better solution for a problem I've come up
> > against recently.  I have been using gdb 6.3 and finding that all of my
> > kde program backtraces contain hundreds of irrelevant and corrupt-looking
> > frames. Upgrading to cvs fixed most of the problem (the corrupt looking
> > frames), but some frames still remain before the main function, which in
> > kde programs is called kdemain().
> >
> > Is there something the kde sources can do to have gdb recognise kdemain()
> > as the replacement main() function, and thus prevent gdb from unwinding
> > past it?
>
> Is there really no main() on the backtrace?  There's no easy way in C
> to mark another function as main or as not-backtraceable.

Yep... here's a snippet:

#21 0x00002aaaacab22fa in QApplication::exec () at 
kernel/qapplication.cpp:2522
#22 0x00002aaaaabd0a84 in kdemain (argc=<value optimized out>, 
argv=0x7fffffbd8ce8) at /opt/kde4/src/kdebase/kate/app/kwritemain.cpp:696
#23 0x00002aaaaf227d95 in __libc_start_main () from /lib/libc.so.6
#24 0x00000000004007ea in _start () at ../sysdeps/x86_64/elf/start.S:113

In gdb 6.3 on amd64, this trace would be follwed by approx 800 - 1000 useless 
"frames".

I don't exactly know why or how the kdemain() function works, but I know it 
has something to do with kdeinit... there's some comments in the source in 
the kde svn repository, under kdelibs/kinit/*

Cheers,
Hamish.

Attachment: pgp00000.pgp
Description: PGP signature


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