Page 1 of 1

conditional breakpoint gets removed

Posted: Wed Nov 30, 2022 3:56 am
by systemdlete

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.


Re: conditional breakpoint gets removed and program crashes

Posted: Sat Dec 03, 2022 2:27 am
by eranif

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...


Re: conditional breakpoint gets removed and program crashes

Posted: Sat Dec 03, 2022 4:16 am
by systemdlete

Indeed. In fact, at https://sourceware.org/gdb/onlinedocs/g ... Conditions, it even says:

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:

Code: Select all

(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")

Re: conditional breakpoint gets removed and program crashes

Posted: Sat Dec 03, 2022 4:27 am
by systemdlete

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.