Skip to content

Commit b702ada

Browse files
committed
fixed DR-i#1486
- provide better error message on Dr.Memory registration failure R=bruening@google.com BUG=DR-i#1486 Review URL: https://codereview.appspot.com/119520045 SVN-Revision: 2010
1 parent 84aebbb commit b702ada

File tree

2 files changed

+25
-15
lines changed

2 files changed

+25
-15
lines changed

docs/Doxyfile.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ SUBGROUPING = YES
5959
#---------------------------------------------------------------------------
6060
EXTRACT_ALL = NO
6161
EXTRACT_PRIVATE = NO
62-
EXTRACT_STATIC = NO
62+
EXTRACT_STATIC = YES
6363
EXTRACT_LOCAL_CLASSES = YES
6464
EXTRACT_LOCAL_METHODS = NO
6565
HIDE_UNDOC_MEMBERS = YES

drmemory/frontend.c

+24-14
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,8 @@ _tmain(int argc, TCHAR *targv[])
717717
#endif
718718

719719
drfront_status_t sc;
720-
bool res;
720+
IF_NOT_X64(bool res;)
721+
dr_config_status_t status;
721722

722723
if (dr_standalone_init() == NULL) {
723724
/* We assume this is due to a new version of Windows */
@@ -1068,11 +1069,10 @@ _tmain(int argc, TCHAR *targv[])
10681069
if (i < argc)
10691070
usage("%s", "-nudge does not take an app to run");
10701071
/* could also complain about other client or app specific ops */
1071-
res = dr_nudge_pid(nudge_pid, DRMEM_CLIENT_ID, NUDGE_LEAK_SCAN, INFINITE);
1072-
if (res != DR_SUCCESS) {
1073-
fatal("error nudging %d%s", nudge_pid,
1074-
(res == DR_NUDGE_PID_NOT_INJECTED) ? ": no such Dr. Memory process"
1075-
: "");
1072+
status = dr_nudge_pid(nudge_pid, DRMEM_CLIENT_ID, NUDGE_LEAK_SCAN, INFINITE);
1073+
if (status != DR_SUCCESS) {
1074+
const char *err_msg = dr_config_status_code_to_string(status);
1075+
fatal("error nudging %d, error code %d (%s)", nudge_pid, status, err_msg);
10761076
assert(false); /* shouldn't get here */
10771077
}
10781078
exit(0);
@@ -1301,17 +1301,27 @@ _tmain(int argc, TCHAR *targv[])
13011301
* this-pid config will override
13021302
*/
13031303
info("configuring %s pid=%d dr_ops=\"%s\"", process, pid, dr_ops);
1304-
if (dr_register_process(process, pid,
1305-
false/*local*/, dr_root, DR_MODE_CODE_MANIPULATION,
1306-
use_dr_debug, DR_PLATFORM_DEFAULT, dr_ops) != DR_SUCCESS) {
1307-
fatal("failed to register DynamoRIO configuration");
1304+
status = dr_register_process(process, pid,
1305+
false/*local*/, dr_root, DR_MODE_CODE_MANIPULATION,
1306+
use_dr_debug, DR_PLATFORM_DEFAULT, dr_ops);
1307+
if (status != DR_SUCCESS) {
1308+
const char *err_msg = dr_config_status_code_to_string(status);
1309+
fatal("failed to register DynamoRIO configuration for \"%s\"(%d) "
1310+
"dr_ops=\"%s\".\n"
1311+
"Error code %d (%s)",
1312+
process, pid, dr_ops, status, err_msg);
13081313
goto error; /* actually won't get here */
13091314
}
13101315
info("configuring client \"%s\" ops=\"%s\"", client_path, client_ops);
1311-
if (dr_register_client(process, pid,
1312-
false/*local*/, DR_PLATFORM_DEFAULT, DRMEM_CLIENT_ID,
1313-
0, client_path, client_ops) != DR_SUCCESS) {
1314-
fatal("failed to register DynamoRIO client configuration");
1316+
status = dr_register_client(process, pid,
1317+
false/*local*/, DR_PLATFORM_DEFAULT, DRMEM_CLIENT_ID,
1318+
0, client_path, client_ops);
1319+
if (status != DR_SUCCESS) {
1320+
const char *err_msg = dr_config_status_code_to_string(status);
1321+
fatal("failed to register DynamoRIO client configuration for \"%s\","
1322+
" ops=\"%s\"\n"
1323+
"Error code %d (%s)",
1324+
client_path, client_ops, status, err_msg);
13151325
goto error; /* actually won't get here */
13161326
}
13171327

0 commit comments

Comments
 (0)