From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2060.outbound.protection.outlook.com [40.107.223.60]) by sourceware.org (Postfix) with ESMTPS id D5D2E3858D28 for ; Wed, 25 Jan 2023 20:21:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D5D2E3858D28 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=netapp.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=netapp.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KKaZA92j49y8dIkNaqBge0AGmt4ngRAqjcU6GHjfMPIarnG4il6yfI7YfHcT0z4Ci8fhBGOkxL79h02aUJdW3Unz01HNPpGVnSxMXWQBkvCr9ks30P1KZ/fRN/7j/U/Zdnct+C9iTK/zWVkJFzGmLk9FUuQj1A1MU374j64vugIwkoR8m1QJVhwWBZ7xsmsMChU7biD+PUgx3ripPwWEucBI8tNeStjfYYf/d1S6Xv5IJBypVqaCXWvDJXne98h1d1k5ZRcq4FRzAASyokavOAL69xrfHoENVyyO0Rv+WeszJxhgogvvbhtSEaFZA0j1eYjkXVEFIEVED1tKyk8sgg== 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=WEAe2sOMHZNgMILVVxMwtOxvyPHe1xbz0fzsiTc1UKE=; b=dFCz+7/4C493fdBPp9f97V7TCBEh2fu312GczdZ74Qq5irQViz+VKuqC+B45m+JTtklrP06HuhTQIeW6UwhltjuXKqVInA1f9S5A7IF1S+8wpA4tS7UtJCWw0Qbur2r3uRR5AYgqd8+U2BLWK3VVxoCNETvY2kkizR+3WWtQrTBgBbUCkkJlQPCZKJEz+FP2s9oNYeTuzJN6MKN97doFHOx/LHGpt0axURJK0ftMvOJ/Hp0fdEfeyi80JBp+ghRcoWPdHhaJTZ9143ENQJRZ2h8x/c76OFLuThWexMJkD6REBWw9yfoHM7KLEu+DU9cTb+kG1WnQBiy+9Q6fwP8+XA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=netapp.com; dmarc=pass action=none header.from=netapp.com; dkim=pass header.d=netapp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netapp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WEAe2sOMHZNgMILVVxMwtOxvyPHe1xbz0fzsiTc1UKE=; b=AOA1KINIr2jhVJ9ltXJ9KDqdUF0oT+AehZosDU9f9vGjo+KoQ6icBDxIysVPR48pYenxD4X28/xsA69AKbHWQ66gZ3MCpZ+ENgdmjOBwiUNDxaBPDSHl/bJE1bxnJZMPYb9ns5xH2OdSoEYPTLDcal3CdkKI/B2ImNpeEef+6dD6rMQ40ZEQL1UlPn3npbTFCvkZybZydxu5qhiwY2Fz59zsFlW6F4kbed434LasK36cJ7Tvu3qO4dQLRdJjElari5aoMH13NpcRYFGgrrYeuvxBmiI/eYqzhM948aoJBLAkcap9TUVbfYwQ3gLyJzU4SVN4c/MZ/TvfAjGN0oEi/A== Received: from BYAPR06MB6117.namprd06.prod.outlook.com (2603:10b6:a03:e1::19) by BYAPR06MB4279.namprd06.prod.outlook.com (2603:10b6:a03:5c::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.33; Wed, 25 Jan 2023 20:21:26 +0000 Received: from BYAPR06MB6117.namprd06.prod.outlook.com ([fe80::4107:39d5:185:3cfc]) by BYAPR06MB6117.namprd06.prod.outlook.com ([fe80::4107:39d5:185:3cfc%4]) with mapi id 15.20.6043.021; Wed, 25 Jan 2023 20:21:25 +0000 From: "Peikes, Wendy" To: Keith Seitz , "gdb-patches@sourceware.org" Subject: RE: [RFC PATCH 0/2] Command expression evaulation substitution Thread-Topic: [RFC PATCH 0/2] Command expression evaulation substitution Thread-Index: AQHZMPSgXPSrpi8L+UC9Ht66MpXTf66vkx9Q Date: Wed, 25 Jan 2023 20:21:25 +0000 Message-ID: References: <20230125193825.3665649-1-keiths@redhat.com> In-Reply-To: <20230125193825.3665649-1-keiths@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=netapp.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: BYAPR06MB6117:EE_|BYAPR06MB4279:EE_ x-ms-office365-filtering-correlation-id: dbc6aa28-5d6c-4df7-fff7-08daff11bbf2 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: NC7ZdY9zzi6MxNIIYJRr1CsBmjqemSPjoBH6NiwQntTmaU8TMIypDGUIRjgZ7f+ZksvIE0ybqzWArfoQzYaqohEVfEcnwXPpQLErOW88Cv0lTDxaC1WJalhcIxBmNn+nMhcSM9i7x1ZsjKFZcSAQer7qQqMEs2rW1OosDj2KvwRulME+D/dGg8bjiZ63PavCKRSo1KA0pt2xboQ0Rk9S15iYDoxQFR0G20/3F6M4/xNow4muMeiqXTjwc5eKh5Fa03/QiU+UPtG97N/krV6V6jD5MXXmgQwELO1fU2ScD1IHGGw1pXLND1ic6s1P/rAqKDlDFRwr39Kzal7IeqhzrTfuaw2tUtOZ7xI90vkMGQfMgmCPmUMFlLUJGo2wGjED5Lsv659RAycIu6naTLu3JGj0RR3J0uSq5o3hjMQei7axi5wiDBSQLqr8RoIhKnZOWjJ2M6LBsN2C4Fgz25III23h8UK2mWBW3YHSNtyGwd0zwC2c1bIivbK9ZNzg4PToOwD1Fah9AXo/x5+xUcVUTiHwiY4MlDA7kBPK6NsZ0tqW9VNHUKh8oJDX9SwXOLDBFtTjfj3Oe3Ms3vcqlStnAoIi5i6WsE6p9sCmgUKyLjICtRhn/LV/yDNBVatKxhKFAsRsdBUtw1ChY1fbskvnXZgUkZ7LN5gkeZx5gSt0ZUbK3UOoRqfO6S3NkzdYwfHLgQojEjLx2iHhS0eu1r/z3A== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR06MB6117.namprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(346002)(39860400002)(366004)(396003)(376002)(136003)(451199018)(83380400001)(6506007)(38070700005)(2906002)(76116006)(86362001)(52536014)(5660300002)(8936002)(33656002)(66446008)(110136005)(122000001)(71200400001)(53546011)(7696005)(478600001)(66556008)(9686003)(38100700002)(66476007)(186003)(55016003)(41300700001)(66946007)(64756008)(8676002)(316002);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?AYtEixOw+gQkxur+KRarhlzYjRYsjLtka8YDQ+vN8xNbK7SIlh0qbc0Ehy9f?= =?us-ascii?Q?NciWnkNMCi0nowzr9WS734JTMab4vOaxzr+82c7EUqp00uWkKcic/7AUWW4b?= =?us-ascii?Q?2MFQyARRH7enwPBvd8v/AjCFLSkqDbwFABcn6fDXHQvv7NiWaAfZxnUu6wS+?= =?us-ascii?Q?Qpxp8e5Z8Vl/U1Bl+/5hB/qRnbZ1cilb0+NwtAeNqAq4YwVXqbLK+VcX/B1J?= =?us-ascii?Q?pZYVAXIsC58cta0rU65dkD17f43kAzbfnyl3xqS1DOohGnMjoL8gKYNeCOTZ?= =?us-ascii?Q?9oXTkpkzoiAzzrmHnxIhzJVdXAAKJ9UNBH7nY47XCdPPphUg7MYki233weab?= =?us-ascii?Q?/4YGr/XvBafzf8P4sU04pZmx+V50nOHM4fOPcHw4ZUFYs2pvANs4rz8oybVE?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NfZ4DHA9XwI1vo8V+MaRb4LUesdw?= =?us-ascii?Q?8xZnkpWxNqU5AIsASmbV+sXwVzXkIhPXGcXDAI60S7DGtA0m0m1+LUHHga9R?= =?us-ascii?Q?WDTdexaRT5g0ZuM69vs1ZABlqYqigFbHjzVIcBuyuc4+CwlEw6AcozUwzRUA?= =?us-ascii?Q?FrWQSUBLEvMjyfMf8t2w3WLiNctC6ZKPH6MJihvqGL0Q6qG85p/4j8eM8caL?= =?us-ascii?Q?4biVigqGEQ+T+K/q2D/euAG8lWbpmzGOPXlQOj9M0NsJZYDrZfi75UWgsKMb?= =?us-ascii?Q?3/IvIAy1C/PYvWuAACRATmXGnITYswaOkdtpzBUdFSDujyNFfWVL2B6W7cXB?= =?us-ascii?Q?ySwdIR7Z2ApNauriLeg4zc1z41hyu+qbFuR9GnALhJWX?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: netapp.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BYAPR06MB6117.namprd06.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: dbc6aa28-5d6c-4df7-fff7-08daff11bbf2 X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Jan 2023 20:21:25.8981 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4b0911a0-929b-4715-944b-c03745165b3a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: HqyKj6YkN2QYDDBRaZzZPkgGeJqk7jEFPUnDUqEUjw9867rtqZD+W/s4khPv6CwnAkKFz8xDNNE/5Gp0Xei0Xw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR06MB4279 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Thank you so much for writing back. So is this patch you incorporated based on the idea I sent you? If so THANK= YOU! wendy -----Original Message----- From: Keith Seitz =20 Sent: Wednesday, January 25, 2023 11:38 AM To: gdb-patches@sourceware.org Cc: Peikes, Wendy Subject: [RFC PATCH 0/2] Command expression evaulation substitution NetApp Security WARNING: This is an external email. Do not click links or o= pen attachments unless you recognize the sender and know the content is saf= e. This RFC proposes a new syntax to allow arbitrary expressions to be substit= uted into command arguments. For example, the first patch in this series adds a new `_env' Python conven= ience function which gives users access to the shell's environment variable= s. If a user wanted to access the value of an environment variable within a= GDB command, though, they cannot currently do that: (gdb) set logging file $_env("HOME")/$_env("MYLOG") (gdb) show logging file The current logfile is "$_env("HOME")/$_env("MYLOG")". (gdb) eval "set logging file %s/%s", $_env("HOME"), $_env("MYLOG") evaluati= on of this expression requires the target program to be active That `eval' doesn't work is likely a bug, but I nonetheless find the syntax= quite cumbersome for this purpose. Therefore, I've chosen to introduce a new marker for expression substitutio= n, $(). The second patch implements a proof-of-concept implementation following thi= s concept: (gdb) set logging file $($_env("HOME"))/$($_env("MYLOG")) (gdb) show logging file The current logfile is "/home/keiths/my.log". There is a lot more to do to refine this new feature. For example, the valu= e almost certainly needs to have a lot of format tweaking, since, for examp= le, using chars does not work: (gdb) p 'a' $1 =3D 97 'a' (gdb) echo $($1)\n 97 'a' There are probably a multitude of other similar issues to be sorted out, su= ch as arrays, repeating elements, symbol/object printing and so on. If anyone has any suggestions on how to improve this value printing code, I= 'd love to hear 'em. I've also chosen to hook this in at quite a low level so that all commands = can immediately benefit from this. [That is, we don't have to add handling = code into every command function in which we want to support this new synta= x.] This may not be the best approach. @Wendy.Peikes@netapp.com: Would this proposal satisfy NetApp's needs? Keith Seitz (2): Add $_env convenience function Allow and evaluate expressions in command arguments gdb/data-directory/Makefile.in | 1 + gdb/python/lib/gdb/function/env.py | 21 ++++++++++ gdb/top.c | 65 ++++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+) create mode 100644 gdb/python/lib/gdb/function/env.py -- 2.38.1