So I tried to set a conditional breakpoint such as:
!strcmp(varname,"dagnabbit")
Codelite starts to add it to the breakpoints, but then removes it immediately. Are subroutine calls not permitted in conditional breakpoints? I'm looking through the gdb docs to see what it says about this. Conditionals can be an expression, and expressions generally allow for function calls. But maybe codelite does not support this. Or maybe I just don't have the right expression fu.
Last edited by systemdlete on Sat Dec 03, 2022 4:56 am, edited 1 time in total.
I am not using cond breakpoints too often, but when I do, I am using simple expressions such as i = 10
The answer to this is somewhere in the gdb docs...
Break conditions can have side effects, and may even call functions in your program. This can be useful, for example, to activate functions that log program progress, or to use your own print functions to format special data structures
I just tried an example in gdb (invoked at command line, not from codelite), and it does in fact work. I can "info break" and I see my conditional breakpoint listed:
(gdb) b 319 if strcmp(buttons[i],"help")
(gdb) info break
Num Type Disp Enb Address What
1 breakpoint keep y 0x0000000000402b2d in display_list
at checkoff.c:319
stop only if strcmp(buttons[i],"help")
I forgot to mention that I am using codelite from your repo, which is codelite v16.5.0. I am running on Devuan Chimaera (debian bullseye with the shitsemd dleted). I need to also add that my program is statically linked.
I think it is easy enough to run the simple test, above, to recreate the problem. I tried various means of specifying the condition in the input box of the breakpoint dialog. It could be that it is just a matter of getting the right invocation there.