From 0e90c441629bcf1f53ba484f7d855ed8eb68f138 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 26 Apr 2022 14:08:03 -0600 Subject: Constify target_pid_to_exec_file This changes target_pid_to_exec_file and target_ops::pid_to_exec_file to return a "const char *". I couldn't build many of these targets, but did examine the code by hand -- also, as this only affects the return type, it's normally pretty safe. This brings gdb and gdbserver a bit closer, and allows for the removal of a const_cast as well. --- gdb/target.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gdb/target.h') diff --git a/gdb/target.h b/gdb/target.h index f77dbf0..18559fe 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -688,7 +688,7 @@ struct target_ops TARGET_DEFAULT_FUNC (default_target_pass_ctrlc); virtual void rcmd (const char *command, struct ui_file *output) TARGET_DEFAULT_FUNC (default_rcmd); - virtual char *pid_to_exec_file (int pid) + virtual const char *pid_to_exec_file (int pid) TARGET_DEFAULT_RETURN (NULL); virtual void log_command (const char *) TARGET_DEFAULT_IGNORE (); @@ -1951,7 +1951,7 @@ extern gdb::byte_vector target_thread_info_to_thread_handle the client if the string will not be immediately used, or if it must persist. */ -extern char *target_pid_to_exec_file (int pid); +extern const char *target_pid_to_exec_file (int pid); /* See the to_thread_architecture description in struct target_ops. */ -- cgit v1.1