Commit 99e07b5b authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

- fixed regression in watchpoint setting (by addr)

- in backtrace, show at least module when no symbol is found - protect event parsing from command line (when no real number)
parent 0bec4b70
...@@ -351,7 +351,7 @@ void break_check_delayed_bp(void) ...@@ -351,7 +351,7 @@ void break_check_delayed_bp(void)
* *
* Add a watchpoint. * Add a watchpoint.
*/ */
void break_add_watch(const struct dbg_lvalue* lvalue, BOOL is_write) static void break_add_watch(const struct dbg_lvalue* lvalue, BOOL is_write)
{ {
int num; int num;
DWORD l = 4; DWORD l = 4;
...@@ -387,10 +387,26 @@ void break_add_watch(const struct dbg_lvalue* lvalue, BOOL is_write) ...@@ -387,10 +387,26 @@ void break_add_watch(const struct dbg_lvalue* lvalue, BOOL is_write)
dbg_printf("\n"); dbg_printf("\n");
} }
/******************************************************************
* break_add_watch_from_lvalue
*
* Adds a watch point from an address (stored in a lvalue)
*/
void break_add_watch_from_lvalue(const struct dbg_lvalue* lvalue)
{
struct dbg_lvalue lval;
lval.addr.Mode = AddrModeFlat;
lval.addr.Offset = types_extract_as_integer(lvalue);
lval.type.id = dbg_itype_none;
break_add_watch(&lval, TRUE);
}
/*********************************************************************** /***********************************************************************
* break_add_watch_from_id * break_add_watch_from_id
* *
* Add a watchpoint from a symbol name (and eventually a line #) * Add a watchpoint from a symbol name
*/ */
void break_add_watch_from_id(const char *name) void break_add_watch_from_id(const char *name)
{ {
......
...@@ -226,7 +226,7 @@ break_command: ...@@ -226,7 +226,7 @@ break_command:
; ;
watch_command: watch_command:
tWATCH '*' expr_lvalue { break_add_watch(&$3, 1); } tWATCH '*' expr_lvalue { break_add_watch_from_lvalue(&$3); }
| tWATCH identifier { break_add_watch_from_id($2); } | tWATCH identifier { break_add_watch_from_id($2); }
; ;
......
...@@ -244,7 +244,7 @@ extern BOOL break_add_break(const ADDRESS* addr, BOOL verbose); ...@@ -244,7 +244,7 @@ extern BOOL break_add_break(const ADDRESS* addr, BOOL verbose);
extern BOOL break_add_break_from_lvalue(const struct dbg_lvalue* value); extern BOOL break_add_break_from_lvalue(const struct dbg_lvalue* value);
extern void break_add_break_from_id(const char* name, int lineno); extern void break_add_break_from_id(const char* name, int lineno);
extern void break_add_break_from_lineno(int lineno); extern void break_add_break_from_lineno(int lineno);
extern void break_add_watch(const struct dbg_lvalue* lvalue, int is_write); extern void break_add_watch_from_lvalue(const struct dbg_lvalue* lvalue);
extern void break_add_watch_from_id(const char* name); extern void break_add_watch_from_id(const char* name);
extern void break_check_delayed_bp(void); extern void break_check_delayed_bp(void);
extern void break_delete_xpoint(int num); extern void break_delete_xpoint(int num);
......
...@@ -542,40 +542,43 @@ void print_addr_and_args(const ADDRESS* pc, const ADDRESS* frame) ...@@ -542,40 +542,43 @@ void print_addr_and_args(const ADDRESS* pc, const ADDRESS* frame)
IMAGEHLP_STACK_FRAME isf; IMAGEHLP_STACK_FRAME isf;
IMAGEHLP_LINE il; IMAGEHLP_LINE il;
IMAGEHLP_MODULE im; IMAGEHLP_MODULE im;
struct sym_enum se;
char tmp[1024];
DWORD64 disp; DWORD64 disp;
if (pc->Mode != AddrModeFlat) print_bare_address(pc);
dbg_printf("0x%04x:0x%04lx", pc->Segment, pc->Offset);
else
dbg_printf("0x%08lx", pc->Offset);
isf.InstructionOffset = (DWORD_PTR)memory_to_linear_addr(pc); isf.InstructionOffset = (DWORD_PTR)memory_to_linear_addr(pc);
isf.FrameOffset = (DWORD_PTR)memory_to_linear_addr(frame); isf.FrameOffset = (DWORD_PTR)memory_to_linear_addr(frame);
/* grab module where symbol is. If we don't have a module, we cannot print more */
im.SizeOfStruct = sizeof(im);
if (!SymGetModuleInfo(dbg_curr_process->handle, isf.InstructionOffset, &im))
return;
si->SizeOfStruct = sizeof(*si); si->SizeOfStruct = sizeof(*si);
si->MaxNameLen = 256; si->MaxNameLen = 256;
if (!SymFromAddr(dbg_curr_process->handle, isf.InstructionOffset, &disp, si)) if (SymFromAddr(dbg_curr_process->handle, isf.InstructionOffset, &disp, si))
return; {
struct sym_enum se;
char tmp[1024];
dbg_printf(" %s", si->Name); dbg_printf(" %s", si->Name);
if (disp) dbg_printf("+0x%lx", (DWORD_PTR)disp); if (disp) dbg_printf("+0x%lx", (DWORD_PTR)disp);
SymSetContext(dbg_curr_process->handle, &isf, NULL); SymSetContext(dbg_curr_process->handle, &isf, NULL);
se.tmp = tmp; se.tmp = tmp;
se.frame = isf.FrameOffset; se.frame = isf.FrameOffset;
tmp[0] = '\0'; tmp[0] = '\0';
SymEnumSymbols(dbg_curr_process->handle, 0, NULL, sym_enum_cb, &se); SymEnumSymbols(dbg_curr_process->handle, 0, NULL, sym_enum_cb, &se);
if (tmp[0]) dbg_printf("(%s)", tmp); if (tmp[0]) dbg_printf("(%s)", tmp);
il.SizeOfStruct = sizeof(il); il.SizeOfStruct = sizeof(il);
if (SymGetLineFromAddr(dbg_curr_process->handle, isf.InstructionOffset, if (SymGetLineFromAddr(dbg_curr_process->handle, isf.InstructionOffset,
NULL, &il)) NULL, &il))
dbg_printf(" [%s:%lu]", il.FileName, il.LineNumber); dbg_printf(" [%s:%lu]", il.FileName, il.LineNumber);
im.SizeOfStruct = sizeof(im);
if (SymGetModuleInfo(dbg_curr_process->handle, isf.InstructionOffset, &im))
dbg_printf(" in %s", im.ModuleName); dbg_printf(" in %s", im.ModuleName);
}
else dbg_printf(" in %s (+0x%lx)",
im.ModuleName, (DWORD_PTR)(isf.InstructionOffset - im.BaseOfImage));
} }
BOOL memory_disasm_one_insn(ADDRESS* addr) BOOL memory_disasm_one_insn(ADDRESS* addr)
......
...@@ -1180,7 +1180,7 @@ int main(int argc, char** argv) ...@@ -1180,7 +1180,7 @@ int main(int argc, char** argv)
char* ptr; char* ptr;
dbg_curr_pid = strtol(argv[1], &ptr, 10); dbg_curr_pid = strtol(argv[1], &ptr, 10);
if (dbg_curr_pid == 0 || ptr == NULL || if (dbg_curr_pid == 0 || ptr != argv[1] + strlen(argv[1]) ||
!dbg_attach_debuggee(dbg_curr_pid, dbg_action_mode != gdb_mode, FALSE)) !dbg_attach_debuggee(dbg_curr_pid, dbg_action_mode != gdb_mode, FALSE))
dbg_curr_pid = 0; dbg_curr_pid = 0;
} }
......
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