Re: Get versioned minsyms from dynamic symtab (Was: Re: How to call operator<< functions?)

Frederic RISS
2006-08-31T12:26:29Z

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):

(gdb) p std::cout
$1 = <incomplete type>
(gdb) ptype std::cout
type = struct std::basic_ostream<char,std::char_traits<char> > {
<incomplete type>
}
(gdb) start
Breakpoint 1 at 0x8048703: file cout.cc, line 11.
Starting program: /home/rf23/tmp/cout/a.out
main () at cout.cc:11
11 std::cout << "&std::cout is " << &std::cout << std::endl;
(gdb) ptype std::cout
type = class std::basic_ostream<char,std::char_traits<char> >
: public virtual std::basic_ios<char,std::char_traits<char> > {
public:
void basic_ostream(int, const void **,
class std::basic_streambuf<char,std::char_traits<char> > *);
protected:
void basic_ostream(int, const void **);
public:
~basic_ostream(int, const void **);
class std::basic_ostream<char,std::char_traits<char> >
& operator<<(std::ostream& (*)(std::ostream&));
class std::basic_ostream<char,std::char_traits<char> >
& operator<<(std::basic_ios<char, std::char_traits<char> >& (*)(std::basic_ios<char, std::char_traits<char> >&));
class std::basic_ostream<char,std::char_traits<char> >
& operator<<(std::ios_base& (*)(std::ios_base&));
class std::basic_ostream<char,std::char_traits<char> > & operator<<(long);
class std::basic_ostream<char,std::char_traits<char> >
& operator<<(unsigned long);
class std::basic_ostream<char,std::char_traits<char> > & operator<<(bool);
class std::basic_ostream<char,std::char_traits<char> > & operator<<(short);
class std::basic_ostream<char,std::char_traits<char> >
& operator<<(unsigned short);
class std::basic_ostream<char,std::char_traits<char> > & operator<<(int);
class std::basic_ostream<char,std::char_traits<char> >
& operator<<(unsigned int);
class std::basic_ostream<char,std::char_traits<char> >
& operator<<(long long);
class std::basic_ostream<char,std::char_traits<char> >
& operator<<(unsigned long long);
class std::basic_ostream<char,std::char_traits<char> >
& operator<<(double);
class std::basic_ostream<char,std::char_traits<char> > & operator<<(float);
class std::basic_ostream<char,std::char_traits<char> >
---Type <return> to continue, or q <return> to quit---q
& operator<<(long douQuit
(gdb) q