From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id OfF7K+JyKWqPwT8AWB0awg (envelope-from ) for ; Wed, 10 Jun 2026 10:21:22 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=efficios.com header.i=@efficios.com header.a=rsa-sha256 header.s=selector1 header.b=TvDD54cv; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 9CFEC1E0A3; Wed, 10 Jun 2026 10:21:22 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (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 30F811E070 for ; Wed, 10 Jun 2026 10:21:21 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2B690484B1CA for ; Wed, 10 Jun 2026 14:21:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2B690484B1CA Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=efficios.com header.i=@efficios.com header.a=rsa-sha256 header.s=selector1 header.b=TvDD54cv Received: from YQZPR01CU011.outbound.protection.outlook.com (mail-canadaeastazlp170100000.outbound.protection.outlook.com [IPv6:2a01:111:f403:c104::]) by sourceware.org (Postfix) with ESMTPS id 031274906D48 for ; Wed, 10 Jun 2026 14:20:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 031274906D48 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=efficios.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=efficios.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 031274906D48 Authentication-Results: sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:c104:: ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1781101236; cv=pass; b=VbhXVjINti2elblXAC9Pj7m3FiskoVeLh2gsaOD+4+uSGdZ9fZYfHOe0zOZGPh9jjzj57+McdFvmfGcwGoVxwXaY+qenRNlgipAvk2CjC0EB2rlsB9btSdNijgCdjwisseex0xXAaiJEvy+HfvI9nZ22/9DVIDBX4GlVumFDJVY= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1781101236; c=relaxed/simple; bh=xqR4sjRqdFCeLkIihZCQFGuBMUGLmkX4c2KRhD5qYTU=; h=DKIM-Signature:Message-ID:Date:Subject:To:From:MIME-Version; b=If626yhcdDibzj1XdzWwOChICpw+jTp7tB9XJWVDheVjjSoyEY9KgzZAsW818NvhYW7/Nd5E8P7Z6f8i+jk3jIgpnYBExOiZ4h3U9htxrPttSYVfKWJSVTpN3HHkCz+ppIy9jTYLUuTJb7DUk1VRTnVzfU3QBKAm/2YZDfp1I44= ARC-Authentication-Results: i=2; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=efficios.com header.i=@efficios.com header.a=rsa-sha256 header.s=selector1 header.b=TvDD54cv DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 031274906D48 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=atEqt4V8Dks3+xceBB/f2HZc3PBXTm3CAorrS8lis6jd6hE3poe+85T4wWwpY8Tc1/I6NNrB0khV13g2uFnxmRRIupvUy+4ENXW2y1qOhh+KJRQQ23CXe1HilD4ICu3M6AyOOMiJQAs+p05+sQyA7p6xf4woFO4GIdJwQ+JAU9JJ4zhl6SZMz+6LA8Zd5e00E+2ocSiDqtl/7vD5EmSRJCmyA5C0NPLBMHHNjdXPovE/7JYWEOFkpWpjZ+8UgVRBXGg3vTWECXfzFJPT3AgKLu91srVRhFC3Zs7mimwDIIj2VDWkaRdT30xtejiE74LHEejLvsuXpOEfcJ5zsBLnsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=a6kZItePfXn5XsOq+HHBa/BsPO2jviPbEaFWDE3kLpA=; b=cgc4Vy43qCtfXIf4SqCiDYnv6m45KbzwoWuDlWXjlO1CoXaCSrNNnDa2nohJOOgozPukkXQoMLaUiUBDJw4fymZlkY4ag3Zdd1m10m0DlCFC/Ysl88rdQqgNuRfuN78QD2XDm+H/5/QQFo8sJzQHEZrJQaD9a90hrs2QWf5Rc1noHqmyDAh6nxeuenKHOu6uMX8ZZ6nzYDT25tuoDj5Q7lethlolRIkZC9z5dTPgFg0QCo2wX8xeghd6k0Ce7V1gSzSwPsGKM9vIVsP4sLclqtc+8Pkiy4F0HHTYF1BVuYpL0MvGVCHTZkO4cy25E58pe3umr00eZB9WoLg9cFVwFw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=efficios.com; dmarc=pass action=none header.from=efficios.com; dkim=pass header.d=efficios.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=a6kZItePfXn5XsOq+HHBa/BsPO2jviPbEaFWDE3kLpA=; b=TvDD54cvw/520ZQJgvftpT0zbQiTbbe50b6Rrkymr6pswoTHVCOIUUCGHd6R04RhWBZqNzCGQMk67LDBBPc6GJEJbgcPurqK516DbnRCxgTc4sZ1x5Hckk4nmj9BWiwuPc/YXMs2ZnMuhtFO9fDNIfYgm8vWyX61bF5TUNLvndEGjx9/q+1zgWFanTAXmqcG4Yz3fiMOn7aZFaz2urujn7lYjD2538VCm7wfoL1o7Pi4wrEFjKq3Nux4rdd8PI7U0f0Ga/w2x+vkLB+xHcrwgz0rcHdVWRy2o3j0FDkP8G8UrYvTfD5f9JpUl+YghYSg7c5gsS2s9ioammd3Gjni6w== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=efficios.com; Received: from YQBPR0101MB9104.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c01:5f::18) by YQBPR0101MB6086.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c01:35::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.113.11; Wed, 10 Jun 2026 14:20:33 +0000 Received: from YQBPR0101MB9104.CANPRD01.PROD.OUTLOOK.COM ([fe80::8c3:42b8:f43:3b9f]) by YQBPR0101MB9104.CANPRD01.PROD.OUTLOOK.COM ([fe80::8c3:42b8:f43:3b9f%7]) with mapi id 15.21.0113.011; Wed, 10 Jun 2026 14:20:32 +0000 Message-ID: <4e494351-57c8-4b17-af8f-79c85db3b49f@efficios.com> Date: Wed, 10 Jun 2026 10:20:32 -0400 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] gdb/breakpoint: remove assertion when printing internal breakpoints without locspecs To: Andrew Burgess , gdb-patches@sourceware.org References: <20260526145701.41678-1-sdarche@efficios.com> <87tsrqxlqz.fsf@redhat.com> Content-Language: en-US From: =?UTF-8?Q?S=C3=A9bastien_Darche?= In-Reply-To: <87tsrqxlqz.fsf@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: YT4PR01CA0109.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:d7::29) To YQBPR0101MB9104.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c01:5f::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: YQBPR0101MB9104:EE_|YQBPR0101MB6086:EE_ X-MS-Office365-Filtering-Correlation-Id: 9a611d36-0412-4fa6-0c25-08dec6fb6e92 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|23010399003|366016|376014|18002099003|22082099003|3023799007|5023799004|4143699003|56012099006|8126099003|13003099007; X-Microsoft-Antispam-Message-Info: P0HyArVfL3LNIEFFgKsBnDobI5dgmn5ZxvdGN/94PUjVAEdtmOfmIrDzfEGZvxSd+Rt4uHWYxP2MNqJYyU8JOoewHnbtePG6On2iFN8ZGvz/UdkRMvk19cqtjEEvZSXBcU3MCJ8bI7rHNvBACfVC+KbtURuouyC3zJDrdW6DdLpk33h+Zz8vZ5G4nLsWNNR17y++UHbZiNcFiRK4FfBLftSEHSyUOb/BEzGtca17SvUCFkr45Ap3D6bchRyvrmU/VT+TdxO6xSSDUE1mWDHujCrN2h8hZ8Je29P6vUobKvkxSg0NVXZ3O7PYgNCkTWePvPyhEreyp9Va2vKpVHaXxNiOFLRPfQ++ddz/c5mIfu98rqysO1WadpuXHzRv+8BFnaM7quHitBe3wF4R5XXaF/xEzYDeKymJaGDrOFd0tqmuJ6GU3aaiz6qOOIF+yI5iCDbjjiJYJCBjPENNBbNJUC18GyxomVcw81f8rMetDUwBdRhJMTDe28kTPnP0swlbgc0axsOOlsjm90w9d7YMg59LJSgJIlKiefMDjCGuMRFLXLhxm5H39eHvLUptB1sU4GuDCTmY3RhFR10vwRht0OuEKI0xP50e8yrzDCH+2JajMfa73oJUaz8k9W4mCLkdm428h40uhoLDEaBI1TIqBDr7kKFz4zy40Xh24F5sojI1unbttis5LEUV0igEUezFkFLCjh/Of99ZBde/DGEGlA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:YQBPR0101MB9104.CANPRD01.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(23010399003)(366016)(376014)(18002099003)(22082099003)(3023799007)(5023799004)(4143699003)(56012099006)(8126099003)(13003099007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?YWEwUEVVd0hCTWQxYW94ZlFsY0tHUWNBZDloUlFEaDNiRlpGb0N5R2tMZmJy?= =?utf-8?B?bmxvV25GeUpHQmpydUVkUHkwMEtkZm92MTlhUXZQMzB2SmlEaDdXaTh4OEdU?= =?utf-8?B?UExGMldwOWNqSWdvSnZyTTFXZGZQdE5Ic0FWY3hVVDBHa1dKOFJRTGk2OU9o?= =?utf-8?B?blR3TnRzemZSYW9FZUgzNm1GNVRQeG9oTnViMUlTTjg1TlVHd0VQMG5qZjZM?= =?utf-8?B?bmxhZnhvZFArRjQyUUhQS2pXZlVrdXhReWV4ZVR3dGg2VE9rdlpRNk5uakJn?= =?utf-8?B?Z0VtNmY3OHIrMzZHcjk2blY0WmVEMzVpbUdJMXBCekpIUzZZS25uR2N6V2Np?= =?utf-8?B?c0pRWlY1cmxmekFLSUVPRUVacVRZdjNtQlZIWnkrdVlITys2U2hpTUJtUVpO?= =?utf-8?B?bUFtTXRHUFFac2Vpa2hPd2FyNlgxZ0VhNUV2QXZ3TVZUU2hZM3hSY09Wejdo?= =?utf-8?B?NnVrV3BFOUt4eE1RZjA2K0k0a2VwVVN3VHl2K2JmYzZOejgwTklpcithWWZu?= =?utf-8?B?NUwzbTBXUmpBTjROdGtkVVlURGRuektSOWdnd0tMTlRXOW1jbDN0VVNYenpX?= =?utf-8?B?VDNLTWhoTzJ1UlVCVys0TXhBTlpWS3dSQm41VnhyTFJ0R1JXUGhHeno2UU5L?= =?utf-8?B?aEU5aDNTNGl2enNlQmhwbnB0MXp2bXg5T092TlVTRm93YW1iUWF0YWdUTVpG?= =?utf-8?B?ZzBKNE9SZTRiUjB4NkNLQW4rbm82em16SmNDTngxS0ZoNEUrelZncXo0SHFo?= =?utf-8?B?bkptbDZKYjNpRk5zVUpESDhMWC9hbFZjbDFFM0pBamJKeVpzZ0JZYmt5MldL?= =?utf-8?B?d0d2MWlMeDgycTg4aHE0eFdRNllKdTZWNERWUm5OU0JYN0YyZDFReXBBdUoy?= =?utf-8?B?T3oxMmJXNkg5S2N3ek4xQmhDNUpaU0ZZR3VyMUd4eUROZ0pHVXFVdGRxU2FK?= =?utf-8?B?MExXT1IydisxSjh0Y05yejVBMisxRmZ6aWFiZnpzeU1YTjhJay9TVUhtT1Br?= =?utf-8?B?allkb00vYmZGNjRRNHJhU050R29sR0R0UkorNEM5OUFnejVzWTZlNzVYbkUv?= =?utf-8?B?T0t1Yks3bVM2anZxekZnZlBRNmRNWk0rN1F0cEhDblo4VW4vaUt1eEdvdUZX?= =?utf-8?B?cW1ncUo3bDhjTzVjMTBTdS8vQ2pZclpsVE1DNGdPc3hzNHVhaXF6bnZYUWVZ?= =?utf-8?B?VzFaRVArOFBvSFhEUzlBUzh6clN5MmJpeEZIb2NHY0thRG5VQ3FVb0hIZkwr?= =?utf-8?B?SnJhaXR5MWNqMFkzT2VRMGhPTTBtWUxZdkJYd1BCQ21kSlNkaWhkQ2VVWi81?= =?utf-8?B?UkMvWFJxYmZReklKUVNMYWpjK2dHQWFpMkZITnY1T0g5cWRXL0NVallZRHJF?= =?utf-8?B?WHF3UXluakpXM2NUQkxMczFubmRuL0FLRVVFeU5VSVJHWUIwTmZGZld4RGJF?= =?utf-8?B?clBzR0lJMytGWUY2cG15cjJreEZuSWlHSVZoRkpiTHQrUlF3amtoODUrcTNv?= =?utf-8?B?UzJTdHhwOG1obmJLYWZ3N1Rwd0VwUlE2elR5WVdMRnJaaUFaOUtMeit2S3lX?= =?utf-8?B?Y2ZJa2VZNm1JTUdIVFV5eXhoZ0lSU25hSkJ4dGd6NmZOV2poSnFqb2pYQWJN?= =?utf-8?B?UWhuaDZyWmxPd1cxYWp3VkFja09SSWhFNDBscjFNaUhxSnFZU0gxaE1QTXRB?= =?utf-8?B?K0YwMzlrV1RqdXVCMlFDZ2NpN1g4ODZyTUtxSHg2NStrbllvMy9pK2VZR1l5?= =?utf-8?B?T296czNnLzdOWVlTd0lKTWVSS3ZlZkdPRjBCTDRDSHBLeEVOQ3ZhMFJXekhY?= =?utf-8?B?VkJoZ2N4NStLMjdJbUZJWGZNM3BZUTNnalRwOEplRjlKemU4VGd0Uy9YNmpY?= =?utf-8?B?SVQ5MHVQVkQ3N3grRm5KQmhaY20rUitJb1VETnhVOU5wcktWczVqTmNvOGt4?= =?utf-8?B?dys3TUd6dyt1anhzWnZnaGdoZVgyaXRoYXFObHhnU1BZMSttZjNFY3JiMTRx?= =?utf-8?B?ajlLeEZiRnVzcnAvS05tY3RoeWVKdWMxTmlWQXhNb2RjRDhCaGI5czB6VFNT?= =?utf-8?B?OUZSSmwvS1RYcnZaNURIbTA5TWRUaFczYkpLMFluOFVCY0tTOTQwR0hkTUYv?= =?utf-8?B?NEl2VkhuM0J3WXMxZEJ2NGRubjNQZjczbEdvSy9ma3p3blRoT3h4aEtoR1Fa?= =?utf-8?B?V1hyQmpHSWoyOVA5U20vdU41YTNmeDZ4SlZudVNYVFVLRUpQZU83K3N5K2wy?= =?utf-8?B?RlZBYVhuVnhRZVdvZzVvWnJBazZCUnBTeWpCNFFhUlIzbXZEbkNTdVdoMGhQ?= =?utf-8?B?SVQ0MWo1K3M3cVcvQmV3aEZ0OFpyaDhJc0ZObUVtem5NZFhwMmg0Zz09?= X-OriginatorOrg: efficios.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9a611d36-0412-4fa6-0c25-08dec6fb6e92 X-MS-Exchange-CrossTenant-AuthSource: YQBPR0101MB9104.CANPRD01.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jun 2026 14:20:32.8380 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4f278736-4ab6-415c-957e-1f55336bd31e X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: TrckvUb5h/qKgbfQt63+xLCpx9GPFj953hsRfOoPS8oDTP9lQ3+8OsB4j1/J4pnD8l3tm1ybqIFlpG1RWtb2aQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: YQBPR0101MB6086 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 Hi Andrew. Thanks for the review. I just sent an updated patch to the mailing list with your comments. The test passes with some remote target boards. I however noticed that some of them do not compile due to the missing header "jit-protocol.h" that is common to all the jit tests, as it does not get uploaded. All the jit tests that rely on this header show as unsupported instead of failed. Maybe this is something we might want to look into in the future. Best, Sébastien On 2026-05-29 11:45, Andrew Burgess wrote: > > Hi Sébastien, > > Thanks for looking at this. I think this looks good, I have a couple of > minor nits to feedback, see inline below. > > Sébastien Darche writes: > >> When debugging gdb with `set debug breakpoint on`, gdb would crash if >> the inferior happened to unload (through dlclose ()) a shared library >> that contains jit debugging symbols: >> >> ../../gdb/breakpoint.c:6473: internal-error: print_breakpoint_location: >> Assertion `b->locspec != nullptr || (!user_breakpoint_p (b) && (b->type >> == bp_shlib_event || b->type == bp_thread_event))' failed. >> A problem internal to GDB has been detected [...] >> >> This assertion was added in commit 5770f68 ("gdb: handle empty locspec >> when printing breakpoints"). The assumption for this assert is that the >> user may not call any (gdb-)debugging command between the time a shared >> library is marked (bp_location->shlib_disabled is set) and the >> breakpoint is actually removed. This would be true if the user called >> `maint info breakpoints` as explained in the original commit message. >> >> However, if `set debug breakpoint on` is called, gdb prints debugging >> info as the shared library is being unloaded. The ~jiter_objfile_data >> dtor deletes the breakpoint, which calls remove_breakpoint_1 on the >> bp_location in the recently unloaded shared object. Since `debug >> breakpoint` is enabled, we go through print_breakpoint_location with the >> bp_location's shlib_disabled flag set.. which results in the assert >> above. > > I think the ".. " should be replace with ", ". > >> >> This commit removes the assertion as it is not true in all cases. I've >> also included a minimal test case that loads a shared library with a >> __jit_debug_register_code symbol. The test fails with the assert. > > >> >> Change-Id: Ia19c84f194a6f0c10315548c7f423bfd86ef0266 >> --- >> gdb/breakpoint.c | 17 --------- >> gdb/testsuite/gdb.base/jit-unload-solib.c | 21 +++++++++++ >> gdb/testsuite/gdb.base/jit-unload.c | 45 +++++++++++++++++++++++ >> gdb/testsuite/gdb.base/jit-unload.exp | 44 ++++++++++++++++++++++ >> 4 files changed, 110 insertions(+), 17 deletions(-) >> create mode 100644 gdb/testsuite/gdb.base/jit-unload-solib.c >> create mode 100644 gdb/testsuite/gdb.base/jit-unload.c >> create mode 100644 gdb/testsuite/gdb.base/jit-unload.exp >> >> diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c >> index 101dc57ee6b..85c4ffc3171 100644 >> --- a/gdb/breakpoint.c >> +++ b/gdb/breakpoint.c >> @@ -6457,23 +6457,6 @@ print_breakpoint_location (const breakpoint *b, const bp_location *loc) >> } >> else >> { >> - /* Internal breakpoints don't have a locspec string, but can become >> - pending if the shared library the breakpoint is in is unloaded. >> - For most internal breakpoint types though, after unloading the >> - shared library, the breakpoint will be deleted and never recreated >> - (see internal_breakpoint::re_set). But for two internal >> - breakpoint types bp_shlib_event and bp_thread_event this is not >> - true. Usually we don't expect the libraries that contain these >> - breakpoints to ever be unloaded, but a buggy inferior might do >> - such a thing, in which case GDB should be prepared to handle this >> - case. >> - >> - If these two breakpoint types become pending then there will be no >> - locspec string. */ >> - gdb_assert (b->locspec != nullptr >> - || (!user_breakpoint_p (b) >> - && (b->type == bp_shlib_event >> - || b->type == bp_thread_event))); >> const char *locspec_str >> = (b->locspec != nullptr ? b->locspec->to_string () : ""); >> uiout->field_string ("pending", locspec_str); >> diff --git a/gdb/testsuite/gdb.base/jit-unload-solib.c b/gdb/testsuite/gdb.base/jit-unload-solib.c >> new file mode 100644 >> index 00000000000..3cf2c580320 >> --- /dev/null >> +++ b/gdb/testsuite/gdb.base/jit-unload-solib.c >> @@ -0,0 +1,21 @@ >> +/* This test program is part of GDB, the GNU debugger. >> + >> + Copyright 2026 Free Software Foundation, Inc. >> + >> + This program is free software; you can redistribute it and/or modify >> + it under the terms of the GNU General Public License as published by >> + the Free Software Foundation; either version 3 of the License, or >> + (at your option) any later version. >> + >> + This program is distributed in the hope that it will be useful, >> + but WITHOUT ANY WARRANTY; without even the implied warranty of >> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >> + GNU General Public License for more details. >> + >> + You should have received a copy of the GNU General Public License >> + along with this program. If not, see . */ >> + >> +/* This simulates a JIT library. */ >> + >> + >> +#include "jit-protocol.h" >> diff --git a/gdb/testsuite/gdb.base/jit-unload.c b/gdb/testsuite/gdb.base/jit-unload.c >> new file mode 100644 >> index 00000000000..def66b53861 >> --- /dev/null >> +++ b/gdb/testsuite/gdb.base/jit-unload.c >> @@ -0,0 +1,45 @@ >> +/* This test program is part of GDB, the GNU debugger. >> + >> + Copyright 2026 Free Software Foundation, Inc. >> + >> + This program is free software; you can redistribute it and/or modify >> + it under the terms of the GNU General Public License as published by >> + the Free Software Foundation; either version 3 of the License, or >> + (at your option) any later version. >> + >> + This program is distributed in the hope that it will be useful, >> + but WITHOUT ANY WARRANTY; without even the implied warranty of >> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >> + GNU General Public License for more details. >> + >> + You should have received a copy of the GNU General Public License >> + along with this program. If not, see . */ >> + >> +/* Simulate loading of a library JIT code. */ >> + >> +#include >> +#include >> + >> +#ifdef __WIN32__ >> +#include >> +#define dlopen(name, mode) LoadLibrary (TEXT (name)) >> +#define dlclose(handle) FreeLibrary (handle) >> +#else >> +#include >> +#endif >> + >> + >> +int >> +main() > > Missing space after 'main'. Also, for C code I think 'main (void)' is > what we should be writing, though we do have a lot of 'main ()' already. > >> +{ >> + void *handle = dlopen (SHLIB_NAME, RTLD_NOW); >> + >> + if (handle == nullptr) > > The 'nullptr' is a C23 feature. To allow this test to compile with > older compilers it would be better to use 'NULL'. > >> + { >> + fprintf (stderr, "%s\n", dlerror ()); >> + exit (1); >> + } >> + >> + dlclose (handle); >> + return 0; >> +} >> diff --git a/gdb/testsuite/gdb.base/jit-unload.exp b/gdb/testsuite/gdb.base/jit-unload.exp >> new file mode 100644 >> index 00000000000..0bf9c59385d >> --- /dev/null >> +++ b/gdb/testsuite/gdb.base/jit-unload.exp >> @@ -0,0 +1,44 @@ >> +# Copyright 2026 Free Software Foundation, Inc. >> + >> +# This program is free software; you can redistribute it and/or modify >> +# it under the terms of the GNU General Public License as published by >> +# the Free Software Foundation; either version 3 of the License, or >> +# (at your option) any later version. >> +# >> +# This program is distributed in the hope that it will be useful, >> +# but WITHOUT ANY WARRANTY; without even the implied warranty of >> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >> +# GNU General Public License for more details. >> +# >> +# You should have received a copy of the GNU General Public License >> +# along with this program. If not, see . >> + >> +# This test checks that gdb does not assert when unloading a shared library >> +# that defines a __jit_debug_register_code if `set debug breakpoint on` is set. >> + >> +require allow_shlib_tests >> + >> +standard_testfile .c -solib.c >> +set libfile ${testfile}-lib >> + >> +set options [list \ >> + debug \ >> + shlib_load \ >> + additional_flags=-DSHLIB_NAME=\"${libfile}\"] >> + >> +if { [build_executable "build main file" $testfile $srcfile $options] == -1 } { >> + return >> +} >> + >> +if { [build_executable "build shlib" $libfile $srcfile2 {debug shlib}] == -1 } { >> + return >> +} > > This isn't going to work for remote target boards as the shlib will > still be on the build machine. If you rewrite like this to make use of > gdb_download_shlib then things will be better. I tested this using > 'make check-all-boards', which is described in gdb/testsuite/README: > > require allow_shlib_tests > > standard_testfile .c -solib.c > > set lib_testfile ${testfile}-lib > set lib_binfile [standard_output_file $lib_testfile] > > if { [build_executable "build shlib" $lib_testfile $srcfile2 \ > {debug shlib}] == -1 } { > return > } > > set lib_testfile_on_target [gdb_download_shlib $lib_binfile] > > set options [list \ > debug \ > shlib_load \ > additional_flags=-DSHLIB_NAME=\"${lib_testfile_on_target}\"] > > if { [prepare_for_testing "build main file" $testfile $srcfile \ > $options] == -1 } { > return > } > >> + >> +clean_restart $::testfile > > I propose using prepare_for_testing above, so this line will no longer > be needed. > >> + >> +if { ![runto_main] } { >> + return >> +} >> + >> +gdb_test_no_output "set debug breakpoint on" >> +gdb_continue_to_end "unload" continue 1 > > I worry about trying to handle all of the possible debug breakpoint > output using gdb_continue_to_end, which matches all the output with a > ".*" pattern; there's a risk of buffer overflow in the future. > > I'd prefer to see this handled with something like: > > set saw_exit false > gdb_test_multiple "continue" unload { > -re "^\\\[Inferior $decimal \[^\r\n\]+ exited normally\\\]\r\n" { > set saw_exit true > exp_continue > } > > -re "^$gdb_prompt $" { > gdb_assert ${saw_exit} $gdb_test_name > } > > -re "^\[^\r\n\]*\r\n" { > exp_continue > } > } > > which handles the output line by line, and so will be happy with any > volume of debug output. > > Thanks, > Andrew > >