1. Meta Information for Debugging
- Posted by euphoric (admin) Dec 17, 2014
- 1453 views
Is there anything I can call on from Euphoria code to give me the name of the history of called procedures/functions?
So, for example, in a debug_print() function, I could look at the list and see what procedure/function called the debug_print() function? Obviously, this would be meta-data known by the interpreter/executable, and would be very convenient for debugging.
If we don't have this, I will add $50 to the bounty to incorporate it into Euphoria code.
If there's another/better way to track this (during end-user run-time, NOT during debugging), I would love to hear about it.
2. Re: Meta Information for Debugging
- Posted by ne1uno Dec 17, 2014
- 1459 views
Is there anything I can call on from Euphoria code to give me the name of the history of called procedures/functions?
have you tried
--debugger=simple_debug.e or --debugger=simple_debug.dll using /Eu41/demo/simple_debug.e or built as a dll/so
demo & doc needs more comment. debugger is probably one of the lesser known options.
a combination bounty/poll page might inspire someone to write another example demo.
3. Re: Meta Information for Debugging
- Posted by euphoric (admin) Dec 18, 2014
- 1357 views
Looks like some useful and complicated stuff! I'll check this out. Thank you!
4. Re: Meta Information for Debugging
- Posted by mattlewis (admin) Dec 19, 2014
- 1294 views
have you tried
In particular something like this (this is eu 4.1):
without inline include euphoria/debug/debug.e include std/console.e procedure debug_print() display( call_stack() ) end procedure procedure foo() debug_print() end procedure procedure bar() foo() debug_print() end procedure debug_print() foo() bar()
Matt
5. Re: Meta Information for Debugging
- Posted by ghaberek (admin) Dec 19, 2014
- 1277 views
Is there line counting problem in here somewhere? Perhaps an off-by-one error? Or maybe I'm misunderstanding how call_stack() reports its line numbers?
/* 1 */ /* 2 */ without inline /* 3 */ include euphoria/debug/debug.e /* 4 */ include std/console.e /* 5 */ /* 6 */ sequence cs = call_stack() /* 7 */ display( cs[2..$] ) /* 8 */
{ "<TopLevel>", "C:\\Temp\\debug.ex", 5 <-- call_stack() was called from line 6 }
/* 1 */ /* 2 */ without inline /* 3 */ include euphoria/debug/debug.e /* 4 */ include std/console.e /* 5 */ /* 6 */ procedure debug_print() /* 7 */ sequence cs = call_stack() /* 8 */ display( cs[2..$] ) /* 9 */ end procedure /* 10 */ /* 11 */ debug_print() /* 12 */
{ { "debug_print", "C:\\Temp\\debug.ex", 6 <-- call_stack() was called from line 7 }, { "<TopLevel>", "C:\\Temp\\debug.ex", 10 <-- debug_print() was called from line 11 } }
-Greg
6. Re: Meta Information for Debugging
- Posted by euphoric (admin) Dec 22, 2014
- 1172 views
Wow! Thanks, Matt! That call_stack() function looks to be exactly what I need!
7. Re: Meta Information for Debugging
- Posted by euphoric (admin) Dec 22, 2014
- 1142 views
Matt, your program works fine for me. However, when I add my own function, the program doesn't run and there's no error output. Can you see if this fails for you too? You literally just need to add that debug_printx() function and the program stops working. I'm running Euphoria 4.1 on this PC, Windows 8.
I've drilled down to what seems to be causing the crash, and it looks like the appending of the variable bc. This code runs, but if you uncomment the lines with bc being appended, it suddenly doesn't run for me, whether or not breadCrumb is 1.
Must be an obscure bug, right? Or something so obvious that I'm missing it.
8. Re: Meta Information for Debugging
- Posted by mattlewis (admin) Dec 22, 2014
- 1132 views
Matt, your program works fine for me. However, when I add my own function, the program doesn't run and there's no error output. Can you see if this fails for you too? You literally just need to add that debug_printx() function and the program stops working. I'm running Euphoria 4.1 on this PC, Windows 8.
I've drilled down to what seems to be causing the crash, and it looks like the appending of the variable bc. This code runs, but if you uncomment the lines with bc being appended, it suddenly doesn't run for me, whether or not breadCrumb is 1.
Must be an obscure bug, right? Or something so obvious that I'm missing it.
It seems to work for me. I even added a call to debug_printx().
Matt
9. Re: Meta Information for Debugging
- Posted by mattlewis (admin) Dec 22, 2014
- 1191 views
Is there line counting problem in here somewhere? Perhaps an off-by-one error? Or maybe I'm misunderstanding how call_stack() reports its line numbers?
Could very easily be an off by one error. It's been a long time since I've looked at this code.
Matt
10. Re: Meta Information for Debugging
- Posted by euphoric (admin) Dec 22, 2014
- 1118 views
OK, thanks, Matt. I'll test on a few other PCs.