Cleanup of dbghelp.h (and a couple of definition fixes). The

displacements (in most of the functions) are not optional.
This commit is contained in:
Eric Pouech 2005-01-31 11:34:59 +00:00 committed by Alexandre Julliard
parent dff207d3ce
commit 499cff6f26
10 changed files with 116 additions and 157 deletions

View File

@ -888,7 +888,7 @@ BOOL WINAPI SymFromAddr(HANDLE hProcess, DWORD64 Address,
sym = module->addr_sorttab[idx];
symt_fill_sym_info(module, &sym->symt, Symbol);
if (Displacement) *Displacement = Address - Symbol->Address;
*Displacement = Address - Symbol->Address;
return TRUE;
}
@ -1081,7 +1081,7 @@ BOOL WINAPI SymGetLineFromAddr(HANDLE hProcess, DWORD dwAddr,
if (!symt_fill_func_line_info(module,
(struct symt_function*)module->addr_sorttab[idx],
dwAddr, Line)) return FALSE;
if (pdwDisplacement) *pdwDisplacement = dwAddr - Line->Address;
*pdwDisplacement = dwAddr - Line->Address;
return TRUE;
}

View File

@ -137,7 +137,7 @@ typedef struct _IMAGEHLP_LINE
typedef struct _SOURCEFILE
{
DWORD ModBase;
DWORD64 ModBase;
PCHAR FileName;
} SOURCEFILE, *PSOURCEFILE;
@ -160,7 +160,8 @@ typedef struct _IMAGEHLP_CBA_READ_MEMORY
DWORD *bytesread;
} IMAGEHLP_CBA_READ_MEMORY, *PIMAGEHLP_CBA_READ_MEMORY;
enum {
enum
{
sevInfo = 0,
sevProblem,
sevAttn,
@ -170,16 +171,16 @@ enum {
typedef struct _IMAGEHLP_CBA_EVENT
{
DWORD severity;
DWORD code;
PCHAR desc;
PVOID object;
DWORD severity;
DWORD code;
PCHAR desc;
PVOID object;
} IMAGEHLP_CBA_EVENT, *PIMAGEHLP_CBA_EVENT;
typedef struct _IMAGEHLP_DEFERRED_SYMBOL_LOAD
{
DWORD SizeOfStruct;
DWORD64 BaseOfImage;
DWORD BaseOfImage;
DWORD CheckSum;
DWORD TimeDateStamp;
CHAR FileName[MAX_PATH];
@ -540,27 +541,17 @@ BOOL WINAPI MiniDumpReadDumpStream(PVOID,ULONG,PMINIDUMP_DIRECTORY*,PVOID*,ULONG
/*************************
* MODULE handling *
*************************/
typedef BOOL (CALLBACK *PENUMLOADED_MODULES_CALLBACK)(PSTR ModuleName, DWORD ModuleBase,
ULONG ModuleSize, 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);
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);
typedef BOOL (CALLBACK *PENUMLOADED_MODULES_CALLBACK)(PSTR, DWORD, ULONG, PVOID);
BOOL WINAPI EnumerateLoadedModules(HANDLE, PENUMLOADED_MODULES_CALLBACK, PVOID);
typedef BOOL (CALLBACK *PSYM_ENUMMODULES_CALLBACK)(PSTR, DWORD, PVOID);
BOOL WINAPI SymEnumerateModules(HANDLE, PSYM_ENUMMODULES_CALLBACK, PVOID);
BOOL WINAPI SymGetModuleInfo(HANDLE, DWORD, PIMAGEHLP_MODULE);
BOOL WINAPI SymGetModuleInfoW(HANDLE, DWORD, PIMAGEHLP_MODULEW);
DWORD WINAPI SymGetModuleBase(HANDLE, DWORD);
DWORD WINAPI SymLoadModule(HANDLE, HANDLE, PSTR, PSTR, DWORD, DWORD);
DWORD64 WINAPI SymLoadModuleEx(HANDLE, HANDLE, PSTR, PSTR, DWORD64, DWORD,
PMODLOAD_DATA, DWORD);
BOOL WINAPI SymUnloadModule(HANDLE, DWORD);
/*************************
* Symbol Handling *
@ -664,101 +655,70 @@ typedef struct _TI_FINDCHILDREN_PARAMS
#define UNDNAME_NO_ARGUMENTS (0x2000)
#define UNDNAME_NO_SPECIAL_SYMS (0x4000)
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, ULONG64 BaseOfDll,
PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback,
PVOID UserContext);
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, ULONG64 BaseOfDll, LPSTR Name,
PSYMBOL_INFO Symbol);
BOOL WINAPI SymGetSymNext(HANDLE,PIMAGEHLP_SYMBOL);
BOOL WINAPI SymGetSymPrev(HANDLE,PIMAGEHLP_SYMBOL);
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,
ULONG SymbolSize, PVOID UserContext);
BOOL WINAPI SymEnumerateSymbols(HANDLE hProcess, DWORD BaseOfDll,
PSYM_ENUMSYMBOLS_CALLBACK EnumSymbolsCallback,
PVOID UserContext);
typedef BOOL (CALLBACK *PSYMBOL_REGISTERED_CALLBACK)(HANDLE hProcess, ULONG ActionCode,
PVOID CallbackData, PVOID UserContext);
BOOL WINAPI SymRegisterCallback(HANDLE hProcess,
PSYMBOL_REGISTERED_CALLBACK CallbackFunction,
PVOID UserContext);
BOOL WINAPI SymUnDName(PIMAGEHLP_SYMBOL,PSTR,DWORD);
DWORD WINAPI UnDecorateSymbolName(LPCSTR DecoratedName, LPSTR UnDecoratedName,
DWORD UndecoratedLength, DWORD Flags);
BOOL WINAPI SymGetTypeInfo(HANDLE, DWORD64, ULONG, IMAGEHLP_SYMBOL_TYPE_INFO, PVOID);
typedef BOOL (CALLBACK *PSYM_ENUMERATESYMBOLS_CALLBACK)(PSYMBOL_INFO, ULONG, PVOID);
BOOL WINAPI SymEnumTypes(HANDLE, ULONG64, PSYM_ENUMERATESYMBOLS_CALLBACK, PVOID);
BOOL WINAPI SymFromAddr(HANDLE, DWORD64, DWORD64*, SYMBOL_INFO*);
BOOL WINAPI SymFromName(HANDLE, LPSTR, PSYMBOL_INFO);
BOOL WINAPI SymGetSymFromAddr(HANDLE, DWORD, PDWORD, PIMAGEHLP_SYMBOL);
BOOL WINAPI SymGetSymFromName(HANDLE, PSTR, PIMAGEHLP_SYMBOL);
BOOL WINAPI SymGetTypeFromName(HANDLE, ULONG64, LPSTR, PSYMBOL_INFO);
BOOL WINAPI SymGetSymNext(HANDLE, PIMAGEHLP_SYMBOL);
BOOL WINAPI SymGetSymPrev(HANDLE, PIMAGEHLP_SYMBOL);
BOOL WINAPI SymEnumSymbols(HANDLE, ULONG64, PCSTR, PSYM_ENUMERATESYMBOLS_CALLBACK,
PVOID);
typedef BOOL (CALLBACK *PSYM_ENUMSYMBOLS_CALLBACK)(PSTR, DWORD, ULONG, PVOID);
BOOL WINAPI SymEnumerateSymbols(HANDLE, DWORD, PSYM_ENUMSYMBOLS_CALLBACK, PVOID);
typedef BOOL (CALLBACK *PSYMBOL_REGISTERED_CALLBACK)(HANDLE, ULONG, PVOID, PVOID);
BOOL WINAPI SymRegisterCallback(HANDLE, PSYMBOL_REGISTERED_CALLBACK, PVOID);
BOOL WINAPI SymUnDName(PIMAGEHLP_SYMBOL, PSTR, DWORD);
DWORD WINAPI UnDecorateSymbolName(LPCSTR, LPSTR, DWORD, DWORD);
/*************************
* Source Files *
*************************/
typedef BOOL (CALLBACK *PSYM_ENUMSOURCFILES_CALLBACK)(PSOURCEFILE pSourceFile,
PVOID UserContext);
typedef BOOL (CALLBACK *PSYM_ENUMSOURCFILES_CALLBACK)(PSOURCEFILE, PVOID);
BOOL WINAPI SymEnumSourceFiles(HANDLE hProcess, ULONG64 ModBase, LPSTR Mask,
PSYM_ENUMSOURCFILES_CALLBACK cbSrcFiles,
PVOID UserContext);
BOOL WINAPI SymGetLineFromAddr(HANDLE hProcess, DWORD dwAddr,
PDWORD pdwDisplacement, PIMAGEHLP_LINE Line);
BOOL WINAPI SymGetLinePrev(HANDLE hProcess, PIMAGEHLP_LINE Line);
BOOL WINAPI SymGetLineNext(HANDLE hProcess, PIMAGEHLP_LINE Line);
BOOL WINAPI SymEnumSourceFiles(HANDLE, ULONG64, LPSTR, PSYM_ENUMSOURCFILES_CALLBACK,
PVOID);
BOOL WINAPI SymGetLineFromAddr(HANDLE, DWORD, PDWORD, PIMAGEHLP_LINE);
BOOL WINAPI SymGetLinePrev(HANDLE, PIMAGEHLP_LINE);
BOOL WINAPI SymGetLineNext(HANDLE, PIMAGEHLP_LINE);
/*************************
* File & image handling *
*************************/
BOOL WINAPI SymInitialize(HANDLE hProcess, PSTR UserSearchPath, BOOL fInvadeProcess);
BOOL WINAPI SymCleanup(HANDLE hProcess);
BOOL WINAPI SymInitialize(HANDLE, PSTR, BOOL);
BOOL WINAPI SymCleanup(HANDLE);
HANDLE WINAPI FindDebugInfoFile(PSTR FileName, PSTR SymbolPath, PSTR DebugFilePath);
typedef BOOL (CALLBACK *PFIND_DEBUG_FILE_CALLBACK)(HANDLE FileHandle, PSTR FileName,
PVOID CallerData);
HANDLE WINAPI FindDebugInfoFileEx(PSTR FileName, PSTR SymbolPath, PSTR DebugFilePath,
PFIND_DEBUG_FILE_CALLBACK Callback, PVOID CallerData);
typedef BOOL (CALLBACK *PFINDFILEINPATHCALLBACK)(PSTR filename, PVOID context);
BOOL WINAPI SymFindFileInPath(HANDLE hProcess, LPSTR searchPath, LPSTR FileName,
PVOID id, DWORD two, DWORD three, DWORD flags,
LPSTR FilePath, PFINDFILEINPATHCALLBACK callback,
PVOID context);
HANDLE WINAPI FindExecutableImage(PSTR FileName, PSTR SymbolPath, PSTR ImageFilePath);
typedef BOOL (CALLBACK *PFIND_EXE_FILE_CALLBACK)(HANDLE FileHandle, PSTR FileName,
PVOID CallerData);
HANDLE WINAPI FindExecutableImageEx(PSTR FileName, PSTR SymbolPath, PSTR ImageFilePath,
PFIND_EXE_FILE_CALLBACK Callback, PVOID CallerData);
PIMAGE_NT_HEADERS WINAPI ImageNtHeader(PVOID Base);
PVOID WINAPI ImageDirectoryEntryToDataEx(PVOID Base, BOOLEAN MappedAsImage,
USHORT DirectoryEntry, PULONG Size,
PIMAGE_SECTION_HEADER *FoundHeader);
PVOID WINAPI ImageDirectoryEntryToData(PVOID Base, BOOLEAN MappedAsImage,
USHORT DirectoryEntry, PULONG Size);
PIMAGE_SECTION_HEADER WINAPI ImageRvaToSection(PIMAGE_NT_HEADERS NtHeaders,
PVOID Base, ULONG Rva);
PVOID WINAPI ImageRvaToVa(PIMAGE_NT_HEADERS NtHeaders, PVOID Base,
ULONG Rva, OUT PIMAGE_SECTION_HEADER *LastRvaSection);
BOOL WINAPI SymGetSearchPath(HANDLE,PSTR,DWORD);
BOOL WINAPI SymSetSearchPath(HANDLE,PSTR);
HANDLE WINAPI FindDebugInfoFile(PSTR, PSTR, PSTR);
typedef BOOL (CALLBACK *PFIND_DEBUG_FILE_CALLBACK)(HANDLE, PSTR, PVOID);
HANDLE WINAPI FindDebugInfoFileEx(PSTR, PSTR, PSTR, PFIND_DEBUG_FILE_CALLBACK, PVOID);
typedef BOOL (CALLBACK *PFINDFILEINPATHCALLBACK)(PSTR, PVOID);
BOOL WINAPI SymFindFileInPath(HANDLE, LPSTR, LPSTR, PVOID, DWORD, DWORD, DWORD,
LPSTR, PFINDFILEINPATHCALLBACK, PVOID);
HANDLE WINAPI FindExecutableImage(PSTR, PSTR, PSTR);
typedef BOOL (CALLBACK *PFIND_EXE_FILE_CALLBACK)(HANDLE, PSTR, PVOID);
HANDLE WINAPI FindExecutableImageEx(PSTR, PSTR, PSTR, PFIND_EXE_FILE_CALLBACK, PVOID);
PIMAGE_NT_HEADERS WINAPI ImageNtHeader(PVOID);
PVOID WINAPI ImageDirectoryEntryToDataEx(PVOID, BOOLEAN, USHORT, PULONG,
PIMAGE_SECTION_HEADER *);
PVOID WINAPI ImageDirectoryEntryToData(PVOID, BOOLEAN, USHORT, PULONG);
PIMAGE_SECTION_HEADER WINAPI ImageRvaToSection(PIMAGE_NT_HEADERS, PVOID, ULONG);
PVOID WINAPI ImageRvaToVa(PIMAGE_NT_HEADERS, PVOID, ULONG, PIMAGE_SECTION_HEADER*);
BOOL WINAPI SymGetSearchPath(HANDLE, PSTR, DWORD);
BOOL WINAPI SymSetSearchPath(HANDLE, PSTR);
DWORD WINAPI GetTimestampForLoadedLibrary(HMODULE);
BOOL WINAPI MakeSureDirectoryPathExists(PCSTR);
BOOL WINAPI SearchTreeForFile(PSTR,PSTR,PSTR);
typedef BOOL (CALLBACK *PENUMDIRTREE_CALLBACK)(LPCSTR path, PVOID user);
BOOL WINAPI EnumDirTree(HANDLE hProcess, PCSTR root, PCSTR file,
LPSTR buffer, PENUMDIRTREE_CALLBACK cb, void* user);
BOOL WINAPI SymMatchFileName(LPSTR file, LPSTR match, LPSTR* filestop, LPSTR* matchstop);
BOOL WINAPI SearchTreeForFile(PSTR, PSTR, PSTR);
typedef BOOL (CALLBACK *PENUMDIRTREE_CALLBACK)(LPCSTR, PVOID);
BOOL WINAPI EnumDirTree(HANDLE, PCSTR, PCSTR, LPSTR, PENUMDIRTREE_CALLBACK, void*);
BOOL WINAPI SymMatchFileName(LPSTR, LPSTR, LPSTR*, LPSTR*);
/*************************
* Context management *
*************************/
BOOL WINAPI SymSetContext(HANDLE hProcess, PIMAGEHLP_STACK_FRAME StackFrame,
PIMAGEHLP_CONTEXT Context);
BOOL WINAPI SymSetContext(HANDLE, PIMAGEHLP_STACK_FRAME, PIMAGEHLP_CONTEXT);
/*************************
@ -788,29 +748,21 @@ typedef struct _STACKFRAME
BOOL Virtual;
DWORD Reserved[3];
KDHELP KdHelp;
ADDRESS AddrBStore;
} STACKFRAME, *LPSTACKFRAME;
typedef BOOL (CALLBACK *PREAD_PROCESS_MEMORY_ROUTINE)
(HANDLE hProcess, LPCVOID lpBaseAddress, PVOID lpBuffer,
DWORD nSize, PDWORD lpNumberOfBytesRead);
(HANDLE, LPCVOID, PVOID, DWORD, PDWORD);
typedef PVOID (CALLBACK *PFUNCTION_TABLE_ACCESS_ROUTINE)(HANDLE, DWORD);
typedef DWORD (CALLBACK *PGET_MODULE_BASE_ROUTINE)(HANDLE, DWORD);
typedef DWORD (CALLBACK *PTRANSLATE_ADDRESS_ROUTINE)(HANDLE, HANDLE, LPADDRESS);
BOOL WINAPI StackWalk(DWORD, HANDLE, HANDLE, LPSTACKFRAME, PVOID,
PREAD_PROCESS_MEMORY_ROUTINE,
PFUNCTION_TABLE_ACCESS_ROUTINE,
PGET_MODULE_BASE_ROUTINE,
PTRANSLATE_ADDRESS_ROUTINE);
typedef PVOID (CALLBACK *PFUNCTION_TABLE_ACCESS_ROUTINE)
(HANDLE hProcess, DWORD AddrBase);
typedef DWORD (CALLBACK *PGET_MODULE_BASE_ROUTINE)
(HANDLE hProcess, DWORD ReturnAddress);
typedef DWORD (CALLBACK *PTRANSLATE_ADDRESS_ROUTINE)
(HANDLE hProcess, HANDLE hThread, LPADDRESS lpaddr);
BOOL WINAPI StackWalk(DWORD MachineType, HANDLE hProcess, HANDLE hThread,
LPSTACKFRAME StackFrame, PVOID ContextRecord,
PREAD_PROCESS_MEMORY_ROUTINE ReadMemoryRoutine,
PFUNCTION_TABLE_ACCESS_ROUTINE FunctionTableAccessRoutine,
PGET_MODULE_BASE_ROUTINE GetModuleBaseRoutine,
PTRANSLATE_ADDRESS_ROUTINE TranslateAddress);
PVOID WINAPI SymFunctionTableAccess(HANDLE hProcess, DWORD AddrBase);
PVOID WINAPI SymFunctionTableAccess(HANDLE, DWORD);
/*************************
* Version, global stuff *
@ -825,7 +777,7 @@ typedef struct API_VERSION
} API_VERSION, *LPAPI_VERSION;
LPAPI_VERSION WINAPI ImagehlpApiVersion(void);
LPAPI_VERSION WINAPI ImagehlpApiVersionEx(LPAPI_VERSION AppVersion);
LPAPI_VERSION WINAPI ImagehlpApiVersionEx(LPAPI_VERSION);
typedef struct _IMAGE_DEBUG_INFORMATION
{
@ -863,10 +815,9 @@ typedef struct _IMAGE_DEBUG_INFORMATION
} IMAGE_DEBUG_INFORMATION, *PIMAGE_DEBUG_INFORMATION;
PIMAGE_DEBUG_INFORMATION WINAPI MapDebugInformation(HANDLE FileHandle, PSTR FileName,
PSTR SymbolPath, DWORD ImageBase);
PIMAGE_DEBUG_INFORMATION WINAPI MapDebugInformation(HANDLE, PSTR, PSTR, DWORD);
BOOL WINAPI UnmapDebugInformation(PIMAGE_DEBUG_INFORMATION DebugInfo);
BOOL WINAPI UnmapDebugInformation(PIMAGE_DEBUG_INFORMATION);
DWORD WINAPI SymGetOptions(void);
DWORD WINAPI SymSetOptions(DWORD);

View File

@ -269,10 +269,11 @@ void break_add_break_from_lineno(int lineno)
IMAGEHLP_LINE il;
IMAGEHLP_LINE iil;
BOOL found = FALSE;
DWORD disp;
il.SizeOfStruct = sizeof(il);
if (!SymGetLineFromAddr(dbg_curr_process->handle,
(DWORD)memory_to_linear_addr(&addr), NULL, &il))
(DWORD)memory_to_linear_addr(&addr), &disp, &il))
{
dbg_printf("Unable to add breakpoint (unknown address)\n");
return;
@ -353,8 +354,8 @@ void break_check_delayed_bp(void)
*/
static void break_add_watch(const struct dbg_lvalue* lvalue, BOOL is_write)
{
int num;
DWORD l = 4;
int num;
DWORD l = 4;
num = init_xpoint((is_write) ? be_xpoint_watch_write : be_xpoint_watch_read,
&lvalue->addr);

View File

@ -170,8 +170,8 @@ list_arg:
| pathname ':' tNUM { $$.FileName = $1; $$.LineNumber = $3; }
| identifier { symbol_get_line(NULL, $1, &$$); }
| pathname ':' identifier { symbol_get_line($3, $1, &$$); }
| '*' expr_lvalue { $$.SizeOfStruct = sizeof($$);
SymGetLineFromAddr(dbg_curr_process->handle, (unsigned long)memory_to_linear_addr(& $2.addr), NULL, & $$); }
| '*' expr_lvalue { DWORD disp; $$.SizeOfStruct = sizeof($$);
SymGetLineFromAddr(dbg_curr_process->handle, (unsigned long)memory_to_linear_addr(& $2.addr), &disp, & $$); }
;
run_command:

View File

@ -207,7 +207,7 @@ all { return tALL; }
<PATH_EXPECTED>{PATHNAME} { yylval.string = lexeme_alloc(yytext); return tPATH; }
<*>[ \t]+ /* Eat up whitespace */
<*>[ \t\r]+ /* Eat up whitespace and DOS LF */
<NOPROCESS>. { BEGIN(ASTRING_EXPECTED); yyless(0); return tNOPROCESS;}
<*>. { if (syntax_error == 0) { syntax_error++; dbg_printf("Syntax Error (%s)\n", yytext); } }

View File

@ -483,22 +483,23 @@ 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);
DWORD64 disp;
DWORD64 disp64;
DWORD disp;
print_bare_address(addr);
si->SizeOfStruct = sizeof(*si);
si->MaxNameLen = 256;
if (!SymFromAddr(dbg_curr_process->handle, (DWORD_PTR)lin, &disp, si)) return;
if (!SymFromAddr(dbg_curr_process->handle, (DWORD_PTR)lin, &disp64, si)) return;
dbg_printf(" %s", si->Name);
if (disp) dbg_printf("+0x%lx", (DWORD_PTR)disp);
if (disp64) dbg_printf("+0x%lx", (DWORD_PTR)disp64);
if (with_line)
{
IMAGEHLP_LINE il;
IMAGEHLP_MODULE im;
il.SizeOfStruct = sizeof(il);
if (SymGetLineFromAddr(dbg_curr_process->handle, (DWORD_PTR)lin, NULL, &il))
if (SymGetLineFromAddr(dbg_curr_process->handle, (DWORD_PTR)lin, &disp, &il))
dbg_printf(" [%s:%lu]", il.FileName, il.LineNumber);
im.SizeOfStruct = sizeof(im);
if (SymGetModuleInfo(dbg_curr_process->handle, (DWORD_PTR)lin, &im))
@ -542,7 +543,7 @@ void print_addr_and_args(const ADDRESS* pc, const ADDRESS* frame)
IMAGEHLP_STACK_FRAME isf;
IMAGEHLP_LINE il;
IMAGEHLP_MODULE im;
DWORD64 disp;
DWORD64 disp64;
print_bare_address(pc);
@ -556,13 +557,14 @@ void print_addr_and_args(const ADDRESS* pc, const ADDRESS* frame)
si->SizeOfStruct = sizeof(*si);
si->MaxNameLen = 256;
if (SymFromAddr(dbg_curr_process->handle, isf.InstructionOffset, &disp, si))
if (SymFromAddr(dbg_curr_process->handle, isf.InstructionOffset, &disp64, si))
{
struct sym_enum se;
char tmp[1024];
DWORD disp;
dbg_printf(" %s", si->Name);
if (disp) dbg_printf("+0x%lx", (DWORD_PTR)disp);
if (disp) dbg_printf("+0x%lx", (DWORD_PTR)disp64);
SymSetContext(dbg_curr_process->handle, &isf, NULL);
se.tmp = tmp;
@ -573,7 +575,7 @@ void print_addr_and_args(const ADDRESS* pc, const ADDRESS* frame)
il.SizeOfStruct = sizeof(il);
if (SymGetLineFromAddr(dbg_curr_process->handle, isf.InstructionOffset,
NULL, &il))
&disp, &il))
dbg_printf(" [%s:%lu]", il.FileName, il.LineNumber);
dbg_printf(" in %s", im.ModuleName);
}

View File

@ -228,7 +228,7 @@ static int source_display(const char* sourcefile, int start, int end)
ol->nlines = 0;
ol->linelist = NULL;
source_ofiles = ol;
dbg_printf("Unable to open file %s\n", tmppath);
dbg_printf("Unable to open file '%s'\n", tmppath);
return FALSE;
}
}
@ -359,6 +359,7 @@ void source_list_from_addr(const ADDRESS* addr, int nlines)
{
IMAGEHLP_LINE il;
ADDRESS la;
DWORD disp;
if (!addr)
{
@ -369,6 +370,6 @@ void source_list_from_addr(const ADDRESS* addr, int nlines)
il.SizeOfStruct = sizeof(il);
if (SymGetLineFromAddr(dbg_curr_process->handle,
(unsigned long)memory_to_linear_addr(addr),
NULL, &il))
&disp, &il))
source_list(&il, NULL, nlines);
}

View File

@ -78,6 +78,7 @@ int stack_set_frame(int newframe)
int stack_get_frame(SYMBOL_INFO* symbol, IMAGEHLP_STACK_FRAME* ihsf)
{
DWORD64 disp;
/*
* If we don't have a valid backtrace, then just return.
*/
@ -87,8 +88,9 @@ int stack_get_frame(SYMBOL_INFO* symbol, IMAGEHLP_STACK_FRAME* ihsf)
* If we don't know what the current function is, then we also have
* nothing to report here.
*/
SymFromAddr(dbg_curr_process->handle, frames[dbg_curr_frame].InstructionOffset,
NULL, symbol);
if (!SymFromAddr(dbg_curr_process->handle, frames[dbg_curr_frame].InstructionOffset,
&disp, symbol))
return FALSE;
if (ihsf) *ihsf = frames[dbg_curr_frame];
return TRUE;

View File

@ -127,8 +127,9 @@ static BOOL CALLBACK sgv_cb(SYMBOL_INFO* sym, ULONG size, void* ctx)
}
else
{
DWORD disp;
il.SizeOfStruct = sizeof(il);
SymGetLineFromAddr(dbg_curr_process->handle, sym->Address, NULL, &il);
SymGetLineFromAddr(dbg_curr_process->handle, sym->Address, &disp, &il);
if (sgv->filename && strcmp(sgv->filename, il.FileName))
{
WINE_FIXME("File name mismatch (%s / %s)\n", sgv->filename, il.FileName);
@ -425,7 +426,7 @@ enum dbg_line_status symbol_get_function_line_status(const ADDRESS* addr)
{
IMAGEHLP_LINE il;
DWORD disp, size;
ULONG64 start;
ULONG64 disp64, start;
DWORD lin = (DWORD)memory_to_linear_addr(addr);
char buffer[sizeof(SYMBOL_INFO) + 256];
SYMBOL_INFO* sym = (SYMBOL_INFO*)buffer;
@ -436,7 +437,7 @@ enum dbg_line_status symbol_get_function_line_status(const ADDRESS* addr)
sym->MaxNameLen = sizeof(buffer) - sizeof(SYMBOL_INFO);
/* do we have some info for lin address ? */
if (!SymFromAddr(dbg_curr_process->handle, lin, NULL, sym))
if (!SymFromAddr(dbg_curr_process->handle, lin, &disp64, sym))
return dbg_no_line_info;
switch (sym->Tag)
@ -480,7 +481,7 @@ BOOL symbol_get_line(const char* filename, const char* name, IMAGEHLP_LINE* line
{
struct sgv_data sgv;
char buffer[512];
DWORD opt;
DWORD opt, disp;
sgv.num = 0;
sgv.num_thunks = 0;
@ -527,7 +528,7 @@ BOOL symbol_get_line(const char* filename, const char* name, IMAGEHLP_LINE* line
case 1:
return SymGetLineFromAddr(dbg_curr_process->handle,
(DWORD)memory_to_linear_addr(&sgv.syms[0].lvalue.addr),
NULL, line);
&disp, line);
}
return TRUE;
}

View File

@ -154,8 +154,9 @@ static BOOL types_get_udt_element_lvalue(struct dbg_lvalue* lvalue,
if (types_get_info(type, TI_GET_BITPOSITION, &bitoffset))
{
types_get_info(type, TI_GET_LENGTH, &length);
if (length > sizeof(*tmpbuf)) return FALSE;
if (!types_get_info(type, TI_GET_LENGTH, &length) ||
length > sizeof(*tmpbuf))
return FALSE;
/*
* Bitfield operation. We have to extract the field and store
* it in a temporary buffer so that we get it all right.