Recent

Author Topic: How to Debug and Step into Assert() Function in Lazarus?  (Read 3242 times)

Aruna

  • Hero Member
  • *****
  • Posts: 568
Re: How to Debug and Step into Assert() Function in Lazarus?
« Reply #15 on: October 25, 2024, 02:51:22 pm »
FpcUpDeluxe.
I have never used FpcUpDeluxe

Well that or download the sources, and play with Makefiles. (I don't have a link to any instructions)
Yes I usually build from source I find that is easier for me.

Either way, you get a 2nd independent install of FPC => once you got that in the IDE yo u need to change the compiler (Tools > options // or if you prefer in the project settings, something like compile commands)
Thanks Martin I will explore this further when I have time.

Aruna

  • Hero Member
  • *****
  • Posts: 568
Re: How to Debug and Step into Assert() Function in Lazarus?
« Reply #16 on: October 25, 2024, 02:52:46 pm »
EDIT: make all OPT="-g -gl ?
afaik it is make all DEBUG=1
Thank you @TRon I will experiment with all the options and get back to you..

Aruna

  • Hero Member
  • *****
  • Posts: 568
Re: How to Debug and Step into Assert() Function in Lazarus?
« Reply #17 on: October 25, 2024, 02:54:29 pm »
EDIT: make all OPT="-g -gl ?
afaik it is make all DEBUG=1

If you use FpDebug in your IDE I would suggest   OPT="-gl -gw3 -O-1"

-gl is not strictly needed. The info is added with -gw3
And the unit will be added if you compile the project with -gl

Of course if you want nice dumps when the compiler itself crashes => then yes: -gl
I am running linux debian and I went with the default settings when I first installed so I think what I have in the IDE is gdb. How do I change this to FpDebug?

MarkMLl

  • Hero Member
  • *****
  • Posts: 8129
Re: How to Debug and Step into Assert() Function in Lazarus?
« Reply #18 on: October 25, 2024, 03:01:07 pm »
I am running linux debian and I went with the default settings when I first installed so I think what I have in the IDE is gdb. How do I change this to FpDebug?

IDE, Tools -> Options -> Debugger -> Debugger backend -> Change type

I think.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Aruna

  • Hero Member
  • *****
  • Posts: 568
Re: How to Debug and Step into Assert() Function in Lazarus?
« Reply #19 on: October 25, 2024, 03:03:16 pm »
I am running linux debian and I went with the default settings when I first installed so I think what I have in the IDE is gdb. How do I change this to FpDebug?

IDE, Tools -> Options -> Debugger -> Debugger backend -> Change type

I think.

MarkMLl
Thank you Mark.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10687
  • Debugger - SynEdit - and more
    • wiki
Re: How to Debug and Step into Assert() Function in Lazarus?
« Reply #20 on: October 25, 2024, 03:11:39 pm »
I am running linux debian and I went with the default settings when I first installed so I think what I have in the IDE is gdb. How do I change this to FpDebug?

IDE, Tools -> Options -> Debugger -> Debugger backend -> Change type

Not "change type".

Select from the drop button in the toolbar (toolbar on top of the frame).

If not in there, then "add".

That way you can easily change later.

MarkMLl

  • Hero Member
  • *****
  • Posts: 8129
Re: How to Debug and Step into Assert() Function in Lazarus?
« Reply #21 on: October 25, 2024, 05:14:39 pm »
Sorry, I think I've been caught by that one before.

It's not exactly intuitive though...


MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10687
  • Debugger - SynEdit - and more
    • wiki
Re: How to Debug and Step into Assert() Function in Lazarus?
« Reply #22 on: October 25, 2024, 05:46:40 pm »
Sorry, I think I've been caught by that one before.

It's not exactly intuitive though...

How to make it more intuitive?

If you click the "change type" a red warning appears, telling you to use "add" instead.

Changing the type can however be useful in some scenarios. When you have a gdb debugger and want to turn it into a gdb server, changing the type will preserve all options (from the grid) that they both share. Of course "copy" and the "change type" may be an even better idea.
gdb and fpdebug hardly share any options. So change type between them is not of much use. It will work though. But you should then also change the name or it gets confusing.

MarkMLl

  • Hero Member
  • *****
  • Posts: 8129
Re: How to Debug and Step into Assert() Function in Lazarus?
« Reply #23 on: October 25, 2024, 07:30:19 pm »
How to make it more intuitive?

I'm sorry, that sounded excessively critical. It's just that irrespective of whether that top line is a menu or the tabs on a multipage control (without the visual hint of tab outlines), it's unusual to get a dropdown in the same place. A bit of a mixed metaphor...

Quote
Changing the type can however be useful in some scenarios. When you have a gdb debugger and want to turn it into a gdb server, changing the type will preserve all options (from the grid) that they both share. Of course "copy" and the "change type" may be an even better idea.
gdb and fpdebug hardly share any options. So change type between them is not of much use. It will work though. But you should then also change the name or it gets confusing.

Yes, and using a gdb server is about the only way of debugging something that runs as root (or with enhanced capabilities).

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10687
  • Debugger - SynEdit - and more
    • wiki
Re: How to Debug and Step into Assert() Function in Lazarus?
« Reply #24 on: October 25, 2024, 07:43:39 pm »
Sorry on getting off topic...

I'm sorry, that sounded excessively critical.

It didn't, not at all.
And you are not the only one who got that wrong.

So I am genuinely looking for answers how to improve it.

It seems there is a similar issue on the "user defined markup" with adding lists (aka groups).

Yet, on the Display>Colors page, it does seem to work. Or maybe people rarely need to change stuff in the toolbar?
Though on 2nd thought the color|priority buttons may not be well known, but then that is expert territorial.



The drop-buttons could probably be replaced by real comboboxes. Not sure if they will stick out like a sore thumb, but maybe that is exactly what they need to do?
And then they don't expand to the length of their content....

Maybe just give the thing a diff color, but changing colors always goes wrong when users meddle with the IDE colors (suck as dark theme)

MarkMLl

  • Hero Member
  • *****
  • Posts: 8129
Re: How to Debug and Step into Assert() Function in Lazarus?
« Reply #25 on: October 25, 2024, 07:59:19 pm »
I don't think that many people fiddle with the colours, or with keyword etc. markup (noting the recent thread, which seemed to be new ground for a lot of people).

Looking at those various setup pages, I suspect that on the others (colours etc.) the user's expectations are guided by the combination of short legends on the leftmost, and (on gtk2) the depressed outline. Those visual hints aren't nearly as strong on the "busier" debugger backend page, where the leftmost legend is much longer... I'm not sure if that really is an issue, or if it's entirely down to everybody pretty much having to use the debugger page and hardly anybody fiddling with colours.

Similar apologies to OP for waylaying the thread, but if the choice of debugger is significant in the problem I think it's justified.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Aruna

  • Hero Member
  • *****
  • Posts: 568
Re: How to Debug and Step into Assert() Function in Lazarus?
« Reply #26 on: October 26, 2024, 04:23:44 am »
Sorry on getting off topic...
How is a debugger and debugger-related dialogue off-topic? 'I' do not think anything said was off-topic as 'I learn with each post when someone says or shares something. All good at my end :)

Aruna

  • Hero Member
  • *****
  • Posts: 568
Re: How to Debug and Step into Assert() Function in Lazarus?
« Reply #27 on: October 26, 2024, 04:28:40 am »
Similar apologies to OP for waylaying the thread, but if the choice of debugger is significant in the problem I think it's justified.
If 'you' or anyone apologizes again for sharing what to 'me' is very useful information you leave me no choice but to say for $DIETY's sake Mark  8-)

Aruna

  • Hero Member
  • *****
  • Posts: 568
Re: How to Debug and Step into Assert() Function in Lazarus?
« Reply #28 on: October 26, 2024, 02:42:08 pm »
Hello @MarkMLl and @Martin_fr,

I tested what you both said and the first screenshot shows the warning in red and I have a question about the second screenshot what are all of those? I have never seen a LLDB Debugger (Alpha) before??

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10687
  • Debugger - SynEdit - and more
    • wiki
Re: How to Debug and Step into Assert() Function in Lazarus?
« Reply #29 on: October 26, 2024, 03:08:23 pm »
https://wiki.freepascal.org/Debugger_Status

LLDB like GDB is a command line debugger, that you can download. It supports Linux, Win and Mac.

In the IDE it was added as "LLDB with FpDebug" for Mac, since the pure "FpDebug" does not work for Mac.

"LLDB (Alpha)" without FpDebug was just a by product. It exists, but has no support. (hence Alpha).

FpDebug only supports the Intel/Amd architecture, so for other targets other debuggers are needed. And also for cross debugging and embedded other debuggers are needed. (though there is an FpDebug based debugger for some avr embedded...)


On Windows, gdb is still shipped with the IDE => so that can be used. However it delivers a significantly lesser experience. There are a very few edge cases where it still may be useful. (like in some scenarios, when debugging inside the windows kernel, it gives longer stack traces // or cross debugging from a 32bit IDE to a 64bit project -> really should use the 64bit IDE instead)
« Last Edit: October 26, 2024, 03:12:24 pm by Martin_fr »

 

TinyPortal © 2005-2018