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)
Appreciate your help.
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.
Related
I get into situations in gdb/ddd where there are too many breakpoints.
I want to disable or remove all of them at once, or all except for one. I find the ddd breakpoints menu confusing and unreliable. How can I do this with a gdb command?
use delete command with no arguments; it can be abbreviated to del or d.
I want to disable or remove all of them at once, or all except for one.
Use disable (with no arguments) to disable all breakpoints, followed by enable N, where N is the breakpoint you want to keep.
Is it possible to write replacement macros for NetBeans?
I need to replace function is_active with function isActive. It seems that is not possible with short regex.
So I wonder is it possible to write such macros?
Crazy macros code....
We cannot use find properly, so I decieded to use find-selection
caret-begin
"function[^(]*_[a-z]"
selection-begin-line
find-selection
remove-selection
find
# there is no loop, so you need to repeat this lines many-many times (too many may hang your IDE)
caret-begin
find-next
caret-forward
caret-backward
delete-previous
to-upper-case
To use this macros you need to set the focus on a document and have turned on regex find option.
Warning, could spoil your code.
Is there a way to tell LLDB to ignore a file, i.e. step over code in that file when debugging?
(This could be used as a workaround for 1, 2, 3)
There is a setting to avoid stepping into functions whose name match a regular expression,
(lldb) set list target.process.thread.step-avoid-regexp
step-avoid-regexp -- A regular expression defining functions step-in won't stop in.
e.g. put this in your ~/.lldbinit file
settings set target.process.thread.step-avoid-regexp ^[^ ]+ std::|^std::
but in Xcode 4.5.x that's the best that can be done. I mentioned in #2 of your links that inlined stepping support has been added to the LLDB sources at http://lldb.llvm.org/ but that won't be in Xcode until the next release.
I want to put breakpoint on all functions of a file. I came across this link : http://sourceware.org/gdb/download/onlinedocs/gdb/Set-Breaks.html#Set-Breaks
It suggest the use of rbreak command for this purpose. When i use "rbreak ." , it works fine as expected and puts breakpoint in all functions of a prog. But when is use
rbreak filename.c:.
This doesn't work at all and no breakpoint is put anywhere. I even tried a variation of this putting spaces around :, but even that doesn't work.
Any idea on how this can be done ? Is it possible at all ?
Any help will be greatly appreciated.
thanks,
vikas
rbreak filename.cpp:.* works fine for me.
Note that in order to put breakpoint in a file you need to compile the program with debug info, e.g
g++ -g filename.cpp
rbreak filename.c:.
That isn't supposed to work. From the document you linked to:
rbreak regex
Set breakpoints on all *functions* matching the regular expression regex.
This is different from locations, where filename.c:... is intended to be used.
I want to put breakpoint on all functions of a file.
This is an unusual request. In my many years of debugging, I've never needed to do that.
You'll have to prepare a list, and set the breakpoints individually. A recipe for doing this can be found here.
I have a class with a regrettable number of methods. I would like gdb to break whenever I enter the class, so through any of the methods. Is there a way to do this without setting break points individually for each method?
I never tried it myself, but it seems you can try the rbreak command :
rbreak regex
Set breakpoints on all functions matching the regular expression regex. This command sets an unconditional breakpoint on all matches, printing a list of all breakpoints it set. Once these breakpoints are set, they are treated just like the breakpoints set with the break command.