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
28 #include "wine/debug.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(winedbg
);
32 static BOOL
symbol_get_debug_start(const struct dbg_type
* func
, ULONG64
* start
)
35 char buffer
[sizeof(TI_FINDCHILDREN_PARAMS
) + 256 * sizeof(DWORD
)];
36 TI_FINDCHILDREN_PARAMS
* fcp
= (TI_FINDCHILDREN_PARAMS
*)buffer
;
38 struct dbg_type child
;
40 if (!func
->id
) return FALSE
; /* native dbghelp not always fills the info field */
42 if (!types_get_info(func
, TI_GET_CHILDRENCOUNT
, &count
)) return FALSE
;
46 fcp
->Count
= min(count
, 256);
47 if (types_get_info(func
, TI_FINDCHILDREN
, fcp
))
49 for (i
= 0; i
< min(fcp
->Count
, count
); i
++)
51 child
.module
= func
->module
;
52 child
.id
= fcp
->ChildId
[i
];
53 types_get_info(&child
, TI_GET_SYMTAG
, &tag
);
54 if (tag
!= SymTagFuncDebugStart
) continue;
55 return types_get_info(&child
, TI_GET_ADDRESS
, start
);
57 count
-= min(count
, 256);
65 static BOOL
fill_sym_lvalue(const SYMBOL_INFO
* sym
, ULONG_PTR base
,
66 struct dbg_lvalue
* lvalue
, char* buffer
, size_t sz
)
68 if (buffer
) buffer
[0] = '\0';
69 if (sym
->Flags
& SYMFLAG_REGISTER
)
73 if (!memory_get_register(sym
->Register
, &pval
, buffer
, sz
))
75 lvalue
->cookie
= DLV_HOST
;
76 lvalue
->addr
.Offset
= (DWORD_PTR
)pval
;
78 else if (sym
->Flags
& SYMFLAG_REGREL
)
83 *buffer
++ = '['; sz
--;
84 if (!memory_get_register(sym
->Register
, &pval
, buffer
, sz
))
89 lvalue
->cookie
= DLV_TARGET
;
90 lvalue
->addr
.Offset
= (ULONG64
)*pval
+ sym
->Address
;
91 if ((LONG_PTR
)sym
->Address
>= 0)
92 snprintf(buffer
, sz
, "+%ld]", (ULONG_PTR
)sym
->Address
);
94 snprintf(buffer
, sz
, "-%ld]", -(LONG_PTR
)sym
->Address
);
96 else if (sym
->Flags
& SYMFLAG_VALUEPRESENT
)
101 type
.module
= sym
->ModBase
;
102 type
.id
= sym
->Index
;
104 if (!types_get_info(&type
, TI_GET_VALUE
, &v
))
106 if (buffer
) snprintf(buffer
, sz
, "Couldn't get full value information for %s", sym
->Name
);
109 else if (v
.n1
.n2
.vt
& VT_BYREF
)
111 /* FIXME: this won't work for pointers or arrays, as we don't always
112 * know, if the value to be dereferenced lies in debuggee or
113 * debugger address space.
115 if (sym
->Tag
== SymTagPointerType
|| sym
->Tag
== SymTagArrayType
)
117 if (buffer
) snprintf(buffer
, sz
, "Couldn't dereference pointer for const value for %s", sym
->Name
);
120 /* this is likely Wine's dbghelp which passes const values by reference
121 * (object is managed by dbghelp, hence in debugger address space)
123 lvalue
->cookie
= DLV_HOST
;
124 lvalue
->addr
.Offset
= (DWORD_PTR
)sym
->Value
;
128 DWORD
* pdw
= (DWORD
*)lexeme_alloc_size(sizeof(*pdw
));
129 lvalue
->cookie
= DLV_HOST
;
130 lvalue
->addr
.Offset
= (DWORD_PTR
)pdw
;
134 else if (sym
->Flags
& SYMFLAG_LOCAL
)
136 lvalue
->cookie
= DLV_TARGET
;
137 lvalue
->addr
.Offset
= base
+ sym
->Address
;
139 else if (sym
->Flags
& SYMFLAG_TLSREL
)
141 PROCESS_BASIC_INFORMATION pbi
;
142 THREAD_BASIC_INFORMATION tbi
;
145 PEB_LDR_DATA ldr_data
;
146 PLIST_ENTRY head
, current
;
147 LDR_DATA_TABLE_ENTRY ldr_module
;
148 unsigned tlsindex
= -1;
150 if (NtQueryInformationProcess(dbg_curr_process
->handle
, ProcessBasicInformation
,
151 &pbi
, sizeof(pbi
), NULL
) ||
152 NtQueryInformationThread(dbg_curr_thread
->handle
, ThreadBasicInformation
,
153 &tbi
, sizeof(tbi
), NULL
))
156 if (buffer
) snprintf(buffer
, sz
, "Cannot read TLS address\n");
159 addr
= (DWORD_PTR
)&(((TEB
*)tbi
.TebBaseAddress
)->ThreadLocalStoragePointer
);
160 if (!dbg_read_memory((void*)addr
, &addr
, sizeof(addr
)) ||
161 !dbg_read_memory(pbi
.PebBaseAddress
, &peb
, sizeof(peb
)) ||
162 !dbg_read_memory(peb
.LdrData
, &ldr_data
, sizeof(ldr_data
)))
164 current
= ldr_data
.InLoadOrderModuleList
.Flink
;
165 head
= &((PEB_LDR_DATA
*)peb
.LdrData
)->InLoadOrderModuleList
;
168 if (!dbg_read_memory(CONTAINING_RECORD(current
, LDR_DATA_TABLE_ENTRY
, InLoadOrderLinks
),
169 &ldr_module
, sizeof(ldr_module
))) goto tls_error
;
170 if ((DWORD_PTR
)ldr_module
.DllBase
== sym
->ModBase
)
172 tlsindex
= ldr_module
.TlsIndex
;
175 current
= ldr_module
.InLoadOrderLinks
.Flink
;
176 } while (current
!= head
);
178 addr
+= tlsindex
* sizeof(DWORD_PTR
);
179 if (!dbg_read_memory((void*)addr
, &addr
, sizeof(addr
))) goto tls_error
;
180 lvalue
->cookie
= DLV_TARGET
;
181 lvalue
->addr
.Offset
= addr
+ sym
->Address
;
185 lvalue
->cookie
= DLV_TARGET
;
186 lvalue
->addr
.Offset
= sym
->Address
;
188 lvalue
->addr
.Mode
= AddrModeFlat
;
189 lvalue
->type
.module
= sym
->ModBase
;
190 lvalue
->type
.id
= sym
->TypeIndex
;
200 /* FIXME: NUMDBGV should be made variable */
201 struct dbg_lvalue lvalue
;
204 } syms
[NUMDBGV
]; /* out : will be filled in with various found symbols */
205 int num
; /* out : number of found symbols */
206 int num_thunks
; /* out : number of thunks found */
207 const char* name
; /* in : name of symbol to look up */
208 unsigned do_thunks
: 1; /* in : whether we return thunks tags */
209 ULONG64 frame_offset
; /* in : frame for local & parameter variables look up */
212 static BOOL CALLBACK
sgv_cb(PSYMBOL_INFO sym
, ULONG size
, PVOID ctx
)
214 struct sgv_data
* sgv
= ctx
;
218 if (sym
->Flags
& SYMFLAG_THUNK
)
220 if (!sgv
->do_thunks
) return TRUE
;
224 if (sgv
->num
>= NUMDBGV
)
226 dbg_printf("Too many addresses for symbol '%s', limiting the first %d\n",
230 WINE_TRACE("==> %s %s%s%s%s%s%s%s%s\n",
232 (sym
->Flags
& SYMFLAG_FUNCTION
) ? "func " : "",
233 (sym
->Flags
& SYMFLAG_FRAMEREL
) ? "framerel " : "",
234 (sym
->Flags
& SYMFLAG_TLSREL
) ? "tlsrel " : "",
235 (sym
->Flags
& SYMFLAG_REGISTER
) ? "register " : "",
236 (sym
->Flags
& SYMFLAG_REGREL
) ? "regrel " : "",
237 (sym
->Flags
& SYMFLAG_PARAMETER
) ? "param " : "",
238 (sym
->Flags
& SYMFLAG_LOCAL
) ? "local " : "",
239 (sym
->Flags
& SYMFLAG_THUNK
) ? "thunk " : "");
241 /* always keep the thunks at end of the array */
243 if (sgv
->num_thunks
&& !(sym
->Flags
& SYMFLAG_THUNK
))
245 insp
-= sgv
->num_thunks
;
246 memmove(&sgv
->syms
[insp
+ 1], &sgv
->syms
[insp
],
247 sizeof(sgv
->syms
[0]) * sgv
->num_thunks
);
249 if (!fill_sym_lvalue(sym
, sgv
->frame_offset
, &sgv
->syms
[insp
].lvalue
, tmp
, sizeof(tmp
)))
251 dbg_printf("%s: %s\n", sym
->Name
, tmp
);
254 sgv
->syms
[insp
].flags
= sym
->Flags
;
255 sgv
->syms
[insp
].sym_info
= sym
->Index
;
261 enum sym_get_lval
symbol_picker_interactive(const char* name
, const struct sgv_data
* sgv
,
262 struct dbg_lvalue
* rtn
)
267 if (!dbg_interactiveP
)
269 dbg_printf("More than one symbol named %s, picking the first one\n", name
);
270 *rtn
= sgv
->syms
[0].lvalue
;
274 dbg_printf("Many symbols with name '%s', "
275 "choose the one you want (<cr> to abort):\n", name
);
276 for (i
= 0; i
< sgv
->num
; i
++)
278 if (sgv
->num
- sgv
->num_thunks
> 1 && (sgv
->syms
[i
].flags
& SYMFLAG_THUNK
) && !DBG_IVAR(AlwaysShowThunks
))
280 dbg_printf("[%d]: ", i
+ 1);
281 if (sgv
->syms
[i
].flags
& (SYMFLAG_LOCAL
| SYMFLAG_PARAMETER
))
283 dbg_printf("%s %sof %s\n",
284 sgv
->syms
[i
].flags
& SYMFLAG_PARAMETER
? "Parameter" : "Local variable",
285 sgv
->syms
[i
].flags
& (SYMFLAG_REGISTER
|SYMFLAG_REGREL
) ? "(in a register) " : "",
288 else if (sgv
->syms
[i
].flags
& SYMFLAG_THUNK
)
290 print_address(&sgv
->syms
[i
].lvalue
.addr
, TRUE
);
291 /* FIXME: should display where the thunks points to */
292 dbg_printf(" thunk %s\n", name
);
296 print_address(&sgv
->syms
[i
].lvalue
.addr
, TRUE
);
302 if (input_read_line("=> ", buffer
, sizeof(buffer
)))
304 if (buffer
[0] == '\0') return sglv_aborted
;
306 if (i
< 1 || i
> sgv
->num
)
307 dbg_printf("Invalid choice %d\n", i
);
309 else return sglv_aborted
;
310 } while (i
< 1 || i
> sgv
->num
);
312 /* The array is 0-based, but the choices are 1..n,
313 * so we have to subtract one before returning.
315 *rtn
= sgv
->syms
[i
- 1].lvalue
;
319 enum sym_get_lval
symbol_picker_scoped(const char* name
, const struct sgv_data
* sgv
,
320 struct dbg_lvalue
* rtn
)
325 for (i
= 0; i
< sgv
->num
; i
++)
327 if (sgv
->num
- sgv
->num_thunks
> 1 && (sgv
->syms
[i
].flags
& SYMFLAG_THUNK
) && !DBG_IVAR(AlwaysShowThunks
))
329 if (sgv
->syms
[i
].flags
& (SYMFLAG_LOCAL
| SYMFLAG_PARAMETER
))
335 /* FIXME: several locals with same name... which one to pick ?? */
336 dbg_printf("Several local variables/parameters for %s, aborting\n", name
);
343 *rtn
= sgv
->syms
[local
].lvalue
;
346 /* no locals found, multiple globals... abort for now */
347 dbg_printf("Several global variables for %s, aborting\n", name
);
351 symbol_picker_t symbol_current_picker
= symbol_picker_interactive
;
353 /***********************************************************************
356 * Get the address of a named symbol.
358 * sglv_found: if the symbol is found
359 * sglv_unknown: if the symbol isn't found
360 * sglv_aborted: some error occurred (likely, many symbols of same name exist,
361 * and user didn't pick one of them)
363 enum sym_get_lval
symbol_get_lvalue(const char* name
, const int lineno
,
364 struct dbg_lvalue
* rtn
, BOOL bp_disp
)
370 IMAGEHLP_STACK_FRAME ihsf
;
372 if (strlen(name
) + 4 > sizeof(buffer
))
374 WINE_WARN("Too long symbol (%s)\n", name
);
380 sgv
.name
= &buffer
[2];
381 sgv
.do_thunks
= DBG_IVAR(AlwaysShowThunks
);
383 if (strchr(name
, '!'))
385 strcpy(buffer
, name
);
391 strcpy(&buffer
[2], name
);
394 /* this is a wine specific options to return also ELF modules in the
397 opt
= SymSetExtendedOption(SYMOPT_EX_WINE_NATIVE_MODULES
, TRUE
);
398 SymEnumSymbols(dbg_curr_process
->handle
, 0, buffer
, sgv_cb
, (void*)&sgv
);
402 const char* ptr
= strchr(name
, '!');
403 if ((ptr
&& ptr
[1] != '_') || (!ptr
&& *name
!= '_'))
407 int offset
= ptr
- name
;
408 memcpy(buffer
, name
, offset
+ 1);
409 buffer
[offset
+ 1] = '_';
410 strcpy(&buffer
[offset
+ 2], ptr
+ 1);
417 strcpy(&buffer
[3], name
);
419 SymEnumSymbols(dbg_curr_process
->handle
, 0, buffer
, sgv_cb
, (void*)&sgv
);
422 SymSetExtendedOption(SYMOPT_EX_WINE_NATIVE_MODULES
, opt
);
424 /* now grab local symbols */
425 if (stack_get_current_frame(&ihsf
) && sgv
.num
< NUMDBGV
)
427 sgv
.frame_offset
= ihsf
.FrameOffset
;
428 SymEnumSymbols(dbg_curr_process
->handle
, 0, name
, sgv_cb
, (void*)&sgv
);
433 dbg_printf("No symbols found for %s\n", name
);
437 /* recompute potential offsets for functions (linenumber, skip prolog) */
438 for (i
= 0; i
< sgv
.num
; i
++)
440 if (sgv
.syms
[i
].flags
& (SYMFLAG_REGISTER
|SYMFLAG_REGREL
|SYMFLAG_LOCAL
|SYMFLAG_THUNK
))
445 struct dbg_type type
;
448 type
.module
= sgv
.syms
[i
].lvalue
.type
.module
;
449 type
.id
= sgv
.syms
[i
].sym_info
;
450 if (bp_disp
&& symbol_get_debug_start(&type
, &addr
))
451 sgv
.syms
[i
].lvalue
.addr
.Offset
= addr
;
459 il
.SizeOfStruct
= sizeof(il
);
460 SymGetLineFromAddr64(dbg_curr_process
->handle
,
461 (DWORD_PTR
)memory_to_linear_addr(&sgv
.syms
[i
].lvalue
.addr
),
465 if (lineno
== il
.LineNumber
)
467 sgv
.syms
[i
].lvalue
.addr
.Offset
= il
.Address
;
471 } while (SymGetLineNext64(dbg_curr_process
->handle
, &il
));
473 WINE_FIXME("No line (%d) found for %s (setting to symbol start)\n",
478 if (sgv
.num
- sgv
.num_thunks
> 1 || /* many symbols non thunks (and showing only non thunks) */
479 (sgv
.num
> 1 && DBG_IVAR(AlwaysShowThunks
)) || /* many symbols (showing symbols & thunks) */
480 (sgv
.num
== sgv
.num_thunks
&& sgv
.num_thunks
> 1))
482 return symbol_current_picker(name
, &sgv
, rtn
);
484 /* first symbol is the one we want:
485 * - only one symbol found,
486 * - or many symbols but only one non thunk when AlwaysShowThunks is FALSE
488 *rtn
= sgv
.syms
[0].lvalue
;
492 BOOL
symbol_is_local(const char* name
)
495 IMAGEHLP_STACK_FRAME ihsf
;
500 sgv
.do_thunks
= FALSE
;
502 if (stack_get_current_frame(&ihsf
))
504 sgv
.frame_offset
= ihsf
.FrameOffset
;
505 SymEnumSymbols(dbg_curr_process
->handle
, 0, name
, sgv_cb
, (void*)&sgv
);
510 /***********************************************************************
511 * symbol_read_symtable
513 * Read a symbol file into the hash table.
515 void symbol_read_symtable(const char* filename
, unsigned long offset
)
517 dbg_printf("No longer supported\n");
520 /* FIXME: have to implement SymAddSymbol in dbghelp, but likely we'll need to link
521 * this with an already loaded module !!
530 if (!(symbolfile
= fopen(filename
, "r")))
532 WINE_WARN("Unable to open symbol table %s\n", filename
);
536 dbg_printf("Reading symbols from file %s\n", filename
);
540 fgets(buffer
, sizeof(buffer
), symbolfile
);
541 if (feof(symbolfile
)) break;
543 /* Strip any text after a # sign (i.e. comments) */
544 cpnt
= strchr(buffer
, '#');
545 if (cpnt
) *cpnt
= '\0';
547 /* Quietly ignore any lines that have just whitespace */
548 for (cpnt
= buffer
; *cpnt
; cpnt
++)
550 if (*cpnt
!= ' ' && *cpnt
!= '\t') break;
552 if (!*cpnt
|| *cpnt
== '\n') continue;
554 if (sscanf(buffer
, "%lx %c %s", &addr
, &type
, name
) == 3)
556 if (value
.addr
.off
+ offset
< value
.addr
.off
)
557 WINE_WARN("Address wrap around\n");
558 value
.addr
.off
+= offset
;
559 SymAddSymbol(current_process
->handle
, BaseOfDll
,
567 /***********************************************************************
568 * symbol_get_function_line_status
570 * Find the symbol nearest to a given address.
572 enum dbg_line_status
symbol_get_function_line_status(const ADDRESS64
* addr
)
576 ULONG64 disp64
, start
;
577 DWORD_PTR lin
= (DWORD_PTR
)memory_to_linear_addr(addr
);
578 char buffer
[sizeof(SYMBOL_INFO
) + 256];
579 SYMBOL_INFO
* sym
= (SYMBOL_INFO
*)buffer
;
580 struct dbg_type func
;
582 il
.SizeOfStruct
= sizeof(il
);
583 sym
->SizeOfStruct
= sizeof(SYMBOL_INFO
);
584 sym
->MaxNameLen
= sizeof(buffer
) - sizeof(SYMBOL_INFO
);
586 /* do we have some info for lin address ? */
587 if (!SymFromAddr(dbg_curr_process
->handle
, lin
, &disp64
, sym
))
590 /* some compilers insert thunks in their code without debug info associated
591 * take care of this situation
593 if (dbg_curr_process
->be_cpu
->is_jump((void*)lin
, &jumpee
))
594 return symbol_get_function_line_status(&jumpee
);
595 return dbg_no_line_info
;
601 /* FIXME: so far dbghelp doesn't return the 16 <=> 32 thunks
602 * and furthermore, we no longer take care of them !!!
604 return dbg_in_a_thunk
;
606 case SymTagPublicSymbol
: break;
608 WINE_FIXME("Unexpected sym-tag 0x%08x\n", sym
->Tag
);
610 return dbg_no_line_info
;
612 /* we should have a function now */
613 if (!SymGetLineFromAddr64(dbg_curr_process
->handle
, lin
, &disp
, &il
))
614 return dbg_no_line_info
;
616 func
.module
= sym
->ModBase
;
617 func
.id
= sym
->Index
;
619 if (symbol_get_debug_start(&func
, &start
) && lin
< start
)
620 return dbg_not_on_a_line_number
;
622 if (!sym
->Size
) sym
->Size
= 0x100000;
623 if (il
.FileName
&& il
.FileName
[0] && disp
< sym
->Size
)
624 return (disp
== 0) ? dbg_on_a_line_number
: dbg_not_on_a_line_number
;
626 return dbg_no_line_info
;
629 /***********************************************************************
632 * Find the symbol nearest to a given address.
633 * Returns sourcefile name and line number in a format that the listing
634 * handler can deal with.
636 BOOL
symbol_get_line(const char* filename
, const char* name
,
637 IMAGEHLP_LINE64
* line
)
648 sgv
.name
= &buffer
[2];
649 sgv
.do_thunks
= FALSE
;
653 strcpy(&buffer
[2], name
);
655 /* this is a wine specific options to return also ELF modules in the
658 opt
= SymSetExtendedOption(SYMOPT_EX_WINE_NATIVE_MODULES
, TRUE
);
659 if (!SymEnumSymbols(dbg_curr_process
->handle
, 0, buffer
, sgv_cb
, (void*)&sgv
))
661 SymSetExtendedOption(SYMOPT_EX_WINE_NATIVE_MODULES
, opt
);
665 if (!sgv
.num
&& (name
[0] != '_'))
668 strcpy(&buffer
[3], name
);
669 if (!SymEnumSymbols(dbg_curr_process
->handle
, 0, buffer
, sgv_cb
, (void*)&sgv
))
671 SymSetExtendedOption(SYMOPT_EX_WINE_NATIVE_MODULES
, opt
);
675 SymSetExtendedOption(SYMOPT_EX_WINE_NATIVE_MODULES
, opt
);
677 for (i
= 0; i
< sgv
.num
; i
++)
679 DWORD_PTR linear
= (DWORD_PTR
)memory_to_linear_addr(&sgv
.syms
[i
].lvalue
.addr
);
681 il
.SizeOfStruct
= sizeof(il
);
682 if (!SymGetLineFromAddr64(dbg_curr_process
->handle
, linear
, &disp
, &il
))
684 if (filename
&& strcmp(il
.FileName
, filename
)) continue;
687 WINE_FIXME("Several found, returning first (may not be what you want)...\n");
695 if (filename
) dbg_printf("No such function %s in %s\n", name
, filename
);
696 else dbg_printf("No such function %s\n", name
);
702 /******************************************************************
706 * <name>=<value> in non detailed form
707 * <name>=<value> (local|pmt <where>) in detailed form
708 * Note <value> can be an error message in case of error
710 void symbol_print_local(const SYMBOL_INFO
* sym
, DWORD_PTR base
, BOOL detailed
)
712 struct dbg_lvalue lvalue
;
715 dbg_printf("%s=", sym
->Name
);
717 if (fill_sym_lvalue(sym
, base
, &lvalue
, buffer
, sizeof(buffer
)))
719 print_value(&lvalue
, 0, 1);
721 dbg_printf(" (%s %s)",
722 (sym
->Flags
& SYMFLAG_PARAMETER
) ? "parameter" : "local",
727 dbg_printf("%s", buffer
);
730 (sym
->Flags
& SYMFLAG_PARAMETER
) ? "parameter" : "local");
734 static BOOL CALLBACK
info_locals_cb(PSYMBOL_INFO sym
, ULONG size
, PVOID ctx
)
736 struct dbg_type type
;
739 type
.module
= sym
->ModBase
;
740 type
.id
= sym
->TypeIndex
;
741 types_print_type(&type
, FALSE
);
744 symbol_print_local(sym
, (DWORD_PTR
)ctx
, TRUE
);
750 BOOL
symbol_info_locals(void)
752 IMAGEHLP_STACK_FRAME ihsf
;
755 stack_get_current_frame(&ihsf
);
756 addr
.Mode
= AddrModeFlat
;
757 addr
.Offset
= ihsf
.InstructionOffset
;
758 print_address(&addr
, FALSE
);
759 dbg_printf(": (%08lx)\n", (DWORD_PTR
)ihsf
.FrameOffset
);
760 SymEnumSymbols(dbg_curr_process
->handle
, 0, NULL
, info_locals_cb
, (void*)(DWORD_PTR
)ihsf
.FrameOffset
);
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("%08lx: %s!%s", (ULONG_PTR
)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
);
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
);