=== modified file 'lisp/emacs-lisp/trace.el' --- trunk/lisp/emacs-lisp/trace.el 2010-03-22 16:50:29 +0000 +++ patched/lisp/emacs-lisp/trace.el 2010-06-14 06:09:20 +0000 @@ -207,6 +207,11 @@ ;; do this so we'll see strings: (let ((print-circle t)) (prin1-to-string value)))) +(defcustom trace-output-also-to-debugger t + "Output trace messages also to debugger if non-nil." + :type 'boolean + :group 'trace) + (defun trace-make-advice (function buffer background) ;; Builds the piece of advice to be added to FUNCTION's advice info ;; so that it will generate the proper trace output in BUFFER @@ -223,7 +228,14 @@ ,(unless background '(display-buffer trace-buffer)) (goto-char (point-max)) ;; Insert a separator from previous trace output: - (if (= trace-level 1) (insert trace-separator)) + (when (= trace-level 1) + (when trace-output-also-to-debugger + (gdb-deb-print trace-separator)) + (insert trace-separator)) + (when trace-output-also-to-debugger + (gdb-deb-print + (trace-entry-message + ',function trace-level ad-arg-bindings))) (insert (trace-entry-message ',function trace-level ad-arg-bindings)))) @@ -232,6 +244,10 @@ (with-current-buffer trace-buffer ,(unless background '(display-buffer trace-buffer)) (goto-char (point-max)) + (when trace-output-also-to-debugger + (gdb-deb-print + (trace-exit-message + ',function trace-level ad-return-value))) (insert (trace-exit-message ',function trace-level ad-return-value)))))))) @@ -258,7 +274,13 @@ display oriented stuff, use `trace-function-background' instead." (interactive (list - (intern (completing-read "Trace function: " obarray 'fboundp t)) + (intern + (let ((fn (function-called-at-point))) + (completing-read (if fn + (format "Trace function (default %s: " fn) + "Trace function: ") + obarray 'fboundp t nil nil + (and fn (symbol-name fn))))) (read-buffer "Output to buffer: " trace-buffer))) (trace-function-internal function buffer nil)) @@ -276,7 +298,12 @@ (interactive (list (intern - (completing-read "Trace function in background: " obarray 'fboundp t)) + (let ((fn (function-called-at-point))) + (completing-read (if fn + (format "Trace function in background (default %s: " fn) + "Trace function in background: ") + obarray 'fboundp t nil nil + (and fn (symbol-name fn))))) (read-buffer "Output to buffer: " trace-buffer))) (trace-function-internal function buffer t))