/* * bit_field_class - dump info */ static void bit_field_class( unsigned_8 *buff, bool bit ) /*******************************************************/ { unsigned_8 *ptr; unsigned_16 index; char name[256]; ptr = buff+3; Wdputs( " field locator = " ); ptr = Dump_location_expression( ptr, " " ); if( bit ) { ptr += 2; } ptr = Get_type_index( ptr, &index ); Get_local_name( name, ptr, buff ); Wdputs( " name = \"" ); Wdputs( name ); Wdputs( "\" type idx = " ); Putdec( index ); Wdputslc( "\n attribute = " ); attribute_byte( buff[2] ); if( bit ) { Wdputslc( " start bit = " ); ptr++; Puthex( *ptr, 2 ); Wdputslc( " bit size = " ); ptr++; Puthex( *ptr, 2 ); } Wdputslc( "\n" ); }
/* * Dump the Mach-O command list. */ static void dmp_cmd_list( unsigned_32 start, int n ) { int i; unsigned_32 offset; uint32_t cmd, cmdsize; struct segment_command seg; offset = start + sizeof( struct mach_header ); for( i = 0; i < n; ++i ) { Wlseek( offset ); Wread( &cmd, sizeof( cmd ) ); Wread( &cmdsize, sizeof( cmdsize ) ); Wlseek( offset ); switch( cmd ) { case LC_SEGMENT: Wread( &seg, sizeof( seg ) ); Dump_header( &seg, m_segment_msg ); break; default: Wdputs( "\ncmd = " ); Puthex( cmd, 8 ); Wdputs( "H\ncmdsize = " ); Puthex( cmdsize, 8 ); Wdputs( "H" ); } Wdputslc( "\n" ); offset += cmdsize; Wlseek( offset ); } }
/* * Dmp_hll_head - dump IBM HLL or MS CodeView debugging information */ bool Dmp_hll_head( void ) /**********************/ { off_t end_off; off_t dbg_off; hll_trailer trailer; end_off = lseek( Handle, 0, SEEK_END ); Wlseek( end_off - sizeof( trailer ) ); Wread( &trailer, sizeof( trailer ) ); dbg_off = end_off - trailer.offset; if( memcmp( trailer.sig, HLL_NB04, HLL_SIG_SIZE ) == 0 ) { Banner( "HLL NB04 debugging information" ); Wdputs( "debugging information base = " ); Puthex( dbg_off, 8 ); Wdputslc( "H\n" ); Wdputs( "subsection directory offset = " ); Puthex( trailer.offset, 8 ); Wdputslc( "H\n\n" ); dump_hll( dbg_off ); return( true ); } else if( memcmp( trailer.sig, HLL_NB02, HLL_SIG_SIZE ) == 0 ) { Banner( "CodeView NB02 debugging information" ); Wdputs( "debugging information base = " ); Puthex( dbg_off, 8 ); Wdputslc( "H\n" ); Wdputs( "subsection directory offset = " ); Puthex( trailer.offset, 8 ); Wdputslc( "H\n\n" ); dump_cv( dbg_off ); return( true ); } return( false ); } /* Dmp_hll_head */
/* * Dump The Resource Table for OS/2 NE module */ static void dmp_resrc_tab_os2( void ) /***********************************/ { unsigned_16 i; unsigned_16 id; os2_res_entry res_tab; id = 30; /* if id > 22 a name won't be printed out */ Wdputslc( " seg# type id name id\n" ); Wdputslc( " ==== ======= =======\n" ); for( i = 0; i < Os2_head.resource; i++ ) { Wread( &res_tab, sizeof( os2_res_entry ) ); if( res_tab.type_id != id ) { id = res_tab.type_id; if( id < 23 ) { Wdputs( "type: " ); Wdputslc( resource_type_os2[ res_tab.type_id ] ); } } Wdputs( " " ); Puthex( i + Os2_head.segments - Os2_head.resource + 1, 4 ); Wdputs( " " ); Puthex( res_tab.type_id, 4 ); Wdputs( " " ); Puthex( res_tab.name_id, 4 ); Wdputs( " " ); Wdputslc( "\n" ); } Wdputslc( "\n" ); }
/* * bit_field_struct - dump info */ static void bit_field_struct( unsigned_8 *buff, unsigned_8 size, bool bit ) /*************************************************************************/ { unsigned_8 *ptr; unsigned_16 index; char name[256]; ptr = buff+2+size; if( bit ) { ptr += 2; } ptr = Get_type_index( ptr, &index ); Get_local_name( name, ptr, buff ); Wdputs( " \"" ); Wdputs( name ); Wdputs( "\" offset = " ); ptr = buff+2; Puthex( *ptr, 2*size ); Wdputs( " type idx = " ); Putdec( index ); if( bit ) { Wdputslc( "\n start bit = " ); ptr++; Puthex( *ptr, 2 ); Wdputslc( " bit size = " ); ptr++; Puthex( *ptr, 2 ); } Wdputslc( "\n" ); }
/* * desc_array - dump info */ static void desc_array( unsigned_8 *ptr, bool is386 ) /***************************************************/ { addr32_ptr *p32; addr48_ptr *p48; Wdputs( " scalar type 1 = " ); scalar_type( ptr[0] ); Wdputs( " scalar type 2 = " ); scalar_type( ptr[1] ); ptr += 2; Wdputslc( "\n addr = " ); if( is386 ) { p48 = (addr48_ptr *)ptr; ptr += sizeof(addr48_ptr); Puthex( p48->segment, 4 ); Wdputc( ':' ); Puthex( p48->offset, 8 ); } else { p32 = (addr32_ptr *)ptr; ptr += sizeof(addr32_ptr); Puthex( p32->segment, 4 ); Wdputc( ':' ); Puthex( p32->offset, 4 ); } base_type_index( ptr ); } /* desc_array */
/* * Dump resources. */ static void dmp_resrc( unsigned_16 size, unsigned_32 offset ) /***********************************************************/ { unsigned_16 i; lmf_resource resrc; Wdputslc( "\n" ); Banner( "Resource Table" ); Wread( &resrc, sizeof( lmf_resource ) ); Wdputs( "resource type (0==usage) = " ); Puthex( resrc.res_type, 4 ); Wdputslc( "H\n" ); Wdputs( "zeros = " ); for( i = 0; i < 3; i++ ) { // 3 spares (zeros) Puthex( resrc.spare[i], 4 ); Wdputs( "H " ); } Wdputslc( "\n" ); size -= sizeof( lmf_resource ); Wdputs( "size = " ); Puthex( size, 4 ); Wdputslc( "H\n" ); offset += sizeof( lmf_resource ); if( Options_dmp & RESRC_DMP ) { Dmp_seg_data( offset, size ); } }
static void dump_state( state_info *state ) /*****************************************/ { Wdputs( "-- file " ); Putdec( state->file ); Wdputs( " addr " ); if( state->segment != 0 ) { Puthex( state->segment, 4 ); Wdputs( ":" ); } Puthex( state->address, 8 ); Wdputs( " line " ); Putdec( state->line ); Wdputs( " column " ); Putdec( state->column ); if( state->is_stmt ) { Wdputs( " is_stmt" ); } if( state->basic_block ) { Wdputs( " basic_block" ); } if( state->end_sequence ) { Wdputs( " end_sequence" ); } Wdputslc( "\n" ); }
static void DmpLocList( uint_32 start, uint addr_size ) /*****************************************************/ { uint_32 low; uint_32 high; int len; uint_8 const *p; uint_8 const *stop; p = Sections[ DW_DEBUG_LOC ].data; stop = p + Sections[ DW_DEBUG_LOC ].max_offset; if( p == NULL ) { Wdputslc( "Error: No location list section\n" ); return; } p += start; while( p < stop ) { p = GetInt( p, &low, addr_size ); p = GetInt( p, &high, addr_size ); if( low == high && low == 0 ) { Wdputslc( " <end>\n" ); return; } len = get_u16( (uint_16 *)p ); p+= sizeof( uint_16 ); Wdputslc( "\n Range: " ); Puthex( low, addr_size * 2 ); Wdputs( ":" ); Puthex( high, addr_size * 2 ); Wdputslc( "\n" ); DmpLoc( p, len, addr_size ); p += len; } }
/* * Dump the type and offsets. */ static void dmp_type_offset( unsigned_32 bsize ) /**********************************************/ { unsigned_32 i; unsigned prev; pe_fixup_entry entry; Wdputslc( "type:offset type --\n" ); Wdputslc( "0 = ABSOLUTE, 1 = LOW, 2 = HIGH, 3 = HIGHLOW, 4 = HIGHADJUST, 5 = MIPSJMPADDR\n" ); prev = 0; for( i = 0; i < bsize; i++ ) { Wread( &entry, sizeof( pe_fixup_entry ) ); if( i != 0 ) { if( (i) % 8 == 0 ) { Wdputslc( "\n" ); } else { Wdputs( " " ); } } if( prev == 4 ) { Wdputc( ' ' ); Puthex( entry, 4 ); prev = 0; } else { prev = entry >> 12; Puthex( prev, 1 ); Wdputc( ':' ); Puthex( entry, 3 ); } } Wdputslc( "\n" ); }
/* * Dump the Resource Data. */ static void dmp_res_data( void ) /******************************/ { resource_entry res_data; unsigned_16 i; Wdputslc( "\n" ); Wdputslc( " data rva data size codepage reserved\n" ); Wdputslc( " ======== ======== ======== ========\n" ); Wlseek( Data_off ); for( i = 0; ; i++ ) { Wread( &res_data, sizeof( resource_entry ) ); if( res_data.rsvd != 0 ) break; Putdecl( i, 3 ); Wdputs( ": " ); Puthex( res_data.data_rva, 8 ); Wdputs( " " ); Puthex( res_data.size, 8 ); Wdputs( " " ); Puthex( res_data.code_page, 8 ); Wdputs( " " ); Puthex( res_data.rsvd, 8 ); Wdputslc( "\n" ); } }
/* * Dump the Resource Directory. */ static void dmp_res_dir( void ) /*****************************/ { resource_dir_header res_head; resource_dir_entry res_dir; unsigned_16 count, i; Wdputslc( "\n" ); Wdputslc( "80000000H = name rva, else integer id\n" ); Wdputslc( "80000000H = sudirectory rva, else data entry rva\n" ); Wdputslc( " #id ents #name ents name rva/id data/subdir rva\n" ); Wdputslc( " ==== ==== ======== ========\n" ); Wlseek( Res_off ); for( ;; ) { Wread( &res_head, sizeof( resource_dir_header ) ); count = res_head.num_name_entries + res_head.num_id_entries; if( count == 0 ) break; Wdputs( " " ); Puthex( res_head.num_id_entries, 4 ); Wdputs( " " ); Puthex( res_head.num_name_entries, 4 ); Wdputs( " " ); for( i = 0; i < count; i++ ) { Wread( &res_dir, sizeof( resource_dir_entry ) ); if( i != 0 ) { Wdputs( " " ); } Puthex( res_dir.id_name, 8 ); Wdputs( " " ); Puthex( res_dir.entry_rva, 8 ); Wdputslc( "\n" ); } } }
/* * dump a resource description */ static void dmp_resrc_desc( struct resource_record * res_ent ) /************************************************************/ { unsigned_32 res_off; unsigned_32 res_len; unsigned_32 res_end; dmp_resrc_nam( res_ent->name ); Wdputs( " file offset " ); res_off = (unsigned_32)res_ent->offset << Resrc_shift_cnt; Puthex( res_off, 8 ); Wdputs( "H len " ); res_len = (unsigned_32)res_ent->length << Resrc_shift_cnt; Puthex( res_len, 8 ); Wdputs( " flag " ); dmp_resrc_flag( res_ent->flags ); Wdputslc( "\n" ); if( Options_dmp & RESRC_DMP ) { Wdputslc( " data =\n" ); Dmp_seg_data( res_off, res_len ); } res_end = res_off + res_len; if( res_end > Resrc_end ) { Resrc_end = res_end; } }
/* * Dump a note section. */ static void dmp_sec_note( unsigned_32 offset, unsigned_32 size ) /**************************************************************/ { Elf_Note note; unsigned_32 read = 0; unsigned_32 skip; char *ptr; Wlseek( offset ); while( read < size ) { Wdputslc( "\n" ); Wread( ¬e, sizeof( note ) ); read += sizeof( note ); if( Byte_swap ) { SWAP_32( note.n_namesz ); SWAP_32( note.n_descsz ); SWAP_32( note.n_type ); } ptr = Wmalloc( note.n_namesz ); Wread( ptr, note.n_namesz ); Wdputs( " note name: " ); Wdputs( ptr ); Wdputslc( "\n" ); Wdputs( " descriptor length: " ); Puthex( note.n_descsz, 8 ); Wdputslc( "H\n" ); Wdputs( " note type: " ); switch( note.n_type ) { case NT_PRSTATUS: Wdputs( "process status" ); break; case NT_FPREGSET: Wdputs( "floating-point registers" ); break; case NT_PRPSINFO: Wdputs( "process info" ); break; default: Wdputs( "unknown (" ); Puthex( note.n_type, 8 ); Wdputs( "H)" ); } Wdputslc( "\n" ); free( ptr ); /* Calculate rounded up note name length */ skip = (note.n_namesz + ELF_ROUND) & ~ELF_ROUND; read += skip; Wlseek( offset + read ); /* Calculate rounded up note descriptor length */ skip = (note.n_descsz + ELF_ROUND) & ~ELF_ROUND; read += skip; Wlseek( offset + read ); } }
/* * range - dump info */ static void range( unsigned_8 *ptr, unsigned_8 size ) /***************************************************/ { Wdputs( " low bound = " ); Puthex( *ptr, 2*size ); Wdputs( " high bound = " ); ptr += size; Puthex( *ptr, 2*size ); ptr += size; base_type_index( ptr ); }
static void dump_aranges( const uint_8 *p, uint length ) /******************************************************/ { const uint_8 *end; const uint_8 *unit_end; uint_32 unit_length; uint_32 dbg_offset; uint_32 addr; uint_32 seg; uint_32 len; int addr_size; int seg_size; end = &p[length]; addr_size = 0; while( p < end ) { unit_length = get_u32( (uint_32 *)p ); unit_end = &p[unit_length + sizeof( uint_32 )]; Wdputs( "Length: " ); Puthex( unit_length, 8 ); Wdputslc( "\nVersion: " ); Puthex( get_u16( (uint_16 *)(p + 4) ), 4 ); Wdputslc( "\nDbg Info: " ); dbg_offset = get_u32( (uint_32 *)(p + 6) ); Puthex( dbg_offset, 8 ); addr_size = *(p + 10); Wdputslc( "\nAddress Size " ); Puthex( addr_size, 2 ); seg_size = *(p + 11); Wdputslc( "\nSegment Size " ); Puthex( seg_size, 2 ); Wdputslc( "\n" ); p += 12; Wdputslc( " Address Length\n" ); while( p < unit_end ) { p = GetInt( p, &addr, addr_size ); p = GetInt( p, &seg, seg_size ); p = GetInt( p, &len, addr_size ); if( addr == 0 && seg == 0 && len == 0 ) break; Wdputs( " " ); if( seg_size != 0 ) { Puthex( seg, seg_size * 2 ); Wdputs( ":" ); Puthex( addr, addr_size * 2 ); } else { Puthex( addr, addr_size * 2 ); Wdputs( " " ); } Wdputs( " " ); Puthex( len, addr_size * 2 ); Wdputslc( "\n" ); } p = unit_end; } }
void Dump_header( void *data_ptr, char **msg ) /********************************************/ { unsigned_8 *data = (unsigned_8 *)data_ptr; int skip; bool print_h; for( ; *msg != NULL; ++msg ) { print_h = TRUE; switch( msg[0][0] ) { case '1': Wdputs( &msg[0][1] ); Wdputs( " " ); Puthex( *(unsigned_8 *)data, 2 ); data += sizeof( unsigned_8 ); break; case '2': Wdputs( &msg[0][1] ); Wdputs( " " ); Puthex( *(unsigned_16 *)data, 4 ); data += sizeof( unsigned_16 ); break; case '4': Wdputs( &msg[0][1] ); Puthex( *(unsigned_32 *)data, 8 ); data += sizeof( unsigned_32 ); break; case '0': // fixed size ASCIIZ string skip = msg[0][1] - '0'; if( isdigit( msg[0][2] ) ) { skip = skip * 10 + msg[0][2] - '0'; Wdputs( &msg[0][3] ); } else { Wdputs( &msg[0][2] ); } Wdputs( (char *)data ); data += skip; print_h = FALSE; break; default: Wdputs( &msg[0][1] ); Wdputs( "*** invalid size" ); break; } if( print_h ) { Wdputs( "H" ); } Wdputslc( "\n" ); } }
/* * Dump rw end. */ static void dmp_rw_end( void ) /****************************/ { lmf_rw_end rw_end; Wdputslc( "\n" ); Banner( "Read/Write end" ); Wread( &rw_end, sizeof( lmf_rw_end ) ); Wdputs( "verify = " ); Puthex( rw_end.verify, 4 ); Wdputs( "H signature = " ); Puthex( rw_end.signature, 8 ); Wdputslc( "H\n" ); }
/* * Dump the coff object, if any. */ bool Dmp_coff_head( void ) /************************/ { coff_file_header header; Wlseek( Coff_off ); Wread( &header, sizeof( coff_file_header ) ); if( header.cpu_type != IMAGE_FILE_MACHINE_I386 && header.cpu_type != IMAGE_FILE_MACHINE_ALPHA && header.cpu_type != IMAGE_FILE_MACHINE_UNKNOWN && header.cpu_type != IMAGE_FILE_MACHINE_POWERPC ) { return 0; } Banner( "COFF object file" ); Wdputs( "file offset = " ); Puthex( Coff_off, 8 ); Wdputslc( "H\n" ); Wdputslc( "\n" ); Dump_header( (char *)&header, coff_hdr_msg ); DumpCoffHdrFlags( header.flags ); load_string_table( &header ); Wlseek( Coff_off + sizeof(coff_file_header) + header.opt_hdr_size ); dmp_objects( header.num_sections ); unload_string_table(); dmp_symtab( header.sym_table, header.num_symbols ); return 1; }
/* * dump_section - dump the current section */ void Dump_section( void ) /***********************/ { section_dbg_header sdh; Wread( &sdh, sizeof( section_dbg_header ) ); Wdputs( "Section " ); Putdec( sdh.section_id ); Wdputs( " (off=" ); Puthex( Curr_sectoff, 8 ); Wdputslc( ")\n" ); Wdputslc( "=========================\n" ); Dump_header( (char *)&sdh.mod_offset, sdh_msg ); Wdputslc( "\n" ); currSect = sdh.section_id; if( Debug_options & MODULE_INFO ) { dump_module_info( &sdh ); } if( Debug_options & GLOBAL_INFO ) { dump_global_info( &sdh ); } if( Debug_options & ADDR_INFO ) { dump_addr_info( &sdh ); } } /* dump_section */
/* * Dump segments. */ static void dmp_seg( unsigned_16 size ) /*************************************/ { unsigned_16 i; unsigned_32 seg; if( !size ) { return; } Wdputslc( "segments = type:size\n" ); Wdputslc( "type 0==read/write, 1==read-only, 2==execute/read, 3==execute-only\n" ); for( i = 0; i < size; i++ ) { if( i != 0 ) { if( i % 6 == 0 ) { Wdputslc( "\n" ); } else { Wdputs( " " ); } } Wread( &seg, sizeof( unsigned_32 ) ); Puthex( seg >> 28, 1 ); Wdputc( ':' ); Puthex( seg, 7 ); } Wdputslc( "\n" ); }
/* * Dump Segment Table */ void Dmp_seg_tab( void ) /**********************/ { unsigned_16 num_segs; struct segment_record *segtab; unsigned_16 segtabsize; unsigned_16 segnum; Banner( "Segment Table" ); num_segs = Os2_head.segments; if( num_segs == 0 ) { return; } Wlseek( New_exe_off + Os2_head.segment_off ); segtabsize = sizeof( struct segment_record ) * num_segs; segtab = Wmalloc( segtabsize ); Wread( segtab, segtabsize ); Int_seg_tab = segtab; ++num_segs; Wdputslc( "seg fileoff len alloc prior priv flag\n" ); Wdputslc( "==== ======== ==== ==== ==== ==== ====\n" ); for( segnum = 1; segnum != num_segs; segnum++ ) { Puthex( segnum, 4 ); dmp_seg_ent( segtab++ ); } Wdputslc( "\n" ); }
/* * array_index - dump info */ static void array_index( unsigned_8 *ptr, unsigned_8 size ) /*********************************************************/ { Wdputs( " high bound = " ); Puthex( *ptr, 2*size ); base_type_index( ptr+size ); }
/* * dump_cv_sstModules - dump CV sstModules at 'offset' from 'base' */ static void dump_cv_sstModules( unsigned_32 base, unsigned_32 offset ) /********************************************************************/ { cv3_module_16 mod; cv3_seginfo_16 seg; bool first = true; Wlseek( base + offset ); Wdputs( "==== sstModules at offset " ); Puthex( offset, 8 ); Wdputslc( "\n" ); Wread( &mod, offsetof( cv3_module_16, name_len ) ); Dump_header( &mod, cv_sstModules_msg ); Wdputs( " module name: \"" ); dump_name( 0 ); Wdputslc( "\"\n" ); if( mod.cSeg ) { while( --mod.cSeg ) { if( !first ) { Wdputslc( " ====\n" ); } Wread( &seg, sizeof( seg ) ); Dump_header( &seg, cv_seg_msg ); first = false; } } Wdputslc( "\n" ); }
/* * dump_hll_sstModules - dump HLL sstModules at 'offset' from 'base' */ static void dump_hll_sstModules( unsigned_32 base, unsigned_32 offset ) /*********************************************************************/ { hll_module mod; hll_seginfo seg; bool first = true; Wlseek( base + offset ); Wdputs( "==== sstModules at offset " ); Puthex( offset, 8 ); Wdputslc( "\n" ); Wread( &mod, offsetof( hll_module, name_len ) ); Dump_header( &mod, hll_sstModules_msg ); hll_level = mod.Version >> 8; Wdputs( " module name: \"" ); dump_name( 0 ); Wdputslc( "\"\n" ); if( mod.cSeg ) { while( --mod.cSeg ) { if( !first ) { Wdputslc( " ====\n" ); } Wread( &seg, sizeof( seg ) ); Dump_header( &seg, hll_seg_msg ); first = false; } } Wdputslc( "\n" ); }
/* * dump_hll_sstPublics - dump HLL sstPublics at 'offset' * from 'base 'containing 'size' bytes */ static void dump_hll_sstPublics( unsigned_32 base, unsigned_32 offset, unsigned_32 size ) /********************************************************************/ { hll_public_32 pub32; unsigned_32 read = 0; unsigned_8 name_len; char name[256]; Wlseek( base + offset ); Wdputs( "==== sstPublics at offset " ); Puthex( offset, 8 ); Wdputslc( "\n" ); while( read < size ) { Wread( &pub32, sizeof( pub32 ) ); name_len = pub32.name_len; Dump_header( &pub32, hll_sstPublics_msg ); read += sizeof( pub32 ); Wread( name, name_len ); name[name_len] = '\0'; Wdputs( " symbol name: \"" ); Wdputs( name ); read += name_len; Wdputslc( "\"\n" ); } Wdputslc( "\n" ); }
/* * Dump public entry (export) table. */ static void dmp_public_entry( void ) /**********************************/ { unsigned_32 i; unsigned_8 len; char *name; unsigned_32 addr; if( Nlm_head.numberOfPublics == 0 ) { return; } Wdputslc( "\n" ); Wlseek( Nlm_head.publicsOffset ); Banner( "Public Entry (Export) Table" ); Wdputslc( "80000000H = symbol is in code\n" ); Wdputslc( " Address Name\n" ); Wdputslc( " ======= ====\n" ); for( i = 0; i < Nlm_head.numberOfPublics; i++ ) { Wread( &len, sizeof( unsigned_8 ) ); name = Wmalloc( len ); Wread( name, len ); name[len] = '\0'; Wread( &addr, sizeof( unsigned_32 ) ); Wdputs( " " ); Puthex( addr, 8 ); Wdputs( " " ); Wdputs( name ); Wdputslc( "\n" ); } }
/* * Dump relocation fixup table. */ static void dmp_reloc_fixup( void ) /*********************************/ { unsigned_32 i; unsigned_32 reloc; if( Nlm_head.numberOfRelocationFixups == 0 ) { return; } Wdputslc( "\n" ); Wlseek( Nlm_head.relocationFixupOffset ); Banner( "Relocation Fixup Table" ); Wdputslc( "80000000H = target is in code segment\n" ); Wdputslc( "40000000H = source of fixup is in code segment\n" ); for( i = 0; i < Nlm_head.numberOfRelocationFixups; i++ ) { Wread( &reloc, sizeof( unsigned_32 ) ); if( i != 0 ) { if( (i) % 6 == 0 ) { Wdputslc( "\n" ); } else { Wdputs( " " ); } } Puthex( reloc, 8 ); } Wdputslc( "\n" ); }
/* * dump_global_info - dump out global info */ static void dump_global_info( section_dbg_header *sdh ) /*****************************************************/ { unsigned_32 total_bytes; unsigned_32 bytes_read; v3_gbl_info *gi; long cpos; char name[256]; total_bytes = sdh->addr_offset - sdh->gbl_offset; print_info_title( "Global" ); bytes_read = 0; gi = (v3_gbl_info *) Wbuff; cpos = Curr_sectoff + sdh->gbl_offset; while( bytes_read < total_bytes ) { Wlseek( cpos ); Wread( Wbuff, sizeof( v3_gbl_info ) + 255 ); bytes_read += sizeof( v3_gbl_info ) + gi->name[0]; cpos += sizeof( v3_gbl_info ) + gi->name[0]; get_len_prefix_string( name, gi->name ); Wdputs( " Name: " ); Wdputs( name ); Wdputslc( "\n" ); Wdputs( " address = " ); Puthex( gi->addr.segment, 4 ); Wdputc( ':' ); Puthex( gi->addr.offset, 8 ); Wdputslc( "\n" ); Wdputs( " module index = " ); Putdec( gi->mod ); Wdputslc( "\n" ); Wdputs( " kind: " ); if( gi->kind & GBL_KIND_STATIC ) { Wdputs( " (static pubdef)" ); } if( gi->kind & GBL_KIND_CODE ) { Wdputs( " (code)" ); } if( gi->kind & GBL_KIND_DATA ) { Wdputs( " (data)" ); } Wdputslc( "\n" ); } Wdputslc( "\n" ); } /* dump_global_info */
static void dump_pubnames( const uint_8 *p, uint length ) /*******************************************************/ { const uint_8 *end; const uint_8 *unit_end; uint_32 unit_length; uint_32 dbg_offset; uint_32 dbg_length; uint_32 offset; end = &p[length]; while( p < end ) { unit_length = get_u32( (uint_32 *)p ); unit_end = &p[unit_length + sizeof( uint_32 )]; Wdputs( "Length: " ); Puthex( unit_length, 8 ); Wdputslc( "\nVersion: " ); Puthex( get_u16( (uint_16*)(p + 4) ), 2 ); Wdputslc( "\nDbg Info: " ); dbg_offset = get_u32( (uint_32 *)(p + 6) ); Puthex( dbg_offset, 8 ); Wdputslc( "\nDbg Length: " ); dbg_length = get_u32( (uint_32 *)(p + 10) ); Puthex( dbg_length, 8 ); Wdputslc( "\n" ); p += 14; Wdputslc( " Offset Name\n" ); while( p < unit_end ) { offset = get_u32( (uint_32 *)p ); if( offset == 0 ) { break; } p += sizeof( uint_32 ); Wdputs( " " ); Puthex( offset, 8 ); Wdputs( " " ); Wdputs( (char *)p ); Wdputslc( "\n" ); p += strlen( (char *)p ) + 1; } p = unit_end; } }