Пример #1
0
void    BIInit( void ) {
//================

    dw_init_info        init_dwl;
    dw_cu_info          cu;

    BrInitialized = TRUE;
    if( !_GenerateBrInfo() ) return;
    init_dwl.language = DWLANG_FORTRAN;
    init_dwl.compiler_options = DW_CM_BROWSER | DW_CM_UPPER;
    init_dwl.producer_name = "WATCOM FORTRAN 77";
    if ( !setjmp( init_dwl.exception_handler ) ) {
        CLIInit( &(init_dwl.funcs), MEM_SECTION );
        cBIId = DWInit( &init_dwl );
        justJunk = DWLocFini( cBIId, DWLocInit( cBIId ) );
        cu.source_filename=BIMKFullPath( CurrFile->name );
        cu.directory=".";
        cu.flags = TRUE;
        cu.offset_size = ARCHITECTURE;
        cu.segment_size = 0;
        cu.model = DW_MODEL_NONE;
        cu.inc_list = NULL;
        cu.inc_list_len = 0;
        cu.dbg_pch = NULL;
        DWBeginCompileUnit( cBIId, &cu );
        BISetSrcFile();
    } else {
        BrInitialized = FALSE;
        Error( SM_BROWSE_ERROR );
    }
    BIInitBaseTypes();
}
Пример #2
0
void main( void ) {
    /*****************/

    static const dw_funcs cli_funcs = {
        CLIReloc,
        CLIWrite,
        CLISeek,
        CLITell,
        CLIAlloc,
        CLIFree
    };
    dw_init_info        info;
    dw_loc_handle       seg;
    dw_cu_info          cuinfo;

    info.language = DW_LANG_C89;
    info.compiler_options = DW_CM_BROWSER;
    info.producer_name = "testcli";
    if( setjmp( info.exception_handler ) == 0 ) {
        info.funcs = cli_funcs;

        RelocValues[ DW_W_LOW_PC ] = 0x135;
        RelocValues[ DW_W_HIGH_PC ] = 0x34561ul;
        RelocValues[ DW_W_UNIT_SIZE ] = 0x34561ul - 0x135;
        Client = DWInit( &info );
        if( Client == NULL ) {
            fputs( "error in DWInit()\n", stderr );
            exit( 1 );
        }
        seg = DWLocFini( Client, DWLocInit( Client ) );
        memset( &cuinfo, 0, sizeof( cuinfo ));
        cuinfo.source_filename = "foo.bar";
        cuinfo.directory = "somewhere\\over\\the\\rainbow";

        DWBeginCompileUnit( Client, &cuinfo );
        Test();
        DWEndCompileUnit( Client );
        cuinfo.source_filename = "empty.unit";
        cuinfo.directory = "in\\a\\land\\far\\far\\away";
        DWBeginCompileUnit( Client, &cuinfo );
        DWEndCompileUnit( Client );
        DWLocTrash( Client, seg );
        DWFini( Client );
        DumpSections();
    } else {
        fputs( "fatal error %d in dwarf library\n", stderr );
        exit( 1 );
    }
    exit( 0 );
}
Пример #3
0
dw_client DwarfInit( void )
/*************************/
{
    dw_client       client;
    dw_init_info    info;
    dw_cu_info      cu;
    size_t          incsize;
    char            *inclist;
    char            *fname;
    dw_sectnum      sect;
    static const dw_funcs cli_funcs = {
        dw_reloc,
        dw_write,
        dw_seek,
        dw_tell,
        dw_alloc,
        dw_free
    };

    for( sect = 0; sect < DW_DEBUG_MAX; ++sect ) {
        dw_sections[sect].bufcount  = 0;
        dw_sections[sect].bufptrs   = NULL;
        dw_sections[sect].offset    = 0;
        dw_sections[sect].length    = 0;
    }
    info.language = DWLANG_C;
    info.compiler_options = DW_CM_BROWSER;
    info.producer_name = DWARF_PRODUCER_ID " V1";
    memcpy( &info.exception_handler, Environment, sizeof( jmp_buf ) );
    info.funcs = cli_funcs;
    info.abbrev_sym = NULL;

    relocValues[DW_W_LOW_PC] = 0x0;
    relocValues[DW_W_HIGH_PC] = 0x1;
    relocValues[DW_W_UNIT_SIZE] = 0x1;

    client = DWInit( &info );
    if( client == NULL ) {
        CFatal( "dwarf: error in DWInit()" );
    }
    fname = FNameFullPath( FNames );
    incsize = 0;
    inclist = NULL;
#if 0
    if( HFileList != NULL ) {
        char    *p;

        incsize = strlen( HFileList ) + 1;
        inclist = CMemAlloc( incsize );
        memcpy( inclist, HFileList, incsize );
        // need to handle the case where there are multiple ';' in a row
        for( p = inclist; *p != '\0'; p++ ) {
            if( *p == ';' ) {
                *p = '\0';
            }
        }
        if( inclist[incsize - 2] == '\0' ) {
            --incsize;
        }
    }
#endif
    cu.source_filename = fname;
    cu.directory       = "";
    cu.flags           = 1;
    cu.offset_size     = TARGET_NEAR_POINTER;
    cu.segment_size    = 0;
    cu.model           = DW_MODEL_NONE;
    cu.inc_list        = inclist;
    cu.inc_list_len    = incsize;
    cu.dbg_pch         = NULL;
    DWBeginCompileUnit( client, &cu );
    CMemFree( inclist );
    DWDeclFile( client, fname );
    return( client );
}
Пример #4
0
extern  void    DFObjLineInitDbgInfo( void ) {
/*****************************************************/
/* called by objinit to init segments and dwarf writing library */
    static const dw_funcs cli_funcs = {
        CLIReloc,
        CLIWrite,
        CLISeek,
        CLITell,
        CLIAlloc,
        CLIFree
    };
    dw_init_info    info;
    dw_cu_info      cu;
    type_def       *tipe_addr;

    info.language = DWLANG_C;
    info.compiler_options = DW_CM_DEBUGGER;
    info.abbrev_sym = 0;
    info.producer_name = SetDwarfProducer();
    info.language = SetLang();
    if( setjmp( info.exception_handler ) == 0 ) {
        info.funcs = cli_funcs;
        InitLineSegBck(); // start each seg with a ref label
        Client = DWInit( &info );
        if( Client == NULL ) {
            Zoiks( ZOIKS_107 ); /* Bad */
        }
        cu.source_filename = FEAuxInfo( NULL, SOURCE_NAME );
        cu.directory = "";
        cu.dbg_pch = NULL;
        cu.inc_list = NULL;
        cu.inc_list_len = 0;
#if _TARGET & ( _TARG_IAPX86 | _TARG_80386 )
        if( _IsTargetModel( FLAT_MODEL ) ) {
            cu.flags = true;
            cu.segment_size = 0;
        }else{
            cu.flags = false;
            cu.segment_size = 2;
        }
#else
        cu.flags = true;
        cu.segment_size = 0;
#endif
        tipe_addr = TypeAddress( TY_NEAR_POINTER );
        cu.offset_size = tipe_addr->length;
        switch( GetMemModel() ){
            case 'h':
                cu.model = DW_MODEL_HUGE;
                break;
            case 'l':
                cu.model = DW_MODEL_LARGE;
                break;
            case 'f':
                cu.model = DW_MODEL_FLAT;
                break;
            case 's':
                cu.model = DW_MODEL_SMALL;
                break;
            default:
                cu.model = DW_MODEL_NONE;
                break;
        }
        DWInitDebugLine( Client, &cu );
    } else {
        Zoiks( ZOIKS_107 ); /* Big Error */
    }
}
Пример #5
0
extern  void    DFObjInitDbgInfo( void ) {
/*****************************************************/
/* called by objinit to init segments and dwarf writing library */
    static const dw_funcs cli_funcs = {
        CLIReloc,
        CLIWrite,
        CLISeek,
        CLITell,
        CLIAlloc,
        CLIFree
    };
    dw_init_info    info;
    cg_sym_handle   abbrev_sym;
    cg_sym_handle   debug_pch;
    fe_attr         attr;

    if( _IsntModel( DBG_LOCALS | DBG_TYPES ) ){
        return;
    }
    info.compiler_options = DW_CM_DEBUGGER;
    info.abbrev_sym = 0;
    info.producer_name = SetDwarfProducer();
    info.language = SetLang();
    if( setjmp( info.exception_handler ) == 0 ) {
        info.funcs = cli_funcs;
        InitSegBck(); // start each seg with a ref label
        if( _IsModel( DBG_PREDEF ) ) {
            abbrev_sym = FEAuxInfo( NULL, DBG_PREDEF_SYM );
            info.abbrev_sym = (dw_sym_handle)abbrev_sym;
            attr = FEAttr( abbrev_sym );
            if( (attr & FE_IMPORT) ) {
                info.compiler_options |= DW_CM_ABBREV_PRE;
            }else{
                back_handle bck;
                segment_id  old;

                info.compiler_options |= DW_CM_ABBREV_GEN;
                bck = FEBack( abbrev_sym ); // dump out export label
                bck->seg = DwarfSegs[DW_DEBUG_ABBREV].seg;
                old = SetOP( DwarfSegs[DW_DEBUG_ABBREV].seg );
                DataLabel( bck->lbl );
                SetOP( old );
            }
        }
        debug_pch = FEAuxInfo( NULL, DBG_PCH_SYM );
        if( debug_pch != NULL ){
            attr = FEAttr( debug_pch );
            if( !(attr & FE_IMPORT) ) {
                back_handle bck;
                segment_id  old;

                bck = FEBack( debug_pch );
                bck->seg = DwarfSegs[DW_DEBUG_INFO].seg;
                old = SetOP( DwarfSegs[DW_DEBUG_INFO].seg );
                DataLabel( bck->lbl );
                SetOP( old );
                debug_pch = NULL;
            }
        }
        Client = DWInit( &info );
        if( Client == NULL ) {
            Zoiks( ZOIKS_107 ); /* Bad */
        }
        DFBegCCU( AskCodeSeg(), (dw_sym_handle)debug_pch );
    } else {
        Zoiks( ZOIKS_107 ); /* Big Error */
    }
}
Пример #6
0
dw_client DwarfInit( void )
/********************/
{
    dw_client    client;
    dw_init_info info;
    dw_cu_info      cu;
    unsigned    incsize;
    char        *inclist;
    char       *fname;
    static const dw_funcs cli_funcs = {
        dw_reloc,
        dw_write,
        dw_seek,
        dw_tell,
        dw_alloc,
        dw_free
    };

    DWSectInit();
    info.language = DWLANG_C;
    info.compiler_options = DW_CM_BROWSER;
    info.producer_name = "WATCOM C V10";
    memcpy( &info.exception_handler, Environment, sizeof( jmp_buf ) );
    info.funcs = cli_funcs;

    relocValues[ DW_W_LOW_PC ] = 0x0;
    relocValues[ DW_W_HIGH_PC ] = 0x1;
    relocValues[ DW_W_UNIT_SIZE ] = 0x1;


    client = DWInit( &info );
    if( client == NULL ) {
        CFatal( "dwarf: error in DWInit()" );
    }
    fname = FNameFullPath( FNames );
    incsize = 0;
    inclist = NULL;
#if 0
    if( HFileList != NULL ) {
        char    *p;

        incsize = strlen( HFileList ) + 1;
        inclist = CMemAlloc( incsize );
        strcpy( inclist, HFileList );
        // need to handle the case where there are multiple ';' in a row
        for( p = inclist; *p; p++ ) {
            if( *p == ';' )  *p = '\0';
        }
        if( inclist[ incsize - 2 ] == '\0' )  --incsize; /* 27-may-94 */
    }
#endif
    cu.source_filename = fname;
    cu.directory       = "";
    cu.flags           = 1;
    cu.offset_size     = TARGET_NEAR_POINTER;
    cu.segment_size    = 0;
    cu.model           = DW_MODEL_NONE;
    cu.inc_list        = inclist;
    cu.inc_list_len    = incsize;
    cu.dbg_pch         = NULL;
    DWBeginCompileUnit( client, &cu );
    CMemFree( inclist );
    DWDeclFile( client, fname );
    return( client );
}
Пример #7
0
extern dw_client DwarfInit( void )
/********************************/
{
    dw_init_info    info;
    dw_cu_info      cu;
    char            dir[_MAX_PATH2];
    char            fname[_MAX_PATH];
    char *          full_fname;
    int             i;
    char *          incbuf;
    char *          inccurr;
    unsigned        incsize;
    dw_client       client;

    DwioInit();
    for( i = 0 ; i < DW_DEBUG_MAX ; i++ ) {
        dw_sections[i].file = DwioCreateFile();
        dw_sections[i].offset = 0;
        dw_sections[i].length = 0;
    }
    HFileListStart();
    incsize = HFileListSize();
    if( incsize != 0 ) {
        incbuf = CMemAlloc( incsize );
        inccurr = incbuf;
        for(;;) {
            HFileListNext( inccurr );
            if( *inccurr == '\0' ) break;
            inccurr = strend( inccurr ) + 1;
        }
        incsize = inccurr - incbuf;
    }
    info.language = DWLANG_CPP;
    info.compiler_options = DW_CM_BROWSER;
    info.producer_name = "WATCOM C++ V1";
    memcpy( info.exception_handler, Environment, sizeof( jmp_buf ) );
    info.funcs.reloc = &dw_reloc;
    info.funcs.write = &dw_write;
    info.funcs.seek = &dw_seek;
    info.funcs.tell = &dw_tell;
    info.funcs.alloc = &dw_alloc;
    info.funcs.free = &dw_free;

    client = DWInit( &info );
    if( client == NULL ) {
        CFatal( "dwarf: error in DWInit()" );
    }
    getcwd( dir, sizeof( dir ) ),
    full_fname = IoSuppFullPath( WholeFName, fname, sizeof( fname ) );
    cu.source_filename = full_fname;
    cu.directory       = dir;
    cu.flags           = 1;
    cu.offset_size     = TARGET_NEAR_POINTER;
    cu.segment_size    = 0;
    cu.model           = DW_MODEL_NONE;
    cu.inc_list        = incbuf;
    cu.inc_list_len    = incsize;
    cu.dbg_pch         = 0;


    DWBeginCompileUnit( client, &cu );
    if( incsize != 0 ) {
        CMemFree( incbuf );
    }
    return( client );
}