>From 9281fdcde9e9baa60476155749b2d258d5b2beaa Mon Sep 17 00:00:00 2001 From: Evan Hanson Date: Sun, 2 Dec 2018 14:19:08 +1300 Subject: [PATCH 1/3] Split "-no-trace" and "-debug-info" behaviours This allows the "-no-trace" and "-debug-info" flags to be used together with the intended effect, i.e. that debug events are still generated but call traces are omitted. Previously, call traces would be generated at "-d3" even when "-no-trace" was specified on the command line, since the debugger's event handler would call C_trace() unconditionally whenever a call event was encountered. Instead of leaving the C_trace() call there we move it into the generated procedure body, and also make sure it precedes the call to the C_debugger() so that the most recent item in the call trace always matches the current procedure when the debugger is triggered in response to a call event. This also restores line number information to the traces, which were unintentionally removed in ef5fbf34. --- c-backend.scm | 28 ++++++++++++---------------- dbg-stub.c | 2 -- 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/c-backend.scm b/c-backend.scm index 3de85137..ac79abb5 100644 --- a/c-backend.scm +++ b/c-backend.scm @@ -285,14 +285,12 @@ (empty-closure (and customizable (zero? (lambda-literal-closure-size (find-lambda call-id))))) (fn (car subs)) ) (when name - (cond (emit-debug-info - (when dbi - (gen #t "C_debugger(&(C_debug_info[" dbi "])," - (if non-av-proc "0,NULL" "c,av") ");"))) - (emit-trace-info - (gen #t "C_trace(C_text(\"" (backslashify name-str) "\"));")) - (else - (gen #t "/* " (uncommentify name-str) " */") ) ) ) + (if emit-trace-info + (gen #t "C_trace(C_text(\"" (backslashify name-str) "\"));") + (gen #t "/* " (uncommentify name-str) " */")) + (when (and emit-debug-info dbi) + (gen #t "C_debugger(&(C_debug_info[" dbi "])," + (if non-av-proc "0,NULL" "c,av") ");"))) (cond ((eq? '##core#proc (node-class fn)) (gen #\{) (push-args args i "0") @@ -414,14 +412,12 @@ (fn (car subs)) ) (gen #\() (when name - (cond (emit-debug-info - (when dbi - (gen #t " C_debugger(&(C_debug_info[" dbi "])," - (if non-av-proc "0,NULL" "c,av") "),"))) - (emit-trace-info - (gen #t " C_trace(\"" (backslashify name-str) "\"),")) - (else - (gen #t " /* " (uncommentify name-str) " */")))) + (if emit-trace-info + (gen #t "C_trace(\"" (backslashify name-str) "\"),") + (gen #t "/* " (uncommentify name-str) " */")) + (when (and emit-debug-info dbi) + (gen #t "C_debugger(&(C_debug_info[" dbi "])," + (if non-av-proc "0,NULL" "c,av") "),"))) (gen #t " " call-id #\() (when allocating (gen "C_a_i(&a," demand #\)) diff --git a/dbg-stub.c b/dbg-stub.c index e58a8af6..71051f09 100644 --- a/dbg-stub.c +++ b/dbg-stub.c @@ -577,8 +577,6 @@ debug_event_hook(C_DEBUG_INFO *cell, C_word c, C_word *av, C_char *cloc) } } - if(cell->event == C_DEBUG_CALL) C_trace(cell->val); - return C_SCHEME_UNDEFINED; } -- 2.11.0