ReactOS  0.4.15-dev-1197-g8081ba9
symbol.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <sys/types.h>
#include <assert.h>
#include "wine/debug.h"
#include "dbghelp_private.h"
#include "winnls.h"
Include dependency graph for symbol.c:

Go to the source code of this file.

Classes

struct  sym_enum
 
struct  sym_enumW
 
struct  sym_enumerate
 
struct  sym_enumerate64
 

Macros

#define NONAMELESSUNION
 
#define WILDCHAR(x)   (-(x))
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (dbghelp)
 
 WINE_DECLARE_DEBUG_CHANNEL (dbghelp_symt)
 
static int cmp_addr (ULONG64 a1, ULONG64 a2)
 
static int cmp_sorttab_addr (struct module *module, int idx, ULONG64 addr)
 
int __cdecl symt_cmp_addr (const void *p1, const void *p2)
 
DWORD symt_ptr2index (struct module *module, const struct symt *sym)
 
struct symtsymt_index2ptr (struct module *module, DWORD id)
 
static BOOL symt_grow_sorttab (struct module *module, unsigned sz)
 
static void symt_add_module_ht (struct module *module, struct symt_ht *ht)
 
static WCHARfile_regex (const char *srcfile)
 
struct symt_compilandsymt_new_compiland (struct module *module, ULONG_PTR address, unsigned src_idx)
 
struct symt_publicsymt_new_public (struct module *module, struct symt_compiland *compiland, const char *name, BOOL is_function, ULONG_PTR address, unsigned size)
 
struct symt_datasymt_new_global_variable (struct module *module, struct symt_compiland *compiland, const char *name, unsigned is_static, struct location loc, ULONG_PTR size, struct symt *type)
 
struct symt_functionsymt_new_function (struct module *module, struct symt_compiland *compiland, const char *name, ULONG_PTR addr, ULONG_PTR size, struct symt *sig_type)
 
void symt_add_func_line (struct module *module, struct symt_function *func, unsigned source_idx, int line_num, ULONG_PTR offset)
 
struct symt_datasymt_add_func_local (struct module *module, struct symt_function *func, enum DataKind dt, const struct location *loc, struct symt_block *block, struct symt *type, const char *name)
 
struct symt_blocksymt_open_func_block (struct module *module, struct symt_function *func, struct symt_block *parent_block, unsigned pc, unsigned len)
 
struct symt_blocksymt_close_func_block (struct module *module, const struct symt_function *func, struct symt_block *block, unsigned pc)
 
struct symt_hierarchy_pointsymt_add_function_point (struct module *module, struct symt_function *func, enum SymTagEnum point, const struct location *loc, const char *name)
 
BOOL symt_normalize_function (struct module *module, const struct symt_function *func)
 
struct symt_thunksymt_new_thunk (struct module *module, struct symt_compiland *compiland, const char *name, THUNK_ORDINAL ord, ULONG_PTR addr, ULONG_PTR size)
 
struct symt_datasymt_new_constant (struct module *module, struct symt_compiland *compiland, const char *name, struct symt *type, const VARIANT *v)
 
struct symt_hierarchy_pointsymt_new_label (struct module *module, struct symt_compiland *compiland, const char *name, ULONG_PTR address)
 
static void symt_fill_sym_info (struct module_pair *pair, const struct symt_function *func, const struct symt *sym, SYMBOL_INFO *sym_info)
 
static BOOL send_symbol (const struct sym_enum *se, struct module_pair *pair, const struct symt_function *func, const struct symt *sym)
 
static BOOL symt_enum_module (struct module_pair *pair, const WCHAR *match, const struct sym_enum *se)
 
static unsigned where_to_insert (struct module *module, unsigned high, const struct symt_ht *elt)
 
static BOOL resort_symbols (struct module *module)
 
static void symt_get_length (struct module *module, const struct symt *symt, ULONG64 *size)
 
static int symt_get_best_at (struct module *module, int idx_sorttab)
 
struct symt_htsymt_find_nearest (struct module *module, DWORD_PTR addr)
 
static BOOL symt_enum_locals_helper (struct module_pair *pair, const WCHAR *match, const struct sym_enum *se, struct symt_function *func, const struct vector *v)
 
static BOOL symt_enum_locals (struct process *pcs, const WCHAR *mask, const struct sym_enum *se)
 
void copy_symbolW (SYMBOL_INFOW *siw, const SYMBOL_INFO *si)
 
static BOOL sym_enum (HANDLE hProcess, ULONG64 BaseOfDll, PCWSTR Mask, const struct sym_enum *se)
 
static BOOL doSymEnumSymbols (HANDLE hProcess, ULONG64 BaseOfDll, PCWSTR Mask, PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback, PVOID UserContext)
 
BOOL WINAPI SymEnumSymbols (HANDLE hProcess, ULONG64 BaseOfDll, PCSTR Mask, PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback, PVOID UserContext)
 
static BOOL CALLBACK sym_enumW (PSYMBOL_INFO si, ULONG size, PVOID ctx)
 
BOOL WINAPI SymEnumSymbolsW (HANDLE hProcess, ULONG64 BaseOfDll, PCWSTR Mask, PSYM_ENUMERATESYMBOLS_CALLBACKW EnumSymbolsCallback, PVOID UserContext)
 
static BOOL CALLBACK sym_enumerate_cb (PSYMBOL_INFO syminfo, ULONG size, void *ctx)
 
BOOL WINAPI SymEnumerateSymbols (HANDLE hProcess, DWORD BaseOfDll, PSYM_ENUMSYMBOLS_CALLBACK EnumSymbolsCallback, PVOID UserContext)
 
static BOOL CALLBACK sym_enumerate_cb64 (PSYMBOL_INFO syminfo, ULONG size, void *ctx)
 
BOOL WINAPI SymEnumerateSymbols64 (HANDLE hProcess, DWORD64 BaseOfDll, PSYM_ENUMSYMBOLS_CALLBACK64 EnumSymbolsCallback, PVOID UserContext)
 
BOOL WINAPI SymFromAddr (HANDLE hProcess, DWORD64 Address, DWORD64 *Displacement, PSYMBOL_INFO Symbol)
 
BOOL WINAPI SymFromAddrW (HANDLE hProcess, DWORD64 Address, DWORD64 *Displacement, PSYMBOL_INFOW Symbol)
 
BOOL WINAPI SymGetSymFromAddr (HANDLE hProcess, DWORD Address, PDWORD Displacement, PIMAGEHLP_SYMBOL Symbol)
 
BOOL WINAPI SymGetSymFromAddr64 (HANDLE hProcess, DWORD64 Address, PDWORD64 Displacement, PIMAGEHLP_SYMBOL64 Symbol)
 
static BOOL find_name (struct process *pcs, struct module *module, const char *name, SYMBOL_INFO *symbol)
 
BOOL WINAPI SymFromName (HANDLE hProcess, PCSTR Name, PSYMBOL_INFO Symbol)
 
BOOL WINAPI SymGetSymFromName64 (HANDLE hProcess, PCSTR Name, PIMAGEHLP_SYMBOL64 Symbol)
 
BOOL WINAPI SymGetSymFromName (HANDLE hProcess, PCSTR Name, PIMAGEHLP_SYMBOL Symbol)
 
BOOL symt_fill_func_line_info (const struct module *module, const struct symt_function *func, DWORD64 addr, IMAGEHLP_LINE64 *line)
 
BOOL WINAPI SymGetSymNext64 (HANDLE hProcess, PIMAGEHLP_SYMBOL64 Symbol)
 
BOOL WINAPI SymGetSymNext (HANDLE hProcess, PIMAGEHLP_SYMBOL Symbol)
 
BOOL WINAPI SymGetSymPrev64 (HANDLE hProcess, PIMAGEHLP_SYMBOL64 Symbol)
 
BOOL WINAPI SymGetSymPrev (HANDLE hProcess, PIMAGEHLP_SYMBOL Symbol)
 
static void copy_line_64_from_32 (IMAGEHLP_LINE64 *l64, const IMAGEHLP_LINE *l32)
 
static void copy_line_W64_from_64 (struct process *pcs, IMAGEHLP_LINEW64 *l64w, const IMAGEHLP_LINE64 *l64)
 
static void copy_line_32_from_64 (IMAGEHLP_LINE *l32, const IMAGEHLP_LINE64 *l64)
 
BOOL WINAPI SymGetLineFromAddr (HANDLE hProcess, DWORD dwAddr, PDWORD pdwDisplacement, PIMAGEHLP_LINE Line)
 
BOOL WINAPI SymGetLineFromAddr64 (HANDLE hProcess, DWORD64 dwAddr, PDWORD pdwDisplacement, PIMAGEHLP_LINE64 Line)
 
BOOL WINAPI SymGetLineFromAddrW64 (HANDLE hProcess, DWORD64 dwAddr, PDWORD pdwDisplacement, PIMAGEHLP_LINEW64 Line)
 
BOOL WINAPI SymGetLinePrev64 (HANDLE hProcess, PIMAGEHLP_LINE64 Line)
 
BOOL WINAPI SymGetLinePrev (HANDLE hProcess, PIMAGEHLP_LINE Line)
 
BOOL symt_get_func_line_next (const struct module *module, PIMAGEHLP_LINE64 line)
 
BOOL WINAPI SymGetLineNext64 (HANDLE hProcess, PIMAGEHLP_LINE64 Line)
 
BOOL WINAPI SymGetLineNext (HANDLE hProcess, PIMAGEHLP_LINE Line)
 
BOOL WINAPI SymUnDName (PIMAGEHLP_SYMBOL sym, PSTR UnDecName, DWORD UnDecNameLength)
 
BOOL WINAPI SymUnDName64 (PIMAGEHLP_SYMBOL64 sym, PSTR UnDecName, DWORD UnDecNameLength)
 
static void *CDECL und_alloc (size_t len)
 
static void CDECL und_free (void *ptr)
 
static charund_name (char *buffer, const char *mangled, int buflen, unsigned short flags)
 
DWORD WINAPI UnDecorateSymbolName (const char *decorated_name, char *undecorated_name, DWORD undecorated_length, DWORD flags)
 
DWORD WINAPI UnDecorateSymbolNameW (const WCHAR *decorated_name, WCHAR *undecorated_name, DWORD undecorated_length, DWORD flags)
 
static int re_fetch_char (const WCHAR **re)
 
static int re_match_char (WCHAR ch1, WCHAR ch2, BOOL _case)
 
static const WCHARre_match_one (const WCHAR *string, const WCHAR *elt, BOOL _case)
 
static BOOL re_match_multi (const WCHAR **pstring, const WCHAR **pre, BOOL _case)
 
BOOL WINAPI SymMatchStringA (PCSTR string, PCSTR re, BOOL _case)
 
BOOL WINAPI SymMatchStringW (PCWSTR string, PCWSTR re, BOOL _case)
 
static BOOL doSymSearch (HANDLE hProcess, ULONG64 BaseOfDll, DWORD Index, DWORD SymTag, PCWSTR Mask, DWORD64 Address, PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback, PVOID UserContext, DWORD Options)
 
BOOL WINAPI SymSearch (HANDLE hProcess, ULONG64 BaseOfDll, DWORD Index, DWORD SymTag, PCSTR Mask, DWORD64 Address, PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback, PVOID UserContext, DWORD Options)
 
BOOL WINAPI SymSearchW (HANDLE hProcess, ULONG64 BaseOfDll, DWORD Index, DWORD SymTag, PCWSTR Mask, DWORD64 Address, PSYM_ENUMERATESYMBOLS_CALLBACKW EnumSymbolsCallback, PVOID UserContext, DWORD Options)
 
BOOL WINAPI SymAddSymbol (HANDLE hProcess, ULONG64 BaseOfDll, PCSTR name, DWORD64 addr, DWORD size, DWORD flags)
 
BOOL WINAPI SymAddSymbolW (HANDLE hProcess, ULONG64 BaseOfDll, PCWSTR name, DWORD64 addr, DWORD size, DWORD flags)
 
BOOL WINAPI SymSetScopeFromAddr (HANDLE hProcess, ULONG64 addr)
 
BOOL WINAPI SymEnumLines (HANDLE hProcess, ULONG64 base, PCSTR compiland, PCSTR srcfile, PSYM_ENUMLINES_CALLBACK cb, PVOID user)
 
BOOL WINAPI SymGetLineFromName (HANDLE hProcess, PCSTR ModuleName, PCSTR FileName, DWORD dwLineNumber, PLONG plDisplacement, PIMAGEHLP_LINE Line)
 
BOOL WINAPI SymGetLineFromName64 (HANDLE hProcess, PCSTR ModuleName, PCSTR FileName, DWORD dwLineNumber, PLONG lpDisplacement, PIMAGEHLP_LINE64 Line)
 
BOOL WINAPI SymGetLineFromNameW64 (HANDLE hProcess, PCWSTR ModuleName, PCWSTR FileName, DWORD dwLineNumber, PLONG plDisplacement, PIMAGEHLP_LINEW64 Line)
 
BOOL WINAPI SymFromIndex (HANDLE hProcess, ULONG64 BaseOfDll, DWORD index, PSYMBOL_INFO symbol)
 
BOOL WINAPI SymFromIndexW (HANDLE hProcess, ULONG64 BaseOfDll, DWORD index, PSYMBOL_INFOW symbol)
 
PCHAR WINAPI SymSetHomeDirectory (HANDLE hProcess, PCSTR dir)
 
PWSTR WINAPI SymSetHomeDirectoryW (HANDLE hProcess, PCWSTR dir)
 

Variables

static const WCHAR starW [] = {'*','\0'}
 

Macro Definition Documentation

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 22 of file symbol.c.

◆ WILDCHAR

#define WILDCHAR (   x)    (-(x))

Definition at line 1877 of file symbol.c.

Function Documentation

◆ cmp_addr()

static int cmp_addr ( ULONG64  a1,
ULONG64  a2 
)
inlinestatic

Definition at line 43 of file symbol.c.

44 {
45  if (a1 > a2) return 1;
46  if (a1 < a2) return -1;
47  return 0;
48 }
static const struct update_accum a2
Definition: msg.c:586
static const struct update_accum a1
Definition: msg.c:578

Referenced by cmp_sorttab_addr(), and symt_cmp_addr().

◆ cmp_sorttab_addr()

static int cmp_sorttab_addr ( struct module module,
int  idx,
ULONG64  addr 
)
inlinestatic

Definition at line 50 of file symbol.c.

51 {
52  ULONG64 ref;
54  return cmp_addr(ref, addr);
55 }
BOOL symt_get_address(const struct symt *type, ULONG64 *addr) DECLSPEC_HIDDEN
Definition: type.c:119
static int cmp_addr(ULONG64 a1, ULONG64 a2)
Definition: symbol.c:43
Definition: send.c:48
GLenum GLint ref
Definition: glext.h:6028
unsigned int idx
Definition: utils.c:41
unsigned __int64 ULONG64
Definition: imports.h:198
GLenum const GLvoid * addr
Definition: glext.h:9621
struct symt_ht ** addr_sorttab

Referenced by symt_find_nearest(), symt_get_best_at(), and where_to_insert().

◆ copy_line_32_from_64()

static void copy_line_32_from_64 ( IMAGEHLP_LINE l32,
const IMAGEHLP_LINE64 l64 
)
static

Definition at line 1601 of file symbol.c.

1603 {
1604  l32->Key = l64->Key;
1605  l32->LineNumber = l64->LineNumber;
1606  l32->FileName = l64->FileName;
1607  l32->Address = l64->Address;
1608 }
DWORD LineNumber
Definition: compat.h:1269
PCHAR FileName
Definition: compat.h:846
DWORD Address
Definition: compat.h:1271
DWORD LineNumber
Definition: compat.h:845
PCHAR FileName
Definition: compat.h:1270
DWORD64 Address
Definition: compat.h:847

Referenced by SymGetLineFromAddr(), SymGetLineNext(), and SymGetLinePrev().

◆ copy_line_64_from_32()

static void copy_line_64_from_32 ( IMAGEHLP_LINE64 l64,
const IMAGEHLP_LINE l32 
)
static

Definition at line 1572 of file symbol.c.

1574 {
1575  l64->Key = l32->Key;
1576  l64->LineNumber = l32->LineNumber;
1577  l64->FileName = l32->FileName;
1578  l64->Address = l32->Address;
1579 }
DWORD LineNumber
Definition: compat.h:1269
PCHAR FileName
Definition: compat.h:846
DWORD Address
Definition: compat.h:1271
DWORD LineNumber
Definition: compat.h:845
PCHAR FileName
Definition: compat.h:1270
DWORD64 Address
Definition: compat.h:847

Referenced by SymGetLineNext(), and SymGetLinePrev().

◆ copy_line_W64_from_64()

static void copy_line_W64_from_64 ( struct process pcs,
IMAGEHLP_LINEW64 l64w,
const IMAGEHLP_LINE64 l64 
)
static

Definition at line 1585 of file symbol.c.

1586 {
1587  unsigned len;
1588 
1589  l64w->Key = l64->Key;
1590  l64w->LineNumber = l64->LineNumber;
1591  len = MultiByteToWideChar(CP_ACP, 0, l64->FileName, -1, NULL, 0);
1592  if ((l64w->FileName = fetch_buffer(pcs, len * sizeof(WCHAR))))
1593  MultiByteToWideChar(CP_ACP, 0, l64->FileName, -1, l64w->FileName, len);
1594  l64w->Address = l64->Address;
1595 }
DWORD LineNumber
Definition: compat.h:1287
#define CP_ACP
Definition: compat.h:109
PCHAR FileName
Definition: compat.h:846
smooth NULL
Definition: ftsmooth.c:416
void * fetch_buffer(struct process *pcs, unsigned size)
Definition: dbghelp.c:128
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLenum GLsizei len
Definition: glext.h:6722
DWORD LineNumber
Definition: compat.h:845
#define MultiByteToWideChar
Definition: compat.h:110
DWORD64 Address
Definition: compat.h:847
DWORD64 Address
Definition: compat.h:1289

Referenced by SymGetLineFromAddrW64().

◆ copy_symbolW()

void copy_symbolW ( SYMBOL_INFOW siw,
const SYMBOL_INFO si 
)

Definition at line 1029 of file symbol.c.

1030 {
1031  siw->SizeOfStruct = si->SizeOfStruct;
1032  siw->TypeIndex = si->TypeIndex;
1033  siw->Reserved[0] = si->Reserved[0];
1034  siw->Reserved[1] = si->Reserved[1];
1035  siw->Index = si->Index;
1036  siw->Size = si->Size;
1037  siw->ModBase = si->ModBase;
1038  siw->Flags = si->Flags;
1039  siw->Value = si->Value;
1040  siw->Address = si->Address;
1041  siw->Register = si->Register;
1042  siw->Scope = si->Scope;
1043  siw->Tag = si->Tag;
1044  siw->NameLen = si->NameLen;
1045  siw->MaxNameLen = si->MaxNameLen;
1046  MultiByteToWideChar(CP_ACP, 0, si->Name, -1, siw->Name, siw->MaxNameLen);
1047 }
ULONG Tag
Definition: compat.h:797
CHAR Name[1]
Definition: compat.h:800
ULONG NameLen
Definition: compat.h:798
ULONG64 Address
Definition: compat.h:1114
ULONG MaxNameLen
Definition: compat.h:799
ULONG MaxNameLen
Definition: compat.h:1119
ULONG64 ModBase
Definition: compat.h:1111
#define CP_ACP
Definition: compat.h:109
ULONG Scope
Definition: compat.h:796
ULONG Flags
Definition: compat.h:792
ULONG TypeIndex
Definition: compat.h:787
ULONG64 Address
Definition: compat.h:794
ULONG NameLen
Definition: compat.h:1118
ULONG64 Reserved[2]
Definition: compat.h:788
ULONG64 Reserved[2]
Definition: compat.h:1108
ULONG SizeOfStruct
Definition: compat.h:1106
ULONG Scope
Definition: compat.h:1116
ULONG64 ModBase
Definition: compat.h:791
ULONG Index
Definition: compat.h:789
ULONG64 Value
Definition: compat.h:1113
ULONG Index
Definition: compat.h:1109
ULONG Flags
Definition: compat.h:1112
ULONG SizeOfStruct
Definition: compat.h:786
ULONG Register
Definition: compat.h:795
ULONG TypeIndex
Definition: compat.h:1107
#define MultiByteToWideChar
Definition: compat.h:110
WCHAR Name[1]
Definition: compat.h:1120
ULONG Register
Definition: compat.h:1115
ULONG64 Value
Definition: compat.h:793
ULONG Tag
Definition: compat.h:1117
ULONG Size
Definition: compat.h:790
ULONG Size
Definition: compat.h:1110

Referenced by enum_types_AtoW(), sym_enumW(), and SymFromAddrW().

◆ doSymEnumSymbols()

static BOOL doSymEnumSymbols ( HANDLE  hProcess,
ULONG64  BaseOfDll,
PCWSTR  Mask,
PSYM_ENUMERATESYMBOLS_CALLBACK  EnumSymbolsCallback,
PVOID  UserContext 
)
inlinestatic

Definition at line 1120 of file symbol.c.

1123 {
1124  struct sym_enum se;
1125 
1126  se.cb = EnumSymbolsCallback;
1127  se.user = UserContext;
1128  se.index = 0;
1129  se.tag = 0;
1130  se.addr = 0;
1131  se.sym_info = (PSYMBOL_INFO)se.buffer;
1132 
1133  return sym_enum(hProcess, BaseOfDll, Mask, &se);
1134 }
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
struct _SYMBOL_INFO * PSYMBOL_INFO
PSYM_ENUMERATESYMBOLS_CALLBACK cb
Definition: symbol.c:742

Referenced by SymEnumSymbols(), and SymEnumSymbolsW().

◆ doSymSearch()

static BOOL doSymSearch ( HANDLE  hProcess,
ULONG64  BaseOfDll,
DWORD  Index,
DWORD  SymTag,
PCWSTR  Mask,
DWORD64  Address,
PSYM_ENUMERATESYMBOLS_CALLBACK  EnumSymbolsCallback,
PVOID  UserContext,
DWORD  Options 
)
inlinestatic

Definition at line 2050 of file symbol.c.

2054 {
2055  struct sym_enum se;
2056 
2058  {
2059  FIXME("Unsupported searching with options (%x)\n", Options);
2061  return FALSE;
2062  }
2063 
2064  se.cb = EnumSymbolsCallback;
2065  se.user = UserContext;
2066  se.index = Index;
2067  se.tag = SymTag;
2068  se.addr = Address;
2069  se.sym_info = (PSYMBOL_INFO)se.buffer;
2070 
2071  return sym_enum(hProcess, BaseOfDll, Mask, &se);
2072 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
enum OPTION_FLAGS Options
Definition: stats.c:44
#define SYMSEARCH_GLOBALSONLY
Definition: compat.h:772
struct _SYMBOL_INFO * PSYMBOL_INFO
#define FALSE
Definition: types.h:117
#define FIXME(fmt,...)
Definition: debug.h:111
static WCHAR Address[46]
Definition: ping.c:68
static const UCHAR Index[8]
Definition: usbohci.c:18
#define SetLastError(x)
Definition: compat.h:500

Referenced by SymSearch(), and SymSearchW().

◆ file_regex()

static WCHAR* file_regex ( const char srcfile)
static

Definition at line 159 of file symbol.c.

160 {
161  WCHAR* mask;
162  WCHAR* p;
163 
164  if (!srcfile || !*srcfile)
165  {
166  if (!(p = mask = HeapAlloc(GetProcessHeap(), 0, 3 * sizeof(WCHAR)))) return NULL;
167  *p++ = '?';
168  *p++ = '#';
169  }
170  else
171  {
172  DWORD sz = MultiByteToWideChar(CP_ACP, 0, srcfile, -1, NULL, 0);
173  WCHAR* srcfileW;
174 
175  /* FIXME: we use here the largest conversion for every char... could be optimized */
176  p = mask = HeapAlloc(GetProcessHeap(), 0, (5 * strlen(srcfile) + 1 + sz) * sizeof(WCHAR));
177  if (!mask) return NULL;
178  srcfileW = mask + 5 * strlen(srcfile) + 1;
179  MultiByteToWideChar(CP_ACP, 0, srcfile, -1, srcfileW, sz);
180 
181  while (*srcfileW)
182  {
183  switch (*srcfileW)
184  {
185  case '\\':
186  case '/':
187  *p++ = '[';
188  *p++ = '\\';
189  *p++ = '\\';
190  *p++ = '/';
191  *p++ = ']';
192  break;
193  case '.':
194  *p++ = '?';
195  break;
196  default:
197  *p++ = *srcfileW;
198  break;
199  }
200  srcfileW++;
201  }
202  }
203  *p = 0;
204  return mask;
205 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define CP_ACP
Definition: compat.h:109
GLenum GLint GLuint mask
Definition: glext.h:6028
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:484
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
#define MultiByteToWideChar
Definition: compat.h:110
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by SymEnumLines().

◆ find_name()

static BOOL find_name ( struct process pcs,
struct module module,
const char name,
SYMBOL_INFO symbol 
)
static

Definition at line 1362 of file symbol.c.

1364 {
1365  struct hash_table_iter hti;
1366  void* ptr;
1367  struct symt_ht* sym = NULL;
1368  struct module_pair pair;
1369 
1370  pair.pcs = pcs;
1371  if (!(pair.requested = module)) return FALSE;
1372  if (!module_get_debug(&pair)) return FALSE;
1373 
1374  hash_table_iter_init(&pair.effective->ht_symbols, &hti, name);
1375  while ((ptr = hash_table_iter_up(&hti)))
1376  {
1377  sym = CONTAINING_RECORD(ptr, struct symt_ht, hash_elt);
1378 
1379  if (!strcmp(sym->hash_elt.name, name))
1380  {
1381  symt_fill_sym_info(&pair, NULL, &sym->symt, symbol);
1382  return TRUE;
1383  }
1384  }
1385  return FALSE;
1386 
1387 }
struct hash_table_elt hash_elt
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static PVOID ptr
Definition: dispmode.c:27
void hash_table_iter_init(const struct hash_table *ht, struct hash_table_iter *hti, const char *name) DECLSPEC_HIDDEN
Definition: storage.c:405
smooth NULL
Definition: ftsmooth.c:416
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
BOOL module_get_debug(struct module_pair *) DECLSPEC_HIDDEN
Definition: module.c:374
static void symt_fill_sym_info(struct module_pair *pair, const struct symt_function *func, const struct symt *sym, SYMBOL_INFO *sym_info)
Definition: symbol.c:582
struct symt symt
struct process * pcs
void * hash_table_iter_up(struct hash_table_iter *hti) DECLSPEC_HIDDEN
Definition: storage.c:422
Definition: _pair.h:47
Definition: name.c:38
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469

Referenced by SymFromName().

◆ re_fetch_char()

static int re_fetch_char ( const WCHAR **  re)
static

Definition at line 1879 of file symbol.c.

1880 {
1881  switch (**re)
1882  {
1883  case '\\': (*re)++; return *(*re)++;
1884  case '*': case '[': case '?': case '+': case '#': case ']': return WILDCHAR(*(*re)++);
1885  default: return *(*re)++;
1886  }
1887 }
#define WILDCHAR(x)
Definition: symbol.c:1877

Referenced by re_match_multi(), and re_match_one().

◆ re_match_char()

static int re_match_char ( WCHAR  ch1,
WCHAR  ch2,
BOOL  _case 
)
inlinestatic

Definition at line 1889 of file symbol.c.

1890 {
1891  return _case ? ch1 - ch2 : towupper(ch1) - towupper(ch2);
1892 }
#define towupper(c)
Definition: wctype.h:99

Referenced by re_match_one().

◆ re_match_multi()

static BOOL re_match_multi ( const WCHAR **  pstring,
const WCHAR **  pre,
BOOL  _case 
)
static

Definition at line 1942 of file symbol.c.

1943 {
1944  const WCHAR* re_end = *pre;
1945  const WCHAR* string_end = *pstring;
1946  const WCHAR* re_beg;
1947  const WCHAR* string_beg;
1948  const WCHAR* next;
1949  int ch;
1950 
1951  while (*re_end && *string_end)
1952  {
1953  string_beg = string_end;
1954  re_beg = re_end;
1955  switch (ch = re_fetch_char(&re_end))
1956  {
1957  case WILDCHAR(']'): case WILDCHAR('+'): case WILDCHAR('#'): return FALSE;
1958  case WILDCHAR('*'):
1959  /* transform '*' into '?#' */
1960  {static const WCHAR qmW[] = {'?',0}; re_beg = qmW;}
1961  goto closure;
1962  case WILDCHAR('['):
1963  do
1964  {
1965  if (!(ch = re_fetch_char(&re_end))) return FALSE;
1966  } while (ch != WILDCHAR(']'));
1967  /* fall through */
1968  case WILDCHAR('?'):
1969  default:
1970  break;
1971  }
1972 
1973  switch (*re_end)
1974  {
1975  case '+':
1976  if (!(next = re_match_one(string_end, re_beg, _case))) return FALSE;
1977  string_beg++;
1978  /* fall through */
1979  case '#':
1980  re_end++;
1981  closure:
1982  while ((next = re_match_one(string_end, re_beg, _case))) string_end = next;
1983  for ( ; string_end >= string_beg; string_end--)
1984  {
1985  if (re_match_multi(&string_end, &re_end, _case)) goto found;
1986  }
1987  return FALSE;
1988  default:
1989  if (!(next = re_match_one(string_end, re_beg, _case))) return FALSE;
1990  string_end = next;
1991  }
1992  }
1993 
1994  if (*re_end || *string_end) return FALSE;
1995 
1996 found:
1997  *pre = re_end;
1998  *pstring = string_end;
1999  return TRUE;
2000 }
return
Definition: dirsup.c:529
#define TRUE
Definition: types.h:120
static const WCHAR * re_match_one(const WCHAR *string, const WCHAR *elt, BOOL _case)
Definition: symbol.c:1894
#define FALSE
Definition: types.h:117
static int re_fetch_char(const WCHAR **re)
Definition: symbol.c:1879
do
Definition: dirsup.c:1173
__wchar_t WCHAR
Definition: xmlstorage.h:180
static BOOL re_match_multi(const WCHAR **pstring, const WCHAR **pre, BOOL _case)
Definition: symbol.c:1942
static unsigned __int64 next
Definition: rand_nt.c:6
#define WILDCHAR(x)
Definition: symbol.c:1877

Referenced by SymMatchStringW().

◆ re_match_one()

static const WCHAR* re_match_one ( const WCHAR string,
const WCHAR elt,
BOOL  _case 
)
static

Definition at line 1894 of file symbol.c.

1895 {
1896  int ch1, prev = 0;
1897  unsigned state = 0;
1898 
1899  switch (ch1 = re_fetch_char(&elt))
1900  {
1901  default:
1902  return (ch1 >= 0 && re_match_char(*string, ch1, _case) == 0) ? ++string : NULL;
1903  case WILDCHAR('?'): return *string ? ++string : NULL;
1904  case WILDCHAR('*'): assert(0);
1905  case WILDCHAR('['): break;
1906  }
1907 
1908  for (;;)
1909  {
1910  ch1 = re_fetch_char(&elt);
1911  if (ch1 == WILDCHAR(']')) return NULL;
1912  if (state == 1 && ch1 == '-') state = 2;
1913  else
1914  {
1915  if (re_match_char(*string, ch1, _case) == 0) return ++string;
1916  switch (state)
1917  {
1918  case 0:
1919  state = 1;
1920  prev = ch1;
1921  break;
1922  case 1:
1923  state = 0;
1924  break;
1925  case 2:
1926  if (prev >= 0 && ch1 >= 0 && re_match_char(prev, *string, _case) <= 0 &&
1927  re_match_char(*string, ch1, _case) <= 0)
1928  return ++string;
1929  state = 0;
1930  break;
1931  }
1932  }
1933  }
1934 }
return
Definition: dirsup.c:529
static int re_match_char(WCHAR ch1, WCHAR ch2, BOOL _case)
Definition: symbol.c:1889
#define assert(x)
Definition: debug.h:53
smooth NULL
Definition: ftsmooth.c:416
static int re_fetch_char(const WCHAR **re)
Definition: symbol.c:1879
static int state
Definition: maze.c:121
char string[160]
Definition: util.h:11
#define WILDCHAR(x)
Definition: symbol.c:1877

Referenced by re_match_multi().

◆ resort_symbols()

static BOOL resort_symbols ( struct module module)
static

Definition at line 812 of file symbol.c.

813 {
814  int delta;
815 
817  return FALSE;
818 
819  /* we know that set from 0 up to num_sorttab is already sorted
820  * so sort the remaining (new) symbols, and merge the two sets
821  * (unless the first set is empty)
822  */
823  delta = module->num_symbols - module->num_sorttab;
824  qsort(&module->addr_sorttab[module->num_sorttab], delta, sizeof(struct symt_ht*), symt_cmp_addr);
825  if (module->num_sorttab)
826  {
827  int i, ins_idx = module->num_sorttab, prev_ins_idx;
828  static struct symt_ht** tmp;
829  static unsigned num_tmp;
830 
831  if (num_tmp < delta)
832  {
833  static struct symt_ht** new;
834  if (tmp)
835  new = HeapReAlloc(GetProcessHeap(), 0, tmp, delta * sizeof(struct symt_ht*));
836  else
837  new = HeapAlloc(GetProcessHeap(), 0, delta * sizeof(struct symt_ht*));
838  if (!new)
839  {
840  module->num_sorttab = 0;
841  return resort_symbols(module);
842  }
843  tmp = new;
844  num_tmp = delta;
845  }
846  memcpy(tmp, &module->addr_sorttab[module->num_sorttab], delta * sizeof(struct symt_ht*));
847  qsort(tmp, delta, sizeof(struct symt_ht*), symt_cmp_addr);
848 
849  for (i = delta - 1; i >= 0; i--)
850  {
851  prev_ins_idx = ins_idx;
852  ins_idx = where_to_insert(module, ins_idx, tmp[i]);
853  memmove(&module->addr_sorttab[ins_idx + i + 1],
854  &module->addr_sorttab[ins_idx],
855  (prev_ins_idx - ins_idx) * sizeof(struct symt_ht*));
856  module->addr_sorttab[ins_idx + i] = tmp[i];
857  }
858  }
860  return module->sortlist_valid = TRUE;
861 }
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
static BOOL resort_symbols(struct module *module)
Definition: symbol.c:812
int __cdecl symt_cmp_addr(const void *p1, const void *p2)
Definition: symbol.c:57
#define TRUE
Definition: types.h:120
unsigned num_symbols
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define FALSE
Definition: types.h:117
int sortlist_valid
void __cdecl qsort(_Inout_updates_bytes_(_NumOfElements *_SizeOfElements) void *_Base, _In_ size_t _NumOfElements, _In_ size_t _SizeOfElements, _In_ int(__cdecl *_PtFuncCompare)(const void *, const void *))
unsigned num_sorttab
#define GetProcessHeap()
Definition: compat.h:484
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define HeapReAlloc
Definition: compat.h:482
struct symt_ht ** addr_sorttab
IMAGEHLP_MODULEW64 module
static unsigned where_to_insert(struct module *module, unsigned high, const struct symt_ht *elt)
Definition: symbol.c:787

Referenced by symt_find_nearest().

◆ send_symbol()

static BOOL send_symbol ( const struct sym_enum se,
struct module_pair pair,
const struct symt_function func,
const struct symt sym 
)
static

Definition at line 751 of file symbol.c.

753 {
754  symt_fill_sym_info(pair, func, sym, se->sym_info);
755  if (se->index && se->sym_info->Index != se->index) return FALSE;
756  if (se->tag && se->sym_info->Tag != se->tag) return FALSE;
757  if (se->addr && !(se->addr >= se->sym_info->Address && se->addr < se->sym_info->Address + se->sym_info->Size)) return FALSE;
758  return !se->cb(se->sym_info, se->sym_info->Size, se->user);
759 }
GLenum func
Definition: glext.h:6028
SYMBOL_INFO * sym_info
Definition: symbol.c:744
DWORD64 addr
Definition: symbol.c:747
ULONG Tag
Definition: compat.h:797
ULONG64 Address
Definition: compat.h:794
#define FALSE
Definition: types.h:117
DWORD tag
Definition: symbol.c:746
ULONG Index
Definition: compat.h:789
static void symt_fill_sym_info(struct module_pair *pair, const struct symt_function *func, const struct symt *sym, SYMBOL_INFO *sym_info)
Definition: symbol.c:582
PVOID user
Definition: symbol.c:743
DWORD index
Definition: symbol.c:745
Definition: _pair.h:47
PSYM_ENUMERATESYMBOLS_CALLBACK cb
Definition: symbol.c:742
ULONG Size
Definition: compat.h:790

Referenced by symt_enum_locals_helper(), and symt_enum_module().

◆ sym_enum()

static BOOL sym_enum ( HANDLE  hProcess,
ULONG64  BaseOfDll,
PCWSTR  Mask,
const struct sym_enum se 
)
static

Definition at line 1054 of file symbol.c.

1056 {
1057  struct module_pair pair;
1058  const WCHAR* bang;
1059  WCHAR* mod;
1060 
1062  if (!pair.pcs) return FALSE;
1063  if (BaseOfDll == 0)
1064  {
1065  /* do local variables ? */
1066  if (!Mask || !(bang = wcschr(Mask, '!')))
1067  return symt_enum_locals(pair.pcs, Mask, se);
1068 
1069  if (bang == Mask) return FALSE;
1070 
1071  mod = HeapAlloc(GetProcessHeap(), 0, (bang - Mask + 1) * sizeof(WCHAR));
1072  if (!mod) return FALSE;
1073  memcpy(mod, Mask, (bang - Mask) * sizeof(WCHAR));
1074  mod[bang - Mask] = 0;
1075 
1076  for (pair.requested = pair.pcs->lmodules; pair.requested; pair.requested = pair.requested->next)
1077  {
1078  if (pair.requested->type == DMT_PE && module_get_debug(&pair))
1079  {
1080  if (SymMatchStringW(pair.requested->module.ModuleName, mod, FALSE) &&
1081  symt_enum_module(&pair, bang + 1, se))
1082  break;
1083  }
1084  }
1085  /* not found in PE modules, retry on the ELF ones
1086  */
1087  if (!pair.requested && dbghelp_opt_native)
1088  {
1089  for (pair.requested = pair.pcs->lmodules; pair.requested; pair.requested = pair.requested->next)
1090  {
1091  if ((pair.requested->type == DMT_ELF || pair.requested->type == DMT_MACHO) &&
1092  !module_get_containee(pair.pcs, pair.requested) &&
1094  {
1095  if (SymMatchStringW(pair.requested->module.ModuleName, mod, FALSE) &&
1096  symt_enum_module(&pair, bang + 1, se))
1097  break;
1098  }
1099  }
1100  }
1101  HeapFree(GetProcessHeap(), 0, mod);
1102  return TRUE;
1103  }
1104  pair.requested = module_find_by_addr(pair.pcs, BaseOfDll, DMT_UNKNOWN);
1105  if (!module_get_debug(&pair))
1106  return FALSE;
1107 
1108  /* we always ignore module name from Mask when BaseOfDll is defined */
1109  if (Mask && (bang = wcschr(Mask, '!')))
1110  {
1111  if (bang == Mask) return FALSE;
1112  Mask = bang + 1;
1113  }
1114 
1115  symt_enum_module(&pair, Mask ? Mask : starW, se);
1116 
1117  return TRUE;
1118 }
struct module * module_get_containee(const struct process *pcs, const struct module *inner) DECLSPEC_HIDDEN
Definition: module.c:349
static BOOL symt_enum_locals(struct process *pcs, const WCHAR *mask, const struct sym_enum *se)
Definition: symbol.c:1000
#define TRUE
Definition: types.h:120
struct process * process_find_by_handle(HANDLE hProcess)
Definition: dbghelp.c:99
BOOL dbghelp_opt_native
Definition: dbghelp.c:74
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
BOOL WINAPI SymMatchStringW(PCWSTR string, PCWSTR re, BOOL _case)
Definition: symbol.c:2038
#define FALSE
Definition: types.h:117
static BOOL symt_enum_module(struct module_pair *pair, const WCHAR *match, const struct sym_enum *se)
Definition: symbol.c:761
#define GetProcessHeap()
Definition: compat.h:484
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
BOOL module_get_debug(struct module_pair *) DECLSPEC_HIDDEN
Definition: module.c:374
__wchar_t WCHAR
Definition: xmlstorage.h:180
struct module * module_find_by_addr(const struct process *pcs, DWORD64 addr, enum module_type type) DECLSPEC_HIDDEN
Definition: module.c:420
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
Definition: _pair.h:47
static const WCHAR starW[]
Definition: symbol.c:41
#define HeapFree(x, y, z)
Definition: compat.h:483
static int mod
Definition: i386-dis.c:1273

◆ sym_enumerate_cb()

static BOOL CALLBACK sym_enumerate_cb ( PSYMBOL_INFO  syminfo,
ULONG  size,
void ctx 
)
static

Definition at line 1211 of file symbol.c.

1212 {
1213  struct sym_enumerate* se = ctx;
1214  return (se->cb)(syminfo->Name, syminfo->Address, syminfo->Size, se->ctx);
1215 }
CHAR Name[1]
Definition: compat.h:800
PSYM_ENUMSYMBOLS_CALLBACK cb
Definition: symbol.c:1208
ULONG64 Address
Definition: compat.h:794
void * ctx
Definition: symbol.c:1207
ULONG Size
Definition: compat.h:790

Referenced by SymEnumerateSymbols().

◆ sym_enumerate_cb64()

static BOOL CALLBACK sym_enumerate_cb64 ( PSYMBOL_INFO  syminfo,
ULONG  size,
void ctx 
)
static

Definition at line 1238 of file symbol.c.

1239 {
1240  struct sym_enumerate64* se = ctx;
1241  return (se->cb)(syminfo->Name, syminfo->Address, syminfo->Size, se->ctx);
1242 }
void * ctx
Definition: symbol.c:1234
CHAR Name[1]
Definition: compat.h:800
ULONG64 Address
Definition: compat.h:794
PSYM_ENUMSYMBOLS_CALLBACK64 cb
Definition: symbol.c:1235
ULONG Size
Definition: compat.h:790

Referenced by SymEnumerateSymbols64().

◆ sym_enumW()

static BOOL CALLBACK sym_enumW ( PSYMBOL_INFO  si,
ULONG  size,
PVOID  ctx 
)
static

Definition at line 1179 of file symbol.c.

1180 {
1181  struct sym_enumW* sew = ctx;
1182 
1183  copy_symbolW(sew->sym_info, si);
1184 
1185  return (sew->cb)(sew->sym_info, size, sew->ctx);
1186 }
void copy_symbolW(SYMBOL_INFOW *siw, const SYMBOL_INFO *si)
Definition: symbol.c:1029
GLsizeiptr size
Definition: glext.h:5919
PSYMBOL_INFOW sym_info
Definition: symbol.c:1174
PSYM_ENUMERATESYMBOLS_CALLBACKW cb
Definition: symbol.c:1172
void * ctx
Definition: symbol.c:1173

◆ SymAddSymbol()

BOOL WINAPI SymAddSymbol ( HANDLE  hProcess,
ULONG64  BaseOfDll,
PCSTR  name,
DWORD64  addr,
DWORD  size,
DWORD  flags 
)

Definition at line 2131 of file symbol.c.

2133 {
2135 
2137  return SymAddSymbolW(hProcess, BaseOfDll, nameW, addr, size, flags);
2138 }
BOOL WINAPI SymAddSymbolW(HANDLE hProcess, ULONG64 BaseOfDll, PCWSTR name, DWORD64 addr, DWORD size, DWORD flags)
Definition: symbol.c:2144
#define CP_ACP
Definition: compat.h:109
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
static const WCHAR nameW[]
Definition: main.c:46
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_SYM_NAME
Definition: compat.h:723
GLbitfield flags
Definition: glext.h:7161
GLenum const GLvoid * addr
Definition: glext.h:9621
#define ARRAY_SIZE(a)
Definition: main.h:24
#define MultiByteToWideChar
Definition: compat.h:110
Definition: name.c:38

◆ SymAddSymbolW()

BOOL WINAPI SymAddSymbolW ( HANDLE  hProcess,
ULONG64  BaseOfDll,
PCWSTR  name,
DWORD64  addr,
DWORD  size,
DWORD  flags 
)

Definition at line 2144 of file symbol.c.

2146 {
2147  struct module_pair pair;
2148 
2149  TRACE("(%p %s %s %u)\n", hProcess, wine_dbgstr_w(name), wine_dbgstr_longlong(addr), size);
2150 
2152  if (!pair.pcs) return FALSE;
2153  pair.requested = module_find_by_addr(pair.pcs, BaseOfDll, DMT_UNKNOWN);
2154  if (!module_get_debug(&pair)) return FALSE;
2155 
2157  return FALSE;
2158 }
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
struct process * process_find_by_handle(HANDLE hProcess)
Definition: dbghelp.c:99
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
#define FALSE
Definition: types.h:117
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
BOOL module_get_debug(struct module_pair *) DECLSPEC_HIDDEN
Definition: module.c:374
#define SetLastError(x)
Definition: compat.h:500
GLenum const GLvoid * addr
Definition: glext.h:9621
struct module * module_find_by_addr(const struct process *pcs, DWORD64 addr, enum module_type type) DECLSPEC_HIDDEN
Definition: module.c:420
Definition: _pair.h:47
Definition: name.c:38
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:49
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102

Referenced by SymAddSymbol().

◆ SymEnumerateSymbols()

BOOL WINAPI SymEnumerateSymbols ( HANDLE  hProcess,
DWORD  BaseOfDll,
PSYM_ENUMSYMBOLS_CALLBACK  EnumSymbolsCallback,
PVOID  UserContext 
)

Definition at line 1220 of file symbol.c.

1223 {
1224  struct sym_enumerate se;
1225 
1226  se.ctx = UserContext;
1227  se.cb = EnumSymbolsCallback;
1228 
1229  return SymEnumSymbols(hProcess, BaseOfDll, NULL, sym_enumerate_cb, &se);
1230 }
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
static BOOL CALLBACK sym_enumerate_cb(PSYMBOL_INFO syminfo, ULONG size, void *ctx)
Definition: symbol.c:1211
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI SymEnumSymbols(HANDLE hProcess, ULONG64 BaseOfDll, PCSTR Mask, PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback, PVOID UserContext)
Definition: symbol.c:1147
void * ctx
Definition: symbol.c:1207

◆ SymEnumerateSymbols64()

BOOL WINAPI SymEnumerateSymbols64 ( HANDLE  hProcess,
DWORD64  BaseOfDll,
PSYM_ENUMSYMBOLS_CALLBACK64  EnumSymbolsCallback,
PVOID  UserContext 
)

Definition at line 1247 of file symbol.c.

1250 {
1251  struct sym_enumerate64 se;
1252 
1253  se.ctx = UserContext;
1254  se.cb = EnumSymbolsCallback;
1255 
1256  return SymEnumSymbols(hProcess, BaseOfDll, NULL, sym_enumerate_cb64, &se);
1257 }
void * ctx
Definition: symbol.c:1234
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
smooth NULL
Definition: ftsmooth.c:416
static BOOL CALLBACK sym_enumerate_cb64(PSYMBOL_INFO syminfo, ULONG size, void *ctx)
Definition: symbol.c:1238
BOOL WINAPI SymEnumSymbols(HANDLE hProcess, ULONG64 BaseOfDll, PCSTR Mask, PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback, PVOID UserContext)
Definition: symbol.c:1147

◆ SymEnumLines()

BOOL WINAPI SymEnumLines ( HANDLE  hProcess,
ULONG64  base,
PCSTR  compiland,
PCSTR  srcfile,
PSYM_ENUMLINES_CALLBACK  cb,
PVOID  user 
)

Definition at line 2177 of file symbol.c.

2179 {
2180  struct module_pair pair;
2181  struct hash_table_iter hti;
2182  struct symt_ht* sym;
2183  WCHAR* srcmask;
2184  struct line_info* dli;
2185  void* ptr;
2186  SRCCODEINFO sci;
2187  const char* file;
2188 
2189  if (!cb) return FALSE;
2190  if (!(dbghelp_options & SYMOPT_LOAD_LINES)) return TRUE;
2191 
2193  if (!pair.pcs) return FALSE;
2194  if (compiland) FIXME("Unsupported yet (filtering on compiland %s)\n", compiland);
2195  pair.requested = module_find_by_addr(pair.pcs, base, DMT_UNKNOWN);
2196  if (!module_get_debug(&pair)) return FALSE;
2197  if (!(srcmask = file_regex(srcfile))) return FALSE;
2198 
2199  sci.SizeOfStruct = sizeof(sci);
2200  sci.ModBase = base;
2201 
2202  hash_table_iter_init(&pair.effective->ht_symbols, &hti, NULL);
2203  while ((ptr = hash_table_iter_up(&hti)))
2204  {
2205  unsigned int i;
2206 
2207  sym = CONTAINING_RECORD(ptr, struct symt_ht, hash_elt);
2208  if (sym->symt.tag != SymTagFunction) continue;
2209 
2210  sci.FileName[0] = '\0';
2211  for (i=0; i<vector_length(&((struct symt_function*)sym)->vlines); i++)
2212  {
2213  dli = vector_at(&((struct symt_function*)sym)->vlines, i);
2214  if (dli->is_source_file)
2215  {
2216  file = source_get(pair.effective, dli->u.source_file);
2217  if (!file) sci.FileName[0] = '\0';
2218  else
2219  {
2220  DWORD sz = MultiByteToWideChar(CP_ACP, 0, file, -1, NULL, 0);
2221  WCHAR* fileW;
2222 
2223  if ((fileW = HeapAlloc(GetProcessHeap(), 0, sz * sizeof(WCHAR))))
2224  MultiByteToWideChar(CP_ACP, 0, file, -1, fileW, sz);
2225  if (SymMatchStringW(fileW, srcmask, FALSE))
2226  strcpy(sci.FileName, file);
2227  else
2228  sci.FileName[0] = '\0';
2229  HeapFree(GetProcessHeap(), 0, fileW);
2230  }
2231  }
2232  else if (sci.FileName[0])
2233  {
2234  sci.Key = dli;
2235  sci.Obj[0] = '\0'; /* FIXME */
2236  sci.LineNumber = dli->line_number;
2237  sci.Address = dli->u.pc_offset;
2238  if (!cb(&sci, user)) break;
2239  }
2240  }
2241  }
2242  HeapFree(GetProcessHeap(), 0, srcmask);
2243  return TRUE;
2244 }
ULONG_PTR pc_offset
PVOID Key
Definition: compat.h:859
#define TRUE
Definition: types.h:120
void * vector_at(const struct vector *v, unsigned pos) DECLSPEC_HIDDEN
Definition: storage.c:162
#define CP_ACP
Definition: compat.h:109
struct process * process_find_by_handle(HANDLE hProcess)
Definition: dbghelp.c:99
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
const char * source_get(const struct module *module, unsigned idx) DECLSPEC_HIDDEN
Definition: source.c:130
CHAR FileName[MAX_PATH+1]
Definition: compat.h:862
CHAR Obj[MAX_PATH+1]
Definition: compat.h:861
unsigned source_file
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
BOOL WINAPI SymMatchStringW(PCWSTR string, PCWSTR re, BOOL _case)
Definition: symbol.c:2038
#define FALSE
Definition: types.h:117
GLuint base
Definition: 3dtext.c:35
#define FIXME(fmt,...)
Definition: debug.h:111
static WCHAR * file_regex(const char *srcfile)
Definition: symbol.c:159
static PVOID ptr
Definition: dispmode.c:27
DWORD64 ModBase
Definition: compat.h:860
void hash_table_iter_init(const struct hash_table *ht, struct hash_table_iter *hti, const char *name) DECLSPEC_HIDDEN
Definition: storage.c:405
smooth NULL
Definition: ftsmooth.c:416
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define GetProcessHeap()
Definition: compat.h:484
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
BOOL module_get_debug(struct module_pair *) DECLSPEC_HIDDEN
Definition: module.c:374
__wchar_t WCHAR
Definition: xmlstorage.h:180
DWORD LineNumber
Definition: compat.h:863
const char file[]
Definition: icontest.c:11
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SYMOPT_LOAD_LINES
Definition: compat.h:738
struct symt symt
DWORD SizeOfStruct
Definition: compat.h:858
DWORD64 Address
Definition: compat.h:864
struct module * module_find_by_addr(const struct process *pcs, DWORD64 addr, enum module_type type) DECLSPEC_HIDDEN
Definition: module.c:420
void * hash_table_iter_up(struct hash_table_iter *hti) DECLSPEC_HIDDEN
Definition: storage.c:422
Definition: _pair.h:47
unsigned dbghelp_options
Definition: dbghelp.c:73
#define MultiByteToWideChar
Definition: compat.h:110
static HMODULE MODULEINFO DWORD cb
Definition: module.c:32
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
ULONG_PTR is_source_file
static const WCHAR fileW[]
Definition: url.c:111
void user(int argc, const char *argv[])
Definition: cmds.c:1350
#define HeapFree(x, y, z)
Definition: compat.h:483
unsigned vector_length(const struct vector *v) DECLSPEC_HIDDEN
Definition: storage.c:157
union line_info::@366 u
Definition: fci.c:126
ULONG_PTR line_number

Referenced by ConvertDbgHelp().

◆ SymEnumSymbols()

BOOL WINAPI SymEnumSymbols ( HANDLE  hProcess,
ULONG64  BaseOfDll,
PCSTR  Mask,
PSYM_ENUMERATESYMBOLS_CALLBACK  EnumSymbolsCallback,
PVOID  UserContext 
)

Definition at line 1147 of file symbol.c.

1150 {
1151  BOOL ret;
1152  PWSTR maskW = NULL;
1153 
1154  TRACE("(%p %s %s %p %p)\n",
1155  hProcess, wine_dbgstr_longlong(BaseOfDll), debugstr_a(Mask),
1156  EnumSymbolsCallback, UserContext);
1157 
1158  if (Mask)
1159  {
1160  DWORD sz = MultiByteToWideChar(CP_ACP, 0, Mask, -1, NULL, 0);
1161  if (!(maskW = HeapAlloc(GetProcessHeap(), 0, sz * sizeof(WCHAR))))
1162  return FALSE;
1163  MultiByteToWideChar(CP_ACP, 0, Mask, -1, maskW, sz);
1164  }
1165  ret = doSymEnumSymbols(hProcess, BaseOfDll, maskW, EnumSymbolsCallback, UserContext);
1166  HeapFree(GetProcessHeap(), 0, maskW);
1167  return ret;
1168 }
static BOOL doSymEnumSymbols(HANDLE hProcess, ULONG64 BaseOfDll, PCWSTR Mask, PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback, PVOID UserContext)
Definition: symbol.c:1120
uint16_t * PWSTR
Definition: typedefs.h:56
#define CP_ACP
Definition: compat.h:109
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:484
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
#define MultiByteToWideChar
Definition: compat.h:110
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:49
#define HeapFree(x, y, z)
Definition: compat.h:483

Referenced by DumpParams(), main(), ParseImageSymbols(), SymEnumerateSymbols(), SymEnumerateSymbols64(), and test_SymEnumSymbols().

◆ SymEnumSymbolsW()

BOOL WINAPI SymEnumSymbolsW ( HANDLE  hProcess,
ULONG64  BaseOfDll,
PCWSTR  Mask,
PSYM_ENUMERATESYMBOLS_CALLBACKW  EnumSymbolsCallback,
PVOID  UserContext 
)

Definition at line 1192 of file symbol.c.

1195 {
1196  struct sym_enumW sew;
1197 
1198  sew.ctx = UserContext;
1199  sew.cb = EnumSymbolsCallback;
1200  sew.sym_info = (PSYMBOL_INFOW)sew.buffer;
1201 
1202  return doSymEnumSymbols(hProcess, BaseOfDll, Mask, sym_enumW, &sew);
1203 }
static BOOL doSymEnumSymbols(HANDLE hProcess, ULONG64 BaseOfDll, PCWSTR Mask, PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback, PVOID UserContext)
Definition: symbol.c:1120
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
struct _SYMBOL_INFOW * PSYMBOL_INFOW
void * ctx
Definition: symbol.c:1173

◆ SymFromAddr()

BOOL WINAPI SymFromAddr ( HANDLE  hProcess,
DWORD64  Address,
DWORD64 Displacement,
PSYMBOL_INFO  Symbol 
)

Definition at line 1263 of file symbol.c.

1265 {
1266  struct module_pair pair;
1267  struct symt_ht* sym;
1268 
1270  if (!pair.pcs) return FALSE;
1271  pair.requested = module_find_by_addr(pair.pcs, Address, DMT_UNKNOWN);
1272  if (!module_get_debug(&pair)) return FALSE;
1273  if ((sym = symt_find_nearest(pair.effective, Address)) == NULL) return FALSE;
1274 
1275  symt_fill_sym_info(&pair, NULL, &sym->symt, Symbol);
1276  if (Displacement)
1277  *Displacement = (Address >= Symbol->Address) ? (Address - Symbol->Address) : (DWORD64)-1;
1278  return TRUE;
1279 }
#define TRUE
Definition: types.h:120
struct process * process_find_by_handle(HANDLE hProcess)
Definition: dbghelp.c:99
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
static WCHAR Address[46]
Definition: ping.c:68
BOOL module_get_debug(struct module_pair *) DECLSPEC_HIDDEN
Definition: module.c:374
static void symt_fill_sym_info(struct module_pair *pair, const struct symt_function *func, const struct symt *sym, SYMBOL_INFO *sym_info)
Definition: symbol.c:582
struct symt symt
struct module * module_find_by_addr(const struct process *pcs, DWORD64 addr, enum module_type type) DECLSPEC_HIDDEN
Definition: module.c:420
uint64_t DWORD64
Definition: typedefs.h:67
Definition: Symbol.h:8
Definition: _pair.h:47
struct symt_ht * symt_find_nearest(struct module *module, DWORD_PTR addr)
Definition: symbol.c:903

Referenced by DbgHelpAddLineNumber(), ParseImageSymbols(), PrintStackBacktrace(), SymFromAddrW(), SymGetSymFromAddr(), SymGetSymFromAddr64(), and test_SymFromAddr().

◆ SymFromAddrW()

BOOL WINAPI SymFromAddrW ( HANDLE  hProcess,
DWORD64  Address,
DWORD64 Displacement,
PSYMBOL_INFOW  Symbol 
)

Definition at line 1285 of file symbol.c.

1287 {
1288  PSYMBOL_INFO si;
1289  unsigned len;
1290  BOOL ret;
1291 
1292  len = sizeof(*si) + Symbol->MaxNameLen * sizeof(WCHAR);
1293  si = HeapAlloc(GetProcessHeap(), 0, len);
1294  if (!si) return FALSE;
1295 
1296  si->SizeOfStruct = sizeof(*si);
1297  si->MaxNameLen = Symbol->MaxNameLen;
1298  if ((ret = SymFromAddr(hProcess, Address, Displacement, si)))
1299  {
1300  copy_symbolW(Symbol, si);
1301  }
1302  HeapFree(GetProcessHeap(), 0, si);
1303  return ret;
1304 }
ULONG MaxNameLen
Definition: compat.h:799
void copy_symbolW(SYMBOL_INFOW *siw, const SYMBOL_INFO *si)
Definition: symbol.c:1029
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
static WCHAR Address[46]
Definition: ping.c:68
#define GetProcessHeap()
Definition: compat.h:484
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
BOOL WINAPI SymFromAddr(HANDLE hProcess, DWORD64 Address, DWORD64 *Displacement, PSYMBOL_INFO Symbol)
Definition: symbol.c:1263
__wchar_t WCHAR
Definition: xmlstorage.h:180
int ret
ULONG SizeOfStruct
Definition: compat.h:786
GLenum GLsizei len
Definition: glext.h:6722
Definition: Symbol.h:8
#define HeapFree(x, y, z)
Definition: compat.h:483

◆ SymFromIndex()

BOOL WINAPI SymFromIndex ( HANDLE  hProcess,
ULONG64  BaseOfDll,
DWORD  index,
PSYMBOL_INFO  symbol 
)

Definition at line 2274 of file symbol.c.

2275 {
2276  FIXME("hProcess = %p, BaseOfDll = %s, index = %d, symbol = %p\n",
2277  hProcess, wine_dbgstr_longlong(BaseOfDll), index, symbol);
2278 
2279  return FALSE;
2280 }
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
#define FALSE
Definition: types.h:117
#define FIXME(fmt,...)
Definition: debug.h:111
GLuint index
Definition: glext.h:6031
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:49

◆ SymFromIndexW()

BOOL WINAPI SymFromIndexW ( HANDLE  hProcess,
ULONG64  BaseOfDll,
DWORD  index,
PSYMBOL_INFOW  symbol 
)

Definition at line 2286 of file symbol.c.

2287 {
2288  FIXME("hProcess = %p, BaseOfDll = %s, index = %d, symbol = %p\n",
2289  hProcess, wine_dbgstr_longlong(BaseOfDll), index, symbol);
2290 
2291  return FALSE;
2292 }
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
#define FALSE
Definition: types.h:117
#define FIXME(fmt,...)
Definition: debug.h:111
GLuint index
Definition: glext.h:6031
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:49

◆ SymFromName()

BOOL WINAPI SymFromName ( HANDLE  hProcess,
PCSTR  Name,
PSYMBOL_INFO  Symbol 
)

Definition at line 1392 of file symbol.c.

1393 {
1394  struct process* pcs = process_find_by_handle(hProcess);
1395  struct module* module;
1396  const char* name;
1397 
1398  TRACE("(%p, %s, %p)\n", hProcess, Name, Symbol);
1399  if (!pcs) return FALSE;
1400  if (Symbol->SizeOfStruct < sizeof(*Symbol)) return FALSE;
1401  name = strchr(Name, '!');
1402  if (name)
1403  {
1404  char tmp[128];
1405  assert(name - Name < sizeof(tmp));
1406  memcpy(tmp, Name, name - Name);
1407  tmp[name - Name] = '\0';
1408  module = module_find_by_nameA(pcs, tmp);
1409  return find_name(pcs, module, name + 1, Symbol);
1410  }
1411  for (module = pcs->lmodules; module; module = module->next)
1412  {
1413  if (module->type == DMT_PE && find_name(pcs, module, Name, Symbol))
1414  return TRUE;
1415  }
1416  /* not found in PE modules, retry on the ELF ones
1417  */
1418  if (dbghelp_opt_native)
1419  {
1420  for (module = pcs->lmodules; module; module = module->next)
1421  {
1422  if ((module->type == DMT_ELF || module->type == DMT_MACHO) &&
1423  !module_get_containee(pcs, module) &&
1424  find_name(pcs, module, Name, Symbol))
1425  return TRUE;
1426  }
1427  }
1428  return FALSE;
1429 }
struct module * module_get_containee(const struct process *pcs, const struct module *inner) DECLSPEC_HIDDEN
Definition: module.c:349
HMODULE module
Definition: main.cpp:47
#define TRUE
Definition: types.h:120
struct process * process_find_by_handle(HANDLE hProcess)
Definition: dbghelp.c:99
BOOL dbghelp_opt_native
Definition: dbghelp.c:74
struct module * module_find_by_nameA(const struct process *pcs, const char *name) DECLSPEC_HIDDEN
Definition: module.c:291
#define assert(x)
Definition: debug.h:53
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
enum module_type type
#define FALSE
Definition: types.h:117
struct module * lmodules
struct NameRec_ * Name
Definition: cdprocs.h:459
static BOOL find_name(struct process *pcs, struct module *module, const char *name, SYMBOL_INFO *symbol)
Definition: symbol.c:1362
#define TRACE(s)
Definition: solgame.cpp:4
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
Definition: Symbol.h:8
char * strchr(const char *String, int ch)
Definition: utclib.c:501
Definition: name.c:38
struct module * next
GLuint const GLchar * name
Definition: glext.h:6031

Referenced by elf_search_auxv(), ImageSymToVa(), SymGetSymFromName(), SymGetSymFromName64(), and test_SymFromName().

◆ SymGetLineFromAddr()

BOOL WINAPI SymGetLineFromAddr ( HANDLE  hProcess,
DWORD  dwAddr,
PDWORD  pdwDisplacement,
PIMAGEHLP_LINE  Line 
)

Definition at line 1614 of file symbol.c.

1616 {
1617  IMAGEHLP_LINE64 il64;
1618 
1619  il64.SizeOfStruct = sizeof(il64);
1620  if (!SymGetLineFromAddr64(hProcess, dwAddr, pdwDisplacement, &il64))
1621  return FALSE;
1622  copy_line_32_from_64(Line, &il64);
1623  return TRUE;
1624 }
BOOL WINAPI SymGetLineFromAddr64(HANDLE hProcess, DWORD64 dwAddr, PDWORD pdwDisplacement, PIMAGEHLP_LINE64 Line)
Definition: symbol.c:1630
#define TRUE
Definition: types.h:120
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
#define FALSE
Definition: types.h:117
DWORD SizeOfStruct
Definition: compat.h:843
Definition: ncftp.h:79
static void copy_line_32_from_64(IMAGEHLP_LINE *l32, const IMAGEHLP_LINE64 *l64)
Definition: symbol.c:1601

◆ SymGetLineFromAddr64()

BOOL WINAPI SymGetLineFromAddr64 ( HANDLE  hProcess,
DWORD64  dwAddr,
PDWORD  pdwDisplacement,
PIMAGEHLP_LINE64  Line 
)

Definition at line 1630 of file symbol.c.

1632 {
1633  struct module_pair pair;
1634  struct symt_ht* symt;
1635 
1636  TRACE("%p %s %p %p\n", hProcess, wine_dbgstr_longlong(dwAddr), pdwDisplacement, Line);
1637 
1638  if (Line->SizeOfStruct < sizeof(*Line)) return FALSE;
1639 
1641  if (!pair.pcs) return FALSE;
1642  pair.requested = module_find_by_addr(pair.pcs, dwAddr, DMT_UNKNOWN);
1643  if (!module_get_debug(&pair)) return FALSE;
1644  if ((symt = symt_find_nearest(pair.effective, dwAddr)) == NULL) return FALSE;
1645 
1646  if (symt->symt.tag != SymTagFunction) return FALSE;
1647  if (!symt_fill_func_line_info(pair.effective, (struct symt_function*)symt,
1648  dwAddr, Line)) return FALSE;
1649  *pdwDisplacement = dwAddr - Line->Address;
1650  return TRUE;
1651 }
#define TRUE
Definition: types.h:120
struct process * process_find_by_handle(HANDLE hProcess)
Definition: dbghelp.c:99
BOOL symt_fill_func_line_info(const struct module *module, const struct symt_function *func, DWORD64 addr, IMAGEHLP_LINE64 *line)
Definition: symbol.c:1480
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
#define FALSE
Definition: types.h:117
enum SymTagEnum tag
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
BOOL module_get_debug(struct module_pair *) DECLSPEC_HIDDEN
Definition: module.c:374
struct symt symt
Definition: ncftp.h:79
struct module * module_find_by_addr(const struct process *pcs, DWORD64 addr, enum module_type type) DECLSPEC_HIDDEN
Definition: module.c:420
Definition: _pair.h:47
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:49
struct symt_ht * symt_find_nearest(struct module *module, DWORD_PTR addr)
Definition: symbol.c:903

Referenced by SymGetLineFromAddr(), and SymGetLineFromAddrW64().

◆ SymGetLineFromAddrW64()

BOOL WINAPI SymGetLineFromAddrW64 ( HANDLE  hProcess,
DWORD64  dwAddr,
PDWORD  pdwDisplacement,
PIMAGEHLP_LINEW64  Line 
)

Definition at line 1657 of file symbol.c.

1659 {
1660  IMAGEHLP_LINE64 il64;
1661 
1662  il64.SizeOfStruct = sizeof(il64);
1663  if (!SymGetLineFromAddr64(hProcess, dwAddr, pdwDisplacement, &il64))
1664  return FALSE;
1666  return TRUE;
1667 }
BOOL WINAPI SymGetLineFromAddr64(HANDLE hProcess, DWORD64 dwAddr, PDWORD pdwDisplacement, PIMAGEHLP_LINE64 Line)
Definition: symbol.c:1630
#define TRUE
Definition: types.h:120
struct process * process_find_by_handle(HANDLE hProcess)
Definition: dbghelp.c:99
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
#define FALSE
Definition: types.h:117
DWORD SizeOfStruct
Definition: compat.h:843
Definition: ncftp.h:79
static void copy_line_W64_from_64(struct process *pcs, IMAGEHLP_LINEW64 *l64w, const IMAGEHLP_LINE64 *l64)
Definition: symbol.c:1585

◆ SymGetLineFromName()

BOOL WINAPI SymGetLineFromName ( HANDLE  hProcess,
PCSTR  ModuleName,
PCSTR  FileName,
DWORD  dwLineNumber,
PLONG  plDisplacement,
PIMAGEHLP_LINE  Line 
)

Definition at line 2246 of file symbol.c.

2248 {
2249  FIXME("(%p) (%s, %s, %d %p %p): stub\n", hProcess, ModuleName, FileName,
2250  dwLineNumber, plDisplacement, Line);
2251  return FALSE;
2252 }
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 ACPI_STATUS const char UINT32 ACPI_STATUS const char UINT32 const char const char * ModuleName
Definition: acpixf.h:1274
#define FALSE
Definition: types.h:117
#define FIXME(fmt,...)
Definition: debug.h:111
Definition: ncftp.h:79

◆ SymGetLineFromName64()

BOOL WINAPI SymGetLineFromName64 ( HANDLE  hProcess,
PCSTR  ModuleName,
PCSTR  FileName,
DWORD  dwLineNumber,
PLONG  lpDisplacement,
PIMAGEHLP_LINE64  Line 
)

Definition at line 2254 of file symbol.c.

2256 {
2257  FIXME("(%p) (%s, %s, %d %p %p): stub\n", hProcess, ModuleName, FileName,
2258  dwLineNumber, lpDisplacement, Line);
2259  return FALSE;
2260 }
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 ACPI_STATUS const char UINT32 ACPI_STATUS const char UINT32 const char const char * ModuleName
Definition: acpixf.h:1274
#define FALSE
Definition: types.h:117
#define FIXME(fmt,...)
Definition: debug.h:111
Definition: ncftp.h:79

◆ SymGetLineFromNameW64()

BOOL WINAPI SymGetLineFromNameW64 ( HANDLE  hProcess,
PCWSTR  ModuleName,
PCWSTR  FileName,
DWORD  dwLineNumber,
PLONG  plDisplacement,
PIMAGEHLP_LINEW64  Line 
)

Definition at line 2262 of file symbol.c.

2264 {
2265  FIXME("(%p) (%s, %s, %d %p %p): stub\n", hProcess, debugstr_w(ModuleName), debugstr_w(FileName),
2266  dwLineNumber, plDisplacement, Line);
2267  return FALSE;
2268 }
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 ACPI_STATUS const char UINT32 ACPI_STATUS const char UINT32 const char const char * ModuleName
Definition: acpixf.h:1274
#define FALSE
Definition: types.h:117
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111
Definition: ncftp.h:79

◆ SymGetLineNext()

BOOL WINAPI SymGetLineNext ( HANDLE  hProcess,
PIMAGEHLP_LINE  Line 
)

Definition at line 1780 of file symbol.c.

1781 {
1782  IMAGEHLP_LINE64 line64;
1783 
1784  line64.SizeOfStruct = sizeof(line64);
1785  copy_line_64_from_32(&line64, Line);
1786  if (!SymGetLineNext64(hProcess, &line64)) return FALSE;
1787  copy_line_32_from_64(Line, &line64);
1788  return TRUE;
1789 }
#define TRUE
Definition: types.h:120
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
#define FALSE
Definition: types.h:117
static void copy_line_64_from_32(IMAGEHLP_LINE64 *l64, const IMAGEHLP_LINE *l32)
Definition: symbol.c:1572
DWORD SizeOfStruct
Definition: compat.h:843
BOOL WINAPI SymGetLineNext64(HANDLE hProcess, PIMAGEHLP_LINE64 Line)
Definition: symbol.c:1759
Definition: ncftp.h:79
static void copy_line_32_from_64(IMAGEHLP_LINE *l32, const IMAGEHLP_LINE64 *l64)
Definition: symbol.c:1601

◆ SymGetLineNext64()

BOOL WINAPI SymGetLineNext64 ( HANDLE  hProcess,
PIMAGEHLP_LINE64  Line 
)

Definition at line 1759 of file symbol.c.

1760 {
1761  struct module_pair pair;
1762 
1763  TRACE("(%p %p)\n", hProcess, Line);
1764 
1765  if (Line->SizeOfStruct < sizeof(*Line)) return FALSE;
1767  if (!pair.pcs) return FALSE;
1768  pair.requested = module_find_by_addr(pair.pcs, Line->Address, DMT_UNKNOWN);
1769  if (!module_get_debug(&pair)) return FALSE;
1770 
1771  if (symt_get_func_line_next(pair.effective, Line)) return TRUE;
1772  SetLastError(ERROR_NO_MORE_ITEMS); /* FIXME */
1773  return FALSE;
1774 }
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:105
#define TRUE
Definition: types.h:120
struct process * process_find_by_handle(HANDLE hProcess)
Definition: dbghelp.c:99
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
BOOL symt_get_func_line_next(const struct module *module, PIMAGEHLP_LINE64 line)
Definition: symbol.c:1734
#define FALSE
Definition: types.h:117
#define TRACE(s)
Definition: solgame.cpp:4
BOOL module_get_debug(struct module_pair *) DECLSPEC_HIDDEN
Definition: module.c:374
#define SetLastError(x)
Definition: compat.h:500
Definition: ncftp.h:79
struct module * module_find_by_addr(const struct process *pcs, DWORD64 addr, enum module_type type) DECLSPEC_HIDDEN
Definition: module.c:420
Definition: _pair.h:47

Referenced by SymGetLineNext().

◆ SymGetLinePrev()

BOOL WINAPI SymGetLinePrev ( HANDLE  hProcess,
PIMAGEHLP_LINE  Line 
)

Definition at line 1723 of file symbol.c.

1724 {
1725  IMAGEHLP_LINE64 line64;
1726 
1727  line64.SizeOfStruct = sizeof(line64);
1728  copy_line_64_from_32(&line64, Line);
1729  if (!SymGetLinePrev64(hProcess, &line64)) return FALSE;
1730  copy_line_32_from_64(Line, &line64);
1731  return TRUE;
1732 }
#define TRUE
Definition: types.h:120
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
#define FALSE
Definition: types.h:117
static void copy_line_64_from_32(IMAGEHLP_LINE64 *l64, const IMAGEHLP_LINE *l32)
Definition: symbol.c:1572
DWORD SizeOfStruct
Definition: compat.h:843
BOOL WINAPI SymGetLinePrev64(HANDLE hProcess, PIMAGEHLP_LINE64 Line)
Definition: symbol.c:1673
Definition: ncftp.h:79
static void copy_line_32_from_64(IMAGEHLP_LINE *l32, const IMAGEHLP_LINE64 *l64)
Definition: symbol.c:1601

◆ SymGetLinePrev64()

BOOL WINAPI SymGetLinePrev64 ( HANDLE  hProcess,
PIMAGEHLP_LINE64  Line 
)

Definition at line 1673 of file symbol.c.

1674 {
1675  struct module_pair pair;
1676  struct line_info* li;
1677  BOOL in_search = FALSE;
1678 
1679  TRACE("(%p %p)\n", hProcess, Line);
1680 
1681  if (Line->SizeOfStruct < sizeof(*Line)) return FALSE;
1682 
1684  if (!pair.pcs) return FALSE;
1685  pair.requested = module_find_by_addr(pair.pcs, Line->Address, DMT_UNKNOWN);
1686  if (!module_get_debug(&pair)) return FALSE;
1687 
1688  if (Line->Key == 0) return FALSE;
1689  li = Line->Key;
1690  /* things are a bit complicated because when we encounter a DLIT_SOURCEFILE
1691  * element we have to go back until we find the prev one to get the real
1692  * source file name for the DLIT_OFFSET element just before
1693  * the first DLIT_SOURCEFILE
1694  */
1695  while (!li->is_first)
1696  {
1697  li--;
1698  if (!li->is_source_file)
1699  {
1700  Line->LineNumber = li->line_number;
1701  Line->Address = li->u.pc_offset;
1702  Line->Key = li;
1703  if (!in_search) return TRUE;
1704  }
1705  else
1706  {
1707  if (in_search)
1708  {
1709  Line->FileName = (char*)source_get(pair.effective, li->u.source_file);
1710  return TRUE;
1711  }
1712  in_search = TRUE;
1713  }
1714  }
1715  SetLastError(ERROR_NO_MORE_ITEMS); /* FIXME */
1716  return FALSE;
1717 }
ULONG_PTR pc_offset
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:105
#define TRUE
Definition: types.h:120
struct process * process_find_by_handle(HANDLE hProcess)
Definition: dbghelp.c:99
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
const char * source_get(const struct module *module, unsigned idx) DECLSPEC_HIDDEN
Definition: source.c:130
unsigned source_file
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TRACE(s)
Definition: solgame.cpp:4
BOOL module_get_debug(struct module_pair *) DECLSPEC_HIDDEN
Definition: module.c:374
#define SetLastError(x)
Definition: compat.h:500
Definition: ncftp.h:79
struct module * module_find_by_addr(const struct process *pcs, DWORD64 addr, enum module_type type) DECLSPEC_HIDDEN
Definition: module.c:420
Definition: _pair.h:47
ULONG_PTR is_first
ULONG_PTR is_source_file
union line_info::@366 u
ULONG_PTR line_number

Referenced by SymGetLinePrev().

◆ SymGetSymFromAddr()

BOOL WINAPI SymGetSymFromAddr ( HANDLE  hProcess,
DWORD  Address,
PDWORD  Displacement,
PIMAGEHLP_SYMBOL  Symbol 
)

Definition at line 1310 of file symbol.c.

1312 {
1313  char buffer[sizeof(SYMBOL_INFO) + MAX_SYM_NAME];
1315  size_t len;
1316  DWORD64 Displacement64;
1317 
1318  if (Symbol->SizeOfStruct < sizeof(*Symbol)) return FALSE;
1319  si->SizeOfStruct = sizeof(*si);
1320  si->MaxNameLen = MAX_SYM_NAME;
1321  if (!SymFromAddr(hProcess, Address, &Displacement64, si))
1322  return FALSE;
1323 
1324  if (Displacement)
1325  *Displacement = Displacement64;
1326  Symbol->Address = si->Address;
1327  Symbol->Size = si->Size;
1328  Symbol->Flags = si->Flags;
1329  len = min(Symbol->MaxNameLength, si->MaxNameLen);
1330  lstrcpynA(Symbol->Name, si->Name, len);
1331  return TRUE;
1332 }
#define TRUE
Definition: types.h:120
GLuint buffer
Definition: glext.h:5915
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
#define FALSE
Definition: types.h:117
static WCHAR Address[46]
Definition: ping.c:68
BOOL WINAPI SymFromAddr(HANDLE hProcess, DWORD64 Address, DWORD64 *Displacement, PSYMBOL_INFO Symbol)
Definition: symbol.c:1263
struct _SYMBOL_INFO SYMBOL_INFO
#define MAX_SYM_NAME
Definition: compat.h:723
GLenum GLsizei len
Definition: glext.h:6722
uint64_t DWORD64
Definition: typedefs.h:67
Definition: Symbol.h:8
#define min(a, b)
Definition: monoChain.cc:55
#define lstrcpynA
Definition: compat.h:499

◆ SymGetSymFromAddr64()

BOOL WINAPI SymGetSymFromAddr64 ( HANDLE  hProcess,
DWORD64  Address,
PDWORD64  Displacement,
PIMAGEHLP_SYMBOL64  Symbol 
)

Definition at line 1338 of file symbol.c.

1340 {
1341  char buffer[sizeof(SYMBOL_INFO) + MAX_SYM_NAME];
1343  size_t len;
1344  DWORD64 Displacement64;
1345 
1346  if (Symbol->SizeOfStruct < sizeof(*Symbol)) return FALSE;
1347  si->SizeOfStruct = sizeof(*si);
1348  si->MaxNameLen = MAX_SYM_NAME;
1349  if (!SymFromAddr(hProcess, Address, &Displacement64, si))
1350  return FALSE;
1351 
1352  if (Displacement)
1353  *Displacement = Displacement64;
1354  Symbol->Address = si->Address;
1355  Symbol->Size = si->Size;
1356  Symbol->Flags = si->Flags;
1357  len = min(Symbol->MaxNameLength, si->MaxNameLen);
1358  lstrcpynA(Symbol->Name, si->Name, len);
1359  return TRUE;
1360 }
#define TRUE
Definition: types.h:120
GLuint buffer
Definition: glext.h:5915
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
#define FALSE
Definition: types.h:117
static WCHAR Address[46]
Definition: ping.c:68
BOOL WINAPI SymFromAddr(HANDLE hProcess, DWORD64 Address, DWORD64 *Displacement, PSYMBOL_INFO Symbol)
Definition: symbol.c:1263
struct _SYMBOL_INFO SYMBOL_INFO
#define MAX_SYM_NAME
Definition: compat.h:723
GLenum GLsizei len
Definition: glext.h:6722
uint64_t DWORD64
Definition: typedefs.h:67
Definition: Symbol.h:8
#define min(a, b)
Definition: monoChain.cc:55
#define lstrcpynA
Definition: compat.h:499

◆ SymGetSymFromName()

BOOL WINAPI SymGetSymFromName ( HANDLE  hProcess,
PCSTR  Name,
PIMAGEHLP_SYMBOL  Symbol 
)

Definition at line 1456 of file symbol.c.

1457 {
1458  char buffer[sizeof(SYMBOL_INFO) + MAX_SYM_NAME];
1460  size_t len;
1461 
1462  if (Symbol->SizeOfStruct < sizeof(*Symbol)) return FALSE;
1463  si->SizeOfStruct = sizeof(*si);
1464  si->MaxNameLen = MAX_SYM_NAME;
1465  if (!SymFromName(hProcess, Name, si)) return FALSE;
1466 
1467  Symbol->Address = si->Address;
1468  Symbol->Size = si->Size;
1469  Symbol->Flags = si->Flags;
1470  len = min(Symbol->MaxNameLength, si->MaxNameLen);
1471  lstrcpynA(Symbol->Name, si->Name, len);
1472  return TRUE;
1473 }
#define TRUE
Definition: types.h:120
GLuint buffer
Definition: glext.h:5915
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
#define FALSE
Definition: types.h:117
struct _SYMBOL_INFO SYMBOL_INFO
#define MAX_SYM_NAME
Definition: compat.h:723
GLenum GLsizei len
Definition: glext.h:6722
Definition: Symbol.h:8
#define min(a, b)
Definition: monoChain.cc:55
#define lstrcpynA
Definition: compat.h:499
BOOL WINAPI SymFromName(HANDLE hProcess, PCSTR Name, PSYMBOL_INFO Symbol)
Definition: symbol.c:1392

◆ SymGetSymFromName64()

BOOL WINAPI SymGetSymFromName64 ( HANDLE  hProcess,
PCSTR  Name,
PIMAGEHLP_SYMBOL64  Symbol 
)

Definition at line 1434 of file symbol.c.

1435 {
1436  char buffer[sizeof(SYMBOL_INFO) + MAX_SYM_NAME];
1438  size_t len;
1439 
1440  if (Symbol->SizeOfStruct < sizeof(*Symbol)) return FALSE;
1441  si->SizeOfStruct = sizeof(*si);
1442  si->MaxNameLen = MAX_SYM_NAME;
1443  if (!SymFromName(hProcess, Name, si)) return FALSE;
1444 
1445  Symbol->Address = si->Address;
1446  Symbol->Size = si->Size;
1447  Symbol->Flags = si->Flags;
1448  len = min(Symbol->MaxNameLength, si->MaxNameLen);
1449  lstrcpynA(Symbol->Name, si->Name, len);
1450  return TRUE;
1451 }
#define TRUE
Definition: types.h:120
GLuint buffer
Definition: glext.h:5915
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
#define FALSE
Definition: types.h:117
struct _SYMBOL_INFO SYMBOL_INFO
#define MAX_SYM_NAME
Definition: compat.h:723
GLenum GLsizei len
Definition: glext.h:6722
Definition: Symbol.h:8
#define min(a, b)
Definition: monoChain.cc:55
#define lstrcpynA
Definition: compat.h:499
BOOL WINAPI SymFromName(HANDLE hProcess, PCSTR Name, PSYMBOL_INFO Symbol)
Definition: symbol.c:1392

◆ SymGetSymNext()

BOOL WINAPI SymGetSymNext ( HANDLE  hProcess,
PIMAGEHLP_SYMBOL  Symbol 
)

Definition at line 1541 of file symbol.c.

1542 {
1543  FIXME("(%p, %p): stub\n", hProcess, Symbol);
1545  return FALSE;
1546 }
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
#define FALSE
Definition: types.h:117
#define FIXME(fmt,...)
Definition: debug.h:111
#define SetLastError(x)
Definition: compat.h:500
Definition: Symbol.h:8
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102

◆ SymGetSymNext64()

BOOL WINAPI SymGetSymNext64 ( HANDLE  hProcess,
PIMAGEHLP_SYMBOL64  Symbol 
)

Definition at line 1525 of file symbol.c.

1526 {
1527  /* algo:
1528  * get module from Symbol.Address
1529  * get index in module.addr_sorttab of Symbol.Address
1530  * increment index
1531  * if out of module bounds, move to next module in process address space
1532  */
1533  FIXME("(%p, %p): stub\n", hProcess, Symbol);
1535  return FALSE;
1536 }
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
#define FALSE
Definition: types.h:117
#define FIXME(fmt,...)
Definition: debug.h:111
#define SetLastError(x)
Definition: compat.h:500
Definition: Symbol.h:8
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102

◆ SymGetSymPrev()

BOOL WINAPI SymGetSymPrev ( HANDLE  hProcess,
PIMAGEHLP_SYMBOL  Symbol 
)

Definition at line 1561 of file symbol.c.

1562 {
1563  FIXME("(%p, %p): stub\n", hProcess, Symbol);
1565  return FALSE;
1566 }
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
#define FALSE
Definition: types.h:117
#define FIXME(fmt,...)
Definition: debug.h:111
#define SetLastError(x)
Definition: compat.h:500
Definition: Symbol.h:8
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102

◆ SymGetSymPrev64()

BOOL WINAPI SymGetSymPrev64 ( HANDLE  hProcess,
PIMAGEHLP_SYMBOL64  Symbol 
)

Definition at line 1551 of file symbol.c.

1552 {
1553  FIXME("(%p, %p): stub\n", hProcess, Symbol);
1555  return FALSE;
1556 }
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
#define FALSE
Definition: types.h:117
#define FIXME(fmt,...)
Definition: debug.h:111
#define SetLastError(x)
Definition: compat.h:500
Definition: Symbol.h:8
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102

◆ SymMatchStringA()

BOOL WINAPI SymMatchStringA ( PCSTR  string,
PCSTR  re,
BOOL  _case 
)

Definition at line 2006 of file symbol.c.

2007 {
2008  WCHAR* strW;
2009  WCHAR* reW;
2010  BOOL ret = FALSE;
2011  DWORD sz;
2012 
2013  if (!string || !re)
2014  {
2016  return FALSE;
2017  }
2018  TRACE("%s %s %c\n", string, re, _case ? 'Y' : 'N');
2019 
2020  sz = MultiByteToWideChar(CP_ACP, 0, string, -1, NULL, 0);
2021  if ((strW = HeapAlloc(GetProcessHeap(), 0, sz * sizeof(WCHAR))))
2022  MultiByteToWideChar(CP_ACP, 0, string, -1, strW, sz);
2023  sz = MultiByteToWideChar(CP_ACP, 0, re, -1, NULL, 0);
2024  if ((reW = HeapAlloc(GetProcessHeap(), 0, sz * sizeof(WCHAR))))
2025  MultiByteToWideChar(CP_ACP, 0, re, -1, reW, sz);
2026 
2027  if (strW && reW)
2028  ret = SymMatchStringW(strW, reW, _case);
2029  HeapFree(GetProcessHeap(), 0, strW);
2030  HeapFree(GetProcessHeap(), 0, reW);
2031  return ret;
2032 }
#define CP_ACP
Definition: compat.h:109
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
BOOL WINAPI SymMatchStringW(PCWSTR string, PCWSTR re, BOOL _case)
Definition: symbol.c:2038
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
WCHAR strW[12]
Definition: clipboard.c:2029
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:484
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:500
int ret
#define MultiByteToWideChar
Definition: compat.h:110
#define HeapFree(x, y, z)
Definition: compat.h:483

◆ SymMatchStringW()

BOOL WINAPI SymMatchStringW ( PCWSTR  string,
PCWSTR  re,
BOOL  _case 
)

Definition at line 2038 of file symbol.c.

2039 {
2040  TRACE("%s %s %c\n", debugstr_w(string), debugstr_w(re), _case ? 'Y' : 'N');
2041 
2042  if (!string || !re)
2043  {
2045  return FALSE;
2046  }
2047  return re_match_multi(&string, &re, _case);
2048 }
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
#define FALSE
Definition: types.h:117
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
#define SetLastError(x)
Definition: compat.h:500
static BOOL re_match_multi(const WCHAR **pstring, const WCHAR **pre, BOOL _case)
Definition: symbol.c:1942

Referenced by sym_enum(), SymEnumLines(), SymMatchStringA(), symt_enum_locals_helper(), and symt_enum_module().

◆ SymSearch()

BOOL WINAPI SymSearch ( HANDLE  hProcess,
ULONG64  BaseOfDll,
DWORD  Index,
DWORD  SymTag,
PCSTR  Mask,
DWORD64  Address,
PSYM_ENUMERATESYMBOLS_CALLBACK  EnumSymbolsCallback,
PVOID  UserContext,
DWORD  Options 
)

Definition at line 2077 of file symbol.c.

2081 {
2082  LPWSTR maskW = NULL;
2083  BOOLEAN ret;
2084 
2085  TRACE("(%p %s %u %u %s %s %p %p %x)\n",
2086  hProcess, wine_dbgstr_longlong(BaseOfDll), Index, SymTag, Mask,
2087  wine_dbgstr_longlong(Address), EnumSymbolsCallback,
2088  UserContext, Options);
2089 
2090  if (Mask)
2091  {
2092  DWORD sz = MultiByteToWideChar(CP_ACP, 0, Mask, -1, NULL, 0);
2093 
2094  if (!(maskW = HeapAlloc(GetProcessHeap(), 0, sz * sizeof(WCHAR))))
2095  return FALSE;
2096  MultiByteToWideChar(CP_ACP, 0, Mask, -1, maskW, sz);
2097  }
2098  ret = doSymSearch(hProcess, BaseOfDll, Index, SymTag, maskW, Address,
2099  EnumSymbolsCallback, UserContext, Options);
2100  HeapFree(GetProcessHeap(), 0, maskW);
2101  return ret;
2102 }
#define CP_ACP
Definition: compat.h:109
static BOOL doSymSearch(HANDLE hProcess, ULONG64 BaseOfDll, DWORD Index, DWORD SymTag, PCWSTR Mask, DWORD64 Address, PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback, PVOID UserContext, DWORD Options)
Definition: symbol.c:2050
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
enum OPTION_FLAGS Options
Definition: stats.c:44
#define FALSE
Definition: types.h:117
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
static WCHAR Address[46]
Definition: ping.c:68
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:484
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
static const UCHAR Index[8]
Definition: usbohci.c:18
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
#define MultiByteToWideChar
Definition: compat.h:110
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:49
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:483

◆ SymSearchW()

BOOL WINAPI SymSearchW ( HANDLE  hProcess,
ULONG64  BaseOfDll,
DWORD  Index,
DWORD  SymTag,
PCWSTR  Mask,
DWORD64  Address,
PSYM_ENUMERATESYMBOLS_CALLBACKW  EnumSymbolsCallback,
PVOID  UserContext,
DWORD  Options 
)

Definition at line 2107 of file symbol.c.

2111 {
2112  struct sym_enumW sew;
2113 
2114  TRACE("(%p %s %u %u %s %s %p %p %x)\n",
2115  hProcess, wine_dbgstr_longlong(BaseOfDll), Index, SymTag, debugstr_w(Mask),
2116  wine_dbgstr_longlong(Address), EnumSymbolsCallback,
2117  UserContext, Options);
2118 
2119  sew.ctx = UserContext;
2120  sew.cb = EnumSymbolsCallback;
2121  sew.sym_info = (PSYMBOL_INFOW)sew.buffer;
2122 
2123  return doSymSearch(hProcess, BaseOfDll, Index, SymTag, Mask, Address,
2124  sym_enumW, &sew, Options);
2125 }
static BOOL doSymSearch(HANDLE hProcess, ULONG64 BaseOfDll, DWORD Index, DWORD SymTag, PCWSTR Mask, DWORD64 Address, PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback, PVOID UserContext, DWORD Options)
Definition: symbol.c:2050
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
enum OPTION_FLAGS Options
Definition: stats.c:44
#define debugstr_w
Definition: kernel32.h:32
static WCHAR Address[46]
Definition: ping.c:68
#define TRACE(s)
Definition: solgame.cpp:4
static const UCHAR Index[8]
Definition: usbohci.c:18
struct _SYMBOL_INFOW * PSYMBOL_INFOW
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:49

◆ SymSetHomeDirectory()

PCHAR WINAPI SymSetHomeDirectory ( HANDLE  hProcess,
PCSTR  dir 
)

Definition at line 2298 of file symbol.c.

2299 {
2300  FIXME("(%p, %s): stub\n", hProcess, dir);
2301 
2302  return NULL;
2303 }
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
#define FIXME(fmt,...)
Definition: debug.h:111
smooth NULL
Definition: ftsmooth.c:416
unsigned int dir
Definition: maze.c:112

◆ SymSetHomeDirectoryW()

PWSTR WINAPI SymSetHomeDirectoryW ( HANDLE  hProcess,
PCWSTR  dir 
)

Definition at line 2309 of file symbol.c.

2310 {
2311  FIXME("(%p, %s): stub\n", hProcess, debugstr_w(dir));
2312 
2313  return NULL;
2314 }
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111
smooth NULL
Definition: ftsmooth.c:416
unsigned int dir
Definition: maze.c:112

◆ SymSetScopeFromAddr()

BOOL WINAPI SymSetScopeFromAddr ( HANDLE  hProcess,
ULONG64  addr 
)

Definition at line 2163 of file symbol.c.

2164 {
2165  struct process* pcs;
2166 
2167  FIXME("(%p %s): stub\n", hProcess, wine_dbgstr_longlong(addr));
2168 
2169  if (!(pcs = process_find_by_handle(hProcess))) return FALSE;
2170  return TRUE;
2171 }
#define TRUE
Definition: types.h:120
struct process * process_find_by_handle(HANDLE hProcess)
Definition: dbghelp.c:99
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
#define FALSE
Definition: types.h:117
#define FIXME(fmt,...)
Definition: debug.h:111
GLenum const GLvoid * addr
Definition: glext.h:9621
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:49

◆ symt_add_func_line()

void symt_add_func_line ( struct module module,
struct symt_function func,
unsigned  source_idx,
int  line_num,
ULONG_PTR  offset 
)

Definition at line 326 of file symbol.c.

328 {
329  struct line_info* dli;
330  BOOL last_matches = FALSE;
331  int i;
332 
333  if (func == NULL || !(dbghelp_options & SYMOPT_LOAD_LINES)) return;
334 
335  TRACE_(dbghelp_symt)("(%p)%s:%lx %s:%u\n",
336  func, func->hash_elt.name, offset,
337  source_get(module, source_idx), line_num);
338 
339  assert(func->symt.tag == SymTagFunction);
340 
341  for (i=vector_length(&func->vlines)-1; i>=0; i--)
342  {
343  dli = vector_at(&func->vlines, i);
344  if (dli->is_source_file)
345  {
346  last_matches = (source_idx == dli->u.source_file);
347  break;
348  }
349  }
350 
351  if (!last_matches)
352  {
353  /* we shouldn't have line changes on first line of function */
354  dli = vector_add(&func->vlines, &module->pool);
355  dli->is_source_file = 1;
356  dli->is_first = dli->is_last = 0;
357  dli->line_number = 0;
358  dli->u.source_file = source_idx;
359  }
360  dli = vector_add(&func->vlines, &module->pool);
361  dli->is_source_file = 0;
362  dli->is_first = dli->is_last = 0;
363  dli->line_number = line_num;
364  dli->u.pc_offset = func->address + offset;
365 }
GLenum func
Definition: glext.h:6028
ULONG_PTR pc_offset
void * vector_at(const struct vector *v, unsigned pos) DECLSPEC_HIDDEN
Definition: storage.c:162
GLintptr offset
Definition: glext.h:5920
#define assert(x)
Definition: debug.h:53
const char * source_get(const struct module *module, unsigned idx) DECLSPEC_HIDDEN
Definition: source.c:130
unsigned source_file
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define TRACE_(x)
Definition: compat.h:76
ULONG_PTR is_last
#define SYMOPT_LOAD_LINES
Definition: compat.h:738
struct pool pool
void * vector_add(struct vector *v, struct pool *pool) DECLSPEC_HIDDEN
Definition: storage.c:171
unsigned dbghelp_options
Definition: dbghelp.c:73
ULONG_PTR is_first
ULONG_PTR is_source_file
unsigned vector_length(const struct vector *v) DECLSPEC_HIDDEN
Definition: storage.c:157
union line_info::@366 u
ULONG_PTR line_number

Referenced by codeview_snarf_linetab(), codeview_snarf_linetab2(), coff_process_info(), dwarf2_set_line_number(), pending_flush(), rsym_parse(), and stabs_parse().

◆ symt_add_func_local()

struct symt_data* symt_add_func_local ( struct module module,
struct symt_function func,
enum DataKind  dt,
const struct location loc,
struct symt_block block,
struct symt type,
const char name 
)

Definition at line 378 of file symbol.c.

384 {
385  struct symt_data* locsym;
386  struct symt** p;
387 
388  TRACE_(dbghelp_symt)("Adding local symbol (%s:%s): %s %p\n",
390  name, type);
391 
392  assert(func);
393  assert(func->symt.tag == SymTagFunction);
394  assert(dt == DataIsParam || dt == DataIsLocal);
395 
396  locsym = pool_alloc(&module->pool, sizeof(*locsym));
397  locsym->symt.tag = SymTagData;
398  locsym->hash_elt.name = pool_strdup(&module->pool, name);
399  locsym->hash_elt.next = NULL;
400  locsym->kind = dt;
401  locsym->container = block ? &block->symt : &func->symt;
402  locsym->type = type;
403  locsym->u.var = *loc;
404  if (block)
405  p = vector_add(&block->vchildren, &module->pool);
406  else
407  p = vector_add(&func->vchildren, &module->pool);
408  *p = &locsym->symt;
409  return locsym;
410 }
static unsigned int block
Definition: xmlmemory.c:118
GLenum func
Definition: glext.h:6028
WCHAR ModuleName[32]
Definition: compat.h:824
union symt_data::@363 u
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define assert(x)
Definition: debug.h:53
enum DataKind kind
void * pool_alloc(struct pool *a, size_t len) DECLSPEC_HIDDEN
Definition: storage.c:89
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
struct symt symt
struct symt * type
#define TRACE_(x)
Definition: compat.h:76
char * name
Definition: compiler.c:66
struct symt * container
struct location var
struct pool pool
char * pool_strdup(struct pool *a, const char *str) DECLSPEC_HIDDEN
Definition: storage.c:126
void * vector_add(struct vector *v, struct pool *pool) DECLSPEC_HIDDEN
Definition: storage.c:171
struct hash_table_elt hash_elt
Definition: name.c:38
GLfloat GLfloat p
Definition: glext.h:8902
IMAGEHLP_MODULEW64 module
GLuint const GLchar * name
Definition: glext.h:6031

Referenced by codeview_snarf(), dwarf2_parse_variable(), pending_flush(), and stabs_parse().

◆ symt_add_function_point()

struct symt_hierarchy_point* symt_add_function_point ( struct module module,
struct symt_function func,
enum SymTagEnum  point,
const struct location loc,
const char name 
)

Definition at line 452 of file symbol.c.

457 {
458  struct symt_hierarchy_point*sym;
459  struct symt** p;
460 
461  if ((sym = pool_alloc(&module->pool, sizeof(*sym))))
462  {
463  sym->symt.tag = point;
464  sym->parent = &func->symt;
465  sym->loc = *loc;
466  sym->hash_elt.name = name ? pool_strdup(&module->pool, name) : NULL;
467  p = vector_add(&func->vchildren, &module->pool);
468  *p = &sym->symt;
469  }
470  return sym;
471 }
GLenum func
Definition: glext.h:6028
POINTL point
Definition: edittest.c:50
void * pool_alloc(struct pool *a, size_t len) DECLSPEC_HIDDEN
Definition: storage.c:89
smooth NULL
Definition: ftsmooth.c:416
struct location loc
struct pool pool
char * pool_strdup(struct pool *a, const char *str) DECLSPEC_HIDDEN
Definition: storage.c:126
void * vector_add(struct vector *v, struct pool *pool) DECLSPEC_HIDDEN
Definition: storage.c:171
Definition: name.c:38
GLfloat GLfloat p
Definition: glext.h:8902
struct hash_table_elt hash_elt

Referenced by codeview_snarf(), dwarf2_parse_subprogram(), dwarf2_parse_subprogram_label(), rsym_finalize_function(), and stabs_finalize_function().

◆ symt_add_module_ht()

static void symt_add_module_ht ( struct module module,
struct symt_ht ht 
)
static

Definition at line 143 of file symbol.c.

144 {
145  ULONG64 addr;
146 
147  hash_table_add(&module->ht_symbols, &ht->hash_elt);
148  /* Don't store in sorttab a symbol without address, they are of
149  * no use here (e.g. constant values)
150  */
151  if (symt_get_address(&ht->symt, &addr) &&
153  {
156  }
157 }
BOOL symt_get_address(const struct symt *type, ULONG64 *addr) DECLSPEC_HIDDEN
Definition: type.c:119
struct hash_table ht_symbols
unsigned num_symbols
#define FALSE
Definition: types.h:117
int sortlist_valid
static BOOL symt_grow_sorttab(struct module *module, unsigned sz)
Definition: symbol.c:120
void hash_table_add(struct hash_table *ht, struct hash_table_elt *elt) DECLSPEC_HIDDEN
Definition: storage.c:378
unsigned __int64 ULONG64
Definition: imports.h:198
GLenum const GLvoid * addr
Definition: glext.h:9621
static const struct newhuff ht[]
Definition: huffman.h:296
struct symt_ht ** addr_sorttab

Referenced by symt_new_constant(), symt_new_function(), symt_new_global_variable(), symt_new_label(), symt_new_public(), and symt_new_thunk().

◆ symt_close_func_block()

struct symt_block* symt_close_func_block ( struct module module,
const struct symt_function func,
struct symt_block block,
unsigned  pc 
)

Definition at line 440 of file symbol.c.

443 {
444  assert(func);
445  assert(func->symt.tag == SymTagFunction);
446 
447  if (pc) block->size = func->address + pc - block->address;
448  return (block->container->tag == SymTagBlock) ?
449  CONTAINING_RECORD(block->container, struct symt_block, symt) : NULL;
450 }
static unsigned int block
Definition: xmlmemory.c:118
GLenum func
Definition: glext.h:6028
#define assert(x)
Definition: debug.h:53
smooth NULL
Definition: ftsmooth.c:416
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by codeview_snarf(), dwarf2_parse_inlined_subroutine(), dwarf2_parse_subprogram_block(), and stabs_parse().

◆ symt_cmp_addr()

int __cdecl symt_cmp_addr ( const void p1,
const void p2 
)

Definition at line 57 of file symbol.c.

58 {
59  const struct symt* sym1 = *(const struct symt* const *)p1;
60  const struct symt* sym2 = *(const struct symt* const *)p2;
61  ULONG64 a1, a2;
62 
63  symt_get_address(sym1, &a1);
64  symt_get_address(sym2, &a2);
65  return cmp_addr(a1, a2);
66 }
BOOL symt_get_address(const struct symt *type, ULONG64 *addr) DECLSPEC_HIDDEN
Definition: type.c:119
static int cmp_addr(ULONG64 a1, ULONG64 a2)
Definition: symbol.c:43
static const struct update_accum a2
Definition: msg.c:586
unsigned __int64 ULONG64
Definition: imports.h:198
static const struct update_accum a1
Definition: msg.c:578

Referenced by coff_process_info(), and resort_symbols().

◆ symt_enum_locals()

static BOOL symt_enum_locals ( struct process pcs,
const WCHAR mask,
const struct sym_enum se 
)
static

Definition at line 1000 of file symbol.c.

1002 {
1003  struct module_pair pair;
1004  struct symt_ht* sym;
1006 
1007  se->sym_info->SizeOfStruct = sizeof(*se->sym_info);
1008  se->sym_info->MaxNameLen = sizeof(se->buffer) - sizeof(SYMBOL_INFO);
1009 
1010  pair.pcs = pcs;
1011  pair.requested = module_find_by_addr(pair.pcs, pc, DMT_UNKNOWN);
1012  if (!module_get_debug(&pair)) return FALSE;
1013  if ((sym = symt_find_nearest(pair.effective, pc)) == NULL) return FALSE;
1014 
1015  if (sym->symt.tag == SymTagFunction)
1016  {
1017  return symt_enum_locals_helper(&pair, mask ? mask : starW, se, (struct symt_function*)sym,
1018  &((struct symt_function*)sym)->vchildren);
1019  }
1020  return FALSE;
1021 }
SYMBOL_INFO * sym_info
Definition: symbol.c:744
ULONG MaxNameLen
Definition: compat.h:799
IMAGEHLP_STACK_FRAME ctx_frame
GLenum GLint GLuint mask
Definition: glext.h:6028
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
char buffer[sizeof(SYMBOL_INFO)+MAX_SYM_NAME]
Definition: symbol.c:748
BOOL module_get_debug(struct module_pair *) DECLSPEC_HIDDEN
Definition: module.c:374
struct symt symt
ULONG64 InstructionOffset
Definition: compat.h:1124
struct module * module_find_by_addr(const struct process *pcs, DWORD64 addr, enum module_type type) DECLSPEC_HIDDEN
Definition: module.c:420
ULONG SizeOfStruct
Definition: compat.h:786
uint32_t DWORD_PTR
Definition: typedefs.h:65
static BOOL symt_enum_locals_helper(struct module_pair *pair, const WCHAR *match, const struct sym_enum *se, struct symt_function *func, const struct vector *v)
Definition: symbol.c:953
Definition: _pair.h:47
static const WCHAR starW[]
Definition: symbol.c:41
struct symt_ht * symt_find_nearest(struct module *module, DWORD_PTR addr)
Definition: symbol.c:903

Referenced by sym_enum().

◆ symt_enum_locals_helper()

static BOOL symt_enum_locals_helper ( struct module_pair pair,
const WCHAR match,
const struct sym_enum se,
struct symt_function func,
const struct vector v 
)
static

Definition at line 953 of file symbol.c.

956 {
957  struct symt* lsym = NULL;
958  DWORD pc = pair->pcs->ctx_frame.InstructionOffset;
959  unsigned int i;
960  WCHAR* nameW;
961  BOOL ret;
962 
963  for (i=0; i<vector_length(v); i++)
964  {
965  lsym = *(struct symt**)vector_at(v, i);
966  switch (lsym->tag)
967  {
968  case SymTagBlock:
969  {
970  struct symt_block* block = (struct symt_block*)lsym;
971  if (pc < block->address || block->address + block->size <= pc)
972  continue;
973  if (!symt_enum_locals_helper(pair, match, se, func, &block->vchildren))
974  return FALSE;
975  }
976  break;
977  case SymTagData:
978  nameW = symt_get_nameW(lsym);
982  if (ret)
983  {
984  if (send_symbol(se, pair, func, lsym)) return FALSE;
985  }
986  break;
987  case SymTagLabel:
989  case SymTagFuncDebugEnd:
990  case SymTagCustom:
991  break;
992  default:
993  FIXME("Unknown type: %u (%x)\n", lsym->tag, lsym->tag);
994  assert(0);
995  }
996  }
997  return TRUE;
998 }
static unsigned int block
Definition: xmlmemory.c:118
GLenum func
Definition: glext.h:6028
WCHAR * symt_get_nameW(const struct symt *sym) DECLSPEC_HIDDEN
Definition: type.c:106
#define TRUE
Definition: types.h:120
Definition: match.c:28
void * vector_at(const struct vector *v, unsigned pos) DECLSPEC_HIDDEN
Definition: storage.c:162
#define assert(x)
Definition: debug.h:53
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
BOOL WINAPI SymMatchStringW(PCWSTR string, PCWSTR re, BOOL _case)
Definition: symbol.c:2038
#define SYMOPT_CASE_INSENSITIVE
Definition: compat.h:735
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
enum SymTagEnum tag
#define FIXME(fmt,...)
Definition: debug.h:111
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR nameW[]
Definition: main.c:46
#define GetProcessHeap()
Definition: compat.h:484
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint address
Definition: glext.h:9393
int ret
static BOOL symt_enum_locals_helper(struct module_pair *pair, const WCHAR *match, const struct sym_enum *se, struct symt_function *func, const struct vector *v)
Definition: symbol.c:953
const GLdouble * v
Definition: gl.h:2040
Definition: _pair.h:47
unsigned dbghelp_options
Definition: dbghelp.c:73
static BOOL send_symbol(const struct sym_enum *se, struct module_pair *pair, const struct symt_function *func, const struct symt *sym)
Definition: symbol.c:751
#define HeapFree(x, y, z)
Definition: compat.h:483
unsigned vector_length(const struct vector *v) DECLSPEC_HIDDEN
Definition: storage.c:157

Referenced by symt_enum_locals().

◆ symt_enum_module()

static BOOL symt_enum_module ( struct module_pair pair,
const WCHAR match,
const struct sym_enum se 
)
static

Definition at line 761 of file symbol.c.

763 {
764  void* ptr;
765  struct symt_ht* sym = NULL;
766  struct hash_table_iter hti;
767  WCHAR* nameW;
768  BOOL ret;
769 
770  hash_table_iter_init(&pair->effective->ht_symbols, &hti, NULL);
771  while ((ptr = hash_table_iter_up(&hti)))
772  {
773  sym = CONTAINING_RECORD(ptr, struct symt_ht, hash_elt);
774  nameW = symt_get_nameW(&sym->symt);
777  if (ret)
778  {
779  se->sym_info->SizeOfStruct = sizeof(SYMBOL_INFO);
780  se->sym_info->MaxNameLen = sizeof(se->buffer) - sizeof(SYMBOL_INFO);
781  if (send_symbol(se, pair, NULL, &sym->symt)) return TRUE;
782  }
783  }
784  return FALSE;
785 }
SYMBOL_INFO * sym_info
Definition: symbol.c:744
WCHAR * symt_get_nameW(const struct symt *sym) DECLSPEC_HIDDEN
Definition: type.c:106
ULONG MaxNameLen
Definition: compat.h:799
#define TRUE
Definition: types.h:120
Definition: match.c:28
BOOL WINAPI SymMatchStringW(PCWSTR string, PCWSTR re, BOOL _case)
Definition: symbol.c:2038
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
static PVOID ptr
Definition: dispmode.c:27
void hash_table_iter_init(const struct hash_table *ht, struct hash_table_iter *hti, const char *name) DECLSPEC_HIDDEN
Definition: storage.c:405
smooth NULL
Definition: ftsmooth.c:416
char buffer[sizeof(SYMBOL_INFO)+MAX_SYM_NAME]
Definition: symbol.c:748
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
static const WCHAR nameW[]
Definition: main.c:46
#define GetProcessHeap()
Definition: compat.h:484
__wchar_t WCHAR
Definition: xmlstorage.h:180
struct _SYMBOL_INFO SYMBOL_INFO
struct symt symt
int ret
ULONG SizeOfStruct
Definition: compat.h:786
void * hash_table_iter_up(struct hash_table_iter *hti) DECLSPEC_HIDDEN
Definition: storage.c:422
Definition: _pair.h:47
static BOOL send_symbol(const struct sym_enum *se, struct module_pair *pair, const struct symt_function *func, const struct symt *sym)
Definition: symbol.c:751
#define HeapFree(x, y, z)
Definition: compat.h:483

Referenced by sym_enum().

◆ symt_fill_func_line_info()

BOOL symt_fill_func_line_info ( const struct module module,
const struct symt_function func,
DWORD64  addr,
IMAGEHLP_LINE64 line 
)

Definition at line 1480 of file symbol.c.

1482 {
1483  struct line_info* dli = NULL;
1484  BOOL found = FALSE;
1485  int i;
1486 
1487  assert(func->symt.tag == SymTagFunction);
1488 
1489  for (i=vector_length(&func->vlines)-1; i>=0; i--)
1490  {
1491  dli = vector_at(&func->vlines, i);
1492  if (!dli->is_source_file)
1493  {
1494  if (found || dli->u.pc_offset > addr) continue;
1495  line->LineNumber = dli->line_number;
1496  line->Address = dli->u.pc_offset;
1497  line->Key = dli;
1498  found = TRUE;
1499  continue;
1500  }
1501  if (found)
1502  {
1503  if (dbghelp_opt_native)
1504  {
1505  /* Return native file paths when using winedbg */
1506  line->FileName = (char*)source_get(module, dli->u.source_file);
1507  }
1508  else
1509  {
1511  DWORD len = WideCharToMultiByte(CP_ACP, 0, dospath, -1, NULL, 0, NULL, NULL);
1512  line->FileName = fetch_buffer(module->process, len);
1513  WideCharToMultiByte(CP_ACP, 0, dospath, -1, line->FileName, len, NULL, NULL);
1514  HeapFree( GetProcessHeap(), 0, dospath );
1515  }
1516  return TRUE;
1517  }
1518  }
1519  return FALSE;
1520 }
GLenum func
Definition: glext.h:6028
ULONG_PTR pc_offset
#define WideCharToMultiByte
Definition: compat.h:111
#define TRUE
Definition: types.h:120
void * vector_at(const struct vector *v, unsigned pos) DECLSPEC_HIDDEN
Definition: storage.c:162
#define CP_ACP
Definition: compat.h:109
BOOL dbghelp_opt_native
Definition: dbghelp.c:74
#define assert(x)
Definition: debug.h:53
const char * source_get(const struct module *module, unsigned idx) DECLSPEC_HIDDEN
Definition: source.c:130
unsigned source_file
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
Definition: parser.c:48
void * fetch_buffer(struct process *pcs, unsigned size)
Definition: dbghelp.c:128
#define GetProcessHeap()
Definition: compat.h:484
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum const GLvoid * addr
Definition: glext.h:9621
GLenum GLsizei len
Definition: glext.h:6722
struct process * process
ULONG_PTR is_source_file
WCHAR *CDECL wine_get_dos_file_name(LPCSTR str)
Definition: path.c:42
#define HeapFree(x, y, z)
Definition: compat.h:483
unsigned vector_length(const struct vector *v) DECLSPEC_HIDDEN
Definition: storage.c:157
union line_info::@366 u
ULONG_PTR line_number

Referenced by rsym_finalize_function(), stabs_finalize_function(), and SymGetLineFromAddr64().

◆ symt_fill_sym_info()

static void symt_fill_sym_info ( struct module_pair pair,
const struct symt_function func,
const struct symt sym,
SYMBOL_INFO sym_info 
)
static

Definition at line 582 of file symbol.c.

585 {
586  const char* name;
587  DWORD64 size;
588 
589  if (!symt_get_info(pair->effective, sym, TI_GET_TYPE, &sym_info->TypeIndex))
590  sym_info->TypeIndex = 0;
591  sym_info->Index = symt_ptr2index(pair->effective, sym);
592  sym_info->Reserved[0] = sym_info->Reserved[1] = 0;
593  if (!symt_get_info(pair->effective, sym, TI_GET_LENGTH, &size) &&
594  (!sym_info->TypeIndex ||
595  !symt_get_info(pair->effective, symt_index2ptr(pair->effective, sym_info->TypeIndex),
596  TI_GET_LENGTH, &size)))
597  size = 0;
598  sym_info->Size = (DWORD)size;
599  sym_info->ModBase = pair->requested->module.BaseOfImage;
600  sym_info->Flags = 0;
601  sym_info->Value = 0;
602 
603  switch (sym->tag)
604  {
605  case SymTagData:
606  {
607  const struct symt_data* data = (const struct symt_data*)sym;
608  switch (data->kind)
609  {
610  case DataIsParam:
611  sym_info->Flags |= SYMFLAG_PARAMETER;
612  /* fall through */
613  case DataIsLocal:
614  sym_info->Flags |= SYMFLAG_LOCAL;
615  {
616  struct location loc = data->u.var;
617 
618  if (loc.kind >= loc_user)
619  {
620  unsigned i;
621  struct module_format* modfmt;
622 
623  for (i = 0; i < DFI_LAST; i++)
624  {
625  modfmt = pair->effective->format_info[i];
626  if (modfmt && modfmt->loc_compute)
627  {
628  modfmt->loc_compute(pair->pcs, modfmt, func, &loc);
629  break;
630  }
631  }
632  }
633  switch (loc.kind)
634  {
635  case loc_error:
636  /* for now we report error cases as a negative register number */
637  /* fall through */
638  case loc_register:
639  sym_info->Flags |= SYMFLAG_REGISTER;
640  sym_info->Register = loc.reg;
641  sym_info->Address = 0;
642  break;
643  case loc_regrel:
644  sym_info->Flags |= SYMFLAG_REGREL;
645  sym_info->Register = loc.reg;
646  if (loc.reg == CV_REG_NONE || (int)loc.reg < 0 /* error */)
647  FIXME("suspicious register value %x\n", loc.reg);
648  sym_info->Address = loc.offset;
649  break;
650  case loc_absolute:
651  sym_info->Flags |= SYMFLAG_VALUEPRESENT;
652  sym_info->Value = loc.offset;
653  break;
654  default:
655  FIXME("Shouldn't happen (kind=%d), debug reader backend is broken\n", loc.kind);
656  assert(0);
657  }
658  }
659  break;
660  case DataIsGlobal:
661  case DataIsFileStatic:
662  switch (data->u.var.kind)
663  {
664  case loc_tlsrel:
665  sym_info->Flags |= SYMFLAG_TLSREL;
666  /* fall through */
667  case loc_absolute:
668  symt_get_address(sym, &sym_info->Address);
669  sym_info->Register = 0;
670  break;
671  default:
672  FIXME("Shouldn't happen (kind=%d), debug reader backend is broken\n", data->u.var.kind);
673  assert(0);
674  }
675  break;
676  case DataIsConstant:
677  sym_info->Flags |= SYMFLAG_VALUEPRESENT;
678  switch (data->u.value.n1.n2.vt)
679  {
680  case VT_I4: sym_info->Value = (ULONG)data->u.value.n1.n2.n3.lVal; break;
681  case VT_I2: sym_info->Value = (ULONG)(LONG_PTR)data->u.value.n1.n2.n3.iVal; break;
682  case VT_I1: sym_info->Value = (ULONG)(LONG_PTR)data->u.value.n1.n2.n3.cVal; break;
683  case VT_UI4: sym_info->Value = (ULONG)data->u.value.n1.n2.n3.ulVal; break;
684  case VT_UI2: sym_info->Value = (ULONG)data->u.value.n1.n2.n3.uiVal; break;
685  case VT_UI1: sym_info->Value = (ULONG)data->u.value.n1.n2.n3.bVal; break;
686  case VT_I1 | VT_BYREF: sym_info->Value = (ULONG64)(DWORD_PTR)data->u.value.n1.n2.n3.byref; break;
687  case VT_EMPTY: sym_info->Value = 0; break;
688  default:
689  FIXME("Unsupported variant type (%u)\n", data->u.value.n1.n2.vt);
690  sym_info->Value = 0;
691  break;
692  }
693  break;
694  default:
695  FIXME("Unhandled kind (%u) in sym data\n", data->kind);
696  }
697  }
698  break;
699  case SymTagPublicSymbol:
700  {
701  const struct symt_public* pub = (const struct symt_public*)sym;
702  if (pub->is_function)
703  sym_info->Flags |= SYMFLAG_PUBLIC_CODE;
704  else
705  sym_info->Flags |= SYMFLAG_EXPORT;
706  symt_get_address(sym, &sym_info->Address);
707  }
708  break;
709  case SymTagFunction:
710  symt_get_address(sym, &sym_info->Address);
711  break;
712  case SymTagThunk:
713  sym_info->Flags |= SYMFLAG_THUNK;
714  symt_get_address(sym, &sym_info->Address);
715  break;
716  default:
717  symt_get_address(sym, &sym_info->Address);
718  sym_info->Register = 0;
719  break;
720  }
721  sym_info->Scope = 0; /* FIXME */
722  sym_info->Tag = sym->tag;
723  name = symt_get_name(sym);
724  if (sym_info->MaxNameLen)
725  {
727  ((sym_info->NameLen = UnDecorateSymbolName(name, sym_info->Name,
728  sym_info->MaxNameLen, UNDNAME_NAME_ONLY)) == 0))
729  {
730  sym_info->NameLen = min(strlen(name), sym_info->MaxNameLen - 1);
731  memcpy(sym_info->Name, name, sym_info->NameLen);
732  sym_info->Name[sym_info->NameLen] = '\0';
733  }
734  }
735  TRACE_(dbghelp_symt)("%p => %s %u %s\n",
736  sym, sym_info->Name, sym_info->Size,
737  wine_dbgstr_longlong(sym_info->Address));
738 }
BOOL symt_get_address(const struct symt *type, ULONG64 *addr) DECLSPEC_HIDDEN
Definition: type.c:119
GLenum func
Definition: glext.h:6028
ULONG Tag
Definition: compat.h:797
#define LONG_PTR
Definition: treelist.c:79
CHAR Name[1]
Definition: compat.h:800
ULONG NameLen
Definition: compat.h:798
Definition: compat.h:2046
ULONG MaxNameLen
Definition: compat.h:799
#define SYMFLAG_REGREL
Definition: compat.h:745
Definition: compat.h:2058
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define SYMFLAG_TLSREL
Definition: compat.h:755
ULONG Scope
Definition: compat.h:796
ULONG Flags
Definition: compat.h:792
ULONG TypeIndex
Definition: compat.h:787
#define assert(x)
Definition: debug.h:53
ULONG64 Address
Definition: compat.h:794
const char * symt_get_name(const struct symt *sym) DECLSPEC_HIDDEN
Definition: type.c:81
#define SYMFLAG_PUBLIC_CODE
Definition: compat.h:763
#define UNDNAME_NAME_ONLY
Definition: compat.h:765
#define DWORD
Definition: nt_native.h:44
DWORD symt_ptr2index(struct module *module, const struct symt *sym)
Definition: symbol.c:68
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
ULONG64 Reserved[2]
Definition: compat.h:788
struct symt * symt_index2ptr(struct module *module, DWORD id)
Definition: symbol.c:110
enum SymTagEnum tag
#define FIXME(fmt,...)
Definition: debug.h:111
ULONG64 ModBase
Definition: compat.h:791
ULONG Index
Definition: compat.h:789
#define SYMFLAG_LOCAL
Definition: compat.h:748
ULONG_PTR offset
#define SYMFLAG_VALUEPRESENT
Definition: compat.h:743
DWORD WINAPI UnDecorateSymbolName(const char *decorated_name, char *undecorated_name, DWORD undecorated_length, DWORD flags)
Definition: symbol.c:1832
#define TRACE_(x)
Definition: compat.h:76
GLsizeiptr size
Definition: glext.h:5919
void(* loc_compute)(struct process *pcs, const struct module_format *modfmt, const struct symt_function *func, struct location *loc)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define SYMOPT_UNDNAME
Definition: compat.h:736
unsigned __int64 ULONG64
Definition: imports.h:198
unsigned reg
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define SYMFLAG_REGISTER
Definition: compat.h:744
ULONG Register
Definition: compat.h:795
unsigned kind
BOOL symt_get_info(struct module *module, const struct symt *type, IMAGEHLP_SYMBOL_TYPE_INFO req, void *pInfo) DECLSPEC_HIDDEN
Definition: type.c:536
uint64_t DWORD64
Definition: typedefs.h:67
#define SYMFLAG_EXPORT
Definition: compat.h:750
#define min(a, b)
Definition: monoChain.cc:55
Definition: _pair.h:47
unsigned dbghelp_options
Definition: dbghelp.c:73
#define SYMFLAG_THUNK
Definition: compat.h:754
ULONG64 Value
Definition: compat.h:793
Definition: name.c:38
unsigned int ULONG
Definition: retypes.h:1
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:49
#define SYMFLAG_PARAMETER
Definition: compat.h:747
ULONG Size
Definition: compat.h:790
Definition: compat.h:2045
GLuint const GLchar * name
Definition: glext.h:6031

Referenced by find_name(), send_symbol(), and SymFromAddr().

◆ symt_find_nearest()

struct symt_ht* symt_find_nearest ( struct module module,
DWORD_PTR  addr 
)

Definition at line 903 of file symbol.c.

904 {
905  int mid, high, low;
906  ULONG64 ref_addr, ref_size;
907 
909  {
910  if (!resort_symbols(module)) return NULL;
911  }
912 
913  /*
914  * Binary search to find closest symbol.
915  */
916  low = 0;
917  high = module->num_sorttab;
918 
919  symt_get_address(&module->addr_sorttab[0]->symt, &ref_addr);
920  if (addr <= ref_addr)
921  {
922  low = symt_get_best_at(module, 0);
923  return module->addr_sorttab[low];
924  }
925 
926  if (high)
927  {
928  symt_get_address(&module->addr_sorttab[high - 1]->symt, &ref_addr);
929  symt_get_length(module, &module->addr_sorttab[high - 1]->symt, &ref_size);
930  if (addr >= ref_addr + ref_size) return NULL;
931  }
932 
933  while (high > low + 1)
934  {
935  mid = (high + low) / 2;
936  if (cmp_sorttab_addr(module, mid, addr) < 0)
937  low = mid;
938  else
939  high = mid;
940  }
941  if (low != high && high != module->num_sorttab &&
942  cmp_sorttab_addr(module, high, addr) <= 0)
943  low = high;
944 
945  /* If found symbol is a public symbol, check if there are any other entries that
946  * might also have the same address, but would get better information
947  */
948  low = symt_get_best_at(module, low);
949 
950  return module->addr_sorttab[low];
951 }
BOOL symt_get_address(const struct symt *type, ULONG64 *addr) DECLSPEC_HIDDEN
Definition: type.c:119
static BOOL resort_symbols(struct module *module)
Definition: symbol.c:812
int sortlist_valid
smooth NULL
Definition: ftsmooth.c:416
unsigned num_sorttab
static int cmp_sorttab_addr(struct module *module, int idx, ULONG64 addr)
Definition: symbol.c:50
static void symt_get_length(struct module *module, const struct symt *symt, ULONG64 *size)
Definition: symbol.c:863
unsigned __int64 ULONG64
Definition: imports.h:198
GLenum const GLvoid * addr
Definition: glext.h:9621
static int symt_get_best_at(struct module *module, int idx_sorttab)
Definition: symbol.c:876
struct symt_ht ** addr_sorttab

Referenced by codeview_add_variable(), codeview_snarf_linetab(), codeview_snarf_linetab2(), dwarf2_set_line_number(), elf_new_wine_thunks(), macho_finish_stabs(), SymFromAddr(), SymGetLineFromAddr64(), symt_enum_locals(), and symt_new_public().

◆ symt_get_best_at()

static int symt_get_best_at ( struct module module,
int  idx_sorttab 
)
static

Definition at line 876 of file symbol.c.

877 {
878  ULONG64 ref_addr;
879  int idx_sorttab_orig = idx_sorttab;
880  if (module->addr_sorttab[idx_sorttab]->symt.tag == SymTagPublicSymbol)
881  {
882  symt_get_address(&module->addr_sorttab[idx_sorttab]->symt, &ref_addr);
883  while (idx_sorttab > 0 &&
884  module->addr_sorttab[idx_sorttab]->symt.tag == SymTagPublicSymbol &&
885  !cmp_sorttab_addr(module, idx_sorttab - 1, ref_addr))
886  idx_sorttab--;
887  if (module->addr_sorttab[idx_sorttab]->symt.tag == SymTagPublicSymbol)
888  {
889  idx_sorttab = idx_sorttab_orig;
890  while (idx_sorttab < module->num_sorttab - 1 &&
891  module->addr_sorttab[idx_sorttab]->symt.tag == SymTagPublicSymbol &&
892  !cmp_sorttab_addr(module, idx_sorttab + 1, ref_addr))
893  idx_sorttab++;
894  }
895  /* if no better symbol was found restore the original */
896  if (module->addr_sorttab[idx_sorttab]->symt.tag == SymTagPublicSymbol)
897  idx_sorttab = idx_sorttab_orig;
898  }
899  return idx_sorttab;
900 }
BOOL symt_get_address(const struct symt *type, ULONG64 *addr) DECLSPEC_HIDDEN
Definition: type.c:119
static int cmp_sorttab_addr(struct module *module, int idx, ULONG64 addr)
Definition: symbol.c:50
unsigned __int64 ULONG64
Definition: imports.h:198
struct symt_ht ** addr_sorttab

Referenced by symt_find_nearest().

◆ symt_get_func_line_next()

BOOL symt_get_func_line_next ( const struct module module,
PIMAGEHLP_LINE64  line 
)

Definition at line 1734 of file symbol.c.

1735 {
1736  struct line_info* li;
1737 
1738  if (line->Key == 0) return FALSE;
1739  li = line->Key;
1740  while (!li->is_last)
1741  {
1742  li++;
1743  if (!li->is_source_file)
1744  {
1745  line->LineNumber = li->line_number;
1746  line->Address = li->u.pc_offset;
1747  line->Key = li;
1748  return TRUE;
1749  }
1750  line->FileName = (char*)source_get(module, li->u.source_file);
1751  }
1752  return FALSE;
1753 }
ULONG_PTR pc_offset
#define TRUE
Definition: types.h:120
const char * source_get(const struct module *module, unsigned idx) DECLSPEC_HIDDEN
Definition: source.c:130
unsigned source_file
#define FALSE
Definition: types.h:117
Definition: parser.c:48
ULONG_PTR is_last
ULONG_PTR is_source_file
union line_info::@366 u
ULONG_PTR line_number

Referenced by rsym_finalize_function(), stabs_finalize_function(), and SymGetLineNext64().

◆ symt_get_length()

static void symt_get_length ( struct module module,
const struct symt symt,
ULONG64 size 
)
static

Definition at line 863 of file symbol.c.

864 {
865  DWORD type_index;
866 
868  return;
869 
870  if (symt_get_info(module, symt, TI_GET_TYPE, &type_index) &&
871  symt_get_info(module, symt_index2ptr(module, type_index), TI_GET_LENGTH, size)) return;
872  *size = 0x1000; /* arbitrary value */
873 }
struct symt * symt_index2ptr(struct module *module, DWORD id)
Definition: symbol.c:110
GLsizeiptr size
Definition: glext.h:5919
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL symt_get_info(struct module *module, const struct symt *type, IMAGEHLP_SYMBOL_TYPE_INFO req, void *pInfo) DECLSPEC_HIDDEN
Definition: type.c:536

Referenced by symt_find_nearest().

◆ symt_grow_sorttab()

static BOOL symt_grow_sorttab ( struct module module,
unsigned  sz 
)
static

Definition at line 120 of file symbol.c.

121 {
122  struct symt_ht** new;
123  unsigned int size;
124 
125  if (sz <= module->sorttab_size) return TRUE;
126  if (module->addr_sorttab)
127  {
128  size = module->sorttab_size * 2;
130  size * sizeof(struct symt_ht*));
131  }
132  else
133  {
134  size = 64;
135  new = HeapAlloc(GetProcessHeap(), 0, size * sizeof(struct symt_ht*));
136  }
137  if (!new) return FALSE;
139  module->addr_sorttab = new;
140  return TRUE;
141 }
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:484
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)