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 ); }
static void GenRetSym( dbg_loc loc, dbg_type tipe ) { /*******************************************************************/ dw_loc_handle dw_loc; dw_loc = DBGLoc2DF( loc ); if( dw_loc != NULL ){ DWVariable( Client, tipe, dw_loc, 0, NULL, ".return", 0, DW_FLAG_ARTIFICIAL ); DWLocTrash( Client, dw_loc ); } }
static void BIOutVar( sym_id ste_ptr ) { //====================================== // Dump the name of a variable. dw_handle handle; char name[MAX_SYMLEN+1]; memset( name, 0, MAX_SYMLEN+1 ); handle = DWVariable(cBIId, BIGetAnyType(ste_ptr), 0, 0, 0, strncpy(name, ste_ptr->u.ns.name, ste_ptr->u.ns.u2.name_len ), 0, 0 ); BIRefSymbol( handle ); BISetHandle( ste_ptr, handle ); }
extern void DFGenStatic( cg_sym_handle sym, dbg_loc loc ) { /*******************************************************************/ uint flags; fe_attr attr; const char *name; dw_loc_handle dw_loc; dw_loc_handle dw_segloc; dw_handle obj; dbg_type dbtype; attr = FEAttr( sym ); if( attr & FE_GLOBAL ){ flags = DW_FLAG_GLOBAL; }else{ flags = 0; } name = FEName( sym ); if( attr & FE_STATIC ){ #if _TARGET & ( _TARG_IAPX86 | _TARG_80386 ) if( _IsTargetModel( FLAT_MODEL ) ) { dw_segloc = NULL; }else{ dw_segloc = SegLoc( sym ); } #else dw_segloc = NULL; #endif }else{ dw_segloc = NULL; } dbtype = FEDbgType( sym ); /* causes name side effects */ dw_loc = DBGLoc2DF( loc ); obj = DWVariable( Client, dbtype, dw_loc, 0, dw_segloc, name, 0, flags ); if( attr & FE_GLOBAL ){ name = FEName( sym ); DWPubname( Client, obj, name ); } if( dw_loc != NULL ){ DWLocTrash( Client, dw_loc ); } if( dw_segloc != NULL ){ DWLocTrash( Client, dw_segloc ); } }
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 ); }
static void TestStruct3( void ) { dw_handle class_1; dw_handle class_2; dw_handle class_3; dw_loc_handle field_hdl; dw_loc_id id; class_1 = DWStruct( Client, DW_ST_CLASS ); class_2 = DWStruct( Client, DW_ST_CLASS ); DWBeginStruct( Client, class_1, 4, "bugs", 0, 0 ); DWAddFriend( Client, class_2 ); /* static int a; */ DWAddField( Client, FundamentalTypes[DW_FT_SIGNED], NULL, "a", DW_FLAG_PRIVATE ); // was DW_FLAG_STATIC ?? /* private float b; */ field_hdl = DWLocFini( Client, DWLocInit( Client ) ); DWAddField( Client, FundamentalTypes[DW_FT_FLOAT], field_hdl, "b", DW_FLAG_PRIVATE ); DWLocTrash( Client, field_hdl ); DWEndStruct( Client ); id = DWLocInit( Client ); SymHandles[5] = 0x666UL; DWLocStatic( Client, id, (dw_sym_handle)5 ); field_hdl = DWLocFini( Client, id ); DWVariable( Client, FundamentalTypes[DW_FT_SIGNED], field_hdl, class_1, NULL, "a", 0, 0 ); DWLocTrash( Client, field_hdl ); DWBeginStruct( Client, class_2, 4, "beetles", 0, 0 ); field_hdl = DWLocFini( Client, DWLocInit( Client ) ); DWAddField( Client, FundamentalTypes[DW_FT_FLOAT], field_hdl, "b", DW_FLAG_PRIVATE ); DWLocTrash( Client, field_hdl ); DWEndStruct( Client ); class_3 = DWStruct( Client, DW_ST_CLASS ); DWBeginStruct( Client, class_3, 16, "ants", 0, 0 ); field_hdl = DWLocFini( Client, DWLocInit( Client ) ); DWAddInheritance( Client, class_2, field_hdl, 0 ); DWLocTrash( Client, field_hdl ); DWEndStruct( Client ); }
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 }