Peter.Schauer wrote:

> > c++ -O2 lib.cpp -c
> 
> This line is causing the problem.
> Try
> c++ -g -O2 lib.cpp -c
> and you should get better results.
> 
> GDB cannot display the proper line number for modules compiled without -g.
> GDB also does not step into functions compiled without -g and executes
> a `next' (step over) instead, which explains why you end up back in `main'
> after a step into `problem'.

hmm, i think you didn't realize the real problem: Maybe i have to clearify:

I don't expect that gdb shows me information for a file compiled without -g.
But i expect that it does not show WRONG informaton for such files.

if i compile the given example (without changes) gdb says for the command
'info line * 0x8048660' (it's the address of function 'problem')

gdb> Line 23 of "cctest.cpp" starts at address 0x8048652 <main+66>
gdb>    and ends at 0x80486c0 <__tf4Test>.(

gdb shows wrong line and wrong file information.

Now i just remove the keyword 'virtual' from file Class.h, compile again 
and redo the gdb-command:

gdb> No line number information available for address 0x80485f0
gdb> <problem__Fv>

Ok, that output is correct!
(it is also correkt with keyword 'virtual' but without the functionbody!)
(Anyway, note that there is no reference to the class defined in file 
Class.h)


Best regards
Henning Moll

_______________________________________________
Bug-gdb mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-gdb

Reply via email to