Example #1
0
void FreeImage( image_entry *image )
{
    image_entry         **owner;
    image_entry         *curr;
    map_entry           *head;
    map_entry           *next;

    for( owner = &DbgImageList; (curr = *owner) != NULL; owner = &curr->link ) {
        if( curr == image ) {
            if( curr == ImageEntry( ContextMod ) ) {
                ContextMod = NO_MOD;
            }
            if( curr == ImageEntry( CodeAddrMod ) ) {
                CodeAddrMod = NO_MOD;
            }
            VarUnMapScopes( curr );
            UnMapPoints( curr );
            *owner = curr->link;
            for( head = curr->map_list; head != NULL; head = next ) {
                next = head->link;
                _Free( head );
            }
            _Free( curr->symfile_name );
            _Free( curr );
            break;
        }
    }
}
Example #2
0
address DefAddrSpaceForMod( mod_handle mh )
{
    image_entry *image;
    address     def_addr;

    image = ImageEntry( mh );
    if( image == NULL )
        image = ImagePrimary();
    if( image != NULL ) {
        return( image->def_addr_space );
    }
    def_addr = GetRegSP();
    def_addr.mach.offset = 0;
    return( def_addr );
}
Example #3
0
static void UnMapOnePoint( brkp *bp, image_entry *image )
{
    mod_handle          himage;

    if( bp->status.b.unmapped )
        return;
    if( image != NULL ) {
        if( DeAliasAddrMod( bp->loc.addr, &himage ) == SR_NONE )
            return;
        if( image != ImageEntry( himage ) ) {
            return;
        }
    }
    if( bp->image_name == NULL || bp->mod_name == NULL ) {
        bp->status.b.unmapped = UnMapAddress( &bp->loc, image );
    } else {
        bp->status.b.unmapped = true;
    }
}
Example #4
0
bool UnMapAddress( mappable_addr *loc, image_entry *image )
{
    map_entry           *map;
    mod_handle          himage;

    if( image == NULL ) {
        if( DeAliasAddrMod( loc->addr, &himage ) == SR_NONE )
            return( false );
        image = ImageEntry( himage );
    }
    if( image == NULL )
        return( false );
    DbgFree( loc->image_name );
    loc->image_name = DupStr( image->image_name );
    for( map = image->map_list; map != NULL; map = map->link ) {
        if( map->real_addr.segment == loc->addr.mach.segment ) {
            loc->addr.mach.segment = map->map_addr.segment;
            loc->addr.mach.offset = loc->addr.mach.offset - map->real_addr.offset;
            return( true );
        }
    }
    return( false );
}
Example #5
0
void SetPointAddr( brkp *bp, address addr )
{
    DIPHDL( cue, ch );
    image_entry *image;
    mod_handle  mod;
    char  const *start;
    bool        ok;

    if( bp->status.b.unmapped )
        return;
    _Free( bp->source_line );
    bp->source_line = NULL;
    bp->loc.addr = addr;
    _Free( bp->mod_name );
    bp->mod_name = NULL;
    _Free( bp->image_name );
    bp->image_name = NULL;
    _Free( bp->sym_name );
    bp->sym_name = NULL;
    bp->cue_diff = 0;
    bp->addr_diff = 0;
    if( !IS_BP_EXECUTE( bp->th ) ) {
        GetWPVal( bp );
    } else if( DeAliasAddrMod( addr, &mod ) != SR_NONE ) {
        image = ImageEntry( mod );
        if( image == NULL )
            return;
        ModName( mod, TxtBuff, TXT_LEN );
        bp->mod_name = DupStr( TxtBuff );
        if( image->image_name != NULL ) {
            start = SkipPathInfo( image->image_name, OP_REMOTE );
            bp->image_name = DupStrLen( start, ExtPointer( start, OP_REMOTE ) - start );
        } else {
            bp->image_name = NULL;
        }
        switch( DeAliasAddrCue( NO_MOD, addr, ch ) ) {
        case SR_EXACT:
            bp->source_line = CopySourceLine( ch );
            Format( TxtBuff, "%d", CueLine( ch ) );
            bp->sym_name = DupStr( TxtBuff );
            ok = GetBPSymAddr( bp, &addr );
            break;
        case SR_CLOSEST:
            Format( TxtBuff, "%d", CueLine( ch ) );
            bp->sym_name = DupStr( TxtBuff );
            bp->addr_diff = addr.mach.offset - CueAddr( ch ).mach.offset;
            ok = GetBPSymAddr( bp, &addr );
            break;
        default:
            ok = false;
        }
        if( !ok ) {
            _Free( bp->image_name );
            _Free( bp->mod_name );
            _Free( bp->sym_name );
            bp->image_name = NULL;
            bp->mod_name = NULL;
            bp->sym_name = NULL;
        }
    }
}