예제 #1
0
void DumpFuncDefn( void )
{
    TYPEPTR     typ;
    FNAMEPTR    flist;
    STRCHUNK    chunk;
    char        *result;

    typ = CurFunc->sym_type;
    DumpParmTags( typ->u.fn.parms, DefFile );
    flist = FileIndexToFName( CurFunc->src_loc.fno );
    fprintf( DefFile, "//#line \"%s\" %u\n",
                flist->name,
                CurFunc->src_loc.line );

    ChunkInit( &chunk );

    if( CurFunc->attribs.stg_class == SC_STATIC ) {
        put_keyword( T_STATIC, &chunk );
    } else {
        put_keyword( T_EXTERN, &chunk );
    }
    if( CurFunc->flags & SYM_TYPE_GIVEN ) {
        DumpBaseType( Object( typ ), &chunk );
    }
    DumpDecl( typ, CurFunc, &chunk );

    result = ChunkToStr( &chunk );
    fprintf( DefFile, "%s;\n", result );
    CMemFree( result );
}
예제 #2
0
/* static */ wxString
wxDbgHelpDLL::DumpSymbol(wxPSYMBOL_INFO pSym, void *pVariable)
{
    wxString s;
    wxSYMBOL_INFO symDeref = *pSym;
    switch ( DereferenceSymbol(&symDeref, &pVariable) )
    {
        default:
            // Suppress gcc warnings about unhandled enum values, don't assert
            // to avoid problems during fatal crash generation.
            break;

        case SYMBOL_TAG_UDT:
            // show UDT recursively
            s = DumpUDT(&symDeref, pVariable);
            break;

        case SYMBOL_TAG_BASE_TYPE:
            // variable of simple type, show directly
            BasicType bt = GetBasicType(&symDeref);
            if ( bt )
            {
                s = DumpBaseType(bt, pSym->Size, pVariable);
            }
            break;
    }

    return s;
}
예제 #3
0
static void DoDumpType( TYPEPTR realtype, const char *symname, STRCHUNK *pch )
{
    type_modifiers  pointer_flags;
    TYPEPTR         typ;

    realtype = TrueType( realtype );
    DumpBaseType( realtype, pch );
    DumpDecl( realtype, NULL, pch );
    if( symname )
        ChunkSaveStr( pch, symname );
    if( realtype->decl_type == TYPE_POINTER ) {
        if( realtype->u.p.decl_flags & FLAG_WAS_ARRAY ) {
            typ = Object( realtype );
            if( typ->decl_type != TYPE_ARRAY ) {
                ChunkSaveStr( pch, "[]" );
            }
        }
    }
    for( typ = realtype; typ != NULL; typ = Object( typ ) ) {
        if( typ->decl_type == TYPE_TYPEDEF )
            break;
        pointer_flags = 0;
        while( typ->decl_type == TYPE_POINTER ) {
            pointer_flags = typ->u.p.decl_flags;
            typ = Object( typ );
        }
        if( typ->decl_type == TYPE_ARRAY || typ->decl_type == TYPE_FUNCTION ) {
            DumpTail( realtype, NULL, pointer_flags, pch );
            break;
        }
    }
}
예제 #4
0
/* static */ wxString
wxDbgHelpDLL::DumpSymbol(PSYMBOL_INFO pSym, void *pVariable)
{
    wxString s;
    SYMBOL_INFO symDeref = *pSym;
    switch ( DereferenceSymbol(&symDeref, &pVariable) )
    {
        case SYMBOL_TAG_UDT:
            // show UDT recursively
            s = DumpUDT(&symDeref, pVariable);
            break;

        case SYMBOL_TAG_BASE_TYPE:
            // variable of simple type, show directly
            BasicType bt = GetBasicType(&symDeref);
            if ( bt )
            {
                s = DumpBaseType(bt, pSym->Size, pVariable);
            }
            break;
    }

    return s;
}
예제 #5
0
wxString
wxDbgHelpDLL::DumpField(PSYMBOL_INFO pSym, void *pVariable, unsigned level)
{
    wxString s;

    // avoid infinite recursion
    if ( level > 100 )
    {
        return s;
    }

    SymbolTag tag = SYMBOL_TAG_NULL;
    if ( !DoGetTypeInfo(pSym, TI_GET_SYMTAG, &tag) )
    {
        return s;
    }

    switch ( tag )
    {
        case SYMBOL_TAG_UDT:
        case SYMBOL_TAG_BASE_CLASS:
            s = DumpUDT(pSym, pVariable, level);
            break;

        case SYMBOL_TAG_DATA:
            if ( !pVariable )
            {
                s = _T("NULL");
            }
            else // valid location
            {
                wxDbgHelpDLL::DataKind kind;
                if ( !DoGetTypeInfo(pSym, TI_GET_DATAKIND, &kind) ||
                        kind != DATA_MEMBER )
                {
                    // maybe it's a static member? we're not interested in them...
                    break;
                }

                // get the offset of the child member, relative to its parent
                DWORD ofs = 0;
                if ( !DoGetTypeInfo(pSym, TI_GET_OFFSET, &ofs) )
                    break;

                pVariable = (void *)((DWORD_PTR)pVariable + ofs);


                // now pass to the type representing the type of this member
                SYMBOL_INFO sym = *pSym;
                if ( !DoGetTypeInfo(pSym, TI_GET_TYPEID, &sym.TypeIndex) )
                    break;

                ULONG64 size;
                DoGetTypeInfo(&sym, TI_GET_LENGTH, &size);

                switch ( DereferenceSymbol(&sym, &pVariable) )
                {
                    case SYMBOL_TAG_BASE_TYPE:
                        {
                            BasicType bt = GetBasicType(&sym);
                            if ( bt )
                            {
                                s = DumpBaseType(bt, size, pVariable);
                            }
                        }
                        break;

                    case SYMBOL_TAG_UDT:
                    case SYMBOL_TAG_BASE_CLASS:
                        s = DumpUDT(&sym, pVariable, level);
                        break;
                }
            }

            if ( !s.empty() )
            {
                s = GetSymbolName(pSym) + _T(" = ") + s;
            }
            break;
    }

    if ( !s.empty() )
    {
        s = wxString(_T('\t'), level + 1) + s + _T('\n');
    }

    return s;
}