Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds optional '-logprefix' command line option to drcov #3510

Merged
merged 3 commits into from
Apr 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
gaasedelen marked this conversation as resolved.
Show resolved Hide resolved
Expand Down