From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17636 invoked by alias); 13 Aug 2010 16:39:33 -0000 Received: (qmail 17623 invoked by uid 22791); 13 Aug 2010 16:39:31 -0000 X-SWARE-Spam-Status: No, hits=-6.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 13 Aug 2010 16:39:22 +0000 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o7DGdL1u012515 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 13 Aug 2010 12:39:21 -0400 Received: from host1.dyn.jankratochvil.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o7DGdI84026908 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 13 Aug 2010 12:39:20 -0400 Received: from host1.dyn.jankratochvil.net (localhost [127.0.0.1]) by host1.dyn.jankratochvil.net (8.14.4/8.14.4) with ESMTP id o7DGdIox031730; Fri, 13 Aug 2010 18:39:18 +0200 Received: (from jkratoch@localhost) by host1.dyn.jankratochvil.net (8.14.4/8.14.4/Submit) id o7DGdH0A031723; Fri, 13 Aug 2010 18:39:17 +0200 Date: Fri, 13 Aug 2010 16:39:00 -0000 From: Jan Kratochvil To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: RFA: implement "watch -location" Message-ID: <20100813163917.GA31498@host1.dyn.jankratochvil.net> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-12-10) 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: 2010-08/txt/msg00193.txt.bz2 Hi Tom, this patch has a regression (guessing due to -lmcheck) on {x86_64,x86_64-m32,i686}-fedora14snapshot-linux-gnu for: PASS: gdb.base/default.exp: up-silently -PASS: gdb.base/default.exp: watch +ERROR: Process no longer exists +UNRESOLVED: gdb.base/default.exp: watch [...] There are some freed VALUEs in use. While thanks for this killer patch I do not like: Num Type Disp Enb Address What 1 watchpoint keep y gdb_stdin 2 watchpoint keep y * (struct ui_file * *) 0x0000000001bf84d0 What does the watchpoint 2 watch? Is this add-on patch OK? Num Type Disp Enb Address What 1 watchpoint keep y gdb_stdin 2 watchpoint keep y -location: gdb_stdin Thanks, Jan gdb/ 2010-08-13 Jan Kratochvil * breakpoint.c (update_watchpoint): Add source empty line. Prefer EXP_STRING_REPARSE to EXP_STRING. (watch_command_1): Set also EXP_STRING_REPARSE. (delete_breakpoint): Free also EXP_STRING_REPARSE. * breakpoint.h (struct breakpoint): New field exp_string_reparse. Update comment for exp_string. --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -1339,12 +1339,13 @@ update_watchpoint (struct breakpoint *b, int reparse) if (within_current_scope && reparse) { char *s; + if (b->exp) { xfree (b->exp); b->exp = NULL; } - s = b->exp_string; + s = b->exp_string_reparse ? b->exp_string_reparse : b->exp_string; b->exp = parse_exp_1 (&s, b->exp_valid_block, 0); /* If the meaning of expression itself changed, the old value is no longer relevant. We don't want to report a watchpoint hit @@ -8211,10 +8212,13 @@ watch_command_1 (char *arg, int accessflag, int from_tty, int just_location) t = check_typedef (TYPE_TARGET_TYPE (check_typedef (t))); name = type_to_string (t); - b->exp_string = xstrprintf ("* (%s *) %s", name, - core_addr_to_string (addr)); + b->exp_string_reparse = xstrprintf ("* (%s *) %s", name, + core_addr_to_string (addr)); xfree (name); + b->exp_string = xstrprintf ("-location: %.*s", + (int) (exp_end - exp_start), exp_start); + /* The above expression is in C. */ b->language = language_c; } @@ -9644,6 +9648,7 @@ delete_breakpoint (struct breakpoint *bpt) xfree (bpt->addr_string); xfree (bpt->exp); xfree (bpt->exp_string); + xfree (bpt->exp_string_reparse); value_free (bpt->val); xfree (bpt->source_file); xfree (bpt->exec_pathname); --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -450,8 +450,11 @@ struct breakpoint /* String form of the breakpoint condition (malloc'd), or NULL if there is no condition. */ char *cond_string; - /* String form of exp (malloc'd), or NULL if none. */ + /* String form of exp to use for displaying to the user (malloc'd), or + NULL if none. */ char *exp_string; + /* String form to use for reparsing of EXP (malloc'd) or NULL. */ + char *exp_string_reparse; /* The expression we are watching, or NULL if not a watchpoint. */ struct expression *exp;