Exemplo n.º 1
0
void CallConf( void )
{
    char        *ptr;
    unsigned    i;
    bool        first;

    if( _IsOn( SW_HAVE_SET_CALL ) ) {
        ptr = TxtBuff;
        if( DefCallType != MAD_MSTR_NIL ) {
            *ptr++ = '/';
            ptr += MADCli( String )( DefCallType, ptr, TXT_LEN );
        }
        *ptr++ = '(';
        first = true;
        for( i = 0; i < MAX_PARMS; ++i ) {
            if( DefParms[i] != NULL ) {
                if( !first ) {
                    *ptr++ = ',';
                }
                ptr = StrCopy( DefParms[i], ptr );
                first = false;
            }
        }
        *ptr++ = ')';
        if( DefReturn == NULL ) {
            *ptr++ = '/';
            *ptr = NULLCHAR;
        } else {
            StrCopy( DefReturn, ptr );
        }
        ConfigLine( TxtBuff );
    }
}
Exemplo n.º 2
0
static walk_result logRegisterSet( const mad_reg_set_data *reg_set, void *_regs)
{
    mad_registers          *regs = _regs;
    int                     i;
    int                     j;
    int                     num_columns;
    int                     num_regs;
    RegStringCreateData     *reg_create;
    char                    *reg_name;
    char                    *set_level;
    unsigned                len;

    len = MADCli( String )( MADRegSetName( reg_set ), NULL, 0 );
    reg_name = alloca( len + 1 );
    MADCli( String )( MADRegSetName( reg_set ), reg_name, len + 1 );
    len = MADRegSetLevel( reg_set, NULL, 0 );
    if( len == 0 ){
        logStrPrintf( "\n%s\n\n", reg_name );
    } else {
        set_level = alloca( len + 1 );
        MADRegSetLevel( reg_set, set_level, len + 1 );
        logStrPrintf( "\n%s (%s)\n\n", reg_name, set_level );
    }

    GetRegStringCreate( regs, (mad_reg_set_data*)reg_set, PAGE_WIDTH, &reg_create, &num_regs, &num_columns );
    j = 0;
    for( i = 0; i < num_regs; i++ ) {
        logStrPrintf("%*s  ", -reg_create[j].length, reg_create[i].buffer );
        j++;
        if ( j == num_columns ){
            logStrPrintf( "\n" );
            j = 0;
        }
    }

    FreeRegStringCreate( reg_create, num_regs );
    return( WR_CONTINUE );
}
Exemplo n.º 3
0
static const char *RegValueName( const void *data_handle, int item )
{
    mad_modify_list const *possible = (mad_modify_list const *)data_handle + item;
    size_t          buff_len;

    buff_len = TXT_LEN;
    if( possible->name == MAD_MSTR_NIL ) {
        MADTypeHandleToString( MADTypePreferredRadix( possible->type ),
                possible->type, possible->data, TxtBuff, &buff_len );
    } else {
        MADCli( String )( possible->name, TxtBuff, buff_len );
    }
    return( TxtBuff );
}
Exemplo n.º 4
0
static void logStack( ExceptDlgInfo *info ) {
    unsigned_16     *data;
    int             i;
    int             j;
    address         sp;
    DWORD           linecnt;
    DWORD           bytesread;
    mad_type_info   host;
    mad_type_info   mti;
    void            *item;
    char            buff[BUF_SIZE];
    unsigned        buff_len;
    unsigned        word_size;

#define MIN_SIZE    sizeof( unsigned_16 )

    MADRegSpecialGet( MSR_SP, info->regs, &( sp.mach ) );
    MADTypeInfoForHost( MTK_ADDRESS, sizeof( address ), &host );
    MADTypeInfo( MADTypeDefault( MTK_ADDRESS, MAF_FULL, NULL, &sp ), &mti );
    item = alloca( BITS2BYTES( mti.b.bits ) + 1 );
#ifdef __AXP__
    word_size = 8;
#else
    word_size = 4;
#endif
    data = alloca( word_size * 4 );
    logPrintf( STR_STACK_DATA );
    for( linecnt=0; linecnt < 20; linecnt ++ ) {
        bytesread = MADCli( ReadMem )( sp, word_size * 4, data );
        MADTypeConvert( &host, &sp, &mti, item, 0 );
        buff_len = sizeof( buff );
        MADTypeToString( 16, &mti, item, buff, &buff_len );
        logStrPrintf( "%s - ", buff );
        for( i = 0; i < bytesread / MIN_SIZE; i += word_size / MIN_SIZE ) {
            for( j = word_size / MIN_SIZE - 1; j >= 0; j-- ) {
                logStrPrintf( "%04hX", data[i+j]);
            }
            logStrPrintf( " " );
            MADAddrAdd( &sp, word_size, MAF_FULL );
        }
        logStrPrintf( "\n" );
    }
}
Exemplo n.º 5
0
/*
 * logFaultInfo
 */
static void logFaultInfo( ExceptDlgInfo *info ) {

    char        *str;
    char        buf[150];
    char        addr_buf[64];
    char        fname[ FNAME_BUFLEN ];
    DWORD       type;
    DWORD       line;
    msg_id      gptype;
    ProcStats   stats;

    logStrPrintf( "\n" );
    logPrintf( STR_OFFENDING_PROC_ULINE );
    logPrintf( STR_OFFENDING_PROC_INFO );
    logPrintf( STR_OFFENDING_PROC_ULINE );

    while( !GetProcessInfo( info->procinfo->procid, &stats ) ) {
        Sleep( 100 );
        RefreshInfo();
    }
    logPrintf( STR_OFFENDING_PROC_X, stats.name, info->procinfo->procid );
    type = info->dbinfo->u.Exception.ExceptionRecord.ExceptionCode;
    FormatException( buf, type );
    MADCli( AddrToString )( info->init_ip,
        MADTypeDefault( MTK_ADDRESS, MAF_FULL, NULL, &( info->init_ip ) ),
        MLK_CODE, addr_buf, 63 );
    logPrintf( STR_ERR_OCCURRED_AT_X_Y, buf, addr_buf );
    if( type == EXCEPTION_ACCESS_VIOLATION ) {
        if( info->dbinfo->u.Exception.ExceptionRecord.ExceptionInformation[0] ) {
            gptype = STR_LOG_INV_WRITE_TO;
        } else {
            gptype = STR_LOG_INV_READ_FROM;
        }
        logPrintf( gptype,
          info->dbinfo->u.Exception.ExceptionRecord.ExceptionInformation[1] );
    }
    str = SrchMsg( info->action, Actions, NULL );
    if( str != NULL ) {
        logStrPrintf( "%s\n", str );
    }

    logPrintf( STR_MODULES_LOADED );
    logModules( info->procinfo->procid, INDENT );
    logRegisters( info );
    logPrintf( STR_SOURCE_INFORMATION );
    if( info->got_dbginfo && GetLineNum( &info->init_ip, fname,
            FNAME_BUFLEN, &line ) ) {
        logPrintf( STR_LOG_LINE_X_OF_FILE, INDENT, "", line, fname );
    } else {
        logPrintf( STR_LOG_N_A, INDENT, "" );
    }
    logPrintf( STR_DISASSEMBLY );
    logDisasm( info );
    logStack( info );
#ifndef CHICAGO
    if( LogData.log_mem_manager ) {
        logMemManInfo( info->procinfo->procid );
    }
#endif
    if( LogData.log_mem_dmp ) {
        logMemDmp( info );
    }
}
Exemplo n.º 6
0
static bool RegResize( a_window *wnd )
{
    reg_window          *reg = WndReg( wnd );
    gui_ord             space;
    int                 old_up;
    int                 i,j;
    reg_display_piece   disp;
    gui_ord             max_extent;
    gui_ord             max_descript;
    a_reg_info          *info;
    gui_ord             indent;
    gui_ord             value,descript;
    char                *p;
    unsigned            len;

    old_up = reg->up;
    reg->up = 1;

    RegFindData( reg->kind, &reg->data );
    reg->count = 0;
    while( GetDisplayPiece( &disp, reg, DbgRegs, reg->count ) ) {
        reg->count++;
    }

    WndFree( reg->info );
    reg->info = WndMustAlloc( reg->count * sizeof( *reg->info ) );
    space = WndAvgCharX( wnd );

    max_extent = 0;
    max_descript = 0;
    for( i = 0; i < reg->count; ++i ) {
        GetDisplayPiece( &disp, reg, DbgRegs, i );
        if( disp.max_value == 0 && disp.reginfo != NULL ) {
            disp.max_value = GetMADMaxFormatWidth( disp.disp_type );
        }
        info = &reg->info[i];
        info->max_value = disp.max_value;
        info->info = disp.reginfo;
        if( disp.max_descript > strlen( disp.descript ) ) {
            info->max_descript = space + disp.max_descript * WndAvgCharX( wnd );
        } else {
            info->max_descript = space + WndExtentX( wnd, disp.descript );
        }
        info->max_extent = space + disp.max_value * WndAvgCharX( wnd );
        info->standout = false;
        if( max_extent < info->max_extent ) {
            max_extent = info->max_extent;
        }
        if( max_descript < info->max_descript ) {
            max_descript = info->max_descript;
        }
    }

    reg->up = MADRegSetDisplayGrouping( reg->data );
    if( reg->up == 0 ) {
        reg->up = WndWidth( wnd ) / ( max_extent + max_descript );
        if( reg->up < 1 )
            reg->up = 1;
        if( reg->up > reg->count ) {
            reg->up = reg->count;
        }
    }
    reg->rows = ( reg->count + reg->up - 1 ) / reg->up;

    // calculate the indents

    WndFree( reg->indents );
    reg->indents = WndMustAlloc( reg->count * sizeof( *reg->indents ) );

    // For each column
    for( i = 0; i < reg->up; ++i ) {
        reg->indents[i].descript = 0;
        reg->indents[i].value = 0;
        // Calc max widths for column
        for( j = i; j < reg->count; j += reg->up ) {
            if( reg->indents[i].value < reg->info[j].max_extent ) {
                reg->indents[i].value = reg->info[j].max_extent;
            }
            if( reg->indents[i].descript < reg->info[j].max_descript ) {
                reg->indents[i].descript = reg->info[j].max_descript;
            }
        }
    }
    // Calc indents for each column
    indent = 0;
    value = 0;
    descript = 0;
    // For each column
    for( i = 0; i < reg->up; ++i ) {
        value = reg->indents[i].value;
        descript = reg->indents[i].descript;
        reg->indents[i].descript = indent;
        reg->indents[i].value = indent + descript;
        indent += value + descript;
#if ( defined( __GUI__ ) && defined( __OS2__ ) )
        // OS/2 PM GUI needs more space between columns
        indent += space;
#endif
    }
    // Copy indents to all registers by column
    for( i = reg->up; i < reg->count; ++i ) {
        reg->indents[i] = reg->indents[i % reg->up];
    }

    if( reg->up != old_up ) {
        WndScrollAbs( wnd, 0 );
        WndNoCurrent( wnd );
    }

    p = TxtBuff + MADCli( String )( MADRegSetName( reg->data ), TxtBuff, TXT_LEN );
    *p++ = ' ';
    *p++ = '(';
    len = MADRegSetLevel( reg->data, p, TXT_LEN - ( p - TxtBuff ) );
    if( len == 0 ) {
        p -= 2;
    } else {
        p += len;
        *p++ = ')';
    }
    *p++ = NULLCHAR;
    WndSetTitle( wnd, TxtBuff );

    return( true );
}
Exemplo n.º 7
0
static void InitChangeRegisterDialog(HWND hwnd,LPARAM lparam)
{
    RegModifyData   *data;
    char            *name;
    unsigned        len;
    mad_radix       radix;
    mad_type_info   mti;
    mad_type_info   cmp;
    char            s[255];
    RECT            p_rect;
    RECT            c_rect;
    HWND            field;
    int             i;
    unsigned        max_len;
    HDC             dc;
    TEXTMETRIC      tm;
    HWND            cancel;

    SetWindowLong( hwnd, DWL_USER, (LONG)lparam);
    data = (RegModifyData *)lparam;
    len = MADRegFullName( data->curr_info, ".", NULL, 0 );
    if( len > 0 ) {
        name = alloca( ( len + 1 ) * sizeof( char ) );
        MADRegFullName( data->curr_info, ".", name, len );
        SetWindowText( hwnd, name );
    } else {
        SetWindowText( hwnd, "" );
    }

    if( data->num_possible == 1 ) {
        field = GetDlgItem( hwnd, REG_EDIT_FIELD );
    } else {
        field = GetDlgItem( hwnd, CH_REG_COMBO_LIST );
    }
    SetMonoFont( field );
    GetChildPos( hwnd, field, &c_rect);
    dc = GetDC( field );
    GetTextMetrics( dc, &tm );
    MADTypeInfo( data->th, &mti );
    radix = MADTypePreferredRadix( data->th );

    if( data->num_possible == 1 ) {
        if( data->maxv == 0 ) {
            len = 255;
        } else {
            len = data->maxv;
        }
        MADTypeToString( radix, &mti, data->curr_value, s, &len );
        if( data->maxv == 0 ) {
            max_len = strlen( s );
        } else {
            max_len = data->maxv;
        }
        SetDlgItemText(hwnd,REG_EDIT_FIELD,s);
    } else {
        MADTypeInfo( data->curr_info->type, &cmp );
        max_len = 0;
        for( i = 0; i < data->num_possible; i++ ) {
            if( data->m_list[i].name == MAD_MSTR_NIL ) {
                len = sizeof( s );
                MADTypeToString( radix, &mti, data->m_list[i].data, s, &len );
            } else {
                MADCli( String )( data->m_list[i].name, s, sizeof( s ) );
            }
            if( max_len < strlen( s ) )
                max_len = strlen( s );
            SendDlgItemMessage( hwnd, CH_REG_COMBO_LIST, CB_ADDSTRING, 0, (LPARAM)s );
            if( memcmp( data->curr_value, data->m_list[i].data, BITS2BYTES( cmp.b.bits ) ) == 0 ) {
                SendDlgItemMessage( hwnd, CH_REG_COMBO_LIST, CB_SETCURSEL, (WPARAM)i, 0 );
            }
        }
        c_rect.bottom += SendMessage( field, CB_GETITEMHEIGHT, 0, 0 ) * (i + 1);
    }
    max_len *= tm.tmMaxCharWidth;
    if( max_len > c_rect.right ) {
        max_len -= max_len%2;
        GetWindowRect( hwnd, &p_rect );
        p_rect.right -= p_rect.left;
        p_rect.bottom -= p_rect.top;
        p_rect.left -= ( max_len - c_rect.right )/2;
        p_rect.right += ( max_len - c_rect.right );
        MoveWindow( hwnd, p_rect.left, p_rect.top, p_rect.right, p_rect.bottom, FALSE );
        cancel = GetDlgItem( hwnd, IDCANCEL );
        GetChildPos( hwnd, cancel, &p_rect );
        p_rect.left += ( max_len - c_rect.right );
        MoveWindow( cancel, p_rect.left, p_rect.top, p_rect.right, p_rect.bottom, FALSE );
        c_rect.right = max_len;
    }
    ReleaseDC( field, dc );
    MoveWindow( field, c_rect.left, c_rect.top, c_rect.right, c_rect.bottom, FALSE );
}