mirror of
https://github.com/reactos/wine.git
synced 2024-11-26 05:00:30 +00:00
- 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)
This commit is contained in:
parent
0bec4b7024
commit
99e07b5bf2
@ -351,7 +351,7 @@ void break_check_delayed_bp(void)
|
||||
*
|
||||
* 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;
|
||||
DWORD l = 4;
|
||||
@ -387,10 +387,26 @@ void break_add_watch(const struct dbg_lvalue* lvalue, BOOL is_write)
|
||||
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
|
||||
*
|
||||
* 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)
|
||||
{
|
||||
|
@ -226,7 +226,7 @@ break_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); }
|
||||
;
|
||||
|
||||
|
@ -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 void break_add_break_from_id(const char* name, 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_check_delayed_bp(void);
|
||||
extern void break_delete_xpoint(int num);
|
||||
|
@ -542,40 +542,43 @@ void print_addr_and_args(const ADDRESS* pc, const ADDRESS* frame)
|
||||
IMAGEHLP_STACK_FRAME isf;
|
||||
IMAGEHLP_LINE il;
|
||||
IMAGEHLP_MODULE im;
|
||||
struct sym_enum se;
|
||||
char tmp[1024];
|
||||
DWORD64 disp;
|
||||
|
||||
if (pc->Mode != AddrModeFlat)
|
||||
dbg_printf("0x%04x:0x%04lx", pc->Segment, pc->Offset);
|
||||
else
|
||||
dbg_printf("0x%08lx", pc->Offset);
|
||||
print_bare_address(pc);
|
||||
|
||||
isf.InstructionOffset = (DWORD_PTR)memory_to_linear_addr(pc);
|
||||
isf.FrameOffset = (DWORD_PTR)memory_to_linear_addr(frame);
|
||||
|
||||
si->SizeOfStruct = sizeof(*si);
|
||||
si->MaxNameLen = 256;
|
||||
if (!SymFromAddr(dbg_curr_process->handle, isf.InstructionOffset, &disp, si))
|
||||
/* 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;
|
||||
|
||||
dbg_printf(" %s", si->Name);
|
||||
if (disp) dbg_printf("+0x%lx", (DWORD_PTR)disp);
|
||||
si->SizeOfStruct = sizeof(*si);
|
||||
si->MaxNameLen = 256;
|
||||
if (SymFromAddr(dbg_curr_process->handle, isf.InstructionOffset, &disp, si))
|
||||
{
|
||||
struct sym_enum se;
|
||||
char tmp[1024];
|
||||
|
||||
SymSetContext(dbg_curr_process->handle, &isf, NULL);
|
||||
se.tmp = tmp;
|
||||
se.frame = isf.FrameOffset;
|
||||
tmp[0] = '\0';
|
||||
SymEnumSymbols(dbg_curr_process->handle, 0, NULL, sym_enum_cb, &se);
|
||||
if (tmp[0]) dbg_printf("(%s)", tmp);
|
||||
dbg_printf(" %s", si->Name);
|
||||
if (disp) dbg_printf("+0x%lx", (DWORD_PTR)disp);
|
||||
|
||||
il.SizeOfStruct = sizeof(il);
|
||||
if (SymGetLineFromAddr(dbg_curr_process->handle, isf.InstructionOffset,
|
||||
NULL, &il))
|
||||
dbg_printf(" [%s:%lu]", il.FileName, il.LineNumber);
|
||||
im.SizeOfStruct = sizeof(im);
|
||||
if (SymGetModuleInfo(dbg_curr_process->handle, isf.InstructionOffset, &im))
|
||||
SymSetContext(dbg_curr_process->handle, &isf, NULL);
|
||||
se.tmp = tmp;
|
||||
se.frame = isf.FrameOffset;
|
||||
tmp[0] = '\0';
|
||||
SymEnumSymbols(dbg_curr_process->handle, 0, NULL, sym_enum_cb, &se);
|
||||
if (tmp[0]) dbg_printf("(%s)", tmp);
|
||||
|
||||
il.SizeOfStruct = sizeof(il);
|
||||
if (SymGetLineFromAddr(dbg_curr_process->handle, isf.InstructionOffset,
|
||||
NULL, &il))
|
||||
dbg_printf(" [%s:%lu]", il.FileName, il.LineNumber);
|
||||
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)
|
||||
|
@ -1180,7 +1180,7 @@ int main(int argc, char** argv)
|
||||
char* ptr;
|
||||
|
||||
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_curr_pid = 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user