Get versioned minsyms from dynamic symtab (Was: Re: How to call operator<< functions?)
Michael Veksler
mveksler@techunix.technion.ac.il
Thu Aug 31 13:02:00 GMT 2006
Frederic RISS wrote:
> On Thu, 2006-08-31 at 15:09 +0300, Michael Veksler wrote:
>
>
>> Great, now std::cout does not cause crashes. Still there is the problem of
>>
>> (gdb) p std::cout
>> $1 = <incomplete type>
>>
>> But that's unrelated, right?
>>
>
> Yes, unrelated.
> This should work if you've got a version of libstdc++ compiled with
> debug info. If you don't, then GDB can't find std::cout's type. This
> works for me once the library is loaded (i.e. once the inferior is
> running):
>
>
Sounds reasonable, however look at the end for my test.
> (gdb) ptype std::cout
> type = struct std::basic_ostream<char,std::char_traits<char> > {
> <incomplete type>
> }
> (gdb) start
>
...
> (gdb) ptype std::cout
> type = class std::basic_ostream<char,std::char_traits<char> >
> : public virtual std::basic_ios<char,std::char_traits<char> > {
>
Take the two files from my test case in:
http://sources.redhat.com/ml/gdb/2006-08/msg00271.html
=> gdb-6.5 -silent a.out
Using host libthread_db library "/lib/tls/libthread_db.so.1".
(gdb) b 30
Breakpoint 1 at 0x8048a62: file cout-gdb.cpp, line 30.
(gdb) r
Starting program: /home/veksler/a.out
Enter B::Print() this=0xbfffec00
Breakpoint 1, main () at cout-gdb.cpp:30
warning: Source file is more recent than executable.
30 return forceLink;
(gdb) p x.Print(std::cout)
Enter B::Print() this=0xbfffec00
$1 = void
(gdb) p x.Print(myCout)
Cannot resolve method B::Print to any overloaded instance
(gdb) p x.Print(std::cout)
Cannot resolve method B::Print to any overloaded instance
(gdb)
==============
What is going on here. Why the second Print(std::cout) no longer works?
Let's try to rerun without exiting GDB:
=============
(gdb) r
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /home/veksler/a.out
Enter B::Print() this=0xbfffec00
Breakpoint 1, main () at cout-gdb.cpp:30
30 return forceLink;
(gdb) p x.Print(std::cout)
Cannot resolve method B::Print to any overloaded instance
(gdb)
===========
Still does not work!?
Is it related to your patch?
Michael
More information about the Gdb
mailing list