[Lazarus] Conditional Debugger breakpoints not working ?
Michael Van Canneyt
michael at freepascal.org
Mon Feb 20 13:46:03 CET 2023
On Mon, 20 Feb 2023, Martin Frb via lazarus wrote:
> On 20/02/2023 12:31, Michael Van Canneyt via lazarus wrote:
>>
>> I'm trying to set a condition on a breakpoint.
>>
>> I have a local variable aUnit, type string:
>>
>> var
>> aUnit : string;
>>
>> I wish the breakpoint is only triggered when aUnit equals 'termio'.
>>
>> So, in the breakpoint properties dialog, I enter the condition:
>>
>> aUnit='termio'
>>
>> It seems to have no effect whatsoever. The breakpoint is triggered
>> always at
>> the first traversal of the line.
>>
>> I tried variations (uppercase, lowercase) , but to no avail.
>>
>> Looking at the debug internals window, I see that the expression is
>> only (correctly) evaluated by gdb when I move the mouse over the
>> identifier
>> in the sources:
>>
>> (gdb) <ptype AUNIT>
>
> gdb doesn't know pascal strings, or how do an "=" operation on them.
>
> You can try to get $_streq(myvar, "hello") to work....
> https://sourceware.org/gdb/onlinedocs/gdb/Convenience-Funs.html
>
> Or use FpDebug. FpDebug can compare strings.
I suggest you adapt the wiki to clarify all this.
While you're at it, The link in the wiki page to the gdb convenience
functions is broken.
In general, I don't think you can expect the user to know that he should use
$_streq(myvar, "hello"), specially the cmem condition that seems necessary.
Ideally, the IDE could detect a string and transform the expression.
Michael.
More information about the lazarus
mailing list