From patchwork Fri Mar 31 03:44:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thiago Jung Bauermann X-Patchwork-Id: 67139 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 641F73858025 for ; Fri, 31 Mar 2023 03:45:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 641F73858025 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1680234323; bh=6hOUks+PY139xOuZ6hs8NiNxdF1K9PGzSaM7Gazwgws=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=vDAy8H8goAy+UojAR0Etqv8jBkQGvp8KEBohZyNx+PLt42RvdGq35CJ37gue2namw MGrnv2p9NSsGNvKJ5LzKQCkXMK8RqG3+RsSwjcBNfawIjG+jFS5FWU75yY61DEy1a6 cJ8LxOwC/MgLWn8NMONKWRUcFV7q9LxDleAszLEI= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-ot1-x329.google.com (mail-ot1-x329.google.com [IPv6:2607:f8b0:4864:20::329]) by sourceware.org (Postfix) with ESMTPS id A824D3858D38 for ; Fri, 31 Mar 2023 03:44:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A824D3858D38 Received: by mail-ot1-x329.google.com with SMTP id 61-20020a9d02c3000000b0069fe8de3139so11217450otl.1 for ; Thu, 30 Mar 2023 20:44:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680234297; x=1682826297; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6hOUks+PY139xOuZ6hs8NiNxdF1K9PGzSaM7Gazwgws=; b=yxJDK2SIbVjYBhCoRuMH7xP3EgKuLYuQ4VZ4dhwiJvOGmkbeJP3X6HR2KCuYyAa0yW IVGYOmYBXITegEqFLKn3AhuMnHCdkPTevap6XGauJEUOe/UkyhaUC5Y7bQt07AmRAFhT o6TDh6HXTZ5ctw0LjkxMKZyFfd7cBEzzVVpHtG49N/nqBGKt9WPrpIzj8QjmfBaPayP9 a7yvCxeXG6GImq94BDanWsloU7M75/0k+vc6RTXK4edeytSwdloHCKqKh8jgmrVQY6s9 EkyNmDulclh8HOWgxQTTr+FEt29j5bYOgTV4wo56bbb66qfKGbVulqf+R8FlvM4Pv87M MtvA== X-Gm-Message-State: AO0yUKUIdyznEC1pYZgLJlLGeHe1odqbF/IUxTo8hEpVQM57CGPRxH+X dz7k4DVZ3xgB6fOEl8C27RUDifTiQdEojhn/hsI= X-Google-Smtp-Source: AK7set9uEmuhd7ZaAbZEti2L1ssY8y49NapI4UIXuoA4wq6LOKsCdC2151r7HwEisAqgdTRQ+p0EYw== X-Received: by 2002:a9d:7dc9:0:b0:69f:d2:4ff9 with SMTP id k9-20020a9d7dc9000000b0069f00d24ff9mr13080780otn.34.1680234296986; Thu, 30 Mar 2023 20:44:56 -0700 (PDT) Received: from localhost ([177.124.15.55]) by smtp.gmail.com with ESMTPSA id l6-20020a0568301d6600b0069fa6ca584bsm691664oti.40.2023.03.30.20.44.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Mar 2023 20:44:56 -0700 (PDT) To: gdb-patches@sourceware.org Cc: Thiago Jung Bauermann , Pedro Alves Subject: [PATCH 1/5] gdbserver: Use current_process in handle_qxfer_auxv Date: Fri, 31 Mar 2023 03:44:28 +0000 Message-Id: <20230331034432.3037148-2-thiago.bauermann@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230331034432.3037148-1-thiago.bauermann@linaro.org> References: <20230331034432.3037148-1-thiago.bauermann@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, 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 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-Patchwork-Original-From: Thiago Jung Bauermann via Gdb-patches From: Thiago Jung Bauermann Reply-To: Thiago Jung Bauermann Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" Commit 43e5fbd8b788 ("gdbserver: Add PID parameter to linux_get_auxv and linux_get_hwcap") changed the functions for reading auxv from using current_thread to accepting a PID argument. Pedro then suggested: "Since we're removing the thread dependency, I think that check should be replaced by current_process() == NULL instead". This patch implements his suggestion. Suggested-by: Pedro Alves --- gdbserver/server.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gdbserver/server.cc b/gdbserver/server.cc index 949849b63a2d..b6786baafadd 100644 --- a/gdbserver/server.cc +++ b/gdbserver/server.cc @@ -1445,11 +1445,10 @@ handle_qxfer_auxv (const char *annex, if (!the_target->supports_read_auxv () || writebuf != NULL) return -2; - if (annex[0] != '\0' || current_thread == NULL) + if (annex[0] != '\0' || current_process () == nullptr) return -1; - return the_target->read_auxv (current_thread->id.pid (), offset, readbuf, - len); + return the_target->read_auxv (current_process ()->pid, offset, readbuf, len); } /* Handle qXfer:exec-file:read. */