-
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: fix InspectorStarted macro guard #13167
Conversation
Random observations about the src/node.cc in master:
I think if you enforce 4, you'll be able to cut quite a bit of code and ifdef logic. Good idea, bad idea? diff --git a/src/node.cc b/src/node.cc
index a5c86d4..81e1dd7 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -260,10 +260,6 @@ static struct {
const node::DebugOptions& options) {
return env->inspector_agent()->Start(platform_, script_path, options);
}
-
- bool InspectorStarted(Environment *env) {
- return env->inspector_agent()->IsStarted();
- }
#endif // HAVE_INSPECTOR
void StartTracingAgent() {
@@ -293,9 +289,6 @@ static struct {
"so event tracing is not available.\n");
}
void StopTracingAgent() {}
- bool InspectorStarted(Environment *env) {
- return false;
- }
#endif // !NODE_USE_V8_PLATFORM
} v8_platform;
@@ -4467,8 +4460,13 @@ inline int Start(Isolate* isolate, IsolateData* isolate_data,
const char* path = argc > 1 ? argv[1] : nullptr;
StartDebug(&env, path, debug_options);
- if (debug_options.inspector_enabled() && !v8_platform.InspectorStarted(&env))
- return 12; // Signal internal error.
+ if (debug_options.inspector_enabled()) {
+#if HAVE_INSPECTOR
+ if (!env->inspector_agent()->IsStarted()) return 12; // Internal error.
+#else
+ return 12; // Internal error.
+#endif
+ }
env.set_abort_on_uncaught_exception(abort_on_uncaught_exception);
|
Sounds good to me. I'll take a look at this. Just for my understanding of when |
src/node.cc
Outdated
@@ -293,10 +293,13 @@ static struct { | |||
"so event tracing is not available.\n"); | |||
} | |||
void StopTracingAgent() {} | |||
#endif // !NODE_USE_V8_PLATFORM | |||
|
|||
#if NODE_USE_V8_PLATFORM == 0 || HAVE_INSPECTOR == 0 |
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.
shouldn't it be #if !defined(NODE_USE_V8_PLATFORM) || !defined(HAVE_INSPECTOR)
?
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.
I thought so too, but we need to check the value as the names will always be defined as macros.
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.
sorry to nag, but what about #if !NODE_USE_V8_PLATFORM || !HAVE_INSPECTOR
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.
sorry to nag, but what about #if !NODE_USE_V8_PLATFORM || !HAVE_INSPECTOR
Yes, that works as it is equivalent to the current statement. I'm fine with either.
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.
I'll make this change.
Yes, correct. |
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.
This PR LGTM as a stop-gap measure, by the way.
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.
Ran into this problem in my fork and had a similar fix in mind. 👍
Currently the InspectorStarted function is guarded by the else clause of the NODE_USE_V8_PLATFORM macro. If node is configured --without-ssl then NODE_USE_V8_PLATFORM will be 1 but the nested HAVE_INSPECTOR macro will not be 0 which will lead to that there will be no InspectorStarted function defined. If building --without-inspector or --without-ssl the following compilation error will occur: ../src/node.cc:4470:57: error: no member named 'InspectorStarted' in 'node::(anonymous struct at ../src/node.cc:241:8)' if (debug_options.inspector_enabled() && !v8_platform.InspectorStarted(&env)) ~~~~~~~~~~~ ^ ../src/node.cc:4470:57: error: no member named 'InspectorStarted' in 'node::(anonymous struct at ../src/node.cc:241:8)' if (debug_options.inspector_enabled() && !v8_platform.InspectorStarted(&env)) ~~~~~~~~~~~ ^ 1 error generated. This commit adds a separate if preprocessor directive to catch the case when either --without-ssl/--without-inspector and --without-v8-platform combinations are used to configure node. PR-URL: nodejs/node#13167 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Kyle Farnung <kfarnung@microsoft.com>
Currently the InspectorStarted function is guarded by the else clause of the NODE_USE_V8_PLATFORM macro. If node is configured --without-ssl then NODE_USE_V8_PLATFORM will be 1 but the nested HAVE_INSPECTOR macro will not be 0 which will lead to that there will be no InspectorStarted function defined. If building --without-inspector or --without-ssl the following compilation error will occur: ../src/node.cc:4470:57: error: no member named 'InspectorStarted' in 'node::(anonymous struct at ../src/node.cc:241:8)' if (debug_options.inspector_enabled() && !v8_platform.InspectorStarted(&env)) ~~~~~~~~~~~ ^ ../src/node.cc:4470:57: error: no member named 'InspectorStarted' in 'node::(anonymous struct at ../src/node.cc:241:8)' if (debug_options.inspector_enabled() && !v8_platform.InspectorStarted(&env)) ~~~~~~~~~~~ ^ 1 error generated. This commit adds a separate if preprocessor directive to catch the case when either --without-ssl/--without-inspector and --without-v8-platform combinations are used to configure node. PR-URL: nodejs/node#13167 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Kyle Farnung <kfarnung@microsoft.com>
Currently the InspectorStarted function is guarded by the else clause of the NODE_USE_V8_PLATFORM macro. If node is configured --without-ssl then NODE_USE_V8_PLATFORM will be 1 but the nested HAVE_INSPECTOR macro will not be 0 which will lead to that there will be no InspectorStarted function defined. If building --without-inspector or --without-ssl the following compilation error will occur: ../src/node.cc:4470:57: error: no member named 'InspectorStarted' in 'node::(anonymous struct at ../src/node.cc:241:8)' if (debug_options.inspector_enabled() && !v8_platform.InspectorStarted(&env)) ~~~~~~~~~~~ ^ ../src/node.cc:4470:57: error: no member named 'InspectorStarted' in 'node::(anonymous struct at ../src/node.cc:241:8)' if (debug_options.inspector_enabled() && !v8_platform.InspectorStarted(&env)) ~~~~~~~~~~~ ^ 1 error generated. This commit adds a separate if preprocessor directive to catch the case when either --without-ssl/--without-inspector and --without-v8-platform combinations are used to configure node.
117cdb1
to
7bb3c4e
Compare
If there are no objections I'd like to merge this and then follow up with a separate PR when I have a little more time (hopefully next week) to address the comments from @bnoordhuis. |
Currently the InspectorStarted function is guarded by the else clause of the NODE_USE_V8_PLATFORM macro. If node is configured --without-ssl then NODE_USE_V8_PLATFORM will be 1 but the nested HAVE_INSPECTOR macro will not be 0 which will lead to that there will be no InspectorStarted function defined. If building --without-inspector or --without-ssl the following compilation error will occur: ../src/node.cc:4470:57: error: no member named 'InspectorStarted' in 'node::(anonymous struct at ../src/node.cc:241:8)' if (debug_options.inspector_enabled() && !v8_platform.InspectorStarted(&env)) ~~~~~~~~~~~ ^ ../src/node.cc:4470:57: error: no member named 'InspectorStarted' in 'node::(anonymous struct at ../src/node.cc:241:8)' if (debug_options.inspector_enabled() && !v8_platform.InspectorStarted(&env)) ~~~~~~~~~~~ ^ 1 error generated. This commit adds a separate if preprocessor directive to catch the case when either --without-ssl/--without-inspector and --without-v8-platform combinations are used to configure node. PR-URL: nodejs#13167 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Refael Ackermann <refack@gmail.com>
Landed in ae5e65c |
Currently the InspectorStarted function is guarded by the else clause of the NODE_USE_V8_PLATFORM macro. If node is configured --without-ssl then NODE_USE_V8_PLATFORM will be 1 but the nested HAVE_INSPECTOR macro will not be 0 which will lead to that there will be no InspectorStarted function defined. If building --without-inspector or --without-ssl the following compilation error will occur: ../src/node.cc:4470:57: error: no member named 'InspectorStarted' in 'node::(anonymous struct at ../src/node.cc:241:8)' if (debug_options.inspector_enabled() && !v8_platform.InspectorStarted(&env)) ~~~~~~~~~~~ ^ ../src/node.cc:4470:57: error: no member named 'InspectorStarted' in 'node::(anonymous struct at ../src/node.cc:241:8)' if (debug_options.inspector_enabled() && !v8_platform.InspectorStarted(&env)) ~~~~~~~~~~~ ^ 1 error generated. This commit adds a separate if preprocessor directive to catch the case when either --without-ssl/--without-inspector and --without-v8-platform combinations are used to configure node. PR-URL: #13167 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Refael Ackermann <refack@gmail.com>
This does not land cleanly in LTS. Please feel free to manually backport. Please also feel free to replace the backport request label with do-not-land if it shouldn't land |
Currently the InspectorStarted function is guarded by the else clause of
the NODE_USE_V8_PLATFORM macro. If node is configured --without-ssl then
NODE_USE_V8_PLATFORM will be 1 but the nested HAVE_INSPECTOR macro
will not be 0 which will lead to that there will be no InspectorStarted
function defined.
If building --without-inspector or --without-ssl the following
compilation error will occur:
This commit adds a separate if preprocessor directive to catch the case
when either --without-ssl/--without-inspector and --without-v8-platform
combinations are used to configure node.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)