static bool DWRGetConstAT( dr_handle abbrev, dr_handle info, unsigned at, unsigned_32 *where ) /******************************************************************/ /* look for a specific attribute in the list of attributes */ /* if found read in */ { unsigned attrib; unsigned form; bool ret; ret = FALSE; for( ;; ) { attrib = DWRVMReadULEB128( &abbrev ); if( attrib == at ) break; form = DWRVMReadULEB128( &abbrev ); if( attrib == 0 ) break; DWRSkipForm( &info, form ); } if( attrib != 0 ) { *where = DWRReadConstant( abbrev, info ); ret = TRUE; } return( ret ); }
static dr_language GetLanguage( drmem_hdl abbrev, drmem_hdl mod ) /***************************************************************/ { dr_language result; dw_langnum lang; result = DR_LANG_UNKNOWN; if( DWRScanForAttrib( &abbrev, &mod, DW_AT_language ) ) { lang = (dw_langnum)DWRReadConstant( abbrev, mod ); switch( lang ) { case DW_LANG_C89: case DW_LANG_C: result = DR_LANG_C; break; case DW_LANG_C_plus_plus: result = DR_LANG_CPLUSPLUS; break; case DW_LANG_Fortran77: case DW_LANG_Fortran90: result = DR_LANG_FORTRAN; break; } } return( result ); }
unsigned DRGetByteSize( drmem_hdl entry ) /***************************************/ { drmem_hdl abbrev; abbrev = DWRSkipTag( &entry ) + 1; if( DWRScanForAttrib( &abbrev, &entry, DW_AT_byte_size ) ) { return( DWRReadConstant( abbrev, entry ) ); } return( 0 ); }
dr_virtuality DRGetVirtuality( drmem_hdl entry ) /**********************************************/ { drmem_hdl abbrev; abbrev = DWRSkipTag( &entry ) + 1; if( DWRScanForAttrib( &abbrev, &entry, DW_AT_virtuality ) ) { return( (dr_virtuality)DWRReadConstant( abbrev, entry ) ); } return( DR_VIRTUALITY_NONE ); }
dr_access DRGetAccess( drmem_hdl entry ) /**************************************/ { drmem_hdl abbrev; abbrev = DWRSkipTag( &entry ) + 1; if( DWRScanForAttrib( &abbrev, &entry, DW_AT_accessibility ) ) { return( (dr_access)DWRReadConstant( abbrev, entry ) ); } return( DR_ACCESS_PUBLIC ); }
static bool GrabLineAddr( drmem_hdl abbrev, drmem_hdl mod, mod_scan_info *x, void *data ) /***************************************************************************************/ /* this is called by ScanCompileUnit with abbrevptr and dataptr pointing at * the start of a compile unit die. This picks out the line number info. * offset, and stores it in data */ { x = x; // to avoid a warning if( DWRScanForAttrib( &abbrev, &mod, DW_AT_stmt_list ) ) { *((unsigned_32 *)data) = DWRReadConstant( abbrev, mod ); } return( false ); // do not continue with the search. }
dr_model DRGetMemModelAT( drmem_hdl entry ) /*****************************************/ { drmem_hdl abbrev; dr_model retval; abbrev = DWRSkipTag( &entry ) + 1; if( DWRScanForAttrib( &abbrev, &entry, DW_AT_WATCOM_memory_model ) ) { retval = (dr_model)DWRReadConstant( abbrev, entry ); } else { retval = DR_MODEL_NONE; } return( retval ); }
long DRGetLine( drmem_hdl entry ) /**************************************/ // NYI: this is not going to work for macros. { long retval; drmem_hdl abbrev; retval = -1; // signifies no column available abbrev = DWRSkipTag( &entry ) + 1; if( DWRScanForAttrib( &abbrev, &entry, DW_AT_decl_line ) ) { retval = DWRReadConstant( abbrev, entry ); } return( retval ); }
extern char *DRGetFileName( drmem_hdl entry ) /*******************************************/ { drmem_hdl abbrev; char * name; dr_fileidx fileidx; name = NULL; abbrev = DWRSkipTag( &entry ) + 1; if( DWRScanForAttrib( &abbrev, &entry, DW_AT_decl_file ) ) { fileidx = (dr_fileidx)DWRReadConstant( abbrev, entry ); name = DWRFindFileName( fileidx, entry ); } return( name ); }
bool DRStartScopeAT( drmem_hdl entry, uint_32 *num ) /**************************************************/ { drmem_hdl abbrev; uint_32 offset; bool ret; abbrev = DWRSkipTag( &entry ) + 1; if( DWRScanForAttrib( &abbrev, &entry, DW_AT_start_scope ) ) { offset = DWRReadConstant( abbrev, entry ); *num = offset; ret = true; } else { ret = false; } return( ret ); }
extern dr_ptr DRGetAddrClass( dr_handle entry ) /*********************************************/ { dr_handle abbrev; dr_ptr ret; int value; abbrev = DWRGetAbbrev( &entry ); if( DWRScanForAttrib( &abbrev, &entry, DW_AT_address_class ) ) { value = DWRReadConstant( abbrev, entry ); } else { value = DW_ADDR_none; } switch( value ) { case DW_ADDR_none: ret = DR_PTR_none; break; case DW_ADDR_near16: ret = DR_PTR_near16; break; case DW_ADDR_far16: ret = DR_PTR_far16; break; case DW_ADDR_huge16: ret = DR_PTR_huge16; break; case DW_ADDR_near32: ret = DR_PTR_near32; break; case DW_ADDR_far32: ret = DR_PTR_far32; break; default: ret = 0; break; } return( ret ); }