-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
src: expose ListNode<T>::prev_ on postmortem metadata #30027
Conversation
Does this come from some other PR? I feel like I’ve seen this before 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this approach isn't wrong, you could also export the offset of the prev_
field and then use that:
diff --git a/src/node_postmortem_metadata.cc b/src/node_postmortem_metadata.cc
index 05800f79b0..ccb347e951 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<HandleWrap>::prev_) \
V(ListNode_HandleWrap, next_, uintptr_t, ListNode<HandleWrap>::next_) \
V(Environment_ReqWrapQueue, head_, ListNode_ReqWrapQueue, \
Environment::ReqWrapQueue::head_) \
+ V(ListNode_ReqWrap, prev_, uintptr_t, ListNode<ReqWrapBase>::prev_) \
V(ListNode_ReqWrap, next_, uintptr_t, ListNode<ReqWrapBase>::next_)
extern "C" {
And then:
diff --git a/test/cctest/test_node_postmortem_metadata.cc b/test/cctest/test_node_postmortem_metadata.cc
index 79b766939b..0eac0240cd 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;
@@ -143,12 +145,12 @@ TEST_F(DebugSymbolsTest, HandleWrapList) {
auto queue = reinterpret_cast<uintptr_t>((*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<uintptr_t*>(next);
+ auto prev =
+ head + nodedbg_offset_ListNode_HandleWrap__prev___uintptr_t;
+ prev = *reinterpret_cast<uintptr_t*>(prev);
auto expected = reinterpret_cast<uintptr_t>(&obj);
- auto calculated = next -
+ auto calculated = prev -
nodedbg_offset_HandleWrap__handle_wrap_queue___ListNode_HandleWrap;
EXPECT_EQ(expected, calculated);
@@ -177,13 +179,13 @@ TEST_F(DebugSymbolsTest, ReqWrapList) {
auto queue = reinterpret_cast<uintptr_t>((*env)->req_wrap_queue());
auto head = queue +
nodedbg_offset_Environment_ReqWrapQueue__head___ListNode_ReqWrapQueue;
- auto next =
+ auto prev =
head + nodedbg_offset_ListNode_ReqWrap__next___uintptr_t;
- next = *reinterpret_cast<uintptr_t*>(next);
+ prev = *reinterpret_cast<uintptr_t*>(prev);
auto expected = reinterpret_cast<uintptr_t>(&obj);
auto calculated =
- next - nodedbg_offset_ReqWrap__req_wrap_queue___ListNode_ReqWrapQueue;
+ prev - nodedbg_offset_ReqWrap__req_wrap_queue___ListNode_ReqWrapQueue;
EXPECT_EQ(expected, calculated);
obj.Dispatched();
If nothing else, the logic should probably also be updated for the ReqWrap list.
Make ListNode<T> postmortem easier to find last items in the queue.
40efd8c
to
4a5813a
Compare
@bnoordhuis That would be much simpler. I've updated the patch to also make sure coverage on both metadata (the next and prev). |
Landed in 45efe67 |
Make ListNode<T> postmortem easier to find last items in the queue. PR-URL: #30027 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Make ListNode<T> postmortem easier to find last items in the queue. PR-URL: #30027 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Make ListNode<T> postmortem easier to find last items in the queue. PR-URL: #30027 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Make ListNode<T> postmortem easier to find last items in the queue. PR-URL: #30027 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Make ListNode<T> postmortem easier to find last items in the queue. PR-URL: #30027 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Make ListNode<T> postmortem easier to find last items in the queue. PR-URL: #30027 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Make
ListNode<T>
postmortem easier to find last items in the queue.Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes