On Mon, Aug 21, 2017 at 10:38 PM, <math...@sthima.com.br> wrote: > I'm developing some features for llnode, a LLDB plugin that allows better > postmortem debugging for NodeJS, and while developing one of those features > I needed to access a Context object from an Isolate object, which is very > easy using V8 API, Unfortunately it's not possible to call any functions or > methods inside LLDB when analyzing a core dump file, so the only way I found > to access the Context object was by accessing Isolate::thread_local_top_, > and then doing the same to access ThreadLocalTop::context_. To do so, I > needed to change gen-postmortem-metadata.py and add the following symbols > that represents the offsets of both attributes: > > consts_misc = [ > # ... > { 'name': 'IsolateThreadLocalTop', 'value': '(size_t) > (((v8::internal::Isolate*)0)->thread_local_top())' }, > { 'name': 'ThreadLocalTopContext', 'value': '(size_t) > &(((v8::internal::ThreadLocalTop*)0)->context_)' }, > ]; > > Is there an easier way to access the Context object from an Isolate object? > If not, those changes I made are acceptable for submission?
I can answer the first question: no, no easier way, at least not from a core dump. You can compute the current context from the top JS stack frame but that is arguably harder, not easier. As to your second question: I would file a CL and see how it goes. :-) Aside: I think you intended to write `&(((v8::internal::Isolate*)0)->thread_local_top_`? Consider using `offsetof(v8::internal::Isolate, thread_local_top_)` from <stddef.h> instead. -- -- v8-dev mailing list v8-dev@googlegroups.com http://groups.google.com/group/v8-dev --- You received this message because you are subscribed to the Google Groups "v8-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to v8-dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.