From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by sourceware.org (Postfix) with ESMTPS id 295743894C39 for ; Mon, 12 Apr 2021 12:30:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 295743894C39 IronPort-SDR: QvdqCEZs42FcoJObPW3KZIPmTypM9x8yLaJ7ECUUMzVexRmZIw3aBbgDMv9X0I+ybgJYB9DVkz WE242Agj7PkQ== X-IronPort-AV: E=McAfee;i="6000,8403,9951"; a="173669051" X-IronPort-AV: E=Sophos;i="5.82,216,1613462400"; d="scan'208";a="173669051" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Apr 2021 05:30:45 -0700 IronPort-SDR: mdDOugJXzk8wuo+1qCmU/wu5Q3kFGF2WXeBvfi4hmMBssRYBOMhytae+srqILZntol1YzVPnt/ T4rnk3pLHQOw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,216,1613462400"; d="scan'208";a="460146980" Received: from irvmail001.ir.intel.com ([10.43.11.63]) by orsmga001.jf.intel.com with ESMTP; 12 Apr 2021 05:30:43 -0700 Received: from ulvlx001.iul.intel.com (ulvlx001.iul.intel.com [172.28.207.17]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id 13CCUhfW029354; Mon, 12 Apr 2021 13:30:43 +0100 Received: from ulvlx001.iul.intel.com (localhost [127.0.0.1]) by ulvlx001.iul.intel.com with ESMTP id 13CCUhTw020357; Mon, 12 Apr 2021 14:30:43 +0200 Received: (from taktemur@localhost) by ulvlx001.iul.intel.com with LOCAL id 13CCUgui020353; Mon, 12 Apr 2021 14:30:42 +0200 From: Tankut Baris Aktemur To: gdb-patches@sourceware.org Subject: [PATCH] gdbserver: constify the 'pid_to_exec_file' target op Date: Mon, 12 Apr 2021 14:30:38 +0200 Message-Id: <1618230638-20102-1-git-send-email-tankut.baris.aktemur@intel.com> X-Mailer: git-send-email 1.7.0.7 X-Spam-Status: No, score=-14.0 required=5.0 tests=AC_FROM_MANY_DOTS, BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_PASS, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Mon, 12 Apr 2021 12:30:51 -0000 gdbserver/ChangeLog: 2021-04-12 Tankut Baris Aktemur * target.h (class process_stratum_target) : Constify the return type. Update the definition/references below. * target.cc (process_stratum_target::pid_to_exec_file) * linux-low.h (class linux_process_target) * linux-low.cc (linux_process_target::pid_to_exec_file) * netbsd-low.h (class netbsd_process_target) * netbsd-low.cc (netbsd_process_target::pid_to_exec_file) * server.cc (handle_qxfer_exec_file) --- gdbserver/linux-low.cc | 2 +- gdbserver/linux-low.h | 2 +- gdbserver/netbsd-low.cc | 4 ++-- gdbserver/netbsd-low.h | 2 +- gdbserver/server.cc | 2 +- gdbserver/target.cc | 2 +- gdbserver/target.h | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc index 0baac013129..251a54f5c4a 100644 --- a/gdbserver/linux-low.cc +++ b/gdbserver/linux-low.cc @@ -6265,7 +6265,7 @@ linux_process_target::supports_pid_to_exec_file () return true; } -char * +const char * linux_process_target::pid_to_exec_file (int pid) { return linux_proc_pid_to_exec_file (pid); diff --git a/gdbserver/linux-low.h b/gdbserver/linux-low.h index be97526ced7..d59ad386bd5 100644 --- a/gdbserver/linux-low.h +++ b/gdbserver/linux-low.h @@ -292,7 +292,7 @@ class linux_process_target : public process_stratum_target bool supports_pid_to_exec_file () override; - char *pid_to_exec_file (int pid) override; + const char *pid_to_exec_file (int pid) override; bool supports_multifs () override; diff --git a/gdbserver/netbsd-low.cc b/gdbserver/netbsd-low.cc index 38ded94d909..84e34d0e065 100644 --- a/gdbserver/netbsd-low.cc +++ b/gdbserver/netbsd-low.cc @@ -1193,10 +1193,10 @@ netbsd_process_target::supports_qxfer_libraries_svr4 () /* Return the name of a file that can be opened to get the symbols for the child process identified by PID. */ -char * +const char * netbsd_process_target::pid_to_exec_file (pid_t pid) { - return const_cast (netbsd_nat::pid_to_exec_file (pid)); + return netbsd_nat::pid_to_exec_file (pid); } /* Implementation of the target_ops method "supports_pid_to_exec_file". */ diff --git a/gdbserver/netbsd-low.h b/gdbserver/netbsd-low.h index 9c341c71cf9..b98588fdf33 100644 --- a/gdbserver/netbsd-low.h +++ b/gdbserver/netbsd-low.h @@ -121,7 +121,7 @@ class netbsd_process_target : public process_stratum_target bool supports_pid_to_exec_file () override; - char *pid_to_exec_file (int pid) override; + const char *pid_to_exec_file (int pid) override; const char *thread_name (ptid_t thread) override; diff --git a/gdbserver/server.cc b/gdbserver/server.cc index 2a443305691..156fd4333df 100644 --- a/gdbserver/server.cc +++ b/gdbserver/server.cc @@ -1466,7 +1466,7 @@ handle_qxfer_exec_file (const char *annex, gdb_byte *readbuf, const gdb_byte *writebuf, ULONGEST offset, LONGEST len) { - char *file; + const char *file; ULONGEST pid; int total_len; diff --git a/gdbserver/target.cc b/gdbserver/target.cc index 1f2159714b3..5ec3e5cce9f 100644 --- a/gdbserver/target.cc +++ b/gdbserver/target.cc @@ -783,7 +783,7 @@ process_stratum_target::supports_pid_to_exec_file () return false; } -char * +const char * process_stratum_target::pid_to_exec_file (int pid) { gdb_assert_not_reached ("target op pid_to_exec_file not supported"); diff --git a/gdbserver/target.h b/gdbserver/target.h index 2831a6ce7c0..769d8281176 100644 --- a/gdbserver/target.h +++ b/gdbserver/target.h @@ -440,7 +440,7 @@ class process_stratum_target character string containing the pathname is returned. This string should be copied into a buffer by the client if the string will not be immediately used, or if it must persist. */ - virtual char *pid_to_exec_file (int pid); + virtual const char *pid_to_exec_file (int pid); /* Return true if any of the multifs ops is supported. */ virtual bool supports_multifs (); -- 2.17.1