mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
578 lines
20 KiB
Diff
578 lines
20 KiB
Diff
diff -pudN e:\wine\dlls\dbghelp/cpu_i386.c e:\reactos\dll\win32\dbghelp/cpu_i386.c
|
|
--- e:\wine\dlls\dbghelp/cpu_i386.c 2016-05-31 18:01:33 +0100
|
|
+++ e:\reactos\dll\win32\dbghelp/cpu_i386.c 2015-11-21 10:14:57 +0100
|
|
@@ -30,7 +30,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(dbghelp);
|
|
|
|
#define IS_VM86_MODE(ctx) (ctx->EFlags & V86_FLAG)
|
|
|
|
-#ifdef __i386__
|
|
+#if defined(__i386__) && !defined(DBGHELP_STATIC_LIB)
|
|
static ADDRESS_MODE get_selector_type(HANDLE hThread, const CONTEXT* ctx, WORD sel)
|
|
{
|
|
LDT_ENTRY le;
|
|
@@ -69,6 +69,7 @@ static BOOL i386_build_addr(HANDLE hThre
|
|
}
|
|
#endif
|
|
|
|
+#ifndef DBGHELP_STATIC_LIB
|
|
static BOOL i386_get_addr(HANDLE hThread, const CONTEXT* ctx,
|
|
enum cpu_addr ca, ADDRESS64* addr)
|
|
{
|
|
@@ -82,8 +83,9 @@ static BOOL i386_get_addr(HANDLE hThread
|
|
#endif
|
|
return FALSE;
|
|
}
|
|
+#endif /* DBGHELP_STATIC_LIB */
|
|
|
|
-#ifdef __i386__
|
|
+#if defined(__i386__) && !defined(DBGHELP_STATIC_LIB)
|
|
/* fetch_next_frame32()
|
|
*
|
|
* modify (at least) context.{eip, esp, ebp} using unwind information
|
|
@@ -106,7 +108,9 @@ static BOOL fetch_next_frame32(struct cp
|
|
cpair[2].name = "$eip"; cpair[2].pvalue = &context->Eip;
|
|
cpair[3].name = NULL; cpair[3].pvalue = NULL;
|
|
|
|
+#ifndef DBGHELP_STATIC_LIB
|
|
if (!pdb_virtual_unwind(csw, curr_pc, context, cpair))
|
|
+#endif
|
|
{
|
|
/* do a simple unwind using ebp
|
|
* we assume a "regular" prologue in the function has been used
|
|
@@ -144,6 +148,7 @@ enum st_mode {stm_start, stm_32bit, stm_
|
|
#define set_curr_mode(m) {frame->Reserved[__CurrentModeCount] &= ~0x0F; frame->Reserved[__CurrentModeCount] |= (m & 0x0F);}
|
|
#define inc_curr_count() (frame->Reserved[__CurrentModeCount] += 0x10)
|
|
|
|
+#ifndef DBGHELP_STATIC_LIB
|
|
static BOOL i386_stack_walk(struct cpu_stack_walk* csw, LPSTACKFRAME64 frame, CONTEXT* context)
|
|
{
|
|
STACK32FRAME frame32;
|
|
@@ -509,6 +514,7 @@ done_err:
|
|
set_curr_mode(stm_done);
|
|
return FALSE;
|
|
}
|
|
+#endif /* DBGHELP_STATIC_LIB */
|
|
|
|
static unsigned i386_map_dwarf_register(unsigned regno, BOOL eh_frame)
|
|
{
|
|
@@ -667,6 +673,7 @@ static const char* i386_fetch_regname(un
|
|
return NULL;
|
|
}
|
|
|
|
+#ifndef DBGHELP_STATIC_LIB
|
|
static BOOL i386_fetch_minidump_thread(struct dump_context* dc, unsigned index, unsigned flags, const CONTEXT* ctx)
|
|
{
|
|
if (ctx->ContextFlags && (flags & ThreadWriteInstructionWindow))
|
|
@@ -680,6 +687,7 @@ static BOOL i386_fetch_minidump_thread(s
|
|
|
|
return TRUE;
|
|
}
|
|
+#endif
|
|
|
|
static BOOL i386_fetch_minidump_module(struct dump_context* dc, unsigned index, unsigned flags)
|
|
{
|
|
@@ -693,12 +701,22 @@ DECLSPEC_HIDDEN struct cpu cpu_i386 = {
|
|
IMAGE_FILE_MACHINE_I386,
|
|
4,
|
|
CV_REG_EBP,
|
|
+#ifndef DBGHELP_STATIC_LIB
|
|
i386_get_addr,
|
|
i386_stack_walk,
|
|
+#else
|
|
+ NULL,
|
|
+ NULL,
|
|
+#endif
|
|
NULL,
|
|
i386_map_dwarf_register,
|
|
i386_fetch_context_reg,
|
|
i386_fetch_regname,
|
|
+#ifndef DBGHELP_STATIC_LIB
|
|
i386_fetch_minidump_thread,
|
|
i386_fetch_minidump_module,
|
|
+#else
|
|
+ NULL,
|
|
+ NULL,
|
|
+#endif
|
|
};
|
|
diff -pudN e:\wine\dlls\dbghelp/cpu_x86_64.c e:\reactos\dll\win32\dbghelp/cpu_x86_64.c
|
|
--- e:\wine\dlls\dbghelp/cpu_x86_64.c 2016-05-31 18:01:33 +0100
|
|
+++ e:\reactos\dll\win32\dbghelp/cpu_x86_64.c 2015-08-27 22:02:13 +0100
|
|
@@ -280,10 +280,10 @@ static BOOL is_inside_epilog(struct cpu_
|
|
if ((op0 & 0xf8) == 0x48)
|
|
{
|
|
if (!sw_read_mem(csw, pc + 1, &op1, 1)) return FALSE;
|
|
+ if (!sw_read_mem(csw, pc + 2, &op2, 1)) return FALSE;
|
|
switch (op1)
|
|
{
|
|
case 0x81: /* add $nnnn,%rsp */
|
|
- if (!sw_read_mem(csw, pc + 2, &op2, 1)) return FALSE;
|
|
if (op0 == 0x48 && op2 == 0xc4)
|
|
{
|
|
pc += 7;
|
|
@@ -291,7 +291,6 @@ static BOOL is_inside_epilog(struct cpu_
|
|
}
|
|
return FALSE;
|
|
case 0x83: /* add $n,%rsp */
|
|
- if (!sw_read_mem(csw, pc + 2, &op2, 1)) return FALSE;
|
|
if (op0 == 0x48 && op2 == 0xc4)
|
|
{
|
|
pc += 4;
|
|
@@ -299,7 +298,6 @@ static BOOL is_inside_epilog(struct cpu_
|
|
}
|
|
return FALSE;
|
|
case 0x8d: /* lea n(reg),%rsp */
|
|
- if (!sw_read_mem(csw, pc + 2, &op2, 1)) return FALSE;
|
|
if (op0 & 0x06) return FALSE; /* rex.RX must be cleared */
|
|
if (((op2 >> 3) & 7) != 4) return FALSE; /* dest reg mus be %rsp */
|
|
if ((op2 & 7) == 4) return FALSE; /* no SIB byte allowed */
|
|
diff -pudN e:\wine\dlls\dbghelp/dbghelp.c e:\reactos\dll\win32\dbghelp/dbghelp.c
|
|
--- e:\wine\dlls\dbghelp/dbghelp.c 2016-05-31 18:01:33 +0100
|
|
+++ e:\reactos\dll\win32\dbghelp/dbghelp.c 2015-11-21 10:14:57 +0100
|
|
@@ -109,6 +109,7 @@ void* fetch_buffer(struct process* pcs,
|
|
return pcs->buffer;
|
|
}
|
|
|
|
+#ifndef DBGHELP_STATIC_LIB
|
|
const char* wine_dbgstr_addr(const ADDRESS64* addr)
|
|
{
|
|
if (!addr) return "(null)";
|
|
@@ -126,12 +127,18 @@ const char* wine_dbgstr_addr(const ADDRE
|
|
return "unknown";
|
|
}
|
|
}
|
|
+#endif
|
|
|
|
extern struct cpu cpu_i386, cpu_x86_64, cpu_ppc, cpu_arm, cpu_arm64;
|
|
|
|
+#ifndef DBGHELP_STATIC_LIB
|
|
static struct cpu* dbghelp_cpus[] = {&cpu_i386, &cpu_x86_64, &cpu_ppc, &cpu_arm, &cpu_arm64, NULL};
|
|
+#else
|
|
+static struct cpu* dbghelp_cpus[] = {&cpu_i386, NULL};
|
|
+#endif
|
|
+
|
|
struct cpu* dbghelp_current_cpu =
|
|
-#if defined(__i386__)
|
|
+#if defined(__i386__) || defined(DBGHELP_STATIC_LIB)
|
|
&cpu_i386
|
|
#elif defined(__x86_64__)
|
|
&cpu_x86_64
|
|
@@ -256,8 +263,10 @@ static BOOL check_live_target(struct pro
|
|
{
|
|
if (!GetProcessId(pcs->handle)) return FALSE;
|
|
if (GetEnvironmentVariableA("DBGHELP_NOLIVE", NULL, 0)) return FALSE;
|
|
+#ifndef DBGHELP_STATIC_LIB
|
|
if (!elf_read_wine_loader_dbg_info(pcs))
|
|
macho_read_wine_loader_dbg_info(pcs);
|
|
+#endif
|
|
return TRUE;
|
|
}
|
|
|
|
@@ -346,7 +355,8 @@ BOOL WINAPI SymInitializeW(HANDLE hProce
|
|
pcs->dbg_hdr_addr = 0;
|
|
pcs->next = process_first;
|
|
process_first = pcs;
|
|
-
|
|
+
|
|
+#ifndef DBGHELP_STATIC_LIB
|
|
if (check_live_target(pcs))
|
|
{
|
|
if (fInvadeProcess)
|
|
@@ -360,6 +370,7 @@ BOOL WINAPI SymInitializeW(HANDLE hProce
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
return FALSE;
|
|
}
|
|
+#endif
|
|
|
|
return TRUE;
|
|
}
|
|
diff -pudN e:\wine\dlls\dbghelp/dbghelp_private.h e:\reactos\dll\win32\dbghelp/dbghelp_private.h
|
|
--- e:\wine\dlls\dbghelp/dbghelp_private.h 2016-05-31 18:01:33 +0100
|
|
+++ e:\reactos\dll\win32\dbghelp/dbghelp_private.h 2016-06-05 20:02:44 +0100
|
|
@@ -388,6 +388,15 @@ struct module_format
|
|
} u;
|
|
};
|
|
|
|
+#ifdef __REACTOS__
|
|
+struct symt_idx_to_ptr
|
|
+{
|
|
+ struct hash_table_elt hash_elt;
|
|
+ DWORD idx;
|
|
+ const struct symt *sym;
|
|
+};
|
|
+#endif
|
|
+
|
|
extern const struct wine_rb_functions source_rb_functions DECLSPEC_HIDDEN;
|
|
struct module
|
|
{
|
|
@@ -412,6 +421,9 @@ struct module
|
|
unsigned sorttab_size;
|
|
struct symt_ht** addr_sorttab;
|
|
struct hash_table ht_symbols;
|
|
+#ifdef __x86_64__
|
|
+ struct hash_table ht_symaddr;
|
|
+#endif
|
|
|
|
/* types */
|
|
struct hash_table ht_types;
|
|
@@ -703,7 +715,9 @@ extern BOOL dwarf2_virtual_unwin
|
|
CONTEXT* context, ULONG_PTR* cfa) DECLSPEC_HIDDEN;
|
|
|
|
/* stack.c */
|
|
+#ifndef DBGHELP_STATIC_LIB
|
|
extern BOOL sw_read_mem(struct cpu_stack_walk* csw, DWORD64 addr, void* ptr, DWORD sz) DECLSPEC_HIDDEN;
|
|
+#endif
|
|
extern DWORD64 sw_xlat_addr(struct cpu_stack_walk* csw, ADDRESS64* addr) DECLSPEC_HIDDEN;
|
|
extern void* sw_table_access(struct cpu_stack_walk* csw, DWORD64 addr) DECLSPEC_HIDDEN;
|
|
extern DWORD64 sw_module_base(struct cpu_stack_walk* csw, DWORD64 addr) DECLSPEC_HIDDEN;
|
|
diff -pudN e:\wine\dlls\dbghelp/dwarf.c e:\reactos\dll\win32\dbghelp/dwarf.c
|
|
--- e:\wine\dlls\dbghelp/dwarf.c 2016-05-31 18:01:33 +0100
|
|
+++ e:\reactos\dll\win32\dbghelp/dwarf.c 2015-11-21 10:14:57 +0100
|
|
@@ -1901,8 +1901,10 @@ static struct symt* dwarf2_parse_subprog
|
|
* (not the case for stabs), we just drop Wine's thunks here...
|
|
* Actual thunks will be created in elf_module from the symbol table
|
|
*/
|
|
+#ifndef DBGHELP_STATIC_LIB
|
|
if (elf_is_in_thunk_area(ctx->load_offset + low_pc, ctx->thunks) >= 0)
|
|
return NULL;
|
|
+#endif
|
|
if (!(ret_type = dwarf2_lookup_type(ctx, di)))
|
|
{
|
|
ret_type = ctx->symt_cache[sc_void];
|
|
@@ -2420,7 +2422,17 @@ static BOOL dwarf2_parse_compilation_uni
|
|
}
|
|
if (dwarf2_find_attribute(&ctx, di, DW_AT_stmt_list, &stmt_list))
|
|
{
|
|
+#if defined(__REACTOS__) && defined(__clang__)
|
|
+ unsigned long stmt_list_val = stmt_list.u.uvalue;
|
|
+ if (stmt_list_val > module->module.BaseOfImage)
|
|
+ {
|
|
+ /* FIXME: Clang is recording this as an address, not an offset */
|
|
+ stmt_list_val -= module->module.BaseOfImage + sections[section_line].rva;
|
|
+ }
|
|
+ if (dwarf2_parse_line_numbers(sections, &ctx, comp_dir.u.string, stmt_list_val))
|
|
+#else
|
|
if (dwarf2_parse_line_numbers(sections, &ctx, comp_dir.u.string, stmt_list.u.uvalue))
|
|
+#endif
|
|
module->module.LineNumbers = TRUE;
|
|
}
|
|
ret = TRUE;
|
|
diff -pudN e:\wine\dlls\dbghelp/dwarf.h e:\reactos\dll\win32\dbghelp/dwarf.h
|
|
--- e:\wine\dlls\dbghelp/dwarf.h 2016-05-31 18:01:33 +0100
|
|
+++ e:\reactos\dll\win32\dbghelp/dwarf.h 2014-03-05 11:46:24 +0100
|
|
@@ -556,3 +556,15 @@ enum dwarf_call_frame_info
|
|
#define DW_INL_inlined 0x01
|
|
#define DW_INL_declared_not_inlined 0x02
|
|
#define DW_INL_declared_inlined 0x03
|
|
+
|
|
+#ifdef DBGHELP_STATIC_LIB
|
|
+/* from stack.c */
|
|
+static BOOL sw_read_mem(struct cpu_stack_walk* csw, DWORD64 addr, void* ptr, DWORD sz)
|
|
+{
|
|
+ DWORD bytes_read = 0;
|
|
+ if (csw->is32)
|
|
+ return csw->u.s32.f_read_mem(csw->hProcess, addr, ptr, sz, &bytes_read);
|
|
+ else
|
|
+ return csw->u.s64.f_read_mem(csw->hProcess, addr, ptr, sz, &bytes_read);
|
|
+}
|
|
+#endif
|
|
diff -pudN e:\wine\dlls\dbghelp/image_private.h e:\reactos\dll\win32\dbghelp/image_private.h
|
|
--- e:\wine\dlls\dbghelp/image_private.h 2016-05-31 18:01:33 +0100
|
|
+++ e:\reactos\dll\win32\dbghelp/image_private.h 2015-11-21 10:14:57 +0100
|
|
@@ -58,7 +58,7 @@ typedef struct section mach
|
|
|
|
#define IMAGE_NO_MAP ((void*)-1)
|
|
|
|
-#ifdef __ELF__
|
|
+#if defined(__ELF__) && !defined(DBGHELP_STATIC_LIB)
|
|
|
|
#ifdef _WIN64
|
|
#define Elf_Ehdr Elf64_Ehdr
|
|
@@ -98,7 +98,7 @@ struct image_file_map
|
|
const char* shstrtab;
|
|
struct image_file_map* alternate; /* another ELF file (linked to this one) */
|
|
char* target_copy;
|
|
-#ifdef __ELF__
|
|
+#if defined(__ELF__) && !defined(DBGHELP_STATIC_LIB)
|
|
Elf_Ehdr elfhdr;
|
|
struct
|
|
{
|
|
@@ -180,8 +180,10 @@ static inline BOOL image_find_section(st
|
|
{
|
|
switch (fmap->modtype)
|
|
{
|
|
+#ifndef DBGHELP_STATIC_LIB
|
|
case DMT_ELF: return elf_find_section(fmap, name, SHT_NULL, ism);
|
|
case DMT_MACHO: return macho_find_section(fmap, NULL, name, ism);
|
|
+#endif
|
|
case DMT_PE: return pe_find_section(fmap, name, ism);
|
|
default: assert(0); return FALSE;
|
|
}
|
|
@@ -192,8 +194,10 @@ static inline const char* image_map_sect
|
|
if (!ism->fmap) return NULL;
|
|
switch (ism->fmap->modtype)
|
|
{
|
|
+#ifndef DBGHELP_STATIC_LIB
|
|
case DMT_ELF: return elf_map_section(ism);
|
|
case DMT_MACHO: return macho_map_section(ism);
|
|
+#endif
|
|
case DMT_PE: return pe_map_section(ism);
|
|
default: assert(0); return NULL;
|
|
}
|
|
@@ -204,8 +208,10 @@ static inline void image_unmap_section(s
|
|
if (!ism->fmap) return;
|
|
switch (ism->fmap->modtype)
|
|
{
|
|
+#ifndef DBGHELP_STATIC_LIB
|
|
case DMT_ELF: elf_unmap_section(ism); break;
|
|
case DMT_MACHO: macho_unmap_section(ism); break;
|
|
+#endif
|
|
case DMT_PE: pe_unmap_section(ism); break;
|
|
default: assert(0); return;
|
|
}
|
|
@@ -216,8 +222,10 @@ static inline DWORD_PTR image_get_map_rv
|
|
if (!ism->fmap) return 0;
|
|
switch (ism->fmap->modtype)
|
|
{
|
|
+#ifndef DBGHELP_STATIC_LIB
|
|
case DMT_ELF: return elf_get_map_rva(ism);
|
|
case DMT_MACHO: return macho_get_map_rva(ism);
|
|
+#endif
|
|
case DMT_PE: return pe_get_map_rva(ism);
|
|
default: assert(0); return 0;
|
|
}
|
|
@@ -228,8 +236,10 @@ static inline unsigned image_get_map_siz
|
|
if (!ism->fmap) return 0;
|
|
switch (ism->fmap->modtype)
|
|
{
|
|
+#ifndef DBGHELP_STATIC_LIB
|
|
case DMT_ELF: return elf_get_map_size(ism);
|
|
case DMT_MACHO: return macho_get_map_size(ism);
|
|
+#endif
|
|
case DMT_PE: return pe_get_map_size(ism);
|
|
default: assert(0); return 0;
|
|
}
|
|
diff -pudN e:\wine\dlls\dbghelp/module.c e:\reactos\dll\win32\dbghelp/module.c
|
|
--- e:\wine\dlls\dbghelp/module.c 2016-05-31 18:01:33 +0100
|
|
+++ e:\reactos\dll\win32\dbghelp/module.c 2016-06-05 20:02:44 +0100
|
|
@@ -211,6 +211,9 @@ struct module* module_new(struct process
|
|
*/
|
|
hash_table_init(&module->pool, &module->ht_symbols, 4096);
|
|
hash_table_init(&module->pool, &module->ht_types, 4096);
|
|
+#ifdef __x86_64__
|
|
+ hash_table_init(&module->pool, &module->ht_symaddr, 4096);
|
|
+#endif
|
|
vector_init(&module->vtypes, sizeof(struct symt*), 32);
|
|
|
|
module->sources_used = 0;
|
|
@@ -337,9 +340,11 @@ BOOL module_get_debug(struct module_pair
|
|
if (pair->effective->is_virtual) ret = FALSE;
|
|
else switch (pair->effective->type)
|
|
{
|
|
+#ifndef DBGHELP_STATIC_LIB
|
|
case DMT_ELF:
|
|
ret = elf_load_debug_info(pair->effective);
|
|
break;
|
|
+#endif
|
|
case DMT_PE:
|
|
idslW64.SizeOfStruct = sizeof(idslW64);
|
|
idslW64.BaseOfImage = pair->effective->module.BaseOfImage;
|
|
@@ -356,9 +361,11 @@ BOOL module_get_debug(struct module_pair
|
|
ret ? CBA_DEFERRED_SYMBOL_LOAD_COMPLETE : CBA_DEFERRED_SYMBOL_LOAD_FAILURE,
|
|
&idslW64);
|
|
break;
|
|
+#ifndef DBGHELP_STATIC_LIB
|
|
case DMT_MACHO:
|
|
ret = macho_load_debug_info(pair->effective);
|
|
break;
|
|
+#endif
|
|
default:
|
|
ret = FALSE;
|
|
break;
|
|
@@ -497,11 +504,13 @@ enum module_type module_get_type_by_name
|
|
/******************************************************************
|
|
* refresh_module_list
|
|
*/
|
|
+#ifndef DBGHELP_STATIC_LIB
|
|
static BOOL refresh_module_list(struct process* pcs)
|
|
{
|
|
/* force transparent ELF and Mach-O loading / unloading */
|
|
return elf_synchronize_module_list(pcs) || macho_synchronize_module_list(pcs);
|
|
}
|
|
+#endif
|
|
|
|
/***********************************************************************
|
|
* SymLoadModule (DBGHELP.@)
|
|
@@ -585,7 +594,9 @@ DWORD64 WINAPI SymLoadModuleExW(HANDLE
|
|
if (Flags & ~(SLMFLAG_VIRTUAL))
|
|
FIXME("Unsupported Flags %08x for %s\n", Flags, debugstr_w(wImageName));
|
|
|
|
+#ifndef DBGHELP_STATIC_LIB
|
|
refresh_module_list(pcs);
|
|
+#endif
|
|
|
|
/* this is a Wine extension to the API just to redo the synchronisation */
|
|
if (!wImageName && !hFile) return 0;
|
|
@@ -609,6 +620,7 @@ DWORD64 WINAPI SymLoadModuleExW(HANDLE
|
|
wImageName)
|
|
{
|
|
/* and finally an ELF or Mach-O module */
|
|
+#ifndef DBGHELP_STATIC_LIB
|
|
switch (module_get_type_by_name(wImageName))
|
|
{
|
|
case DMT_ELF:
|
|
@@ -621,6 +633,7 @@ DWORD64 WINAPI SymLoadModuleExW(HANDLE
|
|
/* Ignored */
|
|
break;
|
|
}
|
|
+#endif
|
|
}
|
|
}
|
|
if (!module)
|
|
@@ -810,6 +823,7 @@ BOOL WINAPI SymEnumerateModulesW64(HAND
|
|
return TRUE;
|
|
}
|
|
|
|
+#ifndef DBGHELP_STATIC_LIB
|
|
/******************************************************************
|
|
* EnumerateLoadedModules64 (DBGHELP.@)
|
|
*
|
|
@@ -911,6 +925,8 @@ BOOL WINAPI EnumerateLoadedModulesW64(H
|
|
return sz != 0 && i == sz;
|
|
}
|
|
|
|
+#endif /* DBGHELP_STATIC_LIB */
|
|
+
|
|
/******************************************************************
|
|
* SymGetModuleInfo (DBGHELP.@)
|
|
*
|
|
@@ -1122,7 +1138,11 @@ BOOL WINAPI SymRefreshModuleList(HANDLE
|
|
|
|
if (!(pcs = process_find_by_handle(hProcess))) return FALSE;
|
|
|
|
+#ifndef DBGHELP_STATIC_LIB
|
|
return refresh_module_list(pcs);
|
|
+#else
|
|
+ return TRUE;
|
|
+#endif
|
|
}
|
|
|
|
/***********************************************************************
|
|
diff -pudN e:\wine\dlls\dbghelp/pe_module.c e:\reactos\dll\win32\dbghelp/pe_module.c
|
|
--- e:\wine\dlls\dbghelp/pe_module.c 2016-05-31 18:01:33 +0100
|
|
+++ e:\reactos\dll\win32\dbghelp/pe_module.c 2016-06-05 20:02:44 +0100
|
|
@@ -505,6 +505,7 @@ static BOOL pe_load_dwarf(struct module*
|
|
return ret;
|
|
}
|
|
|
|
+#ifndef DBGHELP_STATIC_LIB
|
|
/******************************************************************
|
|
* pe_load_dbg_file
|
|
*
|
|
@@ -604,6 +605,7 @@ done:
|
|
pe_unmap_full(fmap);
|
|
return ret;
|
|
}
|
|
+#endif /* DBGHELP_STATIC_LIB */
|
|
|
|
/***********************************************************************
|
|
* pe_load_export_debug_info
|
|
@@ -700,7 +702,9 @@ BOOL pe_load_debug_info(const struct pro
|
|
{
|
|
ret = pe_load_stabs(pcs, module);
|
|
ret = pe_load_dwarf(module) || ret;
|
|
+ #ifndef DBGHELP_STATIC_LIB
|
|
ret = pe_load_msc_debug_info(pcs, module) || ret;
|
|
+ #endif
|
|
ret = ret || pe_load_coff_symbol_table(module); /* FIXME */
|
|
/* if we still have no debug info (we could only get SymExport at this
|
|
* point), then do the SymExport except if we have an ELF container,
|
|
diff -pudN e:\wine\dlls\dbghelp/stabs.c e:\reactos\dll\win32\dbghelp/stabs.c
|
|
--- e:\wine\dlls\dbghelp/stabs.c 2016-05-31 18:01:33 +0100
|
|
+++ e:\reactos\dll\win32\dbghelp/stabs.c 2015-08-27 22:02:13 +0100
|
|
@@ -37,6 +37,10 @@
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(dbghelp_stabs);
|
|
|
|
+#ifndef DBGHELP_STATIC_LIB
|
|
+#define strtoull _strtoui64
|
|
+#endif
|
|
+
|
|
/* Masks for n_type field */
|
|
#ifndef N_STAB
|
|
#define N_STAB 0xe0
|
|
diff -pudN e:\wine\dlls\dbghelp/symbol.c e:\reactos\dll\win32\dbghelp/symbol.c
|
|
--- e:\wine\dlls\dbghelp/symbol.c 2016-05-31 18:01:33 +0100
|
|
+++ e:\reactos\dll\win32\dbghelp/symbol.c 2016-06-05 20:02:44 +0100
|
|
@@ -53,18 +53,39 @@ int symt_cmp_addr(const void* p1, const
|
|
|
|
DWORD symt_ptr2index(struct module* module, const struct symt* sym)
|
|
{
|
|
-#ifdef _WIN64
|
|
+#ifdef __x86_64__
|
|
const struct symt** c;
|
|
- int len = vector_length(&module->vsymt), i;
|
|
+ int len = vector_length(&module->vsymt);
|
|
+ struct hash_table_iter hti;
|
|
+ void *ptr;
|
|
+ struct symt_idx_to_ptr *idx_to_ptr;
|
|
+ /* place enough storage on the stack to represent a pointer in %p form */
|
|
+ char ptrbuf[3 + (sizeof(void *) * 2)];
|
|
|
|
- /* FIXME: this is inefficient */
|
|
- for (i = 0; i < len; i++)
|
|
- {
|
|
- if (*(struct symt**)vector_at(&module->vsymt, i) == sym)
|
|
- return i + 1;
|
|
+ /* make a string representation of the pointer to use as a hash key */
|
|
+ sprintf(ptrbuf, "%p", sym);
|
|
+ hash_table_iter_init(&module->ht_symaddr, &hti, ptrbuf);
|
|
+
|
|
+ /* try to find the pointer in our ht */
|
|
+ while ((ptr = hash_table_iter_up(&hti))) {
|
|
+ idx_to_ptr = CONTAINING_RECORD(ptr, struct symt_idx_to_ptr, hash_elt);
|
|
+ if (idx_to_ptr->sym == sym)
|
|
+ return idx_to_ptr->idx;
|
|
}
|
|
+
|
|
/* not found */
|
|
+ /* add the symbol to our symbol vector */
|
|
c = vector_add(&module->vsymt, &module->pool);
|
|
+
|
|
+ /* add an idx to ptr mapping so we can find it again by address */
|
|
+ if ((idx_to_ptr = pool_alloc(&module->pool, sizeof(*idx_to_ptr))))
|
|
+ {
|
|
+ idx_to_ptr->hash_elt.name = pool_strdup(&module->pool, ptrbuf);
|
|
+ idx_to_ptr->sym = sym;
|
|
+ idx_to_ptr->idx = len + 1;
|
|
+ hash_table_add(&module->ht_symaddr, &idx_to_ptr->hash_elt);
|
|
+ }
|
|
+
|
|
if (c) *c = sym;
|
|
return len + 1;
|
|
#else
|
|
@@ -74,7 +95,7 @@ DWORD symt_ptr2index(struct
|
|
|
|
struct symt* symt_index2ptr(struct module* module, DWORD id)
|
|
{
|
|
-#ifdef _WIN64
|
|
+#ifdef __x86_64__
|
|
if (!id-- || id >= vector_length(&module->vsymt)) return NULL;
|
|
return *(struct symt**)vector_at(&module->vsymt, id);
|
|
#else
|
|
diff -pudN e:\wine\dlls\dbghelp/version.rc e:\reactos\dll\win32\dbghelp/version.rc
|
|
--- e:\wine\dlls\dbghelp/version.rc 2015-11-15 19:23:04 +0100
|
|
+++ e:\reactos\dll\win32\dbghelp/version.rc 2012-02-23 01:07:59 +0100
|
|
@@ -18,9 +18,9 @@
|
|
|
|
#define WINE_FILEDESCRIPTION_STR "Wine Image Helper"
|
|
#define WINE_FILENAME_STR "dbghelp.dll"
|
|
-#define WINE_FILEVERSION 6,1,7601,17514
|
|
-#define WINE_FILEVERSION_STR "6.1.7601.17514"
|
|
-#define WINE_PRODUCTVERSION 6,1,7601,17514
|
|
-#define WINE_PRODUCTVERSION_STR "6.1.7601.17514"
|
|
+#define WINE_FILEVERSION 5,1,2600,3264
|
|
+#define WINE_FILEVERSION_STR "5.1.2600.3264"
|
|
+#define WINE_PRODUCTVERSION 5,1,2600,3264
|
|
+#define WINE_PRODUCTVERSION_STR "5.1.2600.3264"
|
|
|
|
#include "wine/wine_common_ver.rc"
|