From: Tom Hughes Date: Sun, 2 Oct 2011 12:12:38 +0000 (+0000) Subject: Add read_Addr and use it so that we work on systems where an address X-Git-Tag: svn/VALGRIND_3_7_0~153 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=acc83cb540cac8eda5b6443570cc6875989fb8cb;p=thirdparty%2Fvalgrind.git 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 --- diff --git a/coregrind/m_debuginfo/misc.c b/coregrind/m_debuginfo/misc.c index 3f3def8891..be60ffc38a 100644 --- a/coregrind/m_debuginfo/misc.c +++ b/coregrind/m_debuginfo/misc.c @@ -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 ---*/ diff --git a/coregrind/m_debuginfo/priv_misc.h b/coregrind/m_debuginfo/priv_misc.h index 0070bc7ca1..51a30c96eb 100644 --- a/coregrind/m_debuginfo/priv_misc.h +++ b/coregrind/m_debuginfo/priv_misc.h @@ -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. */ diff --git a/coregrind/m_debuginfo/readdwarf.c b/coregrind/m_debuginfo/readdwarf.c index 8b70af3893..02d8528aec 100644 --- a/coregrind/m_debuginfo/readdwarf.c +++ b/coregrind/m_debuginfo/readdwarf.c @@ -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",