From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by sourceware.org (Postfix) with ESMTPS id 4B6653858D33 for ; Tue, 5 Dec 2023 08:17:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4B6653858D33 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 4B6653858D33 Authentication-Results: server2.sourceware.org; arc=fail smtp.remote-ip=192.198.163.7 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1701764271; cv=fail; b=NIaF4ftt4t3KfyJMQAlnnOyO1dFpyaPmPjcUR8ZVICwkC5LnMrmTMv4myefBQt0rVKMGqbC5WWq1hPxHYa6htnJCbiURkRVqGUMSzgVcH5UQ4P8uHquAOvePxhhpB7rAt23qpmar0AeKbYnbg4+wBu8dhVkosLa86dUF0mNUMoo= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1701764271; c=relaxed/simple; bh=sHAEX6y30GDtrW5ukTaAWKDQ2AO4PQbMON4qHKQpPog=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=nxc691V29Xfez5bJnRDqWKYyRWro4A1NTgxFjMaLW4ClRNTBZsCVFlR4fmFk6YUzoJNH2eOLhfk/XITmk8G1WqKhs7WDit4OFUyPttRIiHZUWN+KK2kE84CtFvAcd0FYMmPNaxXXHjY9flOpQ/HUs0SiDy+75Be8NLm7DhhFkVQ= 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=1701764269; x=1733300269; h=from:to:subject:date:message-id:references:in-reply-to: mime-version:content-transfer-encoding; bh=sHAEX6y30GDtrW5ukTaAWKDQ2AO4PQbMON4qHKQpPog=; b=Su2q7GtVfiSka5utvxSgt23O7Qdiwrd4f4w0BBjQAuMlXkCzXyzAvPUJ RrzWhpR2zvVY8mDyJLhwXocq6f7RJEDLEoQ5WSSWTV4tl8xm6Y4HLgeRk OIxEkG0evjv/H4Rnr7E4tyREfeHp8fk6xPvy/4GjKyWXkyYBWSAjc0MNH GAGJgFK2BZmsSiq9eElzEy1Nx5LboIWzcH2wgqpzF1WIwUlrYKiOaSIqj Hm9A3NKiiAxgyjXA53tgRsgrCnRheWY9Lpe0uKXSaU/iwkhYUgEC+57jb QtWG33gvIugSNeCcKM5JAT2RIlKzfcySU3ypoijIndULEI14yDkCogzvw Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10914"; a="15408932" X-IronPort-AV: E=Sophos;i="6.04,251,1695711600"; d="scan'208";a="15408932" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Dec 2023 00:17:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10914"; a="836889583" X-IronPort-AV: E=Sophos;i="6.04,251,1695711600"; d="scan'208";a="836889583" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by fmsmga008.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 05 Dec 2023 00:17:47 -0800 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) 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:17:47 -0800 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx612.amr.corp.intel.com (10.22.229.25) 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:17:47 -0800 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (104.47.73.169) 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:17:47 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OmTy0rzehUxOxuh39nLjrD7YpNTP1ZZnhomL5PTieURmzVUz4ftAtIiKPPc4DGWrYSN+I+p5LFjum0bwFrgoXuhwAVd0Vcg4xZaCX8a/nrSVNbkQczyemfaQSKS7+vwEIs/rB0bOe8MSAdPFIADYMbgFvcPrCwj4wY1xU07Q+4lEfclEeHl3YQMH94e++0RVmmw7qSTXomunl5vua13msitoP0VJho/Q4Dpil6nXZvyCcV6I+emvOE+w2QfUPQSoGXh6tsDMykRofw+OWbS+cXMyRymLAyVOH1Sy/2Ef9GnkbzqaI1uSZFgrrMnwupevX2EkgLDFPWIsrmy5Zzyn4g== 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=NXyPMccydg6DV1/yzpkyh6IbgBC05Y1FyxY1+twGEcU=; b=CZHK4YlOkcOqtEI9Yfhwq7B8zJwk9skiDboQgUcwUUQBFbRT3vcDFvJ3IyZeL/OeMKhY6zz20LckNeeuFBV+1fv6IvhBH1Jymy3TYwHPBSFufVmQQnXvPHm+CxOVilnoRfWAxiwC0E9Sng6Czzzehhd1yLxHCG6o2tt2iFMpKIG4pMYFoysxvk1nAPeVS9KNX9w4ErH0SM/ssyMwGmG2MmBRLm03u6ZKB/PeVbruW2wDmshTwRn9cYty5MuNKBbpLX+yUjh0IOp2KnOvgDmZXODM3GXWSZ72OFoqZ8rGQcWwwfSaNRvsQgPlrVfW5Ln0gAOvJXNCX7Kb/0n+84GqYg== 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 IA0PR11MB7307.namprd11.prod.outlook.com (2603:10b6:208:437::10) by DM8PR11MB5637.namprd11.prod.outlook.com (2603:10b6:8:33::5) 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:17:45 +0000 Received: from IA0PR11MB7307.namprd11.prod.outlook.com ([fe80::ab6c:8be0:46a3:8011]) by IA0PR11MB7307.namprd11.prod.outlook.com ([fe80::ab6c:8be0:46a3:8011%7]) with mapi id 15.20.7046.028; Tue, 5 Dec 2023 08:17:45 +0000 From: "Aktemur, Tankut Baris" To: Andrew Burgess , "gdb-patches@sourceware.org" Subject: RE: [PATCHv6 04/10] gdb: build dprintf commands just once in code_breakpoint constructor Thread-Topic: [PATCHv6 04/10] gdb: build dprintf commands just once in code_breakpoint constructor Thread-Index: AQHaJQxo+atYTizyFEu5mrJnP8GFVrCaW0Cw Date: Tue, 5 Dec 2023 08:17:45 +0000 Message-ID: References: <3c240e1430759e5bdf78207106d79207a92c5f44.1701513409.git.aburgess@redhat.com> In-Reply-To: <3c240e1430759e5bdf78207106d79207a92c5f44.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: IA0PR11MB7307:EE_|DM8PR11MB5637:EE_ x-ms-office365-filtering-correlation-id: 48cd24a6-0a11-4223-e76c-08dbf56aa8d6 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: pX/nUlB6Q9/wegT/zm/C1l4QtR0htMCNXxeIwvLQ5GAkxHd+pWxR9zpeUH/2KtbTvfSitfN/+fmfJ8leSeYj3DyVoC2FE/stNzS3rWheFx+kw5ng1T8SkwfsGUsS9Hvb66eLGlyCGLAbKoauWGXuwaEiUYk44UwzT71zIg0bMx3i/kYdvrdC5df0+s7e1sZJ6rl9HwDdX5CU83n1gO3NfqlO8b1xcyV+dDT0FuRI2lWDPHp4C4KZon9RmIqGZBFJflOmsxlFZmKOgU2npRKjNHNG1s76jTkLdZOVeYYvnj2TsTSS9ZqbifQYI+FnialUgAGb5XS88NF0pGTdHgQTDOVOFuiUuLde9HRHOu/TX/Eea4Z3NRJlvISWWCq6SC5z1zPbvW526GMS9F/HulKHTpAEePuXDHwPm+qHisc2GnLPodPwXLogoRbv1MZRNFTGz2cgBWFSBYNDkh1fxPDWrmINk7ryju/2BqwjTxxMRJ8q4ONRqiJFS7+ByHUz8bR6FoFkSDVMCRM58QAaSTfdcf5c5LemjUiYDj9vMGnyUvGLTy+b9ttrCyiXBzUragdQq7VYqzhpHkMD9+lrmcj2kTcYP2z11UE54gbneMwp+EJRnrNxkJy6tAFIHdWuVmIL x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:IA0PR11MB7307.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(39860400002)(346002)(136003)(396003)(366004)(376002)(230922051799003)(186009)(64100799003)(1800799012)(451199024)(2906002)(33656002)(110136005)(316002)(66446008)(66556008)(64756008)(66476007)(38070700009)(86362001)(66946007)(8676002)(76116006)(52536014)(55016003)(41300700001)(8936002)(5660300002)(38100700002)(122000001)(82960400001)(83380400001)(478600001)(26005)(71200400001)(7696005)(9686003)(53546011)(6506007);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?S62J+UyK2/Qo+Us388w9HuXMoDucPfdIeNmh2dodNCU6JsGhDD+NdqE/JxgR?= =?us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9FZtMMt0ofMVBkSSBpd4sEqSD+YzguCf?= =?us-ascii?Q?SWbzUWKci0C4Up8/Mk3zzadkKQanPC4bGRUJS1iAKU4dlj5JQpd9AlS2iU5v?= =?us-ascii?Q?gzgvuJt6EBd6jJP1LhxZhmuoMIJtIKWCP0JRuMCzQQRxsLdLqLtP+qp5/gzM?= =?us-ascii?Q?jfZ5rCRx8RWr6ulYDUP2LTwDgYNmX29OMYq+URNDK7cUkt+FyG1KYr2TRn3+?= =?us-ascii?Q?6EuAHciPfE8KDLevM5XO48fQl1FRw0JpvzZZ85xXmJTcBcYep2gZKb/VwyUQ?= =?us-ascii?Q?5AzzuL0QL0haAchmC3RdhM3SQKKhfrn714K7UcEvIIdRQnOH+/9DWkt6XBzk?= =?us-ascii?Q?Vt8PdTn+Vw/vrm1Tfkc7cSY/iup6FM9Bqa9ae/EfhYDORwqXtaKnRBWFLePE?= =?us-ascii?Q?ZcPRWShYJVD/4BD85QiNIz85qx2cNznq0JrPy67EOH2KHkq9GiAbhTfYlYyo?= =?us-ascii?Q?X3qHWIbxtF0H24zTeAfh6eRGtXJO0ccdiebSU5ukhCuyVoFiab+xpat/3iAz?= =?us-ascii?Q?5i42pGtdJgWdQ2Eq0FXaEDpy/Lk4xlZt4+ywny6D2OTT7U9liCqxSD8PXzXC?= =?us-ascii?Q?qZkdtJYoAd/AbZrXUuADZEb/eQpU88updbxdW+v+afa5BJjydZ63f8mJuBpL?= =?us-ascii?Q?yNdBBecsKxD8IqPauLqL2Ink9WDYETrMu0sLadrDtvqCQJHIXw5Jmdd2SgEF?= =?us-ascii?Q?iA=3D=3D?= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: IA0PR11MB7307.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 48cd24a6-0a11-4223-e76c-08dbf56aa8d6 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Dec 2023 08:17:45.0620 (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: GmQRWLEJY0Y6t8z1bCQscuxiXbPHHHC8+Y2v27DCwDFFkw4LHhJu5+D5f2+5aFZeJ8iCL/tXKseD8JkYR9if5BS+0gsMn0/sX4CmEjL8THQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM8PR11MB5637 X-OriginatorOrg: intel.com Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,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 in code_breakpoint::code_breakpoint that we are calling > update_dprintf_command_list once for each breakpoint location, when we > really only need to call this once per breakpoint -- the data updated > by this function, the breakpoint command list -- is per breakpoint, > not per breakpoint location. Calling update_dprintf_command_list > multiple times is just wasted effort, there's no per location error > checking, we don't even pass the current location to the function. > = > This commit moves the update_dprintf_command_list call outside of the > per-location loop. I have also changes the 'if' that handles the case > where the extra_string (which holds the format/args) is empty. I > don't believe that this situation can ever arise -- and if it does we > should be catching it earlier and throwing an error at that point. > = > There should be no user visible changes after this commit. > --- > gdb/breakpoint.c | 20 +++++++++----------- > 1 file changed, 9 insertions(+), 11 deletions(-) > = > diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c > index c629d27c4c0..c1440a6921f 100644 > --- a/gdb/breakpoint.c > +++ b/gdb/breakpoint.c > @@ -8704,19 +8704,17 @@ code_breakpoint::code_breakpoint (struct gdbarch = *gdbarch_, > /* Do not set breakpoint locations conditions yet. As locations > are inserted, they get sorted based on their addresses. Let > the list stabilize to have reliable location numbers. */ > + } > = > - /* Dynamic printf requires and uses additional arguments on the > - command line, otherwise it's an error. */ > - if (type =3D=3D bp_dprintf) > - { > - if (extra_string !=3D nullptr) > - update_dprintf_command_list (this); > - else > - error (_("Format string required")); > - } > - else if (extra_string !=3D nullptr) > - error (_("Garbage '%s' at end of command"), extra_string.get ()); > + /* Dynamic printf requires and uses additional arguments on the > + command line, otherwise it's an error. */ > + if (type =3D=3D bp_dprintf) > + { > + gdb_assert (extra_string !=3D nullptr); > + update_dprintf_command_list (this); In Patch 3, a gdb_assert was added inside update_dprintf_command_list. I a= lso noticed that in dprintf_breakpoint::re_set, we have /* extra_string should never be non-NULL for dprintf. */ gdb_assert (extra_string !=3D NULL); /* 1 - connect to target 1, that can run breakpoint commands. 2 - create a dprintf, which resolves fine. 3 - disconnect from target 1 4 - connect to target 2, that can NOT run breakpoint commands. After steps #3/#4, you'll want the dprintf command list to be updated, because target 1 and 2 may well return different answers for target_can_run_breakpoint_commands(). Given absence of finer grained resetting, we get to do it all the time. */ if (extra_string !=3D NULL) update_dprintf_command_list (this); So, I wonder if it wouldn't be simpler to have the assert in update_dprintf_command_list only and remove the asserts and if-checks from the call sites. Thanks -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