static bool CheckLoadDebugInfo( image_entry *image, file_handle fh, dip_priority start, dip_priority end ) { char buff[TXT_LEN]; char *symfile; dip_priority priority; char *endstr; image->dip_handle = NO_MOD; for( priority = start - 1; (priority = DIPPriority( priority )) != 0; ) { if( priority > end ) return( false ); DIPStatus = DS_OK; image->dip_handle = DIPLoadInfo( FH2FP( fh ), sizeof( image_entry * ), priority ); if( image->dip_handle != NO_MOD ) break; if( DIPStatus & DS_ERR ) { symfile = image->symfile_name; if( symfile == NULL ) symfile = image->image_name; endstr = Format( buff, LIT_ENG( Sym_Info_Load_Failed ), symfile ); *endstr++ = ' '; StrCopy( DIPMsgText( DIPStatus ), endstr ); Warn( buff ); return( false ); } } *(image_entry **)DIPImageExtra( image->dip_handle ) = image; return( true ); }
mod_handle WPDipLoadInfo( dig_fhandle fid, const char *f_name, void *image, unsigned image_size, unsigned dip_start, unsigned dip_end ) /****************************************************************************/ { unsigned prio; mod_handle dip_module; dip_module = NO_MOD; prio = dip_start; for( ;; ) { prio = DIPPriority( prio ); if( prio == 0 || prio > dip_end ) break; DIPStatus = DS_OK; dip_module = DIPLoadInfo( fid, image_size, prio ); if( dip_module != NO_MOD ) { *(void **)DIPImageExtra( dip_module ) = image; DIPMapInfo( dip_module, image ); break; } if( DIPStatus & DS_ERR ) { ErrorMsg( LIT( Dip_Info_Failed ), f_name, errMsgText( DIPStatus ) ); } } return( dip_module ); }
image_entry *ImageEntry( mod_handle mh ) { image_entry **image_ptr; image_ptr = DIPImageExtra( mh ); return( (image_ptr == NULL) ? NULL : *image_ptr ); }
STATIC void resolveImageSamples( void ) /*************************************/ { image_info *curr_image; massgd_sample_addr **massgd_data; mod_info *curr_mod; file_info *curr_file; rtn_info *curr_rtn; address *addr; sample_index_t tick_index; mod_handle mh; sym_handle *sh; long int count; int count2; int count3; int count4; int index; int index2; sh = alloca( DIPHandleSize( HK_SYM, false ) ); massgd_data = CurrSIOData->massaged_sample; tick_index = 1; index = 0; index2 = 0; for( count = 0; count < CurrSIOData->number_massaged; ++count, ++index2 ) { if( index2 > MAX_MASSGD_BUCKET_INDEX ) { ++index; index2 = 0; } addr = massgd_data[index][index2].raw; if( DIPAddrMod( *addr, &mh ) == SR_NONE ) { curr_image = AddrImage( addr ); if( curr_image == NULL ) { curr_image = CurrSIOData->images[0]; } curr_mod = curr_image->module[0]; curr_rtn = curr_mod->mod_file[0]->routine[0]; } else { curr_image = *(image_info **)DIPImageExtra( mh ); curr_mod = findCurrMod( curr_image, mh ); if( DIPAddrSym( mh, *addr, sh ) == SR_NONE ) { curr_rtn = curr_mod->mod_file[0]->routine[0]; } else { curr_rtn = findCurrRtn( curr_mod, sh ); /**/ myassert( curr_rtn != NULL ); } } if( curr_rtn != NULL ) { curr_rtn->tick_count += massgd_data[index][index2].hits; if( curr_rtn->first_tick_index == 0 ) { curr_rtn->first_tick_index = tick_index; if( curr_mod->first_tick_index == 0 || curr_mod->first_tick_index > tick_index ) { curr_mod->first_tick_index = tick_index; } } curr_rtn->last_tick_index = tick_index; } tick_index++; } CurrSIOData->max_time = 0; for( count = 0; count < CurrSIOData->image_count; ++count ) { curr_image = CurrSIOData->images[count]; curr_image->max_time = 0; for( count2 = 0; count2 < curr_image->mod_count; ++count2 ) { curr_mod = curr_image->module[count2]; curr_mod->max_time = 0; for( count3 = 0; count3 < curr_mod->file_count; ++count3 ) { curr_file = curr_mod->mod_file[count3]; curr_rtn = curr_file->routine[0]; if( curr_rtn->unknown_routine && curr_rtn->tick_count == 0 ) { curr_rtn->ignore_unknown_rtn = true; curr_file->ignore_unknown_rtn = true; } curr_file->max_time = 0; for( count4 = 0; count4 < curr_file->rtn_count; ++count4 ) { curr_rtn = curr_file->routine[count4]; curr_file->agg_count += curr_rtn->tick_count; if( curr_rtn->tick_count > curr_file->max_time ) { curr_file->max_time = curr_rtn->tick_count; } } curr_mod->agg_count += curr_file->agg_count; if( curr_file->agg_count > curr_mod->max_time ) { curr_mod->max_time = curr_file->agg_count; } } curr_file = curr_mod->mod_file[0]; if( curr_file->unknown_file && curr_file->agg_count == 0 ) { curr_file->ignore_unknown_file = true; curr_mod->ignore_unknown_file = true; } curr_image->agg_count += curr_mod->agg_count; if( curr_mod->agg_count > curr_image->max_time ) { curr_image->max_time = curr_mod->agg_count; } } curr_mod = curr_image->module[0]; if( curr_mod->unknown_module && curr_mod->agg_count == 0 ) { curr_mod->ignore_unknown_mod = true; curr_image->ignore_unknown_mod = true; } if( curr_image->agg_count > CurrSIOData->max_time ) { CurrSIOData->max_time = curr_image->agg_count; } } curr_image = CurrSIOData->images[0]; if( curr_image->unknown_image && curr_image->agg_count == 0 ) { curr_image->ignore_unknown_image = true; } }