paladin-t/my_basic

mb_debug_set_stepped_handler

invpe opened this issue · 3 comments

invpe commented

@paladin-t

Using: mb_debug_set_stepped_handler

Is it possible to identify the line at which the interpreter is currently at or at least that it is on start ?

I have noticed that on any execution, when this callback is called, the value of row = 2.
Does it guarantee that the execution is exactly at the start of the BAS ?

The full signature of the handler is typedef int (* mb_debug_stepped_handler_t)(struct mb_interpreter_t* s, void** l, const char* file, int pos, unsigned short row, unsigned short col);. The row should be correct most of the time, except for some cases, the interpreter cannot determine the information of source code position, then the row would be 0.

invpe commented

Thanks,
What is the pos used for ?

It is an offset relative to the beginning of the source code, it could be used to locate to the specific position quickly, i.e. in a code editor.