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
There was a problem hiding this comment.
shouldn't it be #if !defined(NODE_USE_V8_PLATFORM) || !defined(HAVE_INSPECTOR)?
There was a problem hiding this comment.
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.
sorry to nag, but what about #if !NODE_USE_V8_PLATFORM || !HAVE_INSPECTOR
There was a problem hiding this comment.
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.
I'll make this change.
Yes, correct. |
bnoordhuis
left a comment
There was a problem hiding this comment.
This PR LGTM as a stop-gap measure, by the way.
kfarnung
left a comment
There was a problem hiding this comment.
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)