2 * Generate hash tables for Wine debugger symbols
4 * Copyright (C) 1993, Eric Youngdale.
5 * 2004-2005, 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
27 #include "wine/debug.h"
29 WINE_DEFAULT_DEBUG_CHANNEL(winedbg
);
31 static BOOL
symbol_get_debug_start(const struct dbg_type
* func
, ULONG64
* start
)
34 char buffer
[sizeof(TI_FINDCHILDREN_PARAMS
) + 256 * sizeof(DWORD
)];
35 TI_FINDCHILDREN_PARAMS
* fcp
= (TI_FINDCHILDREN_PARAMS
*)buffer
;
37 struct dbg_type child
;
39 if (!func
->id
) return FALSE
; /* native dbghelp not always fills the info field */
41 if (!types_get_info(func
, TI_GET_CHILDRENCOUNT
, &count
)) return FALSE
;
45 fcp
->Count
= min(count
, 256);
46 if (types_get_info(func
, TI_FINDCHILDREN
, fcp
))
48 for (i
= 0; i
< min(fcp
->Count
, count
); i
++)
50 child
.module
= func
->module
;
51 child
.id
= fcp
->ChildId
[i
];
52 types_get_info(&child
, TI_GET_SYMTAG
, &tag
);
53 if (tag
!= SymTagFuncDebugStart
) continue;
54 return types_get_info(&child
, TI_GET_ADDRESS
, start
);
56 count
-= min(count
, 256);
64 static BOOL
fetch_tls_lvalue(const SYMBOL_INFO
* sym
, struct dbg_lvalue
* lvalue
)
66 struct dbg_module
* mod
= dbg_get_module(dbg_curr_process
, sym
->ModBase
);
68 struct dbg_lvalue lv_teb_tls
, lv_index_addr
, lv_module_tls
;
69 dbg_lgint_t teb_tls_addr
, index_addr
, tls_module_addr
;
70 char* teb_tls_storage
;
72 if (!mod
|| !mod
->tls_index_offset
|| !dbg_curr_thread
)
74 /* get ThreadLocalStoragePointer offset depending on debuggee bitness */
75 teb_tls_storage
= (char*)dbg_curr_thread
->teb
;
76 if (ADDRSIZE
== sizeof(void*))
77 /* debugger and debuggee have same bitness */
78 teb_tls_storage
+= offsetof(TEB
, ThreadLocalStoragePointer
);
80 /* debugger is 64bit, while debuggee is 32bit */
81 teb_tls_storage
+= 0x2000 /* TEB64 => TEB32 */ + offsetof(TEB32
, ThreadLocalStoragePointer
);
82 init_lvalue(&lv_teb_tls
, TRUE
, teb_tls_storage
);
84 if (!memory_fetch_integer(&lv_teb_tls
, ADDRSIZE
, FALSE
, &teb_tls_addr
))
87 init_lvalue(&lv_index_addr
, TRUE
, (void*)(DWORD_PTR
)(sym
->ModBase
+ mod
->tls_index_offset
));
88 if (!memory_fetch_integer(&lv_index_addr
, ADDRSIZE
, FALSE
, &index_addr
))
91 if (!dbg_read_memory((const char*)(DWORD_PTR
)index_addr
, &tlsindex
, sizeof(tlsindex
)))
94 init_lvalue(&lv_module_tls
, TRUE
, (void*)(DWORD_PTR
)(teb_tls_addr
+ tlsindex
* ADDRSIZE
));
95 if (!memory_fetch_integer(&lv_module_tls
, ADDRSIZE
, FALSE
, &tls_module_addr
))
97 init_lvalue(lvalue
, TRUE
, (void*)(DWORD_PTR
)(tls_module_addr
+ sym
->Address
));
101 static BOOL
fill_sym_lvalue(const SYMBOL_INFO
* sym
, ULONG_PTR base
,
102 struct dbg_lvalue
* lvalue
, char* buffer
, size_t sz
)
104 if (buffer
) buffer
[0] = '\0';
105 if (sym
->Flags
& SYMFLAG_REGISTER
)
107 if (!memory_get_register(sym
->Register
, lvalue
, buffer
, sz
))
110 else if (sym
->Flags
& SYMFLAG_REGREL
)
114 *buffer
++ = '['; sz
--;
115 if (!memory_get_register(sym
->Register
, lvalue
, buffer
, sz
))
120 init_lvalue(lvalue
, TRUE
, (void*)(DWORD_PTR
)(types_extract_as_integer(lvalue
) + sym
->Address
));
121 if ((LONG64
)sym
->Address
>= 0)
122 snprintf(buffer
, sz
, "+%I64d]", sym
->Address
);
124 snprintf(buffer
, sz
, "-%I64d]", -(LONG64
)sym
->Address
);
126 else if (sym
->Flags
& SYMFLAG_VALUEPRESENT
)
128 struct dbg_type type
;
131 type
.module
= sym
->ModBase
;
132 type
.id
= sym
->Index
;
134 if (!types_get_info(&type
, TI_GET_VALUE
, &v
))
136 if (buffer
) snprintf(buffer
, sz
, "Couldn't get full value information for %s", sym
->Name
);
139 else if (V_ISBYREF(&v
))
141 /* FIXME: this won't work for pointers or arrays, as we don't always
142 * know, if the value to be dereferenced lies in debuggee or
143 * debugger address space.
145 if (sym
->Tag
== SymTagPointerType
|| sym
->Tag
== SymTagArrayType
)
147 if (buffer
) snprintf(buffer
, sz
, "Couldn't dereference pointer for const value for %s", sym
->Name
);
150 /* this is likely Wine's dbghelp which passes const values by reference
151 * (object is managed by dbghelp, hence in debugger address space)
153 init_lvalue(lvalue
, FALSE
, (void*)(DWORD_PTR
)sym
->Value
);
157 DWORD
* pdw
= (DWORD
*)lexeme_alloc_size(sizeof(*pdw
));
158 init_lvalue(lvalue
, FALSE
, pdw
);
162 else if (sym
->Flags
& SYMFLAG_LOCAL
)
164 init_lvalue(lvalue
, TRUE
, (void*)(DWORD_PTR
)(base
+ sym
->Address
));
166 else if (sym
->Flags
& SYMFLAG_TLSREL
)
168 if (!fetch_tls_lvalue(sym
, lvalue
))
170 if (buffer
) snprintf(buffer
, sz
, "Cannot read TLS address\n");
176 init_lvalue(lvalue
, TRUE
, (void*)(DWORD_PTR
)sym
->Address
);
178 lvalue
->addr
.Mode
= AddrModeFlat
;
179 lvalue
->type
.module
= sym
->ModBase
;
180 lvalue
->type
.id
= sym
->TypeIndex
;
190 /* FIXME: NUMDBGV should be made variable */
191 struct dbg_lvalue lvalue
;
194 } syms
[NUMDBGV
]; /* out : will be filled in with various found symbols */
195 int num
; /* out : number of found symbols */
196 int num_thunks
; /* out : number of thunks found */
197 const char* name
; /* in : name of symbol to look up */
198 unsigned do_thunks
: 1; /* in : whether we return thunks tags */
199 ULONG64 frame_offset
; /* in : frame for local & parameter variables look up */
202 static BOOL CALLBACK
sgv_cb(PSYMBOL_INFO sym
, ULONG size
, PVOID ctx
)
204 struct sgv_data
* sgv
= ctx
;
208 if (sym
->Flags
& SYMFLAG_THUNK
)
210 if (!sgv
->do_thunks
) return TRUE
;
214 if (sgv
->num
>= NUMDBGV
)
216 dbg_printf("Too many addresses for symbol '%s', limiting the first %d\n",
220 WINE_TRACE("==> %s %s%s%s%s%s%s%s%s\n",
222 (sym
->Flags
& SYMFLAG_FUNCTION
) ? "func " : "",
223 (sym
->Flags
& SYMFLAG_FRAMEREL
) ? "framerel " : "",
224 (sym
->Flags
& SYMFLAG_TLSREL
) ? "tlsrel " : "",
225 (sym
->Flags
& SYMFLAG_REGISTER
) ? "register " : "",
226 (sym
->Flags
& SYMFLAG_REGREL
) ? "regrel " : "",
227 (sym
->Flags
& SYMFLAG_PARAMETER
) ? "param " : "",
228 (sym
->Flags
& SYMFLAG_LOCAL
) ? "local " : "",
229 (sym
->Flags
& SYMFLAG_THUNK
) ? "thunk " : "");
231 /* always keep the thunks at end of the array */
233 if (sgv
->num_thunks
&& !(sym
->Flags
& SYMFLAG_THUNK
))
235 insp
-= sgv
->num_thunks
;
236 memmove(&sgv
->syms
[insp
+ 1], &sgv
->syms
[insp
],
237 sizeof(sgv
->syms
[0]) * sgv
->num_thunks
);
239 if (!fill_sym_lvalue(sym
, sgv
->frame_offset
, &sgv
->syms
[insp
].lvalue
, tmp
, sizeof(tmp
)))
241 dbg_printf("%s: %s\n", sym
->Name
, tmp
);
244 sgv
->syms
[insp
].flags
= sym
->Flags
;
245 sgv
->syms
[insp
].sym_info
= sym
->Index
;
251 enum sym_get_lval
symbol_picker_interactive(const char* name
, const struct sgv_data
* sgv
,
252 struct dbg_lvalue
* rtn
)
257 if (!dbg_interactiveP
)
259 dbg_printf("More than one symbol named %s, picking the first one\n", name
);
260 *rtn
= sgv
->syms
[0].lvalue
;
264 dbg_printf("Many symbols with name '%s', "
265 "choose the one you want (<cr> to abort):\n", name
);
266 for (i
= 0; i
< sgv
->num
; i
++)
268 if (sgv
->num
- sgv
->num_thunks
> 1 && (sgv
->syms
[i
].flags
& SYMFLAG_THUNK
) && !DBG_IVAR(AlwaysShowThunks
))
270 dbg_printf("[%d]: ", i
+ 1);
271 if (sgv
->syms
[i
].flags
& (SYMFLAG_LOCAL
| SYMFLAG_PARAMETER
))
273 dbg_printf("%s %sof %s\n",
274 sgv
->syms
[i
].flags
& SYMFLAG_PARAMETER
? "Parameter" : "Local variable",
275 sgv
->syms
[i
].flags
& (SYMFLAG_REGISTER
|SYMFLAG_REGREL
) ? "(in a register) " : "",
278 else if (sgv
->syms
[i
].flags
& SYMFLAG_THUNK
)
280 print_address(&sgv
->syms
[i
].lvalue
.addr
, TRUE
);
281 /* FIXME: should display where the thunks points to */
282 dbg_printf(" thunk %s\n", name
);
286 print_address(&sgv
->syms
[i
].lvalue
.addr
, TRUE
);
292 if (input_read_line("=> ", buffer
, sizeof(buffer
)))
294 if (buffer
[0] == '\0') return sglv_aborted
;
296 if (i
< 1 || i
> sgv
->num
)
297 dbg_printf("Invalid choice %d\n", i
);
299 else return sglv_aborted
;
300 } while (i
< 1 || i
> sgv
->num
);
302 /* The array is 0-based, but the choices are 1..n,
303 * so we have to subtract one before returning.
305 *rtn
= sgv
->syms
[i
- 1].lvalue
;
309 enum sym_get_lval
symbol_picker_scoped(const char* name
, const struct sgv_data
* sgv
,
310 struct dbg_lvalue
* rtn
)
315 for (i
= 0; i
< sgv
->num
; i
++)
317 if (sgv
->num
- sgv
->num_thunks
> 1 && (sgv
->syms
[i
].flags
& SYMFLAG_THUNK
) && !DBG_IVAR(AlwaysShowThunks
))
319 if (sgv
->syms
[i
].flags
& (SYMFLAG_LOCAL
| SYMFLAG_PARAMETER
))
325 /* FIXME: several locals with same name... which one to pick ?? */
326 dbg_printf("Several local variables/parameters for %s, aborting\n", name
);
333 *rtn
= sgv
->syms
[local
].lvalue
;
336 /* no locals found, multiple globals... abort for now */
337 dbg_printf("Several global variables for %s, aborting\n", name
);
341 symbol_picker_t symbol_current_picker
= symbol_picker_interactive
;
343 /***********************************************************************
346 * Get the address of a named symbol.
348 * sglv_found: if the symbol is found
349 * sglv_unknown: if the symbol isn't found
350 * sglv_aborted: some error occurred (likely, many symbols of same name exist,
351 * and user didn't pick one of them)
353 enum sym_get_lval
symbol_get_lvalue(const char* name
, const int lineno
,
354 struct dbg_lvalue
* rtn
, BOOL bp_disp
)
360 struct dbg_frame
* frm
;
362 if (strlen(name
) + 4 > sizeof(buffer
))
364 WINE_WARN("Too long symbol (%s)\n", name
);
370 sgv
.name
= &buffer
[2];
371 sgv
.do_thunks
= DBG_IVAR(AlwaysShowThunks
);
373 if (strchr(name
, '!'))
375 strcpy(buffer
, name
);
381 strcpy(&buffer
[2], name
);
384 /* this is a wine specific options to return also ELF modules in the
387 opt
= SymSetExtendedOption(SYMOPT_EX_WINE_NATIVE_MODULES
, TRUE
);
388 SymEnumSymbols(dbg_curr_process
->handle
, 0, buffer
, sgv_cb
, (void*)&sgv
);
392 const char* ptr
= strchr(name
, '!');
393 if ((ptr
&& ptr
[1] != '_') || (!ptr
&& *name
!= '_'))
397 int offset
= ptr
- name
;
398 memcpy(buffer
, name
, offset
+ 1);
399 buffer
[offset
+ 1] = '_';
400 strcpy(&buffer
[offset
+ 2], ptr
+ 1);
407 strcpy(&buffer
[3], name
);
409 SymEnumSymbols(dbg_curr_process
->handle
, 0, buffer
, sgv_cb
, (void*)&sgv
);
412 SymSetExtendedOption(SYMOPT_EX_WINE_NATIVE_MODULES
, opt
);
414 /* now grab local symbols */
415 if ((frm
= stack_get_curr_frame()) && sgv
.num
< NUMDBGV
&& !strchr(name
, '!'))
417 sgv
.frame_offset
= frm
->linear_frame
;
418 SymEnumSymbols(dbg_curr_process
->handle
, 0, name
, sgv_cb
, (void*)&sgv
);
423 dbg_printf("No symbols found for %s\n", name
);
427 /* recompute potential offsets for functions (linenumber, skip prolog) */
428 for (i
= 0; i
< sgv
.num
; i
++)
430 if (sgv
.syms
[i
].flags
& (SYMFLAG_REGISTER
|SYMFLAG_REGREL
|SYMFLAG_LOCAL
|SYMFLAG_THUNK
))
435 struct dbg_type type
;
438 type
.module
= sgv
.syms
[i
].lvalue
.type
.module
;
439 type
.id
= sgv
.syms
[i
].sym_info
;
440 if (bp_disp
&& symbol_get_debug_start(&type
, &addr
))
441 sgv
.syms
[i
].lvalue
.addr
.Offset
= addr
;
449 il
.SizeOfStruct
= sizeof(il
);
450 SymGetLineFromAddr64(dbg_curr_process
->handle
,
451 (DWORD_PTR
)memory_to_linear_addr(&sgv
.syms
[i
].lvalue
.addr
),
455 if (lineno
== il
.LineNumber
)
457 sgv
.syms
[i
].lvalue
.addr
.Offset
= il
.Address
;
461 } while (SymGetLineNext64(dbg_curr_process
->handle
, &il
));
463 WINE_FIXME("No line (%d) found for %s (setting to symbol start)\n",
468 if (sgv
.num
- sgv
.num_thunks
> 1 || /* many symbols non thunks (and showing only non thunks) */
469 (sgv
.num
> 1 && DBG_IVAR(AlwaysShowThunks
)) || /* many symbols (showing symbols & thunks) */
470 (sgv
.num
== sgv
.num_thunks
&& sgv
.num_thunks
> 1))
472 return symbol_current_picker(name
, &sgv
, rtn
);
474 /* first symbol is the one we want:
475 * - only one symbol found,
476 * - or many symbols but only one non thunk when AlwaysShowThunks is FALSE
478 *rtn
= sgv
.syms
[0].lvalue
;
482 BOOL
symbol_is_local(const char* name
)
485 struct dbg_frame
* frm
;
490 sgv
.do_thunks
= FALSE
;
492 if ((frm
= stack_get_curr_frame()))
494 sgv
.frame_offset
= frm
->linear_frame
;
495 SymEnumSymbols(dbg_curr_process
->handle
, 0, name
, sgv_cb
, (void*)&sgv
);
500 /***********************************************************************
501 * symbol_read_symtable
503 * Read a symbol file into the hash table.
505 void symbol_read_symtable(const char* filename
, ULONG_PTR offset
)
507 dbg_printf("No longer supported\n");
510 /* FIXME: have to implement SymAddSymbol in dbghelp, but likely we'll need to link
511 * this with an already loaded module !!
520 if (!(symbolfile
= fopen(filename
, "r")))
522 WINE_WARN("Unable to open symbol table %s\n", filename
);
526 dbg_printf("Reading symbols from file %s\n", filename
);
530 fgets(buffer
, sizeof(buffer
), symbolfile
);
531 if (feof(symbolfile
)) break;
533 /* Strip any text after a # sign (i.e. comments) */
534 cpnt
= strchr(buffer
, '#');
535 if (cpnt
) *cpnt
= '\0';
537 /* Quietly ignore any lines that have just whitespace */
538 for (cpnt
= buffer
; *cpnt
; cpnt
++)
540 if (*cpnt
!= ' ' && *cpnt
!= '\t') break;
542 if (!*cpnt
|| *cpnt
== '\n') continue;
544 if (sscanf(buffer
, "%lx %c %s", &addr
, &type
, name
) == 3)
546 if (value
.addr
.off
+ offset
< value
.addr
.off
)
547 WINE_WARN("Address wrap around\n");
548 value
.addr
.off
+= offset
;
549 SymAddSymbol(current_process
->handle
, BaseOfDll
,
557 /***********************************************************************
558 * symbol_get_function_line_status
560 * Find the symbol nearest to a given address.
562 enum dbg_line_status
symbol_get_function_line_status(const ADDRESS64
* addr
)
566 ULONG64 disp64
, start
;
567 DWORD_PTR lin
= (DWORD_PTR
)memory_to_linear_addr(addr
);
568 char buffer
[sizeof(SYMBOL_INFO
) + 256];
569 SYMBOL_INFO
* sym
= (SYMBOL_INFO
*)buffer
;
570 struct dbg_type func
;
572 il
.SizeOfStruct
= sizeof(il
);
573 sym
->SizeOfStruct
= sizeof(SYMBOL_INFO
);
574 sym
->MaxNameLen
= sizeof(buffer
) - sizeof(SYMBOL_INFO
);
576 /* do we have some info for lin address ? */
577 if (!SymFromAddr(dbg_curr_process
->handle
, lin
, &disp64
, sym
))
580 /* some compilers insert thunks in their code without debug info associated
581 * take care of this situation
583 if (dbg_curr_process
->be_cpu
->is_jump((void*)lin
, &jumpee
))
584 return symbol_get_function_line_status(&jumpee
);
585 return dbg_no_line_info
;
591 /* FIXME: so far dbghelp doesn't return the 16 <=> 32 thunks
592 * and furthermore, we no longer take care of them !!!
594 return dbg_in_a_thunk
;
596 case SymTagPublicSymbol
: break;
598 WINE_FIXME("Unexpected sym-tag 0x%08lx\n", sym
->Tag
);
600 return dbg_no_line_info
;
602 /* we should have a function now */
603 if (!SymGetLineFromAddr64(dbg_curr_process
->handle
, lin
, &disp
, &il
))
604 return dbg_no_line_info
;
606 func
.module
= sym
->ModBase
;
607 func
.id
= sym
->Index
;
609 if (symbol_get_debug_start(&func
, &start
) && lin
< start
)
610 return dbg_not_on_a_line_number
;
612 if (!sym
->Size
) sym
->Size
= 0x100000;
613 if (il
.FileName
&& il
.FileName
[0] && disp
< sym
->Size
)
614 return (disp
== 0) ? dbg_on_a_line_number
: dbg_not_on_a_line_number
;
616 return dbg_no_line_info
;
619 /***********************************************************************
622 * Find the symbol nearest to a given address.
623 * Returns sourcefile name and line number in a format that the listing
624 * handler can deal with.
626 BOOL
symbol_get_line(const char* filename
, const char* name
,
627 IMAGEHLP_LINE64
* line
)
638 sgv
.name
= &buffer
[2];
639 sgv
.do_thunks
= FALSE
;
643 strcpy(&buffer
[2], name
);
645 /* this is a wine specific options to return also ELF modules in the
648 opt
= SymSetExtendedOption(SYMOPT_EX_WINE_NATIVE_MODULES
, TRUE
);
649 if (!SymEnumSymbols(dbg_curr_process
->handle
, 0, buffer
, sgv_cb
, (void*)&sgv
))
651 SymSetExtendedOption(SYMOPT_EX_WINE_NATIVE_MODULES
, opt
);
655 if (!sgv
.num
&& (name
[0] != '_'))
658 strcpy(&buffer
[3], name
);
659 if (!SymEnumSymbols(dbg_curr_process
->handle
, 0, buffer
, sgv_cb
, (void*)&sgv
))
661 SymSetExtendedOption(SYMOPT_EX_WINE_NATIVE_MODULES
, opt
);
665 SymSetExtendedOption(SYMOPT_EX_WINE_NATIVE_MODULES
, opt
);
667 for (i
= 0; i
< sgv
.num
; i
++)
669 DWORD_PTR linear
= (DWORD_PTR
)memory_to_linear_addr(&sgv
.syms
[i
].lvalue
.addr
);
671 il
.SizeOfStruct
= sizeof(il
);
672 if (!SymGetLineFromAddr64(dbg_curr_process
->handle
, linear
, &disp
, &il
))
674 if (filename
&& strcmp(il
.FileName
, filename
)) continue;
677 WINE_FIXME("Several found, returning first (may not be what you want)...\n");
685 if (filename
) dbg_printf("No such function %s in %s\n", name
, filename
);
686 else dbg_printf("No such function %s\n", name
);
692 /******************************************************************
693 * symbol_print_localvalue
696 * <value> in non detailed form
697 * <value> (local|pmt <where>) in detailed form
698 * Note <value> can be an error message in case of error
700 void symbol_print_localvalue(const SYMBOL_INFO
* sym
, DWORD_PTR base
, BOOL detailed
)
702 struct dbg_lvalue lvalue
;
705 if (fill_sym_lvalue(sym
, base
, &lvalue
, buffer
, sizeof(buffer
)))
707 print_value(&lvalue
, 0, 1);
709 dbg_printf(" (%s %s)",
710 (sym
->Flags
& SYMFLAG_PARAMETER
) ? "parameter" : "local",
715 dbg_printf("%s", buffer
);
718 (sym
->Flags
& SYMFLAG_PARAMETER
) ? "parameter" : "local");
722 static BOOL CALLBACK
info_locals_cb(PSYMBOL_INFO sym
, ULONG size
, PVOID ctx
)
727 len
= MultiByteToWideChar(CP_ACP
, 0, sym
->Name
, -1, NULL
, 0);
728 nameW
= malloc(len
* sizeof(WCHAR
));
731 struct dbg_type type
;
733 MultiByteToWideChar(CP_ACP
, 0, sym
->Name
, -1, nameW
, len
);
735 type
.module
= sym
->ModBase
;
736 type
.id
= sym
->TypeIndex
;
739 types_print_type(&type
, FALSE
, nameW
);
742 symbol_print_localvalue(sym
, (DWORD_PTR
)ctx
, TRUE
);
750 BOOL
symbol_info_locals(void)
753 struct dbg_frame
* frm
;
755 if (!(frm
= stack_get_curr_frame())) return FALSE
;
757 addr
.Mode
= AddrModeFlat
;
758 addr
.Offset
= frm
->linear_pc
;
759 print_address(&addr
, FALSE
);
760 dbg_printf(": (%0*Ix)\n", ADDRWIDTH
, frm
->linear_frame
);
761 SymEnumSymbols(dbg_curr_process
->handle
, 0, NULL
, info_locals_cb
, (void*)frm
->linear_frame
);
766 static BOOL CALLBACK
symbols_info_cb(PSYMBOL_INFO sym
, ULONG size
, PVOID ctx
)
768 struct dbg_type type
;
771 mi
.SizeOfStruct
= sizeof(mi
);
773 if (!SymGetModuleInfo(dbg_curr_process
->handle
, sym
->ModBase
, &mi
))
774 mi
.ModuleName
[0] = '\0';
777 size_t len
= strlen(mi
.ModuleName
);
778 if (len
> 5 && !strcmp(mi
.ModuleName
+ len
- 5, "<elf>"))
779 mi
.ModuleName
[len
- 5] = '\0';
782 dbg_printf("%0*I64x: %s!%s", ADDRWIDTH
, sym
->Address
, mi
.ModuleName
, sym
->Name
);
783 type
.id
= sym
->TypeIndex
;
784 type
.module
= sym
->ModBase
;
786 if (sym
->TypeIndex
!= dbg_itype_none
&& sym
->TypeIndex
!= 0)
789 types_print_type(&type
, FALSE
, NULL
);
795 void symbol_info(const char* str
)
800 if (strlen(str
) + 3 >= sizeof(buffer
))
802 dbg_printf("Symbol too long (%s)\n", str
);
807 strcpy(&buffer
[2], str
);
808 /* this is a wine specific options to return also ELF modules in the
811 opt
= SymSetExtendedOption(SYMOPT_EX_WINE_NATIVE_MODULES
, TRUE
);
812 SymEnumSymbols(dbg_curr_process
->handle
, 0, buffer
, symbols_info_cb
, NULL
);
813 SymSetExtendedOption(SYMOPT_EX_WINE_NATIVE_MODULES
, opt
);