From 95a3cd8e30f72434a8ae3f71a97b5679937fdbf3 Mon Sep 17 00:00:00 2001 From: Peter Schlaile Date: Sun, 5 Dec 2010 17:35:55 +0100 Subject: [PATCH] winedbg: Adds an rwatch command to winedbg. --- programs/winedbg/break.c | 8 ++++---- programs/winedbg/dbg.y | 9 ++++++--- programs/winedbg/debug.l | 1 + programs/winedbg/debugger.h | 4 ++-- programs/winedbg/info.c | 2 +- programs/winedbg/winedbg.man.in | 5 +++++ 6 files changed, 19 insertions(+), 10 deletions(-) diff --git a/programs/winedbg/break.c b/programs/winedbg/break.c index 2f502cef34..b8627b6b23 100644 --- a/programs/winedbg/break.c +++ b/programs/winedbg/break.c @@ -415,14 +415,14 @@ static void break_add_watch(const struct dbg_lvalue* lvalue, BOOL is_write) * * Adds a watch point from an address (stored in a lvalue) */ -void break_add_watch_from_lvalue(const struct dbg_lvalue* lvalue) +void break_add_watch_from_lvalue(const struct dbg_lvalue* lvalue,BOOL is_write) { struct dbg_lvalue lval; types_extract_as_address(lvalue, &lval.addr); lval.type.id = dbg_itype_none; - break_add_watch(&lval, TRUE); + break_add_watch(&lval, is_write); } /*********************************************************************** @@ -430,14 +430,14 @@ void break_add_watch_from_lvalue(const struct dbg_lvalue* lvalue) * * 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, BOOL is_write) { struct dbg_lvalue lvalue; switch (symbol_get_lvalue(name, -1, &lvalue, TRUE)) { case sglv_found: - break_add_watch(&lvalue, 1); + break_add_watch(&lvalue, is_write); break; case sglv_unknown: dbg_printf("Unable to add watchpoint\n"); diff --git a/programs/winedbg/dbg.y b/programs/winedbg/dbg.y index 685ca6c4bf..7c9256509d 100644 --- a/programs/winedbg/dbg.y +++ b/programs/winedbg/dbg.y @@ -52,7 +52,7 @@ static void parser(const char*); } %token tCONT tPASS tSTEP tLIST tNEXT tQUIT tHELP tBACKTRACE tALL tINFO tUP tDOWN -%token tENABLE tDISABLE tBREAK tHBREAK tWATCH tDELETE tSET tPRINT tEXAM +%token tENABLE tDISABLE tBREAK tHBREAK tWATCH tRWATCH tDELETE tSET tPRINT tEXAM %token tABORT tECHO %token tCLASS tMAPS tSTACK tSEGMENTS tSYMBOL tREGS tALLREGS tWND tLOCAL tEXCEPTION %token tPROCESS tTHREAD tEOL tEOF @@ -250,10 +250,13 @@ break_command: ; watch_command: - tWATCH '*' expr_lvalue { break_add_watch_from_lvalue(&$3); } - | tWATCH identifier { break_add_watch_from_id($2); } + tWATCH '*' expr_lvalue { break_add_watch_from_lvalue(&$3, TRUE); } + | tWATCH identifier { break_add_watch_from_id($2, TRUE); } + | tRWATCH '*' expr_lvalue { break_add_watch_from_lvalue(&$3, FALSE); } + | tRWATCH identifier { break_add_watch_from_id($2, FALSE); } ; + display_command: tDISPLAY { display_print(); } | tDISPLAY expr { display_add($2, 1, 0); } diff --git a/programs/winedbg/debug.l b/programs/winedbg/debug.l index 4348140416..bdacb78857 100644 --- a/programs/winedbg/debug.l +++ b/programs/winedbg/debug.l @@ -203,6 +203,7 @@ STRING \"[^\n"]+\" break|brea|bre|br|b { BEGIN(NOCMD); return tBREAK; } hbreak|hbrea|hbre|hbr|hb { BEGIN(NOCMD); return tHBREAK; } watch|watc|wat { BEGIN(NOCMD); return tWATCH; } +rwatch|rwatc|rwat { BEGIN(NOCMD); return tRWATCH; } whatis|whati|what { BEGIN(NOCMD); return tWHATIS; } run|ru|r { BEGIN(ASTRING_EXPECTED); return tRUN;} detach|detac|deta|det { BEGIN(NOCMD); return tDETACH; } diff --git a/programs/winedbg/debugger.h b/programs/winedbg/debugger.h index eb05cdac10..5be09430f3 100644 --- a/programs/winedbg/debugger.h +++ b/programs/winedbg/debugger.h @@ -294,8 +294,8 @@ extern BOOL break_add_break(const ADDRESS64* addr, BOOL verbose, BOO 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_watch_from_lvalue(const struct dbg_lvalue* lvalue); -extern void break_add_watch_from_id(const char* name); +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); extern void break_delete_xpoint(int num); extern void break_delete_xpoints_from_module(DWORD64 base); diff --git a/programs/winedbg/info.c b/programs/winedbg/info.c index 8d91cc9780..51cf207d27 100644 --- a/programs/winedbg/info.c +++ b/programs/winedbg/info.c @@ -49,7 +49,7 @@ void print_help(void) "subset of the commands that gdb accepts.", "The commands currently are:", " help quit", - " break [*] watch *", + " break [*] watch | rwatch *", " delete break bpnum disable bpnum", " enable bpnum condition []", " finish cont [N]", diff --git a/programs/winedbg/winedbg.man.in b/programs/winedbg/winedbg.man.in index 8b26e32903..1155111dfa 100644 --- a/programs/winedbg/winedbg.man.in +++ b/programs/winedbg/winedbg.man.in @@ -185,6 +185,11 @@ Adds a watch command (on write) at address \fBN\fR (on 4 bytes). .IP \fBwatch\ \fR Adds a watch command (on write) at the address of symbol \fB\fR. Size depends on size of \fB\fR. +.IP \fBrwatch\ *\ N\fR +Adds a watch command (on read) at address \fBN\fR (on 4 bytes). +.IP \fBrwatch\ \fR +Adds a watch command (on read) at the address of symbol +\fB\fR. Size depends on size of \fB\fR. .IP \fBinfo\ break\fR Lists all (break|watch)-points (with their state). .PP