简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM