[PATCH 07/14] [DbgHelp]: a couple of fix for dwarf2 support on a 64bit platform

Eric Pouech eric.pouech at orange.fr
Sat Dec 12 05:19:02 CST 2009




A+
---

 dlls/dbghelp/dwarf.c |   21 ++++++++++++++++++---
 1 files changed, 18 insertions(+), 3 deletions(-)


diff --git a/dlls/dbghelp/dwarf.c b/dlls/dbghelp/dwarf.c
index bb7257e..4cd75f2 100644
--- a/dlls/dbghelp/dwarf.c
+++ b/dlls/dbghelp/dwarf.c
@@ -217,7 +217,7 @@ static unsigned char dwarf2_parse_byte(dwarf2_traverse_context_t* ctx)
 
 static unsigned short dwarf2_get_u2(const unsigned char* ptr)
 {
-    return *(const unsigned short*)ptr;
+    return *(const UINT16*)ptr;
 }
 
 static unsigned short dwarf2_parse_u2(dwarf2_traverse_context_t* ctx)
@@ -229,7 +229,7 @@ static unsigned short dwarf2_parse_u2(dwarf2_traverse_context_t* ctx)
 
 static unsigned long dwarf2_get_u4(const unsigned char* ptr)
 {
-    return *(const unsigned long*)ptr;
+    return *(const UINT32*)ptr;
 }
 
 static unsigned long dwarf2_parse_u4(dwarf2_traverse_context_t* ctx)
@@ -239,6 +239,11 @@ static unsigned long dwarf2_parse_u4(dwarf2_traverse_context_t* ctx)
     return uvalue;
 }
 
+static DWORD64 dwarf2_get_u8(const unsigned char* ptr)
+{
+    return *(const UINT64*)ptr;
+}
+
 static unsigned long dwarf2_get_leb128_as_unsigned(const unsigned char* ptr, const unsigned char** end)
 {
     unsigned long ret = 0;
@@ -309,6 +314,13 @@ static unsigned dwarf2_leb128_length(const dwarf2_traverse_context_t* ctx)
     return ret + 1;
 }
 
+/******************************************************************
+ *		dwarf2_get_addr
+ *
+ * Returns an address.
+ * We assume that in all cases word size from Dwarf matches the size of
+ * addresses in platform where the exec is compiled.
+ */
 static unsigned long dwarf2_get_addr(const unsigned char* ptr, unsigned word_size)
 {
     unsigned long ret;
@@ -318,6 +330,9 @@ static unsigned long dwarf2_get_addr(const unsigned char* ptr, unsigned word_siz
     case 4:
         ret = dwarf2_get_u4(ptr);
         break;
+    case 8:
+        ret = dwarf2_get_u8(ptr);
+	break;
     default:
         FIXME("Unsupported Word Size %u\n", word_size);
         ret = 0;
@@ -2033,7 +2048,7 @@ static BOOL dwarf2_parse_compilation_unit(const dwarf2_section_t* sections,
     cu_ctx.word_size = dwarf2_parse_byte(&cu_ctx);
 
     TRACE("Compilation Unit Header found at 0x%x:\n",
-          comp_unit_start - sections[section_debug].address);
+          (int)(comp_unit_start - sections[section_debug].address));
     TRACE("- length:        %lu\n", cu_length);
     TRACE("- version:       %u\n",  cu_version);
     TRACE("- abbrev_offset: %lu\n", cu_abbrev_offset);






More information about the wine-patches mailing list