Exemplo n.º 1
0
/**
 * WalkModList callback.
 *
 * @returns WR_CONTINUE
 * @param   mh          The module.
 * @param   _idx        Pointer to the current module index.
 */
static walk_result ModCallback( mod_handle mh, void *_idx )
{
    int         *idx = (int *)_idx;
    char        buff[2048];
    unsigned    len;
    const char  *lang;
    address     addr = {0};

    printf( "%5d  ", ++*idx );

    /* address */
    addr = ModAddr( mh );
    printf( "%04x:%08lx  ", addr.mach.segment, (long)addr.mach.offset );

    /* what info do we have? */
    printf( "%c%c%c%c  ",
            ModHasInfo( mh, HK_IMAGE ) == DS_OK ? 'I' : '-',
            ModHasInfo( mh, HK_TYPE  ) == DS_OK ? 'T' : '-',
            ModHasInfo( mh, HK_CUE   ) == DS_OK ? 'C' : '-',
            ModHasInfo( mh, HK_SYM   ) == DS_OK ? 'S' : '-'
            );

    /* language and name */
    lang = ModSrcLang( mh );
    len = ModName( mh, buff, sizeof(buff) );
    if( len == 0 ) {
        buff[0] = '\0';
    }
    printf( "%-4s  %s\n", lang, buff );

    return( WR_CONTINUE );
}
Exemplo n.º 2
0
BurnAgent::BurnAgent(Coupling *coup, std::string mod, std::string obj, MPI_Comm com, const std::string parentwin) :
  Agent(coup, mod, obj, "Burn-Agent", com, false), parentWin(parentwin)
{
  load_module();

  ignmodel = false;
  std::string ModName(coup->get_control_param()->burn_module);
  if(ModName == "RocburnPY")
    ignmodel = true;

  iburn_all = "iburn_all";   //  for registering dataitems

  iburn_ng = "iburn_ng";    //    burnBuf

  // Material names in files.
  iburn = "iburn";		//  for input
  burn = "burn";

  // SimIN windows
  burnSurfIN = "BurnSurfIN";
  burnVolIN  = "BurnVolIN";

  burnIntBak = "BurnIntBak";

  burnBufOUT = "BurnBufOUT";

  tmp_window = iburn_all;
}
Exemplo n.º 3
0
static void     ModMenuItem( a_window *wnd, unsigned id, int row, int piece )
{
    address     addr;
    mod_handle  handle;
    mod_window  *mod = WndMod( wnd );

    piece=piece;

    handle = NO_MOD;
    addr = NilAddr;
    if( ModListNumRows( ModList( mod ) ) != 0 && row >= 0 ) {
        handle =  ModListMod( ModList( mod ), row );
        if( handle != NO_MOD ) {
            addr = ModFirstAddr( handle );
        }
    }
    switch( id ) {
    case MENU_INITIALIZE:
        WndMenuGrayAll( wnd );
        if( handle != NO_MOD ) {
            WndMenuEnable( wnd, MENU_MODULES_BREAK_SET_ALL, TRUE );
            WndMenuEnable( wnd, MENU_MODULES_BREAK_CLEAR_ALL, TRUE );
            WndMenuEnable( wnd, MENU_MODULES_ASSEMBLY, !IS_NIL_ADDR( addr ) );
            WndMenuEnable( wnd, MENU_MODULES_FUNCTIONS, TRUE );
            if( ModHasSourceInfo( handle ) ) {
                WndMenuEnable( wnd, MENU_MODULES_SOURCE, TRUE );
            }
        }
        WndMenuEnable( wnd, MENU_MODULES_SHOW_ALL, TRUE );
        WndMenuCheck( wnd, MENU_MODULES_SHOW_ALL, mod->all_modules );
        break;
    case MENU_MODULES_BREAK_SET_ALL:
        BreakAllModEntries( handle );
        break;
    case MENU_MODULES_BREAK_CLEAR_ALL:
        ClearAllModBreaks( handle );
        break;
    case MENU_MODULES_SOURCE:
        if( IS_NIL_ADDR( addr ) ) {
            ModName( handle, TxtBuff, TXT_LEN );
            WndFileInspect( TxtBuff, FALSE );
        } else {
            WndSrcInspect( addr );
        }
        break;
    case MENU_MODULES_ASSEMBLY:
        WndAsmInspect( addr );
        break;
    case MENU_MODULES_FUNCTIONS:
        WndFuncInspect( handle );
        break;
    case MENU_MODULES_SHOW_ALL:
        mod->all_modules = !mod->all_modules;
        ModInit( wnd );
        break;
    }
}
Exemplo n.º 4
0
STATIC walk_result loadModuleInfo( mod_handle mh, void *_curr_image )
/*******************************************************************/
{
    image_info      *curr_image = _curr_image;
    mod_info        *new_mod;
    int             mod_count;
    int             name_len;

    name_len = ModName( mh, NULL, 0 );
    new_mod = ProfCAlloc( sizeof( mod_info ) + name_len );
    ModName( mh, new_mod->name, name_len + 1 );
    new_mod->mh = mh;
    mod_count = curr_image->mod_count;
    curr_image->mod_count++;
    curr_image->module = ProfRealloc( curr_image->module,
                                      curr_image->mod_count * sizeof( pointer ) );
    curr_image->module[mod_count] = new_mod;
    initFileInfo( new_mod );
    WalkSymList( SS_MODULE, &mh, &loadRoutineInfo, new_mod );
    return( WR_CONTINUE );
}
Exemplo n.º 5
0
static void AsmSetTitle( a_window *wnd )
{
    char        *p;
    char        *image_name;
    asm_window  *asw = WndAsm( wnd );

    p = StrCopy( ": ", StrCopy( LIT( WindowAssembly ), TxtBuff ) );
    p += ModName( asw->mod, p, TXT_LEN );
    image_name = ModImageName( asw->mod );
    if( image_name[0] != '\0' ) {
        p = StrCopy( "(", StrCopy( " ", p ) );
        p = StrCopy( ")", StrCopy( SkipPathInfo( image_name, OP_REMOTE ), p ) );
    }
    WndSetTitle( wnd, TxtBuff );
}
Exemplo n.º 6
0
static void FileSetTitle( a_window *wnd, mod_handle mod )
{
    char        *p;
    const char  *image_name;
    file_window *file = WndFile( wnd );

    if( file->track ) {
        p = StrCopy( ": ", StrCopy( LIT_DUI( WindowSource ), TxtBuff ) );
    } else {
        p = TxtBuff;
    }
    if( file->viewhndl != NULL ) {
        p = StrCopy( SkipPathInfo( FGetName( file->viewhndl ), 0 ), p );
    } else if( file->mod != NO_MOD ) {
        p += ModName( file->mod, p, TXT_LEN );
    }
    image_name = ModImageName( mod );
    if( image_name[0] != NULLCHAR ) {
        p = StrCopy( "(", StrCopy( " ", p ) );
        p = StrCopy( ")", StrCopy( SkipPathInfo( image_name, OP_REMOTE ), p ) );
    }
    WndSetTitle( wnd, TxtBuff );
}
Exemplo n.º 7
0
void *OpenSrcFile( cue_handle *ch )
{
    void        *hndl;
    char_ring   *path;
    char        *p;
    char        *d;
    char        *rem_name;
    bool        used_star;
    unsigned    len;
    char        *buff;

    len = CueFile( ch, NULL, 0 ) + 1;
    _AllocA( buff, len );
    CueFile( ch, buff, len );
    hndl = FOpenSource( buff, CueMod( ch ), CueFileId( ch ) );
    if( hndl != NULL ) return( hndl );
    for( path = SrcSpec; path != NULL; path = path->next ) {
        used_star = FALSE;
        d = TxtBuff;
        for( p = path->name; *p != '\0'; ++p ) {
            if( *p == '*' ) {
                used_star = TRUE;
                d += ModName( CueMod( ch ), d, TXT_LEN );
            } else {
                *d++ = *p;
            }
        }
        *d = NULLCHAR;
        if( !used_star ) {
            #if 0
                /*
                    John can't remember why he put this code in, and it
                    screws up when the user sets a source path of ".".
                    If we find some case where it's required, we'll have to
                    think harder about things.
                */
            if( *ExtPointer( TxtBuff, 0 ) != '\0' ) {
                *SkipPathInfo( TxtBuff, 0 ) = '\0';
            }
            #endif
            d = AppendPathDelim( TxtBuff, 0 );
            if( !IsAbsolutePath( buff ) ) {
                StrCopy( buff, d );
                hndl = FOpenSource( TxtBuff, CueMod( ch ), CueFileId( ch ) );
                if( hndl != NULL ) return( hndl );
            }
            /*
                We have a small problem here. We want to strip off the
                path information for the source file name, but we don't
                know if the file was compiled on the local system or the
                remote one. We'll kludge things by doing a local skip
                and then a remote one and seeing who takes off the most stuff.
                Don't even think about the case where the file has been
                compiled on a third, different type of file system.
            */
            p = SkipPathInfo( buff, OP_LOCAL );
            rem_name = SkipPathInfo( buff, OP_REMOTE );
            if( rem_name > p ) p = rem_name;
            d = StrCopy( p, d );
            *d = NULLCHAR;
        }
        hndl = FOpenSource( TxtBuff, CueMod( ch ), CueFileId( ch ) );
        if( hndl != NULL ) return( hndl );
    }
    return( NULL );
}
Exemplo n.º 8
0
/**
 * Dumps the loaded debug info.
 *
 * @returns 0 on success, exit code on failure.
 * @param   file    The filename.
 * @param   mh      The DIP/DIG module handle.
 * @param   proc    The process which the module is loaded into.
 */
static int DumpIt( const char *file, mod_handle mh, process_info *proc )
{
    walk_result     walkres;
    struct stat     s;
    char            buff[1024];
    unsigned        len;
    int             i;

    /*
     * Module.
     */
    printf( " Module\n"
            "========\n"
            "\n"
            "name        = %s\n",
            file);
    if( !stat( file, &s ) ) {
        struct tm   *ts;
        char        buff[80];

        ts = gmtime( &s.st_mtime );
        strftime( buff, sizeof( buff ), "%Y-%m-%d %H:%M:%S UCT", ts );
        printf( "timestamp   = %s\n", buff );
    }
    printf( "DIP         = %s\n", ImageDIP( mh ) );

#if 0 /* crashes codeview, nothing on dwarf. */
    buff[0] = '\0';
    len = ModName( mh, buff, sizeof( buff ) );
    if( len ) {
        printf( "module name = %s\n", buff );
    }
#else
    len = len;
    (void)buff;
#endif
    printf( "\n"
            "\n" );

    /*
     * Compiled units?
     */
    if( 1 ) {
        printf( " Compiled Units\n"
                "================\n"
                "\n"
                "index   seg:offset    info  lang  name\n"
                "---------------------------------------\n");
        i = 0;
        walkres = WalkModList( mh, ModCallback, &i );
        printf( "\n"
                "\n" );
    }

#if 0
    /*
     * Types.
     * This crashes DWARF, and with codeview it'll only work on one special module.
     */
    if( 1 ) {
        printf( " Types\n"
                "=======\n"
                "\n"
                "index   seg:offset    info  lang  name\n"
                "---------------------------------------\n");
        i = 0;
        walkres = WalkTypeList( /*mh*/ IMH_GBL, TypeCallback, &i );
        printf( "\n"
                "\n" );
    }
#endif

    /*
     * Global (?) Symbols.
     */
    if( 1 ) {
        printf( " Global Symbols\n"
                "================\n"
                "\n"
                "index  kind   seg:offset    info  lng name\n"
                "------------------------------------------\n");
        i = 0;
        walkres = WalkSymList( SS_MODULE, &mh, SymCallback, &i );
        printf( "\n"
                "\n" );
    }


    /*
     * Iterate compiled modules and dump their line numbers and symbols.
     */
    if( 1 ) {
        i = 0;
        walkres = WalkModList( mh, Mod2Callback, &i );
    }

    printf("\n");
    return( 0 );
}
Exemplo n.º 9
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;
        }
    }
}