Reputation: 695
I am trying to set breakpoints on all functions that start with "dc_api" but I must exclude functions that start with "dc_api_port_counter" and "dc_api_send_reply".
Regarding the "dc_api_port_counter" exclusion, note that I do want to include functions that start with "dc_api_port_something".
I used regex online tester and came up with the following regex: dc_api_(?!port_counter|send_reply).*
However, when using it, I get the following error:
>(gdb) rbreak dc_api_(?!port_counter|send_reply).*
>!port_counter|send_reply).*: event not found
>(gdb)
Upvotes: 1
Views: 5204
Reputation: 11
GDB has convenience functions, https://sourceware.org/gdb/onlinedocs/gdb/Convenience-Funs.html, and the $_regex(str, regex) function will correctly handle regex expressions. However, this might be intended for use as the conditional in conditional breaks.
Upvotes: 1
Reputation: 22549
There's no simple, built-in way to do this. However, it can be done a couple of ways.
First, use rbreak
to set "too many" breakpoints. Then, the trick is to find an automated way to delete the extra breakpoints.
A straightforward way to do this is to write a bit of code in Python that loops over all the gdb breakpoints. For each breakpoint it would examine the location
attribute, and, if it should be excluded, call the breakpoint's delete
method.
Upvotes: 2