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 E21753857815 for ; Mon, 10 May 2021 15:10:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E21753857815 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 14AFA0Vw028554 for ; Mon, 10 May 2021 15:10:58 GMT Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2130.oracle.com with ESMTP id 38dg5bbpvc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 10 May 2021 15:10:58 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 14AEpYhR106709 for ; Mon, 10 May 2021 15:10:57 GMT Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam08lp2047.outbound.protection.outlook.com [104.47.74.47]) by userp3030.oracle.com with ESMTP id 38dfrvkteq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 10 May 2021 15:10:57 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DQKtPG5Y5R73lFWixzeFNBuo0R8OlHNLRkIiboU+hi0qgyWFaANrfxuUk7w22Z+O91se3MsRViEHZ2/4XpeTDUrInojif3hxzIKMljOZvBUn7XWemX/QXcYqqdxv9llrXZC3kJB+Y49nJ2Nhto8PG9j83kV9y7JPgiQHkQuNdfld1t/3oYv+1f3onP5pgUCvc6Z+Z3owpxPvAx8MwJ60SFHyaq9jUl7EAHyGZ9SBdiTbg2sIGn7xD2+VBtANKVEUoEytkXjq/I4pq1QCQGa0sWH/yoMOJ8sFU7REqmU3RNQq1zDtfoLHBJ5dmqGpoJaGLYamPB0nmNXE+67cHW+16Q== 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=lIsablSpxzwbl1wH7fXhpnLIqFNSYhIksu31TRTezoc=; b=faZwTTpIcS/SHnd0FTEJW6vrbAHm1ssbbbJ5BOTS635SGHckLh9StcZ68vX/NGcI0+Pcdv8jEffwIuStz0vpXD6Mua+EgJSiM5AZ1TF+zASJ3RQ2bII5WQvtTfGuod4waQE0c1SCP6srmdRh0UGETez8HoOHufL5mC/rxlYfXbFcX0zMTZT79Mur+tRqC+MKjzkpNNZy3AUNQwhu+kGk9e1mRRnNzYBM9sAny2b2vXHOAQkWSN1Xbi9AiQ6MMNbb4KqxNLvyQ0tRUe5Pm+7wcp9zRFLXWRsseczwVSLjB42gBMnrsQ6EM5wH7wdg7Es5sGK9duIBmBay0dogW0O6Lg== 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 DM5PR10MB1436.namprd10.prod.outlook.com (2603:10b6:3:f::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.30; Mon, 10 May 2021 15:10:55 +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.4108.031; Mon, 10 May 2021 15:10:55 +0000 From: "Jose E. Marchesi" To: gdb-patches@sourceware.org Subject: [PATCH 0/1] Integrate GNU poke in GDB Date: Mon, 10 May 2021 17:10:43 +0200 Message-Id: <20210510151044.20829-1-jose.marchesi@oracle.com> X-Mailer: git-send-email 2.25.0.2.g232378479e Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [141.143.193.76] X-ClientProxiedBy: LNXP265CA0017.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:5e::29) To DM5PR10MB2041.namprd10.prod.outlook.com (2603:10b6:3:111::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from termi.localdomain (141.143.193.76) by LNXP265CA0017.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:5e::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25 via Frontend Transport; Mon, 10 May 2021 15:10:54 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f7e8c49d-f1fc-4d70-23c6-08d913c5cee1 X-MS-TrafficTypeDiagnostic: DM5PR10MB1436: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Cm9gfFewXUfJBJDg3u1fddHcEzquMoZs+/hRioj16c/OalZgE5mHQw2Efcchyyxbyc+gcbz0vZMEQF2UO1yJqE3pR8MgMHuycL9RuAvlGQinZW9lUrADD4BS4vRJaH3l3kU5AiFrEcUo3pQ2wJ/pcO1AMdTYtYHw/NveLOPNtn4ZenmKMjniikQH0OWGqNUxculdeUvK4y7MFw8qLo7Si2cmc7PI+kxYAWvRDiTeUCudHQU9WJb6aAReYc56D/pPBxTAVzylYpZsS19Ch04jUMHYeez9Xf7lAzZLTXEH9z8Xj4imiJ6Dgm88cWuFRuCGnAIYXZ3dUv39E1bnBd4VBKUne6FpuY1DP742CEzoZ5xjUomIi4bqYjCyTKFMCz74w5+OEXUVyTAvL7KMcmYQjc1mT0WSM93jQXwOqA6viQKgdY3bKWdn3HzlxwGwJ2CxJk1hby574Pr0tn6TEnr3aK2atF8fn8AICvfMqZAk9J1OO8B0w5KgDxqqZCWUzjESqrd+D37zPOdW7cZ+FDpp9tbs7USvjpGrvf3wMdj/eOnBWgkr5exVE3VoCYsjMVknPEujjRc41nLLQSBX8vnGaOgbmJwHc91K3sUk4TLOediNm3zYUR2Rr3v5fe7sNaTPbW5mfRowDptYlSrqR2oPOtXbx6m0ieXzlzu0soLU7widgM6hZXNYDItd8VHpKtjQ/sz4WWT63B5yjmeiSB2EA9bfq47rwM/GZCEfbmAlnsc= 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)(346002)(376002)(396003)(366004)(956004)(2616005)(6486002)(66476007)(16526019)(52116002)(186003)(1076003)(66946007)(316002)(36756003)(66556008)(2906002)(5660300002)(6506007)(8936002)(6666004)(26005)(8676002)(6512007)(478600001)(86362001)(38350700002)(38100700002)(83380400001)(6916009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?Hsp8fLFQIEq6MNXNZLT9x4xzzkuBSAZvq93k9w1Ria4xcQAtz2MFS6r/w1I+?= =?us-ascii?Q?Z0XHASlHb3oyLR5yvQzEqftW3vhefCN4+F0ZPJ4OscpA5jM4/benLTpZXdOr?= =?us-ascii?Q?jtdVDqwHE+O2nwgOf49ztHH+cfiK2Xy10g4477Pf8IAYRYcVfIEVttvOzDcS?= =?us-ascii?Q?lS9OpHRuO0oi/7ik+mo9V8iw2pz1PeI85MkF0/cA9HhMfaSBMZiUNZRhPiRx?= =?us-ascii?Q?Yxq35exJmgSN6MhOpS09Ks1tPtjlcOsYJ9efYHryWiKKhwsZCfkSkaP1Vrvh?= =?us-ascii?Q?Ue7OJeKtUdYx2Xv5uWri/TlS5KAH7Zc2asQQ+6rnmLlpxD6Pv/R6L3Z6Ujwz?= =?us-ascii?Q?e1HYFb+5/AafCx9rkhG59g+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Q?t34r7KsjWZ1rKqnwDG7q9LNBFGPddqMyRYbWTtYOi7CgeIGRk1D6JybAAoRL?= =?us-ascii?Q?8MDaHppQnqG3s1R773pp3bS+?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: f7e8c49d-f1fc-4d70-23c6-08d913c5cee1 X-MS-Exchange-CrossTenant-AuthSource: DM5PR10MB2041.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 May 2021 15:10:55.1491 (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: IXS64gRfWX4+TdDA4LCBv9lHrnu++QqHIM4jwNDnkDsY6eaksv4/kviFiKLBg0pPcWDPxrx72M1awK0Tspy82G+i6S2PWpwlsfS4LkL4A1w= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR10MB1436 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9980 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=514 phishscore=0 adultscore=0 bulkscore=0 mlxscore=0 suspectscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105100108 X-Proofpoint-GUID: eXrtvnbz6yf2rRHS8SfZbQAkPeyB9OKf X-Proofpoint-ORIG-GUID: eXrtvnbz6yf2rRHS8SfZbQAkPeyB9OKf X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=9980 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 malwarescore=0 bulkscore=0 spamscore=0 clxscore=1015 priorityscore=1501 adultscore=0 mlxlogscore=767 mlxscore=0 suspectscore=0 impostorscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2105100109 X-Spam-Status: No, score=-5.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: Mon, 10 May 2021 15:11:03 -0000 Hi GDB people! The patch below integrates GNU poke (http://jemarch.net/poke) in GDB by mean of libpoke. It allows the GDB user to execute Poke code from within the debugger with access to the target memory, types and values. A few notes: - The poke support is optional, and built if specified with --enable-poke at configure time. - The poke support requires libpoke from git master (which will become poke 2.x in a few months) since it uses some interfaces that are not available in the released poke 1.x series. - Sorry for what is probably an atrocious mixture of C and C++ idioms. I avoid C++ like the pest, but I am all willing to try and write proper C++ for this integration. - Eventually we will probably want to ship some prewritten Poke code in a pickle gdb.pk. Would $pkddatadir/poke/ be a good location for Poke code distributed with GDB? And a few questions: - Where am I supposed to cleanup and shut down the incremental compiler when GDB exits? I looked but I cannot find a counterpart to _initialize_FOO, like _finalize_FOO. - There are many global parameters that can be configured in the poke incremental compiler: the numeration base used when printing values, the global endianness, a cut-off value for how many array elements are printed, and the like. Reasonable defaults for them are set in `start_poke', but I would like the GDB user to be able to change these settings. I could add a `poke-set SETTING [VALUE]' command, but I was wondering whether there is a better way, like a global register of settings already in GDB? - I am using target_{read,write}_raw_memory to access the target's memory. What is the difference between the raw and non-raw accessors? - How can I demangle C++ identifiers? And how can I detect when a given type is a C++ one that needs demangling? How this stuff works: - GDB links with libpoke.so and uses the interface in libpoke.h. This is also how the GNU poke application (the command-line editor) is implemented. - There are three commands: poke STR poke-add-type EXPR poke-add-types REGEXP poke-dump-types All three commands make sure to start the poke incremental compiler if it isn't running already. - Access to the target's memory is provided by GDB by installing a Foreign IO device in the incremental compiler. This is `iod_if' in poke.c. - Access to the terminal is provided by GDB by providing a pk_term_if implementation to the incremental compiler. This is `poke_term_if' in poke.c. - Access to GDB values is provided by GDB by installing an alien token handler in the incremental compiler. This is `poke_alien_token_handler' in poke.c. Jose E. Marchesi (1): Integrate GNU poke in GDB gdb/ChangeLog | 8 + gdb/Makefile.in | 6 +- gdb/configure | 89 +++++- gdb/configure.ac | 15 + gdb/doc/ChangeLog | 6 + gdb/doc/Makefile.in | 1 + gdb/doc/gdb.texinfo | 4 + gdb/doc/poke.texi | 373 ++++++++++++++++++++++ gdb/poke.c | 762 ++++++++++++++++++++++++++++++++++++++++++++ 9 files changed, 1257 insertions(+), 7 deletions(-) create mode 100644 gdb/doc/poke.texi create mode 100644 gdb/poke.c -- 2.25.0.2.g232378479e