Skip to content

Commit 9b0c6fc

Browse files
author
Alex Rønne Petersen
committed
[profiler] Exit when printing the usage info.
Also print proper errors when failing to parse certain arguments rather than just printing the usage info.
1 parent 0d12302 commit 9b0c6fc

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

mono/profiler/coverage.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -880,6 +880,8 @@ usage (void)
880880
mono_profiler_printf ("\toutput=|PROGRAM write the data to the stdin of PROGRAM");
881881
mono_profiler_printf ("\toutput=|PROGRAM write the data to the stdin of PROGRAM");
882882
// mono_profiler_printf ("\tzip compress the output data");
883+
884+
exit (0);
883885
}
884886

885887
MONO_API void

mono/profiler/log-args.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ set_hsmode (ProfilerConfig *config, const char* val)
260260
unsigned int count = strtoul (val, &end, 10);
261261

262262
if (val == end) {
263-
usage ();
263+
mono_profiler_printf_err ("Could not parse heapshot mode");
264264
return;
265265
}
266266

@@ -271,7 +271,7 @@ set_hsmode (ProfilerConfig *config, const char* val)
271271
config->hs_mode = MONO_PROFILER_HEAPSHOT_X_GC;
272272
config->hs_freq_gc = count;
273273
} else
274-
usage ();
274+
mono_profiler_printf_err ("Could not parse heapshot mode");
275275
}
276276

277277
static void
@@ -302,7 +302,7 @@ set_sample_freq (ProfilerConfig *config, const char *val)
302302
freq = strtoul (p, &end, 10);
303303

304304
if (p == end)
305-
usage ();
305+
mono_profiler_printf_err ("Could not parse sample frequency");
306306
else
307307
config->sample_freq = freq;
308308
}
@@ -347,4 +347,6 @@ usage (void)
347347
mono_profiler_printf ("\treport create a report instead of writing the raw data to a file");
348348
mono_profiler_printf ("\tzip compress the output data");
349349
mono_profiler_printf ("\tport=PORTNUM use PORTNUM for the listening command server");
350+
351+
exit (0);
350352
}

0 commit comments

Comments
 (0)