Ok so I've been majorly successful implementing "step over" functionality in NESICIDE that works at the C and assembly level. It works by using the debug information available from CC65. It works well enough that it is able to step correctly through Shiru's AlterEgo game programmed in C and assembly. Stepping over things like:
or
or
with a single click.
So I think my technique for "step over" is solid. The only thing it has a "problem" with is for loops. And I don't think it's really a problem because I've seen this behavior in other IDEs. Depending [probably] on optimizations, CC65 turns the start, termination, and incrementor portions of a for statement into separate "lines" of assembly statements all referring to the C source line of the for loop. So, in stepping through a for loop when you hit the bottom of it the cursor will go back up to the for statement and stay there until you click two more times. This is because the first time it's there it's indicating evaluation of the "incrementor" portion. The second time it's indicating evaluation of the "termination" portion. I'm not smart enough yet to highlight only the portion of the for statement being evaluated [a behavior I've seen in other debuggers]...but that might not be too far off. CC65 does not give "column" information in its debug output...so I'd have to figure that out on my own.
ANYWAY...now I'm thinking about "step out". "Step into" is stupidly easy...and is nothing more than "step". So, that one's done. I recall there being some discussion here [even related to NESICIDE itself--but as usual finding the thread is a pain!] regarding the best technique to use to evaluate when to terminate a "step out". I'm thinking it'd be as simple as terminating on the next executed RTS. I know this won't satisfy those that use stack trickery...but I'm interested now in the most useful implementation. Is "execute until you execute an RTS then stop" the most useful implementation?
Code:
ppu_waitnmi();
or
Code:
if(!(i&3)) pal_fade();
or
Code:
jsr initlib
with a single click.
So I think my technique for "step over" is solid. The only thing it has a "problem" with is for loops. And I don't think it's really a problem because I've seen this behavior in other IDEs. Depending [probably] on optimizations, CC65 turns the start, termination, and incrementor portions of a for statement into separate "lines" of assembly statements all referring to the C source line of the for loop. So, in stepping through a for loop when you hit the bottom of it the cursor will go back up to the for statement and stay there until you click two more times. This is because the first time it's there it's indicating evaluation of the "incrementor" portion. The second time it's indicating evaluation of the "termination" portion. I'm not smart enough yet to highlight only the portion of the for statement being evaluated [a behavior I've seen in other debuggers]...but that might not be too far off. CC65 does not give "column" information in its debug output...so I'd have to figure that out on my own.
ANYWAY...now I'm thinking about "step out". "Step into" is stupidly easy...and is nothing more than "step". So, that one's done. I recall there being some discussion here [even related to NESICIDE itself--but as usual finding the thread is a pain!] regarding the best technique to use to evaluate when to terminate a "step out". I'm thinking it'd be as simple as terminating on the next executed RTS. I know this won't satisfy those that use stack trickery...but I'm interested now in the most useful implementation. Is "execute until you execute an RTS then stop" the most useful implementation?