stepping from header to header in C++

Kris Warkentin
Wed Jun 9 20:42:00 GMT 2004

I've found a bit more and I'm hoping someone can give me a little advice 
on where to start looking.

We have:

main.cpp -> header1.hpp -> header2.hpp

where "->" denotes inclusion.  If I include header2 in main (before 
header1), then everything works fine.

I'm assuming I should be looking in stabsread.c.  It looks like for some 
reason gdb is not considering code from header2 as having debug info 
(even though it shows up in info sources).

Not really sure what I'm asking - mostly just a starting point.  It 
looks like some info is read with 'sym testfile' but more is read when 
setting breakpoints.  Any hints?



Kris Warkentin wrote:

> Wild stab in the dark here.  I'm grepping through the ChangeLogs and 
> Gnats but I'm hoping someone remembers fixing this.
> In gdb 5.2.1 when debugging a C++ app with stabs+, gdb will not step 
> from a method defined in a header to another method defined in a header. 
>  It stops on breakpoints well enough but will only step over.
> ie
> h1.hpp:
> class testclass1{
>  >>> step into this one fine but steps over the next call
>     public: void method1(void){ test_class2.method1(); }
> }
> h2.hpp:
> class testclass2{
>     public: void method1(void){ print_stuff(); }
> }
> The problem seems to be fixed in more recent versions and doesn't exist 
> when compiling with dwarf either.  Not a super critical thing since it's 
> workaroundable but I was hoping someone might remember off the top of 
> their head.
> cheers,
> Kris

More information about the Gdb mailing list