31#ifndef DBGHELP_STATIC_LIB
37#define strcasecmp _stricmp
52 if (!fmap->
u.
pe.full_map)
56 if (fmap->
u.
pe.full_map)
59 fmap->
u.
pe.full_count++;
60 return fmap->
u.
pe.full_map;
67 if (fmap->
u.
pe.full_count && !--fmap->
u.
pe.full_count)
82 struct pe_file_map* fmap = &ism->
fmap->u.pe;
84 if (ism->
sidx >= 0 && ism->
sidx < fmap->ntheader.FileHeader.NumberOfSections &&
89 if (fmap->sect[ism->
sidx].shdr.Misc.VirtualSize > fmap->sect[ism->
sidx].shdr.SizeOfRawData)
91 FIXME(
"Section %ld: virtual (0x%x) > raw (0x%x) size - not supported\n",
92 ism->
sidx, fmap->sect[ism->
sidx].shdr.Misc.VirtualSize,
93 fmap->sect[ism->
sidx].shdr.SizeOfRawData);
103 fmap->sect[ism->
sidx].shdr.VirtualAddress,
105 return fmap->sect[ism->
sidx].mapped;
120 const char* sectname;
124 for (
i = 0;
i < fmap->
u.
pe.ntheader.FileHeader.NumberOfSections;
i++)
126 sectname = (
const char*)fmap->
u.
pe.sect[
i].shdr.Name;
128 if (sectname[0] ==
'/' && fmap->
u.
pe.strtable)
129 sectname = fmap->
u.
pe.strtable +
atoi(sectname + 1);
156 if (ism->
sidx >= 0 && ism->
sidx < ism->
fmap->u.pe.ntheader.FileHeader.NumberOfSections &&
171 if (ism->
sidx < 0 || ism->
sidx >= ism->
fmap->u.pe.ntheader.FileHeader.NumberOfSections)
173 return ism->
fmap->u.pe.sect[ism->
sidx].shdr.VirtualAddress;
183 if (ism->
sidx < 0 || ism->
sidx >= ism->
fmap->u.pe.ntheader.FileHeader.NumberOfSections)
185 return ism->
fmap->u.pe.sect[ism->
sidx].shdr.Misc.VirtualSize;
195 if (fmap->
u.
pe.hMap != 0)
199 for (ism.
sidx = 0; ism.
sidx <
fmap->u.pe.ntheader.FileHeader.NumberOfSections; ism.
sidx++)
253 if (fmap->
u.
pe.hMap == 0)
return FALSE;
254 fmap->
u.
pe.full_count = 0;
267 memcpy(&fmap->
u.
pe.ntheader, nthdr,
sizeof(fmap->
u.
pe.ntheader));
272 default:
return FALSE;
301 fmap->
u.
pe.strtable =
dst;
305 WARN(
"Bad coff table... wipping out\n");
307 fmap->
u.
pe.ntheader.FileHeader.PointerToSymbolTable = 0;
308 fmap->
u.
pe.ntheader.FileHeader.NumberOfSymbols = 0;
312 else fmap->
u.
pe.strtable =
NULL;
371 numsym = fmap->
u.
pe.ntheader.FileHeader.NumberOfSymbols;
372 if (!fmap->
u.
pe.ntheader.FileHeader.PointerToSymbolTable || !numsym)
377 for (
i = 0;
i < numsym;
i+= naux, isym += naux)
382 if (isym->
N.
Name.Short)
398 TRACE(
"Changing absolute address for %d.%s: %lx -> %s\n",
428 const char* lastfilename =
NULL;
433 numsym = fmap->
u.
pe.ntheader.FileHeader.NumberOfSymbols;
434 if (!fmap->
u.
pe.ntheader.FileHeader.PointerToSymbolTable || !numsym)
439 strtable = (
const char*)&isym[numsym];
442 for (
i = 0;
i < numsym;
i+= naux, isym += naux)
446 lastfilename = (
const char*)(isym + 1);
452 if (isym->
N.
Name.Short)
457 else name = strtable + isym->
N.
Name.Long;
460 if (!compiland && lastfilename)
514 TRACE(
"%s the STABS debug info\n",
ret ?
"successfully loaded" :
"failed to load");
534 TRACE(
"%s the DWARF debug info\n",
ret ?
"successfully loaded" :
"failed to load");
539#ifndef DBGHELP_STATIC_LIB
561 TRACE(
"%s the RSYM debug info\n",
ret ?
"successfully loaded" :
"failed to load");
596 (dbg_mapping +
sizeof(*
hdr) +
598 hdr->ExportedNamesSize);
601 hdr->NumberOfSections, dbg,
602 hdr->DebugDirectorySize /
sizeof(*dbg));
642 ERR(
"-Debug info stripped, but no .DBG file in module %s\n",
716 if (functions && ordinals &&
names)
724 base + functions[ordinals[
i]], 1);
729 if (!functions[
i])
continue;
732 if ((ordinals[
j] ==
i) &&
names[
j])
break;
733 if (j < exports->NumberOfNames)
continue;
760 #ifndef DBGHELP_STATIC_LIB
811 loaded_name[0] =
'\0';
822 FIXME(
"Trouble ahead (no module name passed in deferred mode)\n");
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;
841 modfmt->
u.
pe_info->fmap.u.pe.ntheader.FileHeader.TimeDateStamp,
842 modfmt->
u.
pe_info->fmap.u.pe.ntheader.OptionalHeader.CheckSum);
863 ERR(
"could not load the module '%s'\n",
debugstr_w(loaded_name));
888 nth,
sizeof(*nth),
NULL) &&
950 if (
image || addr < nt64->OptionalHeader.SizeOfHeaders)
return (
char *)
base +
addr;
959 if (
image || addr < nt32->OptionalHeader.SizeOfHeaders)
return (
char *)
base +
addr;
int strcmp(const char *String1, const char *String2)
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
static void * heap_alloc(size_t len)
static BOOL heap_free(void *mem)
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
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 search_dll_path(const struct process *process, const WCHAR *name, BOOL(*match)(void *, HANDLE, const WCHAR *), void *param) 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 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 rsym_parse(struct module *module, unsigned long load_offset, const void *rsym, int rsymlen) DECLSPEC_HIDDEN
unsigned source_new(struct module *module, const char *basedir, const char *source) 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
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
void hash_table_iter_init(const struct hash_table *ht, struct hash_table_iter *hti, const char *name) DECLSPEC_HIDDEN
void * hash_table_iter_up(struct hash_table_iter *hti) DECLSPEC_HIDDEN
struct symt_compiland * symt_new_compiland(struct module *module, ULONG_PTR address, unsigned src_idx) DECLSPEC_HIDDEN
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
#define IMAGE_DIRECTORY_ENTRY_EXPORT
#define ReadProcessMemory(a, b, c, d, e)
#define SYMOPT_NO_PUBLICS
#define IMAGE_SYM_CLASS_EXTERNAL
#define IMAGE_DIRECTORY_ENTRY_DEBUG
#define FindExecutableImageExW
#define INVALID_HANDLE_VALUE
#define CreateFileMappingW(a, b, c, d, e, f)
#define SYMOPT_PUBLICS_ONLY
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
#define RtlImageDirectoryEntryToData
#define IMAGE_DEBUG_MISC_EXENAME
#define stricmp(_String1, _String2)
#define IMAGE_DEBUG_TYPE_MISC
#define HeapFree(x, y, z)
#define SYMOPT_DEFERRED_LOADS
#define IMAGE_SYM_CLASS_FILE
#define FILE_ATTRIBUTE_NORMAL
#define IMAGE_NUMBEROF_DIRECTORY_ENTRIES
GLenum const GLvoid * addr
GLenum GLenum GLenum GLenum mapping
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
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 GLint GLint j
static void image_unmap_section(struct image_section_map *ism)
static const char * image_map_section(struct image_section_map *ism)
BOOL image_check_alternate(struct image_file_map *fmap, const struct module *module) DECLSPEC_HIDDEN
static void image_unmap_file(struct image_file_map *fmap)
static unsigned image_get_map_size(const struct image_section_map *ism)
_Check_return_ int __cdecl atoi(_In_z_ const char *_Str)
#define memcpy(s1, s2, n)
static short search(int val, const short *table, int size)
#define IMAGE_NT_OPTIONAL_HDR32_MAGIC
#define IMAGE_NT_OPTIONAL_HDR64_MAGIC
#define IMAGE_FIRST_SECTION(NtHeader)
static BOOL pe_load_coff_symbol_table(struct module *module)
PVOID WINAPI ImageDirectoryEntryToData(PVOID base, BOOLEAN image, USHORT dir, PULONG size)
static const struct image_file_map_ops pe_file_map_ops
const char * pe_map_directory(struct module *module, int dirno, DWORD *size)
static BOOL pe_locate_with_coff_symbol_table(struct module *module)
static DWORD_PTR pe_get_map_rva(const struct image_section_map *ism)
struct module * pe_load_builtin_module(struct process *pcs, const WCHAR *name, DWORD64 base, DWORD64 size)
BOOL pe_map_file(HANDLE file, struct image_file_map *fmap, enum module_type mt)
BOOL pe_load_debug_info(const struct process *pcs, struct module *module)
static void pe_module_remove(struct process *pcs, struct module_format *modfmt)
static BOOL search_builtin_pe(void *param, HANDLE handle, const WCHAR *path)
static BOOL pe_load_dwarf(struct module *module)
static BOOL pe_load_rsym(struct module *module)
PVOID WINAPI ImageDirectoryEntryToDataEx(PVOID base, BOOLEAN image, USHORT dir, PULONG size, PIMAGE_SECTION_HEADER *section)
static BOOL pe_load_export_debug_info(const struct process *pcs, struct module *module)
static unsigned pe_get_map_size(const struct image_section_map *ism)
static const char * pe_map_section(struct image_section_map *ism)
static BOOL pe_load_msc_debug_info(const struct process *pcs, struct module *module)
BOOL pe_load_nt_header(HANDLE hProc, DWORD64 base, IMAGE_NT_HEADERS *nth)
struct module * pe_load_native_module(struct process *pcs, const WCHAR *name, HANDLE hFile, DWORD64 base, DWORD size)
static void pe_unmap_section(struct image_section_map *ism)
static void * pe_map_full(struct image_file_map *fmap, IMAGE_NT_HEADERS **nth)
static void pe_unmap_full(struct image_file_map *fmap)
static BOOL pe_load_dbg_file(const struct process *pcs, struct module *module, const char *dbg_name, DWORD timestamp)
static const char builtin_signature[]
static BOOL pe_find_section(struct image_file_map *fmap, const char *name, struct image_section_map *ism)
static BOOL pe_is_valid_pointer_table(const IMAGE_NT_HEADERS *nthdr, const void *mapping, DWORD64 sz)
static void pe_unmap_file(struct image_file_map *fmap)
static BOOL pe_load_stabs(const struct process *pcs, struct module *module)
struct _IMAGE_SYMBOL IMAGE_SYMBOL
#define IMAGE_FILE_DEBUG_STRIPPED
#define IMAGE_NT_SIGNATURE
#define IMAGE_SIZEOF_SHORT_NAME
#define IMAGE_DOS_SIGNATURE
struct _IMAGE_SECTION_HEADER IMAGE_SECTION_HEADER
DWORD AddressOfNameOrdinals
struct _IMAGE_SYMBOL::@2299::@2300 Name
union _IMAGE_SYMBOL::@2299 N
struct image_file_map fmap
union image_file_map::@383 u
struct image_file_map * alternate
struct image_file_map::@383::pe_file_map pe
const struct image_file_map_ops * ops
struct macho_section section
struct image_file_map * fmap
IMAGEHLP_MODULEW64 module
struct module_format * format_info[DFI_LAST]
struct hash_table ht_symbols
struct image_file_map fmap
struct hash_table_elt hash_elt
#define CONTAINING_RECORD(address, type, field)