ReactOS 0.4.16-dev-306-g647d351
dbghelp_private.h File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winver.h"
#include "dbghelp.h"
#include "objbase.h"
#include "oaidl.h"
#include "winnls.h"
#include "wine/list.h"
#include "wine/rbtree.h"
#include "cvconst.h"
Include dependency graph for dbghelp_private.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  pool
 
class  vector< _Tp, >
 
struct  sparse_array
 
struct  hash_table_elt
 
struct  hash_table_bucket
 
struct  hash_table
 
struct  hash_table_iter
 
struct  location
 
struct  symt
 
struct  symt_ht
 
struct  symt_block
 
struct  symt_compiland
 
struct  symt_data
 
struct  symt_function
 
struct  symt_hierarchy_point
 
struct  symt_public
 
struct  symt_thunk
 
struct  symt_array
 
struct  symt_basic
 
struct  symt_enum
 
struct  symt_function_signature
 
struct  symt_function_arg_type
 
struct  symt_pointer
 
struct  symt_typedef
 
struct  symt_udt
 
struct  module_format
 
struct  module
 
struct  loader_ops
 
struct  process
 
struct  line_info
 
struct  module_pair
 
struct  pdb_lookup
 
struct  cpu_stack_walk
 
struct  dump_memory
 
struct  dump_memory64
 
struct  dump_module
 
struct  dump_thread
 
struct  dump_context
 
union  ctx
 
struct  cpu
 
struct  _PEB32
 
struct  pdb_cmd_pair
 

Typedefs

typedef BOOL(* enum_modules_cb) (const WCHAR *, ULONG_PTR addr, void *user)
 
typedef struct _PEB32 PEB32
 
typedef void(* stabs_def_cb) (struct module *module, ULONG_PTR load_offset, const char *name, ULONG_PTR offset, BOOL is_public, BOOL is_global, unsigned char other, struct symt_compiland *compiland, void *user)
 

Enumerations

enum  location_kind {
  loc_error , loc_unavailable , loc_absolute , loc_register ,
  loc_regrel , loc_tlsrel , loc_user
}
 
enum  location_error {
  loc_err_internal = -1 , loc_err_too_complex = -2 , loc_err_out_of_scope = -3 , loc_err_cant_read = -4 ,
  loc_err_no_location = -5
}
 
enum  module_type {
  DMT_UNKNOWN , DMT_ELF , DMT_PE , DMT_MACHO ,
  DMT_PDB , DMT_DBG
}
 
enum  format_info {
  DFI_ELF , DFI_PE , DFI_MACHO , DFI_DWARF ,
  DFI_PDB , DFI_LAST
}
 
enum  pdb_kind { PDB_JG , PDB_DS }
 
enum  cpu_addr { cpu_addr_pc , cpu_addr_stack , cpu_addr_frame }
 

Functions

void pool_init (struct pool *a, size_t arena_size) DECLSPEC_HIDDEN
 
void pool_destroy (struct pool *a) DECLSPEC_HIDDEN
 
voidpool_alloc (struct pool *a, size_t len) DECLSPEC_HIDDEN
 
charpool_strdup (struct pool *a, const char *str) DECLSPEC_HIDDEN
 
void vector_init (struct vector *v, unsigned elt_sz, unsigned bucket_sz) DECLSPEC_HIDDEN
 
unsigned vector_length (const struct vector *v) DECLSPEC_HIDDEN
 
voidvector_at (const struct vector *v, unsigned pos) DECLSPEC_HIDDEN
 
voidvector_add (struct vector *v, struct pool *pool) DECLSPEC_HIDDEN
 
void sparse_array_init (struct sparse_array *sa, unsigned elt_sz, unsigned bucket_sz) DECLSPEC_HIDDEN
 
voidsparse_array_find (const struct sparse_array *sa, ULONG_PTR idx) DECLSPEC_HIDDEN
 
voidsparse_array_add (struct sparse_array *sa, ULONG_PTR key, struct pool *pool) DECLSPEC_HIDDEN
 
unsigned sparse_array_length (const struct sparse_array *sa) DECLSPEC_HIDDEN
 
void hash_table_init (struct pool *pool, struct hash_table *ht, unsigned num_buckets) DECLSPEC_HIDDEN
 
void hash_table_destroy (struct hash_table *ht) DECLSPEC_HIDDEN
 
void hash_table_add (struct hash_table *ht, struct hash_table_elt *elt) DECLSPEC_HIDDEN
 
void hash_table_iter_init (const struct hash_table *ht, struct hash_table_iter *hti, const char *name) DECLSPEC_HIDDEN
 
voidhash_table_iter_up (struct hash_table_iter *hti) DECLSPEC_HIDDEN
 
static BOOL read_process_memory (const struct process *process, UINT64 addr, void *buf, size_t size)
 
struct processprocess_find_by_handle (HANDLE hProcess) DECLSPEC_HIDDEN
 
BOOL validate_addr64 (DWORD64 addr) DECLSPEC_HIDDEN
 
BOOL pcs_callback (const struct process *pcs, ULONG action, void *data) DECLSPEC_HIDDEN
 
voidfetch_buffer (struct process *pcs, unsigned size) DECLSPEC_HIDDEN
 
const charwine_dbgstr_addr (const ADDRESS64 *addr) DECLSPEC_HIDDEN
 
struct cpucpu_find (DWORD) DECLSPEC_HIDDEN
 
const WCHARprocess_getenv (const struct process *process, const WCHAR *name)
 
DWORD calc_crc32 (HANDLE handle) DECLSPEC_HIDDEN
 
BOOL elf_read_wine_loader_dbg_info (struct process *pcs, ULONG_PTR addr) DECLSPEC_HIDDEN
 
int elf_is_in_thunk_area (ULONG_PTR addr, const struct elf_thunk_area *thunks) DECLSPEC_HIDDEN
 
BOOL macho_read_wine_loader_dbg_info (struct process *pcs, ULONG_PTR addr) DECLSPEC_HIDDEN
 
void minidump_add_memory_block (struct dump_context *dc, ULONG64 base, ULONG size, ULONG rva) DECLSPEC_HIDDEN
 
struct modulemodule_find_by_addr (const struct process *pcs, DWORD64 addr, enum module_type type) DECLSPEC_HIDDEN
 
struct modulemodule_find_by_nameW (const struct process *pcs, const WCHAR *name) DECLSPEC_HIDDEN
 
struct modulemodule_find_by_nameA (const struct process *pcs, const char *name) DECLSPEC_HIDDEN
 
struct modulemodule_is_already_loaded (const struct process *pcs, const WCHAR *imgname) DECLSPEC_HIDDEN
 
BOOL module_get_debug (struct module_pair *) DECLSPEC_HIDDEN
 
struct modulemodule_new (struct process *pcs, const WCHAR *name, enum module_type type, BOOL virtual, DWORD64 addr, DWORD64 size, ULONG_PTR stamp, ULONG_PTR checksum) DECLSPEC_HIDDEN
 
struct modulemodule_get_containee (const struct process *pcs, const struct module *inner) DECLSPEC_HIDDEN
 
void module_reset_debug_info (struct module *module) DECLSPEC_HIDDEN
 
BOOL module_remove (struct process *pcs, struct module *module) DECLSPEC_HIDDEN
 
void module_set_module (struct module *module, const WCHAR *name) DECLSPEC_HIDDEN
 
WCHARget_wine_loader_name (struct process *pcs) DECLSPEC_HIDDEN
 
BOOL pe_load_debug_directory (const struct process *pcs, struct module *module, const BYTE *mapping, const IMAGE_SECTION_HEADER *sectp, DWORD nsect, const IMAGE_DEBUG_DIRECTORY *dbg, int nDbg) DECLSPEC_HIDDEN
 
BOOL pdb_fetch_file_info (const struct pdb_lookup *pdb_lookup, unsigned *matched) DECLSPEC_HIDDEN
 
BOOL pdb_virtual_unwind (struct cpu_stack_walk *csw, DWORD_PTR ip, union ctx *context, struct pdb_cmd_pair *cpair) DECLSPEC_HIDDEN
 
BOOL path_find_symbol_file (const struct process *pcs, const struct module *module, PCSTR full_path, enum module_type type, const GUID *guid, DWORD dw1, DWORD dw2, WCHAR *buffer, BOOL *is_unmatched) DECLSPEC_HIDDEN
 
WCHARget_dos_file_name (const WCHAR *filename) DECLSPEC_HIDDEN
 
BOOL search_dll_path (const struct process *process, const WCHAR *name, BOOL(*match)(void *, HANDLE, const WCHAR *), void *param) DECLSPEC_HIDDEN
 
BOOL search_unix_path (const WCHAR *name, const WCHAR *path, BOOL(*match)(void *, HANDLE, const WCHAR *), void *param) DECLSPEC_HIDDEN
 
const WCHARfile_name (const WCHAR *str) DECLSPEC_HIDDEN
 
const charfile_nameA (const char *str) DECLSPEC_HIDDEN
 
BOOL pe_load_nt_header (HANDLE hProc, DWORD64 base, IMAGE_NT_HEADERS *nth) DECLSPEC_HIDDEN
 
struct modulepe_load_native_module (struct process *pcs, const WCHAR *name, HANDLE hFile, DWORD64 base, DWORD size) DECLSPEC_HIDDEN
 
struct modulepe_load_builtin_module (struct process *pcs, const WCHAR *name, DWORD64 base, DWORD64 size) DECLSPEC_HIDDEN
 
BOOL pe_load_debug_info (const struct process *pcs, struct module *module) DECLSPEC_HIDDEN
 
const charpe_map_directory (struct module *module, int dirno, DWORD *size) DECLSPEC_HIDDEN
 
unsigned source_new (struct module *module, const char *basedir, const char *source) DECLSPEC_HIDDEN
 
const charsource_get (const struct module *module, unsigned idx) DECLSPEC_HIDDEN
 
int source_rb_compare (const void *key, const struct wine_rb_entry *entry) DECLSPEC_HIDDEN
 
BOOL stabs_parse (struct module *module, ULONG_PTR load_offset, const char *stabs, size_t nstab, size_t stabsize, const char *strs, int strtablen, stabs_def_cb callback, void *user) DECLSPEC_HIDDEN
 
BOOL dwarf2_parse (struct module *module, ULONG_PTR load_offset, const struct elf_thunk_area *thunks, struct image_file_map *fmap) DECLSPEC_HIDDEN
 
BOOL dwarf2_virtual_unwind (struct cpu_stack_walk *csw, DWORD_PTR ip, union ctx *ctx, DWORD64 *cfa) DECLSPEC_HIDDEN
 
BOOL rsym_parse (struct module *module, unsigned long load_offset, const void *rsym, int rsymlen) DECLSPEC_HIDDEN
 
BOOL sw_read_mem (struct cpu_stack_walk *csw, DWORD64 addr, void *ptr, DWORD sz) DECLSPEC_HIDDEN
 
DWORD64 sw_xlat_addr (struct cpu_stack_walk *csw, ADDRESS64 *addr) DECLSPEC_HIDDEN
 
voidsw_table_access (struct cpu_stack_walk *csw, DWORD64 addr) DECLSPEC_HIDDEN
 
DWORD64 sw_module_base (struct cpu_stack_walk *csw, DWORD64 addr) DECLSPEC_HIDDEN
 
const charsymt_get_name (const struct symt *sym) DECLSPEC_HIDDEN
 
WCHARsymt_get_nameW (const struct symt *sym) DECLSPEC_HIDDEN
 
BOOL symt_get_address (const struct symt *type, ULONG64 *addr) DECLSPEC_HIDDEN
 
int __cdecl symt_cmp_addr (const void *p1, const void *p2) DECLSPEC_HIDDEN
 
void copy_symbolW (SYMBOL_INFOW *siw, const SYMBOL_INFO *si) DECLSPEC_HIDDEN
 
struct symt_htsymt_find_nearest (struct module *module, DWORD_PTR addr) DECLSPEC_HIDDEN
 
struct symt_compilandsymt_new_compiland (struct module *module, ULONG_PTR address, unsigned src_idx) DECLSPEC_HIDDEN
 
struct symt_publicsymt_new_public (struct module *module, struct symt_compiland *parent, const char *typename, BOOL is_function, ULONG_PTR address, unsigned size) DECLSPEC_HIDDEN
 
struct symt_datasymt_new_global_variable (struct module *module, struct symt_compiland *parent, const char *name, unsigned is_static, struct location loc, ULONG_PTR size, struct symt *type) DECLSPEC_HIDDEN
 
struct symt_functionsymt_new_function (struct module *module, struct symt_compiland *parent, const char *name, ULONG_PTR addr, ULONG_PTR size, struct symt *type) DECLSPEC_HIDDEN
 
BOOL symt_normalize_function (struct module *module, const struct symt_function *func) DECLSPEC_HIDDEN
 
void symt_add_func_line (struct module *module, struct symt_function *func, unsigned source_idx, int line_num, ULONG_PTR offset) DECLSPEC_HIDDEN
 
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) DECLSPEC_HIDDEN
 
struct symt_blocksymt_open_func_block (struct module *module, struct symt_function *func, struct symt_block *block, unsigned pc, unsigned len) DECLSPEC_HIDDEN
 
struct symt_blocksymt_close_func_block (struct module *module, const struct symt_function *func, struct symt_block *block, unsigned pc) DECLSPEC_HIDDEN
 
struct symt_hierarchy_pointsymt_add_function_point (struct module *module, struct symt_function *func, enum SymTagEnum point, const struct location *loc, const char *name) DECLSPEC_HIDDEN
 
BOOL symt_fill_func_line_info (const struct module *module, const struct symt_function *func, DWORD64 addr, IMAGEHLP_LINE64 *line) DECLSPEC_HIDDEN
 
BOOL symt_get_func_line_next (const struct module *module, PIMAGEHLP_LINE64 line) DECLSPEC_HIDDEN
 
struct symt_thunksymt_new_thunk (struct module *module, struct symt_compiland *parent, const char *name, THUNK_ORDINAL ord, ULONG_PTR addr, ULONG_PTR size) DECLSPEC_HIDDEN
 
struct symt_datasymt_new_constant (struct module *module, struct symt_compiland *parent, const char *name, struct symt *type, const VARIANT *v) DECLSPEC_HIDDEN
 
struct symt_hierarchy_pointsymt_new_label (struct module *module, struct symt_compiland *compiland, const char *name, ULONG_PTR address) DECLSPEC_HIDDEN
 
struct symtsymt_index2ptr (struct module *module, DWORD id) DECLSPEC_HIDDEN
 
DWORD symt_ptr2index (struct module *module, const struct symt *sym) DECLSPEC_HIDDEN
 
void symt_init_basic (struct module *module) DECLSPEC_HIDDEN
 
BOOL symt_get_info (struct module *module, const struct symt *type, IMAGEHLP_SYMBOL_TYPE_INFO req, void *pInfo) DECLSPEC_HIDDEN
 
struct symt_basicsymt_new_basic (struct module *module, enum BasicType, const char *typename, unsigned size) DECLSPEC_HIDDEN
 
struct symt_udtsymt_new_udt (struct module *module, const char *typename, unsigned size, enum UdtKind kind) DECLSPEC_HIDDEN
 
BOOL symt_set_udt_size (struct module *module, struct symt_udt *type, unsigned size) DECLSPEC_HIDDEN
 
BOOL symt_add_udt_element (struct module *module, struct symt_udt *udt_type, const char *name, struct symt *elt_type, unsigned offset, unsigned size) DECLSPEC_HIDDEN
 
struct symt_enumsymt_new_enum (struct module *module, const char *typename, struct symt *basetype) DECLSPEC_HIDDEN
 
BOOL symt_add_enum_element (struct module *module, struct symt_enum *enum_type, const char *name, int value) DECLSPEC_HIDDEN
 
struct symt_arraysymt_new_array (struct module *module, int min, int max, struct symt *base, struct symt *index) DECLSPEC_HIDDEN
 
struct symt_function_signaturesymt_new_function_signature (struct module *module, struct symt *ret_type, enum CV_call_e call_conv) DECLSPEC_HIDDEN
 
BOOL symt_add_function_signature_parameter (struct module *module, struct symt_function_signature *sig, struct symt *param) DECLSPEC_HIDDEN
 
struct symt_pointersymt_new_pointer (struct module *module, struct symt *ref_type, ULONG_PTR size) DECLSPEC_HIDDEN
 
struct symt_typedefsymt_new_typedef (struct module *module, struct symt *ref, const char *name) DECLSPEC_HIDDEN
 

Variables

unsigned dbghelp_options DECLSPEC_HIDDEN
 

Typedef Documentation

◆ enum_modules_cb

typedef BOOL(* enum_modules_cb) (const WCHAR *, ULONG_PTR addr, void *user)

Definition at line 416 of file dbghelp_private.h.

◆ PEB32

typedef struct _PEB32 PEB32

◆ stabs_def_cb

typedef void(* stabs_def_cb) (struct module *module, ULONG_PTR load_offset, const char *name, ULONG_PTR offset, BOOL is_public, BOOL is_global, unsigned char other, struct symt_compiland *compiland, void *user)

Definition at line 732 of file dbghelp_private.h.

Enumeration Type Documentation

◆ cpu_addr

Enumerator
cpu_addr_pc 
cpu_addr_stack 
cpu_addr_frame 

Definition at line 576 of file dbghelp_private.h.

@ cpu_addr_frame
@ cpu_addr_pc
@ cpu_addr_stack

◆ format_info

Enumerator
DFI_ELF 
DFI_PE 
DFI_MACHO 
DFI_DWARF 
DFI_PDB 
DFI_LAST 

Definition at line 339 of file dbghelp_private.h.

340{
341 DFI_ELF,
342 DFI_PE,
343 DFI_MACHO,
344 DFI_DWARF,
345 DFI_PDB,
347};
@ DFI_ELF
@ DFI_PE
@ DFI_DWARF
@ DFI_LAST
@ DFI_MACHO
@ DFI_PDB

◆ location_error

Enumerator
loc_err_internal 
loc_err_too_complex 
loc_err_out_of_scope 
loc_err_cant_read 
loc_err_no_location 

Definition at line 144 of file dbghelp_private.h.

144 {loc_err_internal = -1, /* internal while computing */
145 loc_err_too_complex = -2, /* couldn't compute location (even at runtime) */
146 loc_err_out_of_scope = -3, /* variable isn't available at current address */
147 loc_err_cant_read = -4, /* couldn't read memory at given address */
148 loc_err_no_location = -5, /* likely optimized away (by compiler) */
149};
@ loc_err_cant_read
@ loc_err_no_location
@ loc_err_too_complex
@ loc_err_internal
@ loc_err_out_of_scope

◆ location_kind

Enumerator
loc_error 
loc_unavailable 
loc_absolute 
loc_register 
loc_regrel 
loc_tlsrel 
loc_user 

Definition at line 134 of file dbghelp_private.h.

134 {loc_error, /* reg is the error code */
135 loc_unavailable, /* location is not available */
136 loc_absolute, /* offset is the location */
137 loc_register, /* reg is the location */
138 loc_regrel, /* [reg+offset] is the location */
139 loc_tlsrel, /* offset is the address of the TLS index */
140 loc_user, /* value is debug information dependent,
141 reg & offset can be used ad libidem */
142};
@ loc_unavailable
@ loc_regrel
@ loc_register
@ loc_user
@ loc_error
@ loc_absolute
@ loc_tlsrel

◆ module_type

Enumerator
DMT_UNKNOWN 
DMT_ELF 
DMT_PE 
DMT_MACHO 
DMT_PDB 
DMT_DBG 

Definition at line 323 of file dbghelp_private.h.

324{
325 DMT_UNKNOWN, /* for lookup, not actually used for a module */
326 DMT_ELF, /* a real ELF shared module */
327 DMT_PE, /* a native or builtin PE module */
328 DMT_MACHO, /* a real Mach-O shared module */
329 DMT_PDB, /* .PDB file */
330 DMT_DBG, /* .DBG file */
331};
@ DMT_UNKNOWN
@ DMT_DBG
@ DMT_PE
@ DMT_MACHO
@ DMT_PDB
@ DMT_ELF

◆ pdb_kind

Enumerator
PDB_JG 
PDB_DS 

Definition at line 476 of file dbghelp_private.h.

476{PDB_JG, PDB_DS};
@ PDB_DS
@ PDB_JG

Function Documentation

◆ calc_crc32()

DWORD calc_crc32 ( HANDLE  handle)

Definition at line 874 of file dbghelp.c.

875{
876 BYTE buffer[8192];
877 DWORD crc = 0;
878 DWORD len;
879
881 while (ReadFile(handle, buffer, sizeof(buffer), &len, NULL) && len)
882 crc = RtlComputeCrc32(crc, buffer, len);
883 return crc;
884}
#define NULL
Definition: types.h:112
#define FILE_BEGIN
Definition: compat.h:761
#define RtlComputeCrc32
Definition: compat.h:810
#define ReadFile(a, b, c, d, e)
Definition: compat.h:742
#define SetFilePointer
Definition: compat.h:743
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint buffer
Definition: glext.h:5915
GLenum GLsizei len
Definition: glext.h:6722
unsigned char BYTE
Definition: xxhash.c:193

Referenced by elf_fetch_file_info(), elf_load_file_from_fmap(), image_check_debug_link(), macho_fetch_file_info(), and macho_load_file().

◆ copy_symbolW()

void copy_symbolW ( SYMBOL_INFOW siw,
const SYMBOL_INFO si 
)

Definition at line 1029 of file symbol.c.

1030{
1031 siw->SizeOfStruct = si->SizeOfStruct;
1032 siw->TypeIndex = si->TypeIndex;
1033 siw->Reserved[0] = si->Reserved[0];
1034 siw->Reserved[1] = si->Reserved[1];
1035 siw->Index = si->Index;
1036 siw->Size = si->Size;
1037 siw->ModBase = si->ModBase;
1038 siw->Flags = si->Flags;
1039 siw->Value = si->Value;
1040 siw->Address = si->Address;
1041 siw->Register = si->Register;
1042 siw->Scope = si->Scope;
1043 siw->Tag = si->Tag;
1044 siw->NameLen = si->NameLen;
1045 siw->MaxNameLen = si->MaxNameLen;
1046 MultiByteToWideChar(CP_ACP, 0, si->Name, -1, siw->Name, siw->MaxNameLen);
1047}
#define CP_ACP
Definition: compat.h:109
#define MultiByteToWideChar
Definition: compat.h:110
ULONG Scope
Definition: compat.h:1368
ULONG64 Address
Definition: compat.h:1366
ULONG Size
Definition: compat.h:1362
ULONG TypeIndex
Definition: compat.h:1359
ULONG Register
Definition: compat.h:1367
ULONG Flags
Definition: compat.h:1364
ULONG NameLen
Definition: compat.h:1370
ULONG64 Value
Definition: compat.h:1365
WCHAR Name[1]
Definition: compat.h:1372
ULONG64 ModBase
Definition: compat.h:1363
ULONG SizeOfStruct
Definition: compat.h:1358
ULONG Tag
Definition: compat.h:1369
ULONG64 Reserved[2]
Definition: compat.h:1360
ULONG Index
Definition: compat.h:1361
ULONG MaxNameLen
Definition: compat.h:1371
ULONG64 ModBase
Definition: compat.h:1043
ULONG TypeIndex
Definition: compat.h:1039
ULONG SizeOfStruct
Definition: compat.h:1038
ULONG Tag
Definition: compat.h:1049
ULONG NameLen
Definition: compat.h:1050
ULONG64 Value
Definition: compat.h:1045
ULONG Scope
Definition: compat.h:1048
CHAR Name[1]
Definition: compat.h:1052
ULONG64 Address
Definition: compat.h:1046
ULONG Register
Definition: compat.h:1047
ULONG64 Reserved[2]
Definition: compat.h:1040
ULONG Flags
Definition: compat.h:1044
ULONG Index
Definition: compat.h:1041
ULONG MaxNameLen
Definition: compat.h:1051
ULONG Size
Definition: compat.h:1042

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

◆ cpu_find()

struct cpu * cpu_find ( DWORD  machine)

Definition at line 183 of file dbghelp.c.

184{
185 struct cpu** cpu;
186
187 for (cpu = dbghelp_cpus ; *cpu; cpu++)
188 {
189 if (cpu[0]->machine == machine) return cpu[0];
190 }
191 return NULL;
192}
static struct cpu * dbghelp_cpus[]
Definition: dbghelp.c:164
static const char machine[]
Definition: profile.c:104

Referenced by StackWalk(), and StackWalk64().

◆ dwarf2_parse()

BOOL dwarf2_parse ( struct module module,
ULONG_PTR  load_offset,
const struct elf_thunk_area thunks,
struct image_file_map fmap 
)

Definition at line 3509 of file dwarf.c.

3512{
3515 struct image_section_map debug_sect, debug_str_sect, debug_abbrev_sect,
3516 debug_line_sect, debug_ranges_sect, eh_frame_sect;
3517 BOOL ret = TRUE;
3518 struct module_format* dwarf2_modfmt;
3519
3520 if (!dwarf2_init_section(&eh_frame, fmap, ".eh_frame", NULL, &eh_frame_sect))
3521 /* lld produces .eh_fram to avoid generating a long name */
3522 dwarf2_init_section(&eh_frame, fmap, ".eh_fram", NULL, &eh_frame_sect);
3523 dwarf2_init_section(&section[section_debug], fmap, ".debug_info", ".zdebug_info", &debug_sect);
3524 dwarf2_init_section(&section[section_abbrev], fmap, ".debug_abbrev", ".zdebug_abbrev", &debug_abbrev_sect);
3525 dwarf2_init_section(&section[section_string], fmap, ".debug_str", ".zdebug_str", &debug_str_sect);
3526 dwarf2_init_section(&section[section_line], fmap, ".debug_line", ".zdebug_line", &debug_line_sect);
3527 dwarf2_init_section(&section[section_ranges], fmap, ".debug_ranges", ".zdebug_ranges", &debug_ranges_sect);
3528
3529 /* to do anything useful we need either .eh_frame or .debug_info */
3530 if ((!eh_frame.address || eh_frame.address == IMAGE_NO_MAP) &&
3531 (!section[section_debug].address || section[section_debug].address == IMAGE_NO_MAP))
3532 {
3533 ret = FALSE;
3534 goto leave;
3535 }
3536
3537 if (fmap->modtype == DMT_ELF && debug_sect.fmap)
3538 {
3539 /* debug info might have a different base address than .so file
3540 * when elf file is prelinked after splitting off debug info
3541 * adjust symbol base addresses accordingly
3542 */
3543 load_offset += fmap->u.elf.elf_start - debug_sect.fmap->u.elf.elf_start;
3544 }
3545
3546 TRACE("Loading Dwarf2 information for %s\n", debugstr_w(module->module.ModuleName));
3547
3548 mod_ctx.data = section[section_debug].address;
3549 mod_ctx.end_data = mod_ctx.data + section[section_debug].size;
3550 mod_ctx.word_size = 0; /* will be correctly set later on */
3551
3552 dwarf2_modfmt = HeapAlloc(GetProcessHeap(), 0,
3553 sizeof(*dwarf2_modfmt) + sizeof(*dwarf2_modfmt->u.dwarf2_info));
3554 if (!dwarf2_modfmt)
3555 {
3556 ret = FALSE;
3557 goto leave;
3558 }
3559 dwarf2_modfmt->module = module;
3560 dwarf2_modfmt->remove = dwarf2_module_remove;
3561 dwarf2_modfmt->loc_compute = dwarf2_location_compute;
3562 dwarf2_modfmt->u.dwarf2_info = (struct dwarf2_module_info_s*)(dwarf2_modfmt + 1);
3563 dwarf2_modfmt->u.dwarf2_info->word_size = 0; /* will be correctly set later on */
3564 dwarf2_modfmt->module->format_info[DFI_DWARF] = dwarf2_modfmt;
3565
3566 /* As we'll need later some sections' content, we won't unmap these
3567 * sections upon existing this function
3568 */
3569 dwarf2_init_section(&dwarf2_modfmt->u.dwarf2_info->debug_loc, fmap, ".debug_loc", ".zdebug_loc", NULL);
3570 dwarf2_init_section(&dwarf2_modfmt->u.dwarf2_info->debug_frame, fmap, ".debug_frame", ".zdebug_frame", NULL);
3571 dwarf2_modfmt->u.dwarf2_info->eh_frame = eh_frame;
3572
3573 while (mod_ctx.data < mod_ctx.end_data)
3574 {
3575 dwarf2_parse_compilation_unit(section, dwarf2_modfmt->module, thunks, &mod_ctx, load_offset);
3576 }
3577 dwarf2_modfmt->module->module.SymType = SymDia;
3578 dwarf2_modfmt->module->module.CVSig = 'D' | ('W' << 8) | ('A' << 16) | ('R' << 24);
3579 /* FIXME: we could have a finer grain here */
3580 dwarf2_modfmt->module->module.GlobalSymbols = TRUE;
3581 dwarf2_modfmt->module->module.TypeInfo = TRUE;
3582 dwarf2_modfmt->module->module.SourceIndexed = TRUE;
3583 dwarf2_modfmt->module->module.Publics = TRUE;
3584
3585 /* set the word_size for eh_frame parsing */
3586 dwarf2_modfmt->u.dwarf2_info->word_size = fmap->addr_size / 8;
3587
3588leave:
3594
3595 image_unmap_section(&debug_sect);
3596 image_unmap_section(&debug_abbrev_sect);
3597 image_unmap_section(&debug_str_sect);
3598 image_unmap_section(&debug_line_sect);
3599 image_unmap_section(&debug_ranges_sect);
3600 if (!ret) image_unmap_section(&eh_frame_sect);
3601
3602 return ret;
3603}
#define leave
Definition: btrfs_drv.h:138
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define GetProcessHeap()
Definition: compat.h:736
@ SymDia
Definition: compat.h:1063
#define HeapAlloc
Definition: compat.h:733
static BOOL dwarf2_parse_compilation_unit(const dwarf2_section_t *sections, struct module *module, const struct elf_thunk_area *thunks, dwarf2_traverse_context_t *mod_ctx, ULONG_PTR load_offset)
Definition: dwarf.c:2371
static void dwarf2_fini_section(dwarf2_section_t *section)
Definition: dwarf.c:3496
@ section_line
Definition: dwarf.c:164
@ section_max
Definition: dwarf.c:164
@ section_string
Definition: dwarf.c:164
@ section_abbrev
Definition: dwarf.c:164
@ section_debug
Definition: dwarf.c:164
@ section_ranges
Definition: dwarf.c:164
static BOOL dwarf2_init_section(dwarf2_section_t *section, struct image_file_map *fmap, const char *sectname, const char *zsectname, struct image_section_map *ism)
Definition: dwarf.c:3467
static void dwarf2_location_compute(struct process *pcs, const struct module_format *modfmt, const struct symt_function *func, struct location *loc)
Definition: dwarf.c:3324
static void dwarf2_module_remove(struct process *pcs, struct module_format *modfmt)
Definition: dwarf.c:3502
unsigned int BOOL
Definition: ntddk_ex.h:94
#define IMAGE_NO_MAP
Definition: image_private.h:24
static void image_unmap_section(struct image_section_map *ism)
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
WCHAR ModuleName[32]
Definition: compat.h:1076
dwarf2_section_t eh_frame
Definition: dwarf.c:201
const unsigned char * address
Definition: dwarf.c:159
unsigned char word_size
Definition: dwarf.c:170
const unsigned char * end_data
Definition: dwarf.c:169
const unsigned char * data
Definition: dwarf.c:168
struct image_file_map::@383::elf_file_map elf
enum module_type modtype
union image_file_map::@383 u
unsigned addr_size
struct module * module
struct dwarf2_module_info_s * dwarf2_info
void(* loc_compute)(struct process *pcs, const struct module_format *modfmt, const struct symt_function *func, struct location *loc)
union module_format::@372 u
void(* remove)(struct process *pcs, struct module_format *modfmt)
IMAGEHLP_MODULEW64 module
Definition: parser.c:56
int ret

Referenced by elf_load_debug_info_from_map(), macho_load_debug_info(), and pe_load_dwarf().

◆ dwarf2_virtual_unwind()

BOOL dwarf2_virtual_unwind ( struct cpu_stack_walk csw,
DWORD_PTR  ip,
union ctx ctx,
DWORD64 cfa 
)

Definition at line 3258 of file dwarf.c.

3260{
3261 struct module_pair pair;
3262 struct frame_info info;
3263 dwarf2_traverse_context_t cie_ctx, fde_ctx;
3264 struct module_format* modfmt;
3265 const unsigned char* end;
3266 DWORD_PTR delta;
3267
3268 if (!(pair.pcs = process_find_by_handle(csw->hProcess)) ||
3269 !(pair.requested = module_find_by_addr(pair.pcs, ip, DMT_UNKNOWN)) ||
3271 return FALSE;
3272 modfmt = pair.effective->format_info[DFI_DWARF];
3273 if (!modfmt) return FALSE;
3274 memset(&info, 0, sizeof(info));
3275 fde_ctx.data = modfmt->u.dwarf2_info->eh_frame.address;
3276 fde_ctx.end_data = fde_ctx.data + modfmt->u.dwarf2_info->eh_frame.size;
3277 fde_ctx.word_size = modfmt->u.dwarf2_info->word_size;
3278 /* let offsets relative to the eh_frame sections be correctly computed, as we'll map
3279 * in this process the IMAGE section at a different address as the one expected by
3280 * the image
3281 */
3282 delta = pair.effective->module.BaseOfImage + modfmt->u.dwarf2_info->eh_frame.rva -
3283 (DWORD_PTR)modfmt->u.dwarf2_info->eh_frame.address;
3284 if (!dwarf2_get_cie(ip, pair.effective, delta, &fde_ctx, &cie_ctx, &info, TRUE))
3285 {
3286 fde_ctx.data = modfmt->u.dwarf2_info->debug_frame.address;
3287 fde_ctx.end_data = fde_ctx.data + modfmt->u.dwarf2_info->debug_frame.size;
3288 fde_ctx.word_size = modfmt->u.dwarf2_info->word_size;
3289 delta = pair.effective->reloc_delta;
3290 if (!dwarf2_get_cie(ip, pair.effective, delta, &fde_ctx, &cie_ctx, &info, FALSE))
3291 {
3292 TRACE("Couldn't find information for %lx\n", ip);
3293 return FALSE;
3294 }
3295 }
3296
3297 TRACE("function %lx/%lx code_align %lu data_align %ld retaddr %s\n",
3298 ip, info.ip, info.code_align, info.data_align,
3299 csw->cpu->fetch_regname(csw->cpu->map_dwarf_register(info.retaddr_reg, pair.effective, TRUE)));
3300
3301 /* if at very beginning of function, return and use default unwinder */
3302 if (ip == info.ip) return FALSE;
3303 execute_cfa_instructions(pair.effective, &cie_ctx, ip, &info);
3304
3305 if (info.aug_z_format) /* get length of augmentation data */
3306 {
3308 end = fde_ctx.data + len;
3309 }
3310 else end = NULL;
3311 dwarf2_parse_augmentation_ptr(&fde_ctx, info.lsda_encoding); /* handler_data */
3312 if (end) fde_ctx.data = end;
3313
3314 execute_cfa_instructions(pair.effective, &fde_ctx, ip, &info);
3315
3316 /* if there is no information about retaddr, use default unwinder */
3317 if (info.state.rules[info.retaddr_reg] == RULE_UNSET) return FALSE;
3318
3319 apply_frame_state(pair.effective, csw, context, &info.state, cfa);
3320
3321 return TRUE;
3322}
struct module * module_find_by_addr(const struct process *pcs, DWORD64 addr, enum module_type type) DECLSPEC_HIDDEN
Definition: module.c:420
BOOL module_get_debug(struct module_pair *) DECLSPEC_HIDDEN
Definition: module.c:374
struct process * process_find_by_handle(HANDLE hProcess)
Definition: dbghelp.c:99
@ RULE_UNSET
Definition: dwarf.c:2558
static BOOL dwarf2_get_cie(ULONG_PTR addr, struct module *module, DWORD_PTR delta, dwarf2_traverse_context_t *fde_ctx, dwarf2_traverse_context_t *cie_ctx, struct frame_info *info, BOOL in_eh_frame)
Definition: dwarf.c:2715
static ULONG_PTR dwarf2_parse_augmentation_ptr(dwarf2_traverse_context_t *ctx, unsigned char encoding)
Definition: dwarf.c:2595
static void apply_frame_state(const struct module *module, struct cpu_stack_walk *csw, union ctx *context, struct frame_state *state, DWORD64 *cfa)
Definition: dwarf.c:3201
static ULONG_PTR dwarf2_leb128_as_unsigned(dwarf2_traverse_context_t *ctx)
Definition: dwarf.c:276
static void execute_cfa_instructions(struct module *module, dwarf2_traverse_context_t *ctx, ULONG_PTR last_ip, struct frame_info *info)
Definition: dwarf.c:2792
GLuint GLuint end
Definition: gl.h:1545
if(dx< 0)
Definition: linetemp.h:194
#define memset(x, y, z)
Definition: compat.h:39
Definition: http.c:7252
struct cpu * cpu
Definition: dhcpd.h:62
Definition: _pair.h:47
#define DWORD_PTR
Definition: treelist.c:76
uint32_t DWORD_PTR
Definition: typedefs.h:65
uint32_t ULONG_PTR
Definition: typedefs.h:65

Referenced by fetch_next_frame32().

◆ elf_is_in_thunk_area()

int elf_is_in_thunk_area ( ULONG_PTR  addr,
const struct elf_thunk_area thunks 
)

Definition at line 602 of file elf_module.c.

604{
605 unsigned i;
606
607 if (thunks) for (i = 0; thunks[i].symname; i++)
608 {
609 if (addr >= thunks[i].rva_start && addr < thunks[i].rva_end)
610 return i;
611 }
612 return -1;
613}
GLenum const GLvoid * addr
Definition: glext.h:9621
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
const char * symname
Definition: elf_module.c:77

Referenced by dwarf2_parse_subprogram(), and elf_new_wine_thunks().

◆ elf_read_wine_loader_dbg_info()

BOOL elf_read_wine_loader_dbg_info ( struct process pcs,
ULONG_PTR  addr 
)

Definition at line 1753 of file elf_module.c.

1754{
1755 struct elf_info elf_info;
1756 WCHAR *loader;
1757 BOOL ret;
1758
1760 loader = get_wine_loader_name(pcs);
1761 ret = elf_search_and_load_file(pcs, loader, addr, 0, &elf_info);
1762 heap_free(loader);
1763 if (!ret || !elf_info.dbg_hdr_addr) return FALSE;
1764
1765 TRACE("Found ELF debug header %#lx\n", elf_info.dbg_hdr_addr);
1766 elf_info.module->format_info[DFI_ELF]->u.elf_info->elf_loader = 1;
1769 pcs->loader = &elf_loader_ops;
1770 return TRUE;
1771}
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
WCHAR * get_wine_loader_name(struct process *pcs) DECLSPEC_HIDDEN
Definition: module.c:150
void module_set_module(struct module *module, const WCHAR *name) DECLSPEC_HIDDEN
Definition: module.c:142
const WCHAR S_WineLoaderW[]
Definition: module.c:42
static BOOL elf_search_and_load_file(struct process *pcs, const WCHAR *filename, ULONG_PTR load_offset, ULONG_PTR dyn_addr, struct elf_info *elf_info)
Definition: elf_module.c:1411
#define ELF_INFO_MODULE
Definition: elf_module.c:34
#define ELF_INFO_DEBUG_HEADER
Definition: elf_module.c:33
static const struct loader_ops elf_loader_ops
Definition: elf_module.c:1739
unsigned flags
Definition: elf_module.c:41
struct module * module
Definition: elf_module.c:43
DWORD_PTR dbg_hdr_addr
Definition: elf_module.c:42
const struct loader_ops * loader
ULONG_PTR dbg_hdr_addr
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by check_live_target().

◆ fetch_buffer()

void * fetch_buffer ( struct process pcs,
unsigned  size 
)

Definition at line 128 of file dbghelp.c.

129{
130 if (size > pcs->buffer_size)
131 {
132 if (pcs->buffer)
133 pcs->buffer = HeapReAlloc(GetProcessHeap(), 0, pcs->buffer, size);
134 else
135 pcs->buffer = HeapAlloc(GetProcessHeap(), 0, size);
136 pcs->buffer_size = (pcs->buffer) ? size : 0;
137 }
138 return pcs->buffer;
139}
#define HeapReAlloc
Definition: compat.h:734
GLsizeiptr size
Definition: glext.h:5919
void * buffer
unsigned buffer_size

Referenced by copy_line_W64_from_64(), and symt_fill_func_line_info().

◆ file_name()

const WCHAR * file_name ( const WCHAR str)

Definition at line 45 of file path.c.

46{
47 const WCHAR* p;
48
49 for (p = str + lstrlenW(str) - 1; p >= str && !is_sep(*p); p--);
50 return p + 1;
51}
#define lstrlenW
Definition: compat.h:750
static BOOL is_sep(WCHAR ch)
Definition: path.c:35
GLfloat GLfloat p
Definition: glext.h:8902
const WCHAR * str

◆ file_nameA()

const char * file_nameA ( const char str)

Definition at line 37 of file path.c.

38{
39 const char* p;
40
41 for (p = str + strlen(str) - 1; p >= str && !is_sepA(*p); p--);
42 return p + 1;
43}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
static BOOL is_sepA(char ch)
Definition: path.c:34

Referenced by elf_lookup_symtab(), FindDebugInfoFile(), is_wine_loader(), and test_query_process_image_file_name().

◆ get_dos_file_name()

WCHAR * get_dos_file_name ( const WCHAR filename)

Definition at line 671 of file path.c.

672{
673 WCHAR *dos_path;
674 size_t len;
675
676#ifndef __REACTOS__
677 if (*filename == '/')
678 {
679 char *unix_path;
681 unix_path = heap_alloc(len * sizeof(WCHAR));
682 WideCharToMultiByte(CP_UNIXCP, 0, filename, -1, unix_path, len, NULL, NULL);
683 dos_path = wine_get_dos_file_name(unix_path);
684 heap_free(unix_path);
685 }
686 else
687#endif
688 {
690 dos_path = heap_alloc((len + 1) * sizeof(WCHAR));
691 memcpy(dos_path, filename, (len + 1) * sizeof(WCHAR));
692 }
693 return dos_path;
694}
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
#define CP_UNIXCP
Definition: compat.h:79
#define wine_get_dos_file_name(__x)
Definition: compat.h:61
#define WideCharToMultiByte
Definition: compat.h:111
const char * filename
Definition: ioapi.h:137
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878

Referenced by elf_map_file(), image_check_debug_link(), and macho_map_file().

◆ get_wine_loader_name()

WCHAR * get_wine_loader_name ( struct process pcs)

Definition at line 150 of file module.c.

151{
152 static const WCHAR wineW[] = {'w','i','n','e',0};
153 static const WCHAR suffixW[] = {'6','4',0};
154 WCHAR *buffer, *p;
155 const char *env;
156
157 /* All binaries are loaded with WINELOADER (if run from tree) or by the
158 * main executable
159 */
160 if ((env = getenv("WINELOADER")))
161 {
162 DWORD len = 2 + MultiByteToWideChar( CP_UNIXCP, 0, env, -1, NULL, 0 );
163 buffer = heap_alloc( len * sizeof(WCHAR) );
165 }
166 else
167 {
168 buffer = heap_alloc( sizeof(wineW) + 2 * sizeof(WCHAR) );
170 }
171
172 p = buffer + lstrlenW( buffer ) - lstrlenW( suffixW );
173 if (p > buffer && !wcscmp( p, suffixW ))
174 *p = 0;
175
176 if (pcs->is_64bit)
177 lstrcatW(buffer, suffixW);
178
179 TRACE( "returning %s\n", debugstr_w(buffer) );
180 return buffer;
181}
static LPCWSTR LPCWSTR LPCWSTR env
Definition: db.cpp:170
#define lstrcpyW
Definition: compat.h:749
_Check_return_ char *__cdecl getenv(_In_z_ const char *_VarName)
static WCHAR wineW[]
Definition: localmon.c:128
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)

Referenced by elf_read_wine_loader_dbg_info(), and macho_search_loader().

◆ hash_table_add()

void hash_table_add ( struct hash_table ht,
struct hash_table_elt elt 
)

Definition at line 378 of file storage.c.

379{
380 unsigned hash = hash_table_hash(elt->name, ht->num_buckets);
381
382 if (!ht->buckets)
383 {
384 ht->buckets = pool_alloc(ht->pool, ht->num_buckets * sizeof(struct hash_table_bucket));
385 assert(ht->buckets);
386 memset(ht->buckets, 0, ht->num_buckets * sizeof(struct hash_table_bucket));
387 }
388
389 /* in some cases, we need to get back the symbols of same name in the order
390 * in which they've been inserted. So insert new elements at the end of the list.
391 */
392 if (!ht->buckets[hash].first)
393 {
394 ht->buckets[hash].first = elt;
395 }
396 else
397 {
398 ht->buckets[hash].last->next = elt;
399 }
400 ht->buckets[hash].last = elt;
401 elt->next = NULL;
402 ht->num_elts++;
403}
static unsigned hash_table_hash(const char *name, unsigned num_buckets)
Definition: storage.c:319
void * pool_alloc(struct pool *pool, size_t len)
Definition: storage.c:89
#define assert(x)
Definition: debug.h:53
static const struct newhuff ht[]
Definition: huffman.h:296
struct hash_table_elt * next
const char * name
Definition: _hash_fun.h:40

Referenced by elf_hash_symtab(), macho_stabs_def_cb(), pev_set_value(), symt_add_module_ht(), symt_new_basic(), symt_new_typedef(), symt_new_udt(), and symt_ptr2index().

◆ hash_table_destroy()

void hash_table_destroy ( struct hash_table ht)

Definition at line 342 of file storage.c.

343{
344#if defined(USE_STATS)
345 int i;
346 unsigned len;
347 unsigned min = 0xffffffff, max = 0, sq = 0;
348 struct hash_table_elt* elt;
349 double mean, variance;
350
351 for (i = 0; i < ht->num_buckets; i++)
352 {
353 for (len = 0, elt = ht->buckets[i]; elt; elt = elt->next) len++;
354 if (len < min) min = len;
355 if (len > max) max = len;
356 sq += len * len;
357 }
358 mean = (double)ht->num_elts / ht->num_buckets;
359 variance = (double)sq / ht->num_buckets - mean * mean;
360 FIXME("STATS: elts[num:%-4u size:%u mean:%f] buckets[min:%-4u variance:%+f max:%-4u]\n",
361 ht->num_elts, ht->num_buckets, mean, min, variance, max);
362
363 for (i = 0; i < ht->num_buckets; i++)
364 {
365 for (len = 0, elt = ht->buckets[i]; elt; elt = elt->next) len++;
366 if (len == max)
367 {
368 FIXME("Longest bucket:\n");
369 for (elt = ht->buckets[i]; elt; elt = elt->next)
370 FIXME("\t%s\n", elt->name);
371 break;
372 }
373
374 }
375#endif
376}
#define FIXME(fmt,...)
Definition: precomp.h:53
static const char mbstate_t *static wchar_t const char mbstate_t *static const wchar_t int *static double
Definition: string.c:80
#define min(a, b)
Definition: monoChain.cc:55
#define max(a, b)
Definition: svc.c:63

Referenced by module_remove(), and module_reset_debug_info().

◆ hash_table_init()

void hash_table_init ( struct pool pool,
struct hash_table ht,
unsigned  num_buckets 
)

Definition at line 334 of file storage.c.

335{
336 ht->num_elts = 0;
337 ht->num_buckets = num_buckets;
338 ht->pool = pool;
339 ht->buckets = NULL;
340}

Referenced by elf_load_debug_info(), macho_load_debug_info(), module_new(), and pev_init().

◆ hash_table_iter_init()

void hash_table_iter_init ( const struct hash_table ht,
struct hash_table_iter hti,
const char name 
)

Definition at line 405 of file storage.c.

407{
408 hti->ht = ht;
409 if (name)
410 {
411 hti->last = hash_table_hash(name, ht->num_buckets);
412 hti->index = hti->last - 1;
413 }
414 else
415 {
416 hti->last = ht->num_buckets - 1;
417 hti->index = -1;
418 }
419 hti->element = NULL;
420}
struct hash_table_elt * element
const struct hash_table * ht
Definition: name.c:39

Referenced by codeview_add_type_struct(), elf_finish_stabs_info(), elf_lookup_symtab(), elf_new_public_symbols(), elf_new_wine_thunks(), find_name(), macho_finish_stabs(), pe_locate_with_coff_symbol_table(), pev_get_val(), pev_set_value(), SymEnumLines(), symt_enum_module(), symt_find_type_by_name(), and symt_ptr2index().

◆ hash_table_iter_up()

void * hash_table_iter_up ( struct hash_table_iter hti)

Definition at line 422 of file storage.c.

423{
424 if (!hti->ht->buckets) return NULL;
425
426 if (hti->element) hti->element = hti->element->next;
427 while (!hti->element && hti->index < hti->last)
428 hti->element = hti->ht->buckets[++hti->index].first;
429 return hti->element;
430}

Referenced by codeview_add_type_struct(), elf_finish_stabs_info(), elf_lookup_symtab(), elf_new_public_symbols(), elf_new_wine_thunks(), find_name(), macho_finish_stabs(), pe_locate_with_coff_symbol_table(), pev_get_val(), pev_set_value(), SymEnumLines(), symt_enum_module(), symt_find_type_by_name(), and symt_ptr2index().

◆ macho_read_wine_loader_dbg_info()

BOOL macho_read_wine_loader_dbg_info ( struct process pcs,
ULONG_PTR  addr 
)

Definition at line 1911 of file macho_module.c.

1912{
1913 struct macho_info macho_info;
1914
1915 TRACE("(%p/%p)\n", pcs, pcs->handle);
1916 pcs->dbg_hdr_addr = addr;
1918 if (!macho_search_loader(pcs, &macho_info)) return FALSE;
1919 macho_info.module->format_info[DFI_MACHO]->u.macho_info->is_loader = 1;
1921 pcs->loader = &macho_loader_ops;
1922 TRACE("Found macho debug header %#lx\n", pcs->dbg_hdr_addr);
1923 return TRUE;
1924}
static BOOL macho_search_loader(struct process *pcs, struct macho_info *macho_info)
static const struct loader_ops macho_loader_ops
#define MACHO_INFO_MODULE
Definition: macho_module.c:189
struct module * module
Definition: macho_module.c:195
unsigned flags
Definition: macho_module.c:194
HANDLE handle

Referenced by check_live_target().

◆ minidump_add_memory_block()

void minidump_add_memory_block ( struct dump_context dc,
ULONG64  base,
ULONG  size,
ULONG  rva 
)

Definition at line 355 of file minidump.c.

356{
357 if (!dc->mem)
358 {
359 dc->alloc_mem = 32;
360 dc->mem = HeapAlloc(GetProcessHeap(), 0, dc->alloc_mem * sizeof(*dc->mem));
361 }
362 else if (dc->num_mem >= dc->alloc_mem)
363 {
364 dc->alloc_mem *= 2;
365 dc->mem = HeapReAlloc(GetProcessHeap(), 0, dc->mem,
366 dc->alloc_mem * sizeof(*dc->mem));
367 }
368 if (dc->mem)
369 {
370 dc->mem[dc->num_mem].base = base;
371 dc->mem[dc->num_mem].size = size;
372 dc->mem[dc->num_mem].rva = rva;
373 dc->num_mem++;
374 }
375 else dc->num_mem = dc->alloc_mem = 0;
376}
static const WCHAR dc[]

Referenced by arm64_fetch_minidump_thread(), arm_fetch_minidump_thread(), dump_threads(), i386_fetch_minidump_thread(), x86_64_fetch_minidump_module(), and x86_64_fetch_minidump_thread().

◆ module_find_by_addr()

struct module * module_find_by_addr ( const struct process pcs,
DWORD64  addr,
enum module_type  type 
)

Definition at line 420 of file module.c.

422{
423 struct module* module;
424
425 if (type == DMT_UNKNOWN)
426 {
427 if ((module = module_find_by_addr(pcs, addr, DMT_PE)) ||
430 return module;
431 }
432 else
433 {
434 for (module = pcs->lmodules; module; module = module->next)
435 {
436 if (type == module->type && addr >= module->module.BaseOfImage &&
437 addr < module->module.BaseOfImage + module->module.ImageSize)
438 return module;
439 }
440 }
442 return module;
443}
#define ERROR_MOD_NOT_FOUND
Definition: compat.h:104
#define SetLastError(x)
Definition: compat.h:752
struct module * module_find_by_addr(const struct process *pcs, DWORD64 addr, enum module_type type)
Definition: module.c:420
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
DWORD64 BaseOfImage
Definition: compat.h:1070
struct module * next
enum module_type type
struct module * lmodules

Referenced by dwarf2_virtual_unwind(), module_find_by_addr(), pdb_virtual_unwind(), sym_enum(), SymAddSymbolW(), SymEnumLines(), SymEnumSourceFilesW(), SymEnumTypes(), SymFromAddr(), SymFunctionTableAccess64(), SymGetLineFromAddr64(), SymGetLineNext64(), SymGetLinePrev64(), SymGetModuleBase64(), SymGetModuleInfoW64(), SymGetTypeFromName(), SymGetTypeInfo(), symt_enum_locals(), SymUnloadModule(), SymUnloadModule64(), and x86_64_fetch_minidump_module().

◆ module_find_by_nameA()

struct module * module_find_by_nameA ( const struct process pcs,
const char name 
)

Definition at line 291 of file module.c.

292{
293 WCHAR wname[MAX_PATH];
294
295 MultiByteToWideChar(CP_ACP, 0, name, -1, wname, ARRAY_SIZE(wname));
296 return module_find_by_nameW(pcs, wname);
297}
#define ARRAY_SIZE(A)
Definition: main.h:20
#define MAX_PATH
Definition: compat.h:34
struct module * module_find_by_nameW(const struct process *pcs, const WCHAR *name)
Definition: module.c:279

Referenced by SymFromName().

◆ module_find_by_nameW()

struct module * module_find_by_nameW ( const struct process pcs,
const WCHAR name 
)

Definition at line 279 of file module.c.

280{
281 struct module* module;
282
283 for (module = pcs->lmodules; module; module = module->next)
284 {
285 if (!wcsicmp(name, module->module.ModuleName)) return module;
286 }
288 return NULL;
289}
#define ERROR_INVALID_NAME
Definition: compat.h:103
#define wcsicmp
Definition: compat.h:15

Referenced by module_find_by_nameA(), and SymEnumSourceFilesW().

◆ module_get_containee()

struct module * module_get_containee ( const struct process pcs,
const struct module inner 
)

Definition at line 349 of file module.c.

350{
351 struct module* module;
352
353 for (module = pcs->lmodules; module; module = module->next)
354 {
355 if (module != outer &&
357 outer->module.BaseOfImage + outer->module.ImageSize >=
359 return module;
360 }
361 return NULL;
362}

Referenced by sym_enum(), and SymFromName().

◆ module_get_debug()

BOOL module_get_debug ( struct module_pair pair)

Definition at line 374 of file module.c.

375{
377
378 if (!pair->requested) return FALSE;
379 /* for a PE builtin, always get info from container */
380 if (!(pair->effective = module_get_container(pair->pcs, pair->requested)))
381 pair->effective = pair->requested;
382 /* if deferred, force loading */
383 if (pair->effective->module.SymType == SymDeferred)
384 {
385 BOOL ret;
386
387 if (pair->effective->is_virtual) ret = FALSE;
388 else if (pair->effective->type == DMT_PE)
389 {
390 idslW64.SizeOfStruct = sizeof(idslW64);
391 idslW64.BaseOfImage = pair->effective->module.BaseOfImage;
392 idslW64.CheckSum = pair->effective->module.CheckSum;
393 idslW64.TimeDateStamp = pair->effective->module.TimeDateStamp;
394 memcpy(idslW64.FileName, pair->effective->module.ImageName,
395 sizeof(pair->effective->module.ImageName));
396 idslW64.Reparse = FALSE;
397 idslW64.hFile = INVALID_HANDLE_VALUE;
398
400 ret = pe_load_debug_info(pair->pcs, pair->effective);
401 pcs_callback(pair->pcs,
403 &idslW64);
404 }
405 else ret = pair->pcs->loader->load_debug_info(pair->pcs, pair->effective);
406
407 if (!ret) pair->effective->module.SymType = SymNone;
408 assert(pair->effective->module.SymType != SymDeferred);
409 pair->effective->module.NumSyms = pair->effective->ht_symbols.num_elts;
410 }
411 return pair->effective->module.SymType != SymNone;
412}
BOOL pe_load_debug_info(const struct process *pcs, struct module *module) DECLSPEC_HIDDEN
Definition: pe_module.c:751
@ SymNone
Definition: compat.h:1056
@ SymDeferred
Definition: compat.h:1061
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define CBA_DEFERRED_SYMBOL_LOAD_COMPLETE
Definition: compat.h:977
#define CBA_DEFERRED_SYMBOL_LOAD_FAILURE
Definition: compat.h:978
#define CBA_DEFERRED_SYMBOL_LOAD_START
Definition: compat.h:976
BOOL pcs_callback(const struct process *pcs, ULONG action, void *data)
Definition: dbghelp.c:731
static struct module * module_get_container(const struct process *pcs, const struct module *inner)
Definition: module.c:329
WCHAR FileName[MAX_PATH+1]
Definition: compat.h:1167

Referenced by dwarf2_virtual_unwind(), find_name(), pdb_virtual_unwind(), sym_enum(), SymAddSymbolW(), SymEnumLines(), SymEnumSourceFilesW(), SymEnumTypes(), SymFromAddr(), SymGetLineFromAddr64(), SymGetLineNext64(), SymGetLinePrev64(), SymGetTypeFromName(), SymGetTypeInfo(), and symt_enum_locals().

◆ module_is_already_loaded()

struct module * module_is_already_loaded ( const struct process pcs,
const WCHAR imgname 
)

Definition at line 303 of file module.c.

304{
305 struct module* module;
306 const WCHAR* filename;
307
308 /* first compare the loaded image name... */
309 for (module = pcs->lmodules; module; module = module->next)
310 {
312 return module;
313 }
314 /* then compare the standard filenames (without the path) ... */
316 for (module = pcs->lmodules; module; module = module->next)
317 {
319 return module;
320 }
322 return NULL;
323}
static const WCHAR * get_filename(const WCHAR *name, const WCHAR *endptr)
Definition: module.c:70
WCHAR LoadedImageName[256]
Definition: compat.h:1078

Referenced by elf_load_cb(), elf_search_and_load_file(), macho_search_and_load_file(), and SymLoadModuleExW().

◆ module_new()

struct module * module_new ( struct process pcs,
const WCHAR name,
enum module_type  type,
BOOL  virtual,
DWORD64  addr,
DWORD64  size,
ULONG_PTR  stamp,
ULONG_PTR  checksum 
)

Definition at line 198 of file module.c.

202{
203 struct module* module;
204 unsigned i;
205
206 assert(type == DMT_ELF || type == DMT_PE || type == DMT_MACHO);
208 return NULL;
209
210 module->next = pcs->lmodules;
211 pcs->lmodules = module;
212
213 TRACE("=> %s %s-%s %s\n",
214 get_module_type(type, virtual),
215 wine_dbgstr_longlong(mod_addr), wine_dbgstr_longlong(mod_addr + size),
217
218 pool_init(&module->pool, 65536);
219
220 module->process = pcs;
222 module->module.BaseOfImage = mod_addr;
225 module->module.ImageName[0] = '\0';
228 module->module.NumSyms = 0;
229 module->module.TimeDateStamp = stamp;
231
233 module->module.CVSig = 0;
235 module->module.PdbSig = 0;
237 module->module.PdbAge = 0;
245
246 module->reloc_delta = 0;
247 module->type = type;
248 module->is_virtual = virtual;
249 for (i = 0; i < DFI_LAST; i++) module->format_info[i] = NULL;
251 module->sorttab_size = 0;
253 module->num_sorttab = 0;
254 module->num_symbols = 0;
255
256 vector_init(&module->vsymt, sizeof(struct symt*), 128);
257 /* FIXME: this seems a bit too high (on a per module basis)
258 * need some statistics about this
259 */
262#ifdef __x86_64__
263 hash_table_init(&module->pool, &module->ht_symaddr, 4096);
264#endif
265 vector_init(&module->vtypes, sizeof(struct symt*), 32);
266
267 module->sources_used = 0;
269 module->sources = 0;
271
272 return module;
273}
void hash_table_init(struct pool *pool, struct hash_table *ht, unsigned num_buckets) DECLSPEC_HIDDEN
Definition: storage.c:334
void vector_init(struct vector *v, unsigned elt_sz, unsigned bucket_sz) DECLSPEC_HIDDEN
Definition: storage.c:133
int source_rb_compare(const void *key, const struct wine_rb_entry *entry) DECLSPEC_HIDDEN
Definition: source.c:40
void pool_init(struct pool *a, size_t arena_size) DECLSPEC_HIDDEN
Definition: storage.c:43
static cab_ULONG checksum(const cab_UBYTE *data, cab_UWORD bytes, cab_ULONG csum)
Definition: fdi.c:353
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:49
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define lstrcpynW
Definition: compat.h:738
void module_set_module(struct module *module, const WCHAR *name)
Definition: module.c:142
static const char * get_module_type(enum module_type type, BOOL virtual)
Definition: module.c:184
static void wine_rb_init(struct wine_rb_tree *tree, wine_rb_compare_func_t compare)
Definition: rbtree.h:179
WCHAR CVData[MAX_PATH *3]
Definition: compat.h:1081
WCHAR LoadedPdbName[256]
Definition: compat.h:1079
WCHAR ImageName[256]
Definition: compat.h:1077
SYM_TYPE SymType
Definition: compat.h:1075
unsigned num_sorttab
DWORD64 reloc_delta
unsigned num_symbols
unsigned short is_virtual
struct symt_ht ** addr_sorttab
struct wine_rb_tree sources_offsets_tree
int sortlist_valid
struct process * process
struct hash_table ht_types
unsigned sorttab_size
unsigned sources_used
char * sources
struct module_format * format_info[DFI_LAST]
unsigned sources_alloc
struct vector vsymt
struct hash_table ht_symbols
struct pool pool
struct vector vtypes

Referenced by elf_load_file_from_fmap(), macho_load_file(), pe_load_builtin_module(), pe_load_native_module(), and SymLoadModuleExW().

◆ module_remove()

BOOL module_remove ( struct process pcs,
struct module module 
)

Definition at line 889 of file module.c.

890{
891 struct module_format*modfmt;
892 struct module** p;
893 unsigned i;
894
896
897 for (i = 0; i < DFI_LAST; i++)
898 {
899 if ((modfmt = module->format_info[i]) && modfmt->remove)
900 modfmt->remove(pcs, module->format_info[i]);
901 }
908 /* native dbghelp doesn't invoke registered callback(,CBA_SYMBOLS_UNLOADED,) here
909 * so do we
910 */
911 for (p = &pcs->lmodules; *p; p = &(*p)->next)
912 {
913 if (*p == module)
914 {
915 *p = module->next;
917 return TRUE;
918 }
919 }
920 FIXME("This shouldn't happen\n");
921 return FALSE;
922}
void pool_destroy(struct pool *a) DECLSPEC_HIDDEN
Definition: storage.c:50
void hash_table_destroy(struct hash_table *ht) DECLSPEC_HIDDEN
Definition: storage.c:342
#define HeapFree(x, y, z)
Definition: compat.h:735
WCHAR * real_path

Referenced by elf_synchronize_module_list(), macho_synchronize_module_list(), SymCleanup(), SymUnloadModule(), and SymUnloadModule64().

◆ module_reset_debug_info()

void module_reset_debug_info ( struct module module)

Definition at line 1328 of file module.c.

1329{
1331 module->sorttab_size = 0;
1335 module->ht_symbols.num_buckets = 0;
1336 module->ht_symbols.buckets = NULL;
1338 module->ht_types.num_buckets = 0;
1339 module->ht_types.buckets = NULL;
1340 module->vtypes.num_elts = 0;
1343 module->sources = NULL;
1344}

Referenced by stabs_parse().

◆ module_set_module()

void module_set_module ( struct module module,
const WCHAR name 
)

Definition at line 142 of file module.c.

143{
146}
static void module_fill_module(const WCHAR *in, WCHAR *out, size_t size)
Definition: module.c:118
WCHAR modulename[64]

Referenced by elf_read_wine_loader_dbg_info(), macho_read_wine_loader_dbg_info(), module_new(), and SymLoadModuleExW().

◆ path_find_symbol_file()

BOOL path_find_symbol_file ( const struct process pcs,
const struct module module,
PCSTR  full_path,
enum module_type  type,
const GUID guid,
DWORD  dw1,
DWORD  dw2,
WCHAR buffer,
BOOL is_unmatched 
)

Definition at line 596 of file path.c.

599{
600 struct module_find mf;
601 WCHAR full_pathW[MAX_PATH];
602 WCHAR* ptr;
603 const WCHAR* filename;
604 WCHAR* searchPath = pcs->search_path;
605
606 TRACE("(pcs = %p, full_path = %s, guid = %s, dw1 = 0x%08x, dw2 = 0x%08x, buffer = %p)\n",
607 pcs, debugstr_a(full_path), debugstr_guid(guid), dw1, dw2, buffer);
608
609 mf.guid = guid;
610 mf.dw1 = dw1;
611 mf.dw2 = dw2;
612 mf.matched = 0;
613
614 MultiByteToWideChar(CP_ACP, 0, full_path, -1, full_pathW, MAX_PATH);
615 filename = file_name(full_pathW);
616 mf.kind = type;
617 *is_unmatched = FALSE;
618
619 /* first check full path to file */
620 if (module_find_cb(full_pathW, &mf))
621 {
622 lstrcpyW( buffer, full_pathW );
623 return TRUE;
624 }
625
626 /* FIXME: Use Environment-Variables (see MS docs)
627 _NT_SYMBOL_PATH and _NT_ALT_SYMBOL_PATH
628 FIXME: Implement "Standard Path Elements" (Path) ... (see MS docs)
629 do a search for (every?) path-element like this ...
630 <path>
631 <path>\dll
632 <path>\symbols\dll
633 (dll may be exe, or sys depending on the file extension) */
634
635 /* 2. check module-path */
637 if (do_searchW(filename, buffer, FALSE, module_find_cb, &mf)) return TRUE;
638 if (module->real_path)
639 {
641 if (do_searchW(filename, buffer, FALSE, module_find_cb, &mf)) return TRUE;
642 }
643
644 while (searchPath)
645 {
646 ptr = wcschr(searchPath, ';');
647 if (ptr)
648 {
649 memcpy(buffer, searchPath, (ptr - searchPath) * sizeof(WCHAR));
650 buffer[ptr - searchPath] = '\0';
651 searchPath = ptr + 1;
652 }
653 else
654 {
655 lstrcpyW(buffer, searchPath);
656 searchPath = NULL;
657 }
658 /* return first fully matched file */
659 if (do_searchW(filename, buffer, FALSE, module_find_cb, &mf)) return TRUE;
660 }
661 /* if no fully matching file is found, return the best matching file if any */
662 if ((dbghelp_options & SYMOPT_LOAD_ANYTHING) && mf.matched)
663 {
664 lstrcpyW( buffer, mf.filename );
665 *is_unmatched = TRUE;
666 return TRUE;
667 }
668 return FALSE;
669}
#define wcschr
Definition: compat.h:17
#define SYMOPT_LOAD_ANYTHING
Definition: compat.h:991
unsigned dbghelp_options
Definition: dbghelp.c:73
static BOOL CALLBACK module_find_cb(PCWSTR buffer, PVOID user)
Definition: path.c:473
static BOOL do_searchW(PCWSTR file, PWSTR buffer, BOOL recurse, PENUMDIRTREE_CALLBACKW cb, PVOID user)
Definition: path.c:221
static void file_pathW(const WCHAR *src, WCHAR *dst)
Definition: path.c:53
#define debugstr_guid
Definition: kernel32.h:35
#define debugstr_a
Definition: kernel32.h:31
const GUID * guid
static PVOID ptr
Definition: dispmode.c:27
static LPCWSTR file_name
Definition: protocol.c:147
DWORD dw1
Definition: path.c:462
DWORD dw2
Definition: path.c:463
WCHAR * search_path

Referenced by map_pdb_file(), and pe_load_dbg_file().

◆ pcs_callback()

BOOL pcs_callback ( const struct process pcs,
ULONG  action,
void data 
)

Definition at line 731 of file dbghelp.c.

732{
734
735 TRACE("%p %u %p\n", pcs, action, data);
736
737 if (!pcs->reg_cb) return FALSE;
738 if (!pcs->reg_is_unicode)
739 {
741
742 switch (action)
743 {
744 case CBA_DEBUG_INFO:
746 case CBA_SET_OPTIONS:
748 break;
753 idslW = data;
754 idsl.SizeOfStruct = sizeof(idsl);
755 idsl.BaseOfImage = idslW->BaseOfImage;
756 idsl.CheckSum = idslW->CheckSum;
757 idsl.TimeDateStamp = idslW->TimeDateStamp;
758 WideCharToMultiByte(CP_ACP, 0, idslW->FileName, -1,
759 idsl.FileName, sizeof(idsl.FileName), NULL, NULL);
760 idsl.Reparse = idslW->Reparse;
761 data = &idsl;
762 break;
764 case CBA_EVENT:
765 case CBA_READ_MEMORY:
766 default:
767 FIXME("No mapping for action %u\n", action);
768 return FALSE;
769 }
770 }
771 return pcs->reg_cb(pcs->handle, action, (ULONG64)(DWORD_PTR)data, pcs->reg_user);
772}
#define CBA_DUPLICATE_SYMBOL
Definition: compat.h:980
#define CBA_SYMBOLS_UNLOADED
Definition: compat.h:979
#define CBA_SET_OPTIONS
Definition: compat.h:983
#define CBA_DEFERRED_SYMBOL_LOAD_CANCEL
Definition: compat.h:982
#define CBA_DEBUG_INFO
Definition: compat.h:986
#define CBA_READ_MEMORY
Definition: compat.h:981
#define CBA_DEFERRED_SYMBOL_LOAD_PARTIAL
Definition: compat.h:985
#define CBA_EVENT
Definition: compat.h:984
const WCHAR * action
Definition: action.c:7509
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
unsigned __int64 ULONG64
Definition: imports.h:198
PSYMBOL_REGISTERED_CALLBACK64 reg_cb
BOOL reg_is_unicode
DWORD64 reg_user

Referenced by module_get_debug(), and SymSetOptions().

◆ pdb_fetch_file_info()

BOOL pdb_fetch_file_info ( const struct pdb_lookup pdb_lookup,
unsigned matched 
)

Definition at line 2913 of file msc.c.

2914{
2915 HANDLE hFile, hMap = NULL;
2916 char* image = NULL;
2917 BOOL ret;
2918 struct pdb_file_info pdb_file;
2919
2923 ((image = MapViewOfFile(hMap, FILE_MAP_READ, 0, 0, 0)) == NULL))
2924 {
2925 WARN("Unable to open .PDB file: %s\n", pdb_lookup->filename);
2926 ret = FALSE;
2927 }
2928 else
2929 {
2930 ret = pdb_init(pdb_lookup, &pdb_file, image, matched);
2931 pdb_free_file(&pdb_file);
2932 }
2933
2935 if (hMap) CloseHandle(hMap);
2937
2938 return ret;
2939}
#define WARN(fmt,...)
Definition: precomp.h:61
#define CloseHandle
Definition: compat.h:739
#define PAGE_READONLY
Definition: compat.h:138
#define UnmapViewOfFile
Definition: compat.h:746
#define OPEN_EXISTING
Definition: compat.h:775
#define CreateFileMappingW(a, b, c, d, e, f)
Definition: compat.h:744
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:740
#define GENERIC_READ
Definition: compat.h:135
#define FILE_MAP_READ
Definition: compat.h:776
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define MapViewOfFile
Definition: compat.h:745
#define FILE_SHARE_READ
Definition: compat.h:136
static void pdb_free_file(struct pdb_file_info *pdb_file)
Definition: msc.c:2269
static BOOL pdb_init(const struct pdb_lookup *pdb_lookup, struct pdb_file_info *pdb_file, const char *image, unsigned *matched)
Definition: msc.c:2539
_In_ HANDLE hFile
Definition: mswsock.h:90
HANDLE hMap
Definition: msc.c:64
const char * filename

Referenced by module_find_cb().

◆ pdb_virtual_unwind()

BOOL pdb_virtual_unwind ( struct cpu_stack_walk csw,
DWORD_PTR  ip,
union ctx context,
struct pdb_cmd_pair cpair 
)

Definition at line 3200 of file msc.c.

3202{
3203 struct module_pair pair;
3204 struct pdb_module_info* pdb_info;
3205 PDB_FPO_DATA* fpoext;
3206 unsigned i, size, strsize;
3207 char* strbase;
3208 BOOL ret = TRUE;
3209
3210 if (!(pair.pcs = process_find_by_handle(csw->hProcess)) ||
3211 !(pair.requested = module_find_by_addr(pair.pcs, ip, DMT_UNKNOWN)) ||
3213 return FALSE;
3214 if (!pair.effective->format_info[DFI_PDB]) return FALSE;
3215 pdb_info = pair.effective->format_info[DFI_PDB]->u.pdb_info;
3216 TRACE("searching %lx => %lx\n", ip, ip - (DWORD_PTR)pair.effective->module.BaseOfImage);
3217 ip -= (DWORD_PTR)pair.effective->module.BaseOfImage;
3218
3219 strbase = pdb_read_strings(&pdb_info->pdb_files[0]);
3220 if (!strbase) return FALSE;
3221 strsize = *(const DWORD*)(strbase + 8);
3222 fpoext = pdb_read_file(&pdb_info->pdb_files[0], pdb_info->pdb_files[0].fpoext_stream);
3223 size = pdb_get_file_size(&pdb_info->pdb_files[0], pdb_info->pdb_files[0].fpoext_stream);
3224 if (fpoext && (size % sizeof(*fpoext)) == 0)
3225 {
3226 size /= sizeof(*fpoext);
3227 for (i = 0; i < size; i++)
3228 {
3229 if (fpoext[i].start <= ip && ip < fpoext[i].start + fpoext[i].func_size)
3230 {
3231 TRACE("\t%08x %08x %8x %8x %4x %4x %4x %08x %s\n",
3232 fpoext[i].start, fpoext[i].func_size, fpoext[i].locals_size,
3233 fpoext[i].params_size, fpoext[i].maxstack_size, fpoext[i].prolog_size,
3234 fpoext[i].savedregs_size, fpoext[i].flags,
3235 fpoext[i].str_offset < strsize ?
3236 wine_dbgstr_a(strbase + 12 + fpoext[i].str_offset) : "<out of bounds>");
3237 if (fpoext[i].str_offset < strsize)
3238 ret = pdb_parse_cmd_string(csw, &fpoext[i], strbase + 12 + fpoext[i].str_offset, cpair);
3239 else
3240 ret = FALSE;
3241 break;
3242 }
3243 }
3244 }
3245 else ret = FALSE;
3246 pdb_free(fpoext);
3247 pdb_free(strbase);
3248
3249 return ret;
3250}
GLuint start
Definition: gl.h:1545
GLbitfield flags
Definition: glext.h:7161
static void * pdb_read_file(const struct pdb_file_info *pdb_file, DWORD file_nr)
Definition: msc.c:2239
static BOOL pdb_parse_cmd_string(struct cpu_stack_walk *csw, PDB_FPO_DATA *fpoext, const char *cmd, struct pdb_cmd_pair *cpair)
Definition: msc.c:3147
static void pdb_free(void *buffer)
Definition: msc.c:2264
static void * pdb_read_strings(const struct pdb_file_info *pdb_file)
Definition: msc.c:2337
static unsigned pdb_get_file_size(const struct pdb_file_info *pdb_file, DWORD file_nr)
Definition: msc.c:2254
const char int int int static __inline const char * wine_dbgstr_a(const char *s)
Definition: debug.h:187
struct pdb_file_info pdb_files[CV_MAX_MODULES]
Definition: msc.c:88

Referenced by fetch_next_frame32().

◆ pe_load_builtin_module()

struct module * pe_load_builtin_module ( struct process pcs,
const WCHAR name,
DWORD64  base,
DWORD64  size 
)

Definition at line 896 of file pe_module.c.

898{
899 struct module* module = NULL;
900
901 if (base && pcs->dbg_hdr_addr)
902 {
904
905 if (pe_load_nt_header(pcs->handle, base, &nth))
906 {
911 }
912 }
913 return module;
914}
struct module * module_new(struct process *pcs, const WCHAR *name, enum module_type type, BOOL virtual, DWORD64 addr, DWORD64 size, ULONG_PTR stamp, ULONG_PTR checksum) DECLSPEC_HIDDEN
Definition: module.c:198
BOOL pe_load_nt_header(HANDLE hProc, DWORD64 base, IMAGE_NT_HEADERS *nth)
Definition: pe_module.c:881
IMAGE_OPTIONAL_HEADER32 OptionalHeader
Definition: ntddk_ex.h:184
IMAGE_FILE_HEADER FileHeader
Definition: ntddk_ex.h:183

Referenced by SymLoadModuleExW().

◆ pe_load_debug_directory()

BOOL pe_load_debug_directory ( const struct process pcs,
struct module module,
const BYTE mapping,
const IMAGE_SECTION_HEADER sectp,
DWORD  nsect,
const IMAGE_DEBUG_DIRECTORY dbg,
int  nDbg 
)

Definition at line 3391 of file msc.c.

3395{
3396 BOOL ret;
3397 int i;
3398 struct msc_debug_info msc_dbg;
3399
3400 msc_dbg.module = module;
3401 msc_dbg.nsect = nsect;
3402 msc_dbg.sectp = sectp;
3403 msc_dbg.nomap = 0;
3404 msc_dbg.omapp = NULL;
3405
3406 __TRY
3407 {
3408 ret = FALSE;
3409
3410 /* First, watch out for OMAP data */
3411 for (i = 0; i < nDbg; i++)
3412 {
3414 {
3415 msc_dbg.nomap = dbg[i].SizeOfData / sizeof(OMAP_DATA);
3416 msc_dbg.omapp = (const OMAP_DATA*)(mapping + dbg[i].PointerToRawData);
3417 break;
3418 }
3419 }
3420
3421 /* Now, try to parse CodeView debug info */
3422 for (i = 0; i < nDbg; i++)
3423 {
3424 if (dbg[i].Type == IMAGE_DEBUG_TYPE_CODEVIEW)
3425 {
3426 msc_dbg.root = mapping + dbg[i].PointerToRawData;
3427 if ((ret = codeview_process_info(pcs, &msc_dbg))) goto done;
3428 }
3429 }
3430
3431 /* If not found, try to parse COFF debug info */
3432 for (i = 0; i < nDbg; i++)
3433 {
3434 if (dbg[i].Type == IMAGE_DEBUG_TYPE_COFF)
3435 {
3436 msc_dbg.root = mapping + dbg[i].PointerToRawData;
3437 if ((ret = coff_process_info(&msc_dbg))) goto done;
3438 }
3439 }
3440 done:
3441 /* FIXME: this should be supported... this is the debug information for
3442 * functions compiled without a frame pointer (FPO = frame pointer omission)
3443 * the associated data helps finding out the relevant information
3444 */
3445 for (i = 0; i < nDbg; i++)
3446 if (dbg[i].Type == IMAGE_DEBUG_TYPE_FPO)
3447 FIXME("This guy has FPO information\n");
3448#if 0
3449
3450#define FRAME_FPO 0
3451#define FRAME_TRAP 1
3452#define FRAME_TSS 2
3453
3454typedef struct _FPO_DATA
3455{
3456 DWORD ulOffStart; /* offset 1st byte of function code */
3457 DWORD cbProcSize; /* # bytes in function */
3458 DWORD cdwLocals; /* # bytes in locals/4 */
3459 WORD cdwParams; /* # bytes in params/4 */
3460
3461 WORD cbProlog : 8; /* # bytes in prolog */
3462 WORD cbRegs : 3; /* # regs saved */
3463 WORD fHasSEH : 1; /* TRUE if SEH in func */
3464 WORD fUseBP : 1; /* TRUE if EBP has been allocated */
3465 WORD reserved : 1; /* reserved for future use */
3466 WORD cbFrame : 2; /* frame type */
3467} FPO_DATA;
3468#endif
3469
3470 }
3472 {
3473 ERR("Got a page fault while loading symbols\n");
3474 ret = FALSE;
3475 }
3476 __ENDTRY
3477 return ret;
3478}
Type
Definition: Type.h:7
#define ERR(fmt,...)
Definition: precomp.h:57
DECLSPEC_HIDDEN BOOL coff_process_info(const struct msc_debug_info *msc_dbg)
Definition: coff.c:148
#define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC
Definition: compat.h:148
#define __TRY
Definition: compat.h:80
#define IMAGE_DEBUG_TYPE_FPO
Definition: compat.h:143
#define IMAGE_DEBUG_TYPE_CODEVIEW
Definition: compat.h:142
#define __ENDTRY
Definition: compat.h:82
#define __EXCEPT_PAGE_FAULT
Definition: compat.h:81
#define IMAGE_DEBUG_TYPE_COFF
Definition: compat.h:141
unsigned short WORD
Definition: ntddk_ex.h:93
GLenum GLenum GLenum GLenum mapping
Definition: glext.h:9031
static BOOL codeview_process_info(const struct process *pcs, const struct msc_debug_info *msc_dbg)
Definition: msc.c:3262
DWORD ulOffStart
Definition: winnt_old.h:3607
WORD cbFrame
Definition: winnt_old.h:3616
WORD cdwParams
Definition: winnt_old.h:3610
WORD fUseBP
Definition: winnt_old.h:3614
WORD fHasSEH
Definition: winnt_old.h:3613
WORD reserved
Definition: winnt_old.h:3615
WORD cbRegs
Definition: winnt_old.h:3612
WORD cbProlog
Definition: winnt_old.h:3611
DWORD cdwLocals
Definition: winnt_old.h:3609
DWORD cbProcSize
Definition: winnt_old.h:3608
const IMAGE_SECTION_HEADER * sectp
Definition: mscvpdb.h:2136
struct module * module
Definition: mscvpdb.h:2134
struct _FPO_DATA FPO_DATA

Referenced by pe_load_dbg_file(), and pe_load_msc_debug_info().

◆ pe_load_debug_info()

BOOL pe_load_debug_info ( const struct process pcs,
struct module module 
)

Definition at line 751 of file pe_module.c.

752{
753 BOOL ret = FALSE;
754
756 {
758 ret = pe_load_stabs(pcs, module) || ret;
760 #ifndef DBGHELP_STATIC_LIB
763 #endif
764
765 ret = ret || pe_load_coff_symbol_table(module); /* FIXME */
766 /* if we still have no debug info (we could only get SymExport at this
767 * point), then do the SymExport except if we have an ELF container,
768 * in which case we'll rely on the export's on the ELF side
769 */
770 }
771 /* FIXME shouldn't we check that? if (!module_get_debug(pcs, module)) */
773 ret = TRUE;
774
775 return ret;
776}
#define SYMOPT_PUBLICS_ONLY
Definition: compat.h:992
BOOL image_check_alternate(struct image_file_map *fmap, const struct module *module) DECLSPEC_HIDDEN
Definition: module.c:701
static BOOL pe_load_coff_symbol_table(struct module *module)
Definition: pe_module.c:420
static BOOL pe_load_dwarf(struct module *module)
Definition: pe_module.c:525
static BOOL pe_load_rsym(struct module *module)
Definition: pe_module.c:545
static BOOL pe_load_export_debug_info(const struct process *pcs, struct module *module)
Definition: pe_module.c:666
static BOOL pe_load_msc_debug_info(const struct process *pcs, struct module *module)
Definition: pe_module.c:618
static BOOL pe_load_stabs(const struct process *pcs, struct module *module)
Definition: pe_module.c:489

Referenced by module_get_debug(), and pe_load_native_module().

◆ pe_load_native_module()

struct module * pe_load_native_module ( struct process pcs,
const WCHAR name,
HANDLE  hFile,
DWORD64  base,
DWORD  size 
)

Definition at line 803 of file pe_module.c.

805{
806 struct module* module = NULL;
807 BOOL opened = FALSE;
808 struct module_format* modfmt;
809 WCHAR loaded_name[MAX_PATH];
810
811 loaded_name[0] = '\0';
812 if (!hFile)
813 {
814 assert(name);
815
816 if ((hFile = FindExecutableImageExW(name, pcs->search_path, loaded_name, NULL, NULL)) == NULL)
817 return NULL;
818 opened = TRUE;
819 }
820 else if (name) lstrcpyW(loaded_name, name);
822 FIXME("Trouble ahead (no module name passed in deferred mode)\n");
823 if (!(modfmt = HeapAlloc(GetProcessHeap(), 0, sizeof(struct module_format) + sizeof(struct pe_module_info))))
824 return NULL;
825 modfmt->u.pe_info = (struct pe_module_info*)(modfmt + 1);
826 if (pe_map_file(hFile, &modfmt->u.pe_info->fmap, DMT_PE))
827 {
828#ifndef __REACTOS__
829 struct builtin_search builtin = { NULL };
830 if (modfmt->u.pe_info->fmap.u.pe.builtin && search_dll_path(pcs, loaded_name, search_builtin_pe, &builtin))
831 {
832 TRACE("reloaded %s from %s\n", debugstr_w(loaded_name), debugstr_w(builtin.path));
833 image_unmap_file(&modfmt->u.pe_info->fmap);
834 modfmt->u.pe_info->fmap = builtin.fmap;
835 }
836#endif
837 if (!base) base = modfmt->u.pe_info->fmap.u.pe.ntheader.OptionalHeader.ImageBase;
838 if (!size) size = modfmt->u.pe_info->fmap.u.pe.ntheader.OptionalHeader.SizeOfImage;
839
840 module = module_new(pcs, loaded_name, DMT_PE, FALSE, base, size,
841 modfmt->u.pe_info->fmap.u.pe.ntheader.FileHeader.TimeDateStamp,
842 modfmt->u.pe_info->fmap.u.pe.ntheader.OptionalHeader.CheckSum);
843 if (module)
844 {
845#ifdef __REACTOS__
847#else
848 module->real_path = builtin.path;
849#endif
850 modfmt->module = module;
851 modfmt->remove = pe_module_remove;
852 modfmt->loc_compute = NULL;
853
854 module->format_info[DFI_PE] = modfmt;
857 else
859 module->reloc_delta = base - modfmt->u.pe_info->fmap.u.pe.ntheader.OptionalHeader.ImageBase;
860 }
861 else
862 {
863 ERR("could not load the module '%s'\n", debugstr_w(loaded_name));
864#ifndef __REACTOS__
865 heap_free(builtin.path);
866#endif
867 image_unmap_file(&modfmt->u.pe_info->fmap);
868 }
869 }
870 if (!module) HeapFree(GetProcessHeap(), 0, modfmt);
871
872 if (opened) CloseHandle(hFile);
873
874 return module;
875}
BOOL search_dll_path(const struct process *process, const WCHAR *name, BOOL(*match)(void *, HANDLE, const WCHAR *), void *param) DECLSPEC_HIDDEN
Definition: path.c:697
#define FindExecutableImageExW
Definition: compat.h:1141
#define SYMOPT_DEFERRED_LOADS
Definition: compat.h:989
static void image_unmap_file(struct image_file_map *fmap)
BOOL pe_map_file(HANDLE file, struct image_file_map *fmap, enum module_type mt)
Definition: pe_module.c:245
BOOL pe_load_debug_info(const struct process *pcs, struct module *module)
Definition: pe_module.c:751
static void pe_module_remove(struct process *pcs, struct module_format *modfmt)
Definition: pe_module.c:345
static BOOL search_builtin_pe(void *param, HANDLE handle, const WCHAR *path)
Definition: pe_module.c:785
WCHAR * path
Definition: pe_module.c:781
struct image_file_map fmap
Definition: pe_module.c:782
struct pe_module_info * pe_info

Referenced by SymLoadModuleExW().

◆ pe_load_nt_header()

BOOL pe_load_nt_header ( HANDLE  hProc,
DWORD64  base,
IMAGE_NT_HEADERS nth 
)

Definition at line 881 of file pe_module.c.

882{
884
885 return ReadProcessMemory(hProc, (char*)(DWORD_PTR)base, &dos, sizeof(dos), NULL) &&
887 ReadProcessMemory(hProc, (char*)(DWORD_PTR)(base + dos.e_lfanew),
888 nth, sizeof(*nth), NULL) &&
890}
#define ReadProcessMemory(a, b, c, d, e)
Definition: compat.h:758
IMAGE_DOS_HEADER dos
Definition: module.c:49
#define IMAGE_NT_SIGNATURE
Definition: pedump.c:93
#define IMAGE_DOS_SIGNATURE
Definition: pedump.c:89

Referenced by fetch_pe_module_info_cb(), and pe_load_builtin_module().

◆ pe_map_directory()

const char * pe_map_directory ( struct module module,
int  dirno,
DWORD size 
)

Definition at line 331 of file pe_module.c.

332{
333 IMAGE_NT_HEADERS* nth;
334 void* mapping;
335
336 if (module->type != DMT_PE || !module->format_info[DFI_PE]) return NULL;
338 !(mapping = pe_map_full(&module->format_info[DFI_PE]->u.pe_info->fmap, &nth)))
339 return NULL;
340 if (size) *size = nth->OptionalHeader.DataDirectory[dirno].Size;
341 return RtlImageRvaToVa(nth, mapping,
343}
#define RtlImageRvaToVa
Definition: compat.h:807
#define IMAGE_NUMBEROF_DIRECTORY_ENTRIES
Definition: ntddk_ex.h:135
static void * pe_map_full(struct image_file_map *fmap, IMAGE_NT_HEADERS **nth)
Definition: pe_module.c:50
IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]
Definition: ntddk_ex.h:178

Referenced by x86_64_fetch_minidump_module(), and x86_64_find_runtime_function().

◆ pool_alloc()

void * pool_alloc ( struct pool a,
size_t  len 
)

Definition at line 89 of file storage.c.

90{
91 struct pool_arena* arena;
92 void* ret;
93 size_t size;
94
95 len = (len + 3) & ~3; /* round up size on DWORD boundary */
96
98 {
99 if (arena->end - arena->current >= len)
100 {
101 ret = arena->current;
102 arena->current += len;
103 if (arena->current + 16 >= arena->end)
104 {
105 list_remove( &arena->entry );
106 list_add_tail( &pool->arena_full, &arena->entry );
107 }
108 return ret;
109 }
110 }
111
112 size = max( pool->arena_size, len );
113 arena = HeapAlloc(GetProcessHeap(), 0, size + sizeof(struct pool_arena));
114 if (!arena) return NULL;
115
116 ret = arena + 1;
117 arena->current = (char*)ret + len;
118 arena->end = (char*)ret + size;
119 if (arena->current + 16 >= arena->end)
120 list_add_tail( &pool->arena_full, &arena->entry );
121 else
122 list_add_head( &pool->arena_list, &arena->entry );
123 return ret;
124}
static void list_remove(struct list_entry *entry)
Definition: list.h:90
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
Definition: list.h:83
static void list_add_head(struct list_entry *head, struct list_entry *entry)
Definition: list.h:76
uint32_t entry
Definition: isohybrid.c:63
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
struct list entry
Definition: storage.c:38
char * current
Definition: storage.c:39
char * end
Definition: storage.c:40
struct list arena_list
size_t arena_size
struct list arena_full

Referenced by dwarf2_compute_location_attr(), dwarf2_get_cpp_name(), dwarf2_parse_abbrev_set(), dwarf2_parse_line_numbers(), dwarf2_parse_variable(), dwarf2_read_one_debug_info(), elf_hash_symtab(), hash_table_add(), macho_stabs_def_cb(), pev_set_value(), pool_strdup(), source_new(), symt_add_enum_element(), symt_add_func_local(), symt_add_function_point(), symt_add_function_signature_parameter(), symt_add_udt_element(), symt_new_array(), symt_new_basic(), symt_new_compiland(), symt_new_constant(), symt_new_enum(), symt_new_function(), symt_new_function_signature(), symt_new_global_variable(), symt_new_label(), symt_new_pointer(), symt_new_public(), symt_new_thunk(), symt_new_typedef(), symt_new_udt(), symt_open_func_block(), symt_ptr2index(), and vector_add().

◆ pool_destroy()

void pool_destroy ( struct pool a)

Definition at line 50 of file storage.c.

51{
52 struct pool_arena* arena;
53 struct pool_arena* next;
54
55#ifdef USE_STATS
56 size_t alloc, used, num;
57
58 alloc = used = num = 0;
60 {
61 alloc += arena->end - (char *)arena;
62 used += arena->current - (char*)arena;
63 num++;
64 }
66 {
67 alloc += arena->end - (char *)arena;
68 used += arena->current - (char*)arena;
69 num++;
70 }
71 if (alloc == 0) alloc = 1; /* avoid division by zero */
72 FIXME("STATS: pool %p has allocated %u kbytes, used %u kbytes in %u arenas, non-allocation ratio: %.2f%%\n",
73 pool, (unsigned)(alloc >> 10), (unsigned)(used >> 10), (unsigned)num,
74 100.0 - (float)used / (float)alloc * 100.0);
75#endif
76
78 {
79 list_remove( &arena->entry );
80 HeapFree(GetProcessHeap(), 0, arena);
81 }
83 {
84 list_remove( &arena->entry );
85 HeapFree(GetProcessHeap(), 0, arena);
86 }
87}
static int used
Definition: adh-main.c:39
GLuint GLuint num
Definition: glext.h:9618
static unsigned __int64 next
Definition: rand_nt.c:6
#define alloc
Definition: rosglue.h:13
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204

Referenced by dwarf2_parse_compilation_unit(), elf_load_debug_info(), macho_load_debug_info(), module_remove(), pev_free(), and rsym_parse().

◆ pool_init()

void pool_init ( struct pool a,
size_t  arena_size 
)

Definition at line 43 of file storage.c.

44{
45 list_init( &a->arena_list );
46 list_init( &a->arena_full );
47 a->arena_size = arena_size;
48}
static void list_init(struct list_entry *head)
Definition: list.h:51
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204

Referenced by dwarf2_parse_compilation_unit(), elf_load_debug_info(), macho_load_debug_info(), module_new(), pev_init(), and rsym_parse().

◆ pool_strdup()

◆ process_find_by_handle()

◆ process_getenv()

const WCHAR * process_getenv ( const struct process process,
const WCHAR name 
)

Definition at line 335 of file dbghelp.c.

336{
337 size_t name_len;
338 const WCHAR *iter;
339
340 if (!process->environment) return NULL;
341 name_len = lstrlenW(name);
342
343 for (iter = process->environment; *iter; iter += lstrlenW(iter) + 1)
344 {
345 if (!wcsnicmp(iter, name, name_len) && iter[name_len] == '=')
346 return iter + name_len + 1;
347 }
348
349 return NULL;
350}
#define wcsnicmp
Definition: compat.h:14
WCHAR * environment

Referenced by elf_search_and_load_file(), macho_search_and_load_file(), and search_dll_path().

◆ read_process_memory()

static BOOL read_process_memory ( const struct process process,
UINT64  addr,
void buf,
size_t  size 
)
inlinestatic

Definition at line 451 of file dbghelp_private.h.

452{
454}
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274

Referenced by check_live_target(), dump_memory64_info(), dump_memory_info(), elf_enum_modules_internal(), image_uses_split_segs(), macho_enum_modules_internal(), macho_search_loader(), and x86_64_fetch_minidump_module().

◆ rsym_parse()

BOOL rsym_parse ( struct module module,
unsigned long  load_offset,
const void rsym,
int  rsymlen 
)

Definition at line 79 of file rsym.c.

81{
82 const ROSSYM_HEADER* RosSymHeader;
83 const ROSSYM_ENTRY* First, *Last, *Entry;
84 const CHAR* Strings;
85
86 struct pool pool;
87 struct sparse_array file_table, func_table;
88 rsym_func_entry_t* first_func = NULL;
89
90
91 RosSymHeader = rsym_ptr;
92
93 if (RosSymHeader->SymbolsOffset < sizeof(ROSSYM_HEADER)
94 || RosSymHeader->StringsOffset < RosSymHeader->SymbolsOffset + RosSymHeader->SymbolsLength
95 || rsymlen < RosSymHeader->StringsOffset + RosSymHeader->StringsLength
96 || 0 != (RosSymHeader->SymbolsLength % sizeof(ROSSYM_ENTRY)))
97 {
98 WARN("Invalid ROSSYM_HEADER\n");
99 return FALSE;
100 }
101
102 First = (const ROSSYM_ENTRY *)((const char*)rsym_ptr + RosSymHeader->SymbolsOffset);
103 Last = First + RosSymHeader->SymbolsLength / sizeof(ROSSYM_ENTRY);
104 Strings = (const CHAR*)rsym_ptr + RosSymHeader->StringsOffset;
105
106 pool_init(&pool, 65536);
107 sparse_array_init(&file_table, sizeof(rsym_file_entry_t), 64);
108 sparse_array_init(&func_table, sizeof(rsym_func_entry_t), 128);
109
110 for (Entry = First; Entry != Last; Entry++)
111 {
112 ULONG Address = load_offset + Entry->Address;
113 if (!Entry->FileOffset)
114 {
115 rsym_func_entry_t* func = sparse_array_find(&func_table, Entry->FunctionOffset);
116
117 /* We do not want to define a data point where there is already a function! */
118 if (!func || func->Address != Address)
119 {
120 const char* SymbolName = Strings + Entry->FunctionOffset;
121 if (!is_metadata_sym(SymbolName))
122 {
123 /* TODO: How should we determine the size? */
124 ULONG Size = sizeof(ULONG);
125 if (use_raw_address(SymbolName))
126 Address = Entry->Address;
127
128 symt_new_public(module, NULL, SymbolName, FALSE, Address, Size);
129 }
130 else
131 {
132 /* Maybe use it to fill some metadata? */
133 }
134 }
135 }
136 else
137 {
138 rsym_file_entry_t* file = sparse_array_find(&file_table, Entry->FileOffset);
139 rsym_func_entry_t* func = sparse_array_find(&func_table, Entry->FunctionOffset);
140
141 if (!file)
142 {
143 file = sparse_array_add(&file_table, Entry->FileOffset, &pool);
144 file->File = Strings + Entry->FileOffset;
145 file->Source = source_new(module, NULL, Strings + Entry->FileOffset);
146 }
147
148 if (!func)
149 {
150 func = sparse_array_add(&func_table, Entry->FunctionOffset, &pool);
151 func->func = symt_new_function(module, NULL, Strings + Entry->FunctionOffset,
152 Address, 0, NULL);
153 func->Address = Address;
154 func->next = first_func;
155 first_func = func;
156 }
157
158 /* TODO: What if we have multiple chunks scattered around? */
159 symt_add_func_line(module, func->func, file->Source, Entry->SourceLine, Address - func->Address);
160 }
161 }
162
163 while (first_func)
164 {
165 /* TODO: Size of function? */
166 rsym_finalize_function(module, first_func->func);
167 first_func = first_func->next;
168 }
169
171 module->module.CVSig = 'R' | ('S' << 8) | ('Y' << 16) | ('M' << 24);
177
179
180 return TRUE;
181}
WCHAR First[]
Definition: FormatMessage.c:11
struct symt_function * symt_new_function(struct module *module, struct symt_compiland *parent, const char *name, ULONG_PTR addr, ULONG_PTR size, struct symt *type) DECLSPEC_HIDDEN
Definition: symbol.c:293
void sparse_array_init(struct sparse_array *sa, unsigned elt_sz, unsigned bucket_sz) DECLSPEC_HIDDEN
Definition: storage.c:213
unsigned source_new(struct module *module, const char *basedir, const char *source) DECLSPEC_HIDDEN
Definition: source.c:66
struct symt_public * symt_new_public(struct module *module, struct symt_compiland *parent, const char *typename, BOOL is_function, ULONG_PTR address, unsigned size) DECLSPEC_HIDDEN
Definition: symbol.c:224
void * sparse_array_add(struct sparse_array *sa, ULONG_PTR key, struct pool *pool) DECLSPEC_HIDDEN
Definition: storage.c:281
void * sparse_array_find(const struct sparse_array *sa, ULONG_PTR idx) DECLSPEC_HIDDEN
Definition: storage.c:271
void symt_add_func_line(struct module *module, struct symt_function *func, unsigned source_idx, int line_num, ULONG_PTR offset) DECLSPEC_HIDDEN
Definition: symbol.c:326
static const WCHAR Strings[]
Definition: reg.c:35
static int use_raw_address(const char *name)
Definition: rsym.c:64
static int is_metadata_sym(const char *name)
Definition: rsym.c:58
static void rsym_finalize_function(struct module *module, struct symt_function *func)
Definition: rsym.c:37
GLenum func
Definition: glext.h:6028
static WCHAR Address[46]
Definition: ping.c:68
struct _ROSSYM_ENTRY ROSSYM_ENTRY
base of all file and directory entries
Definition: entries.h:83
Definition: rossym.h:26
unsigned long SymbolsOffset
Definition: rossym.h:20
unsigned long SymbolsLength
Definition: rossym.h:21
unsigned long StringsLength
Definition: rossym.h:23
unsigned long StringsOffset
Definition: rossym.h:22
Definition: fci.c:127
Definition: rsym.c:16
Definition: rsym.c:22
uint32_t ULONG
Definition: typedefs.h:59
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
char CHAR
Definition: xmlstorage.h:175

Referenced by pe_load_rsym().

◆ search_dll_path()

BOOL search_dll_path ( const struct process process,
const WCHAR name,
BOOL(*)(void *, HANDLE, const WCHAR *)  match,
void param 
)

Definition at line 697 of file path.c.

698{
699 const WCHAR *env;
700 size_t len, i;
701 HANDLE file;
702 WCHAR *buf;
703 BOOL ret;
704
706
707 if ((env = process_getenv(process, L"WINEBUILDDIR")))
708 {
709 WCHAR *p, *end;
710 const WCHAR dllsW[] = { '\\','d','l','l','s','\\' };
711 const WCHAR programsW[] = { '\\','p','r','o','g','r','a','m','s','\\' };
712 const WCHAR dot_dllW[] = {'.','d','l','l',0};
713 const WCHAR dot_exeW[] = {'.','e','x','e',0};
714 const WCHAR dot_soW[] = {'.','s','o',0};
715
716
717 len = lstrlenW(env);
718 if (!(buf = heap_alloc((len + 8 + 3 * lstrlenW(name)) * sizeof(WCHAR)))) return FALSE;
719 wcscpy(buf, env);
720 end = buf + len;
721
722 memcpy(end, dllsW, sizeof(dllsW));
723 lstrcpyW(end + ARRAY_SIZE(dllsW), name);
724 if ((p = wcsrchr(end, '.')) && !lstrcmpW(p, dot_soW)) *p = 0;
725 if ((p = wcsrchr(end, '.')) && !lstrcmpW(p, dot_dllW)) *p = 0;
726 p = end + lstrlenW(end);
727 *p++ = '\\';
728 lstrcpyW(p, name);
731 {
732 ret = match(param, file, buf);
734 if (ret) goto found;
735 }
736
737 memcpy(end, programsW, sizeof(programsW));
738 end += ARRAY_SIZE(programsW);
739 lstrcpyW(end, name);
740 if ((p = wcsrchr(end, '.')) && !lstrcmpW(p, dot_soW)) *p = 0;
741 if ((p = wcsrchr(end, '.')) && !lstrcmpW(p, dot_exeW)) *p = 0;
742 p = end + lstrlenW(end);
743 *p++ = '\\';
744 lstrcpyW(p, name);
747 {
748 ret = match(param, file, buf);
750 if (ret) goto found;
751 }
752
753 heap_free(buf);
754 }
755
756 for (i = 0;; i++)
757 {
758 WCHAR env_name[64];
759 swprintf(env_name, ARRAY_SIZE(env_name), L"WINEDLLDIR%u", i);
760 if (!(env = process_getenv(process, env_name))) return FALSE;
761 len = wcslen(env) + wcslen(name) + 2;
762 if (!(buf = heap_alloc(len * sizeof(WCHAR)))) return FALSE;
763 swprintf(buf, len, L"%s\\%s", env, name);
766 {
767 ret = match(param, file, buf);
769 if (ret) goto found;
770 }
771 heap_free(buf);
772 }
773
774 return FALSE;
775
776found:
777 TRACE("found %s\n", debugstr_w(buf));
778 heap_free(buf);
779 return TRUE;
780}
#define wcsrchr
Definition: compat.h:16
#define CreateFileW
Definition: compat.h:741
const WCHAR * process_getenv(const struct process *process, const WCHAR *name)
Definition: dbghelp.c:335
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4243
#define swprintf
Definition: precomp.h:40
GLfloat param
Definition: glext.h:5796
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define L(x)
Definition: ntvdm.h:50
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
Definition: match.c:28

Referenced by elf_search_and_load_file(), macho_search_and_load_file(), and pe_load_native_module().

◆ search_unix_path()

BOOL search_unix_path ( const WCHAR name,
const WCHAR path,
BOOL(*)(void *, HANDLE, const WCHAR *)  match,
void param 
)

Definition at line 782 of file path.c.

783{
784 const WCHAR *iter, *next;
785 size_t size, len;
786 WCHAR *dos_path;
787 char *buf;
788 BOOL ret = FALSE;
789
790 if (!path) return FALSE;
792
795 if (!(buf = heap_alloc(size))) return FALSE;
796
797 for (iter = path;; iter = next + 1)
798 {
799 if (!(next = wcschr(iter, ':'))) next = iter + lstrlenW(iter);
800 if (*iter == '/')
801 {
802 len = WideCharToMultiByte(CP_UNIXCP, 0, iter, next - iter, buf, size, NULL, NULL);
803 if (buf[len - 1] != '/') buf[len++] = '/';
805 if ((dos_path = wine_get_dos_file_name(buf)))
806 {
809 {
810 ret = match(param, file, dos_path);
812 if (ret) TRACE("found %s\n", debugstr_w(dos_path));
813 }
814 heap_free(dos_path);
815 if (ret) break;
816 }
817 }
818 if (*next != ':') break;
819 }
820
821 heap_free(buf);
822 return ret;
823}

Referenced by elf_search_and_load_file(), and macho_search_and_load_file().

◆ source_get()

const char * source_get ( const struct module module,
unsigned  idx 
)

◆ source_new()

unsigned source_new ( struct module module,
const char basedir,
const char source 
)

Definition at line 66 of file source.c.

67{
68 unsigned ret = -1;
69 const char* full;
70 char* tmp = NULL;
71
72 if (!name) return ret;
73 if (!base || *name == '/')
74 full = name;
75 else
76 {
77 unsigned bsz = strlen(base);
78
79 tmp = HeapAlloc(GetProcessHeap(), 0, bsz + 1 + strlen(name) + 1);
80 if (!tmp) return ret;
81 full = tmp;
82 strcpy(tmp, base);
83 if (tmp[bsz - 1] != '/') tmp[bsz++] = '/';
84 strcpy(&tmp[bsz], name);
85 }
87 if (!module->sources || (ret = source_find(full)) == (unsigned)-1)
88 {
89 char* new;
90 int len = strlen(full) + 1;
91 struct source_rb* rb;
92
94 {
95 if (!module->sources)
96 {
97 module->sources_alloc = (module->sources_used + len + 1 + 255) & ~255;
99 }
100 else
101 {
103 (module->sources_used + len + 1 + 255) & ~255 );
106 }
107 if (!new) goto done;
108 module->sources = new;
109 }
114 if ((rb = pool_alloc(&module->pool, sizeof(*rb))))
115 {
116 rb->source = ret;
118 }
119 }
120done:
121 HeapFree(GetProcessHeap(), 0, tmp);
122 return ret;
123}
void * pool_alloc(struct pool *a, size_t len) DECLSPEC_HIDDEN
Definition: storage.c:89
static struct module * rb_module
Definition: source.c:33
static unsigned source_find(const char *name)
Definition: source.c:52
static int wine_rb_put(struct wine_rb_tree *tree, const void *key, struct wine_rb_entry *entry)
Definition: rbtree.h:215
unsigned source
Definition: source.c:37
struct wine_rb_entry entry
Definition: source.c:36

Referenced by codeview_snarf(), codeview_snarf_linetab(), codeview_snarf_linetab2(), coff_add_file(), dwarf2_parse_compilation_unit(), dwarf2_parse_line_numbers(), elf_hash_symtab(), pe_load_coff_symbol_table(), rsym_parse(), and stabs_parse().

◆ source_rb_compare()

int source_rb_compare ( const void key,
const struct wine_rb_entry entry 
)

Definition at line 40 of file source.c.

41{
42 const struct source_rb *t = WINE_RB_ENTRY_VALUE(entry, const struct source_rb, entry);
43
44 return strcmp((const char*)key, rb_module->sources + t->source);
45}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
GLdouble GLdouble t
Definition: gl.h:2047
#define WINE_RB_ENTRY_VALUE(element, type, field)
Definition: rbtree.h:31
Definition: copy.c:22

Referenced by module_new().

◆ sparse_array_add()

void * sparse_array_add ( struct sparse_array sa,
ULONG_PTR  key,
struct pool pool 
)

Definition at line 281 of file storage.c.

283{
284 unsigned idx, i;
285 struct key2index* pk2i;
286 struct key2index* to;
287
288 pk2i = sparse_array_lookup(sa, key, &idx);
289 if (pk2i && pk2i->key == key)
290 {
291 FIXME("re-adding an existing key\n");
292 return NULL;
293 }
294 to = vector_add(&sa->key2index, pool);
295 if (pk2i)
296 {
297 /* we need to shift vector's content... */
298 /* let's do it brute force... (FIXME) */
299 assert(sa->key2index.num_elts >= 2);
300 for (i = sa->key2index.num_elts - 1; i > idx; i--)
301 {
302 pk2i = vector_at(&sa->key2index, i - 1);
303 *to = *pk2i;
304 to = pk2i;
305 }
306 }
307
308 to->key = key;
309 to->index = sa->elements.num_elts;
310
311 return vector_add(&sa->elements, pool);
312}
static struct sockaddr_in sa
Definition: adnsresfilter.c:69
void * vector_at(const struct vector *v, unsigned pos)
Definition: storage.c:162
static struct key2index * sparse_array_lookup(const struct sparse_array *sa, ULONG_PTR key, unsigned *idx)
Definition: storage.c:224
void * vector_add(struct vector *v, struct pool *pool)
Definition: storage.c:171
unsigned index
Definition: storage.c:210
ULONG_PTR key
Definition: storage.c:209

Referenced by dwarf2_parse_abbrev_set(), dwarf2_read_one_debug_info(), and rsym_parse().

◆ sparse_array_find()

void * sparse_array_find ( const struct sparse_array sa,
ULONG_PTR  idx 
)

Definition at line 271 of file storage.c.

272{
273 unsigned idx;
274 struct key2index* pk2i;
275
276 if ((pk2i = sparse_array_lookup(sa, key, &idx)) && pk2i->key == key)
277 return vector_at(&sa->elements, pk2i->index);
278 return NULL;
279}

Referenced by dwarf2_abbrev_table_find_entry(), dwarf2_find_attribute(), dwarf2_get_cpp_name(), dwarf2_get_di_children(), dwarf2_lookup_type(), and rsym_parse().

◆ sparse_array_init()

void sparse_array_init ( struct sparse_array sa,
unsigned  elt_sz,
unsigned  bucket_sz 
)

Definition at line 213 of file storage.c.

214{
215 vector_init(&sa->key2index, sizeof(struct key2index), bucket_sz);
216 vector_init(&sa->elements, elt_sz, bucket_sz);
217}
void vector_init(struct vector *v, unsigned esz, unsigned bucket_sz)
Definition: storage.c:133

Referenced by dwarf2_parse_abbrev_set(), dwarf2_parse_compilation_unit(), and rsym_parse().

◆ sparse_array_length()

unsigned sparse_array_length ( const struct sparse_array sa)

Definition at line 314 of file storage.c.

315{
316 return sa->elements.num_elts;
317}

Referenced by dwarf2_parse_abbrev_set().

◆ stabs_parse()

BOOL stabs_parse ( struct module module,
ULONG_PTR  load_offset,
const char stabs,
size_t  nstab,
size_t  stabsize,
const char strs,
int  strtablen,
stabs_def_cb  callback,
void user 
)

Definition at line 1241 of file stabs.c.

1245{
1246 struct symt_function* curr_func = NULL;
1247 struct symt_block* block = NULL;
1248 struct symt_compiland* compiland = NULL;
1249 char* srcpath = NULL;
1250 int i;
1251 const char* ptr;
1252 char* stabbuff;
1253 unsigned int stabbufflen;
1254 const struct stab_nlist* stab_ptr;
1255 const char* strs_end;
1256 int strtabinc;
1257 char symname[4096];
1258 unsigned incl[32];
1259 int incl_stk = -1;
1260 int source_idx = -1;
1261 struct pending_list pending_block;
1262 struct pending_list pending_func;
1263 BOOL ret = TRUE;
1264 struct location loc;
1265 unsigned char type;
1266 uint64_t n_value;
1267
1268 strs_end = strs + strtablen;
1269
1270 memset(stabs_basic, 0, sizeof(stabs_basic));
1271 memset(&pending_block, 0, sizeof(pending_block));
1272 memset(&pending_func, 0, sizeof(pending_func));
1273
1274 /*
1275 * Allocate a buffer into which we can build stab strings for cases
1276 * where the stab is continued over multiple lines.
1277 */
1278 stabbufflen = 65536;
1279 stabbuff = HeapAlloc(GetProcessHeap(), 0, stabbufflen);
1280
1281 strtabinc = 0;
1282 stabbuff[0] = '\0';
1283 for (i = 0; i < nstab; i++)
1284 {
1285 stab_ptr = (struct stab_nlist *)(pv_stab_ptr + i * stabsize);
1286 n_value = stabsize == sizeof(struct macho64_nlist) ? ((struct macho64_nlist *)stab_ptr)->n_value : stab_ptr->n_value;
1287 ptr = strs + stab_ptr->n_strx;
1288 if ((ptr > strs_end) || (ptr + strlen(ptr) > strs_end))
1289 {
1290 WARN("Bad stabs string %p\n", ptr);
1291 continue;
1292 }
1293 if (*ptr != '\0' && (ptr[strlen(ptr) - 1] == '\\'))
1294 {
1295 /*
1296 * Indicates continuation. Append this to the buffer, and go onto the
1297 * next record. Repeat the process until we find a stab without the
1298 * '/' character, as this indicates we have the whole thing.
1299 */
1300 stabbuf_append(&stabbuff, &stabbufflen, ptr);
1301 continue;
1302 }
1303 else if (stabbuff[0] != '\0')
1304 {
1305 stabbuf_append(&stabbuff, &stabbufflen, ptr);
1306 ptr = stabbuff;
1307 }
1308
1309 if (stab_ptr->n_type & N_STAB)
1310 type = stab_ptr->n_type;
1311 else
1312 {
1313 type = (stab_ptr->n_type & N_TYPE);
1314 if (module->type == DMT_MACHO) type &= ~N_PEXT;
1315 }
1316
1317 /* only symbol entries contain a typedef */
1318 switch (type)
1319 {
1320 case N_GSYM:
1321 case N_LCSYM:
1322 case N_STSYM:
1323 case N_RSYM:
1324 case N_LSYM:
1325 case N_ROSYM:
1326 case N_PSYM:
1327 if (strchr(ptr, '=') != NULL)
1328 {
1329 /*
1330 * The stabs aren't in writable memory, so copy it over so we are
1331 * sure we can scribble on it.
1332 */
1333 if (ptr != stabbuff)
1334 {
1335 stabbuff[0] = 0;
1336 stabbuf_append(&stabbuff, &stabbufflen, ptr);
1337 ptr = stabbuff;
1338 }
1339 stab_strcpy(symname, sizeof(symname), ptr);
1340 if (!stabs_parse_typedef(module, ptr, symname))
1341 {
1342 /* skip this definition */
1343 stabbuff[0] = '\0';
1344 continue;
1345 }
1346 }
1347 }
1348
1349 switch (type)
1350 {
1351 case N_GSYM:
1352 /*
1353 * These are useless with ELF. They have no value, and you have to
1354 * read the normal symbol table to get the address. Thus we
1355 * ignore them, and when we process the normal symbol table
1356 * we should do the right thing.
1357 *
1358 * With a.out or mingw, they actually do make some amount of sense.
1359 */
1360 stab_strcpy(symname, sizeof(symname), ptr);
1361 loc.kind = loc_absolute;
1362 loc.reg = 0;
1363 loc.offset = load_offset + n_value;
1364 symt_new_global_variable(module, compiland, symname, TRUE /* FIXME */,
1365 loc, 0, stabs_parse_type(ptr));
1366 break;
1367 case N_LCSYM:
1368 case N_STSYM:
1369 /* These are static symbols and BSS symbols. */
1370 stab_strcpy(symname, sizeof(symname), ptr);
1371 loc.kind = loc_absolute;
1372 loc.reg = 0;
1373 loc.offset = load_offset + n_value;
1374 symt_new_global_variable(module, compiland, symname, TRUE /* FIXME */,
1375 loc, 0, stabs_parse_type(ptr));
1376 break;
1377 case N_LBRAC:
1378 if (curr_func)
1379 {
1380 block = symt_open_func_block(module, curr_func, block,
1381 n_value, 0);
1382 pending_flush(&pending_block, module, curr_func, block);
1383 }
1384 break;
1385 case N_RBRAC:
1386 if (curr_func)
1388 n_value);
1389 break;
1390 case N_PSYM:
1391 /* These are function parameters. */
1392 if (curr_func != NULL)
1393 {
1394 struct symt* param_type = stabs_parse_type(ptr);
1395 stab_strcpy(symname, sizeof(symname), ptr);
1396 loc.kind = loc_regrel;
1397 loc.reg = dbghelp_current_cpu->frame_regno;
1398 loc.offset = n_value;
1399 symt_add_func_local(module, curr_func,
1400 (int)n_value >= 0 ? DataIsParam : DataIsLocal,
1401 &loc, NULL, param_type, symname);
1403 (struct symt_function_signature*)curr_func->type,
1404 param_type);
1405 }
1406 break;
1407 case N_RSYM:
1408 /* These are registers (as local variables) */
1409 if (curr_func != NULL)
1410 {
1411 loc.kind = loc_register;
1412 loc.offset = 0;
1413
1414 switch (n_value)
1415 {
1416 case 0: loc.reg = CV_REG_EAX; break;
1417 case 1: loc.reg = CV_REG_ECX; break;
1418 case 2: loc.reg = CV_REG_EDX; break;
1419 case 3: loc.reg = CV_REG_EBX; break;
1420 case 4: loc.reg = CV_REG_ESP; break;
1421 case 5: loc.reg = CV_REG_EBP; break;
1422 case 6: loc.reg = CV_REG_ESI; break;
1423 case 7: loc.reg = CV_REG_EDI; break;
1424 case 11:
1425 case 12:
1426 case 13:
1427 case 14:
1428 case 15:
1429 case 16:
1430 case 17:
1431 case 18:
1432 case 19: loc.reg = CV_REG_ST0 + n_value - 12; break;
1433 case 21:
1434 case 22:
1435 case 23:
1436 case 24:
1437 case 25:
1438 case 26:
1439 case 27:
1440 case 28: loc.reg = CV_REG_XMM0 + n_value - 21; break;
1441 case 29:
1442 case 30:
1443 case 31:
1444 case 32:
1445 case 33:
1446 case 34:
1447 case 35:
1448 case 36: loc.reg = CV_REG_MM0 + n_value - 29; break;
1449 default:
1450 FIXME("Unknown register value (%lu)\n", (ULONG_PTR)n_value);
1451 loc.reg = CV_REG_NONE;
1452 break;
1453 }
1454 stab_strcpy(symname, sizeof(symname), ptr);
1455 if (ptr[strlen(symname) + 1] == 'P')
1456 {
1457 struct symt* param_type = stabs_parse_type(ptr);
1458 stab_strcpy(symname, sizeof(symname), ptr);
1459 symt_add_func_local(module, curr_func, DataIsParam, &loc,
1460 NULL, param_type, symname);
1462 (struct symt_function_signature*)curr_func->type,
1463 param_type);
1464 }
1465 else
1466 pending_add_var(&pending_block, ptr, DataIsLocal, &loc);
1467 }
1468 break;
1469 case N_LSYM:
1470 /* These are local variables */
1471 loc.kind = loc_regrel;
1472 loc.reg = dbghelp_current_cpu->frame_regno;
1473 loc.offset = n_value;
1474 if (curr_func != NULL) pending_add_var(&pending_block, ptr, DataIsLocal, &loc);
1475 break;
1476 case N_SLINE:
1477 /*
1478 * This is a line number. These are always relative to the start
1479 * of the function (N_FUN), and this makes the lookup easier.
1480 */
1481 assert(source_idx >= 0);
1482 if (curr_func != NULL)
1483 {
1484 ULONG_PTR offset = n_value;
1485 if (module->type == DMT_MACHO)
1486 offset -= curr_func->address - load_offset;
1487 symt_add_func_line(module, curr_func, source_idx,
1488 stab_ptr->n_desc, offset);
1489 }
1490 else pending_add_line(&pending_func, source_idx, stab_ptr->n_desc,
1491 n_value, load_offset);
1492 break;
1493 case N_FUN:
1494 /*
1495 * For now, just declare the various functions. Later
1496 * on, we will add the line number information and the
1497 * local symbols.
1498 */
1499 /*
1500 * Copy the string to a temp buffer so we
1501 * can kill everything after the ':'. We do
1502 * it this way because otherwise we end up dirtying
1503 * all of the pages related to the stabs, and that
1504 * sucks up swap space like crazy.
1505 */
1506 stab_strcpy(symname, sizeof(symname), ptr);
1507 if (*symname)
1508 {
1509 struct symt_function_signature* func_type;
1510
1511 if (curr_func)
1512 {
1513 /* First, clean up the previous function we were working on.
1514 * Assume size of the func is the delta between current offset
1515 * and offset of last function
1516 */
1518 n_value ?
1519 (load_offset + n_value - curr_func->address) : 0);
1520 }
1522 stabs_parse_type(ptr), -1);
1523 curr_func = symt_new_function(module, compiland, symname,
1524 load_offset + n_value, 0,
1525 &func_type->symt);
1526 pending_flush(&pending_func, module, curr_func, NULL);
1527 }
1528 else
1529 {
1530 /* some versions of GCC to use a N_FUN "" to mark the end of a function
1531 * and n_value contains the size of the func
1532 */
1533 stabs_finalize_function(module, curr_func, n_value);
1534 curr_func = NULL;
1535 }
1536 break;
1537 case N_SO:
1538 /*
1539 * This indicates a new source file. Append the records
1540 * together, to build the correct path name.
1541 */
1542 if (*ptr == '\0') /* end of N_SO file */
1543 {
1544 /* Nuke old path. */
1545 HeapFree(GetProcessHeap(), 0, srcpath);
1546 srcpath = NULL;
1547 stabs_finalize_function(module, curr_func, 0);
1548 curr_func = NULL;
1549 source_idx = -1;
1550 incl_stk = -1;
1551 assert(block == NULL);
1552 compiland = NULL;
1553 }
1554 else
1555 {
1556 int len = strlen(ptr);
1557 if (ptr[len-1] != '/')
1558 {
1560 source_idx = source_new(module, srcpath, ptr);
1561 compiland = symt_new_compiland(module, 0 /* FIXME */, source_idx);
1562 }
1563 else
1564 {
1565 srcpath = HeapAlloc(GetProcessHeap(), 0, len + 1);
1566 strcpy(srcpath, ptr);
1567 }
1568 }
1569 break;
1570 case N_SOL:
1571 source_idx = source_new(module, srcpath, ptr);
1572 break;
1573 case N_UNDF:
1574 strs += strtabinc;
1575 strtabinc = n_value;
1576 /* I'm not sure this is needed, so trace it before we obsolete it */
1577 if (curr_func)
1578 {
1579 FIXME("UNDF: curr_func %s\n", curr_func->hash_elt.name);
1580 stabs_finalize_function(module, curr_func, 0); /* FIXME */
1581 curr_func = NULL;
1582 }
1583 break;
1584 case N_OPT:
1585 /* Ignore this. We don't care what it points to. */
1586 break;
1587 case N_BINCL:
1589 assert(incl_stk < (int) ARRAY_SIZE(incl) - 1);
1590 incl[++incl_stk] = source_idx;
1591 source_idx = source_new(module, NULL, ptr);
1592 break;
1593 case N_EINCL:
1594 assert(incl_stk >= 0);
1595 source_idx = incl[incl_stk--];
1596 break;
1597 case N_EXCL:
1598 if (stabs_add_include(stabs_find_include(ptr, n_value)) < 0)
1599 {
1600 ERR("Excluded header not found (%s,%ld)\n", ptr, (ULONG_PTR)n_value);
1602 ret = FALSE;
1603 goto done;
1604 }
1605 break;
1606 case N_MAIN:
1607 /* Always ignore these. GCC doesn't even generate them. */
1608 break;
1609 case N_BNSYM:
1610 case N_ENSYM:
1611 case N_OSO:
1612 case N_INDR:
1613 /* Always ignore these, they seem to be used only on Darwin. */
1614 break;
1615 case N_ABS:
1616 case N_SECT:
1617 /* FIXME: Other definition types (N_TEXT, N_DATA, N_BSS, ...)? */
1618 if (callback)
1619 {
1620 BOOL is_public = (stab_ptr->n_type & N_EXT);
1621 BOOL is_global = is_public;
1622
1623 /* "private extern"; shared among compilation units in a shared
1624 * library, but not accessible from outside the library. */
1625 if (stab_ptr->n_type & N_PEXT)
1626 {
1627 is_public = FALSE;
1628 is_global = TRUE;
1629 }
1630
1631 if (*ptr == '_') ptr++;
1632 stab_strcpy(symname, sizeof(symname), ptr);
1633
1634 callback(module, load_offset, symname, n_value,
1635 is_public, is_global, stab_ptr->n_other, compiland, user);
1636 }
1637 break;
1638 default:
1639 ERR("Unknown stab type 0x%02x\n", type);
1640 break;
1641 }
1642 stabbuff[0] = '\0';
1643 TRACE("0x%02x %lx %s\n",
1644 stab_ptr->n_type, (ULONG_PTR)n_value, debugstr_a(strs + stab_ptr->n_strx));
1645 }
1647 module->module.CVSig = 'S' | ('T' << 8) | ('A' << 16) | ('B' << 24);
1648 /* FIXME: we could have a finer grain here */
1654done:
1655 HeapFree(GetProcessHeap(), 0, stabbuff);
1657 HeapFree(GetProcessHeap(), 0, pending_block.objs);
1658 HeapFree(GetProcessHeap(), 0, pending_func.objs);
1659 HeapFree(GetProcessHeap(), 0, srcpath);
1660
1661 return ret;
1662}
char * strchr(const char *String, int ch)
Definition: utclib.c:501
void user(int argc, const char *argv[])
Definition: cmds.c:1350
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) DECLSPEC_HIDDEN
Definition: symbol.c:378
struct symt_function_signature * symt_new_function_signature(struct module *module, struct symt *ret_type, enum CV_call_e call_conv) DECLSPEC_HIDDEN
Definition: type.c:377
struct symt_block * symt_close_func_block(struct module *module, const struct symt_function *func, struct symt_block *block, unsigned pc) DECLSPEC_HIDDEN
Definition: symbol.c:440
struct symt_data * symt_new_global_variable(struct module *module, struct symt_compiland *parent, const char *name, unsigned is_static, struct location loc, ULONG_PTR size, struct symt *type) DECLSPEC_HIDDEN
Definition: symbol.c:256
struct symt_block * symt_open_func_block(struct module *module, struct symt_function *func, struct symt_block *block, unsigned pc, unsigned len) DECLSPEC_HIDDEN
Definition: symbol.c:413
void module_reset_debug_info(struct module *module) DECLSPEC_HIDDEN
Definition: module.c:1328
struct symt_compiland * symt_new_compiland(struct module *module, ULONG_PTR address, unsigned src_idx) DECLSPEC_HIDDEN
Definition: symbol.c:207
BOOL symt_add_function_signature_parameter(struct module *module, struct symt_function_signature *sig, struct symt *param) DECLSPEC_HIDDEN
Definition: type.c:394
UINT64 uint64_t
Definition: types.h:77
@ CV_REG_EBX
Definition: compat.h:1699
@ CV_REG_XMM0
Definition: compat.h:1744
@ CV_REG_ESI
Definition: compat.h:1702
@ CV_REG_ECX
Definition: compat.h:1697
@ CV_REG_ST0
Definition: compat.h:1732
@ CV_REG_EBP
Definition: compat.h:1701
@ CV_REG_EAX
Definition: compat.h:1696
@ CV_REG_EDI
Definition: compat.h:1703
@ CV_REG_MM0
Definition: compat.h:1743
@ CV_REG_ESP
Definition: compat.h:1700
@ CV_REG_EDX
Definition: compat.h:1698
@ CV_REG_NONE
Definition: compat.h:1679
@ DataIsLocal
Definition: compat.h:1649
@ DataIsParam
Definition: compat.h:1651
struct cpu * dbghelp_current_cpu
Definition: dbghelp.c:169
GLintptr offset
Definition: glext.h:5920
static IPrintDialogCallback callback
Definition: printdlg.c:326
static void stab_strcpy(char *dest, int sz, const char *source)
Definition: stabs.c:95
static int stabs_find_include(const char *file, ULONG_PTR val)
Definition: stabs.c:174
static void pending_flush(struct pending_list *pending, struct module *module, struct symt_function *func, struct symt_block *block)
Definition: stabs.c:1167
static void stabs_finalize_function(struct module *module, struct symt_function *func, ULONG_PTR size)
Definition: stabs.c:1204
#define N_EXT
Definition: stabs.c:65
#define N_OPT
Definition: stabs.c:80
static void stabs_free_includes(void)
Definition: stabs.c:209
static void stabs_reset_includes(void)
Definition: stabs.c:199
static int stabs_add_include(int idx)
Definition: stabs.c:187
#define N_SECT
Definition: stabs.c:71
#define N_PSYM
Definition: stabs.c:89
#define N_STSYM
Definition: stabs.c:75
#define N_ENSYM
Definition: stabs.c:83
static int stabs_parse_typedef(struct module *module, const char *ptr, const char *typename)
Definition: stabs.c:1000
#define N_SOL
Definition: stabs.c:88
#define N_BINCL
Definition: stabs.c:87
#define N_STAB
Definition: stabs.c:62
#define N_PEXT
Definition: stabs.c:63
#define N_SO
Definition: stabs.c:84
#define N_BNSYM
Definition: stabs.c:79
#define N_GSYM
Definition: stabs.c:73
#define N_ABS
Definition: stabs.c:69
#define N_LBRAC
Definition: stabs.c:91
#define N_RBRAC
Definition: stabs.c:93
#define N_SLINE
Definition: stabs.c:82
#define N_FUN
Definition: stabs.c:74
#define N_EINCL
Definition: stabs.c:90
#define N_RSYM
Definition: stabs.c:81
#define N_INDR
Definition: stabs.c:70
#define N_LSYM
Definition: stabs.c:86
static void pending_add_var(struct pending_list *pending, const char *name, enum DataKind dt, const struct location *loc)
Definition: stabs.c:1141
#define N_UNDF
Definition: stabs.c:68
static struct symt * stabs_parse_type(const char *stab)
Definition: stabs.c:1053
#define N_ROSYM
Definition: stabs.c:78
static int stabs_new_include(const char *file, ULONG_PTR val)
Definition: stabs.c:149
#define N_EXCL
Definition: stabs.c:92
#define N_OSO
Definition: stabs.c:85
#define N_TYPE
Definition: stabs.c:64
static struct symt_basic * stabs_basic[36]
Definition: stabs.c:147
static void pending_add_line(struct pending_list *pending, int source_idx, int line_num, ULONG_PTR offset, ULONG_PTR load_offset)
Definition: stabs.c:1154
#define N_LCSYM
Definition: stabs.c:76
static void stabbuf_append(char **buf, unsigned *buf_size, const char *str)
Definition: stabs.c:1226
#define N_MAIN
Definition: stabs.c:77
unsigned n_strx
unsigned char n_type
unsigned n_value
struct hash_table_elt hash_elt
struct symt * type
ULONG_PTR address
static unsigned int block
Definition: xmlmemory.c:101

Referenced by elf_load_debug_info_from_map(), macho_parse_symtab(), and pe_load_stabs().

◆ sw_module_base()

DWORD64 sw_module_base ( struct cpu_stack_walk csw,
DWORD64  addr 
)

Definition at line 127 of file stack.c.

128{
129 if (csw->is32)
130 return csw->u.s32.f_modl_bas(csw->hProcess, addr);
131 else
132 return csw->u.s64.f_modl_bas(csw->hProcess, addr);
133}
struct cpu_stack_walk::@374::@376 s64
union cpu_stack_walk::@374 u
struct cpu_stack_walk::@374::@375 s32

Referenced by i386_stack_walk().

◆ sw_read_mem()

BOOL sw_read_mem ( struct cpu_stack_walk csw,
DWORD64  addr,
void ptr,
DWORD  sz 
)

Definition at line 95 of file stack.c.

96{
97 DWORD bytes_read = 0;
98 if (csw->is32)
99 return csw->u.s32.f_read_mem(csw->hProcess, addr, ptr, sz, &bytes_read);
100 else
101 return csw->u.s64.f_read_mem(csw->hProcess, addr, ptr, sz, &bytes_read);
102}

Referenced by apply_frame_state(), eval_expression(), fetch_next_frame32(), i386_stack_walk(), pev_deref(), and set_context_reg().

◆ sw_table_access()

void * sw_table_access ( struct cpu_stack_walk csw,
DWORD64  addr 
)

Definition at line 119 of file stack.c.

120{
121 if (csw->is32)
122 return csw->u.s32.f_tabl_acs(csw->hProcess, addr);
123 else
124 return csw->u.s64.f_tabl_acs(csw->hProcess, addr);
125}

Referenced by i386_stack_walk().

◆ sw_xlat_addr()

DWORD64 sw_xlat_addr ( struct cpu_stack_walk csw,
ADDRESS64 addr 
)

Definition at line 104 of file stack.c.

105{
106 if (addr->Mode == AddrModeFlat) return addr->Offset;
107 if (csw->is32)
108 {
109 ADDRESS addr32;
110
111 addr_64to32(addr, &addr32);
112 return csw->u.s32.f_xlat_adr(csw->hProcess, csw->hThread, &addr32);
113 }
114 else if (csw->u.s64.f_xlat_adr)
115 return csw->u.s64.f_xlat_adr(csw->hProcess, csw->hThread, addr);
116 return addr_to_linear(csw->hProcess, csw->hThread, addr);
117}
@ AddrModeFlat
Definition: compat.h:1159
static void addr_64to32(const ADDRESS64 *addr64, ADDRESS *addr32)
Definition: stack.c:88
static DWORD64 WINAPI addr_to_linear(HANDLE hProcess, HANDLE hThread, ADDRESS64 *addr)
Definition: stack.c:34

Referenced by i386_stack_walk().

◆ 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 319 of file type.c.

321{
322 struct symt_data* e;
323 struct symt** p;
324
325 assert(enum_type->symt.tag == SymTagEnum);
326 e = pool_alloc(&module->pool, sizeof(*e));
327 if (e == NULL) return FALSE;
328
329 e->symt.tag = SymTagData;
330 e->hash_elt.name = pool_strdup(&module->pool, name);
331 e->hash_elt.next = NULL;
332 e->kind = DataIsConstant;
333 e->container = &enum_type->symt;
334 e->type = enum_type->base_type;
335 e->u.value.n1.n2.vt = VT_I4;
336 e->u.value.n1.n2.n3.lVal = value;
337
338 p = vector_add(&enum_type->vchildren, &module->pool);
339 if (!p) return FALSE; /* FIXME we leak e */
340 *p = &e->symt;
341
342 return TRUE;
343}
void * vector_add(struct vector *v, struct pool *pool) DECLSPEC_HIDDEN
Definition: storage.c:171
char * pool_strdup(struct pool *a, const char *str) DECLSPEC_HIDDEN
Definition: storage.c:126
SymTagEnum
Definition: compat.h:1580
@ SymTagData
Definition: compat.h:1588
@ DataIsConstant
Definition: compat.h:1657
@ VT_I4
Definition: compat.h:2298
#define e
Definition: ke_i.h:82
struct define * next
Definition: compiler.c:65
char * value
Definition: compiler.c:67
char * name
Definition: compiler.c:66
struct symt symt
struct symt * base_type
struct vector vchildren
Definition: pdh_main.c:94

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

◆ symt_add_func_line()

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

Definition at line 326 of file symbol.c.

328{
329 struct line_info* dli;
330 BOOL last_matches = FALSE;
331 int i;
332
333 if (func == NULL || !(dbghelp_options & SYMOPT_LOAD_LINES)) return;
334
335 TRACE_(dbghelp_symt)("(%p)%s:%lx %s:%u\n",
336 func, func->hash_elt.name, offset,
337 source_get(module, source_idx), line_num);
338
339 assert(func->symt.tag == SymTagFunction);
340
341 for (i=vector_length(&func->vlines)-1; i>=0; i--)
342 {
343 dli = vector_at(&func->vlines, i);
344 if (dli->is_source_file)
345 {
346 last_matches = (source_idx == dli->u.source_file);
347 break;
348 }
349 }
350
351 if (!last_matches)
352 {
353 /* we shouldn't have line changes on first line of function */
354 dli = vector_add(&func->vlines, &module->pool);
355 dli->is_source_file = 1;
356 dli->is_first = dli->is_last = 0;
357 dli->line_number = 0;
358 dli->u.source_file = source_idx;
359 }
360 dli = vector_add(&func->vlines, &module->pool);
361 dli->is_source_file = 0;
362 dli->is_first = dli->is_last = 0;
363 dli->line_number = line_num;
364 dli->u.pc_offset = func->address + offset;
365}
unsigned vector_length(const struct vector *v) DECLSPEC_HIDDEN
Definition: storage.c:157
void * vector_at(const struct vector *v, unsigned pos) DECLSPEC_HIDDEN
Definition: storage.c:162
const char * source_get(const struct module *module, unsigned idx) DECLSPEC_HIDDEN
Definition: source.c:130
#define TRACE_(x)
Definition: compat.h:76
#define SYMOPT_LOAD_LINES
Definition: compat.h:990
@ SymTagFunction
Definition: compat.h:1586
ULONG_PTR pc_offset
union line_info::@373 u
ULONG_PTR is_first
ULONG_PTR line_number
ULONG_PTR is_last
unsigned source_file
ULONG_PTR is_source_file

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

◆ symt_add_func_local()

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

Definition at line 378 of file symbol.c.

384{
385 struct symt_data* locsym;
386 struct symt** p;
387
388 TRACE_(dbghelp_symt)("Adding local symbol (%s:%s): %s %p\n",
390 name, type);
391
392 assert(func);
393 assert(func->symt.tag == SymTagFunction);
394 assert(dt == DataIsParam || dt == DataIsLocal);
395
396 locsym = pool_alloc(&module->pool, sizeof(*locsym));
397 locsym->symt.tag = SymTagData;
398 locsym->hash_elt.name = pool_strdup(&module->pool, name);
399 locsym->hash_elt.next = NULL;
400 locsym->kind = dt;
401 locsym->container = block ? &block->symt : &func->symt;
402 locsym->type = type;
403 locsym->u.var = *loc;
404 if (block)
405 p = vector_add(&block->vchildren, &module->pool);
406 else
407 p = vector_add(&func->vchildren, &module->pool);
408 *p = &locsym->symt;
409 return locsym;
410}
union symt_data::@370 u
struct symt * type
struct symt symt
struct symt * container
struct hash_table_elt hash_elt
struct location var
enum DataKind kind

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

◆ symt_add_function_point()

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

Definition at line 452 of file symbol.c.

457{
458 struct symt_hierarchy_point*sym;
459 struct symt** p;
460
461 if ((sym = pool_alloc(&module->pool, sizeof(*sym))))
462 {
463 sym->symt.tag = point;
464 sym->parent = &func->symt;
465 sym->loc = *loc;
466 sym->hash_elt.name = name ? pool_strdup(&module->pool, name) : NULL;
467 p = vector_add(&func->vchildren, &module->pool);
468 *p = &sym->symt;
469 }
470 return sym;
471}
POINTL point
Definition: edittest.c:50
struct location loc
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_function_signature_parameter()

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

Definition at line 394 of file type.c.

397{
398 struct symt** p;
400
401 assert(sig_type->symt.tag == SymTagFunctionType);
402 arg = pool_alloc(&module->pool, sizeof(*arg));
403 if (!arg) return FALSE;
404 arg->symt.tag = SymTagFunctionArgType;
405 arg->arg_type = param;
406 arg->container = &sig_type->symt;
407 p = vector_add(&sig_type->vchildren, &module->pool);
408 if (!p) return FALSE; /* FIXME we leak arg */
409 *p = &arg->symt;
410
411 return TRUE;
412}
@ SymTagFunctionArgType
Definition: compat.h:1601
@ SymTagFunctionType
Definition: compat.h:1594
void * arg
Definition: msvc.h:10

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

◆ 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 264 of file type.c.

267{
268 struct symt_data* m;
269 struct symt** p;
270
271 assert(udt_type->symt.tag == SymTagUDT);
272
273 TRACE_(dbghelp_symt)("Adding %s to UDT %s\n", name, udt_type->hash_elt.name);
274 if (name)
275 {
276 unsigned int i;
277 for (i=0; i<vector_length(&udt_type->vchildren); i++)
278 {
279 m = *(struct symt_data**)vector_at(&udt_type->vchildren, i);
280 assert(m);
281 assert(m->symt.tag == SymTagData);
282 if (strcmp(m->hash_elt.name, name) == 0)
283 return TRUE;
284 }
285 }
286
287 if ((m = pool_alloc(&module->pool, sizeof(*m))) == NULL) return FALSE;
288 memset(m, 0, sizeof(*m));
289 m->symt.tag = SymTagData;
290 m->hash_elt.name = name ? pool_strdup(&module->pool, name) : "";
291 m->hash_elt.next = NULL;
292
293 m->kind = DataIsMember;
294 m->container = &udt_type->symt;
295 m->type = elt_type;
296 m->u.member.offset = offset;
297 m->u.member.length = ((offset & 7) || (size & 7)) ? size : 0;
298 p = vector_add(&udt_type->vchildren, &module->pool);
299 *p = &m->symt;
300
301 return TRUE;
302}
@ SymTagUDT
Definition: compat.h:1592
@ DataIsMember
Definition: compat.h:1655
const GLfloat * m
Definition: glext.h:10848
struct vector vchildren
struct symt symt
struct hash_table_elt hash_elt

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

◆ symt_close_func_block()

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

Definition at line 440 of file symbol.c.

443{
444 assert(func);
445 assert(func->symt.tag == SymTagFunction);
446
447 if (pc) block->size = func->address + pc - block->address;
448 return (block->container->tag == SymTagBlock) ?
449 CONTAINING_RECORD(block->container, struct symt_block, symt) : NULL;
450}
@ SymTagBlock
Definition: compat.h:1587
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

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

◆ symt_cmp_addr()

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

Definition at line 57 of file symbol.c.

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

Referenced by coff_process_info(), and resort_symbols().

◆ symt_fill_func_line_info()

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

Definition at line 1480 of file symbol.c.

1482{
1483 struct line_info* dli = NULL;
1484 BOOL found = FALSE;
1485 int i;
1486
1487 assert(func->symt.tag == SymTagFunction);
1488
1489 for (i=vector_length(&func->vlines)-1; i>=0; i--)
1490 {
1491 dli = vector_at(&func->vlines, i);
1492 if (!dli->is_source_file)
1493 {
1494 if (found || dli->u.pc_offset > addr) continue;
1495 line->LineNumber = dli->line_number;
1496 line->Address = dli->u.pc_offset;
1497 line->Key = dli;
1498 found = TRUE;
1499 continue;
1500 }
1501 if (found)
1502 {
1504 {
1505 /* Return native file paths when using winedbg */
1506 line->FileName = (char*)source_get(module, dli->u.source_file);
1507 }
1508 else
1509 {
1511 DWORD len = WideCharToMultiByte(CP_ACP, 0, dospath, -1, NULL, 0, NULL, NULL);
1512 line->FileName = fetch_buffer(module->process, len);
1513 WideCharToMultiByte(CP_ACP, 0, dospath, -1, line->FileName, len, NULL, NULL);
1514 HeapFree( GetProcessHeap(), 0, dospath );
1515 }
1516 return TRUE;
1517 }
1518 }
1519 return FALSE;
1520}
void * fetch_buffer(struct process *pcs, unsigned size)
Definition: dbghelp.c:128
BOOL dbghelp_opt_native
Definition: dbghelp.c:74
Definition: parser.c:49

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

◆ symt_find_nearest()

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

Definition at line 903 of file symbol.c.

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

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

◆ symt_get_address()

BOOL symt_get_address ( const struct symt type,
ULONG64 addr 
)

Definition at line 119 of file type.c.

120{
121 switch (type->tag)
122 {
123 case SymTagData:
124 switch (((const struct symt_data*)type)->kind)
125 {
126 case DataIsGlobal:
127 case DataIsFileStatic:
128 *addr = ((const struct symt_data*)type)->u.var.offset;
129 break;
130 default: return FALSE;
131 }
132 break;
133 case SymTagFunction:
134 *addr = ((const struct symt_function*)type)->address;
135 break;
137 *addr = ((const struct symt_public*)type)->address;
138 break;
141 case SymTagLabel:
142 if (!((const struct symt_hierarchy_point*)type)->parent ||
144 return FALSE;
145 *addr += ((const struct symt_hierarchy_point*)type)->loc.offset;
146 break;
147 case SymTagThunk:
148 *addr = ((const struct symt_thunk*)type)->address;
149 break;
150 case SymTagCompiland:
151 *addr = ((const struct symt_compiland*)type)->address;
152 break;
153 default:
154 FIXME("Unsupported sym-tag %s for get-address\n", symt_get_tag_str(type->tag));
155 return FALSE;
156 }
157 return TRUE;
158}
@ SymTagThunk
Definition: compat.h:1608
@ SymTagFuncDebugEnd
Definition: compat.h:1603
@ SymTagPublicSymbol
Definition: compat.h:1591
@ SymTagFuncDebugStart
Definition: compat.h:1602
@ SymTagLabel
Definition: compat.h:1590
@ SymTagCompiland
Definition: compat.h:1583
@ DataIsGlobal
Definition: compat.h:1654
@ DataIsFileStatic
Definition: compat.h:1653
static const char * symt_get_tag_str(DWORD tag)
Definition: type.c:42
BOOL symt_get_address(const struct symt *type, ULONG64 *addr)
Definition: type.c:119
r parent
Definition: btrfs.c:3010

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

◆ symt_get_func_line_next()

BOOL symt_get_func_line_next ( const struct module module,
PIMAGEHLP_LINE64  line 
)

Definition at line 1734 of file symbol.c.

1735{
1736 struct line_info* li;
1737
1738 if (line->Key == 0) return FALSE;
1739 li = line->Key;
1740 while (!li->is_last)
1741 {
1742 li++;
1743 if (!li->is_source_file)
1744 {
1745 line->LineNumber = li->line_number;
1746 line->Address = li->u.pc_offset;
1747 line->Key = li;
1748 return TRUE;
1749 }
1750 line->FileName = (char*)source_get(module, li->u.source_file);
1751 }
1752 return FALSE;
1753}
LARGE_INTEGER li
Definition: fxtimerapi.cpp:235
struct _LARGE_INTEGER::@2303 u

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

◆ symt_get_info()

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

Definition at line 536 of file type.c.

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

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

◆ symt_get_name()

const char * symt_get_name ( const struct symt sym)

Definition at line 81 of file type.c.

82{
83 switch (sym->tag)
84 {
85 /* lexical tree */
86 case SymTagData: return ((const struct symt_data*)sym)->hash_elt.name;
87 case SymTagFunction: return ((const struct symt_function*)sym)->hash_elt.name;
88 case SymTagPublicSymbol: return ((const struct symt_public*)sym)->hash_elt.name;
89 case SymTagBaseType: return ((const struct symt_basic*)sym)->hash_elt.name;
90 case SymTagLabel: return ((const struct symt_hierarchy_point*)sym)->hash_elt.name;
91 case SymTagThunk: return ((const struct symt_thunk*)sym)->hash_elt.name;
92 /* hierarchy tree */
93 case SymTagEnum: return ((const struct symt_enum*)sym)->name;
94 case SymTagTypedef: return ((const struct symt_typedef*)sym)->hash_elt.name;
95 case SymTagUDT: return ((const struct symt_udt*)sym)->hash_elt.name;
96 default:
97 FIXME("Unsupported sym-tag %s\n", symt_get_tag_str(sym->tag));
98 /* fall through */
99 case SymTagArrayType:
102 return NULL;
103 }
104}
enum SymTagEnum tag

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 106 of file type.c.

107{
108 const char* name = symt_get_name(sym);
109 WCHAR* nameW;
110 DWORD sz;
111
112 if (!name) return NULL;
113 sz = MultiByteToWideChar(CP_ACP, 0, name, -1, NULL, 0);
114 if ((nameW = HeapAlloc(GetProcessHeap(), 0, sz * sizeof(WCHAR))))
115 MultiByteToWideChar(CP_ACP, 0, name, -1, nameW, sz);
116 return nameW;
117}
static const WCHAR nameW[]
Definition: main.c:49

Referenced by symt_enum_locals_helper(), and symt_enum_module().

◆ symt_index2ptr()

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

Definition at line 110 of file symbol.c.

111{
112#if defined(__x86_64__) || defined(__arm64__)
113 if (!id-- || id >= vector_length(&module->vsymt)) return NULL;
114 return *(struct symt**)vector_at(&module->vsymt, id);
115#else
116 return (struct symt*)id;
117#endif
118}
GLuint id
Definition: glext.h:5910

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

◆ symt_init_basic()

void symt_init_basic ( struct module module)

◆ 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 345 of file type.c.

347{
348 struct symt_array* sym;
349
350 if ((sym = pool_alloc(&module->pool, sizeof(*sym))))
351 {
352 sym->symt.tag = SymTagArrayType;
353 sym->start = min;
354 sym->end = max;
355 sym->base_type = base;
356 sym->index_type = index;
357 symt_add_type(module, &sym->symt);
358 }
359 return sym;
360}
#define index(s, c)
Definition: various.h:29
static void symt_add_type(struct module *module, struct symt *symt)
Definition: type.c:184
struct symt * base_type
struct symt symt
struct symt * index_type

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,
const char typename,
unsigned  size 
)

Definition at line 192 of file type.c.

194{
195 struct symt_basic* sym;
196
197 if (typename)
198 {
200 typename);
201 if (sym && sym->bt == bt && sym->size == size)
202 return sym;
203 }
204 if ((sym = pool_alloc(&module->pool, sizeof(*sym))))
205 {
206 sym->symt.tag = SymTagBaseType;
207 if (typename)
208 {
209 sym->hash_elt.name = pool_strdup(&module->pool, typename);
211 } else sym->hash_elt.name = NULL;
212 sym->bt = bt;
213 sym->size = size;
214 symt_add_type(module, &sym->symt);
215 }
216 return sym;
217}
void hash_table_add(struct hash_table *ht, struct hash_table_elt *elt) DECLSPEC_HIDDEN
Definition: storage.c:378
static struct symt * symt_find_type_by_name(const struct module *module, enum SymTagEnum sym_tag, const char *typename)
Definition: type.c:160
enum BasicType bt
struct symt symt
struct hash_table_elt hash_elt
ULONG_PTR size

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_compiland()

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

Definition at line 207 of file symbol.c.

209{
210 struct symt_compiland* sym;
211
212 TRACE_(dbghelp_symt)("Adding compiland symbol %s:%s\n",
214 if ((sym = pool_alloc(&module->pool, sizeof(*sym))))
215 {
216 sym->symt.tag = SymTagCompiland;
217 sym->address = address;
218 sym->source = src_idx;
219 vector_init(&sym->vchildren, sizeof(struct symt*), 32);
220 }
221 return sym;
222}
GLuint address
Definition: glext.h:9393
struct symt symt
struct vector vchildren

Referenced by codeview_snarf(), coff_add_file(), dwarf2_parse_compilation_unit(), elf_hash_symtab(), pe_load_coff_symbol_table(), and stabs_parse().

◆ symt_new_constant()

struct symt_data * symt_new_constant ( struct module module,
struct symt_compiland parent,
const char name,
struct symt type,
const VARIANT v 
)

Definition at line 525 of file symbol.c.

529{
530 struct symt_data* sym;
531
532 TRACE_(dbghelp_symt)("Adding constant value %s:%s\n",
534
535 if ((sym = pool_alloc(&module->pool, sizeof(*sym))))
536 {
537 sym->symt.tag = SymTagData;
538 sym->hash_elt.name = pool_strdup(&module->pool, name);
539 sym->kind = DataIsConstant;
540 sym->container = compiland ? &compiland->symt : NULL;
541 sym->type = type;
542 sym->u.value = *v;
543 symt_add_module_ht(module, (struct symt_ht*)sym);
544 if (compiland)
545 {
546 struct symt** p;
547 p = vector_add(&compiland->vchildren, &module->pool);
548 *p = &sym->symt;
549 }
550 }
551 return sym;
552}
VARIANT value
static void symt_add_module_ht(struct module *module, struct symt_ht *ht)
Definition: symbol.c:143

Referenced by codeview_snarf(), and dwarf2_parse_variable().

◆ symt_new_enum()

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

Definition at line 304 of file type.c.

306{
307 struct symt_enum* sym;
308
309 if ((sym = pool_alloc(&module->pool, sizeof(*sym))))
310 {
311 sym->symt.tag = SymTagEnum;
312 sym->name = (typename) ? pool_strdup(&module->pool, typename) : NULL;
313 sym->base_type = basetype;
314 vector_init(&sym->vchildren, sizeof(struct symt*), 8);
315 }
316 return sym;
317}
const char * name

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

◆ symt_new_function()

struct symt_function * symt_new_function ( struct module module,
struct symt_compiland parent,
const char name,
ULONG_PTR  addr,
ULONG_PTR  size,
struct symt type 
)

Definition at line 293 of file symbol.c.

298{
299 struct symt_function* sym;
300 struct symt** p;
301
302 TRACE_(dbghelp_symt)("Adding global function %s:%s @%lx-%lx\n",
304
305 assert(!sig_type || sig_type->tag == SymTagFunctionType);
306 if ((sym = pool_alloc(&module->pool, sizeof(*sym))))
307 {
308 sym->symt.tag = SymTagFunction;
309 sym->hash_elt.name = pool_strdup(&module->pool, name);
310 sym->container = &compiland->symt;
311 sym->address = addr;
312 sym->type = sig_type;
313 sym->size = size;
314 vector_init(&sym->vlines, sizeof(struct line_info), 64);
315 vector_init(&sym->vchildren, sizeof(struct symt*), 8);
316 symt_add_module_ht(module, (struct symt_ht*)sym);
317 if (compiland)
318 {
319 p = vector_add(&compiland->vchildren, &module->pool);
320 *p = &sym->symt;
321 }
322 }
323 return sym;
324}
struct vector vlines
struct vector vchildren
struct symt symt
struct symt * container

Referenced by codeview_snarf(), coff_process_info(), dwarf2_parse_subprogram(), elf_new_wine_thunks(), macho_finish_stabs(), rsym_parse(), and stabs_parse().

◆ 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 377 of file type.c.

380{
381 struct symt_function_signature* sym;
382
383 if ((sym = pool_alloc(&module->pool, sizeof(*sym))))
384 {
385 sym->symt.tag = SymTagFunctionType;
386 sym->rettype = ret_type;
387 vector_init(&sym->vchildren, sizeof(struct symt*), 4);
388 sym->call_conv = call_conv;
389 symt_add_type(module, &sym->symt);
390 }
391 return sym;
392}

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

◆ symt_new_global_variable()

struct symt_data * symt_new_global_variable ( struct module module,
struct symt_compiland parent,
const char name,
unsigned  is_static,
struct location  loc,
ULONG_PTR  size,
struct symt type 
)

Definition at line 256 of file symbol.c.

261{
262 struct symt_data* sym;
263 struct symt** p;
264 DWORD64 tsz;
265
266 TRACE_(dbghelp_symt)("Adding global symbol %s:%s %d@%lx %p\n",
268 if ((sym = pool_alloc(&module->pool, sizeof(*sym))))
269 {
270 sym->symt.tag = SymTagData;
271 sym->hash_elt.name = pool_strdup(&module->pool, name);
272 sym->kind = is_static ? DataIsFileStatic : DataIsGlobal;
273 sym->container = compiland ? &compiland->symt : NULL;
274 sym->type = type;
275 sym->u.var = loc;
276 if (type && size && symt_get_info(module, type, TI_GET_LENGTH, &tsz))
277 {
278 if (tsz != size)
279 FIXME("Size mismatch for %s.%s between type (%s) and src (%lu)\n",
282 }
283 symt_add_module_ht(module, (struct symt_ht*)sym);
284 if (compiland)
285 {
286 p = vector_add(&compiland->vchildren, &module->pool);
287 *p = &sym->symt;
288 }
289 }
290 return sym;
291}
BOOL symt_get_info(struct module *module, const struct symt *type, IMAGEHLP_SYMBOL_TYPE_INFO req, void *pInfo) DECLSPEC_HIDDEN
Definition: type.c:536

Referenced by codeview_add_variable(), coff_process_info(), dwarf2_parse_variable(), elf_new_wine_thunks(), macho_finish_stabs(), and stabs_parse().

◆ symt_new_label()

struct symt_hierarchy_point * symt_new_label ( struct module module,
struct symt_compiland compiland,
const char name,
ULONG_PTR  address 
)

Definition at line 554 of file symbol.c.

557{
558 struct symt_hierarchy_point* sym;
559
560 TRACE_(dbghelp_symt)("Adding global label value %s:%s\n",
562
563 if ((sym = pool_alloc(&module->pool, sizeof(*sym))))
564 {
565 sym->symt.tag = SymTagLabel;
566 sym->hash_elt.name = pool_strdup(&module->pool, name);
567 sym->loc.kind = loc_absolute;
568 sym->loc.offset = address;
569 sym->parent = compiland ? &compiland->symt : NULL;
570 symt_add_module_ht(module, (struct symt_ht*)sym);
571 if (compiland)
572 {
573 struct symt** p;
574 p = vector_add(&compiland->vchildren, &module->pool);
575 *p = &sym->symt;
576 }
577 }
578 return sym;
579}

Referenced by codeview_snarf().

◆ symt_new_pointer()

struct symt_pointer * symt_new_pointer ( struct module module,
struct symt ref_type,
ULONG_PTR  size 
)

Definition at line 414 of file type.c.

415{
416 struct symt_pointer* sym;
417
418 if ((sym = pool_alloc(&module->pool, sizeof(*sym))))
419 {
420 sym->symt.tag = SymTagPointerType;
421 sym->pointsto = ref_type;
422 sym->size = size;
423 symt_add_type(module, &sym->symt);
424 }
425 return sym;
426}
ULONG_PTR size
struct symt * pointsto
struct symt symt

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_public()

struct symt_public * symt_new_public ( struct module module,
struct symt_compiland parent,
const char typename,
BOOL  is_function,
ULONG_PTR  address,
unsigned  size 
)

Definition at line 224 of file symbol.c.

229{
230 struct symt_public* sym;
231 struct symt** p;
232
233 TRACE_(dbghelp_symt)("Adding public symbol %s:%s @%lx\n",
237 return NULL;
238 if ((sym = pool_alloc(&module->pool, sizeof(*sym))))
239 {
240 sym->symt.tag = SymTagPublicSymbol;
241 sym->hash_elt.name = pool_strdup(&module->pool, name);
242 sym->container = compiland ? &compiland->symt : NULL;
243 sym->is_function = is_function;
244 sym->address = address;
245 sym->size = size;
246 symt_add_module_ht(module, (struct symt_ht*)sym);
247 if (compiland)
248 {
249 p = vector_add(&compiland->vchildren, &module->pool);
250 *p = &sym->symt;
251 }
252 }
253 return sym;
254}
#define SYMOPT_AUTO_PUBLICS
Definition: compat.h:994
struct hash_table_elt hash_elt
struct symt * container
ULONG_PTR address
struct symt symt
ULONG_PTR size
struct symt_ht * symt_find_nearest(struct module *module, DWORD_PTR addr)
Definition: symbol.c:903

Referenced by codeview_snarf_public(), elf_new_public_symbols(), macho_finish_stabs(), pe_load_coff_symbol_table(), pe_load_export_debug_info(), and rsym_parse().

◆ symt_new_thunk()

struct symt_thunk * symt_new_thunk ( struct module module,
struct symt_compiland parent,
const char name,
THUNK_ORDINAL  ord,
ULONG_PTR  addr,
ULONG_PTR  size 
)

Definition at line 496 of file symbol.c.

500{
501 struct symt_thunk* sym;
502
503 TRACE_(dbghelp_symt)("Adding global thunk %s:%s @%lx-%lx\n",
505
506 if ((sym = pool_alloc(&module->pool, sizeof(*sym))))
507 {
508 sym->symt.tag = SymTagThunk;
509 sym->hash_elt.name = pool_strdup(&module->pool, name);
510 sym->container = &compiland->symt;
511 sym->address = addr;
512 sym->size = size;
513 sym->ordinal = ord;
514 symt_add_module_ht(module, (struct symt_ht*)sym);
515 if (compiland)
516 {
517 struct symt** p;
518 p = vector_add(&compiland->vchildren, &module->pool);
519 *p = &sym->symt;
520 }
521 }
522 return sym;
523}
struct symt * container
ULONG_PTR address
ULONG_PTR size
struct symt symt
struct hash_table_elt hash_elt
THUNK_ORDINAL ordinal

Referenced by codeview_snarf(), and elf_new_wine_thunks().

◆ symt_new_typedef()

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

Definition at line 428 of file type.c.

430{
431 struct symt_typedef* sym;
432
433 if ((sym = pool_alloc(&module->pool, sizeof(*sym))))
434 {
435 sym->symt.tag = SymTagTypedef;
436 sym->type = ref;
437 sym->hash_elt.name = pool_strdup(&module->pool, name);
439 symt_add_type(module, &sym->symt);
440 }
441 return sym;
442}
Definition: send.c:48
struct hash_table_elt hash_elt
struct symt symt
struct symt * type

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 219 of file type.c.

221{
222 struct symt_udt* sym;
223
224 TRACE_(dbghelp_symt)("Adding udt %s:%s\n",
225 debugstr_w(module->module.ModuleName), typename);
226 if ((sym = pool_alloc(&module->pool, sizeof(*sym))))
227 {
228 sym->symt.tag = SymTagUDT;
229 sym->kind = kind;
230 sym->size = size;
231 if (typename)
232 {
233 sym->hash_elt.name = pool_strdup(&module->pool, typename);
235 } else sym->hash_elt.name = NULL;
236 vector_init(&sym->vchildren, sizeof(struct symt*), 8);
237 symt_add_type(module, &sym->symt);
238 }
239 return sym;
240}

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

◆ symt_normalize_function()

BOOL symt_normalize_function ( struct module module,
const struct symt_function func 
)

Definition at line 473 of file symbol.c.

474{
475 unsigned len;
476 struct line_info* dli;
477
478 assert(func);
479 /* We aren't adding any more locals or line numbers to this function.
480 * Free any spare memory that we might have allocated.
481 */
482 assert(func->symt.tag == SymTagFunction);
483
484/* EPP vector_pool_normalize(&func->vlines, &module->pool); */
485/* EPP vector_pool_normalize(&func->vchildren, &module->pool); */
486
487 len = vector_length(&func->vlines);
488 if (len--)
489 {
490 dli = vector_at(&func->vlines, 0); dli->is_first = 1;
491 dli = vector_at(&func->vlines, len); dli->is_last = 1;
492 }
493 return TRUE;
494}

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

◆ symt_open_func_block()

struct symt_block * symt_open_func_block ( struct module module,
struct symt_function func,
struct symt_block block,
unsigned  pc,
unsigned  len 
)

Definition at line 413 of file symbol.c.

417{
418 struct symt_block* block;
419 struct symt** p;
420
421 assert(func);
422 assert(func->symt.tag == SymTagFunction);
423
424 assert(!parent_block || parent_block->symt.tag == SymTagBlock);
425 block = pool_alloc(&module->pool, sizeof(*block));
426 block->symt.tag = SymTagBlock;
427 block->address = func->address + pc;
428 block->size = len;
429 block->container = parent_block ? &parent_block->symt : &func->symt;
430 vector_init(&block->vchildren, sizeof(struct symt*), 4);
431 if (parent_block)
432 p = vector_add(&parent_block->vchildren, &module->pool);
433 else
434 p = vector_add(&func->vchildren, &module->pool);
435 *p = &block->symt;
436
437 return block;
438}

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

◆ symt_ptr2index()

DWORD symt_ptr2index ( struct module module,
const struct symt sym 
)

Definition at line 68 of file symbol.c.

69{
70#ifdef __x86_64__
71 const struct symt** c;
73 struct hash_table_iter hti;
74 void *ptr;
75 struct symt_idx_to_ptr *idx_to_ptr;
76 /* place enough storage on the stack to represent a pointer in %p form */
77 char ptrbuf[3 + (sizeof(void *) * 2)];
78
79 /* make a string representation of the pointer to use as a hash key */
80 sprintf(ptrbuf, "%p", sym);
81 hash_table_iter_init(&module->ht_symaddr, &hti, ptrbuf);
82
83 /* try to find the pointer in our ht */
84 while ((ptr = hash_table_iter_up(&hti))) {
85 idx_to_ptr = CONTAINING_RECORD(ptr, struct symt_idx_to_ptr, hash_elt);
86 if (idx_to_ptr->sym == sym)
87 return idx_to_ptr->idx;
88 }
89
90 /* not found */
91 /* add the symbol to our symbol vector */
93
94 /* add an idx to ptr mapping so we can find it again by address */
95 if ((idx_to_ptr = pool_alloc(&module->pool, sizeof(*idx_to_ptr))))
96 {
97 idx_to_ptr->hash_elt.name = pool_strdup(&module->pool, ptrbuf);
98 idx_to_ptr->sym = sym;
99 idx_to_ptr->idx = len + 1;
100 hash_table_add(&module->ht_symaddr, &idx_to_ptr->hash_elt);
101 }
102
103 if (c) *c = sym;
104 return len + 1;
105#else
106 return (DWORD)sym;
107#endif
108}
void hash_table_iter_init(const struct hash_table *ht, struct hash_table_iter *hti, const char *name) DECLSPEC_HIDDEN
Definition: storage.c:405
void * hash_table_iter_up(struct hash_table_iter *hti) DECLSPEC_HIDDEN
Definition: storage.c:422
const GLubyte * c
Definition: glext.h:8905
#define c
Definition: ke_i.h:80
#define sprintf(buf, format,...)
Definition: sprintf.c:55

Referenced by SymEnumTypes(), SymGetTypeFromName(), symt_fill_sym_info(), and symt_get_info().

◆ symt_set_udt_size()

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

Definition at line 242 of file type.c.

243{
244 assert(udt->symt.tag == SymTagUDT);
245 if (vector_length(&udt->vchildren) != 0)
246 {
247 if (udt->size != size)
248 FIXME_(dbghelp_symt)("Changing size for %s from %u to %u\n",
249 udt->hash_elt.name, udt->size, size);
250 return TRUE;
251 }
252 udt->size = size;
253 return TRUE;
254}
#define FIXME_(x)
Definition: compat.h:77

Referenced by codeview_add_type_struct(), and stabs_pts_read_aggregate().

◆ validate_addr64()

BOOL validate_addr64 ( DWORD64  addr)

Definition at line 112 of file dbghelp.c.

113{
114 if (sizeof(void*) == sizeof(int) && (addr >> 32))
115 {
116 FIXME("Unsupported address %s\n", wine_dbgstr_longlong(addr));
118 return FALSE;
119 }
120 return TRUE;
121}
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101

Referenced by fetch_pe_module_info_cb(), reg_cb64to32(), SymGetModuleBase(), SymLoadModuleExW(), and SymUnloadModule64().

◆ vector_add()

void * vector_add ( struct vector v,
struct pool pool 
)

Definition at line 171 of file storage.c.

172{
173 unsigned ncurr = v->num_elts++;
174
175 /* check that we don't wrap around */
176 assert(v->num_elts > ncurr);
177 if (ncurr == (v->num_buckets << v->shift))
178 {
179 if(v->num_buckets == v->buckets_allocated)
180 {
181 /* Double the bucket cache, so it scales well with big vectors.*/
182 unsigned new_reserved;
183 void* new;
184
185 new_reserved = 2*v->buckets_allocated;
186 if(new_reserved == 0) new_reserved = 1;
187
188 /* Don't even try to resize memory.
189 Pool datastructure is very inefficient with reallocs. */
190 new = pool_alloc(pool, new_reserved * sizeof(void*));
191 memcpy(new, v->buckets, v->buckets_allocated * sizeof(void*));
192 v->buckets = new;
193 v->buckets_allocated = new_reserved;
194 }
195 v->buckets[v->num_buckets] = pool_alloc(pool, v->elt_size << v->shift);
196 return v->buckets[v->num_buckets++];
197 }
198 return vector_at(v, ncurr);
199}

Referenced by dwarf2_parse_line_numbers(), dwarf2_read_one_debug_info(), pev_push(), sparse_array_add(), symt_add_enum_element(), symt_add_func_line(), symt_add_func_local(), symt_add_function_point(), symt_add_function_signature_parameter(), symt_add_type(), symt_add_udt_element(), symt_new_constant(), symt_new_function(), symt_new_global_variable(), symt_new_label(), symt_new_public(), symt_new_thunk(), symt_open_func_block(), and symt_ptr2index().

◆ vector_at()

◆ vector_init()

void vector_init ( struct vector v,
unsigned  elt_sz,
unsigned  bucket_sz 
)

Definition at line 133 of file storage.c.

134{
135 v->buckets = NULL;
136 /* align size on DWORD boundaries */
137 v->elt_size = (esz + 3) & ~3;
138 switch (bucket_sz)
139 {
140 case 2: v->shift = 1; break;
141 case 4: v->shift = 2; break;
142 case 8: v->shift = 3; break;
143 case 16: v->shift = 4; break;
144 case 32: v->shift = 5; break;
145 case 64: v->shift = 6; break;
146 case 128: v->shift = 7; break;
147 case 256: v->shift = 8; break;
148 case 512: v->shift = 9; break;
149 case 1024: v->shift = 10; break;
150 default: assert(0);
151 }
152 v->num_buckets = 0;
153 v->buckets_allocated = 0;
154 v->num_elts = 0;
155}

Referenced by dwarf2_parse_line_numbers(), dwarf2_read_one_debug_info(), module_new(), pev_init(), sparse_array_init(), symt_new_compiland(), symt_new_enum(), symt_new_function(), symt_new_function_signature(), symt_new_udt(), and symt_open_func_block().

◆ vector_length()

◆ wine_dbgstr_addr()

const char * wine_dbgstr_addr ( const ADDRESS64 addr)

Definition at line 142 of file dbghelp.c.

143{
144 if (!addr) return "(null)";
145 switch (addr->Mode)
146 {
147 case AddrModeFlat:
148 return wine_dbg_sprintf("flat<%s>", wine_dbgstr_longlong(addr->Offset));
149 case AddrMode1616:
150 return wine_dbg_sprintf("1616<%04x:%04x>", addr->Segment, (DWORD)addr->Offset);
151 case AddrMode1632:
152 return wine_dbg_sprintf("1632<%04x:%08x>", addr->Segment, (DWORD)addr->Offset);
153 case AddrModeReal:
154 return wine_dbg_sprintf("real<%04x:%04x>", addr->Segment, (DWORD)addr->Offset);
155 default:
156 return "unknown";
157 }
158}
const char * wine_dbg_sprintf(const char *format,...)
Definition: compat.c:296
@ AddrModeReal
Definition: compat.h:1158
@ AddrMode1616
Definition: compat.h:1156
@ AddrMode1632
Definition: compat.h:1157

Referenced by i386_stack_walk().

Variable Documentation

◆ DECLSPEC_HIDDEN

const struct loader_ops no_loader_ops DECLSPEC_HIDDEN
extern

Definition at line 129 of file dbghelp_private.h.