From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2067.outbound.protection.outlook.com [40.107.247.67]) by sourceware.org (Postfix) with ESMTPS id 946003858D20 for ; Fri, 3 Feb 2023 11:28:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 946003858D20 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=RjDOzGpRfOQ9cJ8VR9N/55p2kdig8SFglXfwJ3wtpgk=; b=7ctIjvRLj2Gf4KNg37gboJe8AYRH8U6wPxqG24ixVx4NMAXxWKElrXsAP0ElJAK0tWgCt6lgES+OOktOIlVYvgTOL/lls8a9/MklPZqPRlwx9EOwYtrhqpcn+dsrVcmCcVnMgqAXydYQ+YO1f2Pk7r9tAFUGrx9OH6TMa/q9hx0= Received: from DB3PR06CA0026.eurprd06.prod.outlook.com (2603:10a6:8:1::39) by DU2PR08MB10038.eurprd08.prod.outlook.com (2603:10a6:10:49c::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.30; Fri, 3 Feb 2023 11:28:06 +0000 Received: from DBAEUR03FT004.eop-EUR03.prod.protection.outlook.com (2603:10a6:8:1:cafe::2a) by DB3PR06CA0026.outlook.office365.com (2603:10a6:8:1::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.28 via Frontend Transport; Fri, 3 Feb 2023 11:28: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 DBAEUR03FT004.mail.protection.outlook.com (100.127.142.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.28 via Frontend Transport; Fri, 3 Feb 2023 11:28:06 +0000 Received: ("Tessian outbound 0d7b2ab0f13d:v132"); Fri, 03 Feb 2023 11:28:06 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 3db460651922719f X-CR-MTA-TID: 64aa7808 Received: from 5fdce61db4da.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 75E39E96-B491-44D6-9FB3-D00E4FA29149.1; Fri, 03 Feb 2023 11:27:59 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 5fdce61db4da.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 03 Feb 2023 11:27:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XBI4bUtoqNslYUuaRk5Q7qFD4tQ8e1b25+ZJHKiN2vBM5E3r3G/z/PSnFQzaCDtweRukewFJu4gCukSl3gwA5i3G5V45XijZ52elI8U53E7fdPSp4lVWiiLGnvQoJp9njND3TdeYP2woJk3lq6CNTLACF9EPvqeQz62A5YPvSAmxxxrMpXMgEEKmmWpmKjwnvdjoJS9auloR6XcFZq+NAGDzWyA8+MDiWgURYOB2MZbckX4kzzxUfLTHMeeng+vYbXKS2w5v2Dbsrh2GEeprFLYe1xFex1lzBniSbY2J2U9M7z0+m54Lq7nOvbCR9qrTaM5oIGcCGxCB8e+N1uRnxg== 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=RjDOzGpRfOQ9cJ8VR9N/55p2kdig8SFglXfwJ3wtpgk=; b=dxK9cgw4dddTR8nZwFg/KOfhXWDJQgxfeQAAbC6HdsthiTvO0ggRWwSZapIQo9ajRBIInQquTIZdCPsCvL2bs55BvvOv1IJwh9Wvg2AHuWMtC+/4h2IDHRl1RAjwhulLTwF9PJh7qjUM3+X51a1FkqdsNoUc4/KntKOpPBmLtx0WQ7stpplMTVeRWoun6dagytuJQP50O5dnPl8TsykUFf1dOgumqTktrxzjNTarh/4yPUZNryo5teIlcEe84efRzTqUsvwu/qS8kr4e1wPeMesnJfdJfzth+WGyAvzilg9vg0ZROYugCEc4KGmBbWEd61D9ImvaRaHrLPHE0B7CQA== 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=RjDOzGpRfOQ9cJ8VR9N/55p2kdig8SFglXfwJ3wtpgk=; b=7ctIjvRLj2Gf4KNg37gboJe8AYRH8U6wPxqG24ixVx4NMAXxWKElrXsAP0ElJAK0tWgCt6lgES+OOktOIlVYvgTOL/lls8a9/MklPZqPRlwx9EOwYtrhqpcn+dsrVcmCcVnMgqAXydYQ+YO1f2Pk7r9tAFUGrx9OH6TMa/q9hx0= 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 DB9PR08MB6587.eurprd08.prod.outlook.com (2603:10a6:10:251::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.31; Fri, 3 Feb 2023 11:27:56 +0000 Received: from VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::bced:32a3:b77e:90a6]) by VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::bced:32a3:b77e:90a6%3]) with mapi id 15.20.6064.028; Fri, 3 Feb 2023 11:27:56 +0000 Message-ID: Date: Fri, 3 Feb 2023 11:27:54 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH v3 6/8] gdb/remote: Parse tdesc field in stop reply and threads list XML Content-Language: en-US To: Simon Marchi , Andrew Burgess , Thiago Jung Bauermann via Gdb-patches Cc: Thiago Jung Bauermann References: <20230130044518.3322695-1-thiago.bauermann@linaro.org> <20230130044518.3322695-7-thiago.bauermann@linaro.org> <87edr9tq0c.fsf@redhat.com> <9f5deefd-52fc-9792-f9a5-dede9c415777@simark.ca> From: Luis Machado In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P123CA0543.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:319::15) To VI1PR08MB3919.eurprd08.prod.outlook.com (2603:10a6:803:c4::31) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: VI1PR08MB3919:EE_|DB9PR08MB6587:EE_|DBAEUR03FT004:EE_|DU2PR08MB10038:EE_ X-MS-Office365-Filtering-Correlation-Id: 8278621f-644a-44a4-b8f2-08db05d9b870 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: IXfYaDLOwT7I+b2ZFJDX04IRkwk93O8Ri4WAgxjm6D9PfHmhTQ3Ivxx/NqPaWrpcJW3I941Rk1rY7CHFmQ6Jq2S/Ejv42ODlcCoV2IXRfKGfLzsH9ey5SiXisVXG4ILT+jByVVwaE0aKTJAljZRrx0cF/YKnMU7BsdPkAEoU2Z4fVxntj1KpJAGJ4eM5TQPBhxkbaUfXYGsjcsfjhbliGNy4wbvVllxmYt021CmkGxoEyfvK3pXWZjcqy9/o8foKECISxcSkrRSVOuuslyyUMaWXdTd1fsRiirbinDnc5qYvNwENQCX0GmonTwfItlMaA2Fec3osIlZX7oZIRjCahWciGSVWjUkVfBbsIGO5a0fQBMkxm47Uw8ESZxbB+zYrBlL9CV17qJV5LXu/mZDvyqUFC8SAdJWAJHvRZqIyn968rdpR8kjVmifwIQzVPkCmFFEBkz2iPx5UQdMlxiv1XjreUMN53dBA6U6QCwQbf0QkPb9REqGb3ohHvxfym6KQjSoPSFNtQxPlOV0u0T8oKet/phjr6e2AGBE0vuMr7eaXpEOtPvAY28RWJBWQHsREPp/Ozur1e5s2yBi5NmQjN69wsQAQnSN63F/RX8P/csQ7w1y9PcZIBVwPWo8TFMNmgC0QopaJ4BHbE1iUvYsGG1Bzwthdy0/aoAMQ6cCJJJLfaMeV8HNgm4dwHLeZL7pvBAhdhtC/T6TfNQxuxmvgiD2s0yGc6LuVNKcc/rFQaIg= 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:(13230025)(4636009)(136003)(39860400002)(396003)(376002)(366004)(346002)(451199018)(36756003)(44832011)(8936002)(5660300002)(66946007)(4326008)(8676002)(66556008)(83380400001)(66476007)(316002)(110136005)(41300700001)(26005)(186003)(31696002)(6512007)(86362001)(31686004)(53546011)(6506007)(2906002)(478600001)(6486002)(2616005)(38100700002)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB6587 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: DBAEUR03FT004.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 96f94080-a290-481e-fd16-08db05d9b1d5 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wTBukMLNNe2/T4evSGsx20XdIdoyFPpc1EQe9YdlnTFA4gtGB1R0KP6QqGF90qREHPynFAAG66FG/m7Flo6QTQHwwUtqqLenfw/mB6VF9zr6D5qnQLg3Q88iI9XUtivceZd+8TM5iyzYRi7AazTZZSz/bsv0mug71/bXHIGwsdIQWlUaoAqYQ+BML58t3XfqK7rtom+oJO4R6ZU/KavGNwL3x7FZGIYWTBSSiMOKzlPyWf2vRY3Ceb7hXgGdizXcDVht4RcLgmXhHA5Jm2P26+PshBnSlWNdGbl/GUywc76uU/i81+uE4m88lN8GUbhaZRERdbFWCB0hoEDah8FT6ltmmDUVu0qitw9M6X+CWkVy1ZSk/XxpZhgHPOo5zQk3r0loo0lAbb+hfguABvqyD4bYZFdPS+T/1by5n/ZlvxPln3HJp9OpZAiMbTMVJVkbT1/AYn2p0BZN+z4MatVmxuWS2yzRQk9bHZK64bnTl91s+XDJ/YHCI10HH1rc9R0b2RAvhmL0ByoD41F9qbyPHEhM9qNchF4ZHNrJQoOoVQCnPTVD7j8a0Kx1sRTulGNwNMSJHOqxaKp6Qz9yxfk1U3187L5C7JZZz8DOKGEKmCkRCvPgz6DN586w2fAXh8bg/JAr6noUWQSXaJYRFlwSvExtlLnlXD869zTtunqMXar3iDbIbfz/HvnQnOVOW2MrgEbLhAHWebMOd/PvXFAS0ICtXCjlrE668B7CGxZOZhU= 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:(13230025)(4636009)(376002)(136003)(39860400002)(346002)(396003)(451199018)(36840700001)(46966006)(40470700004)(6512007)(6486002)(478600001)(26005)(82310400005)(81166007)(47076005)(356005)(31696002)(40480700001)(82740400003)(86362001)(36860700001)(336012)(53546011)(186003)(2616005)(36756003)(40460700003)(83380400001)(6506007)(107886003)(5660300002)(110136005)(4326008)(316002)(8936002)(70206006)(70586007)(8676002)(41300700001)(44832011)(2906002)(31686004)(43740500002);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Feb 2023 11:28:06.3494 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8278621f-644a-44a4-b8f2-08db05d9b870 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: DBAEUR03FT004.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR08MB10038 X-Spam-Status: No, score=-6.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,FORGED_SPF_HELO,KAM_DMARC_NONE,NICE_REPLY_A,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: On 2/1/23 20:16, Simon Marchi via Gdb-patches wrote: >> IIUC, the tdescs would be deleted during the >> pop_all_targets_at_and_above, when the refcount of the remote_target >> gets to 0 and it gets deleted. And the threads would be removed in >> generic_mourn_inferior just after. >> >> An idea could be to call generic_mourn_inferior before >> remote_unpush_target (no idea if it works). Another one would be to >> get a temporary reference to the remote_target object in >> remote_unpush_target, just so that it outlives the threads. >> Or maybe we should say that it's a process target's responsibility to >> delete any thread it "owns" before getting deleted itself. > > Another question related to this popped while reading the following > patch. When creating a gdbarch from a tdesc, the gdbarch keeps a > pointer to that tdesc (accessible through gdbarch_target_desc). And > AFAIK, we never delete gdbarches. So I suppose the gdbarch will refer a > stale target desc. At first I thought it wouldn't be a problem in > practice, because while that gdbarch object still exists, nothing > references it (it is effectively leaked). But then I remember that we > cache gdbarches to avoid creating arches with duplicate features. So > later (let's say if you connect again to a remote), we might want to > create a gdbarch with the same features as before, and we'll dig up the > old gdbarch, that points to the now deleted tdesc. The target descriptions for aarch64 are all cached using a map in gdb/aarch64-tdep.c: /* All possible aarch64 target descriptors. */ static std::unordered_map tdesc_aarch64_map; I don't think we should try to delete those, and they should live throughout the life of gdb (unless things get large, then we might consider cleanups). > > Perhaps it's possible to generate a crash with the current > implementation by connecting, disconnecting, connecting again, and then > doing something that uses the thread-specific gdbarch. > > Simon >