From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11257 invoked by alias); 20 Nov 2007 07:56:35 -0000 Received: (qmail 11234 invoked by uid 22791); 20 Nov 2007 07:56:33 -0000 X-Spam-Check-By: sourceware.org Received: from main.gmane.org (HELO ciao.gmane.org) (80.91.229.2) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 20 Nov 2007 07:56:29 +0000 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1IuNxz-0007D8-A2 for gdb-patches@sources.redhat.com; Tue, 20 Nov 2007 07:56:19 +0000 Received: from 241-246.AKNET.ru ([241-246.AKNET.ru]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 20 Nov 2007 07:56:19 +0000 Received: from vladimir by 241-246.AKNET.ru with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 20 Nov 2007 07:56:19 +0000 To: gdb-patches@sources.redhat.com From: Vladimir Prus Subject: Re: [rfc] Allow watchpoints on inaccessible memory Date: Tue, 20 Nov 2007 07:56:00 -0000 Message-ID: References: <20070821142500.GA28295@caradoc.them.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit User-Agent: Loom/3.14 (http://gmane.org/) 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: 2007-11/txt/msg00372.txt.bz2 Daniel Jacobowitz false.org> writes: > > Here's something I've been meaning to try for ages. Suppose you have > a global variable pointing to some dynamically allocated storage, and > you want to find writes into that storage. When the pointer isn't > initialized you can't even set the watchpoint: ...... > - v = evaluate_expression (bpt->owner->exp); > - value_contents (v); > - value_release_to_mark (mark); > + gdb_evaluate_expression (bpt->owner->exp, &v); > + if (v != NULL) > + { > + gdb_value_fetch_lazy (v); > + value_release_to_mark (mark); > + } In fact, this patch is likely to fix a nasty issue with watchpoints in shared libraries. Say you have a watchpoint set on global variable 'g' in a shared library, and the shared library is unloaded. Next time you try to "next", or "continue", insert_bp_location will try to evaluate watchpoint expression again, and throw -- which will terminate next or continue operation, leaving program at the same place -- which is extremely confusing. - Volodya