Add read_Addr and use it so that we work on systems where an address

is bigger that an int.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12084
This commit is contained in:
Tom Hughes 2011-10-02 12:12:38 +00:00
parent 8ecff4c133
commit acc83cb540
3 changed files with 12 additions and 1 deletions

View File

@ -180,6 +180,16 @@ UChar ML_(read_UChar) ( UChar* data ) {
return data[0];
}
Addr ML_(read_Addr) ( UChar* data ) {
if (sizeof(Addr) == sizeof(UInt)) {
return ML_(read_UInt)(data);
} else if (sizeof(Addr) == sizeof(ULong)) {
return ML_(read_ULong)(data);
} else {
vg_assert(0);
}
}
/*--------------------------------------------------------------------*/
/*--- end misc.c ---*/

View File

@ -51,6 +51,7 @@ UShort ML_(read_UShort)( UChar* data );
UInt ML_(read_UInt)( UChar* data );
ULong ML_(read_ULong)( UChar* data );
UChar ML_(read_UChar)( UChar* data );
Addr ML_(read_Addr)( UChar* data );
/* A handy type, a la Haskell's Maybe type. Yes, I know, C sucks.
Been there. Done that. Seen the movie. Got the T-shirt. Etc. */

View File

@ -393,7 +393,7 @@ Word process_extended_line_op( struct _DebugInfo* di,
break;
case DW_LNE_set_address:
adr = ML_(read_UInt)(data); // FIXME: read_encoded_Addr ??
adr = ML_(read_Addr)(data);
state_machine_regs.address = adr;
if (di->ddump_line)
VG_(printf)(" Extended opcode %d: set Address to 0x%lx\n",