From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2049.outbound.protection.outlook.com [40.107.105.49]) by sourceware.org (Postfix) with ESMTPS id B1E353857705 for ; Wed, 11 Oct 2023 10:07:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B1E353857705 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3kOgCEd8ij9rMi05eXEVpCo8oU8qVcvJZBGfIVtQmmc=; b=2StHmBgXjLW99LH+kUwLetOJJ0GJiZj4YQDGPM6EIWM8b/g1/BhKgOUNReg7qLQRZF+jmC79hlFR2rA3Ql0zzO1XEPkvqtUBmSh5bO5NFzx4U2tCm+ZIT2piZM31uWWz07HXu3kbFQVmxxbVFZ87c5Y/PU77LUsyC1elEqj5a0E= Received: from DB8PR06CA0045.eurprd06.prod.outlook.com (2603:10a6:10:120::19) by AS4PR08MB7553.eurprd08.prod.outlook.com (2603:10a6:20b:4fb::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.38; Wed, 11 Oct 2023 10:07:06 +0000 Received: from DBAEUR03FT050.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:120:cafe::82) by DB8PR06CA0045.outlook.office365.com (2603:10a6:10:120::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.31 via Frontend Transport; Wed, 11 Oct 2023 10:07:06 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DBAEUR03FT050.mail.protection.outlook.com (100.127.142.250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.23 via Frontend Transport; Wed, 11 Oct 2023 10:07:06 +0000 Received: ("Tessian outbound fdf44c93bd44:v211"); Wed, 11 Oct 2023 10:07:06 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: c3ab8a7b1c2cf2db X-CR-MTA-TID: 64aa7808 Received: from 150426a9699d.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 14BB682B-0F3B-4077-AA43-2C937D14E2D0.1; Wed, 11 Oct 2023 10:06:59 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 150426a9699d.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 11 Oct 2023 10:06:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KRszPIFOGcitJBht2LFlFPsy/QaAgMkDAJINGikTk7Di/OYa2/6S+mvw6rj/Bg0yzXCSwKSYudnoIHcP3mKZwpJdydq5a2M2f9YotzKIQCzfNu2g9zzGGzr07+lY/NSQ52Faa4rcg1mNczekK3mHOXDi7jsjktrrUR8Mgv0SHiOG7aiGOcYRpWVq1Q+ZQ9qN7B6zotp33/C9zKwRjduqSEcFP49lwqg6BCeAGAkMjRhlR18p0zqu53lWTI9AaVhqra/suPDXhR4R2TNJ1EfbOGJeG3AoHjUi0wl15RaN7EQV/OGCLAtwMYi56UnAk66pHN/tyRN4YeaQaLUVWxbk9A== 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=3kOgCEd8ij9rMi05eXEVpCo8oU8qVcvJZBGfIVtQmmc=; b=UxTPjEjy9F0qebwJ+Nh+gLiq4W+Bn2JH6jA8bwaT5BLOcWIdz8M1EkXMf2n+sUCysPE7Rusj1PqGLUYthXev6Y6hv0cRhICosYZvk0NHctLFouSV5IZgosYtauMrwe0FPTt6NI2IBSAt6d/23feY+aCyGpocRk5kXGDzVV41e1eMIGL93wDBcu8jdVsc9s+ppBSKtQDxr89zy0rJPN1Kb/Fnxeu0mES7FIlcfnwfEHf65aCMZWBqaSD7G9sj69BsKYBVcupoo8N11GngT1d0Favc+ynFTF4dK6YIUKaxZfkp4cDy2NHqHZ9eBUUAVQUpgg1fH8QIr5MHEtV04e325A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3kOgCEd8ij9rMi05eXEVpCo8oU8qVcvJZBGfIVtQmmc=; b=2StHmBgXjLW99LH+kUwLetOJJ0GJiZj4YQDGPM6EIWM8b/g1/BhKgOUNReg7qLQRZF+jmC79hlFR2rA3Ql0zzO1XEPkvqtUBmSh5bO5NFzx4U2tCm+ZIT2piZM31uWWz07HXu3kbFQVmxxbVFZ87c5Y/PU77LUsyC1elEqj5a0E= Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from VI1PR08MB3919.eurprd08.prod.outlook.com (2603:10a6:803:c4::31) by DB9PR08MB6747.eurprd08.prod.outlook.com (2603:10a6:10:26e::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.43; Wed, 11 Oct 2023 10:06:58 +0000 Received: from VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::c126:1009:20a5:195]) by VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::c126:1009:20a5:195%4]) with mapi id 15.20.6863.032; Wed, 11 Oct 2023 10:06:57 +0000 Message-ID: <05568109-8df9-4a48-af04-9f784bf0e4d8@arm.com> Date: Wed, 11 Oct 2023 11:06:53 +0100 User-Agent: Mozilla Thunderbird Subject: Re: Thread Specific Architectures And Python Unwinder API Content-Language: en-US To: Andrew Burgess Cc: gdb@sourceware.org References: <87bkd5czqr.fsf@redhat.com> From: Luis Machado In-Reply-To: <87bkd5czqr.fsf@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P265CA0327.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:390::10) To VI1PR08MB3919.eurprd08.prod.outlook.com (2603:10a6:803:c4::31) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: VI1PR08MB3919:EE_|DB9PR08MB6747:EE_|DBAEUR03FT050:EE_|AS4PR08MB7553:EE_ X-MS-Office365-Filtering-Correlation-Id: 84406099-f266-4ae3-e1cd-08dbca41d33c x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 2G1fr3ZiZabjQaDEdtDKNmfFO8/IzueUU0ZO4ag2BBZp8mhCGDvW2lcSJfznlOiMaTF5ELOrfxy3/WK6dh07qtOrnkP95WzGUC4lxur06TZOJoGJSdAlPX9TMbnPcNe9AEOjpN9ZJcuTLupWiqxx5QxNJ5Xtr/XDvyqjEiWz8p5G//NORu81Tys/DQyuNd8S/ohEFJaUPW9ixk5M2bvWYOCjLq4/RdVlXKkf0C6ISGym8H8GdWcAqqwMHbTxpHTgZPvWoS37w8oa79DJwg1hzVxGN+OLbLIKFQIDshOKUfqvKJUqV++W0YCJPX6Wm/OoDgfagfUQmi7O0gZvFxqQylBM2BZQ/Iq6byUAkSPOg1IeUG7JZXzPk5Z6szG9qxcSzS8fY/OzdCWWEWL5WjV5X0y97YLIiwvmsoQbYXnLBiiL7zv8VgUIVA/DI8p/WU+cc/k3mT8bkndc1a+vA/BCd7ftr683Mq3lK1yLH4qcj1rCX58x3f/oofQKLwQtYKyI9utZ3QUtb0Z2AIa1AhEzO1R9di/YihCHSV1G7Cc2gkWsZpeS4DuEkDErrboZu7kv40pe6/5v04i8jARgCKPCrLp+F8tSu2ETU2+0As4VoJZDCFn8UQSUko4CjPNGCMjbqfU8DIE60xBUaTEi7kkvzg== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR08MB3919.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(39860400002)(346002)(136003)(376002)(366004)(396003)(230922051799003)(451199024)(64100799003)(186009)(1800799009)(26005)(2616005)(478600001)(6486002)(53546011)(83380400001)(31696002)(6506007)(86362001)(6666004)(41300700001)(36756003)(8936002)(8676002)(4326008)(31686004)(6916009)(316002)(66946007)(66476007)(66556008)(2906002)(6512007)(38100700002)(5660300002)(44832011)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB6747 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT050.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: c782fc45-f00d-40ca-69f1-08dbca41cc10 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: O+3vrVOrd4TAKDqltxrxNagSbicTkKzh/HhZ/97t8PhtqGfCt4Mfgv8Z3kZozYnysK5I5PRVoVCKnTqJbRaO+3Af/rO431h8FnOcvtRyRu76Yn8HjSdprZzFzS+4LMb3gzy67xLWtsPwuJ1OD2E36GlZ3fxdKA1zqXVt1bcs8zi9kzHt1f2iKG5V2eOsnOh/2vLEG9ylOLYiAF2SgZrBy9vIAYwwkLOKg3X4+y+Or6dKQEBujfPgC/5/llD/iIPi3wfhHXbAN138QKsSR92ng5Ai1LxkeNyYPAXsai6pOhokN9hr7KRg+2okCGDb/BfmiBL5Axvn2JU3fkA+SSdKAW5k8OjPhqpuywEusdC9LsycONmDQl0nKuT73/eA0BQ0yjmKHlj26gtiCN4ynEbffz8tzkqlkYwJI+CXfprVUM0ZpOC5zjQUWyXItYgRhdzKJG1wk+ivitxOq10uGWrfkqcYoAiNoSjGJ422CJbCQFqOqRyEekdJXoODRLkMmarhory780PfjXM2bmiXOcZrHBbRYJSlOs95a+GJsSQQ8Tqm2mEtTkj0r5Y5rxn8pkMnE/tjMRr0hGKvQBIWvNXkaygQm8TXYblaTaKzSYSAADNV8iMaP3yVShqA0WiHvfSqlZJ+kunYEDNkyLZPIoDaYqEkJesTCjXevuJjKRYZ7pB6Coa7ZyR5I0WMW1N8GjF/2iHJosXW6lt8XlpKjZm43hwa2YWgD0QA8oF1OxKG3GiN9hDqdqZexHWearhONlwE8MCbCIJ4eLnQi3rgOmZZqQ== X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230031)(4636009)(396003)(39860400002)(376002)(136003)(346002)(230922051799003)(186009)(1800799009)(451199024)(64100799003)(82310400011)(46966006)(36840700001)(40470700004)(31686004)(70586007)(70206006)(316002)(6862004)(4326008)(8936002)(8676002)(41300700001)(336012)(36860700001)(44832011)(356005)(81166007)(82740400003)(5660300002)(6512007)(2906002)(2616005)(6486002)(26005)(47076005)(478600001)(40460700003)(36756003)(6666004)(53546011)(40480700001)(86362001)(31696002)(83380400001)(6506007)(43740500002);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Oct 2023 10:07:06.8724 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 84406099-f266-4ae3-e1cd-08dbca41d33c X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DBAEUR03FT050.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS4PR08MB7553 X-Spam-Status: No, score=-5.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,FORGED_SPF_HELO,KAM_DMARC_NONE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE,TXREP,UNPARSEABLE_RELAY 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: Hi Andrew, On 10/11/23 09:47, Andrew Burgess wrote: > > Hi Luis, > > While working on something else I was looking at the Python Unwinder API > code, and I suspect that the thread-specific architectures support might > (currently) break the Python Unwinder support. > > If it is, then I think the fix is pretty simple, but before I posted it, > I wondered if you could confirm that things are indeed, currently > broken. > > Attached at the end of this email is a Python unwinder. You'll need to > supply your own test program that makes use of sve/sme, and thus uses > thread-specific architectures. > > What you'll need to do is: > > $ gdb -q test_file_that_uses_sve_sme > Reading symbols from .... etc ... > (gdb) source ./unwinder.py > (gdb) break function_where_a_thread_specific_arch_will_be_in_use > Breakpoint 1 at ... etc ... > (gdb) run > Starting program: ... etc ... > > Now at this point, when you stop, you should see at least one instance > of the banner: > > *********************************** > * Have executed the test unwinder * > *********************************** > > being printed, probably more. As you step though the function you > should see more instances of the banner being printed. > > To reveal the bug then it is important that when GDB stops in > function_where_a_thread_specific_arch_will_be_in_use, the per-thread > gdbarch that it creates _must_ be different from the inferior wide, > top-level gdbarch. > > If you don't see the banner then my suspicion is correct, and the Python > Unwinder API was broken when the thread-specific architecture support > was added. > > The problem (I think) is that the Python unwinder is registered on each > gdbarch as a result of the gdb::observers::architecture_changed.notify() > call in set_target_gdbarch (though Simon has recently moved, or is about > to move, this code, but not in a way that will fix this problem). Thus, > the Python unwinder is only registered on the top-level (inferior wide) > gdbarch, not on each of the different per-thread architectures. > > I have a patch here that removes the 'architecture_changed' observer, > and replaces it with a 'new_architecture' observer, which I propose to > move up into gdbarch_find_by_info. > > Thanks, > Andrew > > --- > > from gdb.unwinder import Unwinder, FrameId > > class test_unwinder(Unwinder): > def __init__(self): > super().__init__("test_unwinder") > > def __call__(self,pending_frame): > print("") > print("***********************************") > print("* Have executed the test unwinder *") > print("***********************************") > return None > > gdb.unwinder.register_unwinder(None, test_unwinder(), replace=True) > I'll give this a try and will let you know. But I suspect it might be broken indeed. Not all the gdb layers support this concept of per-thread gdbarch.