On Mon, 20 Feb 2023, Martin Frb via lazarus wrote:

On 20/02/2023 13:46, Michael Van Canneyt via lazarus wrote:


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


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.

This always has been the issue with gdb.

If you had a watch with anything but just a plain variable name, then gdb may give you:
- an error,
- or an incorrect result,
- or the correct result

For watches, there is quite a lot of code in the IDE to try and fix those things. There are testcases, that can be run with different debug-info, and diff gdb versions. (And they run for many hours / and unfortunately still have some errors, some false errors...).

But there is no way to get to 100%. In many cases gdb simple does not give enough info to detect the necessary information on the underlaying type. (And when trying to get this, one has to be carefully not to crash gdb). Also it makes evaluating each individual watch a lot slower (at least factor 3 or 4). Though on that I have always pushed the point that a "correct result" is worth *any* wait time.

Yes. An incorrect result may result in infinite wait time :-)


In any case, with conditional breakpoints it would be even more complex....

It would be nice to have, but with the availability of FpDebug, it is very unlikely that will be fixed. (There are simply a lot of other things that (should) have more priority)

I may add a warning to the breakpoint dlg, that for non-fpdebug will display a red TLabel below the input, with some text that the condition may not work at all.

I think this is a good idea.


It is a problem on Mac, with LLDB. Though I am not even sure that conditional breakpoint are supported at all...

They are:
https://stackoverflow.com/questions/37204551/lldb-setting-conditional-breakpoint-with-string-equality-as-condition


LLDB probably can do them (with restrictions like gdb). But the IDE has absolutely on code to translate "pascal to lldb" => because for watches it can evaluate with fpdebug. But conditional breakpoints must be done by lldb, or they become very very slow. (That is if they need to pass lots of time before they match the condition, and each hit pass 1 second or more, you quickly get to several minutes of wait time)

No problem. I realize it is not easy to solve generally, although a solution for 'simple' strings would be welcome.

I'll stick to poor man's conditionals. Then the compiler will tell me what I do wrong :)

Michael.
--
_______________________________________________
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus

Reply via email to