1 #include "env.h"
2 #include "base_object-inl.h"
3 #include "handle_wrap.h"
4 #include "util-inl.h"
5 #include "req_wrap.h"
6 #include "v8abbr.h"
7 #include "node_context_data.h"
8
9 #define NODEDBG_SYMBOL(Name) nodedbg_ ## Name
10
11 // nodedbg_offset_CLASS__MEMBER__TYPE: Describes the offset to a class member.
12 #define NODEDBG_OFFSET(Class, Member, Type) \
13 NODEDBG_SYMBOL(offset_ ## Class ## __ ## Member ## __ ## Type)
14
15 // These are the constants describing Node internal structures. Every constant
16 // should use the format described above. These constants are declared as
17 // global integers so that they'll be present in the generated node binary. They
18 // also need to be declared outside any namespace to avoid C++ name-mangling.
19 #define NODE_OFFSET_POSTMORTEM_METADATA(V) \
20 V(BaseObject, persistent_handle_, v8_Persistent_v8_Object, \
21 BaseObject::persistent_handle_) \
22 V(Environment, handle_wrap_queue_, Environment_HandleWrapQueue, \
23 Environment::handle_wrap_queue_) \
24 V(Environment, req_wrap_queue_, Environment_ReqWrapQueue, \
25 Environment::req_wrap_queue_) \
26 V(HandleWrap, handle_wrap_queue_, ListNode_HandleWrap, \
27 HandleWrap::handle_wrap_queue_) \
28 V(Environment_HandleWrapQueue, head_, ListNode_HandleWrap, \
29 Environment::HandleWrapQueue::head_) \
30 V(ListNode_HandleWrap, prev_, uintptr_t, ListNode<HandleWrap>::prev_) \
31 V(ListNode_HandleWrap, next_, uintptr_t, ListNode<HandleWrap>::next_) \
32 V(Environment_ReqWrapQueue, head_, ListNode_ReqWrapQueue, \
33 Environment::ReqWrapQueue::head_) \
34 V(ListNode_ReqWrap, prev_, uintptr_t, ListNode<ReqWrapBase>::prev_) \
35 V(ListNode_ReqWrap, next_, uintptr_t, ListNode<ReqWrapBase>::next_)
36
37 extern "C" {
38 int nodedbg_const_ContextEmbedderIndex__kEnvironment__int;
39 int nodedbg_const_BaseObject__kInternalFieldCount__int;
40 uintptr_t nodedbg_offset_ExternalString__data__uintptr_t;
41 uintptr_t nodedbg_offset_ReqWrap__req_wrap_queue___ListNode_ReqWrapQueue;
42
43 #define V(Class, Member, Type, Accessor) \
44 NODE_EXTERN uintptr_t NODEDBG_OFFSET(Class, Member, Type);
45 NODE_OFFSET_POSTMORTEM_METADATA(V)
46 #undef V
47 }
48
49 namespace node {
50
GenDebugSymbols()51 int GenDebugSymbols() {
52 nodedbg_const_ContextEmbedderIndex__kEnvironment__int =
53 ContextEmbedderIndex::kEnvironment;
54 nodedbg_const_BaseObject__kInternalFieldCount__int =
55 BaseObject::kInternalFieldCount;
56
57 nodedbg_offset_ExternalString__data__uintptr_t = NODE_OFF_EXTSTR_DATA;
58 nodedbg_offset_ReqWrap__req_wrap_queue___ListNode_ReqWrapQueue =
59 OffsetOf<ListNode<ReqWrapBase>, ReqWrap<uv_req_t>>(
60 &ReqWrap<uv_req_t>::req_wrap_queue_);
61
62 #define V(Class, Member, Type, Accessor) \
63 NODEDBG_OFFSET(Class, Member, Type) = OffsetOf(&Accessor);
64 NODE_OFFSET_POSTMORTEM_METADATA(V)
65 #undef V
66
67 return 1;
68 }
69
70 const int debug_symbols_generated = GenDebugSymbols();
71
72 } // namespace node
73