示例#1
0
static void TestString( void )
{
    dw_loc_handle               string_length;
    dw_handle                   string_hdl;
    dw_loc_handle               a_loc;
    dw_loc_id                   id;

    /* type InputBuffer = String( 512 ); -- I forget exact Ada syntax */
    DWDeclPos( Client, 50, 1 );
    DWString( Client, NULL, 512, "InputBuffer", 0, 0 );

    /* CHARACTER*(*) A */
    /* we'll pretend the length of the string is at -4[ebp] */
    DWDeclPos( Client, 50, 8 );
    id = DWLocInit( Client );
    DWLocOp( Client, id, DW_LOC_fbreg, -4 );
    string_length = DWLocFini( Client, id );
    string_hdl = DWString( Client, string_length, sizeof( uint_32 ), NULL, 0, 0 );
    DWLocTrash( Client, string_length );
    id = DWLocInit( Client );
    DWLocOp( Client, id, DW_LOC_fbreg, -8 );
    a_loc = DWLocFini( Client, id );
    DWDeclPos( Client, 50, 16 );
    DWVariable( Client, string_hdl, a_loc, 0, NULL, "A", 0, 0 );
    DWLocTrash( Client, a_loc );
}
示例#2
0
static void TestStruct1( void )
{
    dw_handle           struct_div_t;
    dw_loc_handle       field_loc;
    dw_handle           union_hdl;
    dw_handle           struct_foo;
    dw_handle           ptr_to_foo;
    dw_loc_id           id;

    /* struct div_t */
    struct_div_t = DWStruct( Client, DW_ST_STRUCT );
    DWBeginStruct( Client, struct_div_t, 8, "div_t", 0, 0 );
    id = DWLocInit( Client );
    field_loc = DWLocFini( Client, id );
    DWAddField( Client, FundamentalTypes[DW_FT_SIGNED], field_loc, "quot", 0 );
    DWLocTrash( Client, field_loc );
    id = DWLocInit( Client );
    DWLocOp( Client, id, DW_LOC_plus_uconst, 4 );
    field_loc = DWLocFini( Client, id );
    DWAddField( Client, FundamentalTypes[DW_FT_SIGNED], field_loc, "rem", 0 );
    DWLocTrash( Client, field_loc );
    DWEndStruct( Client );

    /*
        struct foo {
            struct foo *next;
            int         type;
            union {
                int     a;
                float   b;
            } x;
        };
    */
    struct_foo = DWStruct( Client, DW_ST_STRUCT );
    DWBeginStruct( Client, struct_foo, 12, "foo", 0, 0 );
    ptr_to_foo = DWPointer( Client, struct_foo, DW_PTR_TYPE_DEFAULT );
    id = DWLocInit( Client );
    field_loc = DWLocFini( Client, id );
    DWAddField( Client, ptr_to_foo, field_loc, "next", 0 );
    DWLocTrash( Client, field_loc );
    id = DWLocInit( Client );
    DWLocOp( Client, id, DW_LOC_plus_uconst, 4 );
    field_loc = DWLocFini( Client, id );
    DWAddField( Client, FundamentalTypes[DW_FT_SIGNED], field_loc, "type", 0 );
    DWLocTrash( Client, field_loc );
    union_hdl = DWStruct( Client, DW_ST_UNION );
    DWBeginStruct( Client, union_hdl, 4, "wombat", 0, 0 );
    DWAddField( Client, FundamentalTypes[DW_FT_SIGNED], NULL, "a", 0 );
    DWAddField( Client, FundamentalTypes[DW_FT_FLOAT], NULL, "b", 0 );
    DWEndStruct( Client );
    id = DWLocInit( Client );
    DWLocOp( Client, id, DW_LOC_plus_uconst, 8 );
    field_loc = DWLocFini( Client, id );
    DWAddField( Client, union_hdl, field_loc, "x", 0 );
    DWLocTrash( Client, field_loc );
    DWEndStruct( Client );
}
示例#3
0
extern  void   DFOutRegInd( dw_loc_id locid, name *reg ) {
/***********************************************/

    dw_regs     regnum;

    regnum = AxpRegN( reg );
    DWLocOp( Client,locid,DW_LOC_breg, regnum, 0 );
}
示例#4
0
extern  void DFOutRegInd( dw_loc_id locid, name *reg )
/****************************************************/
{
    dw_regs     regnum;

    regnum = MapRegN2dw( MIPSRegN( reg ) );
    DWLocOp( Client, locid, DW_LOC_breg, regnum, 0 );
}
示例#5
0
extern  void    DFOutRegInd( dw_loc_id locid, name *reg )
/*******************************************************/
{
    dw_regs     regnum;

    regnum = DFRegMapN( reg );
    DWLocOp( Client, locid, DW_LOC_breg, regnum, 0 );
}
示例#6
0
static dw_loc_id StkLoc( uint_32 stk_offset, dw_loc_id locid ){
/**** make a loc for stack  address *************/
    uint            stk;

    stk = DFStkReg();
    DWLocOp( Client, locid, DW_LOC_breg, stk, stk_offset );
    return( locid );
}
示例#7
0
static dw_loc_handle  RetLoc( uint_32 ret_offset ){
/**** make a loc for return address *************/
    dw_loc_id       locid;
    dw_loc_handle   df_loc;

    locid = DWLocInit( Client );
    DWLocOp( Client, locid, DW_LOC_fbreg, ret_offset );
    df_loc = DWLocFini( Client, locid );
    return( df_loc );
}
示例#8
0
//TODO: maybe this should be some sort of call back
extern void _CGAPI DFDwarfLocal( pointer client, pointer locid, pointer sym ) {
/*** add to location expr where local sym is *********************************/
    name        *tmp;
    type_length offset;

    tmp = DeAlias( AllocUserTemp( sym, XX ) );
    offset = NewBase( tmp );
    DWLocOp( client, locid, DW_LOC_fbreg, offset );

}
示例#9
0
static void TestCommonBlock( void )
{
    dw_handle                   common_block;
    dw_loc_id                   id;
    dw_loc_handle               loc;

    id = DWLocInit( Client );
    DWLocStatic( Client, id, (dw_sym_handle)5 );
    loc = DWLocFini( Client, id );
    common_block = DWBeginCommonBlock( Client, loc, NULL, "DATA", 0 );
    DWLocTrash( Client, loc );
    id = DWLocInit( Client );
    DWLocOp( Client, id, DW_LOC_plus_uconst, 4 );
    loc = DWLocFini( Client, id );
    DWVariable( Client, FundamentalTypes[DW_FT_UNSIGNED_CHAR], loc, 0, NULL, "UNCLE", 0, 0 );
    DWLocTrash( Client, loc );
    DWEndCommonBlock( Client );

    DWIncludeCommonBlock( Client, common_block );
}
示例#10
0
static void TestArray( void )
{
#if 0
    dw_dim_info         dim_info;
    dw_vardim_info      vdim_info;
    dw_handle           array_hdl;
    dw_loc_handle       buf_loc;
    dw_loc_handle       buf2_loc;
    dw_loc_id           id;

    /* char buf[80]; */
    DWDeclPos( Client, 55, 79 );
    array_hdl = DWBeginArray( Client, 1 );
    dim_info.index_type = FundamentalTypes[DW_FT_UNSIGNED];
    dim_info.lo_data = 0;
    dim_info.hi_data = 79;
    DWArrayDimension( Client, &dim_info );
    DWEndArray( Client );
    SymHandles[3] = 0x1234bUL;
    id = DWLocInit( Client );
    DWLocStatic( Client, id, (dw_sym_handle)3 );
    buf_loc = DWLocFini( Client, id );
    DWDeclPos( Client, 55, 80 );
    DWVariable( Client, array_hdl, buf_loc, 0, NULL, "buf", 0, DW_FLAG_GLOBAL );
    DWLocTrash( Client, buf_loc );

    /* INTEGER*4 A(1:N) */
    DWDeclPos( Client, 55, 81 );
    array_hdl = DWBeginArray( Client, 1 );
    dim_info.index_type = FundamentalTypes[DW_FT_SIGNED];
    dim_info.lo_data = 1;
    id = DWLocInit( Client );   /* assume N is at -4[ebp] */
    DWLocOp( Client, id, DW_LOC_fbreg, -4 );
    buf2_loc = DWLocFini( Client, id );
    vdim_info.count_data = (dw_handle)buf2_loc;
    DWArrayDimension( Client, &dim_info );
    DWLocTrash( Client, buf2_loc );
    DWEndArray( Client );
#endif
}