Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/base_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@

namespace node {

int GenDebugSymbols();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct me if I'm wrong but I don't think you have to forward-declare it, just the friend stanza inside the class is enough.


class Environment;

class BaseObject {
Expand Down Expand Up @@ -70,6 +72,7 @@ class BaseObject {
// offsets and generate debug symbols for BaseObject, which assumes that the
// position of members in memory are predictable. For more information please
// refer to `doc/guides/node-postmortem-support.md`
friend int GenDebugSymbols();
v8::Persistent<v8::Object> persistent_handle_;
Environment* env_;
};
Expand Down
3 changes: 3 additions & 0 deletions src/env.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ struct nghttp2_rcbuf;

namespace node {

int GenDebugSymbols();

namespace performance {
class performance_state;
}
Expand Down Expand Up @@ -781,6 +783,7 @@ class Environment {
// symbols for Environment, which assumes that the position of members in
// memory are predictable. For more information please refer to
// `doc/guides/node-postmortem-support.md`
friend int GenDebugSymbols();
HandleWrapQueue handle_wrap_queue_;
ReqWrapQueue req_wrap_queue_;
ListHead<HandleCleanup,
Expand Down
4 changes: 4 additions & 0 deletions src/handle_wrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@

namespace node {

int GenDebugSymbols();

class Environment;

// Rules:
Expand Down Expand Up @@ -81,11 +83,13 @@ class HandleWrap : public AsyncWrap {
friend class Environment;
friend void GetActiveHandles(const v8::FunctionCallbackInfo<v8::Value>&);
static void OnClose(uv_handle_t* handle);

// handle_wrap_queue_ needs to be at a fixed offset from the start of the
// class because it is used by src/node_postmortem_metadata.cc to calculate
// offsets and generate debug symbols for HandleWrap, which assumes that the
// position of members in memory are predictable. For more information please
// refer to `doc/guides/node-postmortem-support.md`
friend int GenDebugSymbols();
ListNode<HandleWrap> handle_wrap_queue_;
enum { kInitialized, kClosing, kClosingWithCallback, kClosed } state_;
uv_handle_t* const handle_;
Expand Down
54 changes: 0 additions & 54 deletions src/node_postmortem_metadata.cc
Original file line number Diff line number Diff line change
@@ -1,57 +1,3 @@
// Need to import standard headers before redefining private, otherwise it
// won't compile.
#include <algorithm>
#include <array>
#include <atomic>
#include <bitset>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdarg>
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <exception>
#include <forward_list>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <new>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <streambuf>
#include <string>
#include <tuple>
#include <type_traits>
#include <typeinfo>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

namespace node {
// Forward declaration needed before redefining private.
int GenDebugSymbols();
} // namespace node


#define private friend int GenDebugSymbols(); private

#include "env.h"
#include "base_object-inl.h"
#include "handle_wrap.h"
Expand Down
3 changes: 3 additions & 0 deletions src/req_wrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

namespace node {

int GenDebugSymbols();

template <typename T>
class ReqWrap : public AsyncWrap {
public:
Expand All @@ -22,6 +24,7 @@ class ReqWrap : public AsyncWrap {

private:
friend class Environment;
friend int GenDebugSymbols();
ListNode<ReqWrap> req_wrap_queue_;

protected:
Expand Down
4 changes: 4 additions & 0 deletions src/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@

namespace node {

int GenDebugSymbols();

// These should be used in our code as opposed to the native
// versions as they abstract out some platform and or
// compiler version specific functionality
Expand Down Expand Up @@ -159,6 +161,7 @@ class ListNode {

private:
template <typename U, ListNode<U> (U::*M)> friend class ListHead;
friend int GenDebugSymbols();
ListNode* prev_;
ListNode* next_;
DISALLOW_COPY_AND_ASSIGN(ListNode);
Expand Down Expand Up @@ -189,6 +192,7 @@ class ListHead {
inline Iterator end() const;

private:
friend int GenDebugSymbols();
ListNode<T> head_;
DISALLOW_COPY_AND_ASSIGN(ListHead);
};
Expand Down