From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from aserp2130.oracle.com (aserp2130.oracle.com [141.146.126.79]) by sourceware.org (Postfix) with ESMTPS id 1023C383582C for ; Wed, 12 May 2021 08:06:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1023C383582C Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 14C83xcZ068418; Wed, 12 May 2021 08:06:31 GMT Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2130.oracle.com with ESMTP id 38dg5bha4s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 May 2021 08:06:31 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 14C864Lj063358; Wed, 12 May 2021 08:06:30 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2108.outbound.protection.outlook.com [104.47.70.108]) by userp3020.oracle.com with ESMTP id 38fh3y05rc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 May 2021 08:06:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LUve9oSfvKDzeZdLee2V/zCSlTpJfSP2SnlYWWd1viVuf618eOqHVCERwiZPCg1ttAb+wI6yDR/Xm+Qx/9wD+zXiXtJsUKM/O4FIypgdb1qeBuvfjma0/8o+bAD77JHwrmHcXq1wBF0wva6XqIXQXZHgJCNuIMkgvZIKGwkYoC3C1X90jlhNKKVMop/EDD4fYXtChrj4XXiuV/pW4OuwsU3FtPu1oNZAPXPIeS2fcAx6QsonwU0q9xMX2oQZpCQgbS+MUTaeQyNclDHDuhR94X/6dUDWu3E9euVSRpJ1pDRwDG+rJPYEdv8rI4/17B81UvY5rePlU7ldNVsD8NNgQg== 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-SenderADCheck; bh=UVpvVh6kq9LKRpSy918B8JkQqaDdiAiHgir+TlJf8PE=; b=E3/oY1+rLjANesgkUb4gjH/dVpOVRpDhCe5SohHSRTGTySxyJqQCzOuP63rDcB0fo6vpQxHA8pZpG6npyRi+3pYd9kR2AjaiuTVbQxVftxhbnuB8+aO9THQBrtIxXBW7X6WX09qsEAzQqgJqtjjcrSmJLcvOusiQeUzyz5T4o2GEyrNksVTtLdf776iBELPzM/tAcKzZpPd/p9PhqSDy0mehKKMPlFvWuTPW/zle+7SDoBj5tTC6AYVoYR2IR/9Vco+NrCiqWBAT9ffDq3gWDXiQCfzHyaKqdsp15yVWMXJd+kINr9QiOUBeBH+I0Yo48qeAJIoDrU5zHglgjGAmdA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none Received: from DM5PR10MB2041.namprd10.prod.outlook.com (2603:10b6:3:111::16) by DM6PR10MB3180.namprd10.prod.outlook.com (2603:10b6:5:1a6::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25; Wed, 12 May 2021 08:06:28 +0000 Received: from DM5PR10MB2041.namprd10.prod.outlook.com ([fe80::14a9:31e9:48af:5e4f]) by DM5PR10MB2041.namprd10.prod.outlook.com ([fe80::14a9:31e9:48af:5e4f%8]) with mapi id 15.20.4129.026; Wed, 12 May 2021 08:06:28 +0000 From: "Jose E. Marchesi" To: Tom Tromey Cc: "Jose E. Marchesi via Gdb-patches" Subject: Re: [PATCH 0/1] Integrate GNU poke in GDB References: <20210510151044.20829-1-jose.marchesi@oracle.com> <87k0o56qvz.fsf@tromey.com> Date: Wed, 12 May 2021 10:06:21 +0200 In-Reply-To: <87k0o56qvz.fsf@tromey.com> (Tom Tromey's message of "Tue, 11 May 2021 12:56:32 -0600") Message-ID: <87bl9gnzpe.fsf@oracle.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Content-Type: text/plain X-Originating-IP: [141.143.193.79] X-ClientProxiedBy: LO2P265CA0046.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:61::34) To DM5PR10MB2041.namprd10.prod.outlook.com (2603:10b6:3:111::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from termi.oracle.com (141.143.193.79) by LO2P265CA0046.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:61::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Wed, 12 May 2021 08:06:27 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d9703539-e21e-42eb-4c02-08d9151cd872 X-MS-TrafficTypeDiagnostic: DM6PR10MB3180: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: g7+moyAMTfxcNqeGm6Kn1boCV7NOyqmAY4EbVJml7IXZm0e+gSd3710l6K7JJpcNGC7acvmE4Ln+Kpr26gmP6dcc5wPzDr1CpxGH+9VAhEyiphLvBautRmd9lB6bg9EFZniq2o4fFhNctA4CVjFXxnkZ4zxdeWCBYGcv9XUHHMEaG0cX13g/c5F2ZReznPkBAXGaEL1SKn+IJYqcs6FaY9n7sDSuFCYdHpPpfJQgTHukiWIeIiX+/IZU0XhHo/cy3lCkkM4vmwWmcOkSbWXqtnsNGtCNBRpFCQcV0LDSjNUAhup5GM9tx3hMysP8P5q/zw0rcVnZec1T5ChEvIY5HSZZItniJBXxwtzDDV8Kx5L230qQ7f9oxVmJqpfrNIG96GYoEV/V7ykMb8HGZnNVQnCBgkJATgk1+ALsndEXVfb82y7nlQpztUatWIUTu3BDqITAVjkvMm5xtkRiWFweYuXeWQdasSGnb+0GBtA3XpM/rwQ0r/zeeLC83ipy/u9x+U2U1ByBSiZVTgmmY+yZ/BFS7XDaBXPJbbTJs3IiUUTW244K+ca9EvFfEFvREvM6H3QBnVB/n9RN9BkNAzEc+jQu74IXTlRnSiLnv8zfdzEAaDNo6GA8nyuEdLM3lTElnrYg2UQqPTCHfwM3nHT4aw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM5PR10MB2041.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(136003)(39860400002)(366004)(376002)(396003)(346002)(2616005)(2906002)(956004)(6486002)(86362001)(26005)(8936002)(83380400001)(16526019)(38100700002)(38350700002)(66556008)(8676002)(6666004)(5660300002)(66476007)(6916009)(36756003)(4326008)(478600001)(7696005)(52116002)(316002)(66946007)(186003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?HfLmpYKrNhii+z/Kbi0x+aOWoUmPXNGATP+ev6V/8P4xx78R2qjstSbzq4f5?= =?us-ascii?Q?6EyBEb5v9jW1WR6Kt276nO8GRxo6Loxveb5drwsbUasKtF+g6sS4w1r4Uo4L?= =?us-ascii?Q?aWGr8yG6n6/a2mb1A1M1JZsTp/sUs/MCKBAgCxxw/yIWl1DUb/bpAMKBcfmD?= =?us-ascii?Q?Cbe5wooBL+tE00DTbYw2vEIj8rTHN1faQS/q1JMlrwNmBPzrSXk19yI1QjSj?= =?us-ascii?Q?u31zXc30hD6NvzdJuozk6HzRSt4SK3HylgVEqAv6Lws7ir+1hWWxcKhVYPTo?= =?us-ascii?Q?0qUupd3+aUen6lGzcUiBbKLQXwqxOqqJOrGai2jrB2dwUZYbFTiGaRRYFnoh?= =?us-ascii?Q?0bp37ulc47MTR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= =?us-ascii?Q?J0K807Ptm18eWmsy5j4uqpUOgcWiuTDxp0R+CF2VpVLUAeyactHK0TI7PjdI?= =?us-ascii?Q?NUpa+I3E6XxXTlyr9WtjuImv?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d9703539-e21e-42eb-4c02-08d9151cd872 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB2041.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 May 2021 08:06:28.8120 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: OsPc2VdYuEjlND8aZ5lhnNDsM+e/lrCtSYiwXdzRZnuyD5s22b/G5w7MOr/NyB2L0YLeclUUs5DFtJ+Xze/Z5yBlUKaDCobqALU1ELVWyyY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB3180 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9981 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 phishscore=0 suspectscore=0 malwarescore=0 adultscore=0 bulkscore=0 mlxlogscore=999 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105120058 X-Proofpoint-GUID: WzWj6WiJr8ojuymidVxosEQ1enWLT1n6 X-Proofpoint-ORIG-GUID: WzWj6WiJr8ojuymidVxosEQ1enWLT1n6 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9981 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 malwarescore=0 bulkscore=0 spamscore=0 clxscore=1011 priorityscore=1501 adultscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 impostorscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105120058 X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, MSGID_FROM_MTA_HEADER, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 May 2021 08:06:40 -0000 > Jose> It allows the GDB user to execute Poke code from within the > Jose> debugger with access to the target memory, types and values. > > Jose> - Eventually we will probably want to ship some prewritten Poke > Jose> code in a pickle gdb.pk. Would $pkddatadir/poke/ be a good > Jose> location for Poke code distributed with GDB? > > Like what kind of thing are you thinking? Any Poke code that is specific to GDB in any way. For example, this code is part of the initialization and opens the IO space for the current target provided by GDB: open (""); In fact in an initial version I had put that in a gdb.pk file that was loaded in start_poke. But since I didn't need to add anything else there, I decided to just do it from C instead: if (pk_compile_statement (poke_compiler, "open (\"\");", NULL, &val) != PK_OK) error (_("Could not open ")); > Jose> - There are three commands: > > Jose> poke STR > Jose> poke-add-type EXPR > Jose> poke-add-types REGEXP > Jose> poke-dump-types > > Jose> All three commands make sure to start the poke incremental > Jose> compiler if it isn't running already. > > It's maybe more gdb-ish to make one command and use subcommands. What would be the gdb-ish way: a) poke STR poke add-type EXPR poke add-types REGEXP poke dump-types or b) poke STR poke add type EXPR poke add types REGEXP poke dump types Because a) will be problematic: `add-types' can be a valid Poke expression if both `add' and `types' are defined as variables. Doing b) would be ok I think. > I wonder if you considered implementing this by writing some Python to > glue Poke into gdb. This would have some advantages: > > * It wouldn't be a configure-time decision by whoever built gdb -- if > you have Poke, it could "just work". (Of course this assumes gdb is > built with Python, but that's the norm for distros.) > > * How Poke is glued in and how the commands work would be controlled by > ordinary Poke patches, rather than having to go through GDB. This > would let you evolve the GDB integration along with the library. That is a very clever idea that no, I had not considered. But I am not really looking forward to write Python bindings for libpoke (or Python for anything for that matter) and even if I could recruit someone to do that work, the stuff would need to be maintained ... poke depending on Python, supporting future Python versions and what not, argh no no no no :) Also somehow I would not feel comfortable getting into such troubles and going C++->Python->C->Poke for something that can be simply achieved as C++->Poke in about 700 lines of C++. So unless there is a strong feeling about this on the GDB side, I would much prefer to integrate via libpoke directly. PS: If GDB supported writing plugins in C or C++ like bash does, I wouldn't blink twice before adopting your suggestion!