This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] Warn on constant value watchpoints
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: gdb-patches at sourceware dot org
- Cc: Daniel Jacobowitz <drow at false dot org>
- Date: Thu, 10 Jul 2008 11:05:50 +0200
- Subject: Re: [patch] Warn on constant value watchpoints
- References: <20080608155302.GA25486@host0.dyn.jankratochvil.net> <uskvnls5g.fsf@gnu.org> <20080608180909.GA6199@caradoc.them.org> <ulk1flq2y.fsf@gnu.org> <20080608192755.GA16172@host0.dyn.jankratochvil.net> <20080609061414.GA19316@host0.dyn.jankratochvil.net> <20080626142731.GK22726@caradoc.them.org> <20080710090207.GB32500@host0.dyn.jankratochvil.net>
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 *);