@@ -200,6 +200,7 @@ static std::string trace_enabled_categories; // NOLINT(runtime/string)
200
200
static std::string trace_file_pattern = // NOLINT(runtime/string)
201
201
" node_trace.${rotation}.log" ;
202
202
static bool abort_on_uncaught_exception = false ;
203
+ static std::string report_events; // NOLINT(runtime/string)
203
204
204
205
// Bit flag used to track security reverts (see node_revert.h)
205
206
unsigned int reverted = 0 ;
@@ -2569,6 +2570,14 @@ void LoadEnvironment(Environment* env) {
2569
2570
return ;
2570
2571
}
2571
2572
2573
+ #if defined(NODE_REPORT)
2574
+ fprintf (stderr, " report events: %s \n " , report_events.c_str ());
2575
+ if (!report_events.empty ()) {
2576
+ nodereport::InitializeNodeReport ();
2577
+ nodereport::SetEvents (env->isolate (), report_events.c_str ());
2578
+ }
2579
+ #endif
2580
+
2572
2581
// Bootstrap Node.js
2573
2582
Local<Object> bootstrapper = Object::New (env->isolate ());
2574
2583
SetupBootstrapObject (env, bootstrapper);
@@ -3044,6 +3053,22 @@ static void ParseArgs(int* argc,
3044
3053
// Also a V8 option. Pass through as-is.
3045
3054
new_v8_argv[new_v8_argc] = arg;
3046
3055
new_v8_argc += 1 ;
3056
+ } else if (strcmp (arg, " --report-events" ) == 0 ) {
3057
+ const char * events = argv[index + 1 ];
3058
+ if (events == nullptr ) {
3059
+ fprintf (stderr, " %s: %s requires an argument\n " , argv[0 ], arg);
3060
+ exit (9 );
3061
+ }
3062
+ args_consumed += 1 ;
3063
+ report_events = events;
3064
+ fprintf (stderr, " parsed events %s \n " , report_events.c_str ());
3065
+ // Replace ',' with '+' separators
3066
+ std::size_t c = report_events.find_first_of (" ," );
3067
+ while (c != std::string::npos) {
3068
+ report_events.replace (c, 1 , " +" );
3069
+ c = report_events.find_first_of (" ," , c + 1 );
3070
+ }
3071
+ fprintf (stderr, " filtered events %s \n " , report_events.c_str ());
3047
3072
} else {
3048
3073
// V8 option. Pass through as-is.
3049
3074
new_v8_argv[new_v8_argc] = arg;
@@ -3691,11 +3716,6 @@ inline int Start(Isolate* isolate, IsolateData* isolate_data,
3691
3716
3692
3717
env.set_trace_sync_io (trace_sync_io);
3693
3718
3694
- #if defined(NODE_REPORT)
3695
- nodereport::InitializeNodeReport ();
3696
- nodereport::SetEvents (isolate, " fatalerror+signal" );
3697
- #endif
3698
-
3699
3719
{
3700
3720
SealHandleScope seal (isolate);
3701
3721
bool more;
0 commit comments