From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by sourceware.org (Postfix) with ESMTPS id E850C3858C5E for ; Tue, 5 Dec 2023 07:39:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E850C3858C5E 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 E850C3858C5E Authentication-Results: server2.sourceware.org; arc=fail smtp.remote-ip=134.134.136.31 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1701761988; cv=fail; b=qBnsMO75Epr6TNSD7bHeQfDKEcfw5maQWCjn5v+za/OQY3UFWwscY82IuLTRaIYR/dmJiUMNHqN0tVIQK7WwuRuko4WnslWiJfrOik5rEzFGH5lfTeye6381CHiTUgupWnagNI0qJ6DUoXY/4AtldU8pOHljn5Cp8Iey2nHcoMI= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1701761988; c=relaxed/simple; bh=RxaB0c043764VLfdwXP9v/qct+GzlHviTuyLSdOEPoo=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=HINlxwG02jZntB3nKXyen5Xu8PnW/6lSwzLOo3yBe6NCM6V95N+tor16TiPXpp7RY/mKy9CgksdyV8sWMn0x+Z7E4YbZdB1avCteQrrhqHrdfqDwwvCICVPaEyS9zHoD3T8pS/MlSLnCS9oq71qJcCN0OF/QDeDy3Pq9pVcag3s= 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=1701761987; x=1733297987; h=from:to:subject:date:message-id:references:in-reply-to: mime-version:content-transfer-encoding; bh=RxaB0c043764VLfdwXP9v/qct+GzlHviTuyLSdOEPoo=; b=lG1i02MpjAZ8kv/tlQn/AZGNjGb85i0+6Ah7toWEIQzHimonyTtXLgi/ 2zVGn6oUSsD6PWLoMA9o6tjNjEdAyscnmTj1Fs2gACPGaQwKqOURL+Kyy v0fO9HDXmA9bj2PCEICeDBCeiiLqaEGwrWDm4YQnUpgO7LpuZFOOA4AKB alT7RhuRZ4psyinbN1cgyDAiJ1i14WKt+rkS8lAA5zTIJDMQrfA8wMfXU bR4E8O+9OPWV+hHqb78PjPZAiY6j74ZNaDiidwfF4NUCRgz0qFC7CuP5c XSLbNK773/ELoJhAM7Z9s+tXltuvfM1Tn86MhWyKL9pTY04jSSm1YSUgr A==; X-IronPort-AV: E=McAfee;i="6600,9927,10914"; a="458109560" X-IronPort-AV: E=Sophos;i="6.04,250,1695711600"; d="scan'208";a="458109560" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Dec 2023 11:40:23 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10914"; a="894105891" X-IronPort-AV: E=Sophos;i="6.04,250,1695711600"; d="scan'208";a="894105891" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orsmga004.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 04 Dec 2023 11:40:23 -0800 Received: from fmsmsx601.amr.corp.intel.com (10.18.126.81) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 4 Dec 2023 11:40:23 -0800 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Mon, 4 Dec 2023 11:40:23 -0800 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (104.47.74.40) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.34; Mon, 4 Dec 2023 11:40:22 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YQxkljCZSviHrGU0bg9n9xwM/v2bOvf+UHlNf4VGpUp7+gxJ5eqTnIa007Lg8Ytnnug3Rf/mcA60Y1eL12gyH2w47NOKhpFnogV7D/wKllQfuSr5Rq+LYLyae7gD/46LyPdZOFvpSthdiOagf1jZQHeGqLCxNxKDjXjq6Bap8MO/ScFonDFfRHJ54ewTfGjcEHJSzOAyEWOTyJcafbf5DEWUgc4jgKAz9AwxRg00j0DMG8VcQAQ/YibD9jrzrGMOGiyHf7WhIsy45E3t1o7/kfvFO3fy5KJGomDBGov/WQHB4lDwYTg5Pyv6Q+NNqbMuTcxiZomXUDjo2j7uuVWR/w== 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=cgV+gQNUaEYTgoj3uYjxUqeuiHYhNS/o9qadTewnfKE=; b=Wt29DQcVeOatisdXiK6exfGJte6MY3F7Jtl5rlVa3rXA8ZnJGqWYokBCzVFCxj+S/7+8Hq826nMGbltSKEc8SkeRC2XFpE1jqQiUQwOKaQA6XBM87/FJwCbqDcr9loYn880/Cihibv7JMY2xWGnlr4i0XfLC++QB9osUipobMKq8y+QCJ/LUkKX63QGIEorZWpvXrtydHEkgRwb3SVBsUe6GTiJYOIKqTMwxLiJAjhwFYa0AyaHC7KXvdWgum9Xh111aXfpfjrAnwLefRZHtWWVqTSfFSUDn/DpFp5O25JOJNQqL4O+dtR6v2Hok8SaYYFJTsamgEldS+PCPXxEkFw== 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 SJ0PR11MB4845.namprd11.prod.outlook.com (2603:10b6:a03:2d1::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.33; Mon, 4 Dec 2023 19:40:20 +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.033; Mon, 4 Dec 2023 19:40:20 +0000 From: "Aktemur, Tankut Baris" To: Andrew Burgess , "gdb-patches@sourceware.org" Subject: RE: [PATCHv6 02/10] gdb: create_breakpoint: asserts relating to extra_string/parse_extra Thread-Topic: [PATCHv6 02/10] gdb: create_breakpoint: asserts relating to extra_string/parse_extra Thread-Index: AQHaJQxSwncn5xMKS06pAZB+b/vTtLCZhqeg Date: Mon, 4 Dec 2023 19:40:20 +0000 Message-ID: References: In-Reply-To: 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_|SJ0PR11MB4845:EE_ x-ms-office365-filtering-correlation-id: 9df04e63-8c66-4ec3-0090-08dbf500d9da x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Pfqk6rtrzOCX3ZihpVjxcalXJjjz/hgfZrrWzVWjDgP/lwlxMNmVUUKR/BVwkM3hMJabTNfdMojpM/nfZGGbjF44Q7yHVG44MyI0OFXTZJIx+qy5Uu5Wu5VhHaLTL6sXuuu+ebZwImxhmRX6zvXokuTSNJRSsCeAJa/WQ7H9M4/XgK6CVS3jF1yNctzQl52AcxdDYLi4ZB0o6IuFLGJdopXYi06fiNx2I35lHwpTfqMD3q3QGadNGen5xP7hxBNOdpWPs91DXBXNjQ46xFXmBP5ngIRYFjnE/aakRTYxjiIbrKs59FbPGrpK7GapZ9ujvFWFQT4/JV45Cmxbg9wAQFnpivP6elrhwCsI81kVGr2zELsndT+1arW4qpLNOXiRL5ffKETzhkFXFPTufkiXjejjS65g0Wyj1riCNwfz2jpm3CVV+h5FirWfmiDCzyXdnXswh8EhlUr7ftBECGgjCCfFXoeMCEBIlv95jIk7Ijuol0gCP8189zkiScEJJyXxTVcR37OvFY2HokyMOjGWZW2KO4U/3SCycrbXjOYzKqDybCsSICpP5qbVr0lAhRtxR1yjoC4KrOPfJv8nWzswUSeNyFT5ogbnFuAhQKwPrBM6G6W9Bqk41x3subOrufjw 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)(136003)(39860400002)(366004)(346002)(376002)(396003)(230922051799003)(1800799012)(186009)(64100799003)(451199024)(66556008)(64756008)(66476007)(66446008)(66946007)(76116006)(8676002)(8936002)(316002)(110136005)(478600001)(71200400001)(5660300002)(38070700009)(41300700001)(33656002)(2906002)(86362001)(52536014)(83380400001)(82960400001)(26005)(122000001)(38100700002)(55016003)(6506007)(9686003)(7696005)(53546011);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?Rme6mw4wQgQSKcaKSKLUXcyiNFioRUCRpfwypVgnGZvJk0cTiNvL4zrbP3o9?= =?us-ascii?Q?8UvezOhN/ZkdRXPtuz54J3/Itj77XolQFaq50GVLN2m1BEjCiRG0GDrgRXd2?= =?us-ascii?Q?FSqt/hmsuHRJkT4JFgQY6dvQvsvQLe255zD8IALmSF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UT58U/BwSsde/facJDkT41IzEaQD+HGA8aE7iIJhybAYgOA7TMU?= =?us-ascii?Q?rDP7l6Kk3TqmxgKzgr1c/OwgeWzJ3+8xd9mPqb4x5G7DEikZTTRr0Pi6h2Zp?= =?us-ascii?Q?7gxL9wsZN2NroCXa3+JuzaTl0feWvrSKBLq2oELHKEYquXGEUVEa5pLsNWow?= =?us-ascii?Q?kq6kbWh1riHyPs0jiX20eQ9gk4doYspnmro7Ya4isk4lnI552x66y/ESucWp?= =?us-ascii?Q?HGlk88C54bS0k2q4RDp61CcR+0zj+yCYup9bIWxXu9dBtan+AQR4v06Y72DB?= =?us-ascii?Q?YN6J8YaGD7ceGztsHORGXmOCtWBQS8k8FEr7fXqbDCQJz+ZsyDUXJVQcPiCz?= =?us-ascii?Q?h3pQDY7y1NaZ53G/YNWGe+kttm7j+BTmDPJZJBHSdR1ZFetiukmt35L12eOk?= =?us-ascii?Q?oMxJehPJB4tYL9R+rKFBiCyPHH3Fy2i2Px026+movYm+/t0islz8roNkuFtE?= =?us-ascii?Q?K8fAvlWipNkgVAFIUDJXVs/HdcYBzDpvRh34ooXnYpRxtbrGjHMCDHVebhNL?= =?us-ascii?Q?4E/7CTKaSOT2vLXsQ3nFuUsj/WfBc753rirq36S/nT0hAPwU9UxeiI+7rLYD?= =?us-ascii?Q?rg=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: 9df04e63-8c66-4ec3-0090-08dbf500d9da X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Dec 2023 19:40:20.6319 (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: 7MTvSt7UGy7yNtGdh4Hzy8JQqdxsBh7VPmlU0FCZuwZX/IcS+bT9zIjRJ5lqcNsPENRhDb4e1Tc3vPtcSsFRQOnGXQFgcedIybiH6N6a7x4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB4845 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,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: > The goal of this commit is to better define the API for > create_breakpoint especially around the use of extra_string and > parse_extra. This will be useful in the next commit when I plan to > make some changes to create_breakpoint. > = > This commit makes one possibly breaking change: until this commit it > was possible to create thread-specific dprintf breakpoint like this: > = > (gdb) dprintf call_me, thread 1 "%s", "hello" > Dprintf 2 at 0x401152: file /tmp/hello.c, line 8. > (gdb) info breakpoints > Num Type Disp Enb Address What > 2 dprintf keep y 0x0000000000401152 in call_me at /tmp/h= ello.c:8 thread 1 > stop only in thread 1 > printf "%s", "hello" > (gdb) > = > this feature of dprintf was not documented, was not tested, and is this -> This > slightly different in syntax to how we create thread specific > breakpoints and/or watchpoints -- the thread condition appears after > the first ','. > = > I believe that this worked at all was simply by luck. We happen to > pass the parse_extra flag as true from dprintf_command to > create_breakpoint. > = > So in this commit I made the choice change this. We now pass > parse_extra as false from dprintf_command to create_breakpoint. With > this done it is assumed that the only thing in the extra_string is the > dprintf format and arguments. > = > Beyond this change I've updated the comment on create_breakpoint in > breakpoint.h, and I've then added some asserts into > create_breakpoint as well as moving around some of the error > handling. > = > - We now assert on the incoming argument values, > = > - I've moved an error check to sit after the call to > find_condition_and_thread_for_sals, this ensures the extra_string > was parsed correctly, > = > In dprintf_command: > = > - We now throw an error if there is no format string after the > dprintf location. This error was already being thrown, but was > being caught later in the process. With this change we catch the > missing string earlier, > = > - And, as mentioned earlier, we pass parse_extra as false when > calling create_breakpoint, > = > In create_tracepoint_from_upload: > = > - We now throw an error if the parsed location doesn't completely > consume the addr_str variable. This error has now effectively > moved out of create_breakpoint. > --- > gdb/breakpoint.c | 42 +++++++++++++++++++++++++++++------------- > gdb/breakpoint.h | 44 +++++++++++++++++++++++++++----------------- > 2 files changed, 56 insertions(+), 30 deletions(-) > = > diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c > index dd415ff42f0..bd28236ce7d 100644 > --- a/gdb/breakpoint.c > +++ b/gdb/breakpoint.c > @@ -9240,6 +9240,17 @@ create_breakpoint (struct gdbarch *gdbarch, > if (extra_string !=3D NULL && *extra_string =3D=3D '\0') > extra_string =3D NULL; > = > + /* A bp_dprintf must always have an accompanying EXTRA_STRING containi= ng > + the dprintf format and arguments -- PARSE_EXTRA should always be fa= lse > + in this case. > + > + For all other breakpoint types, EXTRA_STRING should be nullptr unle= ss > + PARSE_EXTRA is true. */ > + gdb_assert ((type_wanted =3D=3D bp_dprintf > + && extra_string !=3D nullptr && !parse_extra) > + || (type_wanted !=3D bp_dprintf > + && (extra_string =3D=3D nullptr || parse_extra))); > + This could be a personal taste, but I'd find it easier to read if it was written = if (type_wanted =3D=3D bp_dprintf) gdb_assert ((extra_string !=3D nullptr) && !parse_extra); else gdb_assert ((extra_string =3D=3D nullptr) || parse_extra); or gdb_assert ((type_wanted =3D=3D bp_dprintf) ? (extra_string !=3D nullptr) && !parse_extra : (extra_string =3D=3D nullptr) || parse_extra)); 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