From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21267 invoked by alias); 10 Jul 2008 09:06:14 -0000 Received: (qmail 21258 invoked by uid 22791); 10 Jul 2008 09:06:14 -0000 X-Spam-Check-By: sourceware.org Received: from host0.dyn.jankratochvil.net (HELO host0.dyn.jankratochvil.net) (89.250.240.59) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 10 Jul 2008 09:05:56 +0000 Received: from host0.dyn.jankratochvil.net (localhost [127.0.0.1]) by host0.dyn.jankratochvil.net (8.14.2/8.14.2) with ESMTP id m6A95orC023527; Thu, 10 Jul 2008 11:05:50 +0200 Received: (from jkratoch@localhost) by host0.dyn.jankratochvil.net (8.14.2/8.14.2/Submit) id m6A95oq0023524; Thu, 10 Jul 2008 11:05:50 +0200 Date: Thu, 10 Jul 2008 09:06:00 -0000 From: Jan Kratochvil To: gdb-patches@sourceware.org Cc: Daniel Jacobowitz Subject: Re: [patch] Warn on constant value watchpoints Message-ID: <20080710090550.GC32500@host0.dyn.jankratochvil.net> References: <20080608155302.GA25486@host0.dyn.jankratochvil.net> <20080608180909.GA6199@caradoc.them.org> <20080608192755.GA16172@host0.dyn.jankratochvil.net> <20080609061414.GA19316@host0.dyn.jankratochvil.net> <20080626142731.GK22726@caradoc.them.org> <20080710090207.GB32500@host0.dyn.jankratochvil.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="Zs/RYxT/hKAHzkfQ" Content-Disposition: inline In-Reply-To: <20080710090207.GB32500@host0.dyn.jankratochvil.net> User-Agent: Mutt/1.5.18 (2008-05-17) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-07/txt/msg00146.txt.bz2 --Zs/RYxT/hKAHzkfQ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 377 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 --Zs/RYxT/hKAHzkfQ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline; filename="gdb-watchpoint-loop-silent.patch" Content-length: 1628 --- ./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 *); --Zs/RYxT/hKAHzkfQ--