From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id KA53DKx9WWgt1hoAWB0awg (envelope-from ) for ; Mon, 23 Jun 2025 12:15:40 -0400 Received: by simark.ca (Postfix, from userid 112) id 2E7A31E11C; Mon, 23 Jun 2025 12:15:40 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-9.0 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED, RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE autolearn=ham autolearn_force=no version=4.0.1 Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 68D931E0C2 for ; Mon, 23 Jun 2025 12:15:39 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D7E443846E7E for ; Mon, 23 Jun 2025 16:15:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D7E443846E7E Received: from us-smtp-delivery-114.mimecast.com (us-smtp-delivery-114.mimecast.com [170.10.133.114]) by sourceware.org (Postfix) with ESMTP id 0547B3846725 for ; Mon, 23 Jun 2025 16:11:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0547B3846725 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=labware.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=labware.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 0547B3846725 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.114 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1750695095; cv=none; b=vUqwrgGvWUsCqb0Fzv68yJy8sAep/v0O9e7NM6/MK2CqIbF6Xc3iW5prEERaBxbexwpP5k9mpz+uJTh3Ip0g47vqKOdVZzR5iX61yhVxNXE7nWwZwF6sdNs8raUjJ/WO9Am2n/JT4/H4j+7UbgCOgc6sB/NOcsxAIdlarNkB2gA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1750695095; c=relaxed/simple; bh=4Cczt0WpEw0MovdFnPrZALFCF7DukxNBIEcWlKXV/NM=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=q5fyHtYC7b/KkBNHAkVEGIsl4+LotZLpkwMoVCAa/nJBtLY+yD67umbqEcfn206fN/OM5LTQ+oc0Vx981jX7KND5ZJg5EeAe4JaUUaiHuL/soAicvmlWNUoPw9HYq6PE/JMHzipRu5KI4XDIxHZOHrI7/yMNgC4c729HaM3lKyI= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0547B3846725 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2105.outbound.protection.outlook.com [40.107.244.105]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-688-Oww2yII5OjCHMIkwJkdR-Q-1; Mon, 23 Jun 2025 12:11:33 -0400 X-MC-Unique: Oww2yII5OjCHMIkwJkdR-Q-1 X-Mimecast-MFC-AGG-ID: Oww2yII5OjCHMIkwJkdR-Q_1750695091 Received: from SA1PR17MB5365.namprd17.prod.outlook.com (2603:10b6:806:1d8::11) by CH3PR17MB6292.namprd17.prod.outlook.com (2603:10b6:610:14b::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8857.27; Mon, 23 Jun 2025 16:11:30 +0000 Received: from SA1PR17MB5365.namprd17.prod.outlook.com ([fe80::6398:7dc0:7d88:5a4d]) by SA1PR17MB5365.namprd17.prod.outlook.com ([fe80::6398:7dc0:7d88:5a4d%5]) with mapi id 15.20.8857.026; Mon, 23 Jun 2025 16:11:30 +0000 From: Jan Vrany To: gdb-patches@sourceware.org CC: Jan Vrany , Eli Zaretskii Subject: [RFC v5 15/18] gdb/python: add more attributes to gdb.LinetableEntry objects Date: Mon, 23 Jun 2025 17:10:10 +0100 Message-ID: <20250623161013.650814-16-jan.vrany@labware.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250623161013.650814-1-jan.vrany@labware.com> References: <20250623161013.650814-1-jan.vrany@labware.com> X-ClientProxiedBy: LO2P265CA0483.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:13a::8) To SA1PR17MB5365.namprd17.prod.outlook.com (2603:10b6:806:1d8::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA1PR17MB5365:EE_|CH3PR17MB6292:EE_ X-MS-Office365-Filtering-Correlation-Id: f6392a26-1b8c-4f3f-8c71-08ddb2709d34 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|366016|1800799024 X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?wYKf5UndmRC+aWIXCovaHuhMIECRaNwminle6zNXc4ypjtxcJxpJOEfLGzub?= =?us-ascii?Q?8M+qGzyv2y6Yal9x6DKBpq7I0uRgWNJAnGhOPHhGDRtITP6s2bvqk44v44uN?= =?us-ascii?Q?6uo9BPd4aC9vxj56YJlw+Vgi/+7pxNq79P8fADPjLthUvUsJkt++G7zmbslL?= =?us-ascii?Q?JEJhAAXMfYppoRjtbSn1d5crlTcbBBOeUfvavKok7no1B7N8DAby6uoAGUJK?= =?us-ascii?Q?5XNNb48xECeorvc5+e3u7wCw66RoDHe28LlgBq+ZTdO4XjLswZCWYTEaLGPm?= =?us-ascii?Q?L07JZ1OJ8TZkDCUe6dYgPPfqG/HMKsoXs2P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TqsQ5+yxNGMU10NJ6D65yNNrWaoOT7j1GCYn1ZqYmhz?= =?us-ascii?Q?S0l871otzAGufKWphCcvaBOzfrdBwZwtictSFwX1v5aLBd1Mn3LUP8hIX4rh?= =?us-ascii?Q?jX2rkwKG4WI+eb/nmN9gvq5k/6l+0MOyOiPdE1LgpJOZnevQaJgai7rqI/Uk?= =?us-ascii?Q?HdxF8CPcDqYBqFF4VlPmYS/nVKvIBUz0uq3OoRaUM/irDEYVQsL6f8S69gWN?= =?us-ascii?Q?S2ZjeNWAxE0=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SA1PR17MB5365.namprd17.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(366016)(1800799024); DIR:OUT; SFP:1102 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?4VGUoXJkm1OpuSG8K1rIFA7cv4b8AwKjbVDeEKNT6WYg3JyD4Xdjrc6yeUe1?= =?us-ascii?Q?9uhC2DqwklaDWd6HKAj3CbvwP6T3H/FEknd3EHN8IIrNtWBofGE3627edZpt?= =?us-ascii?Q?l7O3/pZR2BAPhFnjQHaHR1UMjLPc6rHTUSVXuuBfeRS4wufe28pvYUxvzYnS?= =?us-ascii?Q?Zkaj5KEnhL+96ay2uI+9VHTD23ys+FDp3QvVli6xf9JmTeF8jeGQVsvGyYOt?= =?us-ascii?Q?/xSYSnlNqvOq539jAMCLCTZDdV3aKnOTUxBh9E/9YASBfi/3nznPNPm/Zle0?= =?us-ascii?Q?hhwMZjT3/nFhS+vcCVRjwXqIw5i8W3RiIN1OV1ikPhYnbiU8J6QP3a2MI0ml?= =?us-ascii?Q?TPAK0adccWSpvoDSLgMfk+jlwGPZnayPEsl5ExzDcuo2vwNpFcd/uo+a/zEd?= =?us-ascii?Q?R4oS2d2qJoj3XYwXG4oNW2ZUU2wGy04fK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Bu0d9LTmDlark6Tc4/cOcIUNEuUPv+FCPsbLr0OfAW+du7CAHFlTq?= =?us-ascii?Q?aVmag/hDEyaloSpGQtk4RHn8Z5UtUz/6xpoxj0ALYMBM2hdKrDsWFSQf/2Hn?= =?us-ascii?Q?DkU7Zn15+chPHIafTVBxEOA6obauUlXUbvP2Pzv/RaSBIwJ9ziWfGXzOktmc?= =?us-ascii?Q?B7cBfOxIPYFuFAe9xHVUCywKYNho+ytw9J5PSX54/IircWeQP123Es3OEKAn?= =?us-ascii?Q?1YuHJC1R7n10+S5INMg+gExqYXQQqCWwzsjW+7Yn?= X-OriginatorOrg: labware.com X-MS-Exchange-CrossTenant-Network-Message-Id: f6392a26-1b8c-4f3f-8c71-08ddb2709d34 X-MS-Exchange-CrossTenant-AuthSource: SA1PR17MB5365.namprd17.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jun 2025 16:11:30.0842 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b5db0322-1aa0-4c0a-859c-ad0f96966f4c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: t4dOJyrzqott0pqNjMvUubMilhDwTjkJT6YHk7uiLwbg6p/fHds1R+efG5XtNeyO0Qzg6paohZglURTUruNH0Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR17MB6292 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: qsIuCFIHlEWDWfbSwBxd7mh7fhr5JwLOKGqqiqAsuxE_1750695091 X-Mimecast-Originator: labware.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=WINDOWS-1252 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org This commit adds is_stmt, prologue_end and epilogue_begin attributes to linetable entry objects. This prompted change in gdb.Linetable.line() (ltpy_get_pcs_for_line). In order to fill initialize new attributes we need complete entries matching the line, not only PCs. Reviewed-By: Eli Zaretskii --- gdb/doc/python.texi | 17 ++++ gdb/python/py-linetable.c | 101 +++++++++++++++++++--- gdb/testsuite/gdb.python/py-linetable.exp | 10 +++ 3 files changed, 116 insertions(+), 12 deletions(-) diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi index 15f851e5fd0..7c3a87cdaad 100644 --- a/gdb/doc/python.texi +++ b/gdb/doc/python.texi @@ -6822,6 +6822,23 @@ executable code for that source line resides in memo= ry. This attribute is not writable. @end defvar =20 +@defvar LineTableEntry.is_stmt +True if pc (associated with this entry) is a good location to place +a breakpoint for line (associated with this entry). This attribute is not +writable. +@end defvar + +@defvar LineTableEntry.prologue_end +True if pc (associated with this entry) is a good location to place +a breakpoint after a function prologue. This attribute is not +writable. +@end defvar + +@defvar LineTableEntry.epilogue_begin +True if pc (associated with this entry) marks the start of the epilogue. +This attribute is not writable. +@end defvar + As there can be multiple addresses for a single source line, you may receive multiple @code{LineTableEntry} objects with matching @code{line} attributes, but with different @code{pc} attributes. The diff --git a/gdb/python/py-linetable.c b/gdb/python/py-linetable.c index 90cba09c88e..5eb40bf3c5b 100644 --- a/gdb/python/py-linetable.c +++ b/gdb/python/py-linetable.c @@ -25,6 +25,12 @@ struct linetable_entry_object { int line; /* The pc associated with the source line. */ CORE_ADDR pc; + /* See is_stmt in stuct linetable_entry. */ + bool is_stmt : 1; + /* See prologue_end in stuct linetable_entry. */ + bool prologue_end : 1; + /* See epilogue_begin in struct linetable_entry. */ + bool epilogue_begin : 1; }; =20 extern PyTypeObject linetable_entry_object_type @@ -98,7 +104,8 @@ symtab_to_linetable_object (PyObject *symtab) and an address. */ =20 static PyObject * -build_linetable_entry (int line, CORE_ADDR address) +build_linetable_entry (int line, CORE_ADDR address, bool is_stmt, +=09=09 bool prologue_end, bool epilogue_begin) { linetable_entry_object *obj; =20 @@ -108,6 +115,9 @@ build_linetable_entry (int line, CORE_ADDR address) { obj->line =3D line; obj->pc =3D address; + obj->is_stmt =3D is_stmt; + obj->prologue_end =3D prologue_end; + obj->epilogue_begin =3D epilogue_begin; } =20 return (PyObject *) obj; @@ -120,22 +130,26 @@ build_linetable_entry (int line, CORE_ADDR address) address. */ =20 static PyObject * -build_line_table_tuple_from_pcs (int line, const std::vector &p= cs) +build_line_table_tuple_from_entries ( +=09const struct objfile *objfile, +=09const std::vector &entries) { int i; =20 - if (pcs.size () < 1) + if (entries.size () < 1) Py_RETURN_NONE; =20 - gdbpy_ref<> tuple (PyTuple_New (pcs.size ())); + gdbpy_ref<> tuple (PyTuple_New (entries.size ())); =20 if (tuple =3D=3D NULL) return NULL; =20 - for (i =3D 0; i < pcs.size (); ++i) + for (i =3D 0; i < entries.size (); ++i) { - CORE_ADDR pc =3D pcs[i]; - gdbpy_ref<> obj (build_linetable_entry (line, pc)); + auto entry =3D entries[i]; + gdbpy_ref<> obj (build_linetable_entry ( +=09=09=09entry->line, entry->pc (objfile), entry->is_stmt, +=09=09=09entry->prologue_end, entry->epilogue_begin)); =20 if (obj =3D=3D NULL) =09return NULL; @@ -155,24 +169,35 @@ ltpy_get_pcs_for_line (PyObject *self, PyObject *args= ) { struct symtab *symtab; gdb_py_longest py_line; - const linetable_entry *best_entry =3D nullptr; - std::vector pcs; + std::vector entries; =20 LTPY_REQUIRE_VALID (self, symtab); =20 if (! PyArg_ParseTuple (args, GDB_PY_LL_ARG, &py_line)) return NULL; =20 + if (! symtab->linetable ()) + Py_RETURN_NONE; + try { - pcs =3D find_pcs_for_symtab_line (symtab, py_line, &best_entry); + const linetable_entry *entry; + int i; + for (entry =3D symtab->linetable ()->item, i =3D 0; +=09 i < symtab->linetable ()->nitems; +=09 entry++, i++) +=09{ +=09 if (entry->line =3D=3D py_line) +=09 entries.push_back (entry); +=09} } catch (const gdb_exception &except) { return gdbpy_handle_gdb_exception (nullptr, except); } =20 - return build_line_table_tuple_from_pcs (py_line, pcs); + struct objfile *objfile =3D symtab->compunit ()->objfile (); + return build_line_table_tuple_from_entries (objfile, entries); } =20 /* Implementation of gdb.LineTable.has_line (self, line) -> Boolean. @@ -321,6 +346,50 @@ ltpy_entry_get_pc (PyObject *self, void *closure) return gdb_py_object_from_ulongest (obj->pc).release (); } =20 +/* Implementation of gdb.LineTableEntry.is_stmt (self) -> bool. Returns + True if associated PC is a good location to place a breakpoint for + associatated LINE. */ + +static PyObject * +ltpy_entry_get_is_stmt (PyObject *self, void *closure) +{ + linetable_entry_object *obj =3D (linetable_entry_object *) self; + + if (obj->is_stmt !=3D 0) + Py_RETURN_TRUE; + else + Py_RETURN_FALSE; +} + +/* Implementation of gdb.LineTableEntry.prologue_end (self) -> bool. Retu= rns + True if associated PC is a good location to place a breakpoint after a + function prologue. */ + +static PyObject * +ltpy_entry_get_prologue_end (PyObject *self, void *closure) +{ + linetable_entry_object *obj =3D (linetable_entry_object *) self; + + if (obj->prologue_end) + Py_RETURN_TRUE; + else + Py_RETURN_FALSE; +} + +/* Implementation of gdb.LineTableEntry.prologue_end (self) -> bool. Retu= rns + True if this location marks the start of the epilogue. */ + +static PyObject * +ltpy_entry_get_epilogue_begin (PyObject *self, void *closure) +{ + linetable_entry_object *obj =3D (linetable_entry_object *) self; + + if (obj->epilogue_begin) + Py_RETURN_TRUE; + else + Py_RETURN_FALSE; +} + /* LineTable iterator functions. */ =20 /* Return a new line table iterator. */ @@ -406,7 +475,8 @@ ltpy_iternext (PyObject *self) } =20 struct objfile *objfile =3D symtab->compunit ()->objfile (); - obj =3D build_linetable_entry (item->line, item->pc (objfile)); + obj =3D build_linetable_entry (item->line, item->pc (objfile), item->is_= stmt, +=09=09=09 item->prologue_end, item->epilogue_begin ); iter_obj->current_index++; =20 return obj; @@ -534,9 +604,16 @@ static gdb_PyGetSetDef linetable_entry_object_getset[]= =3D { "The line number in the source file.", NULL }, { "pc", ltpy_entry_get_pc, NULL, "The memory address for this line number.", NULL }, + { "is_stmt", ltpy_entry_get_is_stmt, NULL, + "Whether this is a good location to place a breakpoint for associated = LINE.", NULL }, + { "prologue_end", ltpy_entry_get_prologue_end, NULL, + "Whether this is a good location to place a breakpoint after method pr= ologue.", NULL }, + { "epilogue_begin", ltpy_entry_get_epilogue_begin, NULL, + "True if this location marks the start of the epilogue.", NULL }, { NULL } /* Sentinel */ }; =20 + PyTypeObject linetable_entry_object_type =3D { PyVarObject_HEAD_INIT (NULL, 0) "gdb.LineTableEntry",=09 /*tp_name*/ diff --git a/gdb/testsuite/gdb.python/py-linetable.exp b/gdb/testsuite/gdb.= python/py-linetable.exp index d27d16edc5d..40afd8c400e 100644 --- a/gdb/testsuite/gdb.python/py-linetable.exp +++ b/gdb/testsuite/gdb.python/py-linetable.exp @@ -53,6 +53,16 @@ gdb_test "python print(len(lt.line(20)))" "1" \ "Test length of a single pc line" gdb_test "python print(lt.line(1))" "None" \ "Test None returned for line with no pc" +gdb_test "python print(next(iter(lt)).is_stmt)" \ +=09 "(True|False)" \ +=09 "Test is_stmt" +gdb_test "python print(next(iter(lt)).prologue_end)" \ +=09 "(True|False)" \ +=09 "Test prologue_end" +gdb_test "python print(next(iter(lt)).epilogue_begin)" \ +=09 "(True|False)" \ +=09 "Test epilogue_begin" + =20 # Test gdb.Linetable.sourcelines () gdb_py_test_silent_cmd "python fset =3D lt.source_lines()" \ --=20 2.47.2