From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id GLtSL8vHdGCVIQAAWB0awg (envelope-from ) for ; Mon, 12 Apr 2021 18:20:59 -0400 Received: by simark.ca (Postfix, from userid 112) id BE7501F104; Mon, 12 Apr 2021 18:20:59 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 0F6541F0FE for ; Mon, 12 Apr 2021 18:20:55 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 867093899435; Mon, 12 Apr 2021 22:20:54 +0000 (GMT) Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) by sourceware.org (Postfix) with ESMTPS id 69B063854813 for ; Mon, 12 Apr 2021 22:20:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 69B063854813 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=alves.ped@gmail.com Received: by mail-wr1-f53.google.com with SMTP id c15so5508695wro.13 for ; Mon, 12 Apr 2021 15:20:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=jCJXtTGbIr8zrrtk0aKyq875PHqtnH/KDrky3v4fl58=; b=FYlXgnjgnGCY7imHYNYeOffwOrRDuDP8Tuk6z/jN08D+ByD0oXEUluzNuzPewU2dwo +WOZAzb/29I8/89YG6peVOEUMXwG4FdDzfzmeppg04Kk1pemNXUzFBCZGHAz3a0RiwVy WNLLnrjQfTRGDcu7Joe+xg+HtrWl64P+qbp9C5l8sjrofjrwNLeibNxyJJKdYOJECyby NDhQGynBL6gCwD0F23uv16MaN3mNTov1VS0VbNBehqg/ODw700jWxS00qRokyOIRkRO4 f8IU+vyTT55OgIcvV7uBkJXaC3lLegkRb2Wdwz9DQWKLFjT5DEvDyBF1tHfB+IiuTXA9 gReg== X-Gm-Message-State: AOAM530FECXclOg3AaGImHYRSTmJlkImj9E9Z90OQMovFa4EsNLUs6Hu 7nVy74tnvA7BMsoEJErE68R9wAFCHLpRMg== X-Google-Smtp-Source: ABdhPJyjBaNz1qGx/meMfB0Dv2u7iSx97CV+nDwH6Po8O/QEIqVgYEHOOBVDcwmqElIOuhXrguwX7A== X-Received: by 2002:adf:dfcd:: with SMTP id q13mr34353194wrn.363.1618266047788; Mon, 12 Apr 2021 15:20:47 -0700 (PDT) Received: from ?IPv6:2001:8a0:f932:6a00:6b6e:c7b6:c5a7:aac3? ([2001:8a0:f932:6a00:6b6e:c7b6:c5a7:aac3]) by smtp.gmail.com with ESMTPSA id a72sm570751wme.29.2021.04.12.15.20.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 12 Apr 2021 15:20:46 -0700 (PDT) Subject: [PATCH] Remove process_stratum_target::hostio_last_error abstraction (Re: [PATCH] gdb, gdbserver: remove WinCE support code) From: Pedro Alves To: Simon Marchi , gdb-patches@sourceware.org References: <20210410231021.1232451-1-simon.marchi@polymtl.ca> <563cec09-990a-77f4-042f-2b95215e9829@palves.net> <1dd71397-369c-b88f-832d-b6c525e5bee8@polymtl.ca> <4e6132b6-acd0-0c9d-fdee-d693784efe13@polymtl.ca> Message-ID: Date: Mon, 12 Apr 2021 23:20:45 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: <4e6132b6-acd0-0c9d-fdee-d693784efe13@polymtl.ca> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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: , Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" On 12/04/21 16:24, Simon Marchi wrote: > On 2021-04-12 11:12 a.m., Simon Marchi via Gdb-patches wrote: >> On 2021-04-12 7:42 a.m., Pedro Alves wrote: >>> We can also get rid of the whole >>> >>> the_target->hostio_last_error / hostio-errno.cc / hostio_last_error_from_errno >>> >>> abstraction now. >> >> Ok, I didn't really know what that was for. I pushed the patch and will >> send a follow up for that. > > Well, I spoke too soon, I don't really understand what abstraction you > are talking about. This. >From 6a3ffc7e3f65799402078dc9c0721eeb33fc19c9 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Mon, 12 Apr 2021 20:23:54 +0100 Subject: [PATCH] Remove process_stratum_target::hostio_last_error abstraction Now that the WinCE port is gone, all ports map host I/O errors from errno, so this abstraction is no longer necessary. Basically undoes: https://sourceware.org/pipermail/gdb-patches/2008-January/055246.html https://sourceware.org/pipermail/gdb-patches/attachments/20080131/f44e7012/attachment.bin gdbserver/ChangeLog: * Makefile.in (SFILES): Remove hostio-errno.cc. * configure: Regenerate. * configure.ac (GDBSERVER_DEPFILES): No longer add $srv_hostio_err_objs. * configure.srv (srv_hostio_err_objs): Delete. * hostio-errno.cc: Delete. * hostio.cc (hostio_error): Inline hostio_last_error_from_errno here. * hostio.h (hostio_last_error_from_errno): Delete. * target.cc (process_stratum_target::hostio_last_error): Delete. * target.h (class process_stratum_target) : Delete. --- gdbserver/Makefile.in | 1 - gdbserver/configure | 2 +- gdbserver/configure.ac | 2 +- gdbserver/configure.srv | 5 ----- gdbserver/hostio-errno.cc | 36 ------------------------------------ gdbserver/hostio.cc | 8 +++++--- gdbserver/hostio.h | 4 ---- gdbserver/target.cc | 6 ------ gdbserver/target.h | 4 ---- 9 files changed, 7 insertions(+), 61 deletions(-) delete mode 100644 gdbserver/hostio-errno.cc diff --git a/gdbserver/Makefile.in b/gdbserver/Makefile.in index a05cd1a57ad..f7ade7d61d5 100644 --- a/gdbserver/Makefile.in +++ b/gdbserver/Makefile.in @@ -186,7 +186,6 @@ SFILES = \ $(srcdir)/dll.cc \ $(srcdir)/gdbreplay.cc \ $(srcdir)/hostio.cc \ - $(srcdir)/hostio-errno.cc \ $(srcdir)/i387-fp.cc \ $(srcdir)/inferiors.cc \ $(srcdir)/linux-aarch64-low.cc \ diff --git a/gdbserver/configure b/gdbserver/configure index 0db0ad3f4fb..032b4ae65bb 100755 --- a/gdbserver/configure +++ b/gdbserver/configure @@ -10633,7 +10633,7 @@ $as_echo "#define USE_XML 1" >>confdefs.h done fi -GDBSERVER_DEPFILES="$srv_regobj $srv_tgtobj $srv_hostio_err_objs $srv_thread_depfiles" +GDBSERVER_DEPFILES="$srv_regobj $srv_tgtobj $srv_thread_depfiles" GDBSERVER_LIBS="$srv_libs" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the target supports __sync_*_compare_and_swap" >&5 diff --git a/gdbserver/configure.ac b/gdbserver/configure.ac index 6c504777d09..5ec222dfc60 100644 --- a/gdbserver/configure.ac +++ b/gdbserver/configure.ac @@ -379,7 +379,7 @@ if test "$srv_xmlfiles" != ""; then done fi -GDBSERVER_DEPFILES="$srv_regobj $srv_tgtobj $srv_hostio_err_objs $srv_thread_depfiles" +GDBSERVER_DEPFILES="$srv_regobj $srv_tgtobj $srv_thread_depfiles" GDBSERVER_LIBS="$srv_libs" dnl Check whether the target supports __sync_*_compare_and_swap. diff --git a/gdbserver/configure.srv b/gdbserver/configure.srv index 2dd8f75a4e0..971f537bffa 100644 --- a/gdbserver/configure.srv +++ b/gdbserver/configure.srv @@ -8,8 +8,6 @@ # srv_regobj The register protocol appropriate for this target. # srv_tgtobj Any other target-specific modules appropriate # for this target. -# srv_hostio_err The object implementing the hostio_last_error -# target method. # srv_xmlfiles All XML files which should be available for # gdbserver in this configuration. # ipa_obj Any other target-specific modules appropriate @@ -24,9 +22,6 @@ # srv_linux_usrregs Set to "yes" if we can get at registers via # PTRACE_PEEKUSR / PTRACE_POKEUSR. -# Default hostio_last_error implementation -srv_hostio_err_objs="hostio-errno.o" - ipa_ppc_linux_regobj="powerpc-32l-ipa.o powerpc-altivec32l-ipa.o powerpc-vsx32l-ipa.o powerpc-isa205-32l-ipa.o powerpc-isa205-altivec32l-ipa.o powerpc-isa205-vsx32l-ipa.o powerpc-isa205-ppr-dscr-vsx32l-ipa.o powerpc-isa207-vsx32l-ipa.o powerpc-isa207-htm-vsx32l-ipa.o powerpc-e500l-ipa.o powerpc-64l-ipa.o powerpc-altivec64l-ipa.o powerpc-vsx64l-ipa.o powerpc-isa205-64l-ipa.o powerpc-isa205-altivec64l-ipa.o powerpc-isa205-vsx64l-ipa.o powerpc-isa205-ppr-dscr-vsx64l-ipa.o powerpc-isa207-vsx64l-ipa.o powerpc-isa207-htm-vsx64l-ipa.o" # Linux object files. This is so we don't have to repeat diff --git a/gdbserver/hostio-errno.cc b/gdbserver/hostio-errno.cc deleted file mode 100644 index 4cb3922b92e..00000000000 --- a/gdbserver/hostio-errno.cc +++ /dev/null @@ -1,36 +0,0 @@ -/* Host file transfer support for gdbserver. - Copyright (C) 2007-2021 Free Software Foundation, Inc. - - Contributed by CodeSourcery. - - This file is part of GDB. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -/* This file implements the hostio_last_error target callback - on top of errno. */ - -#include "server.h" - -#include "hostio.h" - -#include "gdbsupport/fileio.h" - -void -hostio_last_error_from_errno (char *buf) -{ - int error = errno; - int fileio_error = host_to_fileio_error (error); - sprintf (buf, "F-1,%x", fileio_error); -} diff --git a/gdbserver/hostio.cc b/gdbserver/hostio.cc index 26c0f119d20..0654bba3a6f 100644 --- a/gdbserver/hostio.cc +++ b/gdbserver/hostio.cc @@ -191,12 +191,14 @@ require_valid_fd (int fd) return -1; } -/* Fill in own_buf with the last hostio error packet, however it - suitable for the target. */ +/* Fill BUF with an hostio error packet representing the last hostio + error, from errno. */ + static void hostio_error (char *own_buf) { - the_target->hostio_last_error (own_buf); + int fileio_error = host_to_fileio_error (errno); + sprintf (own_buf, "F-1,%x", fileio_error); } static void diff --git a/gdbserver/hostio.h b/gdbserver/hostio.h index 61c42196e54..97c27c6b744 100644 --- a/gdbserver/hostio.h +++ b/gdbserver/hostio.h @@ -22,10 +22,6 @@ /* Per-connection setup. */ extern void hostio_handle_new_gdb_connection (void); -/* Functions from hostio.c. */ extern int handle_vFile (char *, int, int *); -/* Functions from hostio-errno.c. */ -extern void hostio_last_error_from_errno (char *own_buf); - #endif /* GDBSERVER_HOSTIO_H */ diff --git a/gdbserver/target.cc b/gdbserver/target.cc index 5ec3e5cce9f..6660cc04fd5 100644 --- a/gdbserver/target.cc +++ b/gdbserver/target.cc @@ -505,12 +505,6 @@ process_stratum_target::get_tls_address (thread_info *thread, gdb_assert_not_reached ("target op get_tls_address not supported"); } -void -process_stratum_target::hostio_last_error (char *buf) -{ - hostio_last_error_from_errno (buf); -} - bool process_stratum_target::supports_qxfer_osdata () { diff --git a/gdbserver/target.h b/gdbserver/target.h index 769d8281176..2c4393ec8c6 100644 --- a/gdbserver/target.h +++ b/gdbserver/target.h @@ -256,10 +256,6 @@ class process_stratum_target virtual int get_tls_address (thread_info *thread, CORE_ADDR offset, CORE_ADDR load_module, CORE_ADDR *address); - /* Fill BUF with an hostio error packet representing the last hostio - error. */ - virtual void hostio_last_error (char *buf); - /* Return true if the qxfer_osdata target op is supported. */ virtual bool supports_qxfer_osdata (); base-commit: 4bb920c68e3a9e310095d54e0c4034c9cee12916 -- 2.26.2