What I did was placed a breakpoint in Lazarus on same line as assert and then tried to step into it using the ide.
- my RTL had full debug info (that needs to be done outside the IDE)Hi @Martin_fr and 'how' does one do this please?
- my RTL had full debug info (that needs to be done outside the IDE)Hi @Martin_fr and 'how' does one do this please?
EDIT: make all OPT="-g -gl ?afaik it is make all DEBUG=1
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
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.
Thank you @TRon I will experiment with all the options and get back to you..EDIT: make all OPT="-g -gl ?afaik it is make all DEBUG=1
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?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?
Thank you Mark.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
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
Sorry, I think I've been caught by that one before.
It's not exactly intuitive though...
How to make it more intuitive?
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.
I'm sorry, that sounded excessively critical.
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 :)
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-)
It is in system.inc
Procedure fpc_assert(Const Msg,FName:Shortstring;LineNo:Longint; ErrorAddr:Pointer); [Public,Alias : 'FPC_ASSERT']; compilerproc; begin if codepointer(AssertErrorProc)<>nil then AssertErrorProc(Msg,FName,LineNo,ErrorAddr) else HandleErrorAddrFrameInd(227,get_pc_addr,get_frame); end;
Mind that this is an intrinsic. As you can see the boolean result of the condition is not in the parameters => that code is inlined into your calling procedure. So the above is only called, if the condition fails.
Afaik it then depends. If any unit in your app (including recursively any unit you used) uses "SysUtils then it throws an exception.
And if you want you can catch that exception.
https://wiki.freepascal.org/Debugger_StatusMany thanks for the link..
LLDB like GDB is a command line debugger, that you can download. It supports Linux, Win and Mac.Ok..
In the IDE it was added as "LLDB with FpDebug" for Mac, since the pure "FpDebug" does not work for Mac.Ah, I see now..
"LLDB (Alpha)" without FpDebug was just a by product. It exists, but has no support. (hence Alpha).Hmm.. interesting.
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...)Thank you for taking the time to explain all this, very much appreciated.
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)Your joking right? 'Who' debuuged from a 32bit IDE into a 64bit project that is not going to end well as MarkMLI would say. You have to be insane to do something like that or simply did not know better?
Your joking right? 'Who' debuuged from a 32bit IDE into a 64bit project that is not going to end well as MarkMLI would say. You have to be insane to do something like that or simply did not know better?
It is in system.inc
Procedure fpc_assert(Const Msg,FName:Shortstring;LineNo:Longint; ErrorAddr:Pointer); [Public,Alias : 'FPC_ASSERT']; compilerproc; begin if codepointer(AssertErrorProc)<>nil then AssertErrorProc(Msg,FName,LineNo,ErrorAddr) else HandleErrorAddrFrameInd(227,get_pc_addr,get_frame); end;
Mind that this is an intrinsic. As you can see the boolean result of the condition is not in the parameters => that code is inlined into your calling procedure. So the above is only called, if the condition fails.
Afaik it then depends. If any unit in your app (including recursively any unit you used) uses "SysUtils then it throws an exception.
And if you want you can catch that exception.
And as one might also conclude from that code: one can replace AssertErrorProc if one wants. For example the mentioned throwing of an exception is accomplished by the SysUtils unit setting AssertErrorProc in its initialization section.
Is the above correct?You could ask chat gpt :D
I did ask and chatGPT said please go ask the gods. So I did :)QuoteIs the above correct?You could ask chat gpt :D
Over the years I have learned that some of the things I take for granted (as in "how else could you possible do that") are anything but that. And that there are other ways to it. Even if those other ways don't work for me, they still make sense.True... been there, done that :) recently with a Arduino Nano and getting Laz-IDE to talk to it ( bi-directional) and MarkMLI freaked out and wanted to know "why are you using file operations on a serial comm port" and he was right to ask but I could not for the life of me get Synapse to be my friend or suss out how Synapse wants things done so I went old school and the thing is my file operations worked!
Maybe someone has some IDE add on, that only comes for 32bit (e.g. requires a dll that only exists in 32bit)? That can happen if you write software to control external legacy hardware (and you need it to work in the designer too), and the drivers are 32bit. If that is industrial, then new hardware may cost 5 or 6 digits figures.Oh yes that... I totally forgot the rather pricey industrial aspect!