From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 7ECEE3858C30 for ; Thu, 12 Oct 2023 14:25:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7ECEE3858C30 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697120758; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=B9+TD0VZaytx5wC+0bpTnLFQ4k4xgP6l7uPeLplEQDI=; b=a473fCGhzCxaIXsZBTxJDrLHhOAJJXgnhmZ7IPkF0yLrtKj2nyNsfKw1CgAm6lVVvLjXsv 5nzoHq/W4WHHsM4t9oEATG7z09iaoSZVOPgHvX/+eBgVjO+uINuDsbwh/fD4Ctc/X7+q/S eSTQoCvg1as5IrAD/T70aNRx+VEVvBk= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-572-HVzzqy1iOECN-K49uLuW-g-1; Thu, 12 Oct 2023 10:25:56 -0400 X-MC-Unique: HVzzqy1iOECN-K49uLuW-g-1 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-9ae0bf9c0b4so81896966b.0 for ; Thu, 12 Oct 2023 07:25:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697120755; x=1697725555; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=B9+TD0VZaytx5wC+0bpTnLFQ4k4xgP6l7uPeLplEQDI=; b=Wu3XR7wPw1P+Fpq6h5kjXL9NF7Z5+7Ffxs3wTE/dvxHgCt0XlCKzv3yoyDIrtiz7jm BANWmTViFOilIk9LUdtxiWc8f8XHmKMdizzMd3nFh2kKoryAttY4RuUoJj8KpqmndakF XlH6KMGXvXLToAzVuDdonsBnDiCNHvxckiCco0TPWklWJz0ckWleyMe6Naiu0RJhSitf THqMqCKcGaAskJWhHusuz1mmQxrpGSB3FDJ2W4W+FR6D8KIHWmLXL+3IP5YZRq9Xu4CX 3+MxPS108/Bqu4X4fmoBpPlSDLdAhvaYjL00jr3+MQCrv58qhRhB12XU81/J1QzYuCSI OgXw== X-Gm-Message-State: AOJu0YwRs1B+NuihI/7NhRvCRHZk+g0tfVXtyo67EXljQPhyuKUA9lFG HgS4owRDAGxJYxmnc7sOB5TsYF+9dYSei466CbfDmUJkp7AwFsWYMOTc/zC2CBTY1jHW10751EV dvelpuiOlVNMFbfMIdIc= X-Received: by 2002:a17:906:15d:b0:9ae:546b:786b with SMTP id 29-20020a170906015d00b009ae546b786bmr19723018ejh.33.1697120755394; Thu, 12 Oct 2023 07:25:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHdegmDC2OYmv1X7Wd6upIN0Nrfa3JRAkustyuzQEOquQJu7ZAFpeAt/Og/GMyf09MdmUkU+A== X-Received: by 2002:a17:906:15d:b0:9ae:546b:786b with SMTP id 29-20020a170906015d00b009ae546b786bmr19723004ejh.33.1697120754947; Thu, 12 Oct 2023 07:25:54 -0700 (PDT) Received: from localhost ([31.111.84.209]) by smtp.gmail.com with ESMTPSA id m15-20020a1709066d0f00b00982a352f078sm10964776ejr.124.2023.10.12.07.25.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 07:25:54 -0700 (PDT) From: Andrew Burgess To: Luis Machado Cc: gdb@sourceware.org Subject: Re: Thread Specific Architectures And Python Unwinder API In-Reply-To: <897a57fb-f9dc-4a71-a05d-6c3e3b1d1f4d@arm.com> References: <87bkd5czqr.fsf@redhat.com> <05568109-8df9-4a48-af04-9f784bf0e4d8@arm.com> <29fefb89-9934-4e9d-9ea0-adf40789e921@arm.com> <87wmvsat8i.fsf@redhat.com> <897a57fb-f9dc-4a71-a05d-6c3e3b1d1f4d@arm.com> Date: Thu, 12 Oct 2023 15:25:53 +0100 Message-ID: <87ttqvc3ym.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Luis Machado writes: > On 10/12/23 14:02, Andrew Burgess wrote: >> Luis Machado writes: >> >>> On 10/11/23 11:06, Luis Machado wrote: >>>> 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. >>> >>> I've confirmed I don't see the banner. So this seems to be broken. >>> >>> Is the fix to set the python unwinder hook elsewhere? Or maybe save that >>> information when we're trying to pick a different gdbarch? >> >> I'll post my patch for this later today. But I'm going to propose >> changing the 'architecture_changed' observable into a 'new_architecture' >> observable (which is called in a different place). As such, every new >> architecture will have the Python unwinder registered correctly. >> >> I just need to update the commit message with some details of this issue >> as justification for the change, and I'll post it -- it's a pretty small >> change. I'll CC you on the new thread. > > Great. Thanks for the heads-up. Let me know if you need some more testing. If you're keen, the series is now posted here: https://inbox.sourceware.org/gdb-patches/f5efeaed8c7150294024f5d2f6d98b748fd6bf56.1697120493.git.aburgess@redhat.com/T/#u If you apply this, and then repeat the previous experiment (loading the dummy Python unwinder), you should now see the banner being printed. Thanks, Andrew