[PATCH 29/31] [DbgHelp]: multiple debug formats

Eric Pouech eric.pouech at wanadoo.fr
Sun Jun 18 14:32:27 CDT 2006


- when several debug formats (eg stabs & dwarf2) exist
  in the same module, allow to load them all
  (this is needed when different compilation units are compiled
   with different debug options)

A+
---

 dlls/dbghelp/elf_module.c |   51 ++++++++++++++++++++++-----------------------
 1 files changed, 25 insertions(+), 26 deletions(-)

diff --git a/dlls/dbghelp/elf_module.c b/dlls/dbghelp/elf_module.c
index 8f03bdd..966ae76 100644
--- a/dlls/dbghelp/elf_module.c
+++ b/dlls/dbghelp/elf_module.c
@@ -753,7 +753,7 @@ static BOOL elf_load_debug_info_from_map
                                          struct pool* pool,
                                          struct hash_table* ht_symtab)
 {
-    BOOL                ret = FALSE;
+    BOOL                ret = FALSE, lret;
     const char*	        shstrtab;
     int	       	        i;
     int                 symtab_sect, dynsym_sect, stab_sect, stabstr_sect;
@@ -843,22 +843,22 @@ static BOOL elf_load_debug_info_from_map
             if (stab != NO_MAP && stabstr != NO_MAP)
             {
                 /* OK, now just parse all of the stabs. */
-                ret = stabs_parse(module, module->elf_info->elf_addr,
-                                  stab, fmap->sect[stab_sect].shdr.sh_size,
-                                  stabstr, fmap->sect[stabstr_sect].shdr.sh_size);
+                lret = stabs_parse(module, module->elf_info->elf_addr,
+                                   stab, fmap->sect[stab_sect].shdr.sh_size,
+                                   stabstr, fmap->sect[stabstr_sect].shdr.sh_size);
+                if (lret)
+                    /* and fill in the missing information for stabs */
+                    elf_finish_stabs_info(module, ht_symtab);
+                else
+                    WARN("Couldn't correctly read stabs\n");
+                ret = ret || lret;
             }
+            else lret = FALSE;
             elf_unmap_section(fmap, stab_sect);
             elf_unmap_section(fmap, stabstr_sect);
             
-            if (!ret)
-            {
-                WARN("Couldn't correctly read stabs\n");
-                return FALSE;
-            }
-            /* and fill in the missing information for stabs */
-            elf_finish_stabs_info(module, ht_symtab);
         }
-        else if (debug_sect != -1)
+        if (debug_sect != -1)
         {
             /* Dwarf 2 debug information */
             const BYTE* dw2_debug;
@@ -875,23 +875,21 @@ static BOOL elf_load_debug_info_from_map
             if (dw2_debug != NO_MAP && NO_MAP != dw2_debug_abbrev && dw2_debug_str != NO_MAP)
             {
                 /* OK, now just parse dwarf2 debug infos. */
-                ret = dwarf2_parse(module, module->elf_info->elf_addr,
-				   dw2_debug, fmap->sect[debug_sect].shdr.sh_size,
-				   dw2_debug_abbrev, fmap->sect[debug_abbrev_sect].shdr.sh_size,
-				   dw2_debug_str, fmap->sect[debug_str_sect].shdr.sh_size,
-                                   dw2_debug_line, fmap->sect[debug_line_sect].shdr.sh_size);
+                lret = dwarf2_parse(module, module->elf_info->elf_addr,
+                                    dw2_debug, fmap->sect[debug_sect].shdr.sh_size,
+                                    dw2_debug_abbrev, fmap->sect[debug_abbrev_sect].shdr.sh_size,
+                                    dw2_debug_str, fmap->sect[debug_str_sect].shdr.sh_size,
+                                    dw2_debug_line, fmap->sect[debug_line_sect].shdr.sh_size);
+                if (!lret)
+                    WARN("Couldn't correctly read stabs\n");
+                ret = ret || lret;
             }
             elf_unmap_section(fmap, debug_sect);
             elf_unmap_section(fmap, debug_abbrev_sect);
             elf_unmap_section(fmap, debug_str_sect);
             elf_unmap_section(fmap, debug_line_sect);
-            if (!ret)
-            {
-                WARN("Couldn't correctly read stabs\n");
-                return FALSE;
-            }
         }
-        else if (debuglink_sect != -1)
+        if (debuglink_sect != -1)
         {
             const char* dbg_link;
             struct elf_file_map fmap_link;
@@ -907,10 +905,11 @@ static BOOL elf_load_debug_info_from_map
             {
                 fmap_link.crc = *(const DWORD*)(dbg_link + ((DWORD_PTR)(strlen(dbg_link) + 4) & ~3));
                 fmap_link.with_crc = 1;
-                ret = elf_load_debug_info_from_map(module, &fmap_link, pool,
-                                                   ht_symtab);
-                if (!ret)
+                lret = elf_load_debug_info_from_map(module, &fmap_link, pool,
+                                                    ht_symtab);
+                if (!lret)
                     WARN("Couldn't load debug information from %s\n", dbg_link);
+                ret = ret || lret;
             }
             else
                 WARN("Couldn't load linked debug file for %s\n",



More information about the wine-patches mailing list