This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Warn on constant value watchpoints


On Thu, 10 Jul 2008 11:02:07 +0200, Jan Kratochvil wrote:
> On Thu, 26 Jun 2008 16:27:31 +0200, Daniel Jacobowitz wrote:
> > Also, I don't know how useful this feature is, but what happens with
> > "watch foo()"?
> 
> Hmm, it crashes.

Here is another patch - more simple but it will just silently watch missing
data, IMO wrong.  Just a try to go the other way.


Regards,
Jan
--- ./gdb/breakpoint.c	8 Jul 2008 11:09:40 -0000	1.330
+++ ./gdb/breakpoint.c	9 Jul 2008 06:14:26 -0000
@@ -841,7 +841,10 @@ fetch_watchpoint_value (struct expressio
   /* Evaluate the expression.  */
   mark = value_mark ();
   result = NULL;
-  gdb_evaluate_expression (exp, &result);
+  /* We want GDB_EVALUATE_EXPRESSION but we also need EVAL_AVOID_SIDE_EFFECTS,
+     at least for a deadlock calling an inferior function in EXP which needs to
+     UPDATE_WATCHPOINT before its PROCEED.  */
+  gdb_evaluate_type (exp, &result);
   new_mark = value_mark ();
   if (mark == new_mark)
     return;
--- ./gdb/wrapper.c	17 Mar 2008 15:05:42 -0000	1.23
+++ ./gdb/wrapper.c	9 Jul 2008 06:14:33 -0000
@@ -44,7 +44,22 @@ gdb_evaluate_expression (struct expressi
 
   TRY_CATCH (except, RETURN_MASK_ERROR)
     {
-      *value = evaluate_expression(exp);
+      *value = evaluate_expression (exp);
+    }
+
+  if (except.reason < 0)
+    return 0;
+  return 1;
+}
+
+int
+gdb_evaluate_type (struct expression *exp, struct value **value)
+{
+  volatile struct gdb_exception except;
+
+  TRY_CATCH (except, RETURN_MASK_ERROR)
+    {
+      *value = evaluate_type (exp);
     }
 
   if (except.reason < 0)
--- ./gdb/wrapper.h	1 Jan 2008 22:53:13 -0000	1.18
+++ ./gdb/wrapper.h	9 Jul 2008 06:14:33 -0000
@@ -29,6 +29,8 @@ extern int gdb_parse_exp_1 (char **, str
 
 extern int gdb_evaluate_expression (struct expression *, struct value **);
 
+extern int gdb_evaluate_type (struct expression *, struct value **);
+
 extern int gdb_value_fetch_lazy (struct value *);
 
 extern int gdb_value_equal (struct value *, struct value *, int *);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]