/**************************************************************************** * Utility Functions */ static file_t log_file_create_helper(void *drcontext, const char *suffix, char *buf, size_t buf_els) { file_t log = drx_open_unique_appid_file(options.logdir, drcontext == NULL ? dr_get_process_id() : dr_get_thread_id(drcontext), "drcov", suffix, #ifndef WINDOWS DR_FILE_CLOSE_ON_FORK | #endif DR_FILE_ALLOW_LARGE, buf, buf_els); if (log != INVALID_FILE) { dr_log(drcontext, DR_LOG_ALL, 1, "drcov: log file is %s\n", buf); NOTIFY(1, "<created log file %s>\n", buf); } return log; }
static void open_log_file(void) { char buf[MAXIMUM_PATH]; if (strcmp(options.logdir, "-") == 0) outf = STDERR; else { outf = drx_open_unique_appid_file(options.logdir, dr_get_process_id(), "drstrace", "log", #ifndef WINDOWS DR_FILE_CLOSE_ON_FORK | #endif DR_FILE_ALLOW_LARGE, buf, BUFFER_SIZE_ELEMENTS(buf)); ASSERT(outf != INVALID_FILE, "failed to open log file"); ALERT(1, "<drstrace log file is %s>\n", buf); } }