cnext HACK - don't expect to have it working in production...
As a follow up to #25 (closed) Here's a similar one to step over. As-is it is VERY useful to step over PERFORM
or CALL
.
From a quick test this also works when you have comment lines after the current COBOL position - but it won't work if the current line is the last line of an "embedded" copybook (that part could be easily worked around cobcd.py by checking if there is a reference for a higher line in the module, if not go one frame up and possibly use adv +1
there) and most important does not work at the end of a paragraph/program/... - and does not work if at the end of a PERFORM ... UNTIL
(where it leaves the PERFORM
instead of going up to its start - including potential condition checks).
define cnext
set $steps = 1
if $argc == 1
set $steps = $arg0
end
set $i = 0
# TODO: if the current frame is not COBOL: issue cstep instead and increment $i
while $i < $steps
advance +1
set $i = $i + 1
end
# refresh only add this if you want to use GDB's TUI mode
end
document cnext
Continue to the next COBOL source line in the current (innermost) stack frame, often called "Step Over".
This is similar to step, but PERFORM and CALL that appear within the line of code are executed without stopping.
WARNING: Execution does NOT yet stop when control reaches a different line of code at the original stack level
but at the next source line number that was executing when you gave the cnext command.
Usage: cnext [N]
Argument N means step over N times (or till program stops for another reason).
end
Edited by Simon Sobisch