Reputation: 7312
I would like to see a log of all the emacs lisp function calls made during an emacs session.
I want to know exactly what the interpreter is doing. How can "intercept" the interpreter's REPL, if that makes any sense?
With strace I can attach to the emacs process and see all the system calls. But I need higher level information about which lisp functions are actually responsible.
As an aside, the motivation for this is to debug a problem in my emacs session where the emacs process keeps listening on a socket that is forever unavailable:
recvfrom(4, 0xbd4754, 4096, 0, 0, 0) = -1 EAGAIN (Resource temporarily unavailable)
# netstat -p |grep 14854
unix 3 [ ] STREAM CONNECTED 14854 3040/emacs
Upvotes: 6
Views: 3058
Reputation: 28541
You can try M-x profile-start RET RET ... M-x profile-report RET
. It won't give you a complete trace, but it will show you the call tree for any function that lasted enough time.
BTW, I have no idea what problem you're trying to track. Calling recvfrom and getting EAGAIN over and over again might be completely normal.
Upvotes: 4
Reputation: 73314
I'm not aware of anything which traces all function calls. That would surely need to be implemented in C. Maybe there are some existing debug compilation options you could use?
The following might still prove useful for more targeted debugging. (Emacs will certainly grind to a halt if you attempt to make them trace All The Things, however.)
Both libraries have usage details in their commentary.
Trace:
M-x find-library
RET trace
RET
;; M-x trace-function FUNCTION &optional BUFFER
;; M-x untrace-function FUNCTION
;; M-x untrace-all
Emacs Lisp Profiler (ELP):
M-x find-library
RET elp
RET
;; M-x elp-instrument-package
;; M-x elp-instrument-list
;; M-x elp-instrument-function
;; M-x elp-reset-*
;; M-x elp-results
;; M-x elp-restore-all
Upvotes: 1
Reputation: 4804
The Elisp info manual comes with a node
18.2.12 Trace Buffer
As stuff mentioned relies on edebug, should be a way to work from trace-point to trace-point and eventually kill.
WRT to logging, that might be done already with trace-function
from trace.el.
_
Upvotes: 1