From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2130 invoked by alias); 2 Jan 2012 18:18:30 -0000 Received: (qmail 2121 invoked by uid 22791); 2 Jan 2012 18:18:29 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,MSGID_FROM_MTA_HEADER,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from e06smtp14.uk.ibm.com (HELO e06smtp14.uk.ibm.com) (195.75.94.110) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 02 Jan 2012 18:18:14 +0000 Received: from /spool/local by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 2 Jan 2012 18:18:13 -0000 Received: from d06nrmr1806.portsmouth.uk.ibm.com ([9.149.39.193]) by e06smtp14.uk.ibm.com ([192.168.101.144]) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 2 Jan 2012 18:18:12 -0000 Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by d06nrmr1806.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q02IICff2949354 for ; Mon, 2 Jan 2012 18:18:12 GMT Received: from d06av02.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q02IIBUX004907 for ; Mon, 2 Jan 2012 11:18:12 -0700 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with SMTP id q02IIAXd004892; Mon, 2 Jan 2012 11:18:10 -0700 Message-Id: <201201021818.q02IIAXd004892@d06av02.portsmouth.uk.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Mon, 02 Jan 2012 19:18:10 +0100 Subject: [7.4 regression] Stand-alone Cell debugging broken (Re: RFC: don't set the pspace on ordinary breakpoints) To: gdb-patches@sourceware.org Date: Mon, 02 Jan 2012 18:18:00 -0000 From: "Ulrich Weigand" Cc: tromey@redhat.com, alves.ped@gmail.com, brobecker@adacore.com In-Reply-To: <201111181831.pAIIVJan019250@d06av02.portsmouth.uk.ibm.com> from "Ulrich Weigand" at Nov 18, 2011 07:31:19 PM MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit x-cbid: 12010218-1948-0000-0000-000000894A8E 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-01/txt/msg00055.txt.bz2 I wrote: > Tom Tromey wrote: > > >>>>> "Ulrich" == Ulrich Weigand writes: > > > > Ulrich> Sorry for the delay; I wanted to test your patch on Cell to make > > Ulrich> sure it doesn't regress in the scenario bp_startup_disabled was > > Ulrich> introduced to fix. > > > > It is no problem. > > > > Ulrich> Unfortunately, I've been blocked by a number of SPU regressions > > Ulrich> that make results on Cell currently bad anyway, see e.g. > > Ulrich> http://sourceware.org/ml/gdb-patches/2011-11/msg00437.html > > Ulrich> http://sourceware.org/ml/gdb-patches/2011-11/msg00439.html > > > > Ulrich> I'm still planning on doing the run once SPU is stable again. > > > > Ok. I will wait for that then. > > OK, I've now completed a run with your patch in the situation where > bp_startup_disabled was necessary (stand-alone SPU executables on > a Cell/B.E. system). Everything still works fine. While this patch by itself didn't break stand-alone SPU debugging, the whole "ambiguous linespec" series in total apparently did. What happens is that if I set a breakpoint on "main", and then start execution, the first time breakpoints are re-set, addr_string_to_sals (as called from breakpoint_re_set_default) correctly recognizes that even though "main" cannot be found at this moment, this is OK since the address space is currently going through startup. However, while this means that no error is thrown at this point, addr_string_to_sals still returns an empty location list, and the existing list of locations for the "main" breakpoint now gets thrown away in update_breakpoint_locations. This in turn means that the *next* time breakpoints are re-set, the "main" breakpoint now no longer has any locations associated to it, and therefore it is no longer recognized as being related to an address space going through startup. Thus, an error is thrown and the breakpoint is marked disabled, and therefore once startup is completed and "main" now *could* be found again, it is no longer even attempted to insert the breakpoint again. This is a serious regression that bascially means debugging stand- alone SPU programs with a Cell/B.E. debugger is impossible. Thus it would be really good to get this fixed before 7.4 is released ... The following patch fixes the problem for me. It hooks into an existing mechanism to fix a similar problem for breakpoints in shared libraries that are being unloaded: update_breakpoint_locations does: /* If there's no new locations, and all existing locations are pending, don't do anything. This optimizes the common case where all locations are in the same shared library, that was unloaded. We'd like to retain the location, so that when the library is loaded again, we don't loose the enabled/disabled status of the individual locations. */ if (all_locations_are_pending (existing_locations) && sals.nelts == 0) return; which has the effect to keep locations from such libraries present even though the library is unloaded. The patch below now extends this to the executing_startup case by having all_locations_are_pending consider locations in address spaces currently going through startup as "pending" as well. With this change, the breakpoint location is kept active until startup is complete, and then replaced with the correct location. Does this look reasonable? Joel, would this be OK for 7.4 as well? Thanks, Ulrich ChangeLog: * breakpoint.c (all_locations_are_pending): Consider locations in program spaces executing during startup pending as well. Index: gdb/breakpoint.c =================================================================== RCS file: /cvs/src/src/gdb/breakpoint.c,v retrieving revision 1.633.2.2 diff -u -p -r1.633.2.2 breakpoint.c --- gdb/breakpoint.c 23 Dec 2011 17:55:20 -0000 1.633.2.2 +++ gdb/breakpoint.c 2 Jan 2012 15:16:20 -0000 @@ -11500,7 +11500,8 @@ static int all_locations_are_pending (struct bp_location *loc) { for (; loc; loc = loc->next) - if (!loc->shlib_disabled) + if (!loc->shlib_disabled + && !loc->pspace->executing_startup) return 0; return 1; } -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com