-
Notifications
You must be signed in to change notification settings - Fork 11
Description
console.log(...) generally works in the debugger, including:
- updated locals
- struct/object values
- values mutated inside a branch and logged afterward
What does not work is a console.log(...) located inside the branch body itself.
Minimal shape:
int sum = a + b;
console.log("start", sum);
if (sum > 5) {
sum = sum + 10;
console.log("then", sum);
} else {
sum = sum - 1;
console.log("else", sum);
}
console.log("after", sum);Expected:
- with
(2, 5):start 7,then 17,after 17 - with
(2, 3):start 5,else 4,after 4
Actual debugger output:
- with
(2, 5):start 7,after 17 - with
(2, 3):start 5,after 4
So branch-local console logs are skipped, but branch-updated values are still propagated correctly.
Basic debugger-session steps used in the regression tests:
- compile contract with
record_debug_infos: true - create session with
DebugSession::full(...) - execute with stepping / opcode stepping
- collect emitted console output with
take_console_output()
Relevant local tests on my branch:
- passing:
debug_session_console_logs_reflect_updated_variable_values - passing:
debug_session_console_logs_reflect_branch_updated_values_after_if_else - failing/ignored:
debug_session_console_logs_reflect_updated_values_inside_if_else
Repo / branch:
https://github.com/michaelsutton/silverscript/tree/console-log-regression
Direct link to the ignored failing regression:
https://github.com/michaelsutton/silverscript/blob/console-log-regression/debugger/session/tests/debug_session_tests.rs#L210
This looks like a debugger step/console emission issue for branch-local zero-width console steps, not a value propagation problem.