Commit 499cff6f authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

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

displacements (in most of the functions) are not optional.
parent dff207d3
......@@ -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;
}
......
......@@ -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);
......
......@@ -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:
......
......@@ -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); } }
......
......@@ -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);
}
......
......@@ -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);
}
......@@ -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;
......
......@@ -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;
}
......
......@@ -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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment