Commit 35d5c075 authored by Alexandre Julliard's avatar Alexandre Julliard

winedbg: Support setting a breakpoint from a file name and line number.

parent 04e9b16c
......@@ -292,7 +292,7 @@ static BOOL CALLBACK line_cb(SRCCODEINFO* sci, void* user)
*
* Add a breakpoint from a line number in current file
*/
void break_add_break_from_lineno(int lineno, BOOL swbp)
void break_add_break_from_lineno(const char *filename, int lineno, BOOL swbp)
{
struct cb_break_lineno bkln;
......@@ -301,20 +301,23 @@ void break_add_break_from_lineno(int lineno, BOOL swbp)
if (lineno != -1)
{
IMAGEHLP_LINE64 il;
DWORD disp;
DWORD_PTR linear = (DWORD_PTR)memory_to_linear_addr(&bkln.addr);
il.SizeOfStruct = sizeof(il);
if (!SymGetLineFromAddr64(dbg_curr_process->handle, linear, &disp, &il))
if (!filename)
{
dbg_printf("Unable to add breakpoint (unknown address %lx)\n", linear);
return;
DWORD disp;
il.SizeOfStruct = sizeof(il);
if (!SymGetLineFromAddr64(dbg_curr_process->handle, linear, &disp, &il))
{
dbg_printf("Unable to add breakpoint (unknown address %lx)\n", linear);
return;
}
filename = il.FileName;
}
bkln.addr.Offset = 0;
bkln.lineno = lineno;
SymEnumLines(dbg_curr_process->handle, linear, NULL, il.FileName, line_cb, &bkln);
SymEnumLines(dbg_curr_process->handle, linear, NULL, filename, line_cb, &bkln);
if (!bkln.addr.Offset)
{
dbg_printf("Unknown line number\n"
......
......@@ -233,14 +233,14 @@ print_command:
break_command:
tBREAK '*' expr_lvalue { break_add_break_from_lvalue(&$3, TRUE); }
| tBREAK identifier { break_add_break_from_id($2, -1, TRUE); }
| tBREAK identifier ':' tNUM { break_add_break_from_id($2, $4, TRUE); }
| tBREAK tNUM { break_add_break_from_lineno($2, TRUE); }
| tBREAK { break_add_break_from_lineno(-1, TRUE); }
| tBREAK pathname ':' tNUM { break_add_break_from_lineno($2, $4, TRUE); }
| tBREAK tNUM { break_add_break_from_lineno(NULL, $2, TRUE); }
| tBREAK { break_add_break_from_lineno(NULL, -1, TRUE); }
| tHBREAK '*' expr_lvalue { break_add_break_from_lvalue(&$3, FALSE); }
| tHBREAK identifier { break_add_break_from_id($2, -1, FALSE); }
| tHBREAK identifier ':' tNUM { break_add_break_from_id($2, $4, FALSE); }
| tHBREAK tNUM { break_add_break_from_lineno($2, FALSE); }
| tHBREAK { break_add_break_from_lineno(-1, FALSE); }
| tHBREAK pathname ':' tNUM { break_add_break_from_lineno($2, $4, FALSE); }
| tHBREAK tNUM { break_add_break_from_lineno(NULL, $2, FALSE); }
| tHBREAK { break_add_break_from_lineno(NULL, -1, FALSE); }
| tENABLE tNUM { break_enable_xpoint($2, TRUE); }
| tENABLE tBREAK tNUM { break_enable_xpoint($3, TRUE); }
| tDISABLE tNUM { break_enable_xpoint($2, FALSE); }
......
......@@ -200,8 +200,8 @@ STRING \"[^\n"]+\"
<INITIAL,NOPROCESS>source|sourc|sour|src { BEGIN(PATH_EXPECTED); return tSOURCE; }
<INITIAL>symbolfile|symbols|symbol|sf { BEGIN(PATH_EXPECTED); return tSYMBOLFILE; }
<INITIAL,INFO_CMD,BD_CMD>break|brea|bre|br|b { BEGIN(NOCMD); return tBREAK; }
<INITIAL,INFO_CMD,BD_CMD>hbreak|hbrea|hbre|hbr|hb { BEGIN(NOCMD); return tHBREAK; }
<INITIAL,INFO_CMD,BD_CMD>break|brea|bre|br|b { BEGIN(PATH_ACCEPTED); return tBREAK; }
<INITIAL,INFO_CMD,BD_CMD>hbreak|hbrea|hbre|hbr|hb { BEGIN(PATH_ACCEPTED); return tHBREAK; }
<INITIAL>watch|watc|wat { BEGIN(NOCMD); return tWATCH; }
<INITIAL>rwatch|rwatc|rwat { BEGIN(NOCMD); return tRWATCH; }
<INITIAL>whatis|whati|what { BEGIN(NOCMD); return tWHATIS; }
......
......@@ -293,7 +293,7 @@ extern void break_set_xpoints(BOOL set);
extern BOOL break_add_break(const ADDRESS64* addr, BOOL verbose, BOOL swbp);
extern BOOL break_add_break_from_lvalue(const struct dbg_lvalue* value, BOOL swbp);
extern void break_add_break_from_id(const char* name, int lineno, BOOL swbp);
extern void break_add_break_from_lineno(int lineno, BOOL swbp);
extern void break_add_break_from_lineno(const char *filename, int lineno, BOOL swbp);
extern void break_add_watch_from_lvalue(const struct dbg_lvalue* lvalue, BOOL is_write);
extern void break_add_watch_from_id(const char* name, BOOL is_write);
extern void break_check_delayed_bp(void);
......
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