From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2084.outbound.protection.outlook.com [40.107.7.84]) by sourceware.org (Postfix) with ESMTPS id E342138582BE for ; Wed, 7 Feb 2024 18:05:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E342138582BE Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org E342138582BE Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.7.84 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1707329136; cv=pass; b=iwrSOBRHfcpVStton1h17RoItVI4LBfu1tCEvlQYjqnJGjdU1sFZKg9lEYfyimU4gSDMwPKnRcq0qd1NH9JS11/kDRWZ91A14cKrkKz1JahPeskwnLxMMr37+EtcZCkYMZyZYctIZttm8PAx/LV2qQzCot0ACAeSawbfBC+HALo= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1707329136; c=relaxed/simple; bh=wDbl7HRI0IImvpLYoD5SMDPwjO2i3e1vfYgXXfWG228=; h=DKIM-Signature:DKIM-Signature:Message-ID:Date:Subject:To:From: MIME-Version; b=wbFx4jRY02IznWfvSV8sRJM/d0ljHemLXSJlP/FSjgaMPJnd2VPUL+T2MCjLT5gSyyqDaYpenRU4oRUuv5g5EvZwQ59hyzOUQGspRanfM6HrPOFsXfJGa+Aej0zVIj1UqNLjaOufQI3/4vcN/wBq94UmanaBCvNnoAorCwxFmNA= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=mTccxqDQpbZeeP7MxTcYdHaXNzvxXKGcgZqHzZ1thbOeNWPT0Pix5Tk4x6nukBpy7PY1Ry/AqiydKjjXB0DsaDEWiCRE+CI+eJDh3/ix9WKrplxMbKZKY+k09K2nzxktSlA+Hdpt6b5+e4tlC06gITbH7dQn0ydn5dS9X1KuzdAhJTJTNcwc+aMAYrDXFZsRAgWGz3Y1ChG4dbGONHec69KTSDV0ogNpOl70ExrfPZtlwal3HmK3RBB0bplllg1/BW7wSy3CcO57bT/RPPbID1ImBPqtRiJYszud89V1ON9j4D6NqX5sf8A2J4otQ46TP8gzcR4WosIXqFzIpiekNw== ARC-Message-Signature: i=2; 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=naU8e4KmJWkHd9ifOxhOeWfsCv7joXjQL/T2udPFhto=; b=Uk0Zzhux3QedPcO1exfPSjhTBIfPHkze1iBJuP+dEQlw3B6yp1FEbYtliNfHnHwMXCaSEynLuhc4EATT2OFGhKxWwsZlasUXLuOucWtVZL7ZmHUroCyNgykfiQzIpb2zdKke1PUPrgxxT0gk+UDe/6fVfVRQ9o9cS0pru0IoPp7rB58rXHLOGG7ERt7+adq9M0tX53D49Z6bd3J0RnvsZSPx2/hjbD+uXmL0P1dgDCKE99Xmvs06iEFMJuj2uNVgePabO69YFleXIdBsfN6Y6/38TB5bBS9FXEMRDsACImp/QwL1Or5H/EXcrK5OxeYQJQ7thnUwyeB46Ys1ReseDg== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=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=naU8e4KmJWkHd9ifOxhOeWfsCv7joXjQL/T2udPFhto=; b=p9Htlu9XfTulc9HFYgmcea+WuPo978GNWCaq65eg72yS8/gHVi7o7g7ZdkruslRMh1Zo8kiGCpLOIMviBcsQsyvATEaeAyG9sgO4go7s3pMuHpJOfEwm8tRNkyJMt9NyPwScuQJBDE3AEZTT2AQn4J+bRDN7dYtWVhxmvrK2NN0= Received: from DUZPR01CA0327.eurprd01.prod.exchangelabs.com (2603:10a6:10:4ba::17) by PAXPR08MB6334.eurprd08.prod.outlook.com (2603:10a6:102:dc::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.36; Wed, 7 Feb 2024 18:05:29 +0000 Received: from DB3PEPF0000885A.eurprd02.prod.outlook.com (2603:10a6:10:4ba:cafe::aa) by DUZPR01CA0327.outlook.office365.com (2603:10a6:10:4ba::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.37 via Frontend Transport; Wed, 7 Feb 2024 18:05:25 +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 DB3PEPF0000885A.mail.protection.outlook.com (10.167.242.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.19 via Frontend Transport; Wed, 7 Feb 2024 18:05:25 +0000 Received: ("Tessian outbound 94d82ba85b1d:v228"); Wed, 07 Feb 2024 18:05:25 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 1996d3528aabb413 X-CR-MTA-TID: 64aa7808 Received: from cc0619627221.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id A3399962-3576-4385-874E-4B5E742FA220.1; Wed, 07 Feb 2024 18:05:19 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id cc0619627221.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 07 Feb 2024 18:05:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SKMg6LG0aK5NETac6fvGznX6LMUqHgd0qm1vCQqohn+GC2ozt+Of+pojwj3gpF7vLxYnXlq0rbHxzQy/GwCUnemxS/DrG39v6YGxfzUG85Mh2TKZLiFiRLWbHtQP9kGC0fALHQfyp18Dd6ltRpNDorkm0rWMbk4l7dkT6einkG4xNqq/PzmAgCqDLLfgY4eT9Ne0kDLng9i/TLUF0w/ZheQREUSNQIOinDhnW3shzoKy7gH1kY++xqZqB6uws5jKJ8v/8i/TJxsGOVL4kzn74P+PQHvBJ9AFsajaj82n9SQMjT2MHlaKByVAcREewg+QueR3ELi4UZgY1UPgqpAgQw== 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=naU8e4KmJWkHd9ifOxhOeWfsCv7joXjQL/T2udPFhto=; b=mub8qONWjjWqPYUVuMdrL5PyBV8XTVE5Hi5VkeKtAd4hBOCr/SVmnVoy3xihEr1t78VjmXnuDWDEDTMxffcCLnsVIxAFAddu2t3wVXc0avV6isa0G76FzmLw2SASMdAYG+NXo0RZOyNngXjP5Wn3uak/xu38VwMFUio95TMtElOdVBtpAdKPxvOeypC7d1NSL74f1sAbnjTlfbw4W5+JlObbhW5TbwE6kSn2OSsAD0/FimlYXQcDNRLpndwvQ//VHg0tsFGM9WBWAhqE4XCziM1o32FXiSC1OGCYaxrFDtYhXRwWywcKcsVZPVZkFCVCP6ah2xgU0xwd3RUqTWyBbg== 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=naU8e4KmJWkHd9ifOxhOeWfsCv7joXjQL/T2udPFhto=; b=p9Htlu9XfTulc9HFYgmcea+WuPo978GNWCaq65eg72yS8/gHVi7o7g7ZdkruslRMh1Zo8kiGCpLOIMviBcsQsyvATEaeAyG9sgO4go7s3pMuHpJOfEwm8tRNkyJMt9NyPwScuQJBDE3AEZTT2AQn4J+bRDN7dYtWVhxmvrK2NN0= 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 GV1PR08MB10838.eurprd08.prod.outlook.com (2603:10a6:150:16a::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.36; Wed, 7 Feb 2024 18:05:14 +0000 Received: from VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::935e:b3a1:b0fd:99ac]) by VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::935e:b3a1:b0fd:99ac%4]) with mapi id 15.20.7249.035; Wed, 7 Feb 2024 18:05:14 +0000 Message-ID: <27777234-0335-4ef1-bc2b-34324d335e30@arm.com> Date: Wed, 7 Feb 2024 18:05:12 +0000 User-Agent: Mozilla Thunderbird Subject: Re: [FYI/pushed v4 08/25] Thread options & clone events (Linux GDBserver) Content-Language: en-US To: Simon Marchi , Tom Tromey Cc: Pedro Alves , gdb-patches@sourceware.org, Andrew Burgess References: <20231113150427.477431-1-pedro@palves.net> <20231113150427.477431-9-pedro@palves.net> <87eddpej3r.fsf@tromey.com> <2e61811c-ff0f-44d0-bf6f-e98a9de87c33@arm.com> <87mssccmb3.fsf@tromey.com> From: Luis Machado In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P123CA0139.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:193::18) To VI1PR08MB3919.eurprd08.prod.outlook.com (2603:10a6:803:c4::31) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: VI1PR08MB3919:EE_|GV1PR08MB10838:EE_|DB3PEPF0000885A:EE_|PAXPR08MB6334:EE_ X-MS-Office365-Filtering-Correlation-Id: d1226845-9beb-43e0-9181-08dc28075c21 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: hfsCeGHM8+KEqmtea17mk9udONO4ElvBUZ5cqZV64Us3o6B9WRPSjoXeYuLDdElMSNTUStT5NzZKJqjvuduZxFc0kOuzuiCRXN57rFMGTkg0QIi554f9iczD/BhbOQJZfopIy1mKk7dUd5xNYBTKgBE6HyES0DsH7itH2K1YiJph/Y7Rz31c9OH57jvUGnu0wKDvSDoItALYWBExUnBKCawIRb9WFkVZUVAzviQKiM0Cs+YvEwUDY67x2X0tJQGaOmUgOZTNUX3VWgVx5z1WPhOsKZOrj+6+DN5JsghZdN88nAuHqnHonaFjmkuryiOLYYfvuBEzhXc4/d45qWzM1hi/wwvp4ZqknROJxvn244uQLjh4zvIimQnpw5tO/XZhaQhkegwA0dKTit6E9iozfYLunvAPanxT8Ey29dAs3CWvwYmBFeT2n6qnPTulDL9NzXlw07U0ICUE+NX2bW0Z3c+SIX4MBqvla69DnE2T9eqzauOI9j8D5PHEKFpgiiC29PNBrXB01LxEgVQ98Cn/BkQmU27Z/JjRHNnP0rIwxQepE4cWoUVudoQekIW3c/KUsYC2oRBj4/aI1huOw5Zo+rWGDkIyU+pyGgOmJoY7Mg0gM0P/+0vgYtkoU5mU2wGKN2MXfin+lEMq1Qz+K7I+uQ== 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)(376002)(136003)(39860400002)(366004)(346002)(396003)(230922051799003)(186009)(1800799012)(451199024)(64100799003)(31696002)(54906003)(86362001)(44832011)(4326008)(8676002)(316002)(6486002)(66476007)(66946007)(110136005)(66556008)(478600001)(2906002)(5660300002)(38100700002)(83380400001)(6512007)(53546011)(6506007)(2616005)(26005)(8936002)(66899024)(36756003)(41300700001)(31686004)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR08MB10838 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: DB3PEPF0000885A.eurprd02.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: fbd8082f-81e5-48a3-c6b3-08dc2807557a X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5V8G/ojX3t9eu3lZOcje8HUiZ2cjzLB3oPLoWa+blRsyg+RE9B7qen2FJMOwix1vUDuSbzDyexn65KcXyuyfu61vc1IUfp2kjTYMGeRci/awvM2OS6swxDjRNW0XrAOEq6qaQzymTZ3uZPGFhu4dKOLHo7ebmmgDw3+aYgkyvwew/mxAS2WEOzI6y4PfQ1c1ucwtiVmUf3cnheoJNNtQ8SFzTVIjiLfedY0nO4z3I+MJuqIqXNW7Zm8d336IOzUplWADWQhoeEKppFMHhXiYDo6/qmtRqxzAWv2BxeTwp0oNRdZi2G29WzwHTsJRrULUwePRCyIhhUaM3jgf+eByD5GDXOciPJq2En5QlFkDtr03dKQ0x513DyCpvbaHBBcV5+AC5aa1QkFavSuMkZDGBXQF6r+SKevchJ3IIA4aRJcpxgC0VV7jDO1M+wp/4VsPiUeSOIOO+l/yy32LQ95v/My27QOQvyTM60ISua7eoMVlOzXTxiBnx6X2wvLlJq4Duld5rElJQdBWdZCWmcBlR1dW5QAHvkgoPDscZUrlGzg4g7PCgAcyyn7E9/vB74/yMC2TU3TdUEBoAIk6FJJ1uEk2Gwjw9Z6wGyC1zZJnAqGZ6+bKpoiRXuO1sy2XR6F3YM21G9j2FvQ/BgX8shwhQvJq56Huf/0afqIHqzVIWo+AW9RTdr4vHkBSaM3u+rZgrSlqa2pe1i4091YgwxxE1tdzfmYVtaRsNPN8hGlbDkCL07DY84jup5c/vBLkDm16tgWxV77PYaW6JWSijPlDDw== 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)(346002)(39860400002)(376002)(136003)(396003)(230922051799003)(64100799003)(1800799012)(82310400011)(186009)(451199024)(36840700001)(40470700004)(46966006)(41300700001)(66899024)(47076005)(8936002)(86362001)(8676002)(4326008)(31696002)(336012)(44832011)(6512007)(107886003)(6486002)(478600001)(5660300002)(36756003)(6506007)(2616005)(70206006)(110136005)(54906003)(316002)(26005)(53546011)(70586007)(83380400001)(40460700003)(40480700001)(31686004)(36860700001)(356005)(81166007)(2906002)(82740400003)(43740500002);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Feb 2024 18:05:25.5353 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d1226845-9beb-43e0-9181-08dc28075c21 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: DB3PEPF0000885A.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR08MB6334 X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,FORGED_SPF_HELO,GIT_PATCH_0,KAM_DMARC_NONE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY 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: Replying to both Tom's and Simon's comments. On 2/7/24 17:10, Simon Marchi wrote: > On 2/7/24 10:43, Tom Tromey wrote: >>>>>>> "Luis" == Luis Machado writes: >> >> Luis> But find_process_pid returns nullptr. I wonder if it is one of those cases >> Luis> where we have to deal with the tid rather than the pid. >> >> Luis> Does this look like the same case you were chasing? >> >> Yes. The issue is that the new inferior isn't created until after the >> new thread -- but the order can't really be reversed in the caller. >> I see. Is this logic expected? Naturally I'd expect a process to exist before a thread can exist. I haven't followed the patch series closely though, so there may be a reason for it. >> I've appended the patch. I put off sending it because for internal >> reasons it hasn't been through the AdaCore automated testing yet. >> However, I did test it (using the AdaCore test suite -- not gdb's) >> myself. >> >> Let me know what you think. It does fix the regressions I was seeing, but Simon made some good points as well. >> >> Tom >> >> commit 5464152cb1145bc1df108eb6904a642d8bc73b8c >> Author: Tom Tromey >> Date: Mon Feb 5 13:18:51 2024 -0700 >> >> Fix crash in aarch64-linux gdbserver >> >> We noticed that aarch64-linux gdbserver will crash when the inferior >> vforks. This happens in aarch64_get_debug_reg_state: >> >> struct process_info *proc = find_process_pid (pid); >> >> return &proc->priv->arch_private->debug_reg_state; >> >> Here, find_process_pid returns nullptr -- the new inferior hasn't yet >> been created in linux_process_target::handle_extended_wait. >> >> This patch fixes the problem by having aarch64_get_debug_reg_state >> return nullptr in this case, and then updating >> aarch64_linux_new_thread to check for this. >> >> diff --git a/gdb/nat/aarch64-linux.c b/gdb/nat/aarch64-linux.c >> index 5ebbc9b81f8..894de8aa3eb 100644 >> --- a/gdb/nat/aarch64-linux.c >> +++ b/gdb/nat/aarch64-linux.c >> @@ -81,9 +81,9 @@ aarch64_linux_new_thread (struct lwp_info *lwp) >> /* If there are hardware breakpoints/watchpoints in the process then mark that >> all the hardware breakpoint/watchpoint register pairs for this thread need >> to be initialized (with data from aarch_process_info.debug_reg_state). */ >> - if (aarch64_any_set_debug_regs_state (state, false)) >> + if (state == nullptr || aarch64_any_set_debug_regs_state (state, false)) >> DR_MARK_ALL_CHANGED (info->dr_changed_bp, aarch64_num_bp_regs); >> - if (aarch64_any_set_debug_regs_state (state, true)) >> + if (state == nullptr || aarch64_any_set_debug_regs_state (state, true)) >> DR_MARK_ALL_CHANGED (info->dr_changed_wp, aarch64_num_wp_regs); > > I don't really understand all of this, but I'm wondering if the > condition should be: > > if (state != nullptr && aarch64_any_set_debug_regs_state (state, ...)) > > If we have no existing aarch64_debug_reg_state, do we really need to > mark the breakpoints as needing to be updated? > I think as long as we have a thread, we should always have the state for the debug registers, so changing the approach to always initialize the state if there isn't one seems reasonable. See below. >> lwp_set_arch_private_info (lwp, info); >> diff --git a/gdbserver/linux-aarch64-low.cc b/gdbserver/linux-aarch64-low.cc >> index 28d75d035dc..2a4f01a54da 100644 >> --- a/gdbserver/linux-aarch64-low.cc >> +++ b/gdbserver/linux-aarch64-low.cc >> @@ -403,7 +403,8 @@ struct aarch64_debug_reg_state * >> aarch64_get_debug_reg_state (pid_t pid) >> { >> struct process_info *proc = find_process_pid (pid); >> - >> + if (proc == nullptr) >> + return nullptr; >> return &proc->priv->arch_private->debug_reg_state; >> } > > I was wondering if the GDB version of this function needed to get > updated too. It works differently: > > /* See aarch64-nat.h. */ > > struct aarch64_debug_reg_state * > aarch64_get_debug_reg_state (pid_t pid) > { > return &aarch64_debug_process_state[pid]; > } > > Here, aarch64_debug_process_state is an unordered_map aarch64_debug_reg_state>, meaning that if pid isn't currently in the > map, a default aarch64_debug_reg_state will be constructed (is it going > to be initialized properly?). > > So we end up with two different semantics for the two versions of the > function, which might become a source of confusion later. And it would sync the behavior from gdb nat and gdbserver nat layers. I can put together a patch to do that. I wasn't aware there was this discrepancy between gdb and gdbserver. > > Simon