本文整理汇总了C++中Puthex函数的典型用法代码示例。如果您正苦于以下问题:C++ Puthex函数的具体用法?C++ Puthex怎么用?C++ Puthex使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Puthex函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: bit_field_class
/*
* 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" );
}
示例2: dmp_cmd_list
/*
* 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 );
}
}
示例3: Dmp_hll_head
/*
* 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 */
示例4: dmp_resrc_tab_os2
/*
* 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" );
}
示例5: bit_field_struct
/*
* 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" );
}
示例6: desc_array
/*
* 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 */
示例7: dmp_resrc
/*
* 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 );
}
}
示例8: dump_state
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" );
}
示例9: DmpLocList
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;
}
}
示例10: dmp_type_offset
/*
* 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" );
}
示例11: dmp_res_data
/*
* 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" );
}
}
示例12: dmp_res_dir
/*
* 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" );
}
}
}
示例13: dmp_resrc_desc
/*
* 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;
}
}
示例14: range
/*
* 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 );
}
示例15: dump_aranges
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;
}
}