user379151
user379151

Reputation: 1379

gdb : How to confirm that a breakpoint is set on a function?

I have set about 50 breakpoints in my project. How do I figure out if a breakpoint was set in a particular function? I don't want to use

info breakpoints

as it shows all of them. I just want to confirm if there is a breakpoint on this one function.

Upvotes: 1

Views: 240

Answers (1)

karlphillip
karlphillip

Reputation: 93468

The only approach I know for this is turning on logging, listing the breakpoints and turning it off. Then use cat and grep from within gdb to find your breakpoint by function name.

set logging file breaks.txt
set logging on
info break
set logging off
shell cat breaks.txt | grep function_name

Don't forget to delete the file when you change the breakpoint list because these commands will append logs to the existing file and you don't want that.

I know that someone can probably write a gdb script to automate this task, but this is the main idea.

Upvotes: 1

Related Questions