From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150078.outbound.protection.outlook.com [40.107.15.78]) by sourceware.org (Postfix) with ESMTPS id 44B623858D28 for ; Tue, 20 Sep 2022 07:44:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 44B623858D28 ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=JNjDCZ2GAXviRRcwTR/QMxRtnStoqJos+D/Nj9imGmYpXIPf85WtLIwAKurnNzsKfAZAEecv1xdgMRCRX9NEqv2GQhLgIY7lnX81W+UW9o2B/7Np0a4GgZznwUs13wi4qT63untyQ5Lfszrns7Ppn8p8nhrZGZU+sXzKwVrXuouS7/AQM6EAy95/VvNisiGvmoVle3+WdsrSCaJPpe4u6zIrMpZbC3JNe9K2+AiuoVtO8t5d4J7J/KGcZPMKqNc5bs6iLfojJ+7uCNhMKs/UI82N1db6ej6JHT5Qd/iNyOlSVqAeR/7rEHUblYR3jOd26qX/ojrYO2i3fthqmSjpEQ== 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=YkQNNDISYOGPTz9zpHGfzMTctLtFAIwEuc0JHoRNwTg=; b=oEZPC1rUpyGn5Vp76rr0Lo8+xqdkzKlje0gYTjsGJVMhvLWIxvkumqPyz/LORYcX5kzs7XBYcqW81Y1YCoQtQ/qCCG2zip81bxt0dyXYJbwTVT9puXX7fEaANSEgpNt0nj2YDpVRO5/ZtkKUZAKoaMkqF85Yx8NN4rcBZLnE4YWs5gZBIYkPiLfwBW7MXrEeDUVyYGw38ITukMgkUcdFmzugzejFlDbGcMD2tNAGyvzhsy43S4ZEoD2olr55rZimmnOIgFEncnMbPJSsUOecGvp1RJkBWLbiX0WFgZspv3bV1aTDpieZryFxKwIwQMLezKKcZt7613cFbq5JfDRjOA== 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]) Received: from AM6P192CA0076.EURP192.PROD.OUTLOOK.COM (2603:10a6:209:8d::17) by DBBPR08MB6105.eurprd08.prod.outlook.com (2603:10a6:10:20d::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.14; Tue, 20 Sep 2022 07:43:58 +0000 Received: from AM7EUR03FT065.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:8d:cafe::2a) by AM6P192CA0076.outlook.office365.com (2603:10a6:209:8d::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5632.15 via Frontend Transport; Tue, 20 Sep 2022 07:43:57 +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 AM7EUR03FT065.mail.protection.outlook.com (100.127.140.250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5632.12 via Frontend Transport; Tue, 20 Sep 2022 07:43:57 +0000 Received: ("Tessian outbound 0a0431bdcdb4:v124"); Tue, 20 Sep 2022 07:43:57 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: a376768b6f539e5c X-CR-MTA-TID: 64aa7808 Received: from ee68caafc4f9.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 1FE566DD-2397-4938-B595-1E87739CC513.1; Tue, 20 Sep 2022 07:43:50 +0000 Received: from EUR01-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id ee68caafc4f9.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 20 Sep 2022 07:43:50 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LMgqc/W/7EKx7qA9eq2X0ZIZHlcjswAFO83Fr/P9PoUnjqleIOWGc6IboRFwHzlwz0H3oq9niOK4/NdX65pUWAA0DBqvep3dKicbqPdTLQglKZRHaRBOOz4SRYFZvMLz9EkY8i/HCgjX4V0i4IpIyNzulCSZaTkwQb7gLsf8stYAPLc6JOzgJvZw6QLgfO/Ie189FTfOqNovIk5+wZtik1lDJbb1TLGC2Pb4mDfo0d3LcnOKmdDqfDVhOC1bbtAZqmTIldiDrlXNv9T5T6l+HVM5NKxNMkDJVuASKgCKFmfCf53wgBBgx2sIQwIGW63IrLVCdoaQRCuVV2DAUugr6w== 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=YkQNNDISYOGPTz9zpHGfzMTctLtFAIwEuc0JHoRNwTg=; b=KZ0VLFxSZ63WCiu0Pbg5N9N76yMNV9zh935n9ZOjau1vgFTYOMOhNlibuqCiWHFWaqTBs2ithrlN64gcFThp6NTQ0l/lcBYWhGEV4MB+b2AkqAUdpGlF7tPSb+dfTUdHhNyy18kaX8Ilq8hQBSAD/7YSzzHfhBuQs5PtYOp4/9qC5aNRJkK+oWW/acTqtNLLOQp9zug2uHoDmbAqQa09ThtTMCzi02OLuH0JO8AAA3eC4ZcfBJggVLYmGiNPXSV7POX1Reulv6P8+dYvSAtUx4s9M9lFMGTv6intyv4A5hOeYcmL8pDSaeM1RUMefHQs8T/+sCfDrKzz2AqMSo8RDw== 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 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 AS2PR08MB8262.eurprd08.prod.outlook.com (2603:10a6:20b:551::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5632.21; Tue, 20 Sep 2022 07:43:47 +0000 Received: from VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::c5f9:a25b:a5f2:6094]) by VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::c5f9:a25b:a5f2:6094%5]) with mapi id 15.20.5632.021; Tue, 20 Sep 2022 07:43:47 +0000 Message-ID: <07552f1c-85bf-0a09-0656-15790248c036@arm.com> Date: Tue, 20 Sep 2022 08:43:46 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH 2/8] gdbserver: Add thread parameter to linux_get_auxv and linux_get_hwcap Content-Language: en-US To: Thiago Jung Bauermann , gdb-patches@sourceware.org References: <20220908064151.3959930-1-thiago.bauermann@linaro.org> <20220908064151.3959930-3-thiago.bauermann@linaro.org> From: Luis Machado In-Reply-To: <20220908064151.3959930-3-thiago.bauermann@linaro.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P265CA0062.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:2af::18) To VI1PR08MB3919.eurprd08.prod.outlook.com (2603:10a6:803:c4::31) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: VI1PR08MB3919:EE_|AS2PR08MB8262:EE_|AM7EUR03FT065:EE_|DBBPR08MB6105:EE_ X-MS-Office365-Filtering-Correlation-Id: cb901c2b-22fb-428d-75e5-08da9adbe046 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: rY4pwFi9iNwXQfYNFQfo+hY56T0JgCBfjHaJR5+B4LojgyDZX3vRV7zEZqtLUmebcI0sTemTNLUuPZ9xRujD59tOj0pfiidy6DpKybKJl7aVhQU0PaOfrIUyj0+op3TuBHnJZJmyAy2VwMoDs9x8qJNX+djXe1OdzEnp5hKFpsi0W4KPI5oylAkmgONlJFn9aq5PcmtSFJ6eSUGwIdcnxoSFEAmZ4l7nJRaqPiYCW9LaDMNWxo2aZN6XBUm6wgSLPS3I5Th3Dvv2BEBZT5eb48bdLMyuJbLmVPHIU3vMHQor5dPJaO3tdlJ7gz7IfGtzxNxdd9hOocb0MUvVKkVKdJATTnamKsWQRlzumvpPvYAcFK5yUp+exjXzZ6rZkuopQ+irISJzsIc5U/8IgKmz2GEiQF3btgVtgqfs9H1u54CFg3Di/3yc78W0eqXOPc5eNR//qf78qahLQ/pWvWJjhMPW9v4y1/3Dtcy4v4mygwmPpY41K8nyyDo8j4ol8BFp2/OIXKIEYTtk300dwnHIuK8N5hDedbG5ViHdlYTxaFclnaBnFXedeSi1gUIQ/mZbsKhMDtFaQ2z8q38W4pyIEhN9PMFpyRNkwH0Suocu1KHEdL2J/Hd1/m29D5694QwHhhGn08V4hgHiR8oX/QrrUj5pJpYoYchmQtq1mDjm/v8DfaFCGNo3GSH9sBrTst7JXQuMap3R2wu3z7yOAkqH2JBVTLjhfOjr1QO0aMHwoz/WAx5kpTF+i4N/urFrUvUBlLG3jrARU9g3OIuj7GVu1qtGy+KN+PGGXPrI9c1SUpI= 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:(13230022)(4636009)(346002)(396003)(136003)(376002)(366004)(39860400002)(451199015)(31686004)(38100700002)(6512007)(26005)(31696002)(6506007)(8676002)(30864003)(44832011)(2906002)(2616005)(66946007)(53546011)(41300700001)(186003)(5660300002)(36756003)(478600001)(86362001)(8936002)(66556008)(66476007)(83380400001)(6486002)(316002)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS2PR08MB8262 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: AM7EUR03FT065.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 87c344a1-36d9-44c6-ad4e-08da9adbd9e6 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PRPQBAf4XUxYpw0gZga/hD/B1REVpkoV3sJz8LXGzoh4LnAlBeof1mgKuPtOhoaJfwwwwTDz/gLhyqiTK+bYkvC7MkDqurqmHSZ7MyTppA0UNuchFnwUdYUmonM4p1HS/nMTiHjpadha0E7KOvztiIeuNpM8jIvhXdfIwWsDt1DP5Mk2xokAETiGBZHXsiUqaJSjoFc/atBZCDq8L/4ua8x0bhoztwkxbD5qnf/QcQmU0DQ3oG/fAZ2j0POODnX54IKGcc+g6Tw1vSw6oJRjRieNs25CzNdw1HTWW5EaDRq78RQ7gp6Od58f8/sRk/ltqs8o3OSMm7k+MObToUOzlDZ1JZkZ9zIC/Vbe6P+kb0decoOG4h34IGu80g6zfinDYj3xK4OD6k5mgGftw5yhn6/HvTPME+SDD2fMREPeSdpsonjDYanlcNU6BJvh247AQCGRDFTfIrcwBLlQSlM/CRk850C2JUA2BoMPU0qLzAcIVhgYShUdZpNYXeidqlDuPaQbiRDXQ7jSWQVK7TyzP8Ck10zuNGw07d/iss3P3EaGqz9kgS8V9T88W5BQzyIfh7Y5k1KsJlBsLBWzZFlRroS3zXW5jCQGYppkVVb7EkSprli1yJBZPuaHp91cA79IQ+vc1F+nMcKRmEkW7sj3mER/oye2fVb5hyNbgHQOLfVK2AcnEb8S/BlhmTexebsS6Dksi0epBtoxACeb/tF+bxyoRg30r10twpxdQ/PBSbX/4tl+yhwgR7Rtk7p8nPCbCretTkmv/Fj9I4fiPvEn3zlHuRhkddks5nEeg/tlBQQGzOxHBD/Unlun1ghMcT0q 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:(13230022)(4636009)(346002)(376002)(136003)(396003)(39860400002)(451199015)(40470700004)(46966006)(36840700001)(36860700001)(30864003)(31686004)(40460700003)(478600001)(36756003)(6486002)(70586007)(70206006)(41300700001)(8676002)(86362001)(6506007)(53546011)(31696002)(82310400005)(356005)(8936002)(81166007)(26005)(40480700001)(336012)(83380400001)(5660300002)(6512007)(82740400003)(316002)(186003)(47076005)(2616005)(44832011)(2906002)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Sep 2022 07:43:57.6794 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cb901c2b-22fb-428d-75e5-08da9adbe046 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: AM7EUR03FT065.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB6105 X-Spam-Status: No, score=-13.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_NONE, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP, 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 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Sep 2022 07:44:09 -0000 On 9/8/22 07:41, Thiago Jung Bauermann via Gdb-patches wrote: > This patch doesn't change gdbserver behaviour, but after later changes are > made it avoids a null pointer dereference when HWCAP needs to be obtained > for a specific process while current_thread is nullptr. > > Fixing linux_read_auxv, linux_get_hwcap and linux_get_hwcap2 to take a > thread_info parameter seems more correct than setting current_thread in one > particular code path. > > Changes are propagated to allow passing the thread parameter through the > call chain. I suppose the effects will only be known when later patches are applied. But the auxv data is per-process, right? It sounds a bit strange to pass a thread for the hwcap/auxv lookup. Is there some other reason to do that? > --- > gdbserver/linux-aarch64-low.cc | 6 +++--- > gdbserver/linux-arm-low.cc | 2 +- > gdbserver/linux-low.cc | 20 +++++++++++--------- > gdbserver/linux-low.h | 10 +++++----- > gdbserver/linux-ppc-low.cc | 6 +++--- > gdbserver/linux-s390-low.cc | 2 +- > gdbserver/netbsd-low.cc | 4 ++-- > gdbserver/netbsd-low.h | 4 ++-- > gdbserver/server.cc | 2 +- > gdbserver/target.cc | 4 ++-- > gdbserver/target.h | 4 ++-- > 11 files changed, 33 insertions(+), 31 deletions(-) > > diff --git a/gdbserver/linux-aarch64-low.cc b/gdbserver/linux-aarch64-low.cc > index db5086962612..5d4d667dfa42 100644 > --- a/gdbserver/linux-aarch64-low.cc > +++ b/gdbserver/linux-aarch64-low.cc > @@ -826,9 +826,9 @@ aarch64_target::low_arch_setup () > > features.vq = aarch64_sve_get_vq (tid); > /* A-profile PAC is 64-bit only. */ > - features.pauth = linux_get_hwcap (8) & AARCH64_HWCAP_PACA; > + features.pauth = linux_get_hwcap (current_thread, 8) & AARCH64_HWCAP_PACA; > /* A-profile MTE is 64-bit only. */ > - features.mte = linux_get_hwcap2 (8) & HWCAP2_MTE; > + features.mte = linux_get_hwcap2 (current_thread, 8) & HWCAP2_MTE; > features.tls = true; > > current_process ()->tdesc = aarch64_linux_read_description (features); > @@ -3299,7 +3299,7 @@ aarch64_target::supports_memory_tagging () > #endif > } > > - return (linux_get_hwcap2 (8) & HWCAP2_MTE) != 0; > + return (linux_get_hwcap2 (current_thread, 8) & HWCAP2_MTE) != 0; > } > > bool > diff --git a/gdbserver/linux-arm-low.cc b/gdbserver/linux-arm-low.cc > index ab6209a3abc8..d40ce412fe1c 100644 > --- a/gdbserver/linux-arm-low.cc > +++ b/gdbserver/linux-arm-low.cc > @@ -958,7 +958,7 @@ get_next_pcs_syscall_next_pc (struct arm_get_next_pcs *self) > static const struct target_desc * > arm_read_description (void) > { > - unsigned long arm_hwcap = linux_get_hwcap (4); > + unsigned long arm_hwcap = linux_get_hwcap (current_thread, 4); > > if (arm_hwcap & HWCAP_IWMMXT) > return arm_linux_read_description (ARM_FP_TYPE_IWMMXT); > diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc > index 2f71360d3bde..9034a1d8fabe 100644 > --- a/gdbserver/linux-low.cc > +++ b/gdbserver/linux-low.cc > @@ -5486,12 +5486,12 @@ linux_process_target::supports_read_auxv () > to debugger memory starting at MYADDR. */ > > int > -linux_process_target::read_auxv (CORE_ADDR offset, unsigned char *myaddr, > - unsigned int len) > +linux_process_target::read_auxv (const thread_info *thread, CORE_ADDR offset, > + unsigned char *myaddr, unsigned int len) > { > char filename[PATH_MAX]; > int fd, n; > - int pid = lwpid_of (current_thread); > + int pid = lwpid_of (thread); > > xsnprintf (filename, sizeof filename, "/proc/%d/auxv", pid); > > @@ -6912,14 +6912,16 @@ linux_get_pc_64bit (struct regcache *regcache) > /* See linux-low.h. */ > > int > -linux_get_auxv (int wordsize, CORE_ADDR match, CORE_ADDR *valp) > +linux_get_auxv (const thread_info *thread, int wordsize, CORE_ADDR match, > + CORE_ADDR *valp) > { > gdb_byte *data = (gdb_byte *) alloca (2 * wordsize); > int offset = 0; > > gdb_assert (wordsize == 4 || wordsize == 8); > > - while (the_target->read_auxv (offset, data, 2 * wordsize) == 2 * wordsize) > + while (the_target->read_auxv (thread, offset, data, 2 * wordsize) > + == 2 * wordsize) > { > if (wordsize == 4) > { > @@ -6949,20 +6951,20 @@ linux_get_auxv (int wordsize, CORE_ADDR match, CORE_ADDR *valp) > /* See linux-low.h. */ > > CORE_ADDR > -linux_get_hwcap (int wordsize) > +linux_get_hwcap (const thread_info *thread, int wordsize) > { > CORE_ADDR hwcap = 0; > - linux_get_auxv (wordsize, AT_HWCAP, &hwcap); > + linux_get_auxv (thread, wordsize, AT_HWCAP, &hwcap); > return hwcap; > } > > /* See linux-low.h. */ > > CORE_ADDR > -linux_get_hwcap2 (int wordsize) > +linux_get_hwcap2 (const thread_info *thread, int wordsize) > { > CORE_ADDR hwcap2 = 0; > - linux_get_auxv (wordsize, AT_HWCAP2, &hwcap2); > + linux_get_auxv (thread, wordsize, AT_HWCAP2, &hwcap2); > return hwcap2; > } > > diff --git a/gdbserver/linux-low.h b/gdbserver/linux-low.h > index 79be31b8f729..bd1ec31dc5a4 100644 > --- a/gdbserver/linux-low.h > +++ b/gdbserver/linux-low.h > @@ -178,8 +178,8 @@ class linux_process_target : public process_stratum_target > > bool supports_read_auxv () override; > > - int read_auxv (CORE_ADDR offset, unsigned char *myaddr, > - unsigned int len) override; > + int read_auxv (const thread_info *thread, CORE_ADDR offset, > + unsigned char *myaddr, unsigned int len) override; > > int insert_point (enum raw_bkpt_type type, CORE_ADDR addr, > int size, raw_breakpoint *bp) override; > @@ -944,17 +944,17 @@ extern int have_ptrace_getregset; > *VALP and return 1. If not found or if there is an error, return > 0. */ > > -int linux_get_auxv (int wordsize, CORE_ADDR match, > +int linux_get_auxv (const thread_info *thread, int wordsize, CORE_ADDR match, > CORE_ADDR *valp); > > /* Fetch the AT_HWCAP entry from the auxv vector, where entries are length > WORDSIZE. If no entry was found, return zero. */ > > -CORE_ADDR linux_get_hwcap (int wordsize); > +CORE_ADDR linux_get_hwcap (const thread_info *thread, int wordsize); > > /* Fetch the AT_HWCAP2 entry from the auxv vector, where entries are length > WORDSIZE. If no entry was found, return zero. */ > > -CORE_ADDR linux_get_hwcap2 (int wordsize); > +CORE_ADDR linux_get_hwcap2 (const thread_info *thread, int wordsize); > > #endif /* GDBSERVER_LINUX_LOW_H */ > diff --git a/gdbserver/linux-ppc-low.cc b/gdbserver/linux-ppc-low.cc > index 08824887003b..08608b2dcc38 100644 > --- a/gdbserver/linux-ppc-low.cc > +++ b/gdbserver/linux-ppc-low.cc > @@ -894,8 +894,8 @@ ppc_target::low_arch_setup () > > /* The value of current_process ()->tdesc needs to be set for this > call. */ > - ppc_hwcap = linux_get_hwcap (features.wordsize); > - ppc_hwcap2 = linux_get_hwcap2 (features.wordsize); > + ppc_hwcap = linux_get_hwcap (current_thread, features.wordsize); > + ppc_hwcap2 = linux_get_hwcap2 (current_thread, features.wordsize); > > features.isa205 = ppc_linux_has_isa205 (ppc_hwcap); > > @@ -1097,7 +1097,7 @@ is_elfv2_inferior (void) > const struct target_desc *tdesc = current_process ()->tdesc; > int wordsize = register_size (tdesc, 0); > > - if (!linux_get_auxv (wordsize, AT_PHDR, &phdr)) > + if (!linux_get_auxv (current_thread, wordsize, AT_PHDR, &phdr)) > return def_res; > > /* Assume ELF header is at the beginning of the page where program headers > diff --git a/gdbserver/linux-s390-low.cc b/gdbserver/linux-s390-low.cc > index 5adc28070574..0d01dffa64a4 100644 > --- a/gdbserver/linux-s390-low.cc > +++ b/gdbserver/linux-s390-low.cc > @@ -592,7 +592,7 @@ s390_target::low_arch_setup () > /* Determine word size and HWCAP. */ > int pid = pid_of (current_thread); > int wordsize = s390_get_wordsize (pid); > - unsigned long hwcap = linux_get_hwcap (wordsize); > + unsigned long hwcap = linux_get_hwcap (current_thread, wordsize); > > /* Check whether the kernel supports extra register sets. */ > int have_regset_last_break > diff --git a/gdbserver/netbsd-low.cc b/gdbserver/netbsd-low.cc > index f05bcd4e173f..71ac61e9dfbd 100644 > --- a/gdbserver/netbsd-low.cc > +++ b/gdbserver/netbsd-low.cc > @@ -581,10 +581,10 @@ netbsd_read_auxv(pid_t pid, void *offs, void *addr, size_t len) > to debugger memory starting at MYADDR. */ > > int > -netbsd_process_target::read_auxv (CORE_ADDR offset, > +netbsd_process_target::read_auxv (const thread_info *thread, CORE_ADDR offset, > unsigned char *myaddr, unsigned int len) > { > - pid_t pid = pid_of (current_thread); > + pid_t pid = pid_of (thread); > > return netbsd_read_auxv (pid, (void *) (intptr_t) offset, myaddr, len); > } > diff --git a/gdbserver/netbsd-low.h b/gdbserver/netbsd-low.h > index 06b4fd613571..506329251eaf 100644 > --- a/gdbserver/netbsd-low.h > +++ b/gdbserver/netbsd-low.h > @@ -77,8 +77,8 @@ class netbsd_process_target : public process_stratum_target > > bool supports_read_auxv () override; > > - int read_auxv (CORE_ADDR offset, unsigned char *myaddr, > - unsigned int len) override; > + int read_auxv (const thread_info *thread, CORE_ADDR offset, > + unsigned char *myaddr, unsigned int len) override; > > bool supports_hardware_single_step () override; > > diff --git a/gdbserver/server.cc b/gdbserver/server.cc > index c619206d5d2d..2d5cf6e8d8de 100644 > --- a/gdbserver/server.cc > +++ b/gdbserver/server.cc > @@ -1443,7 +1443,7 @@ handle_qxfer_auxv (const char *annex, > if (annex[0] != '\0' || current_thread == NULL) > return -1; > > - return the_target->read_auxv (offset, readbuf, len); > + return the_target->read_auxv (current_thread, offset, readbuf, len); > } > > /* Handle qXfer:exec-file:read. */ > diff --git a/gdbserver/target.cc b/gdbserver/target.cc > index adcfe6e7bcc7..7ee18bde8635 100644 > --- a/gdbserver/target.cc > +++ b/gdbserver/target.cc > @@ -344,8 +344,8 @@ process_stratum_target::supports_read_auxv () > } > > int > -process_stratum_target::read_auxv (CORE_ADDR offset, unsigned char *myaddr, > - unsigned int len) > +process_stratum_target::read_auxv (const thread_info *thread, CORE_ADDR offset, > + unsigned char *myaddr, unsigned int len) > { > gdb_assert_not_reached ("target op read_auxv not supported"); > } > diff --git a/gdbserver/target.h b/gdbserver/target.h > index 6c536a307786..cd6b2193a228 100644 > --- a/gdbserver/target.h > +++ b/gdbserver/target.h > @@ -175,8 +175,8 @@ class process_stratum_target > /* Read auxiliary vector data from the inferior process. > > Read LEN bytes at OFFSET into a buffer at MYADDR. */ > - virtual int read_auxv (CORE_ADDR offset, unsigned char *myaddr, > - unsigned int len); > + virtual int read_auxv (const thread_info *thread, CORE_ADDR offset, > + unsigned char *myaddr, unsigned int len); > > /* Returns true if GDB Z breakpoint type TYPE is supported, false > otherwise. The type is coded as follows: