[NTOSKRNL] Drop the useless Timestamp field
[reactos.git] / dll / win32 / dbghelp / dbghelp_ros.diff
1 diff -pudN e:\wine\dlls\dbghelp/cpu_i386.c e:\reactos\dll\win32\dbghelp/cpu_i386.c
2 --- e:\wine\dlls\dbghelp/cpu_i386.c 2016-05-31 18:01:33 +0100
3 +++ e:\reactos\dll\win32\dbghelp/cpu_i386.c 2015-11-21 10:14:57 +0100
4 @@ -30,7 +30,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(dbghelp);
5
6 #define IS_VM86_MODE(ctx) (ctx->EFlags & V86_FLAG)
7
8 -#ifdef __i386__
9 +#if defined(__i386__) && !defined(DBGHELP_STATIC_LIB)
10 static ADDRESS_MODE get_selector_type(HANDLE hThread, const CONTEXT* ctx, WORD sel)
11 {
12 LDT_ENTRY le;
13 @@ -69,6 +69,7 @@ static BOOL i386_build_addr(HANDLE hThre
14 }
15 #endif
16
17 +#ifndef DBGHELP_STATIC_LIB
18 static BOOL i386_get_addr(HANDLE hThread, const CONTEXT* ctx,
19 enum cpu_addr ca, ADDRESS64* addr)
20 {
21 @@ -82,8 +83,9 @@ static BOOL i386_get_addr(HANDLE hThread
22 #endif
23 return FALSE;
24 }
25 +#endif /* DBGHELP_STATIC_LIB */
26
27 -#ifdef __i386__
28 +#if defined(__i386__) && !defined(DBGHELP_STATIC_LIB)
29 /* fetch_next_frame32()
30 *
31 * modify (at least) context.{eip, esp, ebp} using unwind information
32 @@ -106,7 +108,9 @@ static BOOL fetch_next_frame32(struct cp
33 cpair[2].name = "$eip"; cpair[2].pvalue = &context->Eip;
34 cpair[3].name = NULL; cpair[3].pvalue = NULL;
35
36 +#ifndef DBGHELP_STATIC_LIB
37 if (!pdb_virtual_unwind(csw, curr_pc, context, cpair))
38 +#endif
39 {
40 /* do a simple unwind using ebp
41 * we assume a "regular" prologue in the function has been used
42 @@ -144,6 +148,7 @@ enum st_mode {stm_start, stm_32bit, stm_
43 #define set_curr_mode(m) {frame->Reserved[__CurrentModeCount] &= ~0x0F; frame->Reserved[__CurrentModeCount] |= (m & 0x0F);}
44 #define inc_curr_count() (frame->Reserved[__CurrentModeCount] += 0x10)
45
46 +#ifndef DBGHELP_STATIC_LIB
47 static BOOL i386_stack_walk(struct cpu_stack_walk* csw, LPSTACKFRAME64 frame, CONTEXT* context)
48 {
49 STACK32FRAME frame32;
50 @@ -509,6 +514,7 @@ done_err:
51 set_curr_mode(stm_done);
52 return FALSE;
53 }
54 +#endif /* DBGHELP_STATIC_LIB */
55
56 static unsigned i386_map_dwarf_register(unsigned regno, BOOL eh_frame)
57 {
58 @@ -667,6 +673,7 @@ static const char* i386_fetch_regname(un
59 return NULL;
60 }
61
62 +#ifndef DBGHELP_STATIC_LIB
63 static BOOL i386_fetch_minidump_thread(struct dump_context* dc, unsigned index, unsigned flags, const CONTEXT* ctx)
64 {
65 if (ctx->ContextFlags && (flags & ThreadWriteInstructionWindow))
66 @@ -680,6 +687,7 @@ static BOOL i386_fetch_minidump_thread(s
67
68 return TRUE;
69 }
70 +#endif
71
72 static BOOL i386_fetch_minidump_module(struct dump_context* dc, unsigned index, unsigned flags)
73 {
74 @@ -693,12 +701,22 @@ DECLSPEC_HIDDEN struct cpu cpu_i386 = {
75 IMAGE_FILE_MACHINE_I386,
76 4,
77 CV_REG_EBP,
78 +#ifndef DBGHELP_STATIC_LIB
79 i386_get_addr,
80 i386_stack_walk,
81 +#else
82 + NULL,
83 + NULL,
84 +#endif
85 NULL,
86 i386_map_dwarf_register,
87 i386_fetch_context_reg,
88 i386_fetch_regname,
89 +#ifndef DBGHELP_STATIC_LIB
90 i386_fetch_minidump_thread,
91 i386_fetch_minidump_module,
92 +#else
93 + NULL,
94 + NULL,
95 +#endif
96 };
97 diff -pudN e:\wine\dlls\dbghelp/cpu_x86_64.c e:\reactos\dll\win32\dbghelp/cpu_x86_64.c
98 --- e:\wine\dlls\dbghelp/cpu_x86_64.c 2016-05-31 18:01:33 +0100
99 +++ e:\reactos\dll\win32\dbghelp/cpu_x86_64.c 2015-08-27 22:02:13 +0100
100 @@ -280,10 +280,10 @@ static BOOL is_inside_epilog(struct cpu_
101 if ((op0 & 0xf8) == 0x48)
102 {
103 if (!sw_read_mem(csw, pc + 1, &op1, 1)) return FALSE;
104 + if (!sw_read_mem(csw, pc + 2, &op2, 1)) return FALSE;
105 switch (op1)
106 {
107 case 0x81: /* add $nnnn,%rsp */
108 - if (!sw_read_mem(csw, pc + 2, &op2, 1)) return FALSE;
109 if (op0 == 0x48 && op2 == 0xc4)
110 {
111 pc += 7;
112 @@ -291,7 +291,6 @@ static BOOL is_inside_epilog(struct cpu_
113 }
114 return FALSE;
115 case 0x83: /* add $n,%rsp */
116 - if (!sw_read_mem(csw, pc + 2, &op2, 1)) return FALSE;
117 if (op0 == 0x48 && op2 == 0xc4)
118 {
119 pc += 4;
120 @@ -299,7 +298,6 @@ static BOOL is_inside_epilog(struct cpu_
121 }
122 return FALSE;
123 case 0x8d: /* lea n(reg),%rsp */
124 - if (!sw_read_mem(csw, pc + 2, &op2, 1)) return FALSE;
125 if (op0 & 0x06) return FALSE; /* rex.RX must be cleared */
126 if (((op2 >> 3) & 7) != 4) return FALSE; /* dest reg mus be %rsp */
127 if ((op2 & 7) == 4) return FALSE; /* no SIB byte allowed */
128 diff -pudN e:\wine\dlls\dbghelp/dbghelp.c e:\reactos\dll\win32\dbghelp/dbghelp.c
129 --- e:\wine\dlls\dbghelp/dbghelp.c 2016-05-31 18:01:33 +0100
130 +++ e:\reactos\dll\win32\dbghelp/dbghelp.c 2015-11-21 10:14:57 +0100
131 @@ -109,6 +109,7 @@ void* fetch_buffer(struct process* pcs,
132 return pcs->buffer;
133 }
134
135 +#ifndef DBGHELP_STATIC_LIB
136 const char* wine_dbgstr_addr(const ADDRESS64* addr)
137 {
138 if (!addr) return "(null)";
139 @@ -126,12 +127,18 @@ const char* wine_dbgstr_addr(const ADDRE
140 return "unknown";
141 }
142 }
143 +#endif
144
145 extern struct cpu cpu_i386, cpu_x86_64, cpu_ppc, cpu_arm, cpu_arm64;
146
147 +#ifndef DBGHELP_STATIC_LIB
148 static struct cpu* dbghelp_cpus[] = {&cpu_i386, &cpu_x86_64, &cpu_ppc, &cpu_arm, &cpu_arm64, NULL};
149 +#else
150 +static struct cpu* dbghelp_cpus[] = {&cpu_i386, NULL};
151 +#endif
152 +
153 struct cpu* dbghelp_current_cpu =
154 -#if defined(__i386__)
155 +#if defined(__i386__) || defined(DBGHELP_STATIC_LIB)
156 &cpu_i386
157 #elif defined(__x86_64__)
158 &cpu_x86_64
159 @@ -256,8 +263,10 @@ static BOOL check_live_target(struct pro
160 {
161 if (!GetProcessId(pcs->handle)) return FALSE;
162 if (GetEnvironmentVariableA("DBGHELP_NOLIVE", NULL, 0)) return FALSE;
163 +#ifndef DBGHELP_STATIC_LIB
164 if (!elf_read_wine_loader_dbg_info(pcs))
165 macho_read_wine_loader_dbg_info(pcs);
166 +#endif
167 return TRUE;
168 }
169
170 @@ -346,7 +355,8 @@ BOOL WINAPI SymInitializeW(HANDLE hProce
171 pcs->dbg_hdr_addr = 0;
172 pcs->next = process_first;
173 process_first = pcs;
174 -
175 +
176 +#ifndef DBGHELP_STATIC_LIB
177 if (check_live_target(pcs))
178 {
179 if (fInvadeProcess)
180 @@ -360,6 +370,7 @@ BOOL WINAPI SymInitializeW(HANDLE hProce
181 SetLastError(ERROR_INVALID_PARAMETER);
182 return FALSE;
183 }
184 +#endif
185
186 return TRUE;
187 }
188 diff -pudN e:\wine\dlls\dbghelp/dbghelp_private.h e:\reactos\dll\win32\dbghelp/dbghelp_private.h
189 --- e:\wine\dlls\dbghelp/dbghelp_private.h 2016-05-31 18:01:33 +0100
190 +++ e:\reactos\dll\win32\dbghelp/dbghelp_private.h 2016-06-05 20:02:44 +0100
191 @@ -388,6 +388,15 @@ struct module_format
192 } u;
193 };
194
195 +#ifdef __REACTOS__
196 +struct symt_idx_to_ptr
197 +{
198 + struct hash_table_elt hash_elt;
199 + DWORD idx;
200 + const struct symt *sym;
201 +};
202 +#endif
203 +
204 extern const struct wine_rb_functions source_rb_functions DECLSPEC_HIDDEN;
205 struct module
206 {
207 @@ -412,6 +421,9 @@ struct module
208 unsigned sorttab_size;
209 struct symt_ht** addr_sorttab;
210 struct hash_table ht_symbols;
211 +#ifdef __x86_64__
212 + struct hash_table ht_symaddr;
213 +#endif
214
215 /* types */
216 struct hash_table ht_types;
217 @@ -703,7 +715,9 @@ extern BOOL dwarf2_virtual_unwin
218 CONTEXT* context, ULONG_PTR* cfa) DECLSPEC_HIDDEN;
219
220 /* stack.c */
221 +#ifndef DBGHELP_STATIC_LIB
222 extern BOOL sw_read_mem(struct cpu_stack_walk* csw, DWORD64 addr, void* ptr, DWORD sz) DECLSPEC_HIDDEN;
223 +#endif
224 extern DWORD64 sw_xlat_addr(struct cpu_stack_walk* csw, ADDRESS64* addr) DECLSPEC_HIDDEN;
225 extern void* sw_table_access(struct cpu_stack_walk* csw, DWORD64 addr) DECLSPEC_HIDDEN;
226 extern DWORD64 sw_module_base(struct cpu_stack_walk* csw, DWORD64 addr) DECLSPEC_HIDDEN;
227 diff -pudN e:\wine\dlls\dbghelp/dwarf.c e:\reactos\dll\win32\dbghelp/dwarf.c
228 --- e:\wine\dlls\dbghelp/dwarf.c 2016-05-31 18:01:33 +0100
229 +++ e:\reactos\dll\win32\dbghelp/dwarf.c 2015-11-21 10:14:57 +0100
230 @@ -1901,8 +1901,10 @@ static struct symt* dwarf2_parse_subprog
231 * (not the case for stabs), we just drop Wine's thunks here...
232 * Actual thunks will be created in elf_module from the symbol table
233 */
234 +#ifndef DBGHELP_STATIC_LIB
235 if (elf_is_in_thunk_area(ctx->load_offset + low_pc, ctx->thunks) >= 0)
236 return NULL;
237 +#endif
238 if (!(ret_type = dwarf2_lookup_type(ctx, di)))
239 {
240 ret_type = ctx->symt_cache[sc_void];
241 @@ -2420,7 +2422,17 @@ static BOOL dwarf2_parse_compilation_uni
242 }
243 if (dwarf2_find_attribute(&ctx, di, DW_AT_stmt_list, &stmt_list))
244 {
245 +#if defined(__REACTOS__) && defined(__clang__)
246 + unsigned long stmt_list_val = stmt_list.u.uvalue;
247 + if (stmt_list_val > module->module.BaseOfImage)
248 + {
249 + /* FIXME: Clang is recording this as an address, not an offset */
250 + stmt_list_val -= module->module.BaseOfImage + sections[section_line].rva;
251 + }
252 + if (dwarf2_parse_line_numbers(sections, &ctx, comp_dir.u.string, stmt_list_val))
253 +#else
254 if (dwarf2_parse_line_numbers(sections, &ctx, comp_dir.u.string, stmt_list.u.uvalue))
255 +#endif
256 module->module.LineNumbers = TRUE;
257 }
258 ret = TRUE;
259 diff -pudN e:\wine\dlls\dbghelp/dwarf.h e:\reactos\dll\win32\dbghelp/dwarf.h
260 --- e:\wine\dlls\dbghelp/dwarf.h 2016-05-31 18:01:33 +0100
261 +++ e:\reactos\dll\win32\dbghelp/dwarf.h 2014-03-05 11:46:24 +0100
262 @@ -556,3 +556,15 @@ enum dwarf_call_frame_info
263 #define DW_INL_inlined 0x01
264 #define DW_INL_declared_not_inlined 0x02
265 #define DW_INL_declared_inlined 0x03
266 +
267 +#ifdef DBGHELP_STATIC_LIB
268 +/* from stack.c */
269 +static BOOL sw_read_mem(struct cpu_stack_walk* csw, DWORD64 addr, void* ptr, DWORD sz)
270 +{
271 + DWORD bytes_read = 0;
272 + if (csw->is32)
273 + return csw->u.s32.f_read_mem(csw->hProcess, addr, ptr, sz, &bytes_read);
274 + else
275 + return csw->u.s64.f_read_mem(csw->hProcess, addr, ptr, sz, &bytes_read);
276 +}
277 +#endif
278 diff -pudN e:\wine\dlls\dbghelp/image_private.h e:\reactos\dll\win32\dbghelp/image_private.h
279 --- e:\wine\dlls\dbghelp/image_private.h 2016-05-31 18:01:33 +0100
280 +++ e:\reactos\dll\win32\dbghelp/image_private.h 2015-11-21 10:14:57 +0100
281 @@ -58,7 +58,7 @@ typedef struct section mach
282
283 #define IMAGE_NO_MAP ((void*)-1)
284
285 -#ifdef __ELF__
286 +#if defined(__ELF__) && !defined(DBGHELP_STATIC_LIB)
287
288 #ifdef _WIN64
289 #define Elf_Ehdr Elf64_Ehdr
290 @@ -98,7 +98,7 @@ struct image_file_map
291 const char* shstrtab;
292 struct image_file_map* alternate; /* another ELF file (linked to this one) */
293 char* target_copy;
294 -#ifdef __ELF__
295 +#if defined(__ELF__) && !defined(DBGHELP_STATIC_LIB)
296 Elf_Ehdr elfhdr;
297 struct
298 {
299 @@ -180,8 +180,10 @@ static inline BOOL image_find_section(st
300 {
301 switch (fmap->modtype)
302 {
303 +#ifndef DBGHELP_STATIC_LIB
304 case DMT_ELF: return elf_find_section(fmap, name, SHT_NULL, ism);
305 case DMT_MACHO: return macho_find_section(fmap, NULL, name, ism);
306 +#endif
307 case DMT_PE: return pe_find_section(fmap, name, ism);
308 default: assert(0); return FALSE;
309 }
310 @@ -192,8 +194,10 @@ static inline const char* image_map_sect
311 if (!ism->fmap) return NULL;
312 switch (ism->fmap->modtype)
313 {
314 +#ifndef DBGHELP_STATIC_LIB
315 case DMT_ELF: return elf_map_section(ism);
316 case DMT_MACHO: return macho_map_section(ism);
317 +#endif
318 case DMT_PE: return pe_map_section(ism);
319 default: assert(0); return NULL;
320 }
321 @@ -204,8 +208,10 @@ static inline void image_unmap_section(s
322 if (!ism->fmap) return;
323 switch (ism->fmap->modtype)
324 {
325 +#ifndef DBGHELP_STATIC_LIB
326 case DMT_ELF: elf_unmap_section(ism); break;
327 case DMT_MACHO: macho_unmap_section(ism); break;
328 +#endif
329 case DMT_PE: pe_unmap_section(ism); break;
330 default: assert(0); return;
331 }
332 @@ -216,8 +222,10 @@ static inline DWORD_PTR image_get_map_rv
333 if (!ism->fmap) return 0;
334 switch (ism->fmap->modtype)
335 {
336 +#ifndef DBGHELP_STATIC_LIB
337 case DMT_ELF: return elf_get_map_rva(ism);
338 case DMT_MACHO: return macho_get_map_rva(ism);
339 +#endif
340 case DMT_PE: return pe_get_map_rva(ism);
341 default: assert(0); return 0;
342 }
343 @@ -228,8 +236,10 @@ static inline unsigned image_get_map_siz
344 if (!ism->fmap) return 0;
345 switch (ism->fmap->modtype)
346 {
347 +#ifndef DBGHELP_STATIC_LIB
348 case DMT_ELF: return elf_get_map_size(ism);
349 case DMT_MACHO: return macho_get_map_size(ism);
350 +#endif
351 case DMT_PE: return pe_get_map_size(ism);
352 default: assert(0); return 0;
353 }
354 diff -pudN e:\wine\dlls\dbghelp/module.c e:\reactos\dll\win32\dbghelp/module.c
355 --- e:\wine\dlls\dbghelp/module.c 2016-05-31 18:01:33 +0100
356 +++ e:\reactos\dll\win32\dbghelp/module.c 2016-06-05 20:02:44 +0100
357 @@ -211,6 +211,9 @@ struct module* module_new(struct process
358 */
359 hash_table_init(&module->pool, &module->ht_symbols, 4096);
360 hash_table_init(&module->pool, &module->ht_types, 4096);
361 +#ifdef __x86_64__
362 + hash_table_init(&module->pool, &module->ht_symaddr, 4096);
363 +#endif
364 vector_init(&module->vtypes, sizeof(struct symt*), 32);
365
366 module->sources_used = 0;
367 @@ -337,9 +340,11 @@ BOOL module_get_debug(struct module_pair
368 if (pair->effective->is_virtual) ret = FALSE;
369 else switch (pair->effective->type)
370 {
371 +#ifndef DBGHELP_STATIC_LIB
372 case DMT_ELF:
373 ret = elf_load_debug_info(pair->effective);
374 break;
375 +#endif
376 case DMT_PE:
377 idslW64.SizeOfStruct = sizeof(idslW64);
378 idslW64.BaseOfImage = pair->effective->module.BaseOfImage;
379 @@ -356,9 +361,11 @@ BOOL module_get_debug(struct module_pair
380 ret ? CBA_DEFERRED_SYMBOL_LOAD_COMPLETE : CBA_DEFERRED_SYMBOL_LOAD_FAILURE,
381 &idslW64);
382 break;
383 +#ifndef DBGHELP_STATIC_LIB
384 case DMT_MACHO:
385 ret = macho_load_debug_info(pair->effective);
386 break;
387 +#endif
388 default:
389 ret = FALSE;
390 break;
391 @@ -497,11 +504,13 @@ enum module_type module_get_type_by_name
392 /******************************************************************
393 * refresh_module_list
394 */
395 +#ifndef DBGHELP_STATIC_LIB
396 static BOOL refresh_module_list(struct process* pcs)
397 {
398 /* force transparent ELF and Mach-O loading / unloading */
399 return elf_synchronize_module_list(pcs) || macho_synchronize_module_list(pcs);
400 }
401 +#endif
402
403 /***********************************************************************
404 * SymLoadModule (DBGHELP.@)
405 @@ -585,7 +594,9 @@ DWORD64 WINAPI SymLoadModuleExW(HANDLE
406 if (Flags & ~(SLMFLAG_VIRTUAL))
407 FIXME("Unsupported Flags %08x for %s\n", Flags, debugstr_w(wImageName));
408
409 +#ifndef DBGHELP_STATIC_LIB
410 refresh_module_list(pcs);
411 +#endif
412
413 /* this is a Wine extension to the API just to redo the synchronisation */
414 if (!wImageName && !hFile) return 0;
415 @@ -609,6 +620,7 @@ DWORD64 WINAPI SymLoadModuleExW(HANDLE
416 wImageName)
417 {
418 /* and finally an ELF or Mach-O module */
419 +#ifndef DBGHELP_STATIC_LIB
420 switch (module_get_type_by_name(wImageName))
421 {
422 case DMT_ELF:
423 @@ -621,6 +633,7 @@ DWORD64 WINAPI SymLoadModuleExW(HANDLE
424 /* Ignored */
425 break;
426 }
427 +#endif
428 }
429 }
430 if (!module)
431 @@ -810,6 +823,7 @@ BOOL WINAPI SymEnumerateModulesW64(HAND
432 return TRUE;
433 }
434
435 +#ifndef DBGHELP_STATIC_LIB
436 /******************************************************************
437 * EnumerateLoadedModules64 (DBGHELP.@)
438 *
439 @@ -911,6 +925,8 @@ BOOL WINAPI EnumerateLoadedModulesW64(H
440 return sz != 0 && i == sz;
441 }
442
443 +#endif /* DBGHELP_STATIC_LIB */
444 +
445 /******************************************************************
446 * SymGetModuleInfo (DBGHELP.@)
447 *
448 @@ -1122,7 +1138,11 @@ BOOL WINAPI SymRefreshModuleList(HANDLE
449
450 if (!(pcs = process_find_by_handle(hProcess))) return FALSE;
451
452 +#ifndef DBGHELP_STATIC_LIB
453 return refresh_module_list(pcs);
454 +#else
455 + return TRUE;
456 +#endif
457 }
458
459 /***********************************************************************
460 diff -pudN e:\wine\dlls\dbghelp/pe_module.c e:\reactos\dll\win32\dbghelp/pe_module.c
461 --- e:\wine\dlls\dbghelp/pe_module.c 2016-05-31 18:01:33 +0100
462 +++ e:\reactos\dll\win32\dbghelp/pe_module.c 2016-06-05 20:02:44 +0100
463 @@ -505,6 +505,7 @@ static BOOL pe_load_dwarf(struct module*
464 return ret;
465 }
466
467 +#ifndef DBGHELP_STATIC_LIB
468 /******************************************************************
469 * pe_load_dbg_file
470 *
471 @@ -604,6 +605,7 @@ done:
472 pe_unmap_full(fmap);
473 return ret;
474 }
475 +#endif /* DBGHELP_STATIC_LIB */
476
477 /***********************************************************************
478 * pe_load_export_debug_info
479 @@ -700,7 +702,9 @@ BOOL pe_load_debug_info(const struct pro
480 {
481 ret = pe_load_stabs(pcs, module);
482 ret = pe_load_dwarf(module) || ret;
483 + #ifndef DBGHELP_STATIC_LIB
484 ret = pe_load_msc_debug_info(pcs, module) || ret;
485 + #endif
486 ret = ret || pe_load_coff_symbol_table(module); /* FIXME */
487 /* if we still have no debug info (we could only get SymExport at this
488 * point), then do the SymExport except if we have an ELF container,
489 diff -pudN e:\wine\dlls\dbghelp/stabs.c e:\reactos\dll\win32\dbghelp/stabs.c
490 --- e:\wine\dlls\dbghelp/stabs.c 2016-05-31 18:01:33 +0100
491 +++ e:\reactos\dll\win32\dbghelp/stabs.c 2015-08-27 22:02:13 +0100
492 @@ -37,6 +37,10 @@
493
494 WINE_DEFAULT_DEBUG_CHANNEL(dbghelp_stabs);
495
496 +#ifndef DBGHELP_STATIC_LIB
497 +#define strtoull _strtoui64
498 +#endif
499 +
500 /* Masks for n_type field */
501 #ifndef N_STAB
502 #define N_STAB 0xe0
503 diff -pudN e:\wine\dlls\dbghelp/symbol.c e:\reactos\dll\win32\dbghelp/symbol.c
504 --- e:\wine\dlls\dbghelp/symbol.c 2016-05-31 18:01:33 +0100
505 +++ e:\reactos\dll\win32\dbghelp/symbol.c 2016-06-05 20:02:44 +0100
506 @@ -53,18 +53,39 @@ int symt_cmp_addr(const void* p1, const
507
508 DWORD symt_ptr2index(struct module* module, const struct symt* sym)
509 {
510 -#ifdef _WIN64
511 +#ifdef __x86_64__
512 const struct symt** c;
513 - int len = vector_length(&module->vsymt), i;
514 + int len = vector_length(&module->vsymt);
515 + struct hash_table_iter hti;
516 + void *ptr;
517 + struct symt_idx_to_ptr *idx_to_ptr;
518 + /* place enough storage on the stack to represent a pointer in %p form */
519 + char ptrbuf[3 + (sizeof(void *) * 2)];
520
521 - /* FIXME: this is inefficient */
522 - for (i = 0; i < len; i++)
523 - {
524 - if (*(struct symt**)vector_at(&module->vsymt, i) == sym)
525 - return i + 1;
526 + /* make a string representation of the pointer to use as a hash key */
527 + sprintf(ptrbuf, "%p", sym);
528 + hash_table_iter_init(&module->ht_symaddr, &hti, ptrbuf);
529 +
530 + /* try to find the pointer in our ht */
531 + while ((ptr = hash_table_iter_up(&hti))) {
532 + idx_to_ptr = CONTAINING_RECORD(ptr, struct symt_idx_to_ptr, hash_elt);
533 + if (idx_to_ptr->sym == sym)
534 + return idx_to_ptr->idx;
535 }
536 +
537 /* not found */
538 + /* add the symbol to our symbol vector */
539 c = vector_add(&module->vsymt, &module->pool);
540 +
541 + /* add an idx to ptr mapping so we can find it again by address */
542 + if ((idx_to_ptr = pool_alloc(&module->pool, sizeof(*idx_to_ptr))))
543 + {
544 + idx_to_ptr->hash_elt.name = pool_strdup(&module->pool, ptrbuf);
545 + idx_to_ptr->sym = sym;
546 + idx_to_ptr->idx = len + 1;
547 + hash_table_add(&module->ht_symaddr, &idx_to_ptr->hash_elt);
548 + }
549 +
550 if (c) *c = sym;
551 return len + 1;
552 #else
553 @@ -74,7 +95,7 @@ DWORD symt_ptr2index(struct
554
555 struct symt* symt_index2ptr(struct module* module, DWORD id)
556 {
557 -#ifdef _WIN64
558 +#ifdef __x86_64__
559 if (!id-- || id >= vector_length(&module->vsymt)) return NULL;
560 return *(struct symt**)vector_at(&module->vsymt, id);
561 #else
562 diff -pudN e:\wine\dlls\dbghelp/version.rc e:\reactos\dll\win32\dbghelp/version.rc
563 --- e:\wine\dlls\dbghelp/version.rc 2015-11-15 19:23:04 +0100
564 +++ e:\reactos\dll\win32\dbghelp/version.rc 2012-02-23 01:07:59 +0100
565 @@ -18,9 +18,9 @@
566
567 #define WINE_FILEDESCRIPTION_STR "Wine Image Helper"
568 #define WINE_FILENAME_STR "dbghelp.dll"
569 -#define WINE_FILEVERSION 6,1,7601,17514
570 -#define WINE_FILEVERSION_STR "6.1.7601.17514"
571 -#define WINE_PRODUCTVERSION 6,1,7601,17514
572 -#define WINE_PRODUCTVERSION_STR "6.1.7601.17514"
573 +#define WINE_FILEVERSION 5,1,2600,3264
574 +#define WINE_FILEVERSION_STR "5.1.2600.3264"
575 +#define WINE_PRODUCTVERSION 5,1,2600,3264
576 +#define WINE_PRODUCTVERSION_STR "5.1.2600.3264"
577
578 #include "wine/wine_common_ver.rc"