Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: gdb-patches@sourceware.org
Cc: Daniel Jacobowitz <drow@false.org>
Subject: Re: [patch] Warn on constant value watchpoints
Date: Thu, 10 Jul 2008 09:06:00 -0000	[thread overview]
Message-ID: <20080710090550.GC32500@host0.dyn.jankratochvil.net> (raw)
In-Reply-To: <20080710090207.GB32500@host0.dyn.jankratochvil.net>

[-- Attachment #1: Type: text/plain, Size: 377 bytes --]

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

[-- Attachment #2: gdb-watchpoint-loop-silent.patch --]
[-- Type: text/plain, Size: 1628 bytes --]

--- ./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 *);

      reply	other threads:[~2008-07-10  9:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-08 15:53 Jan Kratochvil
2008-06-08 18:05 ` Eli Zaretskii
2008-06-08 18:09   ` Daniel Jacobowitz
2008-06-08 18:50     ` Eli Zaretskii
2008-06-08 19:28       ` Jan Kratochvil
2008-06-09  6:14         ` Jan Kratochvil
2008-06-26 15:01           ` Daniel Jacobowitz
2008-06-26 19:40             ` Eli Zaretskii
2008-07-10  9:00             ` Jan Kratochvil
2008-07-10  9:02             ` Jan Kratochvil
2008-07-10  9:06               ` Jan Kratochvil [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080710090550.GC32500@host0.dyn.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=drow@false.org \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox