~ chicken-core (chicken-5) c6efffa82493b37057f65c1f562105fecadaf684


commit c6efffa82493b37057f65c1f562105fecadaf684
Author:     Evan Hanson <evhan@foldling.org>
AuthorDate: Sun Dec 2 14:19:08 2018 +1300
Commit:     felix <felix@call-with-current-continuation.org>
CommitDate: Tue Dec 4 18:32:17 2018 +0100

    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.
    
    Signed-off-by: felix <felix@call-with-current-continuation.org>

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;
 }
 
Trap