makeMonday
makeMonday

Reputation: 2415

GDB: How to print/call parent functions from a child object?

Basically, that is it. I do not manage to call some inherited functions/members from an object in GDB.

For instance, I have this line in my code:

41      std::cout << foo->size() << std::endl;

Which prints the size of 'foo' in console. But when I stop there with GDB and try to print it, I get this:

(gdb) print foo->size()
Couldn't find method foo::size

EDIT

foo declaration is:

class foo : public sc_core::sc_module { ... };

sc_module is a SystemC interface, where the method size() is. sc_core is the namespace. So when I try and get this:

(gdb) print (sc_module*)pipe.name()
No symbol "sc_module" in current context.
(gdb) print (sc_core::sc_object*)pipe.name()
A syntax error in expression, near `)pipe.name()'.

Is there a way that I can call that method from that point?

Thanks a lot :)

Upvotes: 4

Views: 1981

Answers (1)

Tom Tromey
Tom Tromey

Reputation: 22559

You can see this behavior if the method has been optimized out. There may be other reasons as well.

The syntax error in the later example suggests that perhaps your gdb is old. We've fixed bugs like this in more recent releases.

Upvotes: 2

Related Questions