[PATCH 03/16] [DbgHelp]: now storing the file map in ELF's module specific data

Eric Pouech eric.pouech at orange.fr
Mon Mar 15 15:12:37 CDT 2010




A+
---

 dlls/dbghelp/elf_module.c |   32 ++++++++++++++++++++++----------
 1 files changed, 22 insertions(+), 10 deletions(-)


diff --git a/dlls/dbghelp/elf_module.c b/dlls/dbghelp/elf_module.c
index 11399b4..301369b 100644
--- a/dlls/dbghelp/elf_module.c
+++ b/dlls/dbghelp/elf_module.c
@@ -75,13 +75,6 @@
 #include "wine/library.h"
 #include "wine/debug.h"
 
-struct elf_module_info
-{
-    DWORD_PTR                   elf_addr;
-    unsigned short	        elf_mark : 1,
-                                elf_loader : 1;
-};
-
 #ifdef __ELF__
 
 #define ELF_INFO_DEBUG_HEADER   0x0001
@@ -152,6 +145,14 @@ struct elf_thunk_area
     unsigned long               rva_end;
 };
 
+struct elf_module_info
+{
+    unsigned long               elf_addr;
+    unsigned short	        elf_mark : 1,
+                                elf_loader : 1;
+    struct elf_file_map         file_map;
+};
+
 /******************************************************************
  *		elf_map_section
  *
@@ -258,6 +259,13 @@ static inline unsigned elf_get_map_size(const struct elf_section_map* esm)
     return esm->fmap->sect[esm->sidx].shdr.sh_size;
 }
 
+static inline void elf_reset_file_map(struct elf_file_map* fmap)
+{
+    fmap->fd = -1;
+    fmap->shstrtab = ELF_NO_MAP;
+    fmap->alternate = NULL;
+}
+
 /******************************************************************
  *		elf_map_file
  *
@@ -278,9 +286,7 @@ static BOOL elf_map_file(const WCHAR* filenameW, struct elf_file_map* fmap)
     if (!(filename = HeapAlloc(GetProcessHeap(), 0, len))) return FALSE;
     WideCharToMultiByte(CP_UNIXCP, 0, filenameW, -1, filename, len, NULL, NULL);
 
-    fmap->fd = -1;
-    fmap->shstrtab = ELF_NO_MAP;
-    fmap->alternate = NULL;
+    elf_reset_file_map(fmap);
 
     /* check that the file exists, and that the module hasn't been loaded yet */
     if (stat(filename, &statbuf) == -1 || S_ISDIR(statbuf.st_mode)) goto done;
@@ -1044,6 +1050,12 @@ BOOL elf_load_debug_info(struct module* module, struct elf_file_map* fmap)
     if (ret)
         ret = elf_load_debug_info_from_map(module, fmap, &pool, &ht_symtab);
 
+    if (ret)
+    {
+        module->elf_info->file_map = *fmap;
+        elf_reset_file_map(fmap);
+    }
+
     pool_destroy(&pool);
     if (fmap == &my_fmap) elf_unmap_file(fmap);
     return ret;






More information about the wine-patches mailing list