From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30963 invoked by alias); 30 Aug 2002 07:14:33 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 30956 invoked from network); 30 Aug 2002 07:14:32 -0000 Received: from unknown (HELO cerbere.u-strasbg.fr) (130.79.112.250) by sources.redhat.com with SMTP; 30 Aug 2002 07:14:32 -0000 Received: from laocoon (laocoon.u-strasbg.fr [130.79.112.72]) by cerbere.u-strasbg.fr (Postfix) with ESMTP id A455E5C4; Fri, 30 Aug 2002 09:16:09 +0200 (CEST) Message-Id: <4.2.0.58.20020830090650.00a48dc8@ics.u-strasbg.fr> X-Sender: muller@ics.u-strasbg.fr Date: Fri, 30 Aug 2002 02:15:00 -0000 To: Michael Snyder From: Pierre Muller Subject: Re: [RFA] 2nd send: Solve the watchpoint failures on second run. Cc: gdb-patches@sources.redhat.com, jimb@redhat.com In-Reply-To: <3D6E9C9F.A7018859@redhat.com> References: <4.2.0.58.20020715162013.02270ed8@ics.u-strasbg.fr> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-SW-Source: 2002-08/txt/msg01028.txt.bz2 At 00:13 30/08/2002 , Michael Snyder a écrit: >Pierre Muller wrote: > > > > I got no answer to that RFA, > > http://sources.redhat.com/ml/gdb-patches/2002-06/msg00394.html > > thus I send it again. > > > > This bug is related to bug 515 of database. > > The following note: > > >(This patch, together with the previous RFA that I sent today, > > >fixes the problem for both statically and dynamically linked > > >programs). > > Can be modified into: > > The following patch together with the patch commited > > on july 4. 2002 > > http://sources.redhat.com/ml/gdb-cvs/2002-07/msg00036.html > > fiwes bug 515 both for statically and dynamically linked programs. > > > > If you use my previous patch and compile the test program > > of the 515 bug with --static option, > > you will still miss the change of x value on the second run. > > This comes from the fact that the val field of the watchpoint is > > not reset correctly when the program is restarted. > > > > I first tried to fix this problem by using evaluate_expression > > in the breakpoint_init_inferior function. But, while this fixes the problem for > > the win32 native debugger, it leads to problems for linux, > > beacuse the program is not yet loaded into memory > > when this function is called: instead, the bash used for launch the debuggee > > seems to be in memory... > > > > So the only way I found to fix that error was to reset val field to NULL > > so that the val field is computed again > > correctly at the first insert_breakpoint call. > >Looks OK to me, Pierre -- except please move the '{' from >the end of the line. > >Thanks >Michael OK I commited the following: 2002-08-30 Pierre Muller * breakpoint.c (breakpoint_init_inferior): Reset the val field of watchpoints to NULL. (insert_breakpoints): set val field of watchpoints if NULL. $ cvs diff -u -p breakpoint.c Index: breakpoint.c =================================================================== RCS file: /cvs/src/src/gdb/breakpoint.c,v retrieving revision 1.84 diff -u -p -r1.84 breakpoint.c --- breakpoint.c 27 Aug 2002 19:06:35 -0000 1.84 +++ breakpoint.c 30 Aug 2002 07:12:26 -0000 @@ -738,7 +738,19 @@ insert_breakpoints (void) if (b->enable_state == bp_permanent) /* Permanent breakpoints cannot be inserted or removed. */ continue; - else if (b->type != bp_watchpoint + if ((b->type == bp_watchpoint + || b->type == bp_hardware_watchpoint + || b->type == bp_read_watchpoint + || b->type == bp_access_watchpoint) && (!b->val)) + { + struct value *val; + val = evaluate_expression (b->exp); + release_value (val); + if (VALUE_LAZY (val)) + value_fetch_lazy (val); + b->val = val; + } + if (b->type != bp_watchpoint && b->type != bp_hardware_watchpoint && b->type != bp_read_watchpoint && b->type != bp_access_watchpoint @@ -1566,6 +1578,14 @@ breakpoint_init_inferior (enum inf_conte /* Likewise for watchpoints on local expressions. */ if (b->exp_valid_block != NULL) delete_breakpoint (b); + if (context == inf_starting) + { + /* Reset val field to force reread of starting value + in insert_breakpoints. */ + if (b->val) + value_free (b->val); + b->val = NULL; + } break; default: /* Likewise for exception catchpoints in dynamic-linked Pierre Muller Institut Charles Sadron 6,rue Boussingault F 67083 STRASBOURG CEDEX (France) mailto:muller@ics.u-strasbg.fr Phone : (33)-3-88-41-40-07 Fax : (33)-3-88-41-40-99