diff --git a/src/node_postmortem_metadata.cc b/src/node_postmortem_metadata.cc index 05800f79b09ecc..ccb347e95175c1 100644 --- a/src/node_postmortem_metadata.cc +++ b/src/node_postmortem_metadata.cc @@ -27,9 +27,11 @@ HandleWrap::handle_wrap_queue_) \ V(Environment_HandleWrapQueue, head_, ListNode_HandleWrap, \ Environment::HandleWrapQueue::head_) \ + V(ListNode_HandleWrap, prev_, uintptr_t, ListNode::prev_) \ V(ListNode_HandleWrap, next_, uintptr_t, ListNode::next_) \ V(Environment_ReqWrapQueue, head_, ListNode_ReqWrapQueue, \ Environment::ReqWrapQueue::head_) \ + V(ListNode_ReqWrap, prev_, uintptr_t, ListNode::prev_) \ V(ListNode_ReqWrap, next_, uintptr_t, ListNode::next_) extern "C" { diff --git a/test/cctest/test_node_postmortem_metadata.cc b/test/cctest/test_node_postmortem_metadata.cc index 79b766939b9d0d..f33d40eb5c23fe 100644 --- a/test/cctest/test_node_postmortem_metadata.cc +++ b/test/cctest/test_node_postmortem_metadata.cc @@ -19,8 +19,10 @@ extern uintptr_t extern uintptr_t nodedbg_offset_Environment__req_wrap_queue___Environment_ReqWrapQueue; extern uintptr_t nodedbg_offset_ExternalString__data__uintptr_t; +extern uintptr_t nodedbg_offset_ListNode_ReqWrap__prev___uintptr_t; extern uintptr_t nodedbg_offset_ListNode_ReqWrap__next___uintptr_t; extern uintptr_t nodedbg_offset_ReqWrap__req_wrap_queue___ListNode_ReqWrapQueue; +extern uintptr_t nodedbg_offset_ListNode_HandleWrap__prev___uintptr_t; extern uintptr_t nodedbg_offset_ListNode_HandleWrap__next___uintptr_t; extern uintptr_t nodedbg_offset_Environment_ReqWrapQueue__head___ListNode_ReqWrapQueue; @@ -129,6 +131,12 @@ TEST_F(DebugSymbolsTest, HandleWrapList) { const Argv argv; Env env{handle_scope, argv}; + auto queue = reinterpret_cast((*env)->handle_wrap_queue()); + auto head = queue + + nodedbg_offset_Environment_HandleWrapQueue__head___ListNode_HandleWrap; + auto tail = head + nodedbg_offset_ListNode_HandleWrap__prev___uintptr_t; + tail = *reinterpret_cast(tail); + uv_tcp_t handle; auto obj_template = v8::FunctionTemplate::New(isolate_); @@ -140,16 +148,12 @@ TEST_F(DebugSymbolsTest, HandleWrapList) { .ToLocalChecked(); TestHandleWrap obj(*env, object, &handle); - auto queue = reinterpret_cast((*env)->handle_wrap_queue()); - auto head = queue + - nodedbg_offset_Environment_HandleWrapQueue__head___ListNode_HandleWrap; - auto next = - head + nodedbg_offset_ListNode_HandleWrap__next___uintptr_t; - next = *reinterpret_cast(next); + auto last = tail + nodedbg_offset_ListNode_HandleWrap__next___uintptr_t; + last = *reinterpret_cast(last); auto expected = reinterpret_cast(&obj); - auto calculated = next - - nodedbg_offset_HandleWrap__handle_wrap_queue___ListNode_HandleWrap; + auto calculated = + last - nodedbg_offset_HandleWrap__handle_wrap_queue___ListNode_HandleWrap; EXPECT_EQ(expected, calculated); obj.persistent().Reset(); // ~HandleWrap() expects an empty handle. @@ -160,6 +164,13 @@ TEST_F(DebugSymbolsTest, ReqWrapList) { const Argv argv; Env env{handle_scope, argv}; + auto queue = reinterpret_cast((*env)->req_wrap_queue()); + auto head = + queue + + nodedbg_offset_Environment_ReqWrapQueue__head___ListNode_ReqWrapQueue; + auto tail = head + nodedbg_offset_ListNode_ReqWrap__prev___uintptr_t; + tail = *reinterpret_cast(tail); + auto obj_template = v8::FunctionTemplate::New(isolate_); obj_template->InstanceTemplate()->SetInternalFieldCount(1); @@ -174,16 +185,12 @@ TEST_F(DebugSymbolsTest, ReqWrapList) { // ARM64 CI machinies. for (auto it : *(*env)->req_wrap_queue()) (void) ⁢ - auto queue = reinterpret_cast((*env)->req_wrap_queue()); - auto head = queue + - nodedbg_offset_Environment_ReqWrapQueue__head___ListNode_ReqWrapQueue; - auto next = - head + nodedbg_offset_ListNode_ReqWrap__next___uintptr_t; - next = *reinterpret_cast(next); + auto last = tail + nodedbg_offset_ListNode_ReqWrap__next___uintptr_t; + last = *reinterpret_cast(last); auto expected = reinterpret_cast(&obj); auto calculated = - next - nodedbg_offset_ReqWrap__req_wrap_queue___ListNode_ReqWrapQueue; + last - nodedbg_offset_ReqWrap__req_wrap_queue___ListNode_ReqWrapQueue; EXPECT_EQ(expected, calculated); obj.Dispatched();