wined3d: Remove the swapchain parameter from fb_copy_to_texture_hwstretch in order...
[wine.git] / dlls / dbghelp / symbol.c
blobe53b58396440b40eeac41b8c9a564a476a55812f
1 /*
2 * File symbol.c - management of symbols (lexical tree)
4 * Copyright (C) 1993, Eric Youngdale.
5 * 2004, Eric Pouech
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #define NONAMELESSUNION
23 #define NONAMELESSSTRUCT
25 #include "config.h"
27 #include <stdlib.h>
28 #include <stdio.h>
29 #include <string.h>
30 #include <limits.h>
31 #include <sys/types.h>
32 #include <assert.h>
33 #ifdef HAVE_REGEX_H
34 # include <regex.h>
35 #endif
37 #include "wine/debug.h"
38 #include "dbghelp_private.h"
39 #include "winnls.h"
41 WINE_DEFAULT_DEBUG_CHANNEL(dbghelp);
42 WINE_DECLARE_DEBUG_CHANNEL(dbghelp_symt);
44 static inline int cmp_addr(ULONG64 a1, ULONG64 a2)
46 if (a1 > a2) return 1;
47 if (a1 < a2) return -1;
48 return 0;
51 static inline int cmp_sorttab_addr(struct module* module, int idx, ULONG64 addr)
53 ULONG64 ref;
55 symt_get_info(module, &module->addr_sorttab[idx]->symt, TI_GET_ADDRESS, &ref);
56 return cmp_addr(ref, addr);
59 struct module* symt_cmp_addr_module = NULL;
61 int symt_cmp_addr(const void* p1, const void* p2)
63 const struct symt* sym1 = *(const struct symt* const *)p1;
64 const struct symt* sym2 = *(const struct symt* const *)p2;
65 ULONG64 a1, a2;
67 symt_get_info(symt_cmp_addr_module, sym1, TI_GET_ADDRESS, &a1);
68 symt_get_info(symt_cmp_addr_module, sym2, TI_GET_ADDRESS, &a2);
69 return cmp_addr(a1, a2);
72 DWORD symt_ptr2index(struct module* module, const struct symt* sym)
74 #ifdef _WIN64
75 const struct symt** c;
76 int len = vector_length(&module->vsymt), i;
78 /* FIXME: this is inefficient */
79 for (i = 0; i < len; i++)
81 if (*(struct symt**)vector_at(&module->vsymt, i) == sym)
82 return i + 1;
84 /* not found */
85 c = vector_add(&module->vsymt, &module->pool);
86 if (c) *c = sym;
87 return len + 1;
88 #else
89 return (DWORD)sym;
90 #endif
93 struct symt* symt_index2ptr(struct module* module, DWORD id)
95 #ifdef _WIN64
96 if (!id-- || id >= vector_length(&module->vsymt)) return NULL;
97 return *(struct symt**)vector_at(&module->vsymt, id);
98 #else
99 return (struct symt*)id;
100 #endif
103 static BOOL symt_grow_sorttab(struct module* module, unsigned sz)
105 struct symt_ht** new;
106 unsigned int size;
108 if (sz <= module->sorttab_size) return TRUE;
109 if (module->addr_sorttab)
111 size = module->sorttab_size * 2;
112 new = HeapReAlloc(GetProcessHeap(), 0, module->addr_sorttab,
113 size * sizeof(struct symt_ht*));
115 else
117 size = 64;
118 new = HeapAlloc(GetProcessHeap(), 0, size * sizeof(struct symt_ht*));
120 if (!new) return FALSE;
121 module->sorttab_size = size;
122 module->addr_sorttab = new;
123 return TRUE;
126 static void symt_add_module_ht(struct module* module, struct symt_ht* ht)
128 ULONG64 addr;
130 hash_table_add(&module->ht_symbols, &ht->hash_elt);
131 /* Don't store in sorttab a symbol without address, they are of
132 * no use here (e.g. constant values)
134 if (symt_get_info(module, &ht->symt, TI_GET_ADDRESS, &addr) &&
135 symt_grow_sorttab(module, module->num_symbols + 1))
137 module->addr_sorttab[module->num_symbols++] = ht;
138 module->sortlist_valid = FALSE;
142 #ifdef HAVE_REGEX_H
144 /* transforms a dbghelp's regular expression into a POSIX one
145 * Here are the valid dbghelp reg ex characters:
146 * * 0 or more characters
147 * ? a single character
148 * [] list
149 * # 0 or more of preceding char
150 * + 1 or more of preceding char
151 * escapes \ on #, ?, [, ], *, +. don't work on -
153 static void compile_regex(const char* str, int numchar, regex_t* re, BOOL _case)
155 char *mask, *p;
156 BOOL in_escape = FALSE;
157 unsigned flags = REG_NOSUB;
159 if (numchar == -1) numchar = strlen( str );
161 p = mask = HeapAlloc( GetProcessHeap(), 0, 2 * numchar + 3 );
162 *p++ = '^';
164 while (*str && numchar--)
166 /* FIXME: this shouldn't be valid on '-' */
167 if (in_escape)
169 *p++ = '\\';
170 *p++ = *str;
171 in_escape = FALSE;
173 else switch (*str)
175 case '\\': in_escape = TRUE; break;
176 case '*': *p++ = '.'; *p++ = '*'; break;
177 case '?': *p++ = '.'; break;
178 case '#': *p++ = '*'; break;
179 /* escape some valid characters in dbghelp reg exp:s */
180 case '$': *p++ = '\\'; *p++ = '$'; break;
181 /* +, [, ], - are the same in dbghelp & POSIX, use them as any other char */
182 default: *p++ = *str; break;
184 str++;
186 if (in_escape)
188 *p++ = '\\';
189 *p++ = '\\';
191 *p++ = '$';
192 *p = 0;
193 if (_case) flags |= REG_ICASE;
194 if (regcomp(re, mask, flags)) FIXME("Couldn't compile %s\n", mask);
195 HeapFree(GetProcessHeap(), 0, mask);
198 static BOOL compile_file_regex(regex_t* re, const char* srcfile)
200 char *mask, *p;
201 BOOL ret;
203 if (!srcfile || !*srcfile) return regcomp(re, ".*", REG_NOSUB);
205 p = mask = HeapAlloc(GetProcessHeap(), 0, 5 * strlen(srcfile) + 4);
206 *p++ = '^';
207 while (*srcfile)
209 switch (*srcfile)
211 case '\\':
212 case '/':
213 *p++ = '[';
214 *p++ = '\\';
215 *p++ = '\\';
216 *p++ = '/';
217 *p++ = ']';
218 break;
219 case '.':
220 *p++ = '\\';
221 *p++ = '.';
222 break;
223 default:
224 *p++ = *srcfile;
225 break;
227 srcfile++;
229 *p++ = '$';
230 *p = 0;
231 ret = !regcomp(re, mask, REG_NOSUB);
232 HeapFree(GetProcessHeap(), 0, mask);
233 if (!ret)
235 FIXME("Couldn't compile %s\n", mask);
236 SetLastError(ERROR_INVALID_PARAMETER);
238 return ret;
241 static int match_regexp( const regex_t *re, const char *str )
243 return !regexec( re, str, 0, NULL, 0 );
246 #else /* HAVE_REGEX_H */
248 /* if we don't have regexp support, fall back to a simple string comparison */
250 typedef struct
252 char *str;
253 BOOL icase;
254 } regex_t;
256 static void compile_regex(const char* str, int numchar, regex_t* re, BOOL _case)
258 if (numchar == -1) numchar = strlen( str );
260 re->str = HeapAlloc( GetProcessHeap(), 0, numchar + 1 );
261 memcpy( re->str, str, numchar );
262 re->str[numchar] = 0;
263 re->icase = _case;
266 static BOOL compile_file_regex(regex_t* re, const char* srcfile)
268 if (!srcfile || !*srcfile) re->str = NULL;
269 else compile_regex( srcfile, -1, re, FALSE );
270 return TRUE;
273 static int match_regexp( const regex_t *re, const char *str )
275 if (!re->str) return 1;
276 if (re->icase) return !lstrcmpiA( re->str, str );
277 return !strcmp( re->str, str );
280 static void regfree( regex_t *re )
282 HeapFree( GetProcessHeap(), 0, re->str );
285 #endif /* HAVE_REGEX_H */
287 struct symt_compiland* symt_new_compiland(struct module* module,
288 unsigned long address, unsigned src_idx)
290 struct symt_compiland* sym;
292 TRACE_(dbghelp_symt)("Adding compiland symbol %s:%s\n",
293 debugstr_w(module->module.ModuleName), source_get(module, src_idx));
294 if ((sym = pool_alloc(&module->pool, sizeof(*sym))))
296 sym->symt.tag = SymTagCompiland;
297 sym->address = address;
298 sym->source = src_idx;
299 vector_init(&sym->vchildren, sizeof(struct symt*), 32);
301 return sym;
304 struct symt_public* symt_new_public(struct module* module,
305 struct symt_compiland* compiland,
306 const char* name,
307 unsigned long address, unsigned size)
309 struct symt_public* sym;
310 struct symt** p;
312 TRACE_(dbghelp_symt)("Adding public symbol %s:%s @%lx\n",
313 debugstr_w(module->module.ModuleName), name, address);
314 if ((dbghelp_options & SYMOPT_AUTO_PUBLICS) &&
315 symt_find_nearest(module, address) != NULL)
316 return NULL;
317 if ((sym = pool_alloc(&module->pool, sizeof(*sym))))
319 sym->symt.tag = SymTagPublicSymbol;
320 sym->hash_elt.name = pool_strdup(&module->pool, name);
321 sym->container = compiland ? &compiland->symt : NULL;
322 sym->address = address;
323 sym->size = size;
324 symt_add_module_ht(module, (struct symt_ht*)sym);
325 if (compiland)
327 p = vector_add(&compiland->vchildren, &module->pool);
328 *p = &sym->symt;
331 return sym;
334 struct symt_data* symt_new_global_variable(struct module* module,
335 struct symt_compiland* compiland,
336 const char* name, unsigned is_static,
337 unsigned long addr, unsigned long size,
338 struct symt* type)
340 struct symt_data* sym;
341 struct symt** p;
342 DWORD64 tsz;
344 TRACE_(dbghelp_symt)("Adding global symbol %s:%s @%lx %p\n",
345 debugstr_w(module->module.ModuleName), name, addr, type);
346 if ((sym = pool_alloc(&module->pool, sizeof(*sym))))
348 sym->symt.tag = SymTagData;
349 sym->hash_elt.name = pool_strdup(&module->pool, name);
350 sym->kind = is_static ? DataIsFileStatic : DataIsGlobal;
351 sym->container = compiland ? &compiland->symt : NULL;
352 sym->type = type;
353 sym->u.var.offset = addr;
354 if (type && size && symt_get_info(module, type, TI_GET_LENGTH, &tsz))
356 if (tsz != size)
357 FIXME("Size mismatch for %s.%s between type (%s) and src (%lu)\n",
358 debugstr_w(module->module.ModuleName), name,
359 wine_dbgstr_longlong(tsz), size);
361 symt_add_module_ht(module, (struct symt_ht*)sym);
362 if (compiland)
364 p = vector_add(&compiland->vchildren, &module->pool);
365 *p = &sym->symt;
368 return sym;
371 struct symt_function* symt_new_function(struct module* module,
372 struct symt_compiland* compiland,
373 const char* name,
374 unsigned long addr, unsigned long size,
375 struct symt* sig_type)
377 struct symt_function* sym;
378 struct symt** p;
380 TRACE_(dbghelp_symt)("Adding global function %s:%s @%lx-%lx\n",
381 debugstr_w(module->module.ModuleName), name, addr, addr + size - 1);
383 assert(!sig_type || sig_type->tag == SymTagFunctionType);
384 if ((sym = pool_alloc(&module->pool, sizeof(*sym))))
386 sym->symt.tag = SymTagFunction;
387 sym->hash_elt.name = pool_strdup(&module->pool, name);
388 sym->container = &compiland->symt;
389 sym->address = addr;
390 sym->type = sig_type;
391 sym->size = size;
392 vector_init(&sym->vlines, sizeof(struct line_info), 64);
393 vector_init(&sym->vchildren, sizeof(struct symt*), 8);
394 symt_add_module_ht(module, (struct symt_ht*)sym);
395 if (compiland)
397 p = vector_add(&compiland->vchildren, &module->pool);
398 *p = &sym->symt;
401 return sym;
404 void symt_add_func_line(struct module* module, struct symt_function* func,
405 unsigned source_idx, int line_num, unsigned long offset)
407 struct line_info* dli;
408 BOOL last_matches = FALSE;
409 int i;
411 if (func == NULL || !(dbghelp_options & SYMOPT_LOAD_LINES)) return;
413 TRACE_(dbghelp_symt)("(%p)%s:%lx %s:%u\n",
414 func, func->hash_elt.name, offset,
415 source_get(module, source_idx), line_num);
417 assert(func->symt.tag == SymTagFunction);
419 for (i=vector_length(&func->vlines)-1; i>=0; i--)
421 dli = vector_at(&func->vlines, i);
422 if (dli->is_source_file)
424 last_matches = (source_idx == dli->u.source_file);
425 break;
429 if (!last_matches)
431 /* we shouldn't have line changes on first line of function */
432 dli = vector_add(&func->vlines, &module->pool);
433 dli->is_source_file = 1;
434 dli->is_first = dli->is_last = 0;
435 dli->line_number = 0;
436 dli->u.source_file = source_idx;
438 dli = vector_add(&func->vlines, &module->pool);
439 dli->is_source_file = 0;
440 dli->is_first = dli->is_last = 0;
441 dli->line_number = line_num;
442 dli->u.pc_offset = func->address + offset;
445 /******************************************************************
446 * symt_add_func_local
448 * Adds a new local/parameter to a given function:
449 * In any cases, dt tells whether it's a local variable or a parameter
450 * If regno it's not 0:
451 * - then variable is stored in a register
452 * - otherwise, value is referenced by register + offset
453 * Otherwise, the variable is stored on the stack:
454 * - offset is then the offset from the frame register
456 struct symt_data* symt_add_func_local(struct module* module,
457 struct symt_function* func,
458 enum DataKind dt,
459 const struct location* loc,
460 struct symt_block* block,
461 struct symt* type, const char* name)
463 struct symt_data* locsym;
464 struct symt** p;
466 TRACE_(dbghelp_symt)("Adding local symbol (%s:%s): %s %p\n",
467 debugstr_w(module->module.ModuleName), func->hash_elt.name,
468 name, type);
470 assert(func);
471 assert(func->symt.tag == SymTagFunction);
472 assert(dt == DataIsParam || dt == DataIsLocal);
474 locsym = pool_alloc(&module->pool, sizeof(*locsym));
475 locsym->symt.tag = SymTagData;
476 locsym->hash_elt.name = pool_strdup(&module->pool, name);
477 locsym->hash_elt.next = NULL;
478 locsym->kind = dt;
479 locsym->container = &block->symt;
480 locsym->type = type;
481 locsym->u.var = *loc;
482 if (block)
483 p = vector_add(&block->vchildren, &module->pool);
484 else
485 p = vector_add(&func->vchildren, &module->pool);
486 *p = &locsym->symt;
487 return locsym;
491 struct symt_block* symt_open_func_block(struct module* module,
492 struct symt_function* func,
493 struct symt_block* parent_block,
494 unsigned pc, unsigned len)
496 struct symt_block* block;
497 struct symt** p;
499 assert(func);
500 assert(func->symt.tag == SymTagFunction);
502 assert(!parent_block || parent_block->symt.tag == SymTagBlock);
503 block = pool_alloc(&module->pool, sizeof(*block));
504 block->symt.tag = SymTagBlock;
505 block->address = func->address + pc;
506 block->size = len;
507 block->container = parent_block ? &parent_block->symt : &func->symt;
508 vector_init(&block->vchildren, sizeof(struct symt*), 4);
509 if (parent_block)
510 p = vector_add(&parent_block->vchildren, &module->pool);
511 else
512 p = vector_add(&func->vchildren, &module->pool);
513 *p = &block->symt;
515 return block;
518 struct symt_block* symt_close_func_block(struct module* module,
519 const struct symt_function* func,
520 struct symt_block* block, unsigned pc)
522 assert(func);
523 assert(func->symt.tag == SymTagFunction);
525 if (pc) block->size = func->address + pc - block->address;
526 return (block->container->tag == SymTagBlock) ?
527 GET_ENTRY(block->container, struct symt_block, symt) : NULL;
530 struct symt_hierarchy_point* symt_add_function_point(struct module* module,
531 struct symt_function* func,
532 enum SymTagEnum point,
533 const struct location* loc,
534 const char* name)
536 struct symt_hierarchy_point*sym;
537 struct symt** p;
539 if ((sym = pool_alloc(&module->pool, sizeof(*sym))))
541 sym->symt.tag = point;
542 sym->parent = &func->symt;
543 sym->loc = *loc;
544 sym->hash_elt.name = name ? pool_strdup(&module->pool, name) : NULL;
545 p = vector_add(&func->vchildren, &module->pool);
546 *p = &sym->symt;
548 return sym;
551 BOOL symt_normalize_function(struct module* module, const struct symt_function* func)
553 unsigned len;
554 struct line_info* dli;
556 assert(func);
557 /* We aren't adding any more locals or line numbers to this function.
558 * Free any spare memory that we might have allocated.
560 assert(func->symt.tag == SymTagFunction);
562 /* EPP vector_pool_normalize(&func->vlines, &module->pool); */
563 /* EPP vector_pool_normalize(&func->vchildren, &module->pool); */
565 len = vector_length(&func->vlines);
566 if (len--)
568 dli = vector_at(&func->vlines, 0); dli->is_first = 1;
569 dli = vector_at(&func->vlines, len); dli->is_last = 1;
571 return TRUE;
574 struct symt_thunk* symt_new_thunk(struct module* module,
575 struct symt_compiland* compiland,
576 const char* name, THUNK_ORDINAL ord,
577 unsigned long addr, unsigned long size)
579 struct symt_thunk* sym;
581 TRACE_(dbghelp_symt)("Adding global thunk %s:%s @%lx-%lx\n",
582 debugstr_w(module->module.ModuleName), name, addr, addr + size - 1);
584 if ((sym = pool_alloc(&module->pool, sizeof(*sym))))
586 sym->symt.tag = SymTagThunk;
587 sym->hash_elt.name = pool_strdup(&module->pool, name);
588 sym->container = &compiland->symt;
589 sym->address = addr;
590 sym->size = size;
591 sym->ordinal = ord;
592 symt_add_module_ht(module, (struct symt_ht*)sym);
593 if (compiland)
595 struct symt** p;
596 p = vector_add(&compiland->vchildren, &module->pool);
597 *p = &sym->symt;
600 return sym;
603 struct symt_data* symt_new_constant(struct module* module,
604 struct symt_compiland* compiland,
605 const char* name, struct symt* type,
606 const VARIANT* v)
608 struct symt_data* sym;
610 TRACE_(dbghelp_symt)("Adding constant value %s:%s\n",
611 debugstr_w(module->module.ModuleName), name);
613 if ((sym = pool_alloc(&module->pool, sizeof(*sym))))
615 sym->symt.tag = SymTagData;
616 sym->hash_elt.name = pool_strdup(&module->pool, name);
617 sym->kind = DataIsConstant;
618 sym->container = compiland ? &compiland->symt : NULL;
619 sym->type = type;
620 sym->u.value = *v;
621 symt_add_module_ht(module, (struct symt_ht*)sym);
622 if (compiland)
624 struct symt** p;
625 p = vector_add(&compiland->vchildren, &module->pool);
626 *p = &sym->symt;
629 return sym;
632 struct symt_hierarchy_point* symt_new_label(struct module* module,
633 struct symt_compiland* compiland,
634 const char* name, unsigned long address)
636 struct symt_hierarchy_point* sym;
638 TRACE_(dbghelp_symt)("Adding global label value %s:%s\n",
639 debugstr_w(module->module.ModuleName), name);
641 if ((sym = pool_alloc(&module->pool, sizeof(*sym))))
643 sym->symt.tag = SymTagLabel;
644 sym->hash_elt.name = pool_strdup(&module->pool, name);
645 sym->loc.kind = loc_absolute;
646 sym->loc.offset = address;
647 sym->parent = compiland ? &compiland->symt : NULL;
648 symt_add_module_ht(module, (struct symt_ht*)sym);
649 if (compiland)
651 struct symt** p;
652 p = vector_add(&compiland->vchildren, &module->pool);
653 *p = &sym->symt;
656 return sym;
659 /* expect sym_info->MaxNameLen to be set before being called */
660 static void symt_fill_sym_info(struct module_pair* pair,
661 const struct symt_function* func,
662 const struct symt* sym, SYMBOL_INFO* sym_info)
664 const char* name;
665 DWORD64 size;
667 if (!symt_get_info(pair->effective, sym, TI_GET_TYPE, &sym_info->TypeIndex))
668 sym_info->TypeIndex = 0;
669 sym_info->info = symt_ptr2index(pair->effective, sym);
670 sym_info->Reserved[0] = sym_info->Reserved[1] = 0;
671 if (!symt_get_info(pair->effective, sym, TI_GET_LENGTH, &size) &&
672 (!sym_info->TypeIndex ||
673 !symt_get_info(pair->effective, symt_index2ptr(pair->effective, sym_info->TypeIndex),
674 TI_GET_LENGTH, &size)))
675 size = 0;
676 sym_info->Size = (DWORD)size;
677 sym_info->ModBase = pair->requested->module.BaseOfImage;
678 sym_info->Flags = 0;
679 sym_info->Value = 0;
681 switch (sym->tag)
683 case SymTagData:
685 const struct symt_data* data = (const struct symt_data*)sym;
686 switch (data->kind)
688 case DataIsParam:
689 sym_info->Flags |= SYMFLAG_PARAMETER;
690 /* fall through */
691 case DataIsLocal:
693 struct location loc = data->u.var;
695 if (loc.kind >= loc_user)
697 unsigned i;
698 struct module_format* modfmt;
700 for (i = 0; i < DFI_LAST; i++)
702 modfmt = pair->effective->format_info[i];
703 if (modfmt && modfmt->loc_compute)
705 modfmt->loc_compute(pair->pcs, modfmt, func, &loc);
706 break;
710 switch (loc.kind)
712 case loc_error:
713 /* for now we report error cases as a negative register number */
714 sym_info->Flags |= SYMFLAG_LOCAL;
715 /* fall through */
716 case loc_register:
717 sym_info->Flags |= SYMFLAG_REGISTER;
718 sym_info->Register = loc.reg;
719 sym_info->Address = 0;
720 break;
721 case loc_regrel:
722 sym_info->Flags |= SYMFLAG_LOCAL | SYMFLAG_REGREL;
723 /* FIXME: it's i386 dependent !!! */
724 sym_info->Register = loc.reg ? loc.reg : CV_REG_EBP;
725 sym_info->Address = loc.offset;
726 break;
727 default:
728 FIXME("Shouldn't happen (kind=%d), debug reader backend is broken\n", loc.kind);
729 assert(0);
732 break;
733 case DataIsGlobal:
734 case DataIsFileStatic:
735 symt_get_info(pair->effective, sym, TI_GET_ADDRESS, &sym_info->Address);
736 sym_info->Register = 0;
737 break;
738 case DataIsConstant:
739 sym_info->Flags |= SYMFLAG_VALUEPRESENT;
740 switch (data->u.value.n1.n2.vt)
742 case VT_I4: sym_info->Value = (ULONG)data->u.value.n1.n2.n3.lVal; break;
743 case VT_I2: sym_info->Value = (ULONG)(long)data->u.value.n1.n2.n3.iVal; break;
744 case VT_I1: sym_info->Value = (ULONG)(long)data->u.value.n1.n2.n3.cVal; break;
745 case VT_UI4: sym_info->Value = (ULONG)data->u.value.n1.n2.n3.ulVal; break;
746 case VT_UI2: sym_info->Value = (ULONG)data->u.value.n1.n2.n3.uiVal; break;
747 case VT_UI1: sym_info->Value = (ULONG)data->u.value.n1.n2.n3.bVal; break;
748 case VT_I1 | VT_BYREF: sym_info->Value = (ULONG64)(DWORD_PTR)data->u.value.n1.n2.n3.byref; break;
749 case VT_EMPTY: sym_info->Value = 0; break;
750 default:
751 FIXME("Unsupported variant type (%u)\n", data->u.value.n1.n2.vt);
752 sym_info->Value = 0;
753 break;
755 break;
756 default:
757 FIXME("Unhandled kind (%u) in sym data\n", data->kind);
760 break;
761 case SymTagPublicSymbol:
762 sym_info->Flags |= SYMFLAG_EXPORT;
763 symt_get_info(pair->effective, sym, TI_GET_ADDRESS, &sym_info->Address);
764 break;
765 case SymTagFunction:
766 sym_info->Flags |= SYMFLAG_FUNCTION;
767 symt_get_info(pair->effective, sym, TI_GET_ADDRESS, &sym_info->Address);
768 break;
769 case SymTagThunk:
770 sym_info->Flags |= SYMFLAG_THUNK;
771 symt_get_info(pair->effective, sym, TI_GET_ADDRESS, &sym_info->Address);
772 break;
773 default:
774 symt_get_info(pair->effective, sym, TI_GET_ADDRESS, &sym_info->Address);
775 sym_info->Register = 0;
776 break;
778 sym_info->Scope = 0; /* FIXME */
779 sym_info->Tag = sym->tag;
780 name = symt_get_name(sym);
781 if (sym_info->MaxNameLen)
783 if (sym->tag != SymTagPublicSymbol || !(dbghelp_options & SYMOPT_UNDNAME) ||
784 (sym_info->NameLen = UnDecorateSymbolName(name, sym_info->Name,
785 sym_info->MaxNameLen, UNDNAME_NAME_ONLY) == 0))
787 sym_info->NameLen = min(strlen(name), sym_info->MaxNameLen - 1);
788 memcpy(sym_info->Name, name, sym_info->NameLen);
789 sym_info->Name[sym_info->NameLen] = '\0';
792 TRACE_(dbghelp_symt)("%p => %s %u %s\n",
793 sym, sym_info->Name, sym_info->Size,
794 wine_dbgstr_longlong(sym_info->Address));
797 struct sym_enum
799 PSYM_ENUMERATESYMBOLS_CALLBACK cb;
800 PVOID user;
801 SYMBOL_INFO* sym_info;
802 DWORD index;
803 DWORD tag;
804 DWORD64 addr;
805 char buffer[sizeof(SYMBOL_INFO) + MAX_SYM_NAME];
808 static BOOL send_symbol(const struct sym_enum* se, struct module_pair* pair,
809 const struct symt_function* func, const struct symt* sym)
811 symt_fill_sym_info(pair, func, sym, se->sym_info);
812 if (se->index && se->sym_info->info != se->index) return FALSE;
813 if (se->tag && se->sym_info->Tag != se->tag) return FALSE;
814 if (se->addr && !(se->addr >= se->sym_info->Address && se->addr < se->sym_info->Address + se->sym_info->Size)) return FALSE;
815 return !se->cb(se->sym_info, se->sym_info->Size, se->user);
818 static BOOL symt_enum_module(struct module_pair* pair, const regex_t* regex,
819 const struct sym_enum* se)
821 void* ptr;
822 struct symt_ht* sym = NULL;
823 struct hash_table_iter hti;
825 hash_table_iter_init(&pair->effective->ht_symbols, &hti, NULL);
826 while ((ptr = hash_table_iter_up(&hti)))
828 sym = GET_ENTRY(ptr, struct symt_ht, hash_elt);
829 if (sym->hash_elt.name && match_regexp(regex, sym->hash_elt.name))
831 se->sym_info->SizeOfStruct = sizeof(SYMBOL_INFO);
832 se->sym_info->MaxNameLen = sizeof(se->buffer) - sizeof(SYMBOL_INFO);
833 if (send_symbol(se, pair, NULL, &sym->symt)) return TRUE;
836 return FALSE;
839 static inline unsigned where_to_insert(struct module* module, unsigned high, const struct symt_ht* elt)
841 unsigned low = 0, mid = high / 2;
842 ULONG64 addr;
844 if (!high) return 0;
845 symt_get_info(module, &elt->symt, TI_GET_ADDRESS, &addr);
848 switch (cmp_sorttab_addr(module, mid, addr))
850 case 0: return mid;
851 case -1: low = mid + 1; break;
852 case 1: high = mid; break;
854 mid = low + (high - low) / 2;
855 } while (low < high);
856 return mid;
859 /***********************************************************************
860 * resort_symbols
862 * Rebuild sorted list of symbols for a module.
864 static BOOL resort_symbols(struct module* module)
866 if (!(module->module.NumSyms = module->num_symbols))
867 return FALSE;
869 /* FIXME: what's the optimal value here ??? */
870 if (module->num_sorttab && module->num_symbols <= module->num_sorttab + 30)
872 int i, delta, ins_idx = module->num_sorttab, prev_ins_idx;
873 struct symt_ht* tmp[30];
875 delta = module->num_symbols - module->num_sorttab;
876 memcpy(tmp, &module->addr_sorttab[module->num_sorttab], delta * sizeof(struct symt_ht*));
877 symt_cmp_addr_module = module;
878 qsort(tmp, delta, sizeof(struct symt_ht*), symt_cmp_addr);
880 for (i = delta - 1; i >= 0; i--)
882 prev_ins_idx = ins_idx;
883 ins_idx = where_to_insert(module, prev_ins_idx = ins_idx, tmp[i]);
884 memmove(&module->addr_sorttab[ins_idx + i + 1],
885 &module->addr_sorttab[ins_idx],
886 (prev_ins_idx - ins_idx) * sizeof(struct symt_ht*));
887 module->addr_sorttab[ins_idx + i] = tmp[i];
890 else
892 symt_cmp_addr_module = module;
893 qsort(module->addr_sorttab, module->num_symbols, sizeof(struct symt_ht*), symt_cmp_addr);
895 module->num_sorttab = module->num_symbols;
896 return module->sortlist_valid = TRUE;
899 static void symt_get_length(struct module* module, const struct symt* symt, ULONG64* size)
901 DWORD type_index;
903 if (symt_get_info(module, symt, TI_GET_LENGTH, size) && *size)
904 return;
906 if (symt_get_info(module, symt, TI_GET_TYPE, &type_index) &&
907 symt_get_info(module, symt_index2ptr(module, type_index), TI_GET_LENGTH, size)) return;
908 *size = 0x1000; /* arbitrary value */
911 /* assume addr is in module */
912 struct symt_ht* symt_find_nearest(struct module* module, DWORD_PTR addr)
914 int mid, high, low;
915 ULONG64 ref_addr, ref_size;
917 if (!module->sortlist_valid || !module->addr_sorttab)
919 if (!resort_symbols(module)) return NULL;
923 * Binary search to find closest symbol.
925 low = 0;
926 high = module->num_sorttab;
928 symt_get_info(module, &module->addr_sorttab[0]->symt, TI_GET_ADDRESS, &ref_addr);
929 if (addr < ref_addr) return NULL;
930 if (high)
932 symt_get_info(module, &module->addr_sorttab[high - 1]->symt, TI_GET_ADDRESS, &ref_addr);
933 symt_get_length(module, &module->addr_sorttab[high - 1]->symt, &ref_size);
934 if (addr >= ref_addr + ref_size) return NULL;
937 while (high > low + 1)
939 mid = (high + low) / 2;
940 if (cmp_sorttab_addr(module, mid, addr) < 0)
941 low = mid;
942 else
943 high = mid;
945 if (low != high && high != module->num_sorttab &&
946 cmp_sorttab_addr(module, high, addr) <= 0)
947 low = high;
949 /* If found symbol is a public symbol, check if there are any other entries that
950 * might also have the same address, but would get better information
952 if (module->addr_sorttab[low]->symt.tag == SymTagPublicSymbol)
954 symt_get_info(module, &module->addr_sorttab[low]->symt, TI_GET_ADDRESS, &ref_addr);
955 if (low > 0 &&
956 module->addr_sorttab[low - 1]->symt.tag != SymTagPublicSymbol &&
957 !cmp_sorttab_addr(module, low - 1, ref_addr))
958 low--;
959 else if (low < module->num_sorttab - 1 &&
960 module->addr_sorttab[low + 1]->symt.tag != SymTagPublicSymbol &&
961 !cmp_sorttab_addr(module, low + 1, ref_addr))
962 low++;
964 /* finally check that we fit into the found symbol */
965 symt_get_info(module, &module->addr_sorttab[low]->symt, TI_GET_ADDRESS, &ref_addr);
966 if (addr < ref_addr) return NULL;
967 symt_get_length(module, &module->addr_sorttab[low]->symt, &ref_size);
968 if (addr >= ref_addr + ref_size) return NULL;
970 return module->addr_sorttab[low];
973 static BOOL symt_enum_locals_helper(struct module_pair* pair,
974 regex_t* preg, const struct sym_enum* se,
975 struct symt_function* func, const struct vector* v)
977 struct symt* lsym = NULL;
978 DWORD pc = pair->pcs->ctx_frame.InstructionOffset;
979 unsigned int i;
981 for (i=0; i<vector_length(v); i++)
983 lsym = *(struct symt**)vector_at(v, i);
984 switch (lsym->tag)
986 case SymTagBlock:
988 struct symt_block* block = (struct symt_block*)lsym;
989 if (pc < block->address || block->address + block->size <= pc)
990 continue;
991 if (!symt_enum_locals_helper(pair, preg, se, func, &block->vchildren))
992 return FALSE;
994 break;
995 case SymTagData:
996 if (match_regexp(preg, symt_get_name(lsym)))
998 if (send_symbol(se, pair, func, lsym)) return FALSE;
1000 break;
1001 case SymTagLabel:
1002 case SymTagFuncDebugStart:
1003 case SymTagFuncDebugEnd:
1004 case SymTagCustom:
1005 break;
1006 default:
1007 FIXME("Unknown type: %u (%x)\n", lsym->tag, lsym->tag);
1008 assert(0);
1011 return TRUE;
1014 static BOOL symt_enum_locals(struct process* pcs, const char* mask,
1015 const struct sym_enum* se)
1017 struct module_pair pair;
1018 struct symt_ht* sym;
1019 DWORD_PTR pc = pcs->ctx_frame.InstructionOffset;
1021 se->sym_info->SizeOfStruct = sizeof(*se->sym_info);
1022 se->sym_info->MaxNameLen = sizeof(se->buffer) - sizeof(SYMBOL_INFO);
1024 pair.pcs = pcs;
1025 pair.requested = module_find_by_addr(pair.pcs, pc, DMT_UNKNOWN);
1026 if (!module_get_debug(&pair)) return FALSE;
1027 if ((sym = symt_find_nearest(pair.effective, pc)) == NULL) return FALSE;
1029 if (sym->symt.tag == SymTagFunction)
1031 BOOL ret;
1032 regex_t preg;
1034 compile_regex(mask ? mask : "*", -1, &preg,
1035 dbghelp_options & SYMOPT_CASE_INSENSITIVE);
1036 ret = symt_enum_locals_helper(&pair, &preg, se, (struct symt_function*)sym,
1037 &((struct symt_function*)sym)->vchildren);
1038 regfree(&preg);
1039 return ret;
1042 return send_symbol(se, &pair, NULL, &sym->symt);
1045 /******************************************************************
1046 * copy_symbolW
1048 * Helper for transforming an ANSI symbol info into a UNICODE one.
1049 * Assume that MaxNameLen is the same for both version (A & W).
1051 void copy_symbolW(SYMBOL_INFOW* siw, const SYMBOL_INFO* si)
1053 siw->SizeOfStruct = si->SizeOfStruct;
1054 siw->TypeIndex = si->TypeIndex;
1055 siw->Reserved[0] = si->Reserved[0];
1056 siw->Reserved[1] = si->Reserved[1];
1057 siw->Index = si->info; /* FIXME: see dbghelp.h */
1058 siw->Size = si->Size;
1059 siw->ModBase = si->ModBase;
1060 siw->Flags = si->Flags;
1061 siw->Value = si->Value;
1062 siw->Address = si->Address;
1063 siw->Register = si->Register;
1064 siw->Scope = si->Scope;
1065 siw->Tag = si->Tag;
1066 siw->NameLen = si->NameLen;
1067 siw->MaxNameLen = si->MaxNameLen;
1068 MultiByteToWideChar(CP_ACP, 0, si->Name, -1, siw->Name, siw->MaxNameLen);
1071 /******************************************************************
1072 * sym_enum
1074 * Core routine for most of the enumeration of symbols
1076 static BOOL sym_enum(HANDLE hProcess, ULONG64 BaseOfDll, PCSTR Mask,
1077 const struct sym_enum* se)
1079 struct module_pair pair;
1080 const char* bang;
1081 regex_t mod_regex, sym_regex;
1083 pair.pcs = process_find_by_handle(hProcess);
1084 if (!pair.pcs) return FALSE;
1085 if (BaseOfDll == 0)
1087 /* do local variables ? */
1088 if (!Mask || !(bang = strchr(Mask, '!')))
1089 return symt_enum_locals(pair.pcs, Mask, se);
1091 if (bang == Mask) return FALSE;
1093 compile_regex(Mask, bang - Mask, &mod_regex, TRUE);
1094 compile_regex(bang + 1, -1, &sym_regex,
1095 dbghelp_options & SYMOPT_CASE_INSENSITIVE);
1097 for (pair.requested = pair.pcs->lmodules; pair.requested; pair.requested = pair.requested->next)
1099 if (pair.requested->type == DMT_PE && module_get_debug(&pair))
1101 if (match_regexp(&mod_regex, pair.requested->module_name) &&
1102 symt_enum_module(&pair, &sym_regex, se))
1103 break;
1106 /* not found in PE modules, retry on the ELF ones
1108 if (!pair.requested && (dbghelp_options & SYMOPT_WINE_WITH_NATIVE_MODULES))
1110 for (pair.requested = pair.pcs->lmodules; pair.requested; pair.requested = pair.requested->next)
1112 if ((pair.requested->type == DMT_ELF || pair.requested->type == DMT_MACHO) &&
1113 !module_get_containee(pair.pcs, pair.requested) &&
1114 module_get_debug(&pair))
1116 if (match_regexp(&mod_regex, pair.requested->module_name) &&
1117 symt_enum_module(&pair, &sym_regex, se))
1118 break;
1122 regfree(&mod_regex);
1123 regfree(&sym_regex);
1124 return TRUE;
1126 pair.requested = module_find_by_addr(pair.pcs, BaseOfDll, DMT_UNKNOWN);
1127 if (!module_get_debug(&pair))
1128 return FALSE;
1130 /* we always ignore module name from Mask when BaseOfDll is defined */
1131 if (Mask && (bang = strchr(Mask, '!')))
1133 if (bang == Mask) return FALSE;
1134 Mask = bang + 1;
1137 compile_regex(Mask ? Mask : "*", -1, &sym_regex,
1138 dbghelp_options & SYMOPT_CASE_INSENSITIVE);
1139 symt_enum_module(&pair, &sym_regex, se);
1140 regfree(&sym_regex);
1142 return TRUE;
1145 /******************************************************************
1146 * SymEnumSymbols (DBGHELP.@)
1148 * cases BaseOfDll = 0
1149 * !foo fails always (despite what MSDN states)
1150 * RE1!RE2 looks up all modules matching RE1, and in all these modules, lookup RE2
1151 * no ! in Mask, lookup in local Context
1152 * cases BaseOfDll != 0
1153 * !foo fails always (despite what MSDN states)
1154 * RE1!RE2 gets RE2 from BaseOfDll (whatever RE1 is)
1156 BOOL WINAPI SymEnumSymbols(HANDLE hProcess, ULONG64 BaseOfDll, PCSTR Mask,
1157 PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback,
1158 PVOID UserContext)
1160 struct sym_enum se;
1162 TRACE("(%p %s %s %p %p)\n",
1163 hProcess, wine_dbgstr_longlong(BaseOfDll), debugstr_a(Mask),
1164 EnumSymbolsCallback, UserContext);
1166 se.cb = EnumSymbolsCallback;
1167 se.user = UserContext;
1168 se.index = 0;
1169 se.tag = 0;
1170 se.addr = 0;
1171 se.sym_info = (PSYMBOL_INFO)se.buffer;
1173 return sym_enum(hProcess, BaseOfDll, Mask, &se);
1176 struct sym_enumW
1178 PSYM_ENUMERATESYMBOLS_CALLBACKW cb;
1179 void* ctx;
1180 PSYMBOL_INFOW sym_info;
1181 char buffer[sizeof(SYMBOL_INFOW) + MAX_SYM_NAME];
1185 static BOOL CALLBACK sym_enumW(PSYMBOL_INFO si, ULONG size, PVOID ctx)
1187 struct sym_enumW* sew = ctx;
1189 copy_symbolW(sew->sym_info, si);
1191 return (sew->cb)(sew->sym_info, size, sew->ctx);
1194 /******************************************************************
1195 * SymEnumSymbolsW (DBGHELP.@)
1198 BOOL WINAPI SymEnumSymbolsW(HANDLE hProcess, ULONG64 BaseOfDll, PCWSTR Mask,
1199 PSYM_ENUMERATESYMBOLS_CALLBACKW EnumSymbolsCallback,
1200 PVOID UserContext)
1202 struct sym_enumW sew;
1203 BOOL ret = FALSE;
1204 char* maskA = NULL;
1206 sew.ctx = UserContext;
1207 sew.cb = EnumSymbolsCallback;
1208 sew.sym_info = (PSYMBOL_INFOW)sew.buffer;
1210 if (Mask)
1212 unsigned len = WideCharToMultiByte(CP_ACP, 0, Mask, -1, NULL, 0, NULL, NULL);
1213 maskA = HeapAlloc(GetProcessHeap(), 0, len);
1214 if (!maskA) return FALSE;
1215 WideCharToMultiByte(CP_ACP, 0, Mask, -1, maskA, len, NULL, NULL);
1217 ret = SymEnumSymbols(hProcess, BaseOfDll, maskA, sym_enumW, &sew);
1218 HeapFree(GetProcessHeap(), 0, maskA);
1220 return ret;
1223 struct sym_enumerate
1225 void* ctx;
1226 PSYM_ENUMSYMBOLS_CALLBACK cb;
1229 static BOOL CALLBACK sym_enumerate_cb(PSYMBOL_INFO syminfo, ULONG size, void* ctx)
1231 struct sym_enumerate* se = ctx;
1232 return (se->cb)(syminfo->Name, syminfo->Address, syminfo->Size, se->ctx);
1235 /***********************************************************************
1236 * SymEnumerateSymbols (DBGHELP.@)
1238 BOOL WINAPI SymEnumerateSymbols(HANDLE hProcess, DWORD BaseOfDll,
1239 PSYM_ENUMSYMBOLS_CALLBACK EnumSymbolsCallback,
1240 PVOID UserContext)
1242 struct sym_enumerate se;
1244 se.ctx = UserContext;
1245 se.cb = EnumSymbolsCallback;
1247 return SymEnumSymbols(hProcess, BaseOfDll, NULL, sym_enumerate_cb, &se);
1250 struct sym_enumerate64
1252 void* ctx;
1253 PSYM_ENUMSYMBOLS_CALLBACK64 cb;
1256 static BOOL CALLBACK sym_enumerate_cb64(PSYMBOL_INFO syminfo, ULONG size, void* ctx)
1258 struct sym_enumerate64* se = ctx;
1259 return (se->cb)(syminfo->Name, syminfo->Address, syminfo->Size, se->ctx);
1262 /***********************************************************************
1263 * SymEnumerateSymbols64 (DBGHELP.@)
1265 BOOL WINAPI SymEnumerateSymbols64(HANDLE hProcess, DWORD64 BaseOfDll,
1266 PSYM_ENUMSYMBOLS_CALLBACK64 EnumSymbolsCallback,
1267 PVOID UserContext)
1269 struct sym_enumerate64 se;
1271 se.ctx = UserContext;
1272 se.cb = EnumSymbolsCallback;
1274 return SymEnumSymbols(hProcess, BaseOfDll, NULL, sym_enumerate_cb64, &se);
1277 /******************************************************************
1278 * SymFromAddr (DBGHELP.@)
1281 BOOL WINAPI SymFromAddr(HANDLE hProcess, DWORD64 Address,
1282 DWORD64* Displacement, PSYMBOL_INFO Symbol)
1284 struct module_pair pair;
1285 struct symt_ht* sym;
1287 pair.pcs = process_find_by_handle(hProcess);
1288 if (!pair.pcs) return FALSE;
1289 pair.requested = module_find_by_addr(pair.pcs, Address, DMT_UNKNOWN);
1290 if (!module_get_debug(&pair)) return FALSE;
1291 if ((sym = symt_find_nearest(pair.effective, Address)) == NULL) return FALSE;
1293 symt_fill_sym_info(&pair, NULL, &sym->symt, Symbol);
1294 *Displacement = Address - Symbol->Address;
1295 return TRUE;
1298 /******************************************************************
1299 * SymFromAddrW (DBGHELP.@)
1302 BOOL WINAPI SymFromAddrW(HANDLE hProcess, DWORD64 Address,
1303 DWORD64* Displacement, PSYMBOL_INFOW Symbol)
1305 PSYMBOL_INFO si;
1306 unsigned len;
1307 BOOL ret;
1309 len = sizeof(*si) + Symbol->MaxNameLen * sizeof(WCHAR);
1310 si = HeapAlloc(GetProcessHeap(), 0, len);
1311 if (!si) return FALSE;
1313 si->SizeOfStruct = sizeof(*si);
1314 si->MaxNameLen = Symbol->MaxNameLen;
1315 if ((ret = SymFromAddr(hProcess, Address, Displacement, si)))
1317 copy_symbolW(Symbol, si);
1319 HeapFree(GetProcessHeap(), 0, si);
1320 return ret;
1323 /******************************************************************
1324 * SymGetSymFromAddr (DBGHELP.@)
1327 BOOL WINAPI SymGetSymFromAddr(HANDLE hProcess, DWORD Address,
1328 PDWORD Displacement, PIMAGEHLP_SYMBOL Symbol)
1330 char buffer[sizeof(SYMBOL_INFO) + MAX_SYM_NAME];
1331 SYMBOL_INFO*si = (SYMBOL_INFO*)buffer;
1332 size_t len;
1333 DWORD64 Displacement64;
1335 if (Symbol->SizeOfStruct < sizeof(*Symbol)) return FALSE;
1336 si->SizeOfStruct = sizeof(*si);
1337 si->MaxNameLen = MAX_SYM_NAME;
1338 if (!SymFromAddr(hProcess, Address, &Displacement64, si))
1339 return FALSE;
1341 if (Displacement)
1342 *Displacement = Displacement64;
1343 Symbol->Address = si->Address;
1344 Symbol->Size = si->Size;
1345 Symbol->Flags = si->Flags;
1346 len = min(Symbol->MaxNameLength, si->MaxNameLen);
1347 lstrcpynA(Symbol->Name, si->Name, len);
1348 return TRUE;
1351 /******************************************************************
1352 * SymGetSymFromAddr64 (DBGHELP.@)
1355 BOOL WINAPI SymGetSymFromAddr64(HANDLE hProcess, DWORD64 Address,
1356 PDWORD64 Displacement, PIMAGEHLP_SYMBOL64 Symbol)
1358 char buffer[sizeof(SYMBOL_INFO) + MAX_SYM_NAME];
1359 SYMBOL_INFO*si = (SYMBOL_INFO*)buffer;
1360 size_t len;
1361 DWORD64 Displacement64;
1363 if (Symbol->SizeOfStruct < sizeof(*Symbol)) return FALSE;
1364 si->SizeOfStruct = sizeof(*si);
1365 si->MaxNameLen = MAX_SYM_NAME;
1366 if (!SymFromAddr(hProcess, Address, &Displacement64, si))
1367 return FALSE;
1369 if (Displacement)
1370 *Displacement = Displacement64;
1371 Symbol->Address = si->Address;
1372 Symbol->Size = si->Size;
1373 Symbol->Flags = si->Flags;
1374 len = min(Symbol->MaxNameLength, si->MaxNameLen);
1375 lstrcpynA(Symbol->Name, si->Name, len);
1376 return TRUE;
1379 static BOOL find_name(struct process* pcs, struct module* module, const char* name,
1380 SYMBOL_INFO* symbol)
1382 struct hash_table_iter hti;
1383 void* ptr;
1384 struct symt_ht* sym = NULL;
1385 struct module_pair pair;
1387 pair.pcs = pcs;
1388 if (!(pair.requested = module)) return FALSE;
1389 if (!module_get_debug(&pair)) return FALSE;
1391 hash_table_iter_init(&pair.effective->ht_symbols, &hti, name);
1392 while ((ptr = hash_table_iter_up(&hti)))
1394 sym = GET_ENTRY(ptr, struct symt_ht, hash_elt);
1396 if (!strcmp(sym->hash_elt.name, name))
1398 symt_fill_sym_info(&pair, NULL, &sym->symt, symbol);
1399 return TRUE;
1402 return FALSE;
1405 /******************************************************************
1406 * SymFromName (DBGHELP.@)
1409 BOOL WINAPI SymFromName(HANDLE hProcess, PCSTR Name, PSYMBOL_INFO Symbol)
1411 struct process* pcs = process_find_by_handle(hProcess);
1412 struct module* module;
1413 const char* name;
1415 TRACE("(%p, %s, %p)\n", hProcess, Name, Symbol);
1416 if (!pcs) return FALSE;
1417 if (Symbol->SizeOfStruct < sizeof(*Symbol)) return FALSE;
1418 name = strchr(Name, '!');
1419 if (name)
1421 char tmp[128];
1422 assert(name - Name < sizeof(tmp));
1423 memcpy(tmp, Name, name - Name);
1424 tmp[name - Name] = '\0';
1425 module = module_find_by_nameA(pcs, tmp);
1426 return find_name(pcs, module, name + 1, Symbol);
1428 for (module = pcs->lmodules; module; module = module->next)
1430 if (module->type == DMT_PE && find_name(pcs, module, Name, Symbol))
1431 return TRUE;
1433 /* not found in PE modules, retry on the ELF ones
1435 if (dbghelp_options & SYMOPT_WINE_WITH_NATIVE_MODULES)
1437 for (module = pcs->lmodules; module; module = module->next)
1439 if ((module->type == DMT_ELF || module->type == DMT_MACHO) &&
1440 !module_get_containee(pcs, module) &&
1441 find_name(pcs, module, Name, Symbol))
1442 return TRUE;
1445 return FALSE;
1448 /***********************************************************************
1449 * SymGetSymFromName64 (DBGHELP.@)
1451 BOOL WINAPI SymGetSymFromName64(HANDLE hProcess, PCSTR Name, PIMAGEHLP_SYMBOL64 Symbol)
1453 char buffer[sizeof(SYMBOL_INFO) + MAX_SYM_NAME];
1454 SYMBOL_INFO*si = (SYMBOL_INFO*)buffer;
1455 size_t len;
1457 if (Symbol->SizeOfStruct < sizeof(*Symbol)) return FALSE;
1458 si->SizeOfStruct = sizeof(*si);
1459 si->MaxNameLen = MAX_SYM_NAME;
1460 if (!SymFromName(hProcess, Name, si)) return FALSE;
1462 Symbol->Address = si->Address;
1463 Symbol->Size = si->Size;
1464 Symbol->Flags = si->Flags;
1465 len = min(Symbol->MaxNameLength, si->MaxNameLen);
1466 lstrcpynA(Symbol->Name, si->Name, len);
1467 return TRUE;
1470 /***********************************************************************
1471 * SymGetSymFromName (DBGHELP.@)
1473 BOOL WINAPI SymGetSymFromName(HANDLE hProcess, PCSTR Name, PIMAGEHLP_SYMBOL Symbol)
1475 char buffer[sizeof(SYMBOL_INFO) + MAX_SYM_NAME];
1476 SYMBOL_INFO*si = (SYMBOL_INFO*)buffer;
1477 size_t len;
1479 if (Symbol->SizeOfStruct < sizeof(*Symbol)) return FALSE;
1480 si->SizeOfStruct = sizeof(*si);
1481 si->MaxNameLen = MAX_SYM_NAME;
1482 if (!SymFromName(hProcess, Name, si)) return FALSE;
1484 Symbol->Address = si->Address;
1485 Symbol->Size = si->Size;
1486 Symbol->Flags = si->Flags;
1487 len = min(Symbol->MaxNameLength, si->MaxNameLen);
1488 lstrcpynA(Symbol->Name, si->Name, len);
1489 return TRUE;
1492 /******************************************************************
1493 * sym_fill_func_line_info
1495 * fills information about a file
1497 BOOL symt_fill_func_line_info(const struct module* module, const struct symt_function* func,
1498 DWORD64 addr, IMAGEHLP_LINE64* line)
1500 struct line_info* dli = NULL;
1501 BOOL found = FALSE;
1502 int i;
1504 assert(func->symt.tag == SymTagFunction);
1506 for (i=vector_length(&func->vlines)-1; i>=0; i--)
1508 dli = vector_at(&func->vlines, i);
1509 if (!dli->is_source_file)
1511 if (found || dli->u.pc_offset > addr) continue;
1512 line->LineNumber = dli->line_number;
1513 line->Address = dli->u.pc_offset;
1514 line->Key = dli;
1515 found = TRUE;
1516 continue;
1518 if (found)
1520 line->FileName = (char*)source_get(module, dli->u.source_file);
1521 return TRUE;
1524 return FALSE;
1527 /***********************************************************************
1528 * SymGetSymNext64 (DBGHELP.@)
1530 BOOL WINAPI SymGetSymNext64(HANDLE hProcess, PIMAGEHLP_SYMBOL64 Symbol)
1532 /* algo:
1533 * get module from Symbol.Address
1534 * get index in module.addr_sorttab of Symbol.Address
1535 * increment index
1536 * if out of module bounds, move to next module in process address space
1538 FIXME("(%p, %p): stub\n", hProcess, Symbol);
1539 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1540 return FALSE;
1543 /***********************************************************************
1544 * SymGetSymNext (DBGHELP.@)
1546 BOOL WINAPI SymGetSymNext(HANDLE hProcess, PIMAGEHLP_SYMBOL Symbol)
1548 FIXME("(%p, %p): stub\n", hProcess, Symbol);
1549 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1550 return FALSE;
1553 /***********************************************************************
1554 * SymGetSymPrev64 (DBGHELP.@)
1556 BOOL WINAPI SymGetSymPrev64(HANDLE hProcess, PIMAGEHLP_SYMBOL64 Symbol)
1558 FIXME("(%p, %p): stub\n", hProcess, Symbol);
1559 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1560 return FALSE;
1563 /***********************************************************************
1564 * SymGetSymPrev (DBGHELP.@)
1566 BOOL WINAPI SymGetSymPrev(HANDLE hProcess, PIMAGEHLP_SYMBOL Symbol)
1568 FIXME("(%p, %p): stub\n", hProcess, Symbol);
1569 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1570 return FALSE;
1573 /******************************************************************
1574 * copy_line_64_from_32 (internal)
1577 static void copy_line_64_from_32(IMAGEHLP_LINE64* l64, const IMAGEHLP_LINE* l32)
1580 l64->Key = l32->Key;
1581 l64->LineNumber = l32->LineNumber;
1582 l64->FileName = l32->FileName;
1583 l64->Address = l32->Address;
1586 /******************************************************************
1587 * copy_line_W64_from_32 (internal)
1590 static void copy_line_W64_from_64(struct process* pcs, IMAGEHLP_LINEW64* l64w, const IMAGEHLP_LINE64* l64)
1592 unsigned len;
1594 l64w->Key = l64->Key;
1595 l64w->LineNumber = l64->LineNumber;
1596 len = MultiByteToWideChar(CP_ACP, 0, l64->FileName, -1, NULL, 0);
1597 if ((l64w->FileName = fetch_buffer(pcs, len * sizeof(WCHAR))))
1598 MultiByteToWideChar(CP_ACP, 0, l64->FileName, -1, l64w->FileName, len);
1599 l64w->Address = l64->Address;
1602 /******************************************************************
1603 * copy_line_32_from_64 (internal)
1606 static void copy_line_32_from_64(IMAGEHLP_LINE* l32, const IMAGEHLP_LINE64* l64)
1609 l32->Key = l64->Key;
1610 l32->LineNumber = l64->LineNumber;
1611 l32->FileName = l64->FileName;
1612 l32->Address = l64->Address;
1615 /******************************************************************
1616 * SymGetLineFromAddr (DBGHELP.@)
1619 BOOL WINAPI SymGetLineFromAddr(HANDLE hProcess, DWORD dwAddr,
1620 PDWORD pdwDisplacement, PIMAGEHLP_LINE Line)
1622 IMAGEHLP_LINE64 il64;
1624 il64.SizeOfStruct = sizeof(il64);
1625 if (!SymGetLineFromAddr64(hProcess, dwAddr, pdwDisplacement, &il64))
1626 return FALSE;
1627 copy_line_32_from_64(Line, &il64);
1628 return TRUE;
1631 /******************************************************************
1632 * SymGetLineFromAddr64 (DBGHELP.@)
1635 BOOL WINAPI SymGetLineFromAddr64(HANDLE hProcess, DWORD64 dwAddr,
1636 PDWORD pdwDisplacement, PIMAGEHLP_LINE64 Line)
1638 struct module_pair pair;
1639 struct symt_ht* symt;
1641 TRACE("%p %s %p %p\n", hProcess, wine_dbgstr_longlong(dwAddr), pdwDisplacement, Line);
1643 if (Line->SizeOfStruct < sizeof(*Line)) return FALSE;
1645 pair.pcs = process_find_by_handle(hProcess);
1646 if (!pair.pcs) return FALSE;
1647 pair.requested = module_find_by_addr(pair.pcs, dwAddr, DMT_UNKNOWN);
1648 if (!module_get_debug(&pair)) return FALSE;
1649 if ((symt = symt_find_nearest(pair.effective, dwAddr)) == NULL) return FALSE;
1651 if (symt->symt.tag != SymTagFunction) return FALSE;
1652 if (!symt_fill_func_line_info(pair.effective, (struct symt_function*)symt,
1653 dwAddr, Line)) return FALSE;
1654 *pdwDisplacement = dwAddr - Line->Address;
1655 return TRUE;
1658 /******************************************************************
1659 * SymGetLineFromAddrW64 (DBGHELP.@)
1662 BOOL WINAPI SymGetLineFromAddrW64(HANDLE hProcess, DWORD64 dwAddr,
1663 PDWORD pdwDisplacement, PIMAGEHLP_LINEW64 Line)
1665 IMAGEHLP_LINE64 il64;
1667 il64.SizeOfStruct = sizeof(il64);
1668 if (!SymGetLineFromAddr64(hProcess, dwAddr, pdwDisplacement, &il64))
1669 return FALSE;
1670 copy_line_W64_from_64(process_find_by_handle(hProcess), Line, &il64);
1671 return TRUE;
1674 /******************************************************************
1675 * SymGetLinePrev64 (DBGHELP.@)
1678 BOOL WINAPI SymGetLinePrev64(HANDLE hProcess, PIMAGEHLP_LINE64 Line)
1680 struct module_pair pair;
1681 struct line_info* li;
1682 BOOL in_search = FALSE;
1684 TRACE("(%p %p)\n", hProcess, Line);
1686 if (Line->SizeOfStruct < sizeof(*Line)) return FALSE;
1688 pair.pcs = process_find_by_handle(hProcess);
1689 if (!pair.pcs) return FALSE;
1690 pair.requested = module_find_by_addr(pair.pcs, Line->Address, DMT_UNKNOWN);
1691 if (!module_get_debug(&pair)) return FALSE;
1693 if (Line->Key == 0) return FALSE;
1694 li = Line->Key;
1695 /* things are a bit complicated because when we encounter a DLIT_SOURCEFILE
1696 * element we have to go back until we find the prev one to get the real
1697 * source file name for the DLIT_OFFSET element just before
1698 * the first DLIT_SOURCEFILE
1700 while (!li->is_first)
1702 li--;
1703 if (!li->is_source_file)
1705 Line->LineNumber = li->line_number;
1706 Line->Address = li->u.pc_offset;
1707 Line->Key = li;
1708 if (!in_search) return TRUE;
1710 else
1712 if (in_search)
1714 Line->FileName = (char*)source_get(pair.effective, li->u.source_file);
1715 return TRUE;
1717 in_search = TRUE;
1720 SetLastError(ERROR_NO_MORE_ITEMS); /* FIXME */
1721 return FALSE;
1724 /******************************************************************
1725 * SymGetLinePrev (DBGHELP.@)
1728 BOOL WINAPI SymGetLinePrev(HANDLE hProcess, PIMAGEHLP_LINE Line)
1730 IMAGEHLP_LINE64 line64;
1732 line64.SizeOfStruct = sizeof(line64);
1733 copy_line_64_from_32(&line64, Line);
1734 if (!SymGetLinePrev64(hProcess, &line64)) return FALSE;
1735 copy_line_32_from_64(Line, &line64);
1736 return TRUE;
1739 BOOL symt_get_func_line_next(const struct module* module, PIMAGEHLP_LINE64 line)
1741 struct line_info* li;
1743 if (line->Key == 0) return FALSE;
1744 li = line->Key;
1745 while (!li->is_last)
1747 li++;
1748 if (!li->is_source_file)
1750 line->LineNumber = li->line_number;
1751 line->Address = li->u.pc_offset;
1752 line->Key = li;
1753 return TRUE;
1755 line->FileName = (char*)source_get(module, li->u.source_file);
1757 return FALSE;
1760 /******************************************************************
1761 * SymGetLineNext64 (DBGHELP.@)
1764 BOOL WINAPI SymGetLineNext64(HANDLE hProcess, PIMAGEHLP_LINE64 Line)
1766 struct module_pair pair;
1768 TRACE("(%p %p)\n", hProcess, Line);
1770 if (Line->SizeOfStruct < sizeof(*Line)) return FALSE;
1771 pair.pcs = process_find_by_handle(hProcess);
1772 if (!pair.pcs) return FALSE;
1773 pair.requested = module_find_by_addr(pair.pcs, Line->Address, DMT_UNKNOWN);
1774 if (!module_get_debug(&pair)) return FALSE;
1776 if (symt_get_func_line_next(pair.effective, Line)) return TRUE;
1777 SetLastError(ERROR_NO_MORE_ITEMS); /* FIXME */
1778 return FALSE;
1781 /******************************************************************
1782 * SymGetLineNext (DBGHELP.@)
1785 BOOL WINAPI SymGetLineNext(HANDLE hProcess, PIMAGEHLP_LINE Line)
1787 IMAGEHLP_LINE64 line64;
1789 line64.SizeOfStruct = sizeof(line64);
1790 copy_line_64_from_32(&line64, Line);
1791 if (!SymGetLineNext64(hProcess, &line64)) return FALSE;
1792 copy_line_32_from_64(Line, &line64);
1793 return TRUE;
1796 /***********************************************************************
1797 * SymUnDName (DBGHELP.@)
1799 BOOL WINAPI SymUnDName(PIMAGEHLP_SYMBOL sym, PSTR UnDecName, DWORD UnDecNameLength)
1801 return UnDecorateSymbolName(sym->Name, UnDecName, UnDecNameLength,
1802 UNDNAME_COMPLETE) != 0;
1805 /***********************************************************************
1806 * SymUnDName64 (DBGHELP.@)
1808 BOOL WINAPI SymUnDName64(PIMAGEHLP_SYMBOL64 sym, PSTR UnDecName, DWORD UnDecNameLength)
1810 return UnDecorateSymbolName(sym->Name, UnDecName, UnDecNameLength,
1811 UNDNAME_COMPLETE) != 0;
1814 static void* und_alloc(size_t len) { return HeapAlloc(GetProcessHeap(), 0, len); }
1815 static void und_free (void* ptr) { HeapFree(GetProcessHeap(), 0, ptr); }
1817 /***********************************************************************
1818 * UnDecorateSymbolName (DBGHELP.@)
1820 DWORD WINAPI UnDecorateSymbolName(PCSTR DecoratedName, PSTR UnDecoratedName,
1821 DWORD UndecoratedLength, DWORD Flags)
1823 /* undocumented from msvcrt */
1824 static char* (*p_undname)(char*, const char*, int, void* (*)(size_t), void (*)(void*), unsigned short);
1825 static const WCHAR szMsvcrt[] = {'m','s','v','c','r','t','.','d','l','l',0};
1827 TRACE("(%s, %p, %d, 0x%08x)\n",
1828 debugstr_a(DecoratedName), UnDecoratedName, UndecoratedLength, Flags);
1830 if (!p_undname)
1832 if (!hMsvcrt) hMsvcrt = LoadLibraryW(szMsvcrt);
1833 if (hMsvcrt) p_undname = (void*)GetProcAddress(hMsvcrt, "__unDName");
1834 if (!p_undname) return 0;
1837 if (!UnDecoratedName) return 0;
1838 if (!p_undname(UnDecoratedName, DecoratedName, UndecoratedLength,
1839 und_alloc, und_free, Flags))
1840 return 0;
1841 return strlen(UnDecoratedName);
1844 /******************************************************************
1845 * SymMatchString (DBGHELP.@)
1848 BOOL WINAPI SymMatchString(PCSTR string, PCSTR re, BOOL _case)
1850 regex_t preg;
1851 BOOL ret;
1853 TRACE("%s %s %c\n", string, re, _case ? 'Y' : 'N');
1855 compile_regex(re, -1, &preg, _case);
1856 ret = match_regexp(&preg, string);
1857 regfree(&preg);
1858 return ret;
1861 /******************************************************************
1862 * SymSearch (DBGHELP.@)
1864 BOOL WINAPI SymSearch(HANDLE hProcess, ULONG64 BaseOfDll, DWORD Index,
1865 DWORD SymTag, PCSTR Mask, DWORD64 Address,
1866 PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback,
1867 PVOID UserContext, DWORD Options)
1869 struct sym_enum se;
1871 TRACE("(%p %s %u %u %s %s %p %p %x)\n",
1872 hProcess, wine_dbgstr_longlong(BaseOfDll), Index, SymTag, Mask,
1873 wine_dbgstr_longlong(Address), EnumSymbolsCallback,
1874 UserContext, Options);
1876 if (Options != SYMSEARCH_GLOBALSONLY)
1878 FIXME("Unsupported searching with options (%x)\n", Options);
1879 SetLastError(ERROR_INVALID_PARAMETER);
1880 return FALSE;
1883 se.cb = EnumSymbolsCallback;
1884 se.user = UserContext;
1885 se.index = Index;
1886 se.tag = SymTag;
1887 se.addr = Address;
1888 se.sym_info = (PSYMBOL_INFO)se.buffer;
1890 return sym_enum(hProcess, BaseOfDll, Mask, &se);
1893 /******************************************************************
1894 * SymSearchW (DBGHELP.@)
1896 BOOL WINAPI SymSearchW(HANDLE hProcess, ULONG64 BaseOfDll, DWORD Index,
1897 DWORD SymTag, PCWSTR Mask, DWORD64 Address,
1898 PSYM_ENUMERATESYMBOLS_CALLBACKW EnumSymbolsCallback,
1899 PVOID UserContext, DWORD Options)
1901 struct sym_enumW sew;
1902 BOOL ret = FALSE;
1903 char* maskA = NULL;
1905 TRACE("(%p %s %u %u %s %s %p %p %x)\n",
1906 hProcess, wine_dbgstr_longlong(BaseOfDll), Index, SymTag, debugstr_w(Mask),
1907 wine_dbgstr_longlong(Address), EnumSymbolsCallback,
1908 UserContext, Options);
1910 sew.ctx = UserContext;
1911 sew.cb = EnumSymbolsCallback;
1912 sew.sym_info = (PSYMBOL_INFOW)sew.buffer;
1914 if (Mask)
1916 unsigned len = WideCharToMultiByte(CP_ACP, 0, Mask, -1, NULL, 0, NULL, NULL);
1917 maskA = HeapAlloc(GetProcessHeap(), 0, len);
1918 if (!maskA) return FALSE;
1919 WideCharToMultiByte(CP_ACP, 0, Mask, -1, maskA, len, NULL, NULL);
1921 ret = SymSearch(hProcess, BaseOfDll, Index, SymTag, maskA, Address,
1922 sym_enumW, &sew, Options);
1923 HeapFree(GetProcessHeap(), 0, maskA);
1925 return ret;
1928 /******************************************************************
1929 * SymAddSymbol (DBGHELP.@)
1932 BOOL WINAPI SymAddSymbol(HANDLE hProcess, ULONG64 BaseOfDll, PCSTR name,
1933 DWORD64 addr, DWORD size, DWORD flags)
1935 WCHAR nameW[MAX_SYM_NAME];
1937 MultiByteToWideChar(CP_ACP, 0, name, -1, nameW, sizeof(nameW) / sizeof(WCHAR));
1938 return SymAddSymbolW(hProcess, BaseOfDll, nameW, addr, size, flags);
1941 /******************************************************************
1942 * SymAddSymbolW (DBGHELP.@)
1945 BOOL WINAPI SymAddSymbolW(HANDLE hProcess, ULONG64 BaseOfDll, PCWSTR name,
1946 DWORD64 addr, DWORD size, DWORD flags)
1948 struct module_pair pair;
1950 TRACE("(%p %s %s %u)\n", hProcess, wine_dbgstr_w(name), wine_dbgstr_longlong(addr), size);
1952 pair.pcs = process_find_by_handle(hProcess);
1953 if (!pair.pcs) return FALSE;
1954 pair.requested = module_find_by_addr(pair.pcs, BaseOfDll, DMT_UNKNOWN);
1955 if (!module_get_debug(&pair)) return FALSE;
1957 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
1958 return FALSE;
1961 /******************************************************************
1962 * SymSetScopeFromAddr (DBGHELP.@)
1964 BOOL WINAPI SymSetScopeFromAddr(HANDLE hProcess, ULONG64 addr)
1966 struct process* pcs;
1968 FIXME("(%p %s): stub\n", hProcess, wine_dbgstr_longlong(addr));
1970 if (!(pcs = process_find_by_handle(hProcess))) return FALSE;
1971 return TRUE;
1974 /******************************************************************
1975 * SymEnumLines (DBGHELP.@)
1978 BOOL WINAPI SymEnumLines(HANDLE hProcess, ULONG64 base, PCSTR compiland,
1979 PCSTR srcfile, PSYM_ENUMLINES_CALLBACK cb, PVOID user)
1981 struct module_pair pair;
1982 struct hash_table_iter hti;
1983 struct symt_ht* sym;
1984 regex_t re;
1985 struct line_info* dli;
1986 void* ptr;
1987 SRCCODEINFO sci;
1988 const char* file;
1990 if (!cb) return FALSE;
1991 if (!(dbghelp_options & SYMOPT_LOAD_LINES)) return TRUE;
1993 pair.pcs = process_find_by_handle(hProcess);
1994 if (!pair.pcs) return FALSE;
1995 if (compiland) FIXME("Unsupported yet (filtering on compiland %s)\n", compiland);
1996 pair.requested = module_find_by_addr(pair.pcs, base, DMT_UNKNOWN);
1997 if (!module_get_debug(&pair)) return FALSE;
1998 if (!compile_file_regex(&re, srcfile)) return FALSE;
2000 sci.SizeOfStruct = sizeof(sci);
2001 sci.ModBase = base;
2003 hash_table_iter_init(&pair.effective->ht_symbols, &hti, NULL);
2004 while ((ptr = hash_table_iter_up(&hti)))
2006 unsigned int i;
2008 sym = GET_ENTRY(ptr, struct symt_ht, hash_elt);
2009 if (sym->symt.tag != SymTagFunction) continue;
2011 sci.FileName[0] = '\0';
2012 for (i=0; i<vector_length(&((struct symt_function*)sym)->vlines); i++)
2014 dli = vector_at(&((struct symt_function*)sym)->vlines, i);
2015 if (dli->is_source_file)
2017 file = source_get(pair.effective, dli->u.source_file);
2018 if (!match_regexp(&re, file)) file = "";
2019 strcpy(sci.FileName, file);
2021 else if (sci.FileName[0])
2023 sci.Key = dli;
2024 sci.Obj[0] = '\0'; /* FIXME */
2025 sci.LineNumber = dli->line_number;
2026 sci.Address = dli->u.pc_offset;
2027 if (!cb(&sci, user)) break;
2031 regfree(&re);
2032 return TRUE;
2035 BOOL WINAPI SymGetLineFromName(HANDLE hProcess, PCSTR ModuleName, PCSTR FileName,
2036 DWORD dwLineNumber, PLONG plDisplacement, PIMAGEHLP_LINE Line)
2038 FIXME("(%p) (%s, %s, %d %p %p): stub\n", hProcess, ModuleName, FileName,
2039 dwLineNumber, plDisplacement, Line);
2040 return FALSE;
2043 BOOL WINAPI SymGetLineFromName64(HANDLE hProcess, PCSTR ModuleName, PCSTR FileName,
2044 DWORD dwLineNumber, PLONG lpDisplacement, PIMAGEHLP_LINE64 Line)
2046 FIXME("(%p) (%s, %s, %d %p %p): stub\n", hProcess, ModuleName, FileName,
2047 dwLineNumber, lpDisplacement, Line);
2048 return FALSE;
2051 BOOL WINAPI SymGetLineFromNameW64(HANDLE hProcess, PCWSTR ModuleName, PCWSTR FileName,
2052 DWORD dwLineNumber, PLONG plDisplacement, PIMAGEHLP_LINEW64 Line)
2054 FIXME("(%p) (%s, %s, %d %p %p): stub\n", hProcess, debugstr_w(ModuleName), debugstr_w(FileName),
2055 dwLineNumber, plDisplacement, Line);
2056 return FALSE;