diff --git a/src/node.cc b/src/node.cc index 1fec85aa793dc4..290d36d2d2058a 100644 --- a/src/node.cc +++ b/src/node.cc @@ -35,6 +35,7 @@ #include "node_options-inl.h" #include "node_perf.h" #include "node_process.h" +#include "node_report.h" #include "node_revert.h" #include "node_v8_platform-inl.h" #include "node_version.h" @@ -67,10 +68,6 @@ #include "large_pages/node_large_page.h" -#ifdef NODE_REPORT -#include "node_report.h" -#endif - #if defined(__APPLE__) || defined(__linux__) #define NODE_USE_V8_WASM_TRAP_HANDLER 1 #else @@ -781,11 +778,9 @@ int InitializeNodeWithArgs(std::vector* argv, // Make inherited handles noninheritable. uv_disable_stdio_inheritance(); -#ifdef NODE_REPORT // Cache the original command line to be // used in diagnostic reports. per_process::cli_options->cmdline = *argv; -#endif // NODE_REPORT #if defined(NODE_V8_OPTIONS) // Should come before the call to V8::SetFlagsFromCommandLine() diff --git a/src/node_binding.cc b/src/node_binding.cc index 37c64000650085..592d0ca2a397e2 100644 --- a/src/node_binding.cc +++ b/src/node_binding.cc @@ -17,12 +17,6 @@ #define NODE_BUILTIN_ICU_MODULES(V) #endif -#if NODE_REPORT -#define NODE_BUILTIN_REPORT_MODULES(V) V(report) -#else -#define NODE_BUILTIN_REPORT_MODULES(V) -#endif - #if HAVE_INSPECTOR #define NODE_BUILTIN_PROFILER_MODULES(V) V(profiler) #else @@ -67,6 +61,7 @@ V(pipe_wrap) \ V(process_wrap) \ V(process_methods) \ + V(report) \ V(serdes) \ V(signal_wrap) \ V(spawn_sync) \ @@ -94,7 +89,6 @@ NODE_BUILTIN_STANDARD_MODULES(V) \ NODE_BUILTIN_OPENSSL_MODULES(V) \ NODE_BUILTIN_ICU_MODULES(V) \ - NODE_BUILTIN_REPORT_MODULES(V) \ NODE_BUILTIN_PROFILER_MODULES(V) \ NODE_BUILTIN_DTRACE_MODULES(V) diff --git a/src/node_errors.cc b/src/node_errors.cc index 9d038e3d1683e7..ae1da87ef6b0e0 100644 --- a/src/node_errors.cc +++ b/src/node_errors.cc @@ -4,9 +4,7 @@ #include "debug_utils-inl.h" #include "node_errors.h" #include "node_internals.h" -#ifdef NODE_REPORT #include "node_report.h" -#endif #include "node_process.h" #include "node_v8_platform-inl.h" #include "util-inl.h" @@ -405,14 +403,14 @@ void OnFatalError(const char* location, const char* message) { } else { FPrintF(stderr, "FATAL ERROR: %s\n", message); } -#ifdef NODE_REPORT + Isolate* isolate = Isolate::GetCurrent(); Environment* env = Environment::GetCurrent(isolate); if (env == nullptr || env->isolate_data()->options()->report_on_fatalerror) { report::TriggerNodeReport( isolate, env, message, "FatalError", "", Local()); } -#endif // NODE_REPORT + fflush(stderr); ABORT(); } diff --git a/src/node_options.cc b/src/node_options.cc index 3bf1031f1667ba..35dd274d6fe673 100644 --- a/src/node_options.cc +++ b/src/node_options.cc @@ -76,7 +76,7 @@ void PerProcessOptions::CheckOptions(std::vector* errors) { void PerIsolateOptions::CheckOptions(std::vector* errors) { per_env->CheckOptions(errors); -#ifdef NODE_REPORT + if (per_env->experimental_report) { // Assign the report_signal default value here. Once the // --experimental-report flag is dropped, move this initialization to @@ -117,7 +117,6 @@ void PerIsolateOptions::CheckOptions(std::vector* errors) { "--report-uncaught-exception option is valid only when " "--experimental-report is set"); } -#endif // NODE_REPORT } void EnvironmentOptions::CheckOptions(std::vector* errors) { @@ -361,12 +360,10 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() { &EnvironmentOptions::experimental_vm_modules, kAllowedInEnvironment); AddOption("--experimental-worker", "", NoOp{}, kAllowedInEnvironment); -#ifdef NODE_REPORT AddOption("--experimental-report", "enable report generation", &EnvironmentOptions::experimental_report, kAllowedInEnvironment); -#endif // NODE_REPORT AddOption("--experimental-wasi-unstable-preview1", "experimental WASI support", &EnvironmentOptions::experimental_wasi, @@ -620,8 +617,6 @@ PerIsolateOptionsParser::PerIsolateOptionsParser( "disable runtime allocation of executable memory", V8Option{}, kAllowedInEnvironment); - -#ifdef NODE_REPORT AddOption("--report-uncaught-exception", "generate diagnostic report on uncaught exceptions", &PerIsolateOptions::report_uncaught_exception, @@ -650,7 +645,6 @@ PerIsolateOptionsParser::PerIsolateOptionsParser( " (default: current working directory of Node.js process)", &PerIsolateOptions::report_directory, kAllowedInEnvironment); -#endif // NODE_REPORT Insert(eop, &PerIsolateOptions::get_per_env_options); } diff --git a/src/node_options.h b/src/node_options.h index 470007f06b6342..958eaf29571e01 100644 --- a/src/node_options.h +++ b/src/node_options.h @@ -151,9 +151,7 @@ class EnvironmentOptions : public Options { bool syntax_check_only = false; bool has_eval_string = false; -#ifdef NODE_REPORT bool experimental_report = false; -#endif // NODE_REPORT bool experimental_wasi = false; std::string eval_string; bool print_eval = false; @@ -187,15 +185,12 @@ class PerIsolateOptions : public Options { std::shared_ptr per_env { new EnvironmentOptions() }; bool track_heap_objects = false; bool no_node_snapshot = false; - -#ifdef NODE_REPORT bool report_uncaught_exception = false; bool report_on_signal = false; bool report_on_fatalerror = false; std::string report_signal; std::string report_filename; std::string report_directory; -#endif // NODE_REPORT inline EnvironmentOptions* get_per_env_options(); void CheckOptions(std::vector* errors) override; }; @@ -239,10 +234,7 @@ class PerProcessOptions : public Options { #endif std::string use_largepages = "off"; bool trace_sigint = false; - -#ifdef NODE_REPORT std::vector cmdline; -#endif // NODE_REPORT inline PerIsolateOptions* get_per_isolate_options(); void CheckOptions(std::vector* errors) override;