From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25785 invoked by alias); 25 Dec 2008 11:28:33 -0000 Received: (qmail 25777 invoked by uid 22791); 25 Dec 2008 11:28:32 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_20,UNPARSEABLE_RELAY X-Spam-Check-By: sourceware.org Received: from imx12.toshiba.co.jp (HELO imx12.toshiba.co.jp) (61.202.160.132) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 25 Dec 2008 11:27:26 +0000 Received: from arc11.toshiba.co.jp ([133.199.90.127]) by imx12.toshiba.co.jp with ESMTP id mBPBRG1e003229; Thu, 25 Dec 2008 20:27:16 +0900 (JST) Received: (from root@localhost) by arc11.toshiba.co.jp id mBPBRGDn024725; Thu, 25 Dec 2008 20:27:16 +0900 (JST) Received: from ovp11.toshiba.co.jp [133.199.90.148] by arc11.toshiba.co.jp with ESMTP id WAA24724; Thu, 25 Dec 2008 20:27:16 +0900 Received: from mx.toshiba.co.jp (localhost [127.0.0.1]) by ovp11.toshiba.co.jp with ESMTP id mBPBRF9f015712; Thu, 25 Dec 2008 20:27:15 +0900 (JST) Received: from mx.tjsys.co.jp by toshiba.co.jp id mBPBRF7M007218; Thu, 25 Dec 2008 20:27:15 +0900 (JST) Received: from voltage-out.tjsys.co.jp (voltage-out.tjsys.co.jp [157.79.3.51]) by mx.tjsys.co.jp (8.12.11/8.12.11) with ESMTP id mBPBREsn001929; Thu, 25 Dec 2008 20:27:14 +0900 (JST) Received: from is-com10 ([157.79.3.71]) by voltage-out.tjsys.co.jp (8.13.1/8.13.1) with SMTP id mBPBR9Zk001025; Thu, 25 Dec 2008 20:27:09 +0900 Received: from localhost ([157.79.30.228]) by ims.tjsys.co.jp (iPlanet Messaging Server 5.2 HotFix 2.10 (built Dec 26 2005)) with ESMTP id <0KCF00J36JT3F8@ims.tjsys.co.jp>; Thu, 25 Dec 2008 20:27:03 +0900 (JST) Date: Thu, 25 Dec 2008 11:28:00 -0000 From: Emi SUZUKI Subject: Re: Watchpoint on an unloaded shared library(1) In-reply-to: <20081222032758.GA2835@adacore.com> To: brobecker@adacore.com Cc: gdb-patches@sourceware.org Message-id: <20081225.202730.01371998.emi-suzuki@tjsys.co.jp> MIME-version: 1.0 Content-type: Text/Plain; charset=us-ascii Content-transfer-encoding: 7bit References: <20081216.211520.207584606.emi-suzuki@tjsys.co.jp> <20081221131036.GB25416@adacore.com> <20081222032758.GA2835@adacore.com> X-WAuditID: 0812252027030000026522 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-12/txt/msg00410.txt.bz2 Hello Joel, From: Joel Brobecker Subject: Re: Watchpoint on an unloaded shared library(1) Date: Mon, 22 Dec 2008 07:27:58 +0400 >> > > How about replace all the code that's inside >> > > >> > > if (bpt->type == bp_watchpoint || >> > > bpt->type == bp_hardware_watchpoint || >> > > bpt->type == bp_read_watchpoint || >> > > bpt->type == bp_access_watchpoint) >> > > { >> > > [re-create a lot of stuff for our watchpoint...] >> > > >> > > by a call to update_watchpoint (bpt, 1)? Would that work in your case? >> > >> > It works without merging the missing code each other, as long as we >> > don't have to care the hardware watchpoint resource count here: if the >> > user sets other watchpoints while the disabled hardware watchpoints >> > exist, re-enabling the disabled ones might fail out of the shortage of >> > resources. >> >> That's a good point. > > As it turns out, I think we just got lucky thanks to Jan: > http://www.sourceware.org/ml/gdb-patches/2008-12/msg00363.html. > > update_watchpoint now automagically downgrades hardware watchpoints > into a software watchpoints if needed. So we can get rid of that part. > So all we have to do, now is: > >> if (bpt->type == bp_watchpoint || >> bpt->type == bp_hardware_watchpoint || >> bpt->type == bp_read_watchpoint || >> bpt->type == bp_access_watchpoint) >> { >> struct gdb_exception e; >> >> TRY_CATCH (e, RETURN_MASK_ALL) >> { >> update_watchpoint (...); >> } >> if (e.reason < 0) >> { >> exception_fprintf (gdb_strerr, e, "Cannot enable watchpoint %d:", >> b->number); >> return; >> } This does work for me, except one duplication of the codes (that you may have noticed already): static void do_enable_breakpoint (struct breakpoint *bpt, enum bpdisp disposition) { int target_resources_ok, other_type_used; struct value *mark; if (bpt->type == bp_hardware_breakpoint) { int i; i = hw_breakpoint_used_count (); target_resources_ok = TARGET_CAN_USE_HARDWARE_WATCHPOINT (bp_hardware_breakpoint, i + 1, 0); if (target_resources_ok == 0) error (_("No hardware breakpoint support in the target.")); else if (target_resources_ok < 0) error (_("Hardware breakpoints used exceeds limit.")); } That should be done in update_watchpoint. I would try to address incapabilities on PPC after those codes are committed. Thank you for taking care of it! I wonder if I should greet for Christmas here... -- Emi SUZUKI / emi-suzuki at tjsys.co.jp