Skip to content

Commit

Permalink
Add optional '-logprefix' command line option to drcov (#3510)
Browse files Browse the repository at this point in the history
Adds a new command line option '-logprefix' to drcov for better control over the output file.
Updates the changelog.
  • Loading branch information
gaasedelen authored and Hendrik Greving committed Apr 22, 2019
1 parent a92a655 commit 5016017
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions api/docs/release.dox
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ Further non-compatibility-affecting changes include:
- Added the type #dr_opmask_t.
- Added the define #MCXT_NUM_OPMASK_SLOTS for the number of AVX-512 OpMask registers.
- Renamed mcontext's ymm structure into simd.
- Added a new option -logprefix to drcov.

**************************************************
<hr>
Expand Down
3 changes: 3 additions & 0 deletions clients/drcov/drcov.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ options_init(client_id_t id, int argc, const char *argv[], drcovlib_options_t *o
else if (strcmp(token, "-logdir") == 0) {
USAGE_CHECK((i + 1) < argc, "missing logdir path");
ops->logdir = argv[++i];
} else if (strcmp(token, "-logprefix") == 0) {
USAGE_CHECK((i + 1) < argc, "missing logprefix string");
ops->logprefix = argv[++i];
} else if (strcmp(token, "-native_until_thread") == 0) {
USAGE_CHECK((i + 1) < argc, "missing -native_until_thread number");
token = argv[++i];
Expand Down
6 changes: 4 additions & 2 deletions ext/drcovlib/drcovlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ log_file_create_helper(void *drcontext, const char *suffix, char *buf, size_t bu
{
file_t log = drx_open_unique_appid_file(
options.logdir,
drcontext == NULL ? dr_get_process_id() : dr_get_thread_id(drcontext), "drcov",
suffix,
drcontext == NULL ? dr_get_process_id() : dr_get_thread_id(drcontext),
options.logprefix, suffix,
#ifndef WINDOWS
DR_FILE_CLOSE_ON_FORK |
#endif
Expand Down Expand Up @@ -557,6 +557,8 @@ drcovlib_init(drcovlib_options_t *ops)
dr_snprintf(logdir, BUFFER_SIZE_ELEMENTS(logdir), ".");
NULL_TERMINATE_BUFFER(logdir);
options.logdir = logdir;
if (options.logprefix == NULL)
options.logprefix = "drcov";
if (options.native_until_thread > 0)
go_native = true;

Expand Down
5 changes: 5 additions & 0 deletions ext/drcovlib/drcovlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ typedef struct _drcovlib_options_t {
* overrides that default.
*/
const char *logdir;
/**
* By default, log file names are prefixed with "drcov". This option overrides
* that default.
*/
const char *logprefix;
/**
* This is an experimental option for running natively (i.e., not under
* DynamoRIO control) until the nth thread, where n is the value of this
Expand Down

0 comments on commit 5016017

Please sign in to comment.