Help understanding Debug!

Monkey Archive Forums/Monkey Discussion/Help understanding Debug!

SLotman(Posted 2013) [#1]
Guys,

I need your help - I have to make a presentation at my University in two weeks, and I talked my teacher into presenting Monkey :)

I understand how the whole "translating" thing happens - but one thing that got me thinking is how the debug in glfw works.

How does exactly Monkey knows when you place a "debugstop" or when the compiled code crashes, which line on *my code* was the one responsible?

Does Monkey stores or generates somehow a list of lines written in monkey, and their translated code counterparts?

How can I even do step by step debugging in Monkey, when all Monkey does is translate the code?


slenkar(Posted 2013) [#2]
Look at the generated code and you will see:
Does Monkey stores or generates somehow a list of lines written in monkey, and their translated code counterparts?

yep, simple but ingenious solution


AdamRedwoods(Posted 2013) [#3]
How does exactly Monkey knows when you place a "debugstop" or when the compiled code crashes, which line on *my code* was the one responsible?


every single monkey line gets a debugger line of code that sets the last place it has been to. so when the exe picks up a crash or debug stop, it pulls the data from that. DBG_LOCAL sets the variables so you can read variable data in the debugger as well.
DBG_LOCAL(t_arr,"arr")
DBG_LOCAL(t_i,"i")
DBG_INFO("C:/Monkey/modules/monkey/list.monkey<20>");


it slows down execution, but it is extremely helpful.


SLotman(Posted 2013) [#4]
Hah! That makes things much clear! Thank you so much!!!