winedbg: Fix 'break file : lineno' command so that file can be in other modules than the current one.

This commit is contained in:
Eric Pouech 2011-03-07 22:41:09 +01:00 committed by Alexandre Julliard
parent 2d570921dc
commit cf7120b8cc
1 changed files with 36 additions and 24 deletions

View File

@ -270,6 +270,7 @@ void break_add_break_from_id(const char *name, int lineno, BOOL swbp)
struct cb_break_lineno
{
const char* filename;
int lineno;
ADDRESS64 addr;
};
@ -287,6 +288,17 @@ static BOOL CALLBACK line_cb(SRCCODEINFO* sci, void* user)
return TRUE;
}
static BOOL CALLBACK mcb(PCWSTR module, DWORD64 base, void* user)
{
struct cb_break_lineno* bkln = user;
SymEnumLines(dbg_curr_process->handle, base, NULL, bkln->filename, line_cb, bkln);
/* continue module enum if no addr found
* FIXME: we don't report when several addresses match the same filename/lineno pair
*/
return !bkln->addr.Offset;
}
/***********************************************************************
* break_add_break_from_lineno
*
@ -295,18 +307,18 @@ static BOOL CALLBACK line_cb(SRCCODEINFO* sci, void* user)
void break_add_break_from_lineno(const char *filename, int lineno, BOOL swbp)
{
struct cb_break_lineno bkln;
memory_get_current_pc(&bkln.addr);
if (lineno != -1)
{
IMAGEHLP_LINE64 il;
DWORD_PTR linear = (DWORD_PTR)memory_to_linear_addr(&bkln.addr);
bkln.addr.Offset = 0;
bkln.lineno = lineno;
if (!filename)
{
DWORD disp;
ADDRESS64 curr;
IMAGEHLP_LINE64 il;
DWORD_PTR linear;
memory_get_current_pc(&curr);
linear = (DWORD_PTR)memory_to_linear_addr(&curr);
il.SizeOfStruct = sizeof(il);
if (!SymGetLineFromAddr64(dbg_curr_process->handle, linear, &disp, &il))
{
@ -314,19 +326,19 @@ void break_add_break_from_lineno(const char *filename, int lineno, BOOL swbp)
return;
}
filename = il.FileName;
}
bkln.addr.Offset = 0;
bkln.lineno = lineno;
SymEnumLines(dbg_curr_process->handle, linear, NULL, filename, line_cb, &bkln);
if (!bkln.addr.Offset)
}
else
{
/* we have to enumerate across modules */
bkln.filename = filename;
SymEnumerateModulesW64(dbg_curr_process->handle, mcb, &bkln);
}
if (bkln.addr.Offset)
break_add_break(&bkln.addr, TRUE, swbp);
else
dbg_printf("Unknown line number\n"
"(either out of file, or no code at given line number)\n");
return;
}
}
break_add_break(&bkln.addr, TRUE, swbp);
}
/***********************************************************************