Example #1
0
static  bool    ImgGetLine( a_window *wnd, int row, int piece,
                             wnd_line_piece *line )
{
    image_entry         *img;

    wnd=wnd;
    line->indent = Indents[ piece ];
    if( row < 0 ) {
        row += TITLE_SIZE;
        switch( row ) {
        case 0:
            line->tabstop = FALSE;
            switch( piece ) {
            case PIECE_IMAGE:
                line->text = LIT_DUI( Executable_File );
                return( TRUE );
            case PIECE_SYMBOL:
                line->text = LIT_DUI( Debug_Information );
                return( TRUE );
            case PIECE_DIP:
                line->text = LIT_DUI( Debug_Information_Type );
                return( TRUE );
            default:
                return( FALSE );
            }
        case 1:
            if( piece != 0 ) return( FALSE );
            SetUnderLine( wnd, line );
            return( TRUE );
        default:
            return( FALSE );
        }
    } else {
        line->tabstop = FALSE;
        line->use_prev_attr = TRUE;
        line->extent = WND_MAX_EXTEND;
        img = ImgGetImage( row );
        if( img == NULL ) return( FALSE );
        switch( piece ) {
        case PIECE_IMAGE:
            line->text = img->image_name;
            line->tabstop = TRUE;
            line->use_prev_attr = FALSE;
            return( TRUE );
        case PIECE_SYMBOL:
            line->text = ImgSymName( img, FALSE );
            return( TRUE );
        case PIECE_DIP:
            if( img->dip_handle == NO_MOD ) {
                line->text = " ";
            } else {
                line->text = (char *)ImageDIP( img->dip_handle );
            }
            return( TRUE );
        }
    }
    return( FALSE );
}
Example #2
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 );
}