Must have been asked before but is there a way to examine the PB call stack programmatically at run-time?
TIA
Larry Peters
Must have been asked before but is there a way to examine the PB call stack programmatically at run-time?
TIA
Larry Peters
Thanks Arthur.
Now to see if it will work for me.
Best Regards
Larry
Hi Arthur,
Thank you very much for the effort on my behalf.
However I need to stretch your goodwill as I'm still running with PB2017 R3 1880. Will the DLL you so kindly provided work with this release or will I need a PB2017-specific version? I know I could test it to find out but since I won't do that till boxing day I thought I'd ask the question.
Again, thank you so very much.
Best Regards and Merry Christmas
Larry
Hi
I cloned the git repository, created objects and a project for PB2019 (R2) and compiled it with the latest VS version.
You can download the DLL from https://drive.infomaniak.com/app/share/124668/29128503-51f4-44f8-80de-d02d721f5fd4. Import the sr* files from the zip subfolder into your project and copy the DLL to your "main" folder.
The stack trace can be called with:
string ls_Stack[]
stack_trace( ls_Stack )
I did not test any of the other functions.
Regards
Arthur
N.B. Jeremy put a lot of work into this! I did a simple adaption and compilation.
Thanks John,
Yes, that does appear to be a fallback solution which I'm still considering. Trouble is there are many functions (>20) and each would need it's own unique memory variable and also every early exit from the functions would need to reset the variable. It's possible and doable but I'm still hoping for a "call stack" solution.
I found some C++ code in GitHub https://github.com/lakeman/fastfuncs written by Jeremy Lakeman in 2011 which appears to be able to query the call stack. I'm not that savvy with C++ so I haven't yet been able to compile it to test it. Maybe someone can help me with instructions on how to compile a PowerBuilder-useable DLL?
Best Regards
Larry
Hi, Larry -
Could you add a global or instance boolean (depending if the function is a global function or an object function, you did not elaborate) that the function in question checks when it begins and if True, reports the recursive call? If False, sets it to True, runs, then resets it to False before exiting?
This doesn't give you the execution call stack, but it would let you determine if the function is being invoked recursively.
Regards, John
Thanks Chris,
A quick look at your framework seems to indicate that you provide a way to trace the call stack as part of the PBDEBUG method.
Let me describe my need: I believe a function in my app is being called recursively causing a crash which bypasses SystemError. So I was looking to test in that function whether it had been called before in the call stack. Which is why I was looking for a way to examine the call stack. I'm not sure if your framework would help me...
However, if there exists another way to trap the recursive error I would love to know what it is.
Thanks and Regards
Larry
Hi Larry;
FYI: http://community.appeon.com/index.php/qna/q-a/call-stack-availabile-in-pb-error-object
HTH
Regards ... Chris