conditional breakpoint gets removed

General questions regarding the usage of CodeLite
systemdlete
CodeLite Enthusiast
Posts: 11
Joined: Thu Nov 24, 2022 9:39 am
Genuine User: Yes
IDE Question: c++
Contact:

conditional breakpoint gets removed

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

Last edited by systemdlete on Sat Dec 03, 2022 4:56 am, edited 1 time in total.
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: conditional breakpoint gets removed and program crashes

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

Make sure you have read the HOW TO POST thread
systemdlete
CodeLite Enthusiast
Posts: 11
Joined: Thu Nov 24, 2022 9:39 am
Genuine User: Yes
IDE Question: c++
Contact:

Re: conditional breakpoint gets removed and program crashes

Post 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")
systemdlete
CodeLite Enthusiast
Posts: 11
Joined: Thu Nov 24, 2022 9:39 am
Genuine User: Yes
IDE Question: c++
Contact:

Re: conditional breakpoint gets removed and program crashes

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

Post Reply