示例#1
0
static bool ModFill( void *_mod, dr_handle mod_handle )
/*****************************************************/
// fill in mod_handle for dip to dwarf mod map
// pick up general info about mod while here for later calls
{
    mod_list    *mod = _mod;
    char        fname[MAX_PATH];
    char        *name;
    char        *path;
    dr_handle   cu_tag;
    dr_model    model;
    mod_info    *modinfo;

    modinfo = NextModInfo( mod );
    modinfo->mod_handle = mod_handle;
    InitAddrSym( modinfo->addr_sym );
    modinfo->addr_size = DRGetAddrSize( mod_handle );
    cu_tag = DRGetCompileUnitTag( mod_handle );
    modinfo->cu_tag = cu_tag;
    modinfo->stmts = DRGetStmtList( cu_tag );
    path = DRGetName( cu_tag );
    if( path != NULL ) {
        GetModName( path, fname );
        DCFree( path );
        name = DCAlloc( strlen( fname ) + 1 );
        strcpy( name, fname );
    } else {
        name = NULL;
    }
    path = DRGetProducer( cu_tag );
    if( path != NULL ) {

        df_ver version;

        if( strcmp( path, "V2.0 WATCOM" ) == 0 ) {
            version = VER_V3;
        } else if( strcmp( path, "V1.0 WATCOM" ) == 0 ) {
            version = VER_V2;
        } else if( strcmp( path, "WATCOM" ) == 0 ) {
            version = VER_V1;
        } else {
            version = VER_NONE;
        }
        if( mod->version == VER_NONE ) {
            mod->version = version;
        } else if( mod->version != version ) {
            mod->version = VER_ERROR;
        }
        DCFree( path );
    }
    modinfo->name = name;
    model = DRGetMemModelAT( cu_tag );
    if( DCCurrMAD() == MAD_X86 ) {
        switch( model ) {
        case DR_MODEL_NONE:
        case DR_MODEL_FLAT:
            modinfo->is_segment = FALSE;
            break;
        default:
            modinfo->is_segment = TRUE;
            break;
        }
    } else {
        modinfo->is_segment = FALSE;
    }
    modinfo->model = model;
    modinfo->lang = DRGetLanguageAT( cu_tag );
    modinfo->dbg_pch = DRDebugPCHDef( cu_tag );
    modinfo->has_pubnames = FALSE;
    return( TRUE );
}
示例#2
0
static bool ModFill( void *_mod, drmem_hdl mod_handle )
/*****************************************************/
// fill in mod_handle for dip to dwarf mod map
// pick up general info about mod while here for later calls
{
    mod_list    *mod = _mod;
    char        fname[MAX_PATH];
    char        *name;
    char        *path;
    drmem_hdl   cu_tag;
    dr_model    model;
    mod_info    *modinfo;

    modinfo = NextModInfo( mod );
    modinfo->mod_handle = mod_handle;
    InitAddrSym( modinfo->addr_sym );
    modinfo->addr_size = DRGetAddrSize( mod_handle );
    cu_tag = DRGetCompileUnitTag( mod_handle );
    modinfo->cu_tag = cu_tag;
    modinfo->stmts = DRGetStmtList( cu_tag );
    path = DRGetName( cu_tag );
    if( path != NULL ) {
        GetModName( path, fname );
        DCFree( path );
        name = DCAlloc( strlen( fname ) + 1 );
        strcpy( name, fname );
    } else {
        name = NULL;
    }
    path = DRGetProducer( cu_tag );
    if( path != NULL ) {
        df_ver wat_producer_ver;

        if( memcmp( path, DWARF_WATCOM_PRODUCER_V3, sizeof( DWARF_WATCOM_PRODUCER_V3 ) - 1 ) == 0 ) {
            wat_producer_ver = VER_V3;
        } else if( memcmp( path, DWARF_WATCOM_PRODUCER_V2, sizeof( DWARF_WATCOM_PRODUCER_V2 ) - 1 ) == 0 ) {
            wat_producer_ver = VER_V2;
        } else if( memcmp( path, DWARF_WATCOM_PRODUCER_V1, sizeof( DWARF_WATCOM_PRODUCER_V1 ) - 1 ) == 0 ) {
            wat_producer_ver = VER_V1;
        } else {
            wat_producer_ver = VER_NONE;
        }
        if( mod->wat_producer_ver == VER_NONE ) {
            mod->wat_producer_ver = wat_producer_ver;
        } else if( mod->wat_producer_ver != wat_producer_ver ) {
            mod->wat_producer_ver = VER_ERROR;
        }
        DCFree( path );
    }
    modinfo->name = name;
    model = DRGetMemModelAT( cu_tag );
    if( DCCurrMAD() == MAD_X86 ) {
        switch( model ) {
        case DR_MODEL_NONE:
        case DR_MODEL_FLAT:
            modinfo->is_segment = false;
            break;
        default:
            modinfo->is_segment = true;
            break;
        }
    } else {
        modinfo->is_segment = false;
    }
    modinfo->model = model;
    modinfo->lang = DRGetLanguageAT( cu_tag );
    modinfo->dbg_pch = DRDebugPCHDef( cu_tag );
    modinfo->has_pubnames = false;
    return( true );
}