mlornac
mlornac

Reputation: 1

Gdb set a breakpoint on polymorphic methods

Is it possible to set a breakpoint on a method and all the methods that will override it?

Considering the following code:

struct Foo {
    virtual void a();
};

struct Bar : public Foo {
  virtual void a();
};

Is it possible to set a breakpoint on both 'a' methods using a single command other that rbreak?

Upvotes: 0

Views: 427

Answers (1)

Tom Tromey
Tom Tromey

Reputation: 22579

Unfortunately there is no way to do this right now in gdb.

I think it would be a nice addition. However, it would be quite expensive to use. gdb would have to read all the types in the debuginfo looking for subclasses of Foo.

Upvotes: 1

Related Questions