mongodb - gdb breakpoint on base class, but failed -


in mongodb, class cursor defined 'cursor : boost::noncopyable', , there many class derived it. want know given operation client, xxxcursor used. want set breakpoint on cursor::cursor. failed.

(gdb) b mongo::cursor::cursor class mongo::cursor not have method named cursor hint: try 'mongo::cursor::cursor<tab> or 'mongo::cursor::cursor<esc-?> (note leading single quote.) make breakpoint pending on future shared library load? (y or [n]) n  (gdb) ptype mongo::cursor type = class mongo::cursor : private boost::noncopyable_::noncopyable {   public:     ~cursor(int);     virtual bool ok(void);     bool eof(void);     virtual mongo::record * _current(void);     virtual mongo::bsonobj current(void);     virtual mongo::diskloc currloc(void);     virtual bool advance(void);     virtual mongo::bsonobj currkey(void) const;     .... } (gdb) list mongo::cursor::cursor **the class mongo::cursor not have method named cursor hint: try 'mongo::cursor::cursor<tab> or 'mongo::cursor::cursor<esc-?>** (note leading single quote.) 

but wrote similar program

#include <iostream> #include <boost/utility.hpp> class base : boost::noncopyable { public:     void printx() {std::cout<< getx() <<"\n" ;}     virtual int getx()=0; };   class p : public base { public:     int x;     virtual int getx() { return x*3;}     p(int c){ x= c;} };  int main(){     p p(2);     p.printx();     return 0; } 

i can set breakpoint on base::base sucessfully.

do have idea why can't set breakpoint on mongo::cursor::cursor ?

mongo::cursor definied here: https://github.com/mongodb/mongo/blob/master/src/mongo/db/cursor.h

as example. if compile this:

g++ -o0 -g -m64 -i ./boost_1_53_0 main.cpp 

i can set breakpoint on base::base , see base::base symbol:

>nm -c a.out | grep base::base 0000000000400a4e w base::base() 

if compile compile (with optimization level o2):

g++ -o2 -g -m64 -i ./boost_1_53_0 main.cpp 

i don't see base::base symbol:

>nm -c a.out | grep base::base > 

and can't set breakpoint:

(gdb) b base::base class base not have method named base hint: try 'base::base<tab> or 'base::base<esc-?> 

so first step make sure there mongo::cursor::cursor symbol in program or shared library. can optimized out.


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -