Peter Schlaile : winedbg: Adds an rwatch command to winedbg.

Alexandre Julliard julliard at winehq.org
Mon Dec 6 13:18:32 CST 2010


Module: wine
Branch: master
Commit: 95a3cd8e30f72434a8ae3f71a97b5679937fdbf3
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=95a3cd8e30f72434a8ae3f71a97b5679937fdbf3

Author: Peter Schlaile <peter at schlaile.de>
Date:   Sun Dec  5 17:35:55 2010 +0100

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 2f502ce..b8627b6 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 685ca6c..7c92565 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 4348140..bdacb78 100644
--- a/programs/winedbg/debug.l
+++ b/programs/winedbg/debug.l
@@ -203,6 +203,7 @@ STRING     \"[^\n"]+\"
 <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>watch|watc|wat			{ BEGIN(NOCMD); return tWATCH; }
+<INITIAL>rwatch|rwatc|rwat		{ BEGIN(NOCMD); return tRWATCH; }
 <INITIAL>whatis|whati|what		{ BEGIN(NOCMD); return tWHATIS; }
 <INITIAL,NOPROCESS>run|ru|r     	{ BEGIN(ASTRING_EXPECTED); return tRUN;}
 <INITIAL>detach|detac|deta|det   	{ BEGIN(NOCMD); return tDETACH; }
diff --git a/programs/winedbg/debugger.h b/programs/winedbg/debugger.h
index eb05cda..5be0943 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 8d91cc9..51cf207 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 [*<addr>]                        watch *<addr>",
+            "  break [*<addr>]                        watch | rwatch *<addr>",
             "  delete break bpnum                     disable bpnum",
             "  enable bpnum                           condition <bpnum> [<expr>]",
             "  finish                                 cont [N]",
diff --git a/programs/winedbg/winedbg.man.in b/programs/winedbg/winedbg.man.in
index 8b26e32..1155111 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\ <id>\fR
 Adds a watch command (on write) at the address of symbol
 \fB<id>\fR. Size depends on size of \fB<id>\fR.
+.IP \fBrwatch\ *\ N\fR
+Adds a watch command (on read) at address \fBN\fR (on 4 bytes).
+.IP \fBrwatch\ <id>\fR
+Adds a watch command (on read) at the address of symbol
+\fB<id>\fR. Size depends on size of \fB<id>\fR.
 .IP \fBinfo\ break\fR
 Lists all (break|watch)-points (with their state).
 .PP




More information about the wine-cvs mailing list