tools/drdeploy.c
/* Register a process to run under DR */
Register a process to run under DR
Register a process to run under DR
bool register_proc(const char *process,
                   process_id_t pid,
                   bool global,
                   const char *dr_root,
                   const dr_operation_mode_t dr_mode,
                   bool debug,
                   dr_platform_t dr_platform,
                   const char *extra_ops)
{
    dr_config_status_t status;
    assert(dr_root != NULL);
    if (_access(dr_root, 0) == -1) {
        usage("cannot access DynamoRIO root directory %s", dr_root);
    }
    if (dr_mode == DR_MODE_NONE) {
        usage("you must provide a DynamoRIO mode");
    }
    if (!check_dr_root(dr_root, debug, dr_platform, false))
        return false;
    if (dr_process_is_registered(process, pid, global, dr_platform,
                                 NULL, NULL, NULL, NULL)) {
        warn("overriding existing registration");
        if (!unregister_proc(process, pid, global, dr_platform))
            return false;
    }
    status = dr_register_process(process, pid, global, dr_root, dr_mode,
                                 debug, dr_platform, extra_ops);
    if (status != DR_SUCCESS) {
        char buf[MAXIMUM_PATH];
        if (GetEnvironmentVariableA("USERPROFILE", buf,
                                    BUFFER_SIZE_ELEMENTS(buf)) <= 0) {
            error("process registration failed: USERPROFILE env var not set!");
        } else
            error("process registration failed");
        return false;
    }
    return true;
}
bool register_proc ( const char * process , process_id_t pid , bool global , const char * dr_root , const dr_operation_mode_t dr_mode , bool debug , dr_platform_t dr_platform , const char * extra_ops ) { dr_config_status_t status ; assert ( dr_root != NULL ) ; if ( _access ( dr_root , 0 ) == -1 ) { usage ( " " , dr_root ) ; } if ( dr_mode == DR_MODE_NONE ) { usage ( " " ) ; } if ( ! check_dr_root ( dr_root , debug , dr_platform , false ) ) return false ; if ( dr_process_is_registered ( process , pid , global , dr_platform , NULL , NULL , NULL , NULL ) ) { warn ( " " ) ; if ( ! unregister_proc ( process , pid , global , dr_platform ) ) return false ; } status = dr_register_process ( process , pid , global , dr_root , dr_mode , debug , dr_platform , extra_ops ) ; if ( status != DR_SUCCESS ) { char buf [ MAXIMUM_PATH ] ; if ( GetEnvironmentVariableA ( " " , buf , BUFFER_SIZE_ELEMENTS ( buf ) ) <= 0 ) { error ( " " ) ; } else error ( " " ) ; return false ; } return true ; }
Register a process to run under DR
Register a process to run under DR
/* warn if the DR root directory doesn't look right */ /* USERPROFILE is not set by default over cygwin ssh */