Alexandre Julliard : dbghelp: Use Dwarf debug info even when part of it is missing.

Alexandre Julliard julliard at winehq.org
Mon Jan 24 11:07:41 CST 2011


Module: wine
Branch: master
Commit: 9926ca771b7fb0d8f217f5115919e16d5f8c676b
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=9926ca771b7fb0d8f217f5115919e16d5f8c676b

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Jan 24 15:52:42 2011 +0100

dbghelp: Use Dwarf debug info even when part of it is missing.

---

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

diff --git a/dlls/dbghelp/dwarf.c b/dlls/dbghelp/dwarf.c
index d60a5fd..e02e654 100644
--- a/dlls/dbghelp/dwarf.c
+++ b/dlls/dbghelp/dwarf.c
@@ -3174,31 +3174,29 @@ BOOL dwarf2_parse(struct module* module, unsigned long load_offset,
                   const struct elf_thunk_area* thunks,
                   struct image_file_map* fmap)
 {
-    dwarf2_section_t    section[section_max];
+    dwarf2_section_t    eh_frame, section[section_max];
     dwarf2_traverse_context_t   mod_ctx;
     struct image_section_map    debug_sect, debug_str_sect, debug_abbrev_sect,
-                                debug_line_sect, debug_ranges_sect;
+                                debug_line_sect, debug_ranges_sect, eh_frame_sect;
     BOOL                ret = TRUE;
     struct module_format* dwarf2_modfmt;
 
-    if (!dwarf2_init_section(&section[section_debug],  fmap, ".debug_info", &debug_sect))
-        /* no Dwarf debug info here */
-        return FALSE;
-
+    dwarf2_init_section(&eh_frame,                fmap, ".eh_frame",     &eh_frame_sect);
+    dwarf2_init_section(&section[section_debug],  fmap, ".debug_info",   &debug_sect);
     dwarf2_init_section(&section[section_abbrev], fmap, ".debug_abbrev", &debug_abbrev_sect);
     dwarf2_init_section(&section[section_string], fmap, ".debug_str",    &debug_str_sect);
     dwarf2_init_section(&section[section_line],   fmap, ".debug_line",   &debug_line_sect);
     dwarf2_init_section(&section[section_ranges], fmap, ".debug_ranges", &debug_ranges_sect);
 
-    if (section[section_debug].address == IMAGE_NO_MAP ||
-        section[section_abbrev].address == IMAGE_NO_MAP ||
-        section[section_string].address == IMAGE_NO_MAP)
+    /* to do anything useful we need either .eh_frame or .debug_info */
+    if ((!eh_frame.address || eh_frame.address == IMAGE_NO_MAP) &&
+        (!section[section_debug].address || section[section_debug].address == IMAGE_NO_MAP))
     {
         ret = FALSE;
         goto leave;
     }
 
-    if (fmap->modtype == DMT_ELF)
+    if (fmap->modtype == DMT_ELF && debug_sect.fmap)
     {
         /* debug info might have a different base address than .so file
          * when elf file is prelinked after splitting off debug info
@@ -3232,7 +3230,7 @@ BOOL dwarf2_parse(struct module* module, unsigned long load_offset,
      */
     dwarf2_init_section(&dwarf2_modfmt->u.dwarf2_info->debug_loc,   fmap, ".debug_loc",   NULL);
     dwarf2_init_section(&dwarf2_modfmt->u.dwarf2_info->debug_frame, fmap, ".debug_frame", NULL);
-    dwarf2_init_section(&dwarf2_modfmt->u.dwarf2_info->eh_frame,    fmap, ".eh_frame",    NULL);
+    dwarf2_modfmt->u.dwarf2_info->eh_frame = eh_frame;
 
     while (mod_ctx.data < mod_ctx.end_data)
     {
@@ -3252,6 +3250,7 @@ leave:
     image_unmap_section(&debug_str_sect);
     image_unmap_section(&debug_line_sect);
     image_unmap_section(&debug_ranges_sect);
+    if (!ret) image_unmap_section(&eh_frame_sect);
 
     return ret;
 }




More information about the wine-cvs mailing list