ReactOS  0.4.14-dev-98-gb0d4763
type.c File Reference
#include "config.h"
#include <stdlib.h>
#include <stdarg.h>
#include <assert.h>
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "wine/debug.h"
#include "dbghelp_private.h"
Include dependency graph for type.c:

Go to the source code of this file.

Classes

struct  enum_types_AtoW
 

Macros

#define NONAMELESSUNION
 
#define X(_t)   (*((_t*)pInfo))
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (dbghelp)
 
 WINE_DECLARE_DEBUG_CHANNEL (dbghelp_symt)
 
static const charsymt_get_tag_str (DWORD tag)
 
const charsymt_get_name (const struct symt *sym)
 
WCHARsymt_get_nameW (const struct symt *sym)
 
BOOL symt_get_address (const struct symt *type, ULONG64 *addr)
 
static struct symtsymt_find_type_by_name (const struct module *module, enum SymTagEnum sym_tag, const char *typename)
 
static void symt_add_type (struct module *module, struct symt *symt)
 
struct symt_basicsymt_new_basic (struct module *module, enum BasicType bt, const char *typename, unsigned size)
 
struct symt_udtsymt_new_udt (struct module *module, const char *typename, unsigned size, enum UdtKind kind)
 
BOOL symt_set_udt_size (struct module *module, struct symt_udt *udt, unsigned size)
 
BOOL symt_add_udt_element (struct module *module, struct symt_udt *udt_type, const char *name, struct symt *elt_type, unsigned offset, unsigned size)
 
struct symt_enumsymt_new_enum (struct module *module, const char *typename, struct symt *basetype)
 
BOOL symt_add_enum_element (struct module *module, struct symt_enum *enum_type, const char *name, int value)
 
struct symt_arraysymt_new_array (struct module *module, int min, int max, struct symt *base, struct symt *index)
 
static DWORD symt_array_count (struct module *module, const struct symt_array *array)
 
struct symt_function_signaturesymt_new_function_signature (struct module *module, struct symt *ret_type, enum CV_call_e call_conv)
 
BOOL symt_add_function_signature_parameter (struct module *module, struct symt_function_signature *sig_type, struct symt *param)
 
struct symt_pointersymt_new_pointer (struct module *module, struct symt *ref_type, unsigned long size)
 
struct symt_typedefsymt_new_typedef (struct module *module, struct symt *ref, const char *name)
 
BOOL WINAPI SymEnumTypes (HANDLE hProcess, ULONG64 BaseOfDll, PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback, PVOID UserContext)
 
static BOOL CALLBACK enum_types_AtoW (PSYMBOL_INFO si, ULONG addr, PVOID _et)
 
BOOL WINAPI SymEnumTypesW (HANDLE hProcess, ULONG64 BaseOfDll, PSYM_ENUMERATESYMBOLS_CALLBACKW EnumSymbolsCallback, PVOID UserContext)
 
BOOL symt_get_info (struct module *module, const struct symt *type, IMAGEHLP_SYMBOL_TYPE_INFO req, void *pInfo)
 
BOOL WINAPI SymGetTypeInfo (HANDLE hProcess, DWORD64 ModBase, ULONG TypeId, IMAGEHLP_SYMBOL_TYPE_INFO GetType, PVOID pInfo)
 
BOOL WINAPI SymGetTypeFromName (HANDLE hProcess, ULONG64 BaseOfDll, PCSTR Name, PSYMBOL_INFO Symbol)
 

Macro Definition Documentation

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 25 of file type.c.

◆ X

#define X (   _t)    (*((_t*)pInfo))

Function Documentation

◆ enum_types_AtoW()

static BOOL CALLBACK enum_types_AtoW ( PSYMBOL_INFO  si,
ULONG  addr,
PVOID  _et 
)
static

Definition at line 507 of file type.c.

508 {
509  struct enum_types_AtoW* et = _et;
510  SYMBOL_INFOW* siW = (SYMBOL_INFOW*)et->buffer;
511 
512  copy_symbolW(siW, si);
513  return et->callback(siW, addr, et->user);
514 }
void copy_symbolW(SYMBOL_INFOW *siw, const SYMBOL_INFO *si) DECLSPEC_HIDDEN
Definition: symbol.c:1037
void * user
Definition: type.c:503
PSYM_ENUMERATESYMBOLS_CALLBACKW callback
Definition: type.c:504
GLenum const GLvoid * addr
Definition: glext.h:9621
char buffer[sizeof(SYMBOL_INFOW)+256 *sizeof(WCHAR)]
Definition: type.c:502

◆ SymEnumTypes()

BOOL WINAPI SymEnumTypes ( HANDLE  hProcess,
ULONG64  BaseOfDll,
PSYM_ENUMERATESYMBOLS_CALLBACK  EnumSymbolsCallback,
PVOID  UserContext 
)

Definition at line 449 of file type.c.

452 {
453  struct module_pair pair;
454  char buffer[sizeof(SYMBOL_INFO) + 256];
455  SYMBOL_INFO* sym_info = (SYMBOL_INFO*)buffer;
456  const char* tmp;
457  struct symt* type;
458  DWORD64 size;
459  unsigned int i;
460 
461  TRACE("(%p %s %p %p)\n",
462  hProcess, wine_dbgstr_longlong(BaseOfDll), EnumSymbolsCallback,
463  UserContext);
464 
465  if (!(pair.pcs = process_find_by_handle(hProcess))) return FALSE;
466  pair.requested = module_find_by_addr(pair.pcs, BaseOfDll, DMT_UNKNOWN);
467  if (!module_get_debug(&pair)) return FALSE;
468 
469  sym_info->SizeOfStruct = sizeof(SYMBOL_INFO);
470  sym_info->MaxNameLen = sizeof(buffer) - sizeof(SYMBOL_INFO);
471 
472  for (i=0; i<vector_length(&pair.effective->vtypes); i++)
473  {
474  type = *(struct symt**)vector_at(&pair.effective->vtypes, i);
475  sym_info->TypeIndex = symt_ptr2index(pair.effective, type);
476  sym_info->Index = 0; /* FIXME */
477  symt_get_info(pair.effective, type, TI_GET_LENGTH, &size);
478  sym_info->Size = size;
479  sym_info->ModBase = pair.requested->module.BaseOfImage;
480  sym_info->Flags = 0; /* FIXME */
481  sym_info->Value = 0; /* FIXME */
482  sym_info->Address = 0; /* FIXME */
483  sym_info->Register = 0; /* FIXME */
484  sym_info->Scope = 0; /* FIXME */
485  sym_info->Tag = type->tag;
486  tmp = symt_get_name(type);
487  if (tmp)
488  {
489  sym_info->NameLen = min(strlen(tmp),sym_info->MaxNameLen-1);
490  memcpy(sym_info->Name, tmp, sym_info->NameLen);
491  sym_info->Name[sym_info->NameLen] = '\0';
492  }
493  else
494  sym_info->Name[sym_info->NameLen = 0] = '\0';
495  if (!EnumSymbolsCallback(sym_info, sym_info->Size, UserContext)) break;
496  }
497  return TRUE;
498 }
#define TRUE
Definition: types.h:120
struct process * process_find_by_handle(HANDLE hProcess)
Definition: dbghelp.c:80
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
void * vector_at(const struct vector *v, unsigned pos) DECLSPEC_HIDDEN
Definition: storage.c:163
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLuint buffer
Definition: glext.h:5915
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h: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
DWORD symt_ptr2index(struct module *module, const struct symt *sym) DECLSPEC_HIDDEN
Definition: symbol.c: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
struct _SYMBOL_INFO SYMBOL_INFO
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
const char * symt_get_name(const struct symt *sym)
Definition: type.c:82
uint64_t DWORD64
Definition: typedefs.h:65
#define min(a, b)
Definition: monoChain.cc:55
Definition: _pair.h:47
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:41
BOOL symt_get_info(struct module *module, const struct symt *type, IMAGEHLP_SYMBOL_TYPE_INFO req, void *pInfo)
Definition: type.c:537
unsigned vector_length(const struct vector *v) DECLSPEC_HIDDEN
Definition: storage.c:158

Referenced by main(), and SymEnumTypesW().

◆ SymEnumTypesW()

BOOL WINAPI SymEnumTypesW ( HANDLE  hProcess,
ULONG64  BaseOfDll,
PSYM_ENUMERATESYMBOLS_CALLBACKW  EnumSymbolsCallback,
PVOID  UserContext 
)

Definition at line 520 of file type.c.

523 {
524  struct enum_types_AtoW et;
525 
526  et.callback = EnumSymbolsCallback;
527  et.user = UserContext;
528 
529  return SymEnumTypes(hProcess, BaseOfDll, enum_types_AtoW, &et);
530 }
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
BOOL WINAPI SymEnumTypes(HANDLE hProcess, ULONG64 BaseOfDll, PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback, PVOID UserContext)
Definition: type.c:449
PSYM_ENUMERATESYMBOLS_CALLBACKW callback
Definition: type.c:504

◆ SymGetTypeFromName()

BOOL WINAPI SymGetTypeFromName ( HANDLE  hProcess,
ULONG64  BaseOfDll,
PCSTR  Name,
PSYMBOL_INFO  Symbol 
)

Definition at line 924 of file type.c.

926 {
927  struct process* pcs = process_find_by_handle(hProcess);
928  struct module_pair pair;
929  struct symt* type;
930 
931  if (!pcs) return FALSE;
932  pair.requested = module_find_by_addr(pcs, BaseOfDll, DMT_UNKNOWN);
933  if (!module_get_debug(&pair)) return FALSE;
935  if (!type) return FALSE;
936  Symbol->TypeIndex = symt_ptr2index(pair.effective, type);
937 
938  return TRUE;
939 }
#define TRUE
Definition: types.h:120
struct process * process_find_by_handle(HANDLE hProcess)
Definition: dbghelp.c:80
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
static struct symt * symt_find_type_by_name(const struct module *module, enum SymTagEnum sym_tag, const char *typename)
Definition: type.c:161
DWORD symt_ptr2index(struct module *module, const struct symt *sym) DECLSPEC_HIDDEN
Definition: symbol.c:70
BOOL module_get_debug(struct module_pair *) DECLSPEC_HIDDEN
Definition: module.c:340
struct module * module_find_by_addr(const struct process *pcs, DWORD64 addr, enum module_type type) DECLSPEC_HIDDEN
Definition: module.c:399
Definition: Symbol.h:8
Definition: _pair.h:47

◆ SymGetTypeInfo()

BOOL WINAPI SymGetTypeInfo ( HANDLE  hProcess,
DWORD64  ModBase,
ULONG  TypeId,
IMAGEHLP_SYMBOL_TYPE_INFO  GetType,
PVOID  pInfo 
)

Definition at line 901 of file type.c.

904 {
905  struct module_pair pair;
906 
908  if (!pair.pcs) return FALSE;
909 
910  pair.requested = module_find_by_addr(pair.pcs, ModBase, DMT_UNKNOWN);
911  if (!module_get_debug(&pair))
912  {
913  FIXME("Someone didn't properly set ModBase (%s)\n", wine_dbgstr_longlong(ModBase));
914  return FALSE;
915  }
916 
917  return symt_get_info(pair.effective, symt_index2ptr(pair.effective, TypeId), GetType, pInfo);
918 }
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
BOOL module_get_debug(struct module_pair *) DECLSPEC_HIDDEN
Definition: module.c:340
INT GetType(BOOL bLocal, LPOSVERSIONINFOEX osvi, LPSERVER_INFO_102 pBuf102)
Definition: gettype.c:129
struct module * module_find_by_addr(const struct process *pcs, DWORD64 addr, enum module_type type) DECLSPEC_HIDDEN
Definition: module.c:399
struct symt * symt_index2ptr(struct module *module, DWORD id) DECLSPEC_HIDDEN
Definition: symbol.c:112
Definition: _pair.h:47
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:41
BOOL symt_get_info(struct module *module, const struct symt *type, IMAGEHLP_SYMBOL_TYPE_INFO req, void *pInfo)
Definition: type.c:537

Referenced by DumpArray(), DumpBaseType(), DumpCV(), DumpEnum(), DumpFunction(), DumpPointer(), DumpType(), DumpUDT(), EnumParametersCallback(), and ParseImageSymbols().

◆ symt_add_enum_element()

BOOL symt_add_enum_element ( struct module module,
struct symt_enum enum_type,
const char name,
int  value 
)

Definition at line 320 of file type.c.

322 {
323  struct symt_data* e;
324  struct symt** p;
325 
326  assert(enum_type->symt.tag == SymTagEnum);
327  e = pool_alloc(&module->pool, sizeof(*e));
328  if (e == NULL) return FALSE;
329 
330  e->symt.tag = SymTagData;
331  e->hash_elt.name = pool_strdup(&module->pool, name);
332  e->hash_elt.next = NULL;
333  e->kind = DataIsConstant;
334  e->container = &enum_type->symt;
335  e->type = enum_type->base_type;
336  e->u.value.n1.n2.vt = VT_I4;
337  e->u.value.n1.n2.n3.lVal = value;
338 
339  p = vector_add(&enum_type->vchildren, &module->pool);
340  if (!p) return FALSE; /* FIXME we leak e */
341  *p = &e->symt;
342 
343  return TRUE;
344 }
char * name
Definition: wpp.c:36
#define TRUE
Definition: types.h:120
Definition: compat.h:1939
#define assert(x)
Definition: debug.h:53
char * value
Definition: wpp.c:37
void * pool_alloc(struct pool *a, size_t len) DECLSPEC_HIDDEN
Definition: storage.c:90
SymTagEnum
Definition: compat.h:1220
#define e
Definition: ke_i.h:82
smooth NULL
Definition: ftsmooth.c:416
struct symt symt
struct pool pool
GLsizei const GLfloat * value
Definition: glext.h:6069
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 define * next
Definition: wpp.c:35
Definition: name.c:36
struct symt * base_type
GLfloat GLfloat p
Definition: glext.h:8902
struct vector vchildren

Referenced by codeview_add_type_enum_field_list(), dwarf2_parse_enumerator(), and stabs_pts_read_enum().

◆ symt_add_function_signature_parameter()

BOOL symt_add_function_signature_parameter ( struct module module,
struct symt_function_signature sig_type,
struct symt param 
)

Definition at line 395 of file type.c.

398 {
399  struct symt** p;
400  struct symt_function_arg_type* arg;
401 
402  assert(sig_type->symt.tag == SymTagFunctionType);
403  arg = pool_alloc(&module->pool, sizeof(*arg));
404  if (!arg) return FALSE;
405  arg->symt.tag = SymTagFunctionArgType;
406  arg->arg_type = param;
407  arg->container = &sig_type->symt;
408  p = vector_add(&sig_type->vchildren, &module->pool);
409  if (!p) return FALSE; /* FIXME we leak arg */
410  *p = &arg->symt;
411 
412  return TRUE;
413 }
#define TRUE
Definition: types.h:120
#define assert(x)
Definition: debug.h:53
void * arg
Definition: msvc.h:12
void * pool_alloc(struct pool *a, size_t len) DECLSPEC_HIDDEN
Definition: storage.c:90
GLfloat param
Definition: glext.h:5796
struct pool pool
void * vector_add(struct vector *v, struct pool *pool) DECLSPEC_HIDDEN
Definition: storage.c:172
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by codeview_add_func_signature_args(), dwarf2_parse_subroutine_type(), dwarf2_parse_variable(), and stabs_parse().

◆ symt_add_type()

static void symt_add_type ( struct module module,
struct symt symt 
)
static

Definition at line 185 of file type.c.

186 {
187  struct symt** p;
189  assert(p);
190  *p = symt;
191 }
#define assert(x)
Definition: debug.h:53
struct vector vtypes
struct pool pool
void * vector_add(struct vector *v, struct pool *pool) DECLSPEC_HIDDEN
Definition: storage.c:172
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by symt_new_array(), symt_new_basic(), symt_new_function_signature(), symt_new_pointer(), symt_new_typedef(), and symt_new_udt().

◆ symt_add_udt_element()

BOOL symt_add_udt_element ( struct module module,
struct symt_udt udt_type,
const char name,
struct symt elt_type,
unsigned  offset,
unsigned  size 
)

Definition at line 265 of file type.c.

268 {
269  struct symt_data* m;
270  struct symt** p;
271 
272  assert(udt_type->symt.tag == SymTagUDT);
273 
274  TRACE_(dbghelp_symt)("Adding %s to UDT %s\n", name, udt_type->hash_elt.name);
275  if (name)
276  {
277  unsigned int i;
278  for (i=0; i<vector_length(&udt_type->vchildren); i++)
279  {
280  m = *(struct symt_data**)vector_at(&udt_type->vchildren, i);
281  assert(m);
282  assert(m->symt.tag == SymTagData);
283  if (strcmp(m->hash_elt.name, name) == 0)
284  return TRUE;
285  }
286  }
287 
288  if ((m = pool_alloc(&module->pool, sizeof(*m))) == NULL) return FALSE;
289  memset(m, 0, sizeof(*m));
290  m->symt.tag = SymTagData;
291  m->hash_elt.name = name ? pool_strdup(&module->pool, name) : "";
292  m->hash_elt.next = NULL;
293 
294  m->kind = DataIsMember;
295  m->container = &udt_type->symt;
296  m->type = elt_type;
297  m->u.member.offset = offset;
298  m->u.member.length = ((offset & 7) || (size & 7)) ? size : 0;
299  p = vector_add(&udt_type->vchildren, &module->pool);
300  *p = &m->symt;
301 
302  return TRUE;
303 }
#define TRUE
Definition: types.h:120
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
struct symt symt
const GLfloat * m
Definition: glext.h:10848
void * pool_alloc(struct pool *a, size_t len) DECLSPEC_HIDDEN
Definition: storage.c:90
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
smooth NULL
Definition: ftsmooth.c:416
#define TRACE_(x)
Definition: compat.h:66
GLsizeiptr size
Definition: glext.h:5919
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
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
GLfloat GLfloat p
Definition: glext.h:8902
#define memset(x, y, z)
Definition: compat.h:39
unsigned vector_length(const struct vector *v) DECLSPEC_HIDDEN
Definition: storage.c:158
struct vector vchildren
struct hash_table_elt hash_elt
GLuint const GLchar * name
Definition: glext.h:6031

Referenced by codeview_add_udt_element(), dwarf2_parse_udt_member(), and stabs_pts_read_aggregate().

◆ symt_array_count()

static DWORD symt_array_count ( struct module module,
const struct symt_array array 
)
inlinestatic

Definition at line 363 of file type.c.

364 {
365  if (array->end < 0)
366  {
367  DWORD64 elem_size;
368  /* One could want to also set the array->end field in array, but we won't do it
369  * as long as all the get_type() helpers use const objects
370  */
371  if (symt_get_info(module, array->base_type, TI_GET_LENGTH, &elem_size) && elem_size)
372  return -array->end / (DWORD)elem_size;
373  return 0;
374  }
375  return array->end - array->start + 1;
376 }
#define DWORD
Definition: nt_native.h:44
unsigned start
Definition: undname.c:56
uint64_t DWORD64
Definition: typedefs.h:65
BOOL symt_get_info(struct module *module, const struct symt *type, IMAGEHLP_SYMBOL_TYPE_INFO req, void *pInfo)
Definition: type.c:537

Referenced by symt_get_info().

◆ symt_find_type_by_name()

static struct symt* symt_find_type_by_name ( const struct module module,
enum SymTagEnum  sym_tag,
const char typename 
)
static

Definition at line 161 of file type.c.

164 {
165  void* ptr;
166  struct symt_ht* type;
167  struct hash_table_iter hti;
168 
169  assert(typename);
170  assert(module);
171 
172  hash_table_iter_init(&module->ht_types, &hti, typename);
173  while ((ptr = hash_table_iter_up(&hti)))
174  {
175  type = CONTAINING_RECORD(ptr, struct symt_ht, hash_elt);
176 
177  if ((sym_tag == SymTagNull || type->symt.tag == sym_tag) &&
178  type->hash_elt.name && !strcmp(type->hash_elt.name, typename))
179  return &type->symt;
180  }
181  SetLastError(ERROR_INVALID_NAME); /* FIXME ?? */
182  return NULL;
183 }
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define assert(x)
Definition: debug.h:53
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
#define SetLastError(x)
Definition: compat.h:409
void * hash_table_iter_up(struct hash_table_iter *hti) DECLSPEC_HIDDEN
Definition: storage.c:423
struct hash_table ht_types
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define ERROR_INVALID_NAME
Definition: compat.h:93

Referenced by SymGetTypeFromName(), and symt_new_basic().

◆ symt_get_address()

BOOL symt_get_address ( const struct symt type,
ULONG64 addr 
)

Definition at line 120 of file type.c.

121 {
122  switch (type->tag)
123  {
124  case SymTagData:
125  switch (((const struct symt_data*)type)->kind)
126  {
127  case DataIsGlobal:
128  case DataIsFileStatic:
129  *addr = ((const struct symt_data*)type)->u.var.offset;
130  break;
131  default: return FALSE;
132  }
133  break;
134  case SymTagFunction:
135  *addr = ((const struct symt_function*)type)->address;
136  break;
137  case SymTagPublicSymbol:
138  *addr = ((const struct symt_public*)type)->address;
139  break;
141  case SymTagFuncDebugEnd:
142  case SymTagLabel:
143  if (!((const struct symt_hierarchy_point*)type)->parent ||
145  return FALSE;
146  *addr += ((const struct symt_hierarchy_point*)type)->loc.offset;
147  break;
148  case SymTagThunk:
149  *addr = ((const struct symt_thunk*)type)->address;
150  break;
151  case SymTagCompiland:
152  *addr = ((const struct symt_compiland*)type)->address;
153  break;
154  default:
155  FIXME("Unsupported sym-tag %s for get-address\n", symt_get_tag_str(type->tag));
156  return FALSE;
157  }
158  return TRUE;
159 }
#define TRUE
Definition: types.h:120
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static const char * symt_get_tag_str(DWORD tag)
Definition: type.c:43
#define FIXME(fmt,...)
Definition: debug.h:110
r parent
Definition: btrfs.c:2897
GLenum const GLvoid * addr
Definition: glext.h:9621
BOOL symt_get_address(const struct symt *type, ULONG64 *addr)
Definition: type.c:120

Referenced by cmp_sorttab_addr(), coff_process_info(), symt_add_module_ht(), symt_cmp_addr(), symt_fill_sym_info(), symt_find_nearest(), symt_get_best_at(), symt_get_info(), and where_to_insert().

◆ symt_get_info()

BOOL symt_get_info ( struct module module,
const struct symt type,
IMAGEHLP_SYMBOL_TYPE_INFO  req,
void pInfo 
)

Definition at line 537 of file type.c.

539 {
540  unsigned len;
541 
542  if (!type) return FALSE;
543 
544 /* helper to typecast pInfo to its expected type (_t) */
545 #define X(_t) (*((_t*)pInfo))
546 
547  switch (req)
548  {
549  case TI_FINDCHILDREN:
550  {
551  const struct vector* v;
552  struct symt** pt;
553  unsigned i;
554  TI_FINDCHILDREN_PARAMS* tifp = pInfo;
555 
556  switch (type->tag)
557  {
558  case SymTagUDT: v = &((const struct symt_udt*)type)->vchildren; break;
559  case SymTagEnum: v = &((const struct symt_enum*)type)->vchildren; break;
560  case SymTagFunctionType: v = &((const struct symt_function_signature*)type)->vchildren; break;
561  case SymTagFunction: v = &((const struct symt_function*)type)->vchildren; break;
562  default:
563  FIXME("Unsupported sym-tag %s for find-children\n",
564  symt_get_tag_str(type->tag));
565  return FALSE;
566  }
567  for (i = 0; i < tifp->Count; i++)
568  {
569  if (!(pt = vector_at(v, tifp->Start + i))) return FALSE;
570  tifp->ChildId[i] = symt_ptr2index(module, *pt);
571  }
572  }
573  break;
574 
575  case TI_GET_ADDRESS:
576  return symt_get_address(type, (ULONG64*)pInfo);
577 
578  case TI_GET_BASETYPE:
579  switch (type->tag)
580  {
581  case SymTagBaseType:
582  X(DWORD) = ((const struct symt_basic*)type)->bt;
583  break;
584  case SymTagEnum:
585  X(DWORD) = btInt;
586  break;
587  default:
588  return FALSE;
589  }
590  break;
591 
592  case TI_GET_BITPOSITION:
593  if (type->tag == SymTagData &&
594  ((const struct symt_data*)type)->kind == DataIsMember &&
595  ((const struct symt_data*)type)->u.member.length != 0)
596  X(DWORD) = ((const struct symt_data*)type)->u.member.offset & 7;
597  else return FALSE;
598  break;
599 
601  switch (type->tag)
602  {
603  case SymTagUDT:
604  X(DWORD) = vector_length(&((const struct symt_udt*)type)->vchildren);
605  break;
606  case SymTagEnum:
607  X(DWORD) = vector_length(&((const struct symt_enum*)type)->vchildren);
608  break;
609  case SymTagFunctionType:
610  X(DWORD) = vector_length(&((const struct symt_function_signature*)type)->vchildren);
611  break;
612  case SymTagFunction:
613  X(DWORD) = vector_length(&((const struct symt_function*)type)->vchildren);
614  break;
615  case SymTagPointerType: /* MS does it that way */
616  case SymTagArrayType: /* MS does it that way */
617  case SymTagThunk: /* MS does it that way */
618  X(DWORD) = 0;
619  break;
620  default:
621  FIXME("Unsupported sym-tag %s for get-children-count\n",
622  symt_get_tag_str(type->tag));
623  /* fall through */
624  case SymTagData:
625  case SymTagPublicSymbol:
626  case SymTagBaseType:
627  return FALSE;
628  }
629  break;
630 
631  case TI_GET_COUNT:
632  switch (type->tag)
633  {
634  case SymTagArrayType:
635  X(DWORD) = symt_array_count(module, (const struct symt_array*)type);
636  break;
637  case SymTagFunctionType:
638  /* this seems to be wrong for (future) C++ methods, where 'this' parameter
639  * should be included in this value (and not in GET_CHILDREN_COUNT)
640  */
641  X(DWORD) = vector_length(&((const struct symt_function_signature*)type)->vchildren);
642  break;
643  default: return FALSE;
644  }
645  break;
646 
647  case TI_GET_DATAKIND:
648  if (type->tag != SymTagData) return FALSE;
649  X(DWORD) = ((const struct symt_data*)type)->kind;
650  break;
651 
652  case TI_GET_LENGTH:
653  switch (type->tag)
654  {
655  case SymTagBaseType:
656  X(DWORD64) = ((const struct symt_basic*)type)->size;
657  break;
658  case SymTagFunction:
659  X(DWORD64) = ((const struct symt_function*)type)->size;
660  break;
661  case SymTagPointerType:
662  X(DWORD64) = ((const struct symt_pointer*)type)->size;
663  break;
664  case SymTagUDT:
665  X(DWORD64) = ((const struct symt_udt*)type)->size;
666  break;
667  case SymTagEnum:
668  X(DWORD64) = sizeof(int); /* FIXME: should be size of base-type of enum !!! */
669  break;
670  case SymTagData:
671  if (((const struct symt_data*)type)->kind != DataIsMember ||
672  !((const struct symt_data*)type)->u.member.length)
673  return FALSE;
674  X(DWORD64) = ((const struct symt_data*)type)->u.member.length;
675  break;
676  case SymTagArrayType:
677  if (!symt_get_info(module, ((const struct symt_array*)type)->base_type,
678  TI_GET_LENGTH, pInfo))
679  return FALSE;
680  X(DWORD64) *= symt_array_count(module, (const struct symt_array*)type);
681  break;
682  case SymTagPublicSymbol:
683  X(DWORD64) = ((const struct symt_public*)type)->size;
684  break;
685  case SymTagTypedef:
686  return symt_get_info(module, ((const struct symt_typedef*)type)->type, TI_GET_LENGTH, pInfo);
687  case SymTagThunk:
688  X(DWORD64) = ((const struct symt_thunk*)type)->size;
689  break;
690  case SymTagLabel:
691  X(DWORD64) = 0;
692  break;
693  default:
694  FIXME("Unsupported sym-tag %s for get-length\n",
695  symt_get_tag_str(type->tag));
696  /* fall through */
697  case SymTagFunctionType:
698  return FALSE;
699  }
700  break;
701 
703  switch (type->tag)
704  {
705  case SymTagBlock:
706  X(DWORD) = symt_ptr2index(module, ((const struct symt_block*)type)->container);
707  break;
708  case SymTagData:
709  X(DWORD) = symt_ptr2index(module, ((const struct symt_data*)type)->container);
710  break;
711  case SymTagFunction:
712  X(DWORD) = symt_ptr2index(module, ((const struct symt_function*)type)->container);
713  break;
714  case SymTagThunk:
715  X(DWORD) = symt_ptr2index(module, ((const struct symt_thunk*)type)->container);
716  break;
719  break;
720  default:
721  FIXME("Unsupported sym-tag %s for get-lexical-parent\n",
722  symt_get_tag_str(type->tag));
723  return FALSE;
724  }
725  break;
726 
727  case TI_GET_NESTED:
728  switch (type->tag)
729  {
730  case SymTagUDT:
731  case SymTagEnum:
732  X(DWORD) = 0;
733  break;
734  default:
735  return FALSE;
736  }
737  break;
738 
739  case TI_GET_OFFSET:
740  switch (type->tag)
741  {
742  case SymTagData:
743  switch (((const struct symt_data*)type)->kind)
744  {
745  case DataIsParam:
746  case DataIsLocal:
747  X(ULONG) = ((const struct symt_data*)type)->u.var.offset;
748  break;
749  case DataIsMember:
750  X(ULONG) = ((const struct symt_data*)type)->u.member.offset >> 3;
751  break;
752  default:
753  FIXME("Unknown kind (%u) for get-offset\n",
754  ((const struct symt_data*)type)->kind);
755  return FALSE;
756  }
757  break;
758  default:
759  FIXME("Unsupported sym-tag %s for get-offset\n",
760  symt_get_tag_str(type->tag));
761  return FALSE;
762  }
763  break;
764 
765  case TI_GET_SYMNAME:
766  {
767  const char* name = symt_get_name(type);
768  if (!name) return FALSE;
769  len = MultiByteToWideChar(CP_ACP, 0, name, -1, NULL, 0);
770  X(WCHAR*) = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
771  if (!X(WCHAR*)) return FALSE;
772  MultiByteToWideChar(CP_ACP, 0, name, -1, X(WCHAR*), len);
773  }
774  break;
775 
776  case TI_GET_SYMTAG:
777  X(DWORD) = type->tag;
778  break;
779 
780  case TI_GET_TYPE:
781  case TI_GET_TYPEID:
782  switch (type->tag)
783  {
784  /* hierarchical => hierarchical */
785  case SymTagArrayType:
786  X(DWORD) = symt_ptr2index(module, ((const struct symt_array*)type)->base_type);
787  break;
788  case SymTagPointerType:
789  X(DWORD) = symt_ptr2index(module, ((const struct symt_pointer*)type)->pointsto);
790  break;
791  case SymTagFunctionType:
792  X(DWORD) = symt_ptr2index(module, ((const struct symt_function_signature*)type)->rettype);
793  break;
794  case SymTagTypedef:
795  X(DWORD) = symt_ptr2index(module, ((const struct symt_typedef*)type)->type);
796  break;
797  /* lexical => hierarchical */
798  case SymTagData:
799  X(DWORD) = symt_ptr2index(module, ((const struct symt_data*)type)->type);
800  break;
801  case SymTagFunction:
802  X(DWORD) = symt_ptr2index(module, ((const struct symt_function*)type)->type);
803  break;
804  case SymTagEnum:
805  X(DWORD) = symt_ptr2index(module, ((const struct symt_enum*)type)->base_type);
806  break;
808  X(DWORD) = symt_ptr2index(module, ((const struct symt_function_arg_type*)type)->arg_type);
809  break;
810  default:
811  FIXME("Unsupported sym-tag %s for get-type\n",
812  symt_get_tag_str(type->tag));
813  /* fall through */
814  case SymTagPublicSymbol:
815  case SymTagThunk:
816  case SymTagLabel:
817  return FALSE;
818  }
819  break;
820 
821  case TI_GET_UDTKIND:
822  if (type->tag != SymTagUDT) return FALSE;
823  X(DWORD) = ((const struct symt_udt*)type)->kind;
824  break;
825 
826  case TI_GET_VALUE:
827  if (type->tag != SymTagData) return FALSE;
828  switch (((const struct symt_data*)type)->kind)
829  {
830  case DataIsConstant: X(VARIANT) = ((const struct symt_data*)type)->u.value; break;
831  case DataIsLocal:
832  case DataIsParam:
833  {
834  struct location loc = ((const struct symt_data*)type)->u.var;
835  unsigned i;
836  struct module_format* modfmt;
837 
838  if (loc.kind < loc_user) return FALSE;
839  for (i = 0; i < DFI_LAST; i++)
840  {
841  modfmt = module->format_info[i];
842  if (modfmt && modfmt->loc_compute)
843  {
844  modfmt->loc_compute(module->process, modfmt,
845  (const struct symt_function*)((const struct symt_data*)type)->container, &loc);
846  break;
847  }
848  }
849  if (loc.kind != loc_absolute) return FALSE;
850  X(VARIANT).n1.n2.vt = VT_UI4; /* FIXME */
851  X(VARIANT).n1.n2.n3.uiVal = loc.offset;
852  }
853  break;
854  default: return FALSE;
855  }
856  break;
857 
859  if (type->tag != SymTagFunctionType) return FALSE;
860  if (((const struct symt_function_signature*)type)->call_conv == -1)
861  {
862  FIXME("No support for calling convention for this signature\n");
863  X(DWORD) = CV_CALL_FAR_C; /* FIXME */
864  }
865  else X(DWORD) = ((const struct symt_function_signature*)type)->call_conv;
866  break;
868  if (type->tag != SymTagArrayType) return FALSE;
869  X(DWORD) = symt_ptr2index(module, ((const struct symt_array*)type)->index_type);
870  break;
871 
873  /* FIXME: we don't support properly C++ for now, pretend this symbol doesn't
874  * belong to a parent class
875  */
876  return FALSE;
877 
878 #undef X
879 
881  case TI_GET_SYMINDEX:
882  case TI_GET_THISADJUST:
886  case TI_IS_EQUIV_TO:
887  FIXME("Unsupported GetInfo request (%u)\n", req);
888  return FALSE;
889  default:
890  FIXME("Unknown GetInfo request (%u)\n", req);
891  return FALSE;
892  }
893 
894  return TRUE;
895 }
#define TRUE
Definition: types.h:120
#define pt(x, y)
Definition: drawing.c:79
void * vector_at(const struct vector *v, unsigned pos) DECLSPEC_HIDDEN
Definition: storage.c:163
#define CP_ACP
Definition: compat.h:99
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static const char * symt_get_tag_str(DWORD tag)
Definition: type.c:43
enum DataKind kind
char * value
Definition: wpp.c:37
enum UdtKind kind
static DWORD symt_array_count(struct module *module, const struct symt_array *array)
Definition: type.c:363
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
SymTagEnum
Definition: compat.h:1220
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
DWORD symt_ptr2index(struct module *module, const struct symt *sym) DECLSPEC_HIDDEN
Definition: symbol.c:70
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
void(* loc_compute)(struct process *pcs, const struct module_format *modfmt, const struct symt_function *func, struct location *loc)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned __int64 ULONG64
Definition: imports.h:198
GLenum GLsizei len
Definition: glext.h:6722
unsigned kind
const char * symt_get_name(const struct symt *sym)
Definition: type.c:82
#define CV_CALL_FAR_C
Definition: symdump.c:30
uint64_t DWORD64
Definition: typedefs.h:65
const GLdouble * v
Definition: gl.h:2040
struct process * process
#define MultiByteToWideChar
Definition: compat.h:100
Definition: compat.h:1262
Definition: name.c:36
unsigned long offset
unsigned int ULONG
Definition: retypes.h:1
BOOL symt_get_info(struct module *module, const struct symt *type, IMAGEHLP_SYMBOL_TYPE_INFO req, void *pInfo)
Definition: type.c:537
BOOL symt_get_address(const struct symt *type, ULONG64 *addr)
Definition: type.c:120
struct module_format * format_info[DFI_LAST]
#define X(_t)
unsigned vector_length(const struct vector *v) DECLSPEC_HIDDEN
Definition: storage.c:158
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

Referenced by codeview_add_udt_element(), dwarf2_parse_udt_member(), stabs_pts_read_aggregate(), SymEnumTypes(), SymGetTypeInfo(), symt_array_count(), symt_fill_sym_info(), symt_get_length(), and symt_new_global_variable().

◆ symt_get_name()

const char* symt_get_name ( const struct symt sym)

Definition at line 82 of file type.c.

83 {
84  switch (sym->tag)
85  {
86  /* lexical tree */
87  case SymTagData: return ((const struct symt_data*)sym)->hash_elt.name;
88  case SymTagFunction: return ((const struct symt_function*)sym)->hash_elt.name;
89  case SymTagPublicSymbol: return ((const struct symt_public*)sym)->hash_elt.name;
90  case SymTagBaseType: return ((const struct symt_basic*)sym)->hash_elt.name;
91  case SymTagLabel: return ((const struct symt_hierarchy_point*)sym)->hash_elt.name;
92  case SymTagThunk: return ((const struct symt_thunk*)sym)->hash_elt.name;
93  /* hierarchy tree */
94  case SymTagEnum: return ((const struct symt_enum*)sym)->name;
95  case SymTagTypedef: return ((const struct symt_typedef*)sym)->hash_elt.name;
96  case SymTagUDT: return ((const struct symt_udt*)sym)->hash_elt.name;
97  default:
98  FIXME("Unsupported sym-tag %s\n", symt_get_tag_str(sym->tag));
99  /* fall through */
100  case SymTagArrayType:
101  case SymTagPointerType:
102  case SymTagFunctionType:
103  return NULL;
104  }
105 }
static const char * symt_get_tag_str(DWORD tag)
Definition: type.c:43
SymTagEnum
Definition: compat.h:1220
enum SymTagEnum tag
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416

Referenced by stabs_pts_read_aggregate(), stabs_pts_read_type_def(), SymEnumTypes(), symt_fill_sym_info(), symt_get_info(), and symt_get_nameW().

◆ symt_get_nameW()

WCHAR* symt_get_nameW ( const struct symt sym)

Definition at line 107 of file type.c.

108 {
109  const char* name = symt_get_name(sym);
110  WCHAR* nameW;
111  DWORD sz;
112 
113  if (!name) return NULL;
114  sz = MultiByteToWideChar(CP_ACP, 0, name, -1, NULL, 0);
115  if ((nameW = HeapAlloc(GetProcessHeap(), 0, sz * sizeof(WCHAR))))
116  MultiByteToWideChar(CP_ACP, 0, name, -1, nameW, sz);
117  return nameW;
118 }
#define CP_ACP
Definition: compat.h:99
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR nameW[]
Definition: main.c:46
#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
const char * symt_get_name(const struct symt *sym)
Definition: type.c:82
#define MultiByteToWideChar
Definition: compat.h:100
Definition: name.c:36

Referenced by symt_enum_locals_helper(), and symt_enum_module().

◆ symt_get_tag_str()

static const char* symt_get_tag_str ( DWORD  tag)
static

Definition at line 43 of file type.c.

44 {
45  switch (tag)
46  {
47  case SymTagNull: return "SymTagNull";
48  case SymTagExe: return "SymTagExe";
49  case SymTagCompiland: return "SymTagCompiland";
50  case SymTagCompilandDetails: return "SymTagCompilandDetails";
51  case SymTagCompilandEnv: return "SymTagCompilandEnv";
52  case SymTagFunction: return "SymTagFunction";
53  case SymTagBlock: return "SymTagBlock";
54  case SymTagData: return "SymTagData";
55  case SymTagAnnotation: return "SymTagAnnotation";
56  case SymTagLabel: return "SymTagLabel";
57  case SymTagPublicSymbol: return "SymTagPublicSymbol";
58  case SymTagUDT: return "SymTagUDT";
59  case SymTagEnum: return "SymTagEnum";
60  case SymTagFunctionType: return "SymTagFunctionType";
61  case SymTagPointerType: return "SymTagPointerType";
62  case SymTagArrayType: return "SymTagArrayType";
63  case SymTagBaseType: return "SymTagBaseType";
64  case SymTagTypedef: return "SymTagTypedef,";
65  case SymTagBaseClass: return "SymTagBaseClass";
66  case SymTagFriend: return "SymTagFriend";
67  case SymTagFunctionArgType: return "SymTagFunctionArgType,";
68  case SymTagFuncDebugStart: return "SymTagFuncDebugStart,";
69  case SymTagFuncDebugEnd: return "SymTagFuncDebugEnd";
70  case SymTagUsingNamespace: return "SymTagUsingNamespace,";
71  case SymTagVTableShape: return "SymTagVTableShape";
72  case SymTagVTable: return "SymTagVTable";
73  case SymTagCustom: return "SymTagCustom";
74  case SymTagThunk: return "SymTagThunk";
75  case SymTagCustomType: return "SymTagCustomType";
76  case SymTagManagedType: return "SymTagManagedType";
77  case SymTagDimension: return "SymTagDimension";
78  default: return "---";
79  }
80 }
Definition: ecma_167.h:138
SymTagEnum
Definition: compat.h:1220

Referenced by symt_get_address(), symt_get_info(), and symt_get_name().

◆ symt_new_array()

struct symt_array* symt_new_array ( struct module module,
int  min,
int  max,
struct symt base,
struct symt index 
)

Definition at line 346 of file type.c.

348 {
349  struct symt_array* sym;
350 
351  if ((sym = pool_alloc(&module->pool, sizeof(*sym))))
352  {
353  sym->symt.tag = SymTagArrayType;
354  sym->start = min;
355  sym->end = max;
356  sym->base_type = base;
357  sym->index_type = index;
358  symt_add_type(module, &sym->symt);
359  }
360  return sym;
361 }
struct symt symt
#define max(a, b)
Definition: svc.c:63
void * pool_alloc(struct pool *a, size_t len) DECLSPEC_HIDDEN
Definition: storage.c:90
GLuint base
Definition: 3dtext.c:35
static void symt_add_type(struct module *module, struct symt *symt)
Definition: type.c:185
struct symt * index_type
struct symt * base_type
#define index(s, c)
Definition: various.h:29
struct pool pool
#define min(a, b)
Definition: monoChain.cc:55

Referenced by codeview_add_type_array(), dwarf2_parse_array_type(), and stabs_pts_read_array().

◆ symt_new_basic()

struct symt_basic* symt_new_basic ( struct module module,
enum BasicType  bt,
const char typename,
unsigned  size 
)

Definition at line 193 of file type.c.

195 {
196  struct symt_basic* sym;
197 
198  if (typename)
199  {
201  typename);
202  if (sym && sym->bt == bt && sym->size == size)
203  return sym;
204  }
205  if ((sym = pool_alloc(&module->pool, sizeof(*sym))))
206  {
207  sym->symt.tag = SymTagBaseType;
208  if (typename)
209  {
210  sym->hash_elt.name = pool_strdup(&module->pool, typename);
212  } else sym->hash_elt.name = NULL;
213  sym->bt = bt;
214  sym->size = size;
215  symt_add_type(module, &sym->symt);
216  }
217  return sym;
218 }
unsigned long size
struct hash_table_elt hash_elt
void * pool_alloc(struct pool *a, size_t len) DECLSPEC_HIDDEN
Definition: storage.c:90
smooth NULL
Definition: ftsmooth.c:416
static void symt_add_type(struct module *module, struct symt *symt)
Definition: type.c:185
static struct symt * symt_find_type_by_name(const struct module *module, enum SymTagEnum sym_tag, const char *typename)
Definition: type.c:161
GLsizeiptr size
Definition: glext.h:5919
void hash_table_add(struct hash_table *ht, struct hash_table_elt *elt) DECLSPEC_HIDDEN
Definition: storage.c:379
struct symt symt
struct pool pool
char * pool_strdup(struct pool *a, const char *str) DECLSPEC_HIDDEN
Definition: storage.c:127
struct hash_table ht_types
enum BasicType bt

Referenced by codeview_init_basic_types(), dwarf2_parse_base_type(), dwarf2_parse_compilation_unit(), dwarf2_parse_enumeration_type(), dwarf2_parse_unspecified_type(), stabs_get_basic(), stabs_pts_read_range(), and stabs_pts_read_type_def().

◆ symt_new_enum()

struct symt_enum* symt_new_enum ( struct module module,
const char typename,
struct symt basetype 
)

Definition at line 305 of file type.c.

307 {
308  struct symt_enum* sym;
309 
310  if ((sym = pool_alloc(&module->pool, sizeof(*sym))))
311  {
312  sym->symt.tag = SymTagEnum;
313  sym->name = (typename) ? pool_strdup(&module->pool, typename) : NULL;
314  sym->base_type = basetype;
315  vector_init(&sym->vchildren, sizeof(struct symt*), 8);
316  }
317  return sym;
318 }
void * pool_alloc(struct pool *a, size_t len) DECLSPEC_HIDDEN
Definition: storage.c:90
SymTagEnum
Definition: compat.h:1220
smooth NULL
Definition: ftsmooth.c:416
void vector_init(struct vector *v, unsigned elt_sz, unsigned bucket_sz) DECLSPEC_HIDDEN
Definition: storage.c:134
struct symt symt
struct pool pool
char * pool_strdup(struct pool *a, const char *str) DECLSPEC_HIDDEN
Definition: storage.c:127
struct symt * base_type
struct vector vchildren
const char * name

Referenced by codeview_add_type_enum(), dwarf2_parse_enumeration_type(), and stabs_pts_read_type_def().

◆ symt_new_function_signature()

struct symt_function_signature* symt_new_function_signature ( struct module module,
struct symt ret_type,
enum CV_call_e  call_conv 
)

Definition at line 378 of file type.c.

381 {
382  struct symt_function_signature* sym;
383 
384  if ((sym = pool_alloc(&module->pool, sizeof(*sym))))
385  {
386  sym->symt.tag = SymTagFunctionType;
387  sym->rettype = ret_type;
388  vector_init(&sym->vchildren, sizeof(struct symt*), 4);
389  sym->call_conv = call_conv;
390  symt_add_type(module, &sym->symt);
391  }
392  return sym;
393 }
void * pool_alloc(struct pool *a, size_t len) DECLSPEC_HIDDEN
Definition: storage.c:90
static void symt_add_type(struct module *module, struct symt *symt)
Definition: type.c:185
void vector_init(struct vector *v, unsigned elt_sz, unsigned bucket_sz) DECLSPEC_HIDDEN
Definition: storage.c:134
struct pool pool

Referenced by codeview_new_func_signature(), dwarf2_parse_subprogram(), dwarf2_parse_subroutine_type(), stabs_parse(), and stabs_pts_read_type_def().

◆ symt_new_pointer()

struct symt_pointer* symt_new_pointer ( struct module module,
struct symt ref_type,
unsigned long  size 
)

Definition at line 415 of file type.c.

416 {
417  struct symt_pointer* sym;
418 
419  if ((sym = pool_alloc(&module->pool, sizeof(*sym))))
420  {
421  sym->symt.tag = SymTagPointerType;
422  sym->pointsto = ref_type;
423  sym->size = size;
424  symt_add_type(module, &sym->symt);
425  }
426  return sym;
427 }
unsigned long size
void * pool_alloc(struct pool *a, size_t len) DECLSPEC_HIDDEN
Definition: storage.c:90
static void symt_add_type(struct module *module, struct symt *symt)
Definition: type.c:185
GLsizeiptr size
Definition: glext.h:5919
struct symt * pointsto
struct symt symt
struct pool pool

Referenced by codeview_add_type_pointer(), codeview_init_basic_types(), dwarf2_parse_pointer_type(), dwarf2_parse_reference_type(), and stabs_pts_read_type_def().

◆ symt_new_typedef()

struct symt_typedef* symt_new_typedef ( struct module module,
struct symt ref,
const char name 
)

Definition at line 429 of file type.c.

431 {
432  struct symt_typedef* sym;
433 
434  if ((sym = pool_alloc(&module->pool, sizeof(*sym))))
435  {
436  sym->symt.tag = SymTagTypedef;
437  sym->type = ref;
438  sym->hash_elt.name = pool_strdup(&module->pool, name);
440  symt_add_type(module, &sym->symt);
441  }
442  return sym;
443 }
struct hash_table_elt hash_elt
void * pool_alloc(struct pool *a, size_t len) DECLSPEC_HIDDEN
Definition: storage.c:90
struct symt * type
GLenum GLint ref
Definition: glext.h:6028
static void symt_add_type(struct module *module, struct symt *symt)
Definition: type.c:185
struct symt symt
void hash_table_add(struct hash_table *ht, struct hash_table_elt *elt) DECLSPEC_HIDDEN
Definition: storage.c:379
struct pool pool
char * pool_strdup(struct pool *a, const char *str) DECLSPEC_HIDDEN
Definition: storage.c:127
struct hash_table ht_types
Definition: name.c:36

Referenced by codeview_snarf(), and dwarf2_parse_typedef().

◆ symt_new_udt()

struct symt_udt* symt_new_udt ( struct module module,
const char typename,
unsigned  size,
enum UdtKind  kind 
)

Definition at line 220 of file type.c.

222 {
223  struct symt_udt* sym;
224 
225  TRACE_(dbghelp_symt)("Adding udt %s:%s\n",
226  debugstr_w(module->module.ModuleName), typename);
227  if ((sym = pool_alloc(&module->pool, sizeof(*sym))))
228  {
229  sym->symt.tag = SymTagUDT;
230  sym->kind = kind;
231  sym->size = size;
232  if (typename)
233  {
234  sym->hash_elt.name = pool_strdup(&module->pool, typename);
236  } else sym->hash_elt.name = NULL;
237  vector_init(&sym->vchildren, sizeof(struct symt*), 8);
238  symt_add_type(module, &sym->symt);
239  }
240  return sym;
241 }
WCHAR ModuleName[32]
Definition: compat.h:725
struct symt symt
enum UdtKind kind
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
static void symt_add_type(struct module *module, struct symt *symt)
Definition: type.c:185
void vector_init(struct vector *v, unsigned elt_sz, unsigned bucket_sz) DECLSPEC_HIDDEN
Definition: storage.c:134
#define TRACE_(x)
Definition: compat.h:66
GLsizeiptr size
Definition: glext.h:5919
void hash_table_add(struct hash_table *ht, struct hash_table_elt *elt) DECLSPEC_HIDDEN
Definition: storage.c:379
struct pool pool
char * pool_strdup(struct pool *a, const char *str) DECLSPEC_HIDDEN
Definition: storage.c:127
struct hash_table ht_types
IMAGEHLP_MODULEW64 module
struct vector vchildren
struct hash_table_elt hash_elt

Referenced by codeview_add_type_struct(), codeview_parse_one_type(), dwarf2_parse_udt_type(), and stabs_pts_read_type_def().

◆ symt_set_udt_size()

BOOL symt_set_udt_size ( struct module module,
struct symt_udt udt,
unsigned  size 
)

Definition at line 243 of file type.c.

244 {
245  assert(udt->symt.tag == SymTagUDT);
246  if (vector_length(&udt->vchildren) != 0)
247  {
248  if (udt->size != size)
249  FIXME_(dbghelp_symt)("Changing size for %s from %u to %u\n",
250  udt->hash_elt.name, udt->size, size);
251  return TRUE;
252  }
253  udt->size = size;
254  return TRUE;
255 }
#define TRUE
Definition: types.h:120
#define assert(x)
Definition: debug.h:53
struct symt symt
#define FIXME_(x)
Definition: compat.h:67
GLsizeiptr size
Definition: glext.h:5919
unsigned vector_length(const struct vector *v) DECLSPEC_HIDDEN
Definition: storage.c:158
struct vector vchildren
struct hash_table_elt hash_elt

Referenced by codeview_add_type_struct(), and stabs_pts_read_aggregate().

◆ WINE_DECLARE_DEBUG_CHANNEL()

WINE_DECLARE_DEBUG_CHANNEL ( dbghelp_symt  )

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( dbghelp  )