[DBGHELP]
authorAmine Khaldi <amine.khaldi@reactos.org>
Sat, 26 Apr 2014 16:41:51 +0000 (16:41 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Sat, 26 Apr 2014 16:41:51 +0000 (16:41 +0000)
* Sync with Wine 1.7.17.
CORE-8080

svn path=/trunk/; revision=62979

15 files changed:
reactos/dll/win32/dbghelp/cpu_arm.c
reactos/dll/win32/dbghelp/cpu_arm64.c
reactos/dll/win32/dbghelp/cpu_i386.c
reactos/dll/win32/dbghelp/cpu_ppc.c
reactos/dll/win32/dbghelp/cpu_x86_64.c
reactos/dll/win32/dbghelp/dbghelp.c
reactos/dll/win32/dbghelp/dbghelp_private.h
reactos/dll/win32/dbghelp/dwarf.c
reactos/dll/win32/dbghelp/elf_module.c
reactos/dll/win32/dbghelp/macho_module.c
reactos/dll/win32/dbghelp/module.c
reactos/dll/win32/dbghelp/msc.c
reactos/dll/win32/dbghelp/storage.c
reactos/dll/win32/dbghelp/symbol.c
reactos/media/doc/README.WINE

index 1b561c6..31b1926 100644 (file)
@@ -23,8 +23,8 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(dbghelp);
 
 
 WINE_DEFAULT_DEBUG_CHANNEL(dbghelp);
 
-static unsigned arm_get_addr(HANDLE hThread, const CONTEXT* ctx,
-                             enum cpu_addr ca, ADDRESS64* addr)
+static BOOL arm_get_addr(HANDLE hThread, const CONTEXT* ctx,
+                         enum cpu_addr ca, ADDRESS64* addr)
 {
     addr->Mode    = AddrModeFlat;
     addr->Segment = 0; /* don't need segment */
 {
     addr->Mode    = AddrModeFlat;
     addr->Segment = 0; /* don't need segment */
index 87864af..8a8511a 100644 (file)
@@ -2,7 +2,7 @@
  * File cpu_arm64.c
  *
  * Copyright (C) 2009 Eric Pouech
  * File cpu_arm64.c
  *
  * Copyright (C) 2009 Eric Pouech
- * Copyright (C) 2010-2013 Andrأ© Hentschel
+ * Copyright (C) 2010-2013 André Hentschel
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -23,8 +23,8 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(dbghelp);
 
 
 WINE_DEFAULT_DEBUG_CHANNEL(dbghelp);
 
-static unsigned arm64_get_addr(HANDLE hThread, const CONTEXT* ctx,
-                               enum cpu_addr ca, ADDRESS64* addr)
+static BOOL arm64_get_addr(HANDLE hThread, const CONTEXT* ctx,
+                           enum cpu_addr ca, ADDRESS64* addr)
 {
     addr->Mode    = AddrModeFlat;
     addr->Segment = 0; /* don't need segment */
 {
     addr->Mode    = AddrModeFlat;
     addr->Segment = 0; /* don't need segment */
index 88642e0..5916d21 100644 (file)
@@ -45,8 +45,8 @@ static ADDRESS_MODE get_selector_type(HANDLE hThread, const CONTEXT* ctx, WORD s
     return -1;
 }
 
     return -1;
 }
 
-static unsigned i386_build_addr(HANDLE hThread, const CONTEXT* ctx, ADDRESS64* addr,
-                                unsigned seg, unsigned long offset)
+static BOOL i386_build_addr(HANDLE hThread, const CONTEXT* ctx, ADDRESS64* addr,
+                            unsigned seg, unsigned long offset)
 {
     addr->Mode    = AddrModeFlat;
     addr->Segment = seg;
 {
     addr->Mode    = AddrModeFlat;
     addr->Segment = seg;
@@ -71,8 +71,8 @@ static unsigned i386_build_addr(HANDLE hThread, const CONTEXT* ctx, ADDRESS64* a
 #endif
 
 #ifndef DBGHELP_STATIC_LIB
 #endif
 
 #ifndef DBGHELP_STATIC_LIB
-static unsigned i386_get_addr(HANDLE hThread, const CONTEXT* ctx,
-                              enum cpu_addr ca, ADDRESS64* addr)
+static BOOL i386_get_addr(HANDLE hThread, const CONTEXT* ctx,
+                          enum cpu_addr ca, ADDRESS64* addr)
 {
 #ifdef __i386__
     switch (ca)
 {
 #ifdef __i386__
     switch (ca)
index 7543ef6..7090847 100644 (file)
@@ -22,8 +22,8 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(dbghelp);
 
 
 WINE_DEFAULT_DEBUG_CHANNEL(dbghelp);
 
-static unsigned ppc_get_addr(HANDLE hThread, const CONTEXT* ctx,
-                             enum cpu_addr ca, ADDRESS64* addr)
+static BOOL ppc_get_addr(HANDLE hThread, const CONTEXT* ctx,
+                         enum cpu_addr ca, ADDRESS64* addr)
 {
    switch (ca)
     {
 {
    switch (ca)
     {
index d3e2720..09adbe3 100644 (file)
@@ -83,8 +83,8 @@ typedef struct _UNWIND_INFO
 #define GetExceptionDataPtr(info) \
     ((PVOID)((PULONG)GetLanguageSpecificData(info) + 1)
 
 #define GetExceptionDataPtr(info) \
     ((PVOID)((PULONG)GetLanguageSpecificData(info) + 1)
 
-static unsigned x86_64_get_addr(HANDLE hThread, const CONTEXT* ctx,
-                                enum cpu_addr ca, ADDRESS64* addr)
+static BOOL x86_64_get_addr(HANDLE hThread, const CONTEXT* ctx,
+                            enum cpu_addr ca, ADDRESS64* addr)
 {
     addr->Mode = AddrModeFlat;
     switch (ca)
 {
     addr->Mode = AddrModeFlat;
     switch (ca)
index ae4ea13..f9e64d3 100644 (file)
@@ -60,25 +60,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(dbghelp);
  */
 
 unsigned   dbghelp_options = SYMOPT_UNDNAME;
  */
 
 unsigned   dbghelp_options = SYMOPT_UNDNAME;
-HANDLE     hMsvcrt = NULL;
-
-/***********************************************************************
- *           DllMain (DEBUGHLP.@)
- */
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
-{
-    switch (fdwReason)
-    {
-    case DLL_PROCESS_ATTACH:    break;
-    case DLL_PROCESS_DETACH:
-        if (hMsvcrt) FreeLibrary(hMsvcrt);
-        break;
-    case DLL_THREAD_ATTACH:     break;
-    case DLL_THREAD_DETACH:     break;
-    default:                    break;
-    }
-    return TRUE;
-}
 
 static struct process* process_first /* = NULL */;
 
 
 static struct process* process_first /* = NULL */;
 
index a871293..8c10539 100644 (file)
@@ -569,7 +569,7 @@ struct cpu
     DWORD       frame_regno;
 
     /* address manipulation */
     DWORD       frame_regno;
 
     /* address manipulation */
-    unsigned    (*get_addr)(HANDLE hThread, const CONTEXT* ctx,
+    BOOL        (*get_addr)(HANDLE hThread, const CONTEXT* ctx,
                             enum cpu_addr, ADDRESS64* addr);
 
     /* stack manipulation */
                             enum cpu_addr, ADDRESS64* addr);
 
     /* stack manipulation */
@@ -594,7 +594,6 @@ extern struct cpu*      dbghelp_current_cpu DECLSPEC_HIDDEN;
 
 /* dbghelp.c */
 extern struct process* process_find_by_handle(HANDLE hProcess) DECLSPEC_HIDDEN;
 
 /* dbghelp.c */
 extern struct process* process_find_by_handle(HANDLE hProcess) DECLSPEC_HIDDEN;
-extern HANDLE hMsvcrt DECLSPEC_HIDDEN;
 extern BOOL         validate_addr64(DWORD64 addr) DECLSPEC_HIDDEN;
 extern BOOL         pcs_callback(const struct process* pcs, ULONG action, void* data) DECLSPEC_HIDDEN;
 extern void*        fetch_buffer(struct process* pcs, unsigned size) DECLSPEC_HIDDEN;
 extern BOOL         validate_addr64(DWORD64 addr) DECLSPEC_HIDDEN;
 extern BOOL         pcs_callback(const struct process* pcs, ULONG action, void* data) DECLSPEC_HIDDEN;
 extern void*        fetch_buffer(struct process* pcs, unsigned size) DECLSPEC_HIDDEN;
index cca040e..2e00782 100644 (file)
@@ -513,7 +513,7 @@ static void dwarf2_fill_attr(const dwarf2_parse_context_t* ctx,
         break;
     
     case DW_FORM_ref8:
         break;
     
     case DW_FORM_ref8:
-        FIXME("Unhandled 64 bit support\n");
+        FIXME("Unhandled 64-bit support\n");
         break;
 
     case DW_FORM_sdata:
         break;
 
     case DW_FORM_sdata:
@@ -1408,6 +1408,9 @@ static struct symt* dwarf2_parse_udt_type(dwarf2_parse_context_t* ctx,
 
         switch (child->abbrev->tag)
         {
 
         switch (child->abbrev->tag)
         {
+        case DW_TAG_array_type:
+            dwarf2_parse_array_type(ctx, di);
+            break;
         case DW_TAG_member:
             /* FIXME: should I follow the sibling stuff ?? */
             dwarf2_parse_udt_member(ctx, child, (struct symt_udt*)di->symt);
         case DW_TAG_member:
             /* FIXME: should I follow the sibling stuff ?? */
             dwarf2_parse_udt_member(ctx, child, (struct symt_udt*)di->symt);
@@ -1678,7 +1681,10 @@ static void dwarf2_parse_subprogram_label(dwarf2_subprogram_t* subpgm,
 
 static void dwarf2_parse_subprogram_block(dwarf2_subprogram_t* subpgm,
                                           struct symt_block* parent_block,
 
 static void dwarf2_parse_subprogram_block(dwarf2_subprogram_t* subpgm,
                                           struct symt_block* parent_block,
-                                         dwarf2_debug_info_t* di);
+                      dwarf2_debug_info_t* di);
+
+static struct symt* dwarf2_parse_subroutine_type(dwarf2_parse_context_t* ctx,
+                                                 dwarf2_debug_info_t* di);
 
 static void dwarf2_parse_inlined_subroutine(dwarf2_subprogram_t* subpgm,
                                             struct symt_block* parent_block,
 
 static void dwarf2_parse_inlined_subroutine(dwarf2_subprogram_t* subpgm,
                                             struct symt_block* parent_block,
@@ -1769,6 +1775,12 @@ static void dwarf2_parse_subprogram_block(dwarf2_subprogram_t* subpgm,
         case DW_TAG_variable:
             dwarf2_parse_variable(subpgm, block, child);
             break;
         case DW_TAG_variable:
             dwarf2_parse_variable(subpgm, block, child);
             break;
+        case DW_TAG_pointer_type:
+            dwarf2_parse_pointer_type(subpgm->ctx, di);
+            break;
+        case DW_TAG_subroutine_type:
+            dwarf2_parse_subroutine_type(subpgm->ctx, di);
+            break;
         case DW_TAG_lexical_block:
             dwarf2_parse_subprogram_block(subpgm, block, child);
             break;
         case DW_TAG_lexical_block:
             dwarf2_parse_subprogram_block(subpgm, block, child);
             break;
@@ -1900,6 +1912,9 @@ static struct symt* dwarf2_parse_subprogram(dwarf2_parse_context_t* ctx,
         case DW_TAG_inlined_subroutine:
             dwarf2_parse_inlined_subroutine(&subpgm, NULL, child);
             break;
         case DW_TAG_inlined_subroutine:
             dwarf2_parse_inlined_subroutine(&subpgm, NULL, child);
             break;
+        case DW_TAG_pointer_type:
+            dwarf2_parse_pointer_type(subpgm.ctx, di);
+            break;
         case DW_TAG_subprogram:
             /* FIXME: likely a declaration (to be checked)
              * skip it for now
         case DW_TAG_subprogram:
             /* FIXME: likely a declaration (to be checked)
              * skip it for now
index 469b340..b0c1c52 100644 (file)
 #define NT_GNU_BUILD_ID 3
 #endif
 
 #define NT_GNU_BUILD_ID 3
 #endif
 
+#ifndef HAVE_STRUCT_R_DEBUG
+struct r_debug
+{
+    int r_version;
+    struct link_map *r_map;
+    ElfW(Addr) r_brk;
+    enum
+    {
+        RT_CONSISTENT,
+        RT_ADD,
+        RT_DELETE
+    } r_state;
+    ElfW(Addr) r_ldbase;
+};
+#endif /* HAVE_STRUCT_R_DEBUG */
+
+#ifndef HAVE_STRUCT_LINK_MAP
+struct link_map
+{
+    ElfW(Addr) l_addr;
+    char *l_name;
+    ElfW(Dyn) *l_ld;
+    struct link_map *l_next, *l_prev;
+};
+#endif /* HAVE_STRUCT_LINK_MAP */
+
 WINE_DEFAULT_DEBUG_CHANNEL(dbghelp);
 
 struct elf_info
 WINE_DEFAULT_DEBUG_CHANNEL(dbghelp);
 
 struct elf_info
@@ -1427,7 +1453,7 @@ static BOOL elf_search_and_load_file(struct process* pcs, const WCHAR* filename,
 {
     BOOL                ret = FALSE;
     struct module*      module;
 {
     BOOL                ret = FALSE;
     struct module*      module;
-    static WCHAR        S_libstdcPPW[] = {'l','i','b','s','t','d','c','+','+','\0'};
+    static const WCHAR  S_libstdcPPW[] = {'l','i','b','s','t','d','c','+','+','\0'};
 
     if (filename == NULL || *filename == '\0') return FALSE;
     if ((module = module_is_already_loaded(pcs, filename)))
 
     if (filename == NULL || *filename == '\0') return FALSE;
     if ((module = module_is_already_loaded(pcs, filename)))
@@ -1682,8 +1708,8 @@ struct module*  elf_load_module(struct process* pcs, const WCHAR* name, unsigned
 /******************************************************************
  *             elf_synchronize_module_list
  *
 /******************************************************************
  *             elf_synchronize_module_list
  *
- * this functions rescans the debuggee module's list and synchronizes it with
- * the one from 'pcs', ie:
+ * this function rescans the debuggee module's list and synchronizes it with
+ * the one from 'pcs', i.e.:
  * - if a module is in debuggee and not in pcs, it's loaded into pcs
  * - if a module is in pcs and not in debuggee, it's unloaded from pcs
  */
  * - if a module is in debuggee and not in pcs, it's loaded into pcs
  * - if a module is in pcs and not in debuggee, it's unloaded from pcs
  */
index 6013867..67ee681 100644 (file)
@@ -420,17 +420,32 @@ static BOOL macho_map_file(const WCHAR* filenameW, struct macho_file_map* fmap)
     RtlInitializeBitMap(&fmap->sect_is_code, fmap->sect_is_code_buff, MAX_SECT + 1);
 
     len = WideCharToMultiByte(CP_UNIXCP, 0, filenameW, -1, NULL, 0, NULL, NULL);
     RtlInitializeBitMap(&fmap->sect_is_code, fmap->sect_is_code_buff, MAX_SECT + 1);
 
     len = WideCharToMultiByte(CP_UNIXCP, 0, filenameW, -1, NULL, 0, NULL, NULL);
-    if (!(filename = HeapAlloc(GetProcessHeap(), 0, len))) return FALSE;
+    if (!(filename = HeapAlloc(GetProcessHeap(), 0, len)))
+    {
+        WARN("failed to allocate filename buffer\n");
+        return FALSE;
+    }
     WideCharToMultiByte(CP_UNIXCP, 0, filenameW, -1, filename, len, NULL, NULL);
 
     /* check that the file exists */
     WideCharToMultiByte(CP_UNIXCP, 0, filenameW, -1, filename, len, NULL, NULL);
 
     /* check that the file exists */
-    if (stat(filename, &statbuf) == -1 || S_ISDIR(statbuf.st_mode)) goto done;
+    if (stat(filename, &statbuf) == -1 || S_ISDIR(statbuf.st_mode))
+    {
+        TRACE("stat() failed or %s is directory: %s\n", debugstr_a(filename), strerror(errno));
+        goto done;
+    }
 
     /* Now open the file, so that we can mmap() it. */
 
     /* Now open the file, so that we can mmap() it. */
-    if ((fmap->fd = open(filename, O_RDONLY)) == -1) goto done;
+    if ((fmap->fd = open(filename, O_RDONLY)) == -1)
+    {
+        TRACE("failed to open file %s: %d\n", debugstr_a(filename), errno);
+        goto done;
+    }
 
     if (read(fmap->fd, &fat_header, sizeof(fat_header)) != sizeof(fat_header))
 
     if (read(fmap->fd, &fat_header, sizeof(fat_header)) != sizeof(fat_header))
+    {
+        TRACE("failed to read fat header: %d\n", errno);
         goto done;
         goto done;
+    }
     TRACE("... got possible fat header\n");
 
     /* Fat header is always in big-endian order. */
     TRACE("... got possible fat header\n");
 
     /* Fat header is always in big-endian order. */
@@ -936,23 +951,52 @@ static BOOL macho_load_file(struct process* pcs, const WCHAR* filename,
      */
     if (macho_info->flags & MACHO_INFO_DEBUG_HEADER)
     {
      */
     if (macho_info->flags & MACHO_INFO_DEBUG_HEADER)
     {
-        static void* dyld_all_image_infos_addr;
+        PROCESS_BASIC_INFORMATION pbi;
+        NTSTATUS status;
+
+        ret = FALSE;
 
 
-        /* This symbol should be in the same place in all processes. */
-        if (!dyld_all_image_infos_addr)
+        /* Get address of PEB */
+        status = NtQueryInformationProcess(pcs->handle, ProcessBasicInformation,
+                                           &pbi, sizeof(pbi), NULL);
+        if (status == STATUS_SUCCESS)
         {
         {
-            struct nlist nl[2];
-            memset(nl, 0, sizeof(nl));
-            nl[0].n_un.n_name = (char*)"_dyld_all_image_infos";
-            if (!nlist("/usr/lib/dyld", nl))
-                dyld_all_image_infos_addr = (void*)nl[0].n_value;
+            ULONG dyld_image_info;
+
+            /* Read dyld image info address from PEB */
+            if (ReadProcessMemory(pcs->handle, &pbi.PebBaseAddress->Reserved,
+                                  &dyld_image_info, sizeof(dyld_image_info), NULL))
+            {
+                TRACE("got dyld_image_info 0x%08x from PEB %p MacDyldImageInfo %p\n",
+                      dyld_image_info, pbi.PebBaseAddress, &pbi.PebBaseAddress->Reserved);
+                macho_info->dbg_hdr_addr = dyld_image_info;
+                ret = TRUE;
+            }
         }
 
         }
 
-        if (dyld_all_image_infos_addr)
-            macho_info->dbg_hdr_addr = (unsigned long)dyld_all_image_infos_addr;
-        else
-            ret = FALSE;
-        TRACE("dbg_hdr_addr = 0x%08lx\n", macho_info->dbg_hdr_addr);
+        if (!ret)
+        {
+            static void* dyld_all_image_infos_addr;
+
+            /* Our next best guess is that dyld was loaded at its base address
+               and we can find the dyld image infos address by looking up its symbol. */
+            if (!dyld_all_image_infos_addr)
+            {
+                struct nlist nl[2];
+                memset(nl, 0, sizeof(nl));
+                nl[0].n_un.n_name = (char*)"_dyld_all_image_infos";
+                if (!nlist("/usr/lib/dyld", nl))
+                    dyld_all_image_infos_addr = (void*)nl[0].n_value;
+            }
+
+            if (dyld_all_image_infos_addr)
+            {
+                TRACE("got dyld_image_info %p from /usr/lib/dyld symbol table\n",
+                      dyld_all_image_infos_addr);
+                macho_info->dbg_hdr_addr = (unsigned long)dyld_all_image_infos_addr;
+                ret = TRUE;
+            }
+        }
     }
 
     if (macho_info->flags & MACHO_INFO_MODULE)
     }
 
     if (macho_info->flags & MACHO_INFO_MODULE)
@@ -1011,7 +1055,7 @@ leave:
  *              macho_load_file_from_path
  * Tries to load a Mach-O file from a set of paths (separated by ':')
  */
  *              macho_load_file_from_path
  * Tries to load a Mach-O file from a set of paths (separated by ':')
  */
-static BOOL macho_load_file_from_path(HANDLE hProcess,
+static BOOL macho_load_file_from_path(struct process* pcs,
                                       const WCHAR* filename,
                                       unsigned long load_addr,
                                       const char* path,
                                       const WCHAR* filename,
                                       unsigned long load_addr,
                                       const char* path,
@@ -1022,7 +1066,7 @@ static BOOL macho_load_file_from_path(HANDLE hProcess,
     WCHAR*              pathW = NULL;
     unsigned            len;
 
     WCHAR*              pathW = NULL;
     unsigned            len;
 
-    TRACE("(%p, %s, 0x%08lx, %s, %p)\n", hProcess, debugstr_w(filename), load_addr,
+    TRACE("(%p/%p, %s, 0x%08lx, %s, %p)\n", pcs, pcs->handle, debugstr_w(filename), load_addr,
             debugstr_a(path), macho_info);
 
     if (!path) return FALSE;
             debugstr_a(path), macho_info);
 
     if (!path) return FALSE;
@@ -1041,7 +1085,7 @@ static BOOL macho_load_file_from_path(HANDLE hProcess,
         strcpyW(fn, s);
         strcatW(fn, S_SlashW);
         strcatW(fn, filename);
         strcpyW(fn, s);
         strcatW(fn, S_SlashW);
         strcatW(fn, filename);
-        ret = macho_load_file(hProcess, fn, load_addr, macho_info);
+        ret = macho_load_file(pcs, fn, load_addr, macho_info);
         HeapFree(GetProcessHeap(), 0, fn);
         if (ret) break;
         s = (t) ? (t+1) : NULL;
         HeapFree(GetProcessHeap(), 0, fn);
         if (ret) break;
         s = (t) ? (t+1) : NULL;
@@ -1057,7 +1101,7 @@ static BOOL macho_load_file_from_path(HANDLE hProcess,
  *
  * Tries to load a Mach-O file from the dll path
  */
  *
  * Tries to load a Mach-O file from the dll path
  */
-static BOOL macho_load_file_from_dll_path(HANDLE hProcess,
+static BOOL macho_load_file_from_dll_path(struct process* pcs,
                                           const WCHAR* filename,
                                           unsigned long load_addr,
                                           struct macho_info* macho_info)
                                           const WCHAR* filename,
                                           unsigned long load_addr,
                                           struct macho_info* macho_info)
@@ -1066,7 +1110,7 @@ static BOOL macho_load_file_from_dll_path(HANDLE hProcess,
     unsigned int index = 0;
     const char *path;
 
     unsigned int index = 0;
     const char *path;
 
-    TRACE("(%p, %s, 0x%08lx, %p)\n", hProcess, debugstr_w(filename), load_addr,
+    TRACE("(%p/%p, %s, 0x%08lx, %p)\n", pcs, pcs->handle, debugstr_w(filename), load_addr,
             macho_info);
 
     while (!ret && (path = wine_dll_enum_load_path( index++ )))
             macho_info);
 
     while (!ret && (path = wine_dll_enum_load_path( index++ )))
@@ -1083,7 +1127,7 @@ static BOOL macho_load_file_from_dll_path(HANDLE hProcess,
         MultiByteToWideChar(CP_UNIXCP, 0, path, -1, name, len);
         strcatW( name, S_SlashW );
         strcatW( name, filename );
         MultiByteToWideChar(CP_UNIXCP, 0, path, -1, name, len);
         strcatW( name, S_SlashW );
         strcatW( name, filename );
-        ret = macho_load_file(hProcess, name, load_addr, macho_info);
+        ret = macho_load_file(pcs, name, load_addr, macho_info);
         HeapFree( GetProcessHeap(), 0, name );
     }
     TRACE(" => %d\n", ret);
         HeapFree( GetProcessHeap(), 0, name );
     }
     TRACE(" => %d\n", ret);
@@ -1101,7 +1145,7 @@ static BOOL macho_search_and_load_file(struct process* pcs, const WCHAR* filenam
 {
     BOOL                ret = FALSE;
     struct module*      module;
 {
     BOOL                ret = FALSE;
     struct module*      module;
-    static WCHAR        S_libstdcPPW[] = {'l','i','b','s','t','d','c','+','+','\0'};
+    static const WCHAR  S_libstdcPPW[] = {'l','i','b','s','t','d','c','+','+','\0'};
     const WCHAR*        p;
 
     TRACE("(%p/%p, %s, 0x%08lx, %p)\n", pcs, pcs->handle, debugstr_w(filename), load_addr,
     const WCHAR*        p;
 
     TRACE("(%p/%p, %s, 0x%08lx, %p)\n", pcs, pcs->handle, debugstr_w(filename), load_addr,
index 1886dfa..dc6bc17 100644 (file)
@@ -23,6 +23,8 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(dbghelp);
 
 
 WINE_DEFAULT_DEBUG_CHANNEL(dbghelp);
 
+#define DLLPREFIX ""
+
 const WCHAR        S_ElfW[]         = {'<','e','l','f','>','\0'};
 const WCHAR        S_WineLoaderW[]  = {'<','w','i','n','e','-','l','o','a','d','e','r','>','\0'};
 static const WCHAR S_DotSoW[]       = {'.','s','o','\0'};
 const WCHAR        S_ElfW[]         = {'<','e','l','f','>','\0'};
 const WCHAR        S_WineLoaderW[]  = {'<','w','i','n','e','-','l','o','a','d','e','r','>','\0'};
 static const WCHAR S_DotSoW[]       = {'.','s','o','\0'};
@@ -47,7 +49,7 @@ static int match_ext(const WCHAR* ptr, size_t len)
     for (e = ext; *e; e++)
     {
         l = strlenW(*e);
     for (e = ext; *e; e++)
     {
         l = strlenW(*e);
-        if (l >= len) return FALSE;
+        if (l >= len) return 0;
         if (strncmpiW(&ptr[len - l], *e, l)) continue;
         return l;
     }
         if (strncmpiW(&ptr[len - l], *e, l)) continue;
         return l;
     }
@@ -96,7 +98,7 @@ void module_set_module(struct module* module, const WCHAR* name)
 
 const WCHAR *get_wine_loader_name(void)
 {
 
 const WCHAR *get_wine_loader_name(void)
 {
-    static const int is_win64 = sizeof(void *) > sizeof(int); /* FIXME: should depend on target process */
+    static const BOOL is_win64 = sizeof(void *) > sizeof(int); /* FIXME: should depend on target process */
     static const WCHAR wineW[] = {'w','i','n','e',0};
     static const WCHAR suffixW[] = {'6','4',0};
     static const WCHAR *loader;
     static const WCHAR wineW[] = {'w','i','n','e',0};
     static const WCHAR suffixW[] = {'6','4',0};
     static const WCHAR *loader;
@@ -420,6 +422,16 @@ static BOOL module_is_container_loaded(const struct process* pcs,
     size_t              len;
     struct module*      module;
     PCWSTR              filename, modname;
     size_t              len;
     struct module*      module;
     PCWSTR              filename, modname;
+    static WCHAR*       dll_prefix;
+    static int          dll_prefix_len;
+
+    if (!dll_prefix)
+    {
+        dll_prefix_len = MultiByteToWideChar( CP_UNIXCP, 0, DLLPREFIX, -1, NULL, 0 );
+        dll_prefix = HeapAlloc( GetProcessHeap(), 0, dll_prefix_len * sizeof(WCHAR) );
+        MultiByteToWideChar( CP_UNIXCP, 0, DLLPREFIX, -1, dll_prefix, dll_prefix_len );
+        dll_prefix_len--;
+    }
 
     if (!base) return FALSE;
     filename = get_filename(ImageName, NULL);
 
     if (!base) return FALSE;
     filename = get_filename(ImageName, NULL);
@@ -432,6 +444,7 @@ static BOOL module_is_container_loaded(const struct process* pcs,
             base < module->module.BaseOfImage + module->module.ImageSize)
         {
             modname = get_filename(module->module.LoadedImageName, NULL);
             base < module->module.BaseOfImage + module->module.ImageSize)
         {
             modname = get_filename(module->module.LoadedImageName, NULL);
+            if (dll_prefix_len && !strncmpW( modname, dll_prefix, dll_prefix_len )) modname += dll_prefix_len;
             if (!strncmpiW(modname, filename, len) &&
                 !memcmp(modname + len, S_DotSoW, 3 * sizeof(WCHAR)))
             {
             if (!strncmpiW(modname, filename, len) &&
                 !memcmp(modname + len, S_DotSoW, 3 * sizeof(WCHAR)))
             {
index 73df739..110f5b3 100644 (file)
@@ -631,9 +631,9 @@ static struct symt* codeview_add_type_array(struct codeview_type_parse* ctp,
     return &symt_new_array(ctp->module, 0, -arr_len, elem, index)->symt;
 }
 
     return &symt_new_array(ctp->module, 0, -arr_len, elem, index)->symt;
 }
 
-static int codeview_add_type_enum_field_list(struct module* module,
-                                             struct symt_enum* symt,
-                                             const union codeview_reftype* ref_type)
+static BOOL codeview_add_type_enum_field_list(struct module* module,
+                                              struct symt_enum* symt,
+                                              const union codeview_reftype* ref_type)
 {
     const unsigned char*                ptr = ref_type->fieldlist.list;
     const unsigned char*                last = (const BYTE*)ref_type + ref_type->generic.len + 2;
 {
     const unsigned char*                ptr = ref_type->fieldlist.list;
     const unsigned char*                last = (const BYTE*)ref_type + ref_type->generic.len + 2;
@@ -1307,12 +1307,12 @@ static struct symt* codeview_parse_one_type(struct codeview_type_parse* ctp,
     default:
         FIXME("Unsupported type-id leaf %x\n", type->generic.id);
         dump(type, 2 + type->generic.len);
     default:
         FIXME("Unsupported type-id leaf %x\n", type->generic.id);
         dump(type, 2 + type->generic.len);
-        return FALSE;
+        return NULL;
     }
     return codeview_add_type(curr_type, symt) ? symt : NULL;
 }
 
     }
     return codeview_add_type(curr_type, symt) ? symt : NULL;
 }
 
-static int codeview_parse_type_table(struct codeview_type_parse* ctp)
+static BOOL codeview_parse_type_table(struct codeview_type_parse* ctp)
 {
     unsigned int                curr_type = FIRST_DEFINABLE_TYPE;
     const union codeview_type*  type;
 {
     unsigned int                curr_type = FIRST_DEFINABLE_TYPE;
     const union codeview_type*  type;
@@ -1537,8 +1537,8 @@ static inline void codeview_add_variable(const struct msc_debug_info* msc_dbg,
     }
 }
 
     }
 }
 
-static int codeview_snarf(const struct msc_debug_info* msc_dbg, const BYTE* root, 
-                          int offset, int size, BOOL do_globals)
+static BOOL codeview_snarf(const struct msc_debug_info* msc_dbg, const BYTE* root,
+                           int offset, int size, BOOL do_globals)
 {
     struct symt_function*               curr_func = NULL;
     int                                 i, length;
 {
     struct symt_function*               curr_func = NULL;
     int                                 i, length;
@@ -1984,8 +1984,8 @@ static int codeview_snarf(const struct msc_debug_info* msc_dbg, const BYTE* root
     return TRUE;
 }
 
     return TRUE;
 }
 
-static int codeview_snarf_public(const struct msc_debug_info* msc_dbg, const BYTE* root,
-                                 int offset, int size)
+static BOOL codeview_snarf_public(const struct msc_debug_info* msc_dbg, const BYTE* root,
+                                  int offset, int size)
 
 {
     int                                 i, length;
 
 {
     int                                 i, length;
@@ -2619,7 +2619,7 @@ static void pdb_process_symbol_imports(const struct process* pcs,
         while (imp < (const PDB_SYMBOL_IMPORT*)last)
         {
             ptr = (const char*)imp + sizeof(*imp) + strlen(imp->filename);
         while (imp < (const PDB_SYMBOL_IMPORT*)last)
         {
             ptr = (const char*)imp + sizeof(*imp) + strlen(imp->filename);
-            if (i >= CV_MAX_MODULES) FIXME("Out of bounds !!!\n");
+            if (i >= CV_MAX_MODULES) FIXME("Out of bounds!!!\n");
             if (!strcasecmp(pdb_lookup->filename, imp->filename))
             {
                 if (module_index != -1) FIXME("Twice the entry\n");
             if (!strcasecmp(pdb_lookup->filename, imp->filename))
             {
                 if (module_index != -1) FIXME("Twice the entry\n");
@@ -2652,7 +2652,7 @@ static void pdb_process_symbol_imports(const struct process* pcs,
         pdb_module_info->used_subfiles = 1;
     }
     cv_current_module = &cv_zmodules[module_index];
         pdb_module_info->used_subfiles = 1;
     }
     cv_current_module = &cv_zmodules[module_index];
-    if (cv_current_module->allowed) FIXME("Already allowed ??\n");
+    if (cv_current_module->allowed) FIXME("Already allowed??\n");
     cv_current_module->allowed = TRUE;
 }
 
     cv_current_module->allowed = TRUE;
 }
 
@@ -3235,7 +3235,7 @@ static BOOL codeview_process_info(const struct process* pcs,
                 ctp.table  = (const BYTE*)(ctp.offset + types->cTypes);
 
                 cv_current_module = &cv_zmodules[0];
                 ctp.table  = (const BYTE*)(ctp.offset + types->cTypes);
 
                 cv_current_module = &cv_zmodules[0];
-                if (cv_current_module->allowed) FIXME("Already allowed ??\n");
+                if (cv_current_module->allowed) FIXME("Already allowed??\n");
                 cv_current_module->allowed = TRUE;
 
                 codeview_parse_type_table(&ctp);
                 cv_current_module->allowed = TRUE;
 
                 codeview_parse_type_table(&ctp);
index 5f9c624..32e80d4 100644 (file)
@@ -282,7 +282,7 @@ void*   sparse_array_add(struct sparse_array* sa, unsigned long key,
     pk2i = sparse_array_lookup(sa, key, &idx);
     if (pk2i && pk2i->key == key)
     {
     pk2i = sparse_array_lookup(sa, key, &idx);
     if (pk2i && pk2i->key == key)
     {
-        FIXME("re adding an existing key\n");
+        FIXME("re-adding an existing key\n");
         return NULL;
     }
     to = vector_add(&sa->key2index, pool);
         return NULL;
     }
     to = vector_add(&sa->key2index, pool);
@@ -353,13 +353,13 @@ void hash_table_destroy(struct hash_table* ht)
     variance = (double)sq / ht->num_buckets - mean * mean;
     FIXME("STATS: elts[num:%-4u size:%u mean:%f] buckets[min:%-4u variance:%+f max:%-4u]\n",
           ht->num_elts, ht->num_buckets, mean, min, variance, max);
     variance = (double)sq / ht->num_buckets - mean * mean;
     FIXME("STATS: elts[num:%-4u size:%u mean:%f] buckets[min:%-4u variance:%+f max:%-4u]\n",
           ht->num_elts, ht->num_buckets, mean, min, variance, max);
-#if 1
+
     for (i = 0; i < ht->num_buckets; i++)
     {
         for (len = 0, elt = ht->buckets[i]; elt; elt = elt->next) len++;
         if (len == max)
         {
     for (i = 0; i < ht->num_buckets; i++)
     {
         for (len = 0, elt = ht->buckets[i]; elt; elt = elt->next) len++;
         if (len == max)
         {
-            FIXME("Longuest bucket:\n");
+            FIXME("Longest bucket:\n");
             for (elt = ht->buckets[i]; elt; elt = elt->next)
                 FIXME("\t%s\n", elt->name);
             break;
             for (elt = ht->buckets[i]; elt; elt = elt->next)
                 FIXME("\t%s\n", elt->name);
             break;
@@ -367,7 +367,6 @@ void hash_table_destroy(struct hash_table* ht)
 
     }
 #endif
 
     }
 #endif
-#endif
 }
 
 void hash_table_add(struct hash_table* ht, struct hash_table_elt* elt)
 }
 
 void hash_table_add(struct hash_table* ht, struct hash_table_elt* elt)
index 48ebb33..c04019a 100644 (file)
@@ -24,7 +24,7 @@
 WINE_DEFAULT_DEBUG_CHANNEL(dbghelp);
 WINE_DECLARE_DEBUG_CHANNEL(dbghelp_symt);
 
 WINE_DEFAULT_DEBUG_CHANNEL(dbghelp);
 WINE_DECLARE_DEBUG_CHANNEL(dbghelp_symt);
 
-static WCHAR    starW[] = {'*','\0'};
+static const WCHAR starW[] = {'*','\0'};
 
 static inline int cmp_addr(ULONG64 a1, ULONG64 a2)
 {
 
 static inline int cmp_addr(ULONG64 a1, ULONG64 a2)
 {
@@ -1236,7 +1236,8 @@ BOOL WINAPI SymFromAddr(HANDLE hProcess, DWORD64 Address,
     if ((sym = symt_find_nearest(pair.effective, Address)) == NULL) return FALSE;
 
     symt_fill_sym_info(&pair, NULL, &sym->symt, Symbol);
     if ((sym = symt_find_nearest(pair.effective, Address)) == NULL) return FALSE;
 
     symt_fill_sym_info(&pair, NULL, &sym->symt, Symbol);
-    *Displacement = Address - Symbol->Address;
+    if (Displacement)
+        *Displacement = Address - Symbol->Address;
     return TRUE;
 }
 
     return TRUE;
 }
 
@@ -1766,6 +1767,7 @@ DWORD WINAPI UnDecorateSymbolName(PCSTR DecoratedName, PSTR UnDecoratedName,
                                   DWORD UndecoratedLength, DWORD Flags)
 {
     /* undocumented from msvcrt */
                                   DWORD UndecoratedLength, DWORD Flags)
 {
     /* undocumented from msvcrt */
+    static HANDLE hMsvcrt;
     static char* (CDECL *p_undname)(char*, const char*, int, void* (CDECL*)(size_t), void (CDECL*)(void*), unsigned short);
     static const WCHAR szMsvcrt[] = {'m','s','v','c','r','t','.','d','l','l',0};
 
     static char* (CDECL *p_undname)(char*, const char*, int, void* (CDECL*)(size_t), void (CDECL*)(void*), unsigned short);
     static const WCHAR szMsvcrt[] = {'m','s','v','c','r','t','.','d','l','l',0};
 
index 9a446a1..5b9314c 100644 (file)
@@ -69,7 +69,7 @@ reactos/dll/win32/cryptdlg            # Synced to Wine-1.7.1
 reactos/dll/win32/cryptdll            # Synced to Wine-1.7.1
 reactos/dll/win32/cryptnet            # Synced to Wine-1.7.17
 reactos/dll/win32/cryptui             # Synced to Wine-1.7.1
 reactos/dll/win32/cryptdll            # Synced to Wine-1.7.1
 reactos/dll/win32/cryptnet            # Synced to Wine-1.7.17
 reactos/dll/win32/cryptui             # Synced to Wine-1.7.1
-reactos/dll/win32/dbghelp             # Synced to Wine-1.7.1
+reactos/dll/win32/dbghelp             # Synced to Wine-1.7.17
 reactos/dll/win32/dciman32            # Synced to Wine-1.7.1
 reactos/dll/win32/dwmapi              # Synced to Wine-1.7.17
 reactos/dll/win32/faultrep            # Synced to Wine-1.7.1
 reactos/dll/win32/dciman32            # Synced to Wine-1.7.1
 reactos/dll/win32/dwmapi              # Synced to Wine-1.7.17
 reactos/dll/win32/faultrep            # Synced to Wine-1.7.1