Hi all,
I am working on a project where I am setting a two breakpoints on two 
different function calls. For example, consider the below snippet of code,
function f1(type){
   // type could be event1, event2, event3, etc.,
   // 1st breakpoint when f1 is called
    f2();
}
function f2(){
   setTimeout(f3, 200);
}
function f3(){
   // 2nd breakpoint when f3 is called
}

In the above code, I have breakpoint set on f1 and f3, and f3 is part of 
the same function call chain as of f1. They can also have async functions 
between them, which as I understand are only executed after the current 
call stack is cleared. For async traces, AFAIK  the previous stack trace is 
attached as a parent to related calls executed by microtask queue.

To track this, I would need an identifier which is unique to a call chain 
and async boundaries (i.e setTimeout, XMLHTTPRequest, promises). Is there 
any such identifier which I could use to identify that f3() is called by 
f1() which has `type` set as "event1" (i can check the name of this 
function using the stack trace, but there is no way I can figure out that 
the type is event1 since all the scopes are already destroyed for async 
traces).

The only possible solution I can come up with is, if I had access to a 
unique identifier which is only unique throughout the function chain, in JS 
side I can simply store the type in a map(`eventTracesMap`) with the 
identifier as key on breakpoint 1(i.e when f1 is called). When the second 
breakpoint(i.e f3) is hit, I can query the map and get the info i need 
using that unique identifier again.

const eventTracesMap = {}

Please let me know if anyone has any solutions regarding this, thanks in 
advance


-- 
-- 
v8-users mailing list
v8-users@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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-users/75970806-9a20-4c9c-8032-58fd5b161719n%40googlegroups.com.

Reply via email to