|  | 
|  | 1 | +// Need to import standard headers before redefining private, otherwise it | 
|  | 2 | +// won't compile. | 
|  | 3 | +#include <algorithm> | 
|  | 4 | +#include <array> | 
|  | 5 | +#include <atomic> | 
|  | 6 | +#include <bitset> | 
|  | 7 | +#include <cctype> | 
|  | 8 | +#include <climits> | 
|  | 9 | +#include <cmath> | 
|  | 10 | +#include <cstdarg> | 
|  | 11 | +#include <cstddef> | 
|  | 12 | +#include <cstdint> | 
|  | 13 | +#include <cstdio> | 
|  | 14 | +#include <cstdlib> | 
|  | 15 | +#include <cstring> | 
|  | 16 | +#include <ctime> | 
|  | 17 | +#include <deque> | 
|  | 18 | +#include <exception> | 
|  | 19 | +#include <forward_list> | 
|  | 20 | +#include <fstream> | 
|  | 21 | +#include <functional> | 
|  | 22 | +#include <iomanip> | 
|  | 23 | +#include <iosfwd> | 
|  | 24 | +#include <iostream> | 
|  | 25 | +#include <istream> | 
|  | 26 | +#include <iterator> | 
|  | 27 | +#include <limits> | 
|  | 28 | +#include <list> | 
|  | 29 | +#include <map> | 
|  | 30 | +#include <memory> | 
|  | 31 | +#include <new> | 
|  | 32 | +#include <ostream> | 
|  | 33 | +#include <queue> | 
|  | 34 | +#include <set> | 
|  | 35 | +#include <sstream> | 
|  | 36 | +#include <stack> | 
|  | 37 | +#include <streambuf> | 
|  | 38 | +#include <string> | 
|  | 39 | +#include <tuple> | 
|  | 40 | +#include <type_traits> | 
|  | 41 | +#include <typeinfo> | 
|  | 42 | +#include <unordered_map> | 
|  | 43 | +#include <unordered_set> | 
|  | 44 | +#include <utility> | 
|  | 45 | +#include <vector> | 
|  | 46 | + | 
|  | 47 | +namespace node { | 
|  | 48 | +// Forward declaration needed before redefining private. | 
|  | 49 | +int GenDebugSymbols(); | 
|  | 50 | +}  // namespace node | 
|  | 51 | + | 
|  | 52 | + | 
|  | 53 | +#define private friend int GenDebugSymbols(); private | 
|  | 54 | + | 
|  | 55 | +#include "env.h" | 
|  | 56 | +#include "base_object-inl.h" | 
|  | 57 | +#include "handle_wrap.h" | 
|  | 58 | +#include "util-inl.h" | 
|  | 59 | +#include "req_wrap.h" | 
|  | 60 | +#include "v8abbr.h" | 
|  | 61 | + | 
|  | 62 | +#define NODEDBG_SYMBOL(Name)  nodedbg_ ## Name | 
|  | 63 | + | 
|  | 64 | +// nodedbg_offset_CLASS__MEMBER__TYPE: Describes the offset to a class member. | 
|  | 65 | +#define NODEDBG_OFFSET(Class, Member, Type) \ | 
|  | 66 | +    NODEDBG_SYMBOL(offset_ ## Class ## __ ## Member ## __ ## Type) | 
|  | 67 | + | 
|  | 68 | +// These are the constants describing Node internal structures. Every constant | 
|  | 69 | +// should use the format described above.  These constants are declared as | 
|  | 70 | +// global integers so that they'll be present in the generated node binary. They | 
|  | 71 | +// also need to be declared outside any namespace to avoid C++ name-mangling. | 
|  | 72 | +#define NODE_OFFSET_POSTMORTEM_METADATA(V)                                    \ | 
|  | 73 | +  V(BaseObject, persistent_handle_, v8_Persistent_v8_Object,                  \ | 
|  | 74 | +    BaseObject::persistent_handle_)                                           \ | 
|  | 75 | +  V(Environment, handle_wrap_queue_, Environment_HandleWrapQueue,             \ | 
|  | 76 | +    Environment::handle_wrap_queue_)                                          \ | 
|  | 77 | +  V(Environment, req_wrap_queue_, Environment_ReqWrapQueue,                   \ | 
|  | 78 | +    Environment::req_wrap_queue_)                                             \ | 
|  | 79 | +  V(HandleWrap, handle_wrap_queue_, ListNode_HandleWrap,                      \ | 
|  | 80 | +    HandleWrap::handle_wrap_queue_)                                           \ | 
|  | 81 | +  V(Environment_HandleWrapQueue, head_, ListNode_HandleWrap,                  \ | 
|  | 82 | +    Environment::HandleWrapQueue::head_)                                      \ | 
|  | 83 | +  V(ListNode_HandleWrap, next_, uintptr_t, ListNode<HandleWrap>::next_)       \ | 
|  | 84 | +  V(ReqWrap, req_wrap_queue_, ListNode_ReqWrapQueue,                          \ | 
|  | 85 | +    ReqWrap<uv_req_t>::req_wrap_queue_)                                       \ | 
|  | 86 | +  V(Environment_ReqWrapQueue, head_, ListNode_ReqWrapQueue,                   \ | 
|  | 87 | +    Environment::ReqWrapQueue::head_)                                         \ | 
|  | 88 | +  V(ListNode_ReqWrap, next_, uintptr_t, ListNode<ReqWrap<uv_req_t>>::next_) | 
|  | 89 | + | 
|  | 90 | +extern "C" { | 
|  | 91 | +int nodedbg_const_Environment__kContextEmbedderDataIndex__int; | 
|  | 92 | +uintptr_t nodedbg_offset_ExternalString__data__uintptr_t; | 
|  | 93 | + | 
|  | 94 | +#define V(Class, Member, Type, Accessor)                                      \ | 
|  | 95 | +  NODE_EXTERN uintptr_t NODEDBG_OFFSET(Class, Member, Type); | 
|  | 96 | +  NODE_OFFSET_POSTMORTEM_METADATA(V) | 
|  | 97 | +#undef V | 
|  | 98 | +} | 
|  | 99 | + | 
|  | 100 | +namespace node { | 
|  | 101 | + | 
|  | 102 | +int GenDebugSymbols() { | 
|  | 103 | +  nodedbg_const_Environment__kContextEmbedderDataIndex__int = | 
|  | 104 | +      Environment::kContextEmbedderDataIndex; | 
|  | 105 | + | 
|  | 106 | +  nodedbg_offset_ExternalString__data__uintptr_t = NODE_OFF_EXTSTR_DATA; | 
|  | 107 | + | 
|  | 108 | +  #define V(Class, Member, Type, Accessor)                                    \ | 
|  | 109 | +    NODEDBG_OFFSET(Class, Member, Type) = OffsetOf(&Accessor); | 
|  | 110 | +    NODE_OFFSET_POSTMORTEM_METADATA(V) | 
|  | 111 | +  #undef V | 
|  | 112 | + | 
|  | 113 | +  return 1; | 
|  | 114 | +} | 
|  | 115 | + | 
|  | 116 | +int debug_symbols_generated = GenDebugSymbols(); | 
|  | 117 | + | 
|  | 118 | +}  // namespace node | 
0 commit comments