From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4744 invoked by alias); 25 Jul 2012 20:31:46 -0000 Received: (qmail 4729 invoked by uid 22791); 25 Jul 2012 20:31:44 -0000 X-SWARE-Spam-Status: No, hits=-4.0 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL X-Spam-Check-By: sourceware.org Received: from imr3.ericy.com (HELO imr3.ericy.com) (198.24.6.13) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 25 Jul 2012 20:31:30 +0000 Received: from eusaamw0711.eamcs.ericsson.se ([147.117.20.178]) by imr3.ericy.com (8.13.8/8.13.8) with ESMTP id q6PKUfdS008440 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL); Wed, 25 Jul 2012 15:31:27 -0500 Received: from EUSAACMS0703.eamcs.ericsson.se ([169.254.1.135]) by eusaamw0711.eamcs.ericsson.se ([147.117.20.178]) with mapi; Wed, 25 Jul 2012 16:30:50 -0400 From: Marc Khouzam To: "'Tom Tromey'" CC: "'gdb-patches@sourceware.org'" Date: Wed, 25 Jul 2012 20:31:00 -0000 Subject: RE: [Patch] Cannot set pending bp if condition set explicitly Message-ID: References: <87zk6nkghi.fsf@fleche.redhat.com> In-Reply-To: <87zk6nkghi.fsf@fleche.redhat.com> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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: 2012-07/txt/msg00585.txt.bz2 > -----Original Message----- > From: Tom Tromey [mailto:tromey@redhat.com]=20 > Sent: Wednesday, July 25, 2012 11:28 AM > To: Marc Khouzam > Cc: 'gdb-patches@sourceware.org' > Subject: Re: [Patch] Cannot set pending bp if condition set explicitly >=20 > >>>>> "Marc" =3D=3D Marc Khouzam writes: >=20 > Marc> If I set a condition explicitly on a pending breakpoint (using > Marc> the 'condition' command), the breakpoint fails to install. >=20 > Marc> + /* For a pending breakoint, the condition is not=20 > parsed yet */ >=20 > Comment should end with a period and two spaces. Fixed, along with "breakoint" typo. > Marc> + if (b->loc =3D=3D NULL || b->loc->shlib_disabled) >=20 > I think this ought to use all_locations_are_pending. > But, I am not 100% sure of this. I took the original line from print_one_exception_catchpoint() when it figures out to print . But I changed it to use all_locations_are_pending() in the below=20 patch, and it also solves the problem I was seeing. > A test case for this would be quite nice to have. I modified gdb.base/pending.exp to test this case. The test fails before the patch and passes after. You'll note that I removed the=20 two tests tha were disabling bp 7 and 5. There were no bp 7 or 5 in the original test, and my changes added bp 5 which needed to stay=20 enabled. How does it look for HEAD and 7_5 (not the tests for 7_5 I gather)? Thanks Marc 2012-07-25 Marc Khouzam * breakpoint.c: Add declaration of all_locations_are_pending. (set_breakpoint_condition): For pending breakpoints, mark=20 condition as not parsed. 2012-07-25 Marc Khouzam * gdb.base/pendshr.c: Extra line to set a new breakpoint. * gdb.base/pending.exp: Set an enabled pending breakpoint with an explicit condition. ### Eclipse Workspace Patch 1.0 #P src Index: gdb/breakpoint.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/gdb/breakpoint.c,v retrieving revision 1.695 diff -u -r1.695 breakpoint.c --- gdb/breakpoint.c 24 Jul 2012 17:37:56 -0000 1.695 +++ gdb/breakpoint.c 25 Jul 2012 20:15:20 -0000 @@ -230,6 +230,8 @@ =20 static void tcatch_command (char *arg, int from_tty); =20 +static int all_locations_are_pending (struct bp_location *loc); + static void detach_single_step_breakpoints (void); =20 static int single_step_breakpoint_inserted_here_p (struct address_space *, @@ -951,7 +953,12 @@ /* I don't know if it matters whether this is the string the user typed in or the decompiled expression. */ b->cond_string =3D xstrdup (arg); - b->condition_not_parsed =3D 0; + + /* For a pending breakpoint, the condition is not parsed yet. */ + if (all_locations_are_pending (b->loc)) + b->condition_not_parsed =3D 1; + else + b->condition_not_parsed =3D 0; =20 if (is_watchpoint (b)) { Index: gdb/testsuite/gdb.base/pending.exp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/gdb/testsuite/gdb.base/pending.exp,v retrieving revision 1.26 diff -u -r1.26 pending.exp --- gdb/testsuite/gdb.base/pending.exp 21 Jun 2012 20:46:22 -0000 1.26 +++ gdb/testsuite/gdb.base/pending.exp 25 Jul 2012 20:15:20 -0000 @@ -209,6 +209,32 @@ "multiple pending breakpoints 2" =20 # +# Try a pending break with an explicit condition which is enabled at start= up +# + +set bp5_loc [gdb_get_line_number "y++" ${libfile}.c] +gdb_test_multiple "break pendshr.c:$bp5_loc" "Set pending breakpoint 4" { + -re ".*Make breakpoint pending.*y or \\\[n\\\]. $" { + gdb_test "y" "Breakpoint.*pendshr.c:$bp5_loc.*pending." \ + "Set pending breakpoint 5" + } +} + +gdb_test_no_output "condition 5 k =3D=3D 1" + +gdb_test "info break" \ + "Num Type\[ \]+Disp Enb Address\[ \]+What.* +\[0-9\]+\[\t \]+breakpoint keep n.*PENDING.*pendfunc1.* +\[\t \]+stop only if k =3D=3D 1.* +\[\t \]+print k.* +\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline.* +\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*pendshr.c:$bp2_loc if x > = 3.* +\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*pendshr.c:$bp3_loc.*ignore= next 2 hits.* +\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*pendshr.c:$bp5_loc.* +\[\t \]+stop only if k =3D=3D 1.*" \ +"multiple pending breakpoints 3" + +# # Run to main which should resolve a pending breakpoint # =20 @@ -218,6 +244,24 @@ "running to main" =20 # +# Verify that all pending breakpoints have resolved. +# +gdb_test "info break" \ + "Num Type\[ \]+Disp Enb Address\[ \]+What.* +\[0-9\]+\[\t \]+breakpoint keep n.* in pendfunc1 at .* +\[\t \]+stop only if k =3D=3D 1.* +\[\t \]+print k.* +\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline.* +\[\t \]+breakpoint already hit 1 time.* +\[0-9\]+\[\t \]+breakpoint keep y.* in pendfunc1 at .*pendshr.c:$bp2_l= oc.* +\[\t \]+stop only if x > 3.* +\[0-9\]+\[\t \]+breakpoint keep y.* in pendfunc1 at .*pendshr.c:$bp3_l= oc.* +\[\t \]+ignore next 2 hits.* +\[0-9\]+\[\t \]+breakpoint keep y.* in pendfunc1 at .*pendshr.c:$bp5_l= oc.* +\[\t \]+stop only if k =3D=3D 1.*" \ +"multiple pending breakpoints 4" + +# # Re-enable the first pending breakpoint which should resolve # =20 @@ -237,19 +281,14 @@ \[$\]1 =3D 1." \ "continue to resolved breakpoint 1" =20 -# -# Disable the other two breakpoints, and continue to the one with -# the ignore count. Make sure you hit it the third time, x should -# be 3 then. -# - -gdb_test "disable 7" "" "Disable other breakpoints" -gdb_test "disable 5" "" "Disable other breakpoints" - gdb_test "continue" \ ".*Breakpoint.*pendfunc1.*\\\(x=3D3\\\) at.*pendshr.c:$bp3_loc.*pr= intf.*;" \ "continue to resolved breakpoint 3" =20 +gdb_test "continue" \ + ".*Breakpoint.*pendfunc1.*\\\(x=3D3\\\) at.*pendshr.c:$bp5_loc.*y\= \+\\+;" \ +"continue to resolved breakpoint 5" + delete_breakpoints =20 gdb_breakpoint "main" Index: gdb/testsuite/gdb.base/pendshr.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/gdb/testsuite/gdb.base/pendshr.c,v retrieving revision 1.10 diff -u -r1.10 pendshr.c --- gdb/testsuite/gdb.base/pendshr.c 4 Jan 2012 08:17:46 -0000 1.10 +++ gdb/testsuite/gdb.base/pendshr.c 25 Jul 2012 20:15:20 -0000 @@ -21,6 +21,7 @@ { int y =3D x + 4; printf ("in pendfunc1, x is %d\n", x); + y++; } =20 void pendfunc (int x)