How to trace JavaScript function enter/exit event?

24 views
Skip to first unread message

Cong Zuo

unread,
Aug 7, 2019, 10:06:42 AM8/7/19
to v8-users
Hey guys, I want to trace JavaScript function enter and exit events to generate function calling graphs just like DTrace/SystemTap could do.

e.g.
  0  <- rl_getc
  0  <- rl_read_key
  0  -> _rl_dispatch
  0    -> _rl_dispatch_subseq
  0      -> rl_insert
  0        -> _rl_insert_char
  0          -> _rl_any_typein
  0          <- _rl_any_typein
  0          -> rl_insert_text
  0          <- rl_insert_text
  0        <- _rl_insert_char
  0      <- rl_insert
  0    <- _rl_dispatch_subseq
  0  <- _rl_dispatch
  0  -> rl_redisplay
  0    -> _rl_move_cursor_relative
  0    <- _rl_move_cursor_relative
  0    -> _rl_output_some_chars
  0    <- _rl_output_some_chars
  0  <- rl_redisplay
  0  <- readline_internal_char
  0  -> readline_internal_char
  0    -> _rl_init_argument
  0    <- _rl_init_argument
  0    -> rl_read_key
  0      -> _rl_next_macro_key
  0      <- _rl_next_macro_key
  0      -> rl_getc

And I found that it's kind of easy to probe function enter, but I couldn't find a place appropriate place to probe function exit.
What I'm considering are: 1) frame destructor;  2) `Return` ignition handler.

Any advises would be appreciated! Thanks!

Jakob Kummerow

unread,
Aug 7, 2019, 10:08:24 AM8/7/19
to v8-users
V8 already has a --trace flag that does precisely this.

--
--
v8-users mailing list
v8-u...@googlegroups.com
http://groups.google.com/group/v8-users
---
You received this message because you are subscribed to the Google Groups "v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/v8-users/8bfae5a7-1f80-49dc-82e9-13d41b838473%40googlegroups.com.

Cong Zuo

unread,
Aug 7, 2019, 10:36:44 AM8/7/19
to v8-users
Haha, pardon me for this silly question! Just forget about this option...

Thank you Jakob!

To unsubscribe from this group and stop receiving emails from it, send an email to v8-u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages