From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) by sourceware.org (Postfix) with ESMTPS id 1F4463858403 for ; Tue, 5 Dec 2023 08:35:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1F4463858403 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=intel.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 1F4463858403 Authentication-Results: server2.sourceware.org; arc=fail smtp.remote-ip=192.198.163.9 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1701765319; cv=fail; b=P4d7Ti+jGlAl1NJQRJjzE6+Lmx2vvFxHWvw6b3v3KldvuzQZD2aWEf/vlakVbTvS4bzygtr27pM8L6sZBFbQOdf0baNnQs2DGVfZLxR/fHD25ImNS0WWqHwGkFPdRZW4yol4MqQAztir266e4BFmthPgpIx/QIZfPPw6TZtKu78= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1701765319; c=relaxed/simple; bh=6pp4XwikBuxZ1cWs5/6nJFij8FKGUdhey7cy9Xba33w=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=loGF4bghxNVrKvD4jMKBiM3+ZwU8p43abzyOr25wkoXeg8jYv7MCditMFbhBSGqxADPe7p8JV41sM1iW9HJJ5+G3clYdyXt8m/QMeoMG7McK5RfgwCsxgMLped2yk7kFSrmvgV+Xr7PKNgBn3VmPU0klItvpJdmeXzb1i/amhJE= ARC-Authentication-Results: i=2; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1701765316; x=1733301316; h=from:to:subject:date:message-id:references:in-reply-to: mime-version:content-transfer-encoding; bh=6pp4XwikBuxZ1cWs5/6nJFij8FKGUdhey7cy9Xba33w=; b=YFdB/DRJn9yNNLmPSiuc+f/wEr9WMx002zY5bZjA7dqLPwAhmpnFOedZ Yfv0UR9antEWBPkjbclBrts/CAvE6vItv9tLTBNI+SY69PLlPT403iemY XR5MxI099tVieY91ir5roae9CNhRMHFZwXgjeTHnJhhmj5L3FAY/3RFNm VdmKKgWdi0LXg8c5v4HaEVOmSyLzG1zntSUgLerQmrcnG9jcCah4UhCZb Qd0M4OuMW08LFUk5mJoQU4ONNkbWeRfbqpR5xU+Z1S/sXCoLQwA0ZvzVi mucLQ/rCX8OAOI99qN/vcnUSkoU69WMmxGglve/n9UNB+QWaBGgIhRkvR g==; X-IronPort-AV: E=McAfee;i="6600,9927,10914"; a="753537" X-IronPort-AV: E=Sophos;i="6.04,251,1695711600"; d="scan'208";a="753537" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Dec 2023 00:35:14 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10914"; a="747145756" X-IronPort-AV: E=Sophos;i="6.04,251,1695711600"; d="scan'208";a="747145756" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orsmga006.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 05 Dec 2023 00:35:14 -0800 Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 5 Dec 2023 00:35:13 -0800 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Tue, 5 Dec 2023 00:35:13 -0800 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (104.47.73.40) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.34; Tue, 5 Dec 2023 00:35:12 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DDJDyvYhjBQ5qPiviR2NuJJF8d7BQ5RaL4G/IA7QVVIz5N1rLs8IAS7HvJcPzWFa//MUQtikk7RHeypcQxxvRP16r1QynF9bDx6Rx+k09z8jA0VLQQQU80Yz4Wddxv/RW2J6eI5K4uEfrc6VWXafz1O+YNlbBt8YG3I4RFlNJjK6WkKormSgqnbi8tbHal0+eKZ8L1E+XIkGtHJnHSqqAoln2Y+F1dYvyQuBrBTznLL6C3lOX7lwxR3PZ8A+p48xttuvlJipzrLl/LXzeaMXjR6z23lJwytCOR/dVoFvqd5I6WeSEo+/KyXj4QhtbqI/jCt4qTV4N0K5zag80S2Hlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=XUg+CfLeoVCkIgl5IyHgmqj0HLnJUEQWVFPgfNTPQTo=; b=mTKu9nYT2tSQDpvFAWMd/klxr65TWifTL+Em54e/9sWp6wZodFHCa6EF7xKcAb+afIXn3ISlzPEV8LJWylCDl+D9kud6XP6+y3i+5TZz/EtBzJwKmK7ivu5oOMq5fzEfS+XGCWAOUMzBzFLcLpCrykCZBygQQAKRcGTGpe/pwOAbNMrLlQ/jYwhQoK9AECJNsgF6ltYZnTWiWKL3HZrMVuu1dMjjjfyNpTUiHrmI/Iak0Y9TBx4MIHxqXIh94ayUAg3G+gpyCuQzdXMgNM/hl+7PAabozPEK4ZD3+6Po81xfu6x/3s/V8B6qr2GrbIS6o0Nhjru8ydXtU0GvNLL7zQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from DM4PR11MB7303.namprd11.prod.outlook.com (2603:10b6:8:108::21) by CO6PR11MB5668.namprd11.prod.outlook.com (2603:10b6:5:355::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.34; Tue, 5 Dec 2023 08:35:04 +0000 Received: from DM4PR11MB7303.namprd11.prod.outlook.com ([fe80::b960:9754:455d:b195]) by DM4PR11MB7303.namprd11.prod.outlook.com ([fe80::b960:9754:455d:b195%7]) with mapi id 15.20.7046.034; Tue, 5 Dec 2023 08:35:04 +0000 From: "Aktemur, Tankut Baris" To: Andrew Burgess , "gdb-patches@sourceware.org" Subject: RE: [PATCHv6 05/10] gdb: don't display inferior list for pending breakpoints Thread-Topic: [PATCHv6 05/10] gdb: don't display inferior list for pending breakpoints Thread-Index: AQHaJQxgRBMX7UNJm0KJ+ph1XvMhRLCaXn7Q Date: Tue, 5 Dec 2023 08:35:02 +0000 Message-ID: References: <4388587f8ba90fde92b6185020c96b20fe87631a.1701513409.git.aburgess@redhat.com> In-Reply-To: <4388587f8ba90fde92b6185020c96b20fe87631a.1701513409.git.aburgess@redhat.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DM4PR11MB7303:EE_|CO6PR11MB5668:EE_ x-ms-office365-filtering-correlation-id: de69cf57-b3c8-46bc-c411-08dbf56d1376 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 78MzJaQ+yRsPeKXBrpfIh0kgZYGiUq3M5HefcUNofT9MSzup0p6hXXmHMF5eLAdf0kIU8ml/yf3l77C2QY03wbqDEKwfcsP/VQcz2StKFkxzQ8oS5vKcIwWuXJieq+P5iiKpYXWBIipe7cYAIqa7CrIPhp3YZmPebt7KL27YEjFq1CDDfmaQ0D1rbyF5USBdQ0IBG5O1fRLJH3lZsNHNE4LZmWMy9LJKAuapxLVOrFacOONCoP1WM7jRgpnd9mMcXUGG6qHbBMRdjM617vSs0vpRcJ25ZrsH388giqICPgWxfMUqy4ZiWGS14HfB1I6y6Id/dU+BqEyFLHWV2BKXw04CDeLFWHpzBePMfiMNRTqpkfS84b3QksejTR145uivgByAyC+frFb7/KeoS00qbxbM3RfLGZKOAAdSMo/eCojKj6cvYoL3OmcW5jUPOSpMMQwBw+YSIESDiU3Q+4dlFV9zMJr5CIzLG6Gg4L78oxCItmCUtzT3C0Xx6WofY1ydJY/ZVBgqDY1QAQj+HWifbL3Flyc3iOEXWX+X6CqySu+Y+OB45ml/ob+KcbNU0BrfVbXbp1QY24SEljiJmIOOqExdsudWRf+zy2Pm3L241rueiJm9iRkH9XAPZWMUrzsM x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR11MB7303.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(396003)(39860400002)(346002)(376002)(136003)(230922051799003)(1800799012)(186009)(64100799003)(451199024)(82960400001)(83380400001)(122000001)(55016003)(38100700002)(86362001)(8676002)(8936002)(53546011)(6506007)(7696005)(9686003)(26005)(41300700001)(71200400001)(33656002)(76116006)(66946007)(66556008)(316002)(66446008)(110136005)(64756008)(66476007)(478600001)(2906002)(38070700009)(52536014)(5660300002)(2004002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?8SSbha20s8qPbzRhEaOZQWZSI06xTrOOfo60D3vW+7hGcDADjCMRHO/LgnhL?= =?us-ascii?Q?+02qbRp76vatktKzibzidG3KpZqmsTTmqstZeJXhvJkLacWVn54NtX0IHl8e?= =?us-ascii?Q?K3bGmrIMbANiaESVyAtl6LIbrnT17SCNGQtnMxzaZoTG8zQJkvku8p2kHAB+?= =?us-ascii?Q?4zpPIOxaIfuzXLBDPMTL6YM8fKHAgtmm8UeSrC30tSYbe0QYuKdkHbDdSTUV?= =?us-ascii?Q?iIhPitxa6NucpM8EnHCv1ywDCL7/xEArUuqXNZw+GZ2ZNxnw0vvFG3vLL0Ba?= =?us-ascii?Q?0OK9c4x/vD75WK8SWi0VhCbKvs256XB2iijNLfA6wOLaGu19NbJH+bxmlEf+?= =?us-ascii?Q?5U0sUlkn8X2tm/LKCM8d9jqLQ+gLDB6UGyuX5bYmd723pe6bC2m4h9Boryxu?= =?us-ascii?Q?ZxFlXmDkM6SDgtA/PIihJFig+MWVRjqxCsYVjUf9sUSr0vrUQv1tNjINlNas?= =?us-ascii?Q?ctlXK98x7MrJi2rVlCfMhjriYVuNn3lsEfpQO+R3uMNDdLI9cFeJwCQNEeDx?= =?us-ascii?Q?iyKGHg49KNliD2gPZChrkz0gOsSJZb2kjL9SP1Am+RF7o6KAJe0WrnR0Eq/0?= =?us-ascii?Q?AZU8qOTjWEq2xkW42xKkwh55L6NjplAyuEs0ztYn9JpbvHQtTsHEzfIRG4iN?= =?us-ascii?Q?PH2vZ6Ix9TPUbVr2hfltAEy0ok2LlAZw8qTElkMqkBu3To2ifaNsaSQ6GuHy?= =?us-ascii?Q?B/r5yY+wLHDExb5YPn+MGOIZSeFc3QADbCLT+3dX0S6UnWDDCLZXBG8cNYOz?= =?us-ascii?Q?lg6qCKIlS/SsuX5BYPLxOvfEMC8QQWboxsHeje+hNP8k6G1tLoEeKSMHTAor?= =?us-ascii?Q?auyOWo5x/EJdBJ5jaYhst3tgO/AiFMJLEQr6FUgdZaqv1GlAcSvA7lfmHiUB?= =?us-ascii?Q?h901KPvgdINw31q/7Ra9hJk7CB+QQRB1e6MtMmLVWr7UUATACUuDSe0azDzS?= =?us-ascii?Q?kgJHacouB53kQ7aFmaFCcsU+z7e+Ed2TWV/mjcTh/GG1A490oYbVPXwc+7VA?= =?us-ascii?Q?V3YPw9k34Ju+c4sL9jBIalb2xTpAyrnudK6wk8ScLoxU+IxfMOIcgYgmqMqU?= =?us-ascii?Q?gqbx3GyyZslwN+m8avBaqtzt+6695pmOjlH+1OFQrbY4U+be4y29ChfX6oQ2?= =?us-ascii?Q?VWrEyUa86ZsfWBIYlLCKEcL8s+Cf1h7e2fR+gvLvKCIw4NxJyEjNhP/MxKw1?= =?us-ascii?Q?gLSOIjTad+axngC+Oj5plGsiEOJqxPBS0pn4+h/4+v+DVoo1k5dyVbo34h4Z?= =?us-ascii?Q?hGOtFS4I1i5EAxuuz8o27BkBo6exNCFyrJtta8iOdApx3Kynf1WUUaqw4Qgb?= =?us-ascii?Q?p4xnGKBTsQSwWpsdnQiy20mSNUe4r2EE/Bv10yx8Dtujvg3QAs1B2W1jEg55?= =?us-ascii?Q?fXIyyMeDJ3yX1nDXRZPAhiQug7W/2LsbSCIK/7zifYNoRh21+0MWyDBGIdMX?= =?us-ascii?Q?f/Us3W/F2ydbweVgsl4XSf6bVvLVdAvg9nJg7RXoHJX7WeCOvMAwScfi+h4r?= =?us-ascii?Q?4pKg2Ko5R5QUuaItFbNmVf+xwcO2rpXZmRHBMvZ6BxpROwU0ZF2hHztw+aiQ?= =?us-ascii?Q?8JwnhoeGQp6u6QIM6iUgu3Km+SLRu5v9efWYBOk7+p6mcscEL4F0Tkj7ZBv9?= =?us-ascii?Q?KA=3D=3D?= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB7303.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: de69cf57-b3c8-46bc-c411-08dbf56d1376 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Dec 2023 08:35:02.9673 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: ZRKQAendRzUKdnXYhr8mnnUl6eTg7qeRzuSbbaZqn0hEu6NCTM54+BY5cxLzh4BJDwcWfFiuIzNFpTOoDVhbDKvPrzF/AsXscJxFW52Kh+A= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR11MB5668 X-OriginatorOrg: intel.com Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Saturday, December 2, 2023 11:42 AM, Andrew Burgess wrote: > I noticed that in the 'info breakpoints' output, GDB sometimes prints > the inferior list for pending breakpoints, this doesn't seem right to > me. A pending breakpoint has no locations (at least, as far as we > display things in the 'info breakpoints' output), so including an > inferior list seems odd. > = > Here's what I see right now: > = > (gdb) info breakpoint 5 > Num Type Disp Enb Address What > 5 breakpoint keep y foo inf 1 > (gdb) > = > It's the 'inf 1' at the end of the line that I'm objecting too. > = > To trigger this behaviour we need to be in a multi-inferior debug > session. The breakpoint must have been non-pending at some point in > the past, and so have a location assigned to it. > = > The breakpoint becomes pending again as a result of a shared library > being unloaded. When this happens the location itself is marked > pending (via bp_location::shlib_disabled). > = > In print_one_breakpoint_location, in order to print the inferior list > we check that the breakpoint has a location, and that we have multiple > inferiors, but we don't check if the location itself is pending. > = > This commit adds that check, which means the output is now: > = > (gdb) info breakpoint 5 > Num Type Disp Enb Address What > 5 breakpoint keep y foo > (gdb) > = > Which I think makes more sense -- indeed, the format without the > inferior list is what we display for a pending breakpoint that has > never had any locations assigned, so I think this change in behaviour > makes GDB more consistent. > --- > gdb/breakpoint.c | 2 +- > gdb/testsuite/gdb.multi/pending-bp-lib.c | 22 ++++ > gdb/testsuite/gdb.multi/pending-bp.c | 66 ++++++++++++ > gdb/testsuite/gdb.multi/pending-bp.exp | 130 +++++++++++++++++++++++ > 4 files changed, 219 insertions(+), 1 deletion(-) > create mode 100644 gdb/testsuite/gdb.multi/pending-bp-lib.c > create mode 100644 gdb/testsuite/gdb.multi/pending-bp.c > create mode 100644 gdb/testsuite/gdb.multi/pending-bp.exp > = > diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c > index c1440a6921f..3ee23af83d6 100644 > --- a/gdb/breakpoint.c > +++ b/gdb/breakpoint.c > @@ -6597,7 +6597,7 @@ print_one_breakpoint_location (struct breakpoint *b, > } > } > = > - if (loc !=3D NULL && !header_of_multiple) > + if (loc !=3D NULL && !header_of_multiple && !loc->shlib_disabled) Since you're touching the line, would you consider turning NULL into nullptr? > { > std::vector inf_nums; > int mi_only =3D 1; > diff --git a/gdb/testsuite/gdb.multi/pending-bp-lib.c b/gdb/testsuite/gdb= .multi/pending-bp- > lib.c > new file mode 100644 > index 00000000000..15d1b9833dd > --- /dev/null > +++ b/gdb/testsuite/gdb.multi/pending-bp-lib.c > @@ -0,0 +1,22 @@ > +/* Copyright 2023 Free Software Foundation, Inc. > + > + This program is free software; you can redistribute it and/or modify > + it under the terms of the GNU General Public License as published by > + the Free Software Foundation; either version 3 of the License, or > + (at your option) any later version. > + > + This program is distributed in the hope that it will be useful, > + but WITHOUT ANY WARRANTY; without even the implied warranty of > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + GNU General Public License for more details. > + > + You should have received a copy of the GNU General Public License > + along with this program. If not, see .= */ > + > +int global_var =3D 0; > + > +void > +foo (int arg) > +{ > + global_var =3D arg; > +} > diff --git a/gdb/testsuite/gdb.multi/pending-bp.c b/gdb/testsuite/gdb.mul= ti/pending-bp.c > new file mode 100644 > index 00000000000..ca8a3c20b72 > --- /dev/null > +++ b/gdb/testsuite/gdb.multi/pending-bp.c > @@ -0,0 +1,66 @@ > +/* Copyright 2023 Free Software Foundation, Inc. > + > + This program is free software; you can redistribute it and/or modify > + it under the terms of the GNU General Public License as published by > + the Free Software Foundation; either version 3 of the License, or > + (at your option) any later version. > + > + This program is distributed in the hope that it will be useful, > + but WITHOUT ANY WARRANTY; without even the implied warranty of > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + GNU General Public License for more details. > + > + You should have received a copy of the GNU General Public License > + along with this program. If not, see .= */ > + > +#include > +#include > + > +void > +breakpt () > +{ > + /* Nothing. */ > +} > + > +volatile int global_counter =3D 0; > + > +volatile int call_count =3D 1; > + > +int > +main (void) > +{ > + void *handle; > + void (*func)(int); > + > + /* Some filler work so that we don't initially stop on the breakpt call > + below. */ > + ++global_counter; > + > + breakpt (); /* Break before open. */ > + > + /* Now load the shared library. */ > + handle =3D dlopen (SHLIB_NAME, RTLD_LAZY); > + if (handle =3D=3D NULL) > + abort (); > + > + breakpt (); /* Break after open. */ > + > + /* Find the function symbol. */ > + func =3D (void (*)(int)) dlsym (handle, "foo"); > + > + for (; call_count > 0; --call_count) > + { > + /* Call the library function. */ > + func (1); > + } > + > + breakpt (); /* Break before close. */ > + > + /* Unload the shared library. */ > + if (dlclose (handle) !=3D 0) > + abort (); > + > + breakpt (); /* Break after close. */ > + > + return 0; > +} > diff --git a/gdb/testsuite/gdb.multi/pending-bp.exp b/gdb/testsuite/gdb.m= ulti/pending-bp.exp > new file mode 100644 > index 00000000000..e4f0aa2e38a > --- /dev/null > +++ b/gdb/testsuite/gdb.multi/pending-bp.exp > @@ -0,0 +1,130 @@ > +# Copyright 2023 Free Software Foundation, Inc. > + > +# This program is free software; you can redistribute it and/or modify > +# it under the terms of the GNU General Public License as published by > +# the Free Software Foundation; either version 3 of the License, or > +# (at your option) any later version. > +# > +# This program is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +# GNU General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License > +# along with this program. If not, see . > + > +# Tests related to pending breakpoints in a multi-inferior environment. > + > +require allow_shlib_tests !use_gdb_stub > + > +standard_testfile > + > +set libname $testfile-lib > +set srcfile_lib $srcdir/$subdir/$libname.c > +set binfile_lib [standard_output_file $libname.so] > + > +if { [gdb_compile_shlib $srcfile_lib $binfile_lib {}] !=3D "" } { > + untested "failed to compile shared library 1" > + return -1 > +} > + > +set binfile_lib_target [gdb_download_shlib $binfile_lib] > + > +if { [build_executable "failed to prepare" $testfile $srcfile \ > + [list debug \ > + additional_flags=3D-DSHLIB_NAME=3D\"$binfile_lib_target\" \ > + shlib_load pthreads]] } { Is pthreads needed? > + return -1 > +} > + > +# Used to override delete_breakpoints when we don't want breakpoints > +# deleted. > +proc do_nothing {} {} > + > +# Start two inferiors, both running the same test binary. The arguments > +# INF_1_STOP and INF_2_STOP are source code patterns that are passed to > +# gdb_get_line_number to figure out where each inferior should be stoppe= d. > +# > +# This proc does a clean_restart and leaves inferior 2 selected. Also t= he > +# 'breakpoint pending' flag is enabled, so pending breakpoints can be cr= eated > +# without GDB prompting the user. > +proc do_test_setup { inf_1_stop inf_2_stop } { > + clean_restart ${::binfile} > + > + gdb_locate_shlib $::binfile_lib > + > + if ![runto_main] { Braces can be added for consistency with the other if-statements. > + return false > + } > + > + gdb_breakpoint [gdb_get_line_number ${inf_1_stop}] temporary > + gdb_continue_to_breakpoint "move inferior 1 into position" > + > + gdb_test "add-inferior -exec ${::binfile}" \ > + "Added inferior 2.*" "add inferior 2" > + gdb_test "inferior 2" "Switching to inferior 2 .*" "switch to inferi= or 2" > + > + with_override delete_breakpoints do_nothing { I'm not sure why this is needed. The BP at inf_1_stop was already defined temporary. Is there any breakpoint left that we want to retain? > + if {![runto_main]} { > + return false > + } > + } > + > + gdb_breakpoint [gdb_get_line_number ${inf_2_stop}] temporary > + gdb_continue_to_breakpoint "move inferior 2 into position" > + > + gdb_test_no_output "set breakpoint pending on" > + > + return true > +} > + > +# Check that when a breakpoint is in the pending state, but that breakpo= int > +# does have some locations (those locations themselves are pending), GDB > +# doesn't display the inferior list in the 'info breakpoints' output. > +proc_with_prefix test_no_inf_display {} { > + do_test_setup "Break before open" "Break before open" > + > + # Create a breakpoint on 'foo'. As the shared library (that contains > + # foo) has not been loaded into any inferior yet, then there will be= no > + # locations and the breakpoint will be created pending. > + gdb_breakpoint "foo" allow-pending We already did "set breakpoint pending on" in setup. Do we need "allow-pen= ding"? > + set bpnum [get_integer_valueof "\$bpnum" "*INVALID*" \ > + "get foo breakpoint number"] > + > + # Check the 'info breakpoints' output; the breakpoint is pending with > + # not 'inf X' appearing at the end of the line. "not" -> "no" Regards -Baris Intel Deutschland GmbH Registered Address: Am Campeon 10, 85579 Neubiberg, Germany Tel: +49 89 99 8853-0, www.intel.de Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva = Chairperson of the Supervisory Board: Nicole Lau Registered Office: Munich Commercial Register: Amtsgericht Muenchen HRB 186928