ReactOS  0.4.14-dev-41-g31d7680
symbol.c File Reference
#include "config.h"
#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 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, unsigned long address, unsigned src_idx)
 
struct symt_publicsymt_new_public (struct module *module, struct symt_compiland *compiland, const char *name, BOOL is_function, unsigned long 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, unsigned long size, struct symt *type)
 
struct symt_functionsymt_new_function (struct module *module, struct symt_compiland *compiland, const char *name, unsigned long addr, unsigned long size, struct symt *sig_type)
 
void symt_add_func_line (struct module *module, struct symt_function *func, unsigned source_idx, int line_num, unsigned long 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, unsigned long addr, unsigned long 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, unsigned long 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)
 
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 1873 of file symbol.c.

Function Documentation

◆ cmp_addr()

static int cmp_addr ( ULONG64  a1,
ULONG64  a2 
)
inlinestatic

Definition at line 45 of file symbol.c.

46 {
47  if (a1 > a2) return 1;
48  if (a1 < a2) return -1;
49  return 0;
50 }
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 52 of file symbol.c.

53 {
54  ULONG64 ref;
56  return cmp_addr(ref, addr);
57 }
BOOL symt_get_address(const struct symt *type, ULONG64 *addr) DECLSPEC_HIDDEN
Definition: type.c:120
static int cmp_addr(ULONG64 a1, ULONG64 a2)
Definition: symbol.c:45
Definition: send.c:47
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 1597 of file symbol.c.

1599 {
1600  l32->Key = l64->Key;
1601  l32->LineNumber = l64->LineNumber;
1602  l32->FileName = l64->FileName;
1603  l32->Address = l64->Address;
1604 }
DWORD LineNumber
Definition: compat.h:1162
PCHAR FileName
Definition: compat.h:747
DWORD Address
Definition: compat.h:1164
DWORD LineNumber
Definition: compat.h:746
PCHAR FileName
Definition: compat.h:1163
DWORD64 Address
Definition: compat.h:748

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 1568 of file symbol.c.

1570 {
1571  l64->Key = l32->Key;
1572  l64->LineNumber = l32->LineNumber;
1573  l64->FileName = l32->FileName;
1574  l64->Address = l32->Address;
1575 }
DWORD LineNumber
Definition: compat.h:1162
PCHAR FileName
Definition: compat.h:747
DWORD Address
Definition: compat.h:1164
DWORD LineNumber
Definition: compat.h:746
PCHAR FileName
Definition: compat.h:1163
DWORD64 Address
Definition: compat.h:748

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 1581 of file symbol.c.

1582 {
1583  unsigned len;
1584 
1585  l64w->Key = l64->Key;
1586  l64w->LineNumber = l64->LineNumber;
1587  len = MultiByteToWideChar(CP_ACP, 0, l64->FileName, -1, NULL, 0);
1588  if ((l64w->FileName = fetch_buffer(pcs, len * sizeof(WCHAR))))
1589  MultiByteToWideChar(CP_ACP, 0, l64->FileName, -1, l64w->FileName, len);
1590  l64w->Address = l64->Address;
1591 }
DWORD LineNumber
Definition: compat.h:1180
#define CP_ACP
Definition: compat.h:99
PCHAR FileName
Definition: compat.h:747
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLenum GLsizei len
Definition: glext.h:6722
void * fetch_buffer(struct process *pcs, unsigned size)
Definition: dbghelp.c:109
DWORD LineNumber
Definition: compat.h:746
#define MultiByteToWideChar
Definition: compat.h:100
DWORD64 Address
Definition: compat.h:748
DWORD64 Address
Definition: compat.h:1182

Referenced by SymGetLineFromAddrW64().

◆ copy_symbolW()

void copy_symbolW ( SYMBOL_INFOW siw,
const SYMBOL_INFO si 
)

Definition at line 1037 of file symbol.c.

1038 {
1039  siw->SizeOfStruct = si->SizeOfStruct;
1040  siw->TypeIndex = si->TypeIndex;
1041  siw->Reserved[0] = si->Reserved[0];
1042  siw->Reserved[1] = si->Reserved[1];
1043  siw->Index = si->Index;
1044  siw->Size = si->Size;
1045  siw->ModBase = si->ModBase;
1046  siw->Flags = si->Flags;
1047  siw->Value = si->Value;
1048  siw->Address = si->Address;
1049  siw->Register = si->Register;
1050  siw->Scope = si->Scope;
1051  siw->Tag = si->Tag;
1052  siw->NameLen = si->NameLen;
1053  siw->MaxNameLen = si->MaxNameLen;
1054  MultiByteToWideChar(CP_ACP, 0, si->Name, -1, siw->Name, siw->MaxNameLen);
1055 }
ULONG Tag
Definition: compat.h:698
CHAR Name[1]
Definition: compat.h:701
ULONG NameLen
Definition: compat.h:699
ULONG64 Address
Definition: compat.h:1007
ULONG MaxNameLen
Definition: compat.h:700
ULONG MaxNameLen
Definition: compat.h:1012
ULONG64 ModBase
Definition: compat.h:1004
#define CP_ACP
Definition: compat.h:99
ULONG Scope
Definition: compat.h:697
ULONG Flags
Definition: compat.h:693
ULONG TypeIndex
Definition: compat.h:688
ULONG64 Address
Definition: compat.h:695
ULONG NameLen
Definition: compat.h:1011
ULONG64 Reserved[2]
Definition: compat.h:689
ULONG64 Reserved[2]
Definition: compat.h:1001
ULONG SizeOfStruct
Definition: compat.h:999
ULONG Scope
Definition: compat.h:1009
ULONG64 ModBase
Definition: compat.h:692
ULONG Index
Definition: compat.h:690
ULONG64 Value
Definition: compat.h:1006
ULONG Index
Definition: compat.h:1002
ULONG Flags
Definition: compat.h:1005
ULONG SizeOfStruct
Definition: compat.h:687
ULONG Register
Definition: compat.h:696
ULONG TypeIndex
Definition: compat.h:1000
#define MultiByteToWideChar
Definition: compat.h:100
WCHAR Name[1]
Definition: compat.h:1013
ULONG Register
Definition: compat.h:1008
ULONG64 Value
Definition: compat.h:694
ULONG Tag
Definition: compat.h:1010
ULONG Size
Definition: compat.h:691
ULONG Size
Definition: compat.h:1003

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 1128 of file symbol.c.

1131 {
1132  struct sym_enum se;
1133 
1134  se.cb = EnumSymbolsCallback;
1135  se.user = UserContext;
1136  se.index = 0;
1137  se.tag = 0;
1138  se.addr = 0;
1139  se.sym_info = (PSYMBOL_INFO)se.buffer;
1140 
1141  return sym_enum(hProcess, BaseOfDll, Mask, &se);
1142 }
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
struct _SYMBOL_INFO * PSYMBOL_INFO
PSYM_ENUMERATESYMBOLS_CALLBACK cb
Definition: symbol.c:744

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 2047 of file symbol.c.

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

Referenced by SymSearch(), and SymSearchW().

◆ file_regex()

static WCHAR* file_regex ( const char srcfile)
static

Definition at line 161 of file symbol.c.

162 {
163  WCHAR* mask;
164  WCHAR* p;
165 
166  if (!srcfile || !*srcfile)
167  {
168  if (!(p = mask = HeapAlloc(GetProcessHeap(), 0, 3 * sizeof(WCHAR)))) return NULL;
169  *p++ = '?';
170  *p++ = '#';
171  }
172  else
173  {
174  DWORD sz = MultiByteToWideChar(CP_ACP, 0, srcfile, -1, NULL, 0);
175  WCHAR* srcfileW;
176 
177  /* FIXME: we use here the largest conversion for every char... could be optimized */
178  p = mask = HeapAlloc(GetProcessHeap(), 0, (5 * strlen(srcfile) + 1 + sz) * sizeof(WCHAR));
179  if (!mask) return NULL;
180  srcfileW = mask + 5 * strlen(srcfile) + 1;
181  MultiByteToWideChar(CP_ACP, 0, srcfile, -1, srcfileW, sz);
182 
183  while (*srcfileW)
184  {
185  switch (*srcfileW)
186  {
187  case '\\':
188  case '/':
189  *p++ = '[';
190  *p++ = '\\';
191  *p++ = '\\';
192  *p++ = '/';
193  *p++ = ']';
194  break;
195  case '.':
196  *p++ = '?';
197  break;
198  default:
199  *p++ = *srcfileW;
200  break;
201  }
202  srcfileW++;
203  }
204  }
205  *p = 0;
206  return mask;
207 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define CP_ACP
Definition: compat.h:99
GLenum GLint GLuint mask
Definition: glext.h:6028
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
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:100
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 1370 of file symbol.c.

1372 {
1373  struct hash_table_iter hti;
1374  void* ptr;
1375  struct symt_ht* sym = NULL;
1376  struct module_pair pair;
1377 
1378  pair.pcs = pcs;
1379  if (!(pair.requested = module)) return FALSE;
1380  if (!module_get_debug(&pair)) return FALSE;
1381 
1382  hash_table_iter_init(&pair.effective->ht_symbols, &hti, name);
1383  while ((ptr = hash_table_iter_up(&hti)))
1384  {
1385  sym = CONTAINING_RECORD(ptr, struct symt_ht, hash_elt);
1386 
1387  if (!strcmp(sym->hash_elt.name, name))
1388  {
1389  symt_fill_sym_info(&pair, NULL, &sym->symt, symbol);
1390  return TRUE;
1391  }
1392  }
1393  return FALSE;
1394 
1395 }
struct hash_table_elt hash_elt
#define TRUE
Definition: types.h:120
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:406
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:340
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:584
struct symt symt
struct process * pcs
void * hash_table_iter_up(struct hash_table_iter *hti) DECLSPEC_HIDDEN
Definition: storage.c:423
Definition: _pair.h:47
Definition: name.c:36
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 1875 of file symbol.c.

1876 {
1877  switch (**re)
1878  {
1879  case '\\': (*re)++; return *(*re)++;
1880  case '*': case '[': case '?': case '+': case '#': case ']': return WILDCHAR(*(*re)++);
1881  default: return *(*re)++;
1882  }
1883 }
#define WILDCHAR(x)
Definition: symbol.c:1873

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 1885 of file symbol.c.

1886 {
1887  return _case ? ch1 - ch2 : toupperW(ch1) - toupperW(ch2);
1888 }
WINE_UNICODE_INLINE WCHAR toupperW(WCHAR ch)
Definition: unicode.h:141

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 1938 of file symbol.c.

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

Referenced by SymMatchStringW().

◆ re_match_one()

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

Definition at line 1890 of file symbol.c.

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

Referenced by re_match_multi().

◆ resort_symbols()

static BOOL resort_symbols ( struct module module)
static

Definition at line 814 of file symbol.c.

815 {
816  int delta;
817 
819  return FALSE;
820 
821  /* we know that set from 0 up to num_sorttab is already sorted
822  * so sort the remaining (new) symbols, and merge the two sets
823  * (unless the first set is empty)
824  */
825  delta = module->num_symbols - module->num_sorttab;
826  qsort(&module->addr_sorttab[module->num_sorttab], delta, sizeof(struct symt_ht*), symt_cmp_addr);
827  if (module->num_sorttab)
828  {
829  int i, ins_idx = module->num_sorttab, prev_ins_idx;
830  static struct symt_ht** tmp;
831  static unsigned num_tmp;
832 
833  if (num_tmp < delta)
834  {
835  static struct symt_ht** new;
836  if (tmp)
837  new = HeapReAlloc(GetProcessHeap(), 0, tmp, delta * sizeof(struct symt_ht*));
838  else
839  new = HeapAlloc(GetProcessHeap(), 0, delta * sizeof(struct symt_ht*));
840  if (!new)
841  {
842  module->num_sorttab = 0;
843  return resort_symbols(module);
844  }
845  tmp = new;
846  num_tmp = delta;
847  }
848  memcpy(tmp, &module->addr_sorttab[module->num_sorttab], delta * sizeof(struct symt_ht*));
849  qsort(tmp, delta, sizeof(struct symt_ht*), symt_cmp_addr);
850 
851  for (i = delta - 1; i >= 0; i--)
852  {
853  prev_ins_idx = ins_idx;
854  ins_idx = where_to_insert(module, ins_idx, tmp[i]);
855  memmove(&module->addr_sorttab[ins_idx + i + 1],
856  &module->addr_sorttab[ins_idx],
857  (prev_ins_idx - ins_idx) * sizeof(struct symt_ht*));
858  module->addr_sorttab[ins_idx + i] = tmp[i];
859  }
860  }
862  return module->sortlist_valid = TRUE;
863 }
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
static BOOL resort_symbols(struct module *module)
Definition: symbol.c:814
#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
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 *))
int symt_cmp_addr(const void *p1, const void *p2)
Definition: symbol.c:59
unsigned num_sorttab
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define HeapReAlloc
Definition: compat.h:393
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:789

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 753 of file symbol.c.

755 {
756  symt_fill_sym_info(pair, func, sym, se->sym_info);
757  if (se->index && se->sym_info->Index != se->index) return FALSE;
758  if (se->tag && se->sym_info->Tag != se->tag) return FALSE;
759  if (se->addr && !(se->addr >= se->sym_info->Address && se->addr < se->sym_info->Address + se->sym_info->Size)) return FALSE;
760  return !se->cb(se->sym_info, se->sym_info->Size, se->user);
761 }
GLenum func
Definition: glext.h:6028
SYMBOL_INFO * sym_info
Definition: symbol.c:746
DWORD64 addr
Definition: symbol.c:749
ULONG Tag
Definition: compat.h:698
ULONG64 Address
Definition: compat.h:695
DWORD tag
Definition: symbol.c:748
ULONG Index
Definition: compat.h:690
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:584
PVOID user
Definition: symbol.c:745
DWORD index
Definition: symbol.c:747
Definition: _pair.h:47
PSYM_ENUMERATESYMBOLS_CALLBACK cb
Definition: symbol.c:744
ULONG Size
Definition: compat.h:691

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 1062 of file symbol.c.

1064 {
1065  struct module_pair pair;
1066  const WCHAR* bang;
1067  WCHAR* mod;
1068 
1070  if (!pair.pcs) return FALSE;
1071  if (BaseOfDll == 0)
1072  {
1073  /* do local variables ? */
1074  if (!Mask || !(bang = strchrW(Mask, '!')))
1075  return symt_enum_locals(pair.pcs, Mask, se);
1076 
1077  if (bang == Mask) return FALSE;
1078 
1079  mod = HeapAlloc(GetProcessHeap(), 0, (bang - Mask + 1) * sizeof(WCHAR));
1080  if (!mod) return FALSE;
1081  memcpy(mod, Mask, (bang - Mask) * sizeof(WCHAR));
1082  mod[bang - Mask] = 0;
1083 
1084  for (pair.requested = pair.pcs->lmodules; pair.requested; pair.requested = pair.requested->next)
1085  {
1086  if (pair.requested->type == DMT_PE && module_get_debug(&pair))
1087  {
1088  if (SymMatchStringW(pair.requested->module.ModuleName, mod, FALSE) &&
1089  symt_enum_module(&pair, bang + 1, se))
1090  break;
1091  }
1092  }
1093  /* not found in PE modules, retry on the ELF ones
1094  */
1096  {
1097  for (pair.requested = pair.pcs->lmodules; pair.requested; pair.requested = pair.requested->next)
1098  {
1099  if ((pair.requested->type == DMT_ELF || pair.requested->type == DMT_MACHO) &&
1100  !module_get_containee(pair.pcs, pair.requested) &&
1102  {
1103  if (SymMatchStringW(pair.requested->module.ModuleName, mod, FALSE) &&
1104  symt_enum_module(&pair, bang + 1, se))
1105  break;
1106  }
1107  }
1108  }
1109  HeapFree(GetProcessHeap(), 0, mod);
1110  return TRUE;
1111  }
1112  pair.requested = module_find_by_addr(pair.pcs, BaseOfDll, DMT_UNKNOWN);
1113  if (!module_get_debug(&pair))
1114  return FALSE;
1115 
1116  /* we always ignore module name from Mask when BaseOfDll is defined */
1117  if (Mask && (bang = strchrW(Mask, '!')))
1118  {
1119  if (bang == Mask) return FALSE;
1120  Mask = bang + 1;
1121  }
1122 
1123  symt_enum_module(&pair, Mask ? Mask : starW, se);
1124 
1125  return TRUE;
1126 }
struct module * module_get_containee(const struct process *pcs, const struct module *inner) DECLSPEC_HIDDEN
Definition: module.c:314
#define TRUE
Definition: types.h:120
#define SYMOPT_WINE_WITH_NATIVE_MODULES
static BOOL symt_enum_locals(struct process *pcs, const WCHAR *mask, const struct sym_enum *se)
Definition: symbol.c:1008
struct process * process_find_by_handle(HANDLE hProcess)
Definition: dbghelp.c:80
WINE_UNICODE_INLINE WCHAR * strchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:248
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
BOOL WINAPI SymMatchStringW(PCWSTR string, PCWSTR re, BOOL _case)
Definition: symbol.c:2035
static BOOL symt_enum_module(struct module_pair *pair, const WCHAR *match, const struct sym_enum *se)
Definition: symbol.c:763
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
BOOL module_get_debug(struct module_pair *) DECLSPEC_HIDDEN
Definition: module.c:340
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned dbghelp_options
Definition: dbghelp.c:72
struct module * module_find_by_addr(const struct process *pcs, DWORD64 addr, enum module_type type) DECLSPEC_HIDDEN
Definition: module.c:399
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
Definition: _pair.h:47
static const WCHAR starW[]
Definition: symbol.c:43
#define HeapFree(x, y, z)
Definition: compat.h:394
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 1219 of file symbol.c.

1220 {
1221  struct sym_enumerate* se = ctx;
1222  return (se->cb)(syminfo->Name, syminfo->Address, syminfo->Size, se->ctx);
1223 }
CHAR Name[1]
Definition: compat.h:701
PSYM_ENUMSYMBOLS_CALLBACK cb
Definition: symbol.c:1216
ULONG64 Address
Definition: compat.h:695
void * ctx
Definition: symbol.c:1215
ULONG Size
Definition: compat.h:691

Referenced by SymEnumerateSymbols().

◆ sym_enumerate_cb64()

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

Definition at line 1246 of file symbol.c.

1247 {
1248  struct sym_enumerate64* se = ctx;
1249  return (se->cb)(syminfo->Name, syminfo->Address, syminfo->Size, se->ctx);
1250 }
void * ctx
Definition: symbol.c:1242
CHAR Name[1]
Definition: compat.h:701
ULONG64 Address
Definition: compat.h:695
PSYM_ENUMSYMBOLS_CALLBACK64 cb
Definition: symbol.c:1243
ULONG Size
Definition: compat.h:691

Referenced by SymEnumerateSymbols64().

◆ sym_enumW()

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

Definition at line 1187 of file symbol.c.

1188 {
1189  struct sym_enumW* sew = ctx;
1190 
1191  copy_symbolW(sew->sym_info, si);
1192 
1193  return (sew->cb)(sew->sym_info, size, sew->ctx);
1194 }
void copy_symbolW(SYMBOL_INFOW *siw, const SYMBOL_INFO *si)
Definition: symbol.c:1037
GLsizeiptr size
Definition: glext.h:5919
PSYMBOL_INFOW sym_info
Definition: symbol.c:1182
PSYM_ENUMERATESYMBOLS_CALLBACKW cb
Definition: symbol.c:1180
void * ctx
Definition: symbol.c:1181

◆ SymAddSymbol()

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

Definition at line 2128 of file symbol.c.

2130 {
2132 
2133  MultiByteToWideChar(CP_ACP, 0, name, -1, nameW, sizeof(nameW) / sizeof(WCHAR));
2134  return SymAddSymbolW(hProcess, BaseOfDll, nameW, addr, size, flags);
2135 }
BOOL WINAPI SymAddSymbolW(HANDLE hProcess, ULONG64 BaseOfDll, PCWSTR name, DWORD64 addr, DWORD size, DWORD flags)
Definition: symbol.c:2141
#define CP_ACP
Definition: compat.h:99
_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:624
GLbitfield flags
Definition: glext.h:7161
GLenum const GLvoid * addr
Definition: glext.h:9621
#define MultiByteToWideChar
Definition: compat.h:100
Definition: name.c:36

◆ SymAddSymbolW()

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

Definition at line 2141 of file symbol.c.

2143 {
2144  struct module_pair pair;
2145 
2146  TRACE("(%p %s %s %u)\n", hProcess, wine_dbgstr_w(name), wine_dbgstr_longlong(addr), size);
2147 
2149  if (!pair.pcs) return FALSE;
2150  pair.requested = module_find_by_addr(pair.pcs, BaseOfDll, DMT_UNKNOWN);
2151  if (!module_get_debug(&pair)) return FALSE;
2152 
2154  return FALSE;
2155 }
struct process * process_find_by_handle(HANDLE hProcess)
Definition: dbghelp.c:80
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
#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:340
#define SetLastError(x)
Definition: compat.h:409
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:399
Definition: _pair.h:47
Definition: name.c:36
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:41
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92

Referenced by SymAddSymbol().

◆ SymEnumerateSymbols()

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

Definition at line 1228 of file symbol.c.

1231 {
1232  struct sym_enumerate se;
1233 
1234  se.ctx = UserContext;
1235  se.cb = EnumSymbolsCallback;
1236 
1237  return SymEnumSymbols(hProcess, BaseOfDll, NULL, sym_enumerate_cb, &se);
1238 }
_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:1219
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI SymEnumSymbols(HANDLE hProcess, ULONG64 BaseOfDll, PCSTR Mask, PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback, PVOID UserContext)
Definition: symbol.c:1155
void * ctx
Definition: symbol.c:1215

◆ SymEnumerateSymbols64()

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

Definition at line 1255 of file symbol.c.

1258 {
1259  struct sym_enumerate64 se;
1260 
1261  se.ctx = UserContext;
1262  se.cb = EnumSymbolsCallback;
1263 
1264  return SymEnumSymbols(hProcess, BaseOfDll, NULL, sym_enumerate_cb64, &se);
1265 }
void * ctx
Definition: symbol.c:1242
_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:1246
BOOL WINAPI SymEnumSymbols(HANDLE hProcess, ULONG64 BaseOfDll, PCSTR Mask, PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback, PVOID UserContext)
Definition: symbol.c:1155

◆ SymEnumLines()

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

Definition at line 2174 of file symbol.c.

2176 {
2177  struct module_pair pair;
2178  struct hash_table_iter hti;
2179  struct symt_ht* sym;
2180  WCHAR* srcmask;
2181  struct line_info* dli;
2182  void* ptr;
2183  SRCCODEINFO sci;
2184  const char* file;
2185 
2186  if (!cb) return FALSE;
2187  if (!(dbghelp_options & SYMOPT_LOAD_LINES)) return TRUE;
2188 
2190  if (!pair.pcs) return FALSE;
2191  if (compiland) FIXME("Unsupported yet (filtering on compiland %s)\n", compiland);
2192  pair.requested = module_find_by_addr(pair.pcs, base, DMT_UNKNOWN);
2193  if (!module_get_debug(&pair)) return FALSE;
2194  if (!(srcmask = file_regex(srcfile))) return FALSE;
2195 
2196  sci.SizeOfStruct = sizeof(sci);
2197  sci.ModBase = base;
2198 
2199  hash_table_iter_init(&pair.effective->ht_symbols, &hti, NULL);
2200  while ((ptr = hash_table_iter_up(&hti)))
2201  {
2202  unsigned int i;
2203 
2204  sym = CONTAINING_RECORD(ptr, struct symt_ht, hash_elt);
2205  if (sym->symt.tag != SymTagFunction) continue;
2206 
2207  sci.FileName[0] = '\0';
2208  for (i=0; i<vector_length(&((struct symt_function*)sym)->vlines); i++)
2209  {
2210  dli = vector_at(&((struct symt_function*)sym)->vlines, i);
2211  if (dli->is_source_file)
2212  {
2213  file = source_get(pair.effective, dli->u.source_file);
2214  if (!file) sci.FileName[0] = '\0';
2215  else
2216  {
2217  DWORD sz = MultiByteToWideChar(CP_ACP, 0, file, -1, NULL, 0);
2218  WCHAR* fileW;
2219 
2220  if ((fileW = HeapAlloc(GetProcessHeap(), 0, sz * sizeof(WCHAR))))
2221  MultiByteToWideChar(CP_ACP, 0, file, -1, fileW, sz);
2222  if (SymMatchStringW(fileW, srcmask, FALSE))
2223  strcpy(sci.FileName, file);
2224  else
2225  sci.FileName[0] = '\0';
2226  HeapFree(GetProcessHeap(), 0, fileW);
2227  }
2228  }
2229  else if (sci.FileName[0])
2230  {
2231  sci.Key = dli;
2232  sci.Obj[0] = '\0'; /* FIXME */
2233  sci.LineNumber = dli->line_number;
2234  sci.Address = dli->u.pc_offset;
2235  if (!cb(&sci, user)) break;
2236  }
2237  }
2238  }
2239  HeapFree(GetProcessHeap(), 0, srcmask);
2240  return TRUE;
2241 }
unsigned long line_number
unsigned long pc_offset
#define TRUE
Definition: types.h:120
struct process * process_find_by_handle(HANDLE hProcess)
Definition: dbghelp.c:80
union line_info::@359 u
PVOID Key
Definition: compat.h:753
void * vector_at(const struct vector *v, unsigned pos) DECLSPEC_HIDDEN
Definition: storage.c:163
#define CP_ACP
Definition: compat.h: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:131
CHAR FileName[MAX_PATH+1]
Definition: compat.h:756
CHAR Obj[MAX_PATH+1]
Definition: compat.h:755
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:2035
GLuint base
Definition: 3dtext.c:35
#define FIXME(fmt,...)
Definition: debug.h:110
static WCHAR * file_regex(const char *srcfile)
Definition: symbol.c:161
static PVOID ptr
Definition: dispmode.c:27
DWORD64 ModBase
Definition: compat.h:754
void hash_table_iter_init(const struct hash_table *ht, struct hash_table_iter *hti, const char *name) DECLSPEC_HIDDEN
Definition: storage.c:406
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:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
BOOL module_get_debug(struct module_pair *) DECLSPEC_HIDDEN
Definition: module.c:340
__wchar_t WCHAR
Definition: xmlstorage.h:180
DWORD LineNumber
Definition: compat.h:757
const char file[]
Definition: icontest.c:11
unsigned dbghelp_options
Definition: dbghelp.c:72
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SYMOPT_LOAD_LINES
Definition: compat.h:639
struct symt symt
static DWORD cb
Definition: integrity.c:41
DWORD SizeOfStruct
Definition: compat.h:752
DWORD64 Address
Definition: compat.h:758
struct module * module_find_by_addr(const struct process *pcs, DWORD64 addr, enum module_type type) DECLSPEC_HIDDEN
Definition: module.c:399
void * hash_table_iter_up(struct hash_table_iter *hti) DECLSPEC_HIDDEN
Definition: storage.c:423
Definition: _pair.h:47
#define MultiByteToWideChar
Definition: compat.h:100
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
unsigned long 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:394
unsigned vector_length(const struct vector *v) DECLSPEC_HIDDEN
Definition: storage.c:158
Definition: fci.c:126

Referenced by ConvertDbgHelp().

◆ SymEnumSymbols()

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

Definition at line 1155 of file symbol.c.

1158 {
1159  BOOL ret;
1160  PWSTR maskW = NULL;
1161 
1162  TRACE("(%p %s %s %p %p)\n",
1163  hProcess, wine_dbgstr_longlong(BaseOfDll), debugstr_a(Mask),
1164  EnumSymbolsCallback, UserContext);
1165 
1166  if (Mask)
1167  {
1168  DWORD sz = MultiByteToWideChar(CP_ACP, 0, Mask, -1, NULL, 0);
1169  if (!(maskW = HeapAlloc(GetProcessHeap(), 0, sz * sizeof(WCHAR))))
1170  return FALSE;
1171  MultiByteToWideChar(CP_ACP, 0, Mask, -1, maskW, sz);
1172  }
1173  ret = doSymEnumSymbols(hProcess, BaseOfDll, maskW, EnumSymbolsCallback, UserContext);
1174  HeapFree(GetProcessHeap(), 0, maskW);
1175  return ret;
1176 }
static BOOL doSymEnumSymbols(HANDLE hProcess, ULONG64 BaseOfDll, PCWSTR Mask, PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback, PVOID UserContext)
Definition: symbol.c:1128
uint16_t * PWSTR
Definition: typedefs.h:54
#define CP_ACP
Definition: compat.h:99
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
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:395
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:100
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:41
#define HeapFree(x, y, z)
Definition: compat.h:394

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 1200 of file symbol.c.

1203 {
1204  struct sym_enumW sew;
1205 
1206  sew.ctx = UserContext;
1207  sew.cb = EnumSymbolsCallback;
1208  sew.sym_info = (PSYMBOL_INFOW)sew.buffer;
1209 
1210  return doSymEnumSymbols(hProcess, BaseOfDll, Mask, sym_enumW, &sew);
1211 }
static BOOL doSymEnumSymbols(HANDLE hProcess, ULONG64 BaseOfDll, PCWSTR Mask, PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback, PVOID UserContext)
Definition: symbol.c:1128
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
struct _SYMBOL_INFOW * PSYMBOL_INFOW
void * ctx
Definition: symbol.c:1181

◆ SymFromAddr()

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

Definition at line 1271 of file symbol.c.

1273 {
1274  struct module_pair pair;
1275  struct symt_ht* sym;
1276 
1278  if (!pair.pcs) return FALSE;
1279  pair.requested = module_find_by_addr(pair.pcs, Address, DMT_UNKNOWN);
1280  if (!module_get_debug(&pair)) return FALSE;
1281  if ((sym = symt_find_nearest(pair.effective, Address)) == NULL) return FALSE;
1282 
1283  symt_fill_sym_info(&pair, NULL, &sym->symt, Symbol);
1284  if (Displacement)
1285  *Displacement = (Address >= Symbol->Address) ? (Address - Symbol->Address) : (DWORD64)-1;
1286  return TRUE;
1287 }
#define TRUE
Definition: types.h:120
struct process * process_find_by_handle(HANDLE hProcess)
Definition: dbghelp.c:80
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
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:340
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:584
struct symt symt
struct module * module_find_by_addr(const struct process *pcs, DWORD64 addr, enum module_type type) DECLSPEC_HIDDEN
Definition: module.c:399
uint64_t DWORD64
Definition: typedefs.h:65
Definition: Symbol.h:8
Definition: _pair.h:47
struct symt_ht * symt_find_nearest(struct module *module, DWORD_PTR addr)
Definition: symbol.c:905

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 1293 of file symbol.c.

1295 {
1296  PSYMBOL_INFO si;
1297  unsigned len;
1298  BOOL ret;
1299 
1300  len = sizeof(*si) + Symbol->MaxNameLen * sizeof(WCHAR);
1301  si = HeapAlloc(GetProcessHeap(), 0, len);
1302  if (!si) return FALSE;
1303 
1304  si->SizeOfStruct = sizeof(*si);
1305  si->MaxNameLen = Symbol->MaxNameLen;
1306  if ((ret = SymFromAddr(hProcess, Address, Displacement, si)))
1307  {
1308  copy_symbolW(Symbol, si);
1309  }
1310  HeapFree(GetProcessHeap(), 0, si);
1311  return ret;
1312 }
ULONG MaxNameLen
Definition: compat.h:700
void copy_symbolW(SYMBOL_INFOW *siw, const SYMBOL_INFO *si)
Definition: symbol.c:1037
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
unsigned int BOOL
Definition: ntddk_ex.h:94
static WCHAR Address[46]
Definition: ping.c:68
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
BOOL WINAPI SymFromAddr(HANDLE hProcess, DWORD64 Address, DWORD64 *Displacement, PSYMBOL_INFO Symbol)
Definition: symbol.c:1271
__wchar_t WCHAR
Definition: xmlstorage.h:180
int ret
ULONG SizeOfStruct
Definition: compat.h:687
GLenum GLsizei len
Definition: glext.h:6722
Definition: Symbol.h:8
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ SymFromIndex()

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

Definition at line 2271 of file symbol.c.

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

◆ SymFromIndexW()

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

Definition at line 2283 of file symbol.c.

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

◆ SymFromName()

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

Definition at line 1400 of file symbol.c.

1401 {
1402  struct process* pcs = process_find_by_handle(hProcess);
1403  struct module* module;
1404  const char* name;
1405 
1406  TRACE("(%p, %s, %p)\n", hProcess, Name, Symbol);
1407  if (!pcs) return FALSE;
1408  if (Symbol->SizeOfStruct < sizeof(*Symbol)) return FALSE;
1409  name = strchr(Name, '!');
1410  if (name)
1411  {
1412  char tmp[128];
1413  assert(name - Name < sizeof(tmp));
1414  memcpy(tmp, Name, name - Name);
1415  tmp[name - Name] = '\0';
1416  module = module_find_by_nameA(pcs, tmp);
1417  return find_name(pcs, module, name + 1, Symbol);
1418  }
1419  for (module = pcs->lmodules; module; module = module->next)
1420  {
1421  if (module->type == DMT_PE && find_name(pcs, module, Name, Symbol))
1422  return TRUE;
1423  }
1424  /* not found in PE modules, retry on the ELF ones
1425  */
1427  {
1428  for (module = pcs->lmodules; module; module = module->next)
1429  {
1430  if ((module->type == DMT_ELF || module->type == DMT_MACHO) &&
1431  !module_get_containee(pcs, module) &&
1432  find_name(pcs, module, Name, Symbol))
1433  return TRUE;
1434  }
1435  }
1436  return FALSE;
1437 }
struct module * module_get_containee(const struct process *pcs, const struct module *inner) DECLSPEC_HIDDEN
Definition: module.c:314
#define TRUE
Definition: types.h:120
#define SYMOPT_WINE_WITH_NATIVE_MODULES
HMODULE module
Definition: main.cpp:47
struct process * process_find_by_handle(HANDLE hProcess)
Definition: dbghelp.c:80
struct module * module_find_by_nameA(const struct process *pcs, const char *name) DECLSPEC_HIDDEN
Definition: module.c:256
#define assert(x)
Definition: debug.h:53
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
enum module_type type
struct module * lmodules
struct NameRec_ * Name
Definition: cdprocs.h:464
static BOOL find_name(struct process *pcs, struct module *module, const char *name, SYMBOL_INFO *symbol)
Definition: symbol.c:1370
#define TRACE(s)
Definition: solgame.cpp:4
unsigned dbghelp_options
Definition: dbghelp.c:72
#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:36
struct module * next
GLuint const GLchar * name
Definition: glext.h:6031

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

◆ SymGetLineFromAddr()

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

Definition at line 1610 of file symbol.c.

1612 {
1613  IMAGEHLP_LINE64 il64;
1614 
1615  il64.SizeOfStruct = sizeof(il64);
1616  if (!SymGetLineFromAddr64(hProcess, dwAddr, pdwDisplacement, &il64))
1617  return FALSE;
1618  copy_line_32_from_64(Line, &il64);
1619  return TRUE;
1620 }
BOOL WINAPI SymGetLineFromAddr64(HANDLE hProcess, DWORD64 dwAddr, PDWORD pdwDisplacement, PIMAGEHLP_LINE64 Line)
Definition: symbol.c:1626
#define TRUE
Definition: types.h:120
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
DWORD SizeOfStruct
Definition: compat.h:744
Definition: ncftp.h:79
static void copy_line_32_from_64(IMAGEHLP_LINE *l32, const IMAGEHLP_LINE64 *l64)
Definition: symbol.c:1597

◆ SymGetLineFromAddr64()

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

Definition at line 1626 of file symbol.c.

1628 {
1629  struct module_pair pair;
1630  struct symt_ht* symt;
1631 
1632  TRACE("%p %s %p %p\n", hProcess, wine_dbgstr_longlong(dwAddr), pdwDisplacement, Line);
1633 
1634  if (Line->SizeOfStruct < sizeof(*Line)) return FALSE;
1635 
1637  if (!pair.pcs) return FALSE;
1638  pair.requested = module_find_by_addr(pair.pcs, dwAddr, DMT_UNKNOWN);
1639  if (!module_get_debug(&pair)) return FALSE;
1640  if ((symt = symt_find_nearest(pair.effective, dwAddr)) == NULL) return FALSE;
1641 
1642  if (symt->symt.tag != SymTagFunction) return FALSE;
1643  if (!symt_fill_func_line_info(pair.effective, (struct symt_function*)symt,
1644  dwAddr, Line)) return FALSE;
1645  *pdwDisplacement = dwAddr - Line->Address;
1646  return TRUE;
1647 }
#define TRUE
Definition: types.h:120
struct process * process_find_by_handle(HANDLE hProcess)
Definition: dbghelp.c:80
BOOL symt_fill_func_line_info(const struct module *module, const struct symt_function *func, DWORD64 addr, IMAGEHLP_LINE64 *line)
Definition: symbol.c:1488
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
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:340
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:399
Definition: _pair.h:47
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:41
struct symt_ht * symt_find_nearest(struct module *module, DWORD_PTR addr)
Definition: symbol.c:905

Referenced by SymGetLineFromAddr(), and SymGetLineFromAddrW64().

◆ SymGetLineFromAddrW64()

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

Definition at line 1653 of file symbol.c.

1655 {
1656  IMAGEHLP_LINE64 il64;
1657 
1658  il64.SizeOfStruct = sizeof(il64);
1659  if (!SymGetLineFromAddr64(hProcess, dwAddr, pdwDisplacement, &il64))
1660  return FALSE;
1662  return TRUE;
1663 }
BOOL WINAPI SymGetLineFromAddr64(HANDLE hProcess, DWORD64 dwAddr, PDWORD pdwDisplacement, PIMAGEHLP_LINE64 Line)
Definition: symbol.c:1626
#define TRUE
Definition: types.h:120
struct process * process_find_by_handle(HANDLE hProcess)
Definition: dbghelp.c:80
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
DWORD SizeOfStruct
Definition: compat.h:744
Definition: ncftp.h:79
static void copy_line_W64_from_64(struct process *pcs, IMAGEHLP_LINEW64 *l64w, const IMAGEHLP_LINE64 *l64)
Definition: symbol.c:1581

◆ SymGetLineFromName()

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

Definition at line 2243 of file symbol.c.

2245 {
2246  FIXME("(%p) (%s, %s, %d %p %p): stub\n", hProcess, ModuleName, FileName,
2247  dwLineNumber, plDisplacement, Line);
2248  return FALSE;
2249 }
_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:1264
#define FIXME(fmt,...)
Definition: debug.h:110
Definition: ncftp.h:79

◆ SymGetLineFromName64()

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

Definition at line 2251 of file symbol.c.

2253 {
2254  FIXME("(%p) (%s, %s, %d %p %p): stub\n", hProcess, ModuleName, FileName,
2255  dwLineNumber, lpDisplacement, Line);
2256  return FALSE;
2257 }
_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:1264
#define FIXME(fmt,...)
Definition: debug.h:110
Definition: ncftp.h:79

◆ SymGetLineFromNameW64()

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

Definition at line 2259 of file symbol.c.

2261 {
2262  FIXME("(%p) (%s, %s, %d %p %p): stub\n", hProcess, debugstr_w(ModuleName), debugstr_w(FileName),
2263  dwLineNumber, plDisplacement, Line);
2264  return FALSE;
2265 }
_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:1264
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
Definition: ncftp.h:79

◆ SymGetLineNext()

BOOL WINAPI SymGetLineNext ( HANDLE  hProcess,
PIMAGEHLP_LINE  Line 
)

Definition at line 1776 of file symbol.c.

1777 {
1778  IMAGEHLP_LINE64 line64;
1779 
1780  line64.SizeOfStruct = sizeof(line64);
1781  copy_line_64_from_32(&line64, Line);
1782  if (!SymGetLineNext64(hProcess, &line64)) return FALSE;
1783  copy_line_32_from_64(Line, &line64);
1784  return TRUE;
1785 }
#define TRUE
Definition: types.h:120
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
static void copy_line_64_from_32(IMAGEHLP_LINE64 *l64, const IMAGEHLP_LINE *l32)
Definition: symbol.c:1568
DWORD SizeOfStruct
Definition: compat.h:744
BOOL WINAPI SymGetLineNext64(HANDLE hProcess, PIMAGEHLP_LINE64 Line)
Definition: symbol.c:1755
Definition: ncftp.h:79
static void copy_line_32_from_64(IMAGEHLP_LINE *l32, const IMAGEHLP_LINE64 *l64)
Definition: symbol.c:1597

◆ SymGetLineNext64()

BOOL WINAPI SymGetLineNext64 ( HANDLE  hProcess,
PIMAGEHLP_LINE64  Line 
)

Definition at line 1755 of file symbol.c.

1756 {
1757  struct module_pair pair;
1758 
1759  TRACE("(%p %p)\n", hProcess, Line);
1760 
1761  if (Line->SizeOfStruct < sizeof(*Line)) return FALSE;
1763  if (!pair.pcs) return FALSE;
1764  pair.requested = module_find_by_addr(pair.pcs, Line->Address, DMT_UNKNOWN);
1765  if (!module_get_debug(&pair)) return FALSE;
1766 
1767  if (symt_get_func_line_next(pair.effective, Line)) return TRUE;
1768  SetLastError(ERROR_NO_MORE_ITEMS); /* FIXME */
1769  return FALSE;
1770 }
#define TRUE
Definition: types.h:120
struct process * process_find_by_handle(HANDLE hProcess)
Definition: dbghelp.c:80
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:95
_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:1730
#define TRACE(s)
Definition: solgame.cpp:4
BOOL module_get_debug(struct module_pair *) DECLSPEC_HIDDEN
Definition: module.c:340
#define SetLastError(x)
Definition: compat.h:409
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:399
Definition: _pair.h:47

Referenced by SymGetLineNext().

◆ SymGetLinePrev()

BOOL WINAPI SymGetLinePrev ( HANDLE  hProcess,
PIMAGEHLP_LINE  Line 
)

Definition at line 1719 of file symbol.c.

1720 {
1721  IMAGEHLP_LINE64 line64;
1722 
1723  line64.SizeOfStruct = sizeof(line64);
1724  copy_line_64_from_32(&line64, Line);
1725  if (!SymGetLinePrev64(hProcess, &line64)) return FALSE;
1726  copy_line_32_from_64(Line, &line64);
1727  return TRUE;
1728 }
#define TRUE
Definition: types.h:120
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
static void copy_line_64_from_32(IMAGEHLP_LINE64 *l64, const IMAGEHLP_LINE *l32)
Definition: symbol.c:1568
DWORD SizeOfStruct
Definition: compat.h:744
BOOL WINAPI SymGetLinePrev64(HANDLE hProcess, PIMAGEHLP_LINE64 Line)
Definition: symbol.c:1669
Definition: ncftp.h:79
static void copy_line_32_from_64(IMAGEHLP_LINE *l32, const IMAGEHLP_LINE64 *l64)
Definition: symbol.c:1597

◆ SymGetLinePrev64()

BOOL WINAPI SymGetLinePrev64 ( HANDLE  hProcess,
PIMAGEHLP_LINE64  Line 
)

Definition at line 1669 of file symbol.c.

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

Referenced by SymGetLinePrev().

◆ SymGetSymFromAddr()

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

Definition at line 1318 of file symbol.c.

1320 {
1321  char buffer[sizeof(SYMBOL_INFO) + MAX_SYM_NAME];
1323  size_t len;
1324  DWORD64 Displacement64;
1325 
1326  if (Symbol->SizeOfStruct < sizeof(*Symbol)) return FALSE;
1327  si->SizeOfStruct = sizeof(*si);
1328  si->MaxNameLen = MAX_SYM_NAME;
1329  if (!SymFromAddr(hProcess, Address, &Displacement64, si))
1330  return FALSE;
1331 
1332  if (Displacement)
1333  *Displacement = Displacement64;
1334  Symbol->Address = si->Address;
1335  Symbol->Size = si->Size;
1336  Symbol->Flags = si->Flags;
1337  len = min(Symbol->MaxNameLength, si->MaxNameLen);
1338  lstrcpynA(Symbol->Name, si->Name, len);
1339  return TRUE;
1340 }
#define TRUE
Definition: types.h:120
GLuint buffer
Definition: glext.h:5915
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
static WCHAR Address[46]
Definition: ping.c:68
BOOL WINAPI SymFromAddr(HANDLE hProcess, DWORD64 Address, DWORD64 *Displacement, PSYMBOL_INFO Symbol)
Definition: symbol.c:1271
struct _SYMBOL_INFO SYMBOL_INFO
#define MAX_SYM_NAME
Definition: compat.h:624
GLenum GLsizei len
Definition: glext.h:6722
uint64_t DWORD64
Definition: typedefs.h:65
Definition: Symbol.h:8
#define min(a, b)
Definition: monoChain.cc:55
#define lstrcpynA
Definition: compat.h:408

◆ SymGetSymFromAddr64()

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

Definition at line 1346 of file symbol.c.

1348 {
1349  char buffer[sizeof(SYMBOL_INFO) + MAX_SYM_NAME];
1351  size_t len;
1352  DWORD64 Displacement64;
1353 
1354  if (Symbol->SizeOfStruct < sizeof(*Symbol)) return FALSE;
1355  si->SizeOfStruct = sizeof(*si);
1356  si->MaxNameLen = MAX_SYM_NAME;
1357  if (!SymFromAddr(hProcess, Address, &Displacement64, si))
1358  return FALSE;
1359 
1360  if (Displacement)
1361  *Displacement = Displacement64;
1362  Symbol->Address = si->Address;
1363  Symbol->Size = si->Size;
1364  Symbol->Flags = si->Flags;
1365  len = min(Symbol->MaxNameLength, si->MaxNameLen);
1366  lstrcpynA(Symbol->Name, si->Name, len);
1367  return TRUE;
1368 }
#define TRUE
Definition: types.h:120
GLuint buffer
Definition: glext.h:5915
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
static WCHAR Address[46]
Definition: ping.c:68
BOOL WINAPI SymFromAddr(HANDLE hProcess, DWORD64 Address, DWORD64 *Displacement, PSYMBOL_INFO Symbol)
Definition: symbol.c:1271
struct _SYMBOL_INFO SYMBOL_INFO
#define MAX_SYM_NAME
Definition: compat.h:624
GLenum GLsizei len
Definition: glext.h:6722
uint64_t DWORD64
Definition: typedefs.h:65
Definition: Symbol.h:8
#define min(a, b)
Definition: monoChain.cc:55
#define lstrcpynA
Definition: compat.h:408

◆ SymGetSymFromName()

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

Definition at line 1464 of file symbol.c.

1465 {
1466  char buffer[sizeof(SYMBOL_INFO) + MAX_SYM_NAME];
1468  size_t len;
1469 
1470  if (Symbol->SizeOfStruct < sizeof(*Symbol)) return FALSE;
1471  si->SizeOfStruct = sizeof(*si);
1472  si->MaxNameLen = MAX_SYM_NAME;
1473  if (!SymFromName(hProcess, Name, si)) return FALSE;
1474 
1475  Symbol->Address = si->Address;
1476  Symbol->Size = si->Size;
1477  Symbol->Flags = si->Flags;
1478  len = min(Symbol->MaxNameLength, si->MaxNameLen);
1479  lstrcpynA(Symbol->Name, si->Name, len);
1480  return TRUE;
1481 }
#define TRUE
Definition: types.h:120
GLuint buffer
Definition: glext.h:5915
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
struct _SYMBOL_INFO SYMBOL_INFO
#define MAX_SYM_NAME
Definition: compat.h:624
GLenum GLsizei len
Definition: glext.h:6722
Definition: Symbol.h:8
#define min(a, b)
Definition: monoChain.cc:55
#define lstrcpynA
Definition: compat.h:408
BOOL WINAPI SymFromName(HANDLE hProcess, PCSTR Name, PSYMBOL_INFO Symbol)
Definition: symbol.c:1400

◆ SymGetSymFromName64()

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

Definition at line 1442 of file symbol.c.

1443 {
1444  char buffer[sizeof(SYMBOL_INFO) + MAX_SYM_NAME];
1446  size_t len;
1447 
1448  if (Symbol->SizeOfStruct < sizeof(*Symbol)) return FALSE;
1449  si->SizeOfStruct = sizeof(*si);
1450  si->MaxNameLen = MAX_SYM_NAME;
1451  if (!SymFromName(hProcess, Name, si)) return FALSE;
1452 
1453  Symbol->Address = si->Address;
1454  Symbol->Size = si->Size;
1455  Symbol->Flags = si->Flags;
1456  len = min(Symbol->MaxNameLength, si->MaxNameLen);
1457  lstrcpynA(Symbol->Name, si->Name, len);
1458  return TRUE;
1459 }
#define TRUE
Definition: types.h:120
GLuint buffer
Definition: glext.h:5915
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
struct _SYMBOL_INFO SYMBOL_INFO
#define MAX_SYM_NAME
Definition: compat.h:624
GLenum GLsizei len
Definition: glext.h:6722
Definition: Symbol.h:8
#define min(a, b)
Definition: monoChain.cc:55
#define lstrcpynA
Definition: compat.h:408
BOOL WINAPI SymFromName(HANDLE hProcess, PCSTR Name, PSYMBOL_INFO Symbol)
Definition: symbol.c:1400

◆ SymGetSymNext()

BOOL WINAPI SymGetSymNext ( HANDLE  hProcess,
PIMAGEHLP_SYMBOL  Symbol 
)

Definition at line 1537 of file symbol.c.

1538 {
1539  FIXME("(%p, %p): stub\n", hProcess, Symbol);
1541  return FALSE;
1542 }
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
#define FIXME(fmt,...)
Definition: debug.h:110
#define SetLastError(x)
Definition: compat.h:409
Definition: Symbol.h:8
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92

◆ SymGetSymNext64()

BOOL WINAPI SymGetSymNext64 ( HANDLE  hProcess,
PIMAGEHLP_SYMBOL64  Symbol 
)

Definition at line 1521 of file symbol.c.

1522 {
1523  /* algo:
1524  * get module from Symbol.Address
1525  * get index in module.addr_sorttab of Symbol.Address
1526  * increment index
1527  * if out of module bounds, move to next module in process address space
1528  */
1529  FIXME("(%p, %p): stub\n", hProcess, Symbol);
1531  return FALSE;
1532 }
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
#define FIXME(fmt,...)
Definition: debug.h:110
#define SetLastError(x)
Definition: compat.h:409
Definition: Symbol.h:8
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92

◆ SymGetSymPrev()

BOOL WINAPI SymGetSymPrev ( HANDLE  hProcess,
PIMAGEHLP_SYMBOL  Symbol 
)

Definition at line 1557 of file symbol.c.

1558 {
1559  FIXME("(%p, %p): stub\n", hProcess, Symbol);
1561  return FALSE;
1562 }
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
#define FIXME(fmt,...)
Definition: debug.h:110
#define SetLastError(x)
Definition: compat.h:409
Definition: Symbol.h:8
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92

◆ SymGetSymPrev64()

BOOL WINAPI SymGetSymPrev64 ( HANDLE  hProcess,
PIMAGEHLP_SYMBOL64  Symbol 
)

Definition at line 1547 of file symbol.c.

1548 {
1549  FIXME("(%p, %p): stub\n", hProcess, Symbol);
1551  return FALSE;
1552 }
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
#define FIXME(fmt,...)
Definition: debug.h:110
#define SetLastError(x)
Definition: compat.h:409
Definition: Symbol.h:8
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92

◆ SymMatchStringA()

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

Definition at line 2003 of file symbol.c.

2004 {
2005  WCHAR* strW;
2006  WCHAR* reW;
2007  BOOL ret = FALSE;
2008  DWORD sz;
2009 
2010  if (!string || !re)
2011  {
2013  return FALSE;
2014  }
2015  TRACE("%s %s %c\n", string, re, _case ? 'Y' : 'N');
2016 
2017  sz = MultiByteToWideChar(CP_ACP, 0, string, -1, NULL, 0);
2018  if ((strW = HeapAlloc(GetProcessHeap(), 0, sz * sizeof(WCHAR))))
2019  MultiByteToWideChar(CP_ACP, 0, string, -1, strW, sz);
2020  sz = MultiByteToWideChar(CP_ACP, 0, re, -1, NULL, 0);
2021  if ((reW = HeapAlloc(GetProcessHeap(), 0, sz * sizeof(WCHAR))))
2022  MultiByteToWideChar(CP_ACP, 0, re, -1, reW, sz);
2023 
2024  if (strW && reW)
2025  ret = SymMatchStringW(strW, reW, _case);
2026  HeapFree(GetProcessHeap(), 0, strW);
2027  HeapFree(GetProcessHeap(), 0, reW);
2028  return ret;
2029 }
#define CP_ACP
Definition: compat.h:99
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
BOOL WINAPI SymMatchStringW(PCWSTR string, PCWSTR re, BOOL _case)
Definition: symbol.c:2035
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:395
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:409
int ret
#define MultiByteToWideChar
Definition: compat.h:100
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ SymMatchStringW()

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

Definition at line 2035 of file symbol.c.

2036 {
2037  TRACE("%s %s %c\n", debugstr_w(string), debugstr_w(re), _case ? 'Y' : 'N');
2038 
2039  if (!string || !re)
2040  {
2042  return FALSE;
2043  }
2044  return re_match_multi(&string, &re, _case);
2045 }
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
#define SetLastError(x)
Definition: compat.h:409
static BOOL re_match_multi(const WCHAR **pstring, const WCHAR **pre, BOOL _case)
Definition: symbol.c:1938

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 2074 of file symbol.c.

2078 {
2079  LPWSTR maskW = NULL;
2080  BOOLEAN ret;
2081 
2082  TRACE("(%p %s %u %u %s %s %p %p %x)\n",
2083  hProcess, wine_dbgstr_longlong(BaseOfDll), Index, SymTag, Mask,
2084  wine_dbgstr_longlong(Address), EnumSymbolsCallback,
2085  UserContext, Options);
2086 
2087  if (Mask)
2088  {
2089  DWORD sz = MultiByteToWideChar(CP_ACP, 0, Mask, -1, NULL, 0);
2090 
2091  if (!(maskW = HeapAlloc(GetProcessHeap(), 0, sz * sizeof(WCHAR))))
2092  return FALSE;
2093  MultiByteToWideChar(CP_ACP, 0, Mask, -1, maskW, sz);
2094  }
2095  ret = doSymSearch(hProcess, BaseOfDll, Index, SymTag, maskW, Address,
2096  EnumSymbolsCallback, UserContext, Options);
2097  HeapFree(GetProcessHeap(), 0, maskW);
2098  return ret;
2099 }
#define CP_ACP
Definition: compat.h:99
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:2047
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
enum OPTION_FLAGS Options
Definition: stats.c:44
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:395
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:100
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:41
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ 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 2104 of file symbol.c.

2108 {
2109  struct sym_enumW sew;
2110 
2111  TRACE("(%p %s %u %u %s %s %p %p %x)\n",
2112  hProcess, wine_dbgstr_longlong(BaseOfDll), Index, SymTag, debugstr_w(Mask),
2113  wine_dbgstr_longlong(Address), EnumSymbolsCallback,
2114  UserContext, Options);
2115 
2116  sew.ctx = UserContext;
2117  sew.cb = EnumSymbolsCallback;
2118  sew.sym_info = (PSYMBOL_INFOW)sew.buffer;
2119 
2120  return doSymSearch(hProcess, BaseOfDll, Index, SymTag, Mask, Address,
2121  sym_enumW, &sew, Options);
2122 }
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:2047
_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:41

◆ SymSetHomeDirectory()

PCHAR WINAPI SymSetHomeDirectory ( HANDLE  hProcess,
PCSTR  dir 
)

Definition at line 2295 of file symbol.c.

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

◆ SymSetHomeDirectoryW()

PWSTR WINAPI SymSetHomeDirectoryW ( HANDLE  hProcess,
PCWSTR  dir 
)

Definition at line 2306 of file symbol.c.

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

◆ SymSetScopeFromAddr()

BOOL WINAPI SymSetScopeFromAddr ( HANDLE  hProcess,
ULONG64  addr 
)

Definition at line 2160 of file symbol.c.

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

◆ symt_add_func_line()

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

Definition at line 328 of file symbol.c.

330 {
331  struct line_info* dli;
332  BOOL last_matches = FALSE;
333  int i;
334 
335  if (func == NULL || !(dbghelp_options & SYMOPT_LOAD_LINES)) return;
336 
337  TRACE_(dbghelp_symt)("(%p)%s:%lx %s:%u\n",
338  func, func->hash_elt.name, offset,
339  source_get(module, source_idx), line_num);
340 
341  assert(func->symt.tag == SymTagFunction);
342 
343  for (i=vector_length(&func->vlines)-1; i>=0; i--)
344  {
345  dli = vector_at(&func->vlines, i);
346  if (dli->is_source_file)
347  {
348  last_matches = (source_idx == dli->u.source_file);
349  break;
350  }
351  }
352 
353  if (!last_matches)
354  {
355  /* we shouldn't have line changes on first line of function */
356  dli = vector_add(&func->vlines, &module->pool);
357  dli->is_source_file = 1;
358  dli->is_first = dli->is_last = 0;
359  dli->line_number = 0;
360  dli->u.source_file = source_idx;
361  }
362  dli = vector_add(&func->vlines, &module->pool);
363  dli->is_source_file = 0;
364  dli->is_first = dli->is_last = 0;
365  dli->line_number = line_num;
366  dli->u.pc_offset = func->address + offset;
367 }
unsigned long line_number
unsigned long pc_offset
GLenum func
Definition: glext.h:6028
union line_info::@359 u
void * vector_at(const struct vector *v, unsigned pos) DECLSPEC_HIDDEN
Definition: storage.c:163
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:131
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
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define TRACE_(x)
Definition: compat.h:66
unsigned long is_first
unsigned dbghelp_options
Definition: dbghelp.c:72
#define SYMOPT_LOAD_LINES
Definition: compat.h:639
struct pool pool
void * vector_add(struct vector *v, struct pool *pool) DECLSPEC_HIDDEN
Definition: storage.c:172
unsigned long is_last
unsigned long is_source_file
unsigned vector_length(const struct vector *v) DECLSPEC_HIDDEN
Definition: storage.c:158

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 380 of file symbol.c.

386 {
387  struct symt_data* locsym;
388  struct symt** p;
389 
390  TRACE_(dbghelp_symt)("Adding local symbol (%s:%s): %s %p\n",
392  name, type);
393 
394  assert(func);
395  assert(func->symt.tag == SymTagFunction);
396  assert(dt == DataIsParam || dt == DataIsLocal);
397 
398  locsym = pool_alloc(&module->pool, sizeof(*locsym));
399  locsym->symt.tag = SymTagData;
400  locsym->hash_elt.name = pool_strdup(&module->pool, name);
401  locsym->hash_elt.next = NULL;
402  locsym->kind = dt;
403  locsym->container = block ? &block->symt : &func->symt;
404  locsym->type = type;
405  locsym->u.var = *loc;
406  if (block)
407  p = vector_add(&block->vchildren, &module->pool);
408  else
409  p = vector_add(&func->vchildren, &module->pool);
410  *p = &locsym->symt;
411  return locsym;
412 }
static unsigned int block
Definition: xmlmemory.c:118
GLenum func
Definition: glext.h:6028
char * name
Definition: wpp.c:36
WCHAR ModuleName[32]
Definition: compat.h:725
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define assert(x)
Definition: debug.h:53
enum DataKind kind
union symt_data::@356 u
void * pool_alloc(struct pool *a, size_t len) DECLSPEC_HIDDEN
Definition: storage.c:90
#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:66
struct symt * container
struct location var
struct pool pool
char * pool_strdup(struct pool *a, const char *str) DECLSPEC_HIDDEN
Definition: storage.c:127
void * vector_add(struct vector *v, struct pool *pool) DECLSPEC_HIDDEN
Definition: storage.c:172
struct hash_table_elt hash_elt
Definition: name.c:36
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 454 of file symbol.c.

459 {
460  struct symt_hierarchy_point*sym;
461  struct symt** p;
462 
463  if ((sym = pool_alloc(&module->pool, sizeof(*sym))))
464  {
465  sym->symt.tag = point;
466  sym->parent = &func->symt;
467  sym->loc = *loc;
468  sym->hash_elt.name = name ? pool_strdup(&module->pool, name) : NULL;
469  p = vector_add(&func->vchildren, &module->pool);
470  *p = &sym->symt;
471  }
472  return sym;
473 }
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:90
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:127
void * vector_add(struct vector *v, struct pool *pool) DECLSPEC_HIDDEN
Definition: storage.c:172
Definition: name.c:36
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 145 of file symbol.c.

146 {
147  ULONG64 addr;
148 
149  hash_table_add(&module->ht_symbols, &ht->hash_elt);
150  /* Don't store in sorttab a symbol without address, they are of
151  * no use here (e.g. constant values)
152  */
153  if (symt_get_address(&ht->symt, &addr) &&
155  {
158  }
159 }
BOOL symt_get_address(const struct symt *type, ULONG64 *addr) DECLSPEC_HIDDEN
Definition: type.c:120
struct hash_table ht_symbols
unsigned num_symbols
int sortlist_valid
static BOOL symt_grow_sorttab(struct module *module, unsigned sz)
Definition: symbol.c:122
void hash_table_add(struct hash_table *ht, struct hash_table_elt *elt) DECLSPEC_HIDDEN
Definition: storage.c:379
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 442 of file symbol.c.

445 {
446  assert(func);
447  assert(func->symt.tag == SymTagFunction);
448 
449  if (pc) block->size = func->address + pc - block->address;
450  return (block->container->tag == SymTagBlock) ?
451  CONTAINING_RECORD(block->container, struct symt_block, symt) : NULL;
452 }
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 symt_cmp_addr ( const void p1,
const void p2 
)

Definition at line 59 of file symbol.c.

60 {
61  const struct symt* sym1 = *(const struct symt* const *)p1;
62  const struct symt* sym2 = *(const struct symt* const *)p2;
63  ULONG64 a1, a2;
64 
65  symt_get_address(sym1, &a1);
66  symt_get_address(sym2, &a2);
67  return cmp_addr(a1, a2);
68 }
BOOL symt_get_address(const struct symt *type, ULONG64 *addr) DECLSPEC_HIDDEN
Definition: type.c:120
static int cmp_addr(ULONG64 a1, ULONG64 a2)
Definition: symbol.c:45
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 1008 of file symbol.c.

1010 {
1011  struct module_pair pair;
1012  struct symt_ht* sym;
1014 
1015  se->sym_info->SizeOfStruct = sizeof(*se->sym_info);
1016  se->sym_info->MaxNameLen = sizeof(se->buffer) - sizeof(SYMBOL_INFO);
1017 
1018  pair.pcs = pcs;
1019  pair.requested = module_find_by_addr(pair.pcs, pc, DMT_UNKNOWN);
1020  if (!module_get_debug(&pair)) return FALSE;
1021  if ((sym = symt_find_nearest(pair.effective, pc)) == NULL) return FALSE;
1022 
1023  if (sym->symt.tag == SymTagFunction)
1024  {
1025  return symt_enum_locals_helper(&pair, mask ? mask : starW, se, (struct symt_function*)sym,
1026  &((struct symt_function*)sym)->vchildren);
1027  }
1028  return FALSE;
1029 }
SYMBOL_INFO * sym_info
Definition: symbol.c:746
ULONG MaxNameLen
Definition: compat.h:700
IMAGEHLP_STACK_FRAME ctx_frame
GLenum GLint GLuint mask
Definition: glext.h:6028
smooth NULL
Definition: ftsmooth.c:416
char buffer[sizeof(SYMBOL_INFO)+MAX_SYM_NAME]
Definition: symbol.c:750
BOOL module_get_debug(struct module_pair *) DECLSPEC_HIDDEN
Definition: module.c:340
struct symt symt
ULONG64 InstructionOffset
Definition: compat.h:1017
struct module * module_find_by_addr(const struct process *pcs, DWORD64 addr, enum module_type type) DECLSPEC_HIDDEN
Definition: module.c:399
ULONG SizeOfStruct
Definition: compat.h:687
uint32_t DWORD_PTR
Definition: typedefs.h:63
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:961
Definition: _pair.h:47
static const WCHAR starW[]
Definition: symbol.c:43
struct symt_ht * symt_find_nearest(struct module *module, DWORD_PTR addr)
Definition: symbol.c:905

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 961 of file symbol.c.

964 {
965  struct symt* lsym = NULL;
966  DWORD pc = pair->pcs->ctx_frame.InstructionOffset;
967  unsigned int i;
968  WCHAR* nameW;
969  BOOL ret;
970 
971  for (i=0; i<vector_length(v); i++)
972  {
973  lsym = *(struct symt**)vector_at(v, i);
974  switch (lsym->tag)
975  {
976  case SymTagBlock:
977  {
978  struct symt_block* block = (struct symt_block*)lsym;
979  if (pc < block->address || block->address + block->size <= pc)
980  continue;
981  if (!symt_enum_locals_helper(pair, match, se, func, &block->vchildren))
982  return FALSE;
983  }
984  break;
985  case SymTagData:
986  nameW = symt_get_nameW(lsym);
990  if (ret)
991  {
992  if (send_symbol(se, pair, func, lsym)) return FALSE;
993  }
994  break;
995  case SymTagLabel:
997  case SymTagFuncDebugEnd:
998  case SymTagCustom:
999  break;
1000  default:
1001  FIXME("Unknown type: %u (%x)\n", lsym->tag, lsym->tag);
1002  assert(0);
1003  }
1004  }
1005  return TRUE;
1006 }
static unsigned int block
Definition: xmlmemory.c:118
GLenum func
Definition: glext.h:6028
#define TRUE
Definition: types.h:120
WCHAR * symt_get_nameW(const struct symt *sym) DECLSPEC_HIDDEN
Definition: type.c:107
Definition: match.c:28
void * vector_at(const struct vector *v, unsigned pos) DECLSPEC_HIDDEN
Definition: storage.c:163
#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:2035
#define SYMOPT_CASE_INSENSITIVE
Definition: compat.h:636
unsigned int BOOL
Definition: ntddk_ex.h:94
enum SymTagEnum tag
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR nameW[]
Definition: main.c:46
#define GetProcessHeap()
Definition: compat.h:395
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned dbghelp_options
Definition: dbghelp.c:72
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:961
const GLdouble * v
Definition: gl.h:2040
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:753
#define HeapFree(x, y, z)
Definition: compat.h:394
unsigned vector_length(const struct vector *v) DECLSPEC_HIDDEN
Definition: storage.c:158

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 763 of file symbol.c.

765 {
766  void* ptr;
767  struct symt_ht* sym = NULL;
768  struct hash_table_iter hti;
769  WCHAR* nameW;
770  BOOL ret;
771 
772  hash_table_iter_init(&pair->effective->ht_symbols, &hti, NULL);
773  while ((ptr = hash_table_iter_up(&hti)))
774  {
775  sym = CONTAINING_RECORD(ptr, struct symt_ht, hash_elt);
776  nameW = symt_get_nameW(&sym->symt);
779  if (ret)
780  {
781  se->sym_info->SizeOfStruct = sizeof(SYMBOL_INFO);
782  se->sym_info->MaxNameLen = sizeof(se->buffer) - sizeof(SYMBOL_INFO);
783  if (send_symbol(se, pair, NULL, &sym->symt)) return TRUE;
784  }
785  }
786  return FALSE;
787 }
SYMBOL_INFO * sym_info
Definition: symbol.c:746
#define TRUE
Definition: types.h:120
WCHAR * symt_get_nameW(const struct symt *sym) DECLSPEC_HIDDEN
Definition: type.c:107
ULONG MaxNameLen
Definition: compat.h:700
Definition: match.c:28
BOOL WINAPI SymMatchStringW(PCWSTR string, PCWSTR re, BOOL _case)
Definition: symbol.c:2035
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:406
smooth NULL
Definition: ftsmooth.c:416
char buffer[sizeof(SYMBOL_INFO)+MAX_SYM_NAME]
Definition: symbol.c:750
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:395
__wchar_t WCHAR
Definition: xmlstorage.h:180
struct _SYMBOL_INFO SYMBOL_INFO
struct symt symt
int ret
ULONG SizeOfStruct
Definition: compat.h:687
void * hash_table_iter_up(struct hash_table_iter *hti) DECLSPEC_HIDDEN
Definition: storage.c:423
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:753
#define HeapFree(x, y, z)
Definition: compat.h:394

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 1488 of file symbol.c.

1490 {
1491  struct line_info* dli = NULL;
1492  BOOL found = FALSE;
1493  int i;
1494 
1495  assert(func->symt.tag == SymTagFunction);
1496 
1497  for (i=vector_length(&func->vlines)-1; i>=0; i--)
1498  {
1499  dli = vector_at(&func->vlines, i);
1500  if (!dli->is_source_file)
1501  {
1502  if (found || dli->u.pc_offset > addr) continue;
1503  line->LineNumber = dli->line_number;
1504  line->Address = dli->u.pc_offset;
1505  line->Key = dli;
1506  found = TRUE;
1507  continue;
1508  }
1509  if (found)
1510  {
1511  line->FileName = (char*)source_get(module, dli->u.source_file);
1512  return TRUE;
1513  }
1514  }
1515  return FALSE;
1516 }
unsigned long line_number
unsigned long pc_offset
GLenum func
Definition: glext.h:6028
#define TRUE
Definition: types.h:120
union line_info::@359 u
void * vector_at(const struct vector *v, unsigned pos) DECLSPEC_HIDDEN
Definition: storage.c:163
#define assert(x)
Definition: debug.h:53
const char * source_get(const struct module *module, unsigned idx) DECLSPEC_HIDDEN
Definition: source.c:131
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
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
Definition: parser.c:48
GLenum const GLvoid * addr
Definition: glext.h:9621
unsigned long is_source_file
unsigned vector_length(const struct vector *v) DECLSPEC_HIDDEN
Definition: storage.c:158

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 584 of file symbol.c.

587 {
588  const char* name;
589  DWORD64 size;
590 
591  if (!symt_get_info(pair->effective, sym, TI_GET_TYPE, &sym_info->TypeIndex))
592  sym_info->TypeIndex = 0;
593  sym_info->Index = symt_ptr2index(pair->effective, sym);
594  sym_info->Reserved[0] = sym_info->Reserved[1] = 0;
595  if (!symt_get_info(pair->effective, sym, TI_GET_LENGTH, &size) &&
596  (!sym_info->TypeIndex ||
597  !symt_get_info(pair->effective, symt_index2ptr(pair->effective, sym_info->TypeIndex),
598  TI_GET_LENGTH, &size)))
599  size = 0;
600  sym_info->Size = (DWORD)size;
601  sym_info->ModBase = pair->requested->module.BaseOfImage;
602  sym_info->Flags = 0;
603  sym_info->Value = 0;
604 
605  switch (sym->tag)
606  {
607  case SymTagData:
608  {
609  const struct symt_data* data = (const struct symt_data*)sym;
610  switch (data->kind)
611  {
612  case DataIsParam:
613  sym_info->Flags |= SYMFLAG_PARAMETER;
614  /* fall through */
615  case DataIsLocal:
616  sym_info->Flags |= SYMFLAG_LOCAL;
617  {
618  struct location loc = data->u.var;
619 
620  if (loc.kind >= loc_user)
621  {
622  unsigned i;
623  struct module_format* modfmt;
624 
625  for (i = 0; i < DFI_LAST; i++)
626  {
627  modfmt = pair->effective->format_info[i];
628  if (modfmt && modfmt->loc_compute)
629  {
630  modfmt->loc_compute(pair->pcs, modfmt, func, &loc);
631  break;
632  }
633  }
634  }
635  switch (loc.kind)
636  {
637  case loc_error:
638  /* for now we report error cases as a negative register number */
639  /* fall through */
640  case loc_register:
641  sym_info->Flags |= SYMFLAG_REGISTER;
642  sym_info->Register = loc.reg;
643  sym_info->Address = 0;
644  break;
645  case loc_regrel:
646  sym_info->Flags |= SYMFLAG_REGREL;
647  sym_info->Register = loc.reg;
648  if (loc.reg == CV_REG_NONE || (int)loc.reg < 0 /* error */)
649  FIXME("suspicious register value %x\n", loc.reg);
650  sym_info->Address = loc.offset;
651  break;
652  case loc_absolute:
653  sym_info->Flags |= SYMFLAG_VALUEPRESENT;
654  sym_info->Value = loc.offset;
655  break;
656  default:
657  FIXME("Shouldn't happen (kind=%d), debug reader backend is broken\n", loc.kind);
658  assert(0);
659  }
660  }
661  break;
662  case DataIsGlobal:
663  case DataIsFileStatic:
664  switch (data->u.var.kind)
665  {
666  case loc_tlsrel:
667  sym_info->Flags |= SYMFLAG_TLSREL;
668  /* fall through */
669  case loc_absolute:
670  symt_get_address(sym, &sym_info->Address);
671  sym_info->Register = 0;
672  break;
673  default:
674  FIXME("Shouldn't happen (kind=%d), debug reader backend is broken\n", data->u.var.kind);
675  assert(0);
676  }
677  break;
678  case DataIsConstant:
679  sym_info->Flags |= SYMFLAG_VALUEPRESENT;
680  switch (data->u.value.n1.n2.vt)
681  {
682  case VT_I4: sym_info->Value = (ULONG)data->u.value.n1.n2.n3.lVal; break;
683  case VT_I2: sym_info->Value = (ULONG)(long)data->u.value.n1.n2.n3.iVal; break;
684  case VT_I1: sym_info->Value = (ULONG)(long)data->u.value.n1.n2.n3.cVal; break;
685  case VT_UI4: sym_info->Value = (ULONG)data->u.value.n1.n2.n3.ulVal; break;
686  case VT_UI2: sym_info->Value = (ULONG)data->u.value.n1.n2.n3.uiVal; break;
687  case VT_UI1: sym_info->Value = (ULONG)data->u.value.n1.n2.n3.bVal; break;
688  case VT_I1 | VT_BYREF: sym_info->Value = (ULONG64)(DWORD_PTR)data->u.value.n1.n2.n3.byref; break;
689  case VT_EMPTY: sym_info->Value = 0; break;
690  default:
691  FIXME("Unsupported variant type (%u)\n", data->u.value.n1.n2.vt);
692  sym_info->Value = 0;
693  break;
694  }
695  break;
696  default:
697  FIXME("Unhandled kind (%u) in sym data\n", data->kind);
698  }
699  }
700  break;
701  case SymTagPublicSymbol:
702  {
703  const struct symt_public* pub = (const struct symt_public*)sym;
704  if (pub->is_function)
705  sym_info->Flags |= SYMFLAG_PUBLIC_CODE;
706  else
707  sym_info->Flags |= SYMFLAG_EXPORT;
708  symt_get_address(sym, &sym_info->Address);
709  }
710  break;
711  case SymTagFunction:
712  symt_get_address(sym, &sym_info->Address);
713  break;
714  case SymTagThunk:
715  sym_info->Flags |= SYMFLAG_THUNK;
716  symt_get_address(sym, &sym_info->Address);
717  break;
718  default:
719  symt_get_address(sym, &sym_info->Address);
720  sym_info->Register = 0;
721  break;
722  }
723  sym_info->Scope = 0; /* FIXME */
724  sym_info->Tag = sym->tag;
725  name = symt_get_name(sym);
726  if (sym_info->MaxNameLen)
727  {
729  ((sym_info->NameLen = UnDecorateSymbolName(name, sym_info->Name,
730  sym_info->MaxNameLen, UNDNAME_NAME_ONLY)) == 0))
731  {
732  sym_info->NameLen = min(strlen(name), sym_info->MaxNameLen - 1);
733  memcpy(sym_info->Name, name, sym_info->NameLen);
734  sym_info->Name[sym_info->NameLen] = '\0';
735  }
736  }
737  TRACE_(dbghelp_symt)("%p => %s %u %s\n",
738  sym, sym_info->Name, sym_info->Size,
739  wine_dbgstr_longlong(sym_info->Address));
740 }
BOOL symt_get_address(const struct symt *type, ULONG64 *addr) DECLSPEC_HIDDEN
Definition: type.c:120
GLenum func
Definition: glext.h:6028
ULONG Tag
Definition: compat.h:698
CHAR Name[1]
Definition: compat.h:701
ULONG NameLen
Definition: compat.h:699
Definition: compat.h:1939
ULONG MaxNameLen
Definition: compat.h:700
#define SYMFLAG_REGREL
Definition: compat.h:646
Definition: compat.h:1951
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define SYMFLAG_TLSREL
Definition: compat.h:656
ULONG Scope
Definition: compat.h:697
ULONG Flags
Definition: compat.h:693
ULONG TypeIndex
Definition: compat.h:688
#define assert(x)
Definition: debug.h:53
ULONG64 Address
Definition: compat.h:695
const char * symt_get_name(const struct symt *sym) DECLSPEC_HIDDEN
Definition: type.c:82
#define SYMFLAG_PUBLIC_CODE
Definition: compat.h:664
#define UNDNAME_NAME_ONLY
Definition: compat.h:666
#define DWORD
Definition: nt_native.h:44
DWORD symt_ptr2index(struct module *module, const struct symt *sym)
Definition: symbol.c:70
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:689
struct symt * symt_index2ptr(struct module *module, DWORD id)
Definition: symbol.c:112
enum SymTagEnum tag
#define FIXME(fmt,...)
Definition: debug.h:110
ULONG64 ModBase
Definition: compat.h:692
ULONG Index
Definition: compat.h:690
#define SYMFLAG_LOCAL
Definition: compat.h:649
#define SYMFLAG_VALUEPRESENT
Definition: compat.h:644
DWORD WINAPI UnDecorateSymbolName(const char *decorated_name, char *undecorated_name, DWORD undecorated_length, DWORD flags)
Definition: symbol.c:1828
#define TRACE_(x)
Definition: compat.h:66
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)
unsigned dbghelp_options
Definition: dbghelp.c:72
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define SYMOPT_UNDNAME
Definition: compat.h:637
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:63
#define SYMFLAG_REGISTER
Definition: compat.h:645
ULONG Register
Definition: compat.h:696
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:537
uint64_t DWORD64
Definition: typedefs.h:65
#define long
Definition: qsort.c:33
#define SYMFLAG_EXPORT
Definition: compat.h:651
#define min(a, b)
Definition: monoChain.cc:55
Definition: _pair.h:47
#define SYMFLAG_THUNK
Definition: compat.h:655
ULONG64 Value
Definition: compat.h:694
Definition: name.c:36
unsigned long offset
unsigned int ULONG
Definition: retypes.h:1
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:41
#define SYMFLAG_PARAMETER
Definition: compat.h:648
ULONG Size
Definition: compat.h:691
Definition: compat.h:1938
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 905 of file symbol.c.

906 {
907  int mid, high, low;
908  ULONG64 ref_addr, ref_size;
909 
911  {
912  if (!resort_symbols(module)) return NULL;
913  }
914 
915  /*
916  * Binary search to find closest symbol.
917  */
918  low = 0;
919  high = module->num_sorttab;
920 
921  symt_get_address(&module->addr_sorttab[0]->symt, &ref_addr);
922  if (addr <= ref_addr)
923  {
924  low = symt_get_best_at(module, 0);
925  return module->addr_sorttab[low];
926  }
927 
928  if (high)
929  {
930  symt_get_address(&module->addr_sorttab[high - 1]->symt, &ref_addr);
931  symt_get_length(module, &module->addr_sorttab[high - 1]->symt, &ref_size);
932  if (addr >= ref_addr + ref_size) return NULL;
933  }
934 
935  while (high > low + 1)
936  {
937  mid = (high + low) / 2;
938  if (cmp_sorttab_addr(module, mid, addr) < 0)
939  low = mid;
940  else
941  high = mid;
942  }
943  if (low != high && high != module->num_sorttab &&
944  cmp_sorttab_addr(module, high, addr) <= 0)
945  low = high;
946 
947  /* If found symbol is a public symbol, check if there are any other entries that
948  * might also have the same address, but would get better information
949  */
950  low = symt_get_best_at(module, low);
951 
952  /* finally check that we fit into the found symbol */
953  //symt_get_address(&module->addr_sorttab[low]->symt, &ref_addr);
954  //if (addr < ref_addr) return NULL;
955  //symt_get_length(module, &module->addr_sorttab[low]->symt, &ref_size);
956  //if (addr >= ref_addr + ref_size) return NULL;
957 
958  return module->addr_sorttab[low];
959 }
BOOL symt_get_address(const struct symt *type, ULONG64 *addr) DECLSPEC_HIDDEN
Definition: type.c:120
static BOOL resort_symbols(struct module *module)
Definition: symbol.c:814
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:52
static void symt_get_length(struct module *module, const struct symt *symt, ULONG64 *size)
Definition: symbol.c:865
unsigned __int64 ULONG64
Definition: imports.h:198
GLenum const GLvoid * addr
Definition: glext.h:9621
int symt_get_best_at(struct module *module, int idx_sorttab)
Definition: symbol.c:878
struct symt_ht ** addr_sorttab

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

◆ symt_get_best_at()

int symt_get_best_at ( struct module module,
int  idx_sorttab 
)

Definition at line 878 of file symbol.c.

879 {
880  ULONG64 ref_addr;
881  int idx_sorttab_orig = idx_sorttab;
882  if (module->addr_sorttab[idx_sorttab]->symt.tag == SymTagPublicSymbol)
883  {
884  symt_get_address(&module->addr_sorttab[idx_sorttab]->symt, &ref_addr);
885  while (idx_sorttab > 0 &&
886  module->addr_sorttab[idx_sorttab]->symt.tag == SymTagPublicSymbol &&
887  !cmp_sorttab_addr(module, idx_sorttab - 1, ref_addr))
888  idx_sorttab--;
889  if (module->addr_sorttab[idx_sorttab]->symt.tag == SymTagPublicSymbol)
890  {
891  idx_sorttab = idx_sorttab_orig;
892  while (idx_sorttab < module->num_sorttab - 1 &&
893  module->addr_sorttab[idx_sorttab]->symt.tag == SymTagPublicSymbol &&
894  !cmp_sorttab_addr(module, idx_sorttab + 1, ref_addr))
895  idx_sorttab++;
896  }
897  /* if no better symbol fond restore original */
898  if (module->addr_sorttab[idx_sorttab]->symt.tag == SymTagPublicSymbol)
899  idx_sorttab = idx_sorttab_orig;
900  }
901  return idx_sorttab;
902 }
BOOL symt_get_address(const struct symt *type, ULONG64 *addr) DECLSPEC_HIDDEN
Definition: type.c:120
static int cmp_sorttab_addr(struct module *module, int idx, ULONG64 addr)
Definition: symbol.c:52
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 1730 of file symbol.c.

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

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 865 of file symbol.c.

866 {
867  DWORD type_index;
868 
870  return;
871 
872  if (symt_get_info(module, symt, TI_GET_TYPE, &type_index) &&
873  symt_get_info(module, symt_index2ptr(module, type_index), TI_GET_LENGTH, size)) return;
874  *size = 0x1000; /* arbitrary value */
875 }
struct symt * symt_index2ptr(struct module *module, DWORD id)
Definition: symbol.c:112
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:537

Referenced by symt_find_nearest().

◆ symt_grow_sorttab()

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

Definition at line 122 of file symbol.c.

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

Referenced by symt_add_module_ht().

◆ symt_index2ptr()

struct symt* symt_index2ptr ( struct module module,
DWORD  id 
)

Definition at line 112 of file symbol.c.

113 {
114 #ifdef __x86_64__
115  if (!id-- || id >= vector_length(&module->vsymt)) return NULL;
116  return *(struct symt**)vector_at(&module->vsymt, id);
117 #else
118  return (struct symt*)id;
119 #endif
120 }
void * vector_at(const struct vector *v, unsigned pos) DECLSPEC_HIDDEN
Definition: storage.c:163
struct vector vsymt
smooth NULL
Definition: ftsmooth.c:416
GLenum GLuint id
Definition: glext.h:5579
unsigned vector_length(const struct vector *v) DECLSPEC_HIDDEN
Definition: storage.c:158

Referenced by SymGetTypeInfo(), symt_fill_sym_info(), and symt_get_length().

◆ symt_new_compiland()

struct symt_compiland* symt_new_compiland ( struct module module,
unsigned long  address,
unsigned  src_idx 
)

Definition at line 209 of file symbol.c.

211 {
212  struct symt_compiland* sym;
213 
214  TRACE_(dbghelp_symt)("Adding compiland symbol %s:%s\n",
216  if ((sym = pool_alloc(&module->pool, sizeof(*sym))))
217  {
218  sym->symt.tag = SymTagCompiland;
219  sym->address = address;
220  sym->source = src_idx;
221  vector_init(&sym->vchildren, sizeof(struct symt*), 32);
222  }
223  return sym;
224 }
WCHAR ModuleName[32]
Definition: compat.h:725
struct vector vchildren