Fix function and structure field types so we are compatible with the

native dbghelp.
This commit is contained in:
Robert Shearman 2004-10-11 21:00:17 +00:00 committed by Alexandre Julliard
parent 2050591370
commit 6c50556e8b
8 changed files with 73 additions and 67 deletions

View File

@ -26,10 +26,10 @@
@ stdcall StackWalk(long long long ptr ptr ptr ptr ptr ptr)
@ stub StackWalk64
@ stdcall SymCleanup(long)
@ stdcall SymEnumSourceFiles(long long str ptr ptr)
@ stdcall SymEnumSourceFiles(ptr long long str ptr ptr)
@ stub SymEnumSym
@ stdcall SymEnumSymbols(long long str ptr ptr)
@ stdcall SymEnumTypes(long long ptr ptr)
@ stdcall SymEnumTypes(ptr long long ptr ptr)
@ stdcall SymEnumerateModules(long ptr ptr)
@ stub SymEnumerateModules64
@ stdcall SymEnumerateSymbols(long long ptr ptr)
@ -37,7 +37,7 @@
@ stub SymEnumerateSymbolsW
@ stub SymEnumerateSymbolsW64
@ stdcall SymFindFileInPath(long str str ptr long long long ptr ptr ptr)
@ stdcall SymFromAddr(long long ptr ptr)
@ stdcall SymFromAddr(ptr long long ptr ptr)
@ stdcall SymFromName(long str ptr)
@ stdcall SymFunctionTableAccess(long long)
@ stub SymFunctionTableAccess64
@ -66,8 +66,8 @@
@ stub SymGetSymNext64
@ stdcall SymGetSymPrev(long ptr)
@ stub SymGetSymPrev64
@ stdcall SymGetTypeFromName(long long str ptr)
@ stdcall SymGetTypeInfo(long long long long ptr)
@ stdcall SymGetTypeFromName(ptr long long str ptr)
@ stdcall SymGetTypeInfo(ptr long long long long ptr)
@ stdcall SymInitialize(long str long)
@ stdcall SymLoadModule(long long str str long long)
@ stub SymLoadModule64

View File

@ -94,7 +94,7 @@ const char* source_get(const struct module* module, unsigned idx)
* SymEnumSourceFiles (DBGHELP.@)
*
*/
BOOL WINAPI SymEnumSourceFiles(HANDLE hProcess, ULONG ModBase, LPSTR Mask,
BOOL WINAPI SymEnumSourceFiles(HANDLE hProcess, ULONG64 ModBase, LPSTR Mask,
PSYM_ENUMSOURCFILES_CALLBACK cbSrcFiles,
void* UserContext)
{

View File

@ -535,8 +535,9 @@ static void symt_fill_sym_info(const struct module* module,
strncpy(sym_info->Name, name, min(sym_info->NameLen, sym_info->MaxNameLen));
sym_info->Name[sym_info->MaxNameLen - 1] = '\0';
}
TRACE_(dbghelp_symt)("%p => %s %lu %lx\n",
sym, sym_info->Name, sym_info->Size, sym_info->Address);
TRACE_(dbghelp_symt)("%p => %s %lu %s\n",
sym, sym_info->Name, sym_info->Size,
wine_dbgstr_longlong(sym_info->Address));
}
static BOOL symt_enum_module(struct module* module, regex_t* regex,
@ -759,7 +760,7 @@ static BOOL symt_enum_locals(struct process* pcs, const char* mask,
* !foo fails always (despite what MSDN states)
* RE1!RE2 gets RE2 from BaseOfDll (whatever RE1 is)
*/
BOOL WINAPI SymEnumSymbols(HANDLE hProcess, ULONG BaseOfDll, PCSTR Mask,
BOOL WINAPI SymEnumSymbols(HANDLE hProcess, ULONG64 BaseOfDll, PCSTR Mask,
PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback,
PVOID UserContext)
{
@ -769,8 +770,9 @@ BOOL WINAPI SymEnumSymbols(HANDLE hProcess, ULONG BaseOfDll, PCSTR Mask,
const char* bang;
regex_t mod_regex, sym_regex;
TRACE("(%p %08lx %s %p %p)\n",
hProcess, BaseOfDll, debugstr_a(Mask), EnumSymbolsCallback, UserContext);
TRACE("(%p %s %s %p %p)\n",
hProcess, wine_dbgstr_longlong(BaseOfDll), debugstr_a(Mask),
EnumSymbolsCallback, UserContext);
if (!pcs) return FALSE;
@ -864,8 +866,8 @@ BOOL WINAPI SymEnumerateSymbols(HANDLE hProcess, DWORD BaseOfDll,
* SymFromAddr (DBGHELP.@)
*
*/
BOOL WINAPI SymFromAddr(HANDLE hProcess, DWORD Address,
DWORD* Displacement, PSYMBOL_INFO Symbol)
BOOL WINAPI SymFromAddr(HANDLE hProcess, DWORD64 Address,
DWORD64* Displacement, PSYMBOL_INFO Symbol)
{
struct process* pcs = process_find_by_handle(hProcess);
struct module* module;
@ -894,13 +896,16 @@ BOOL WINAPI SymGetSymFromAddr(HANDLE hProcess, DWORD Address,
char buffer[sizeof(SYMBOL_INFO) + 256];
SYMBOL_INFO*si = (SYMBOL_INFO*)buffer;
size_t len;
DWORD64 Displacement64;
if (Symbol->SizeOfStruct < sizeof(*Symbol)) return FALSE;
si->SizeOfStruct = sizeof(*si);
si->MaxNameLen = 256;
if (!SymFromAddr(hProcess, Address, Displacement, si))
if (!SymFromAddr(hProcess, Address, &Displacement64, si))
return FALSE;
if (Displacement)
*Displacement = Displacement64;
Symbol->Address = si->Address;
Symbol->Size = si->Size;
Symbol->Flags = si->Flags;

View File

@ -359,7 +359,7 @@ struct symt_typedef* symt_new_typedef(struct module* module, struct symt* ref,
* SymEnumTypes (DBGHELP.@)
*
*/
BOOL WINAPI SymEnumTypes(HANDLE hProcess, unsigned long BaseOfDll,
BOOL WINAPI SymEnumTypes(HANDLE hProcess, ULONG64 BaseOfDll,
PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback,
void* UserContext)
{
@ -371,8 +371,9 @@ BOOL WINAPI SymEnumTypes(HANDLE hProcess, unsigned long BaseOfDll,
struct symt* type;
void* pos = NULL;
TRACE("(%p %08lx %p %p)\n",
hProcess, BaseOfDll, EnumSymbolsCallback, UserContext);
TRACE("(%p %s %p %p)\n",
hProcess, wine_dbgstr_longlong(BaseOfDll), EnumSymbolsCallback,
UserContext);
if (!(pcs = process_find_by_handle(hProcess))) return FALSE;
module = module_find_by_addr(pcs, BaseOfDll, DMT_UNKNOWN);
@ -742,7 +743,7 @@ BOOL symt_get_info(const struct symt* type, IMAGEHLP_SYMBOL_TYPE_INFO req,
* SymGetTypeInfo (DBGHELP.@)
*
*/
BOOL WINAPI SymGetTypeInfo(HANDLE hProcess, unsigned long ModBase,
BOOL WINAPI SymGetTypeInfo(HANDLE hProcess, DWORD64 ModBase,
ULONG TypeId, IMAGEHLP_SYMBOL_TYPE_INFO GetType,
PVOID pInfo)
{
@ -754,7 +755,7 @@ BOOL WINAPI SymGetTypeInfo(HANDLE hProcess, unsigned long ModBase,
module = module_find_by_addr(pcs, ModBase, DMT_UNKNOWN);
if (!(module = module_get_debug(pcs, module)))
{
FIXME("Someone didn't properly set ModBase (0x%08lx)\n", ModBase);
FIXME("Someone didn't properly set ModBase (%s)\n", wine_dbgstr_longlong(ModBase));
return FALSE;
}
@ -765,7 +766,7 @@ BOOL WINAPI SymGetTypeInfo(HANDLE hProcess, unsigned long ModBase,
* SymGetTypeFromName (DBGHELP.@)
*
*/
BOOL WINAPI SymGetTypeFromName(HANDLE hProcess, unsigned long BaseOfDll,
BOOL WINAPI SymGetTypeFromName(HANDLE hProcess, ULONG64 BaseOfDll,
LPSTR Name, PSYMBOL_INFO Symbol)
{
struct process* pcs = process_find_by_handle(hProcess);

View File

@ -154,7 +154,7 @@ typedef struct _SOURCEFILE
typedef struct _IMAGEHLP_CBA_READ_MEMORY
{
DWORD addr;
DWORD64 addr;
PVOID buf;
DWORD bytes;
DWORD *bytesread;
@ -219,14 +219,14 @@ typedef struct _IMAGEHLP_DUPLICATE_SYMBOL
typedef struct _IMAGEHLP_STACK_FRAME
{
ULONG InstructionOffset;
ULONG ReturnOffset;
ULONG FrameOffset;
ULONG StackOffset;
ULONG BackingStoreOffset;
ULONG FuncTableEntry;
ULONG Params[4];
ULONG Reserved[5];
ULONG64 InstructionOffset;
ULONG64 ReturnOffset;
ULONG64 FrameOffset;
ULONG64 StackOffset;
ULONG64 BackingStoreOffset;
ULONG64 FuncTableEntry;
ULONG64 Params[4];
ULONG64 Reserved[5];
BOOL Virtual;
ULONG Reserved2;
} IMAGEHLP_STACK_FRAME, *PIMAGEHLP_STACK_FRAME;
@ -542,25 +542,25 @@ BOOL WINAPI MiniDumpReadDumpStream(PVOID,ULONG,PMINIDUMP_DIRECTORY*,PVOID*,ULONG
*************************/
typedef BOOL (CALLBACK *PENUMLOADED_MODULES_CALLBACK)(PSTR ModuleName, DWORD ModuleBase,
ULONG ModuleSize, PVOID UserContext);
extern BOOL WINAPI EnumerateLoadedModules(HANDLE hProcess,
PENUMLOADED_MODULES_CALLBACK EnumLoadedModulesCallback,
PVOID UserContext);
BOOL WINAPI EnumerateLoadedModules(HANDLE hProcess,
PENUMLOADED_MODULES_CALLBACK EnumLoadedModulesCallback,
PVOID UserContext);
typedef BOOL (CALLBACK *PSYM_ENUMMODULES_CALLBACK)(PSTR ModuleName, DWORD BaseOfDll,
PVOID UserContext);
extern BOOL WINAPI SymEnumerateModules(HANDLE hProcess,
PSYM_ENUMMODULES_CALLBACK EnumModulesCallback,
PVOID UserContext);
extern BOOL WINAPI SymGetModuleInfo(HANDLE hProcess, DWORD dwAddr,
PIMAGEHLP_MODULE ModuleInfo);
extern BOOL WINAPI SymGetModuleInfoW(HANDLE hProcess, DWORD dwAddr,
PIMAGEHLP_MODULEW ModuleInfo);
extern DWORD WINAPI SymGetModuleBase(HANDLE hProcess, DWORD dwAddr);
extern DWORD WINAPI SymLoadModule(HANDLE hProcess, HANDLE hFile, PSTR ImageName,
PSTR ModuleName, DWORD BaseOfDll, DWORD SizeOfDll);
extern DWORD WINAPI SymLoadModuleEx(HANDLE hProcess, HANDLE hFile, PSTR ImageName,
PSTR ModuleName, DWORD BaseOfDll, DWORD DllSize,
PMODLOAD_DATA Data, DWORD Flags);
extern BOOL WINAPI SymUnloadModule(HANDLE hProcess, DWORD BaseOfDll);
BOOL WINAPI SymEnumerateModules(HANDLE hProcess,
PSYM_ENUMMODULES_CALLBACK EnumModulesCallback,
PVOID UserContext);
BOOL WINAPI SymGetModuleInfo(HANDLE hProcess, DWORD dwAddr,
PIMAGEHLP_MODULE ModuleInfo);
BOOL WINAPI SymGetModuleInfoW(HANDLE hProcess, DWORD dwAddr,
PIMAGEHLP_MODULEW ModuleInfo);
DWORD WINAPI SymGetModuleBase(HANDLE hProcess, DWORD dwAddr);
DWORD WINAPI SymLoadModule(HANDLE hProcess, HANDLE hFile, PSTR ImageName,
PSTR ModuleName, DWORD BaseOfDll, DWORD SizeOfDll);
DWORD64 WINAPI SymLoadModuleEx(HANDLE hProcess, HANDLE hFile, PSTR ImageName,
PSTR ModuleName, DWORD64 BaseOfDll, DWORD DllSize,
PMODLOAD_DATA Data, DWORD Flags);
BOOL WINAPI SymUnloadModule(HANDLE hProcess, DWORD BaseOfDll);
/*************************
* Symbol Handling *
@ -593,13 +593,13 @@ typedef struct _SYMBOL_INFO
{
ULONG SizeOfStruct;
ULONG TypeIndex;
ULONG Reserved[2];
ULONG64 Reserved[2];
ULONG info; /* sdk states info, while MSDN says it's Index... */
ULONG Size;
ULONG ModBase;
ULONG64 ModBase;
ULONG Flags;
ULONG Value;
ULONG Address;
ULONG64 Value;
ULONG64 Address;
ULONG Register;
ULONG Scope;
ULONG Tag;
@ -664,23 +664,23 @@ typedef struct _TI_FINDCHILDREN_PARAMS
#define UNDNAME_NO_ARGUMENTS (0x2000)
#define UNDNAME_NO_SPECIAL_SYMS (0x4000)
BOOL WINAPI SymGetTypeInfo(HANDLE hProcess, DWORD ModBase, ULONG TypeId,
BOOL WINAPI SymGetTypeInfo(HANDLE hProcess, DWORD64 ModBase, ULONG TypeId,
IMAGEHLP_SYMBOL_TYPE_INFO GetType, PVOID);
typedef BOOL (CALLBACK *PSYM_ENUMERATESYMBOLS_CALLBACK)(PSYMBOL_INFO pSymInfo,
ULONG SymbolSize, PVOID UserContext);
BOOL WINAPI SymEnumTypes(HANDLE hProcess, DWORD BaseOfDll,
BOOL WINAPI SymEnumTypes(HANDLE hProcess, ULONG64 BaseOfDll,
PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback,
PVOID UserContext);
BOOL WINAPI SymFromAddr(HANDLE hProcess, DWORD addr, DWORD* displacement,
BOOL WINAPI SymFromAddr(HANDLE hProcess, DWORD64 addr, DWORD64* displacement,
SYMBOL_INFO* sym_info);
BOOL WINAPI SymFromName(HANDLE hProcess, LPSTR Name, PSYMBOL_INFO Symbol);
BOOL WINAPI SymGetSymFromAddr(HANDLE,DWORD,PDWORD,PIMAGEHLP_SYMBOL);
BOOL WINAPI SymGetSymFromName(HANDLE,PSTR,PIMAGEHLP_SYMBOL);
BOOL WINAPI SymGetTypeFromName(HANDLE hProcess, DWORD BaseOfDll, LPSTR Name,
BOOL WINAPI SymGetTypeFromName(HANDLE hProcess, ULONG64 BaseOfDll, LPSTR Name,
PSYMBOL_INFO Symbol);
BOOL WINAPI SymGetSymNext(HANDLE,PIMAGEHLP_SYMBOL);
BOOL WINAPI SymGetSymPrev(HANDLE,PIMAGEHLP_SYMBOL);
BOOL WINAPI SymEnumSymbols(HANDLE hProcess, ULONG BaseOfDll, PCSTR Mask,
BOOL WINAPI SymEnumSymbols(HANDLE hProcess, ULONG64 BaseOfDll, PCSTR Mask,
PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback,
PVOID UserContext);
typedef BOOL (CALLBACK *PSYM_ENUMSYMBOLS_CALLBACK)(PSTR SymbolName, DWORD SymbolAddress,
@ -703,7 +703,7 @@ DWORD WINAPI UnDecorateSymbolName(LPCSTR DecoratedName, LPSTR UnDecoratedName,
typedef BOOL (CALLBACK *PSYM_ENUMSOURCFILES_CALLBACK)(PSOURCEFILE pSourceFile,
PVOID UserContext);
BOOL WINAPI SymEnumSourceFiles(HANDLE hProcess, ULONG ModBase, LPSTR Mask,
BOOL WINAPI SymEnumSourceFiles(HANDLE hProcess, ULONG64 ModBase, LPSTR Mask,
PSYM_ENUMSOURCFILES_CALLBACK cbSrcFiles,
PVOID UserContext);
BOOL WINAPI SymGetLineFromAddr(HANDLE hProcess, DWORD dwAddr,

View File

@ -173,7 +173,7 @@ void* get_symbol(HANDLE hProcess, char* name, char* lib)
si->MaxNameLen = sizeof(buffer) - sizeof(IMAGEHLP_SYMBOL);
if (pSymLoadModule(hProcess, NULL, lib, NULL, 0, 0) &&
pSymFromName(hProcess, name, si))
ret = (void*)si->Address;
ret = (void*)(ULONG_PTR)si->Address;
pSymCleanup(hProcess);
}
return ret;

View File

@ -483,25 +483,25 @@ void print_address(const ADDRESS* addr, BOOLEAN with_line)
char buffer[sizeof(SYMBOL_INFO) + 256];
SYMBOL_INFO* si = (SYMBOL_INFO*)buffer;
void* lin = memory_to_linear_addr(addr);
DWORD disp;
DWORD64 disp;
print_bare_address(addr);
si->SizeOfStruct = sizeof(*si);
si->MaxNameLen = 256;
if (!SymFromAddr(dbg_curr_process->handle, (unsigned long)lin, &disp, si)) return;
if (!SymFromAddr(dbg_curr_process->handle, (DWORD_PTR)lin, &disp, si)) return;
dbg_printf(" %s", si->Name);
if (disp) dbg_printf("+0x%lx", disp);
if (disp) dbg_printf("+0x%lx", (DWORD_PTR)disp);
if (with_line)
{
IMAGEHLP_LINE il;
IMAGEHLP_MODULE im;
il.SizeOfStruct = sizeof(il);
if (SymGetLineFromAddr(dbg_curr_process->handle, (unsigned long)lin, NULL, &il))
if (SymGetLineFromAddr(dbg_curr_process->handle, (DWORD_PTR)lin, NULL, &il))
dbg_printf(" [%s:%lu]", il.FileName, il.LineNumber);
im.SizeOfStruct = sizeof(im);
if (SymGetModuleInfo(dbg_curr_process->handle, (unsigned long)lin, &im))
if (SymGetModuleInfo(dbg_curr_process->handle, (DWORD_PTR)lin, &im))
dbg_printf(" in %s", im.ModuleName);
}
}
@ -544,15 +544,15 @@ void print_addr_and_args(const ADDRESS* pc, const ADDRESS* frame)
IMAGEHLP_MODULE im;
struct sym_enum se;
char tmp[1024];
DWORD disp;
DWORD64 disp;
if (pc->Mode != AddrModeFlat)
dbg_printf("0x%04x:0x%04lx", pc->Segment, pc->Offset);
else
dbg_printf("0x%08lx", pc->Offset);
isf.InstructionOffset = (unsigned long)memory_to_linear_addr(pc);
isf.FrameOffset = (unsigned long)memory_to_linear_addr(frame);
isf.InstructionOffset = (DWORD_PTR)memory_to_linear_addr(pc);
isf.FrameOffset = (DWORD_PTR)memory_to_linear_addr(frame);
si->SizeOfStruct = sizeof(*si);
si->MaxNameLen = 256;
@ -560,7 +560,7 @@ void print_addr_and_args(const ADDRESS* pc, const ADDRESS* frame)
return;
dbg_printf(" %s", si->Name);
if (disp) dbg_printf("+0x%lx", disp);
if (disp) dbg_printf("+0x%lx", (DWORD_PTR)disp);
SymSetContext(dbg_curr_process->handle, &isf, NULL);
se.tmp = tmp;

View File

@ -614,7 +614,7 @@ static BOOL CALLBACK symbols_info_cb(SYMBOL_INFO* sym, ULONG size, void* ctx)
mi.ModuleName[len - 5] = '\0';
}
dbg_printf("%08lx: %s!%s", sym->Address, mi.ModuleName, sym->Name);
dbg_printf("%08lx: %s!%s", (ULONG_PTR)sym->Address, mi.ModuleName, sym->Name);
type.id = sym->TypeIndex;
type.module = sym->ModBase;