Re: [fpc-pascal] FPC Backtrace
On 2022-01-03 23:45, Graeme Geldenhuys wrote: On 2022-01-03 13:28, James Richters via fpc-pascal wrote: I’m curious if there is some way, perhaps with some directive or something to force a debug backtrace to happen, but without an error. Christo already offered you a solution, but to offer an alternative solution... Most IDE debugging functionality (or even GDB directly) allows you to set a Breakpoint with iteration count or some other expression. Here is the details for Lazarus breakpoint properties, if that might help. https://wiki.freepascal.org/IDE_Window:_Breakpoints#Breakpoint_properties Regards, Graeme ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPC Backtrace
On 2022-01-03 13:28, James Richters via fpc-pascal wrote: I’m curious if there is some way, perhaps with some directive or something to force a debug backtrace to happen, but without an error. Christo already offered you a solution, but to offer an alternative solution... Most IDE debugging functionality (or even GDB directly) allows you to set a Breakpoint with iteration count or some other expression. So instead of the default, triggering the breakpoint instantly, you can trigger in with a different criteria. Once the breakpoint is triggered, then you can look at the Call Stack and evaluate local variables and such. Regards, Graeme ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPC Backtrace
That works great!!! Exactly what I was wanting Thank you, James On Mon, Jan 3, 2022 at 3:28 PM James Richters via fpc-pascal mailto:fpc-pascal@lists.freepascal.org> > wrote: I’m curious if there is some way, perhaps with some directive or something to force a debug backtrace to happen, but without an error Try calling Dump_Stack in your code: https://freepascal.org/docs-html/rtl/system/dump_stack.html ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPC Backtrace
On Mon, Jan 3, 2022 at 3:28 PM James Richters via fpc-pascal < fpc-pascal@lists.freepascal.org> wrote: > I’m curious if there is some way, perhaps with some directive or something > to force a debug backtrace to happen, but without an error > Try calling Dump_Stack in your code: https://freepascal.org/docs-html/rtl/system/dump_stack.html ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] FPC Backtrace
I'm curious if there is some way, perhaps with some directive or something to force a debug backtrace to happen, but without an error. I have a function that is getting called twice and should only be called once, so my thought is that if I could go into the routine and put something there that outputs a backtrace.. same as when there is an error in the program.. where it shows the entire list of calls, but not because of an error.. then it would continue to run and I could see the entire chain that resulted in the call each time. I know there are other ways I can find this, but the issue made me wonder if there was a way I could ask for my own backtrace with a command inside the program Because that would be a quick easy way to find all the call chains that get to this function.. And it would be cool to be able to do such a thing, especially on large Complicated projects. James ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal