diff options
author | Tom Tromey <tromey@adacore.com> | 2022-04-26 14:08:03 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2022-05-13 08:21:16 -0600 |
commit | 0e90c441629bcf1f53ba484f7d855ed8eb68f138 (patch) | |
tree | 32543d4e42dfa1873b0fca3e3a81c0e33cd67702 /gdb/target-delegates.c | |
parent | f1025b233f6dad43981f5ad35c81481f8d3658bf (diff) | |
download | binutils-0e90c441629bcf1f53ba484f7d855ed8eb68f138.zip binutils-0e90c441629bcf1f53ba484f7d855ed8eb68f138.tar.gz binutils-0e90c441629bcf1f53ba484f7d855ed8eb68f138.tar.bz2 |
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.
Diffstat (limited to 'gdb/target-delegates.c')
-rw-r--r-- | gdb/target-delegates.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c index 4e653e8..8a99864 100644 --- a/gdb/target-delegates.c +++ b/gdb/target-delegates.c @@ -94,7 +94,7 @@ struct dummy_target : public target_ops void interrupt () override; void pass_ctrlc () override; void rcmd (const char *arg0, struct ui_file *arg1) override; - char *pid_to_exec_file (int arg0) override; + const char *pid_to_exec_file (int arg0) override; void log_command (const char *arg0) override; const target_section_table *get_section_table () override; thread_control_capabilities get_thread_control_capabilities () override; @@ -268,7 +268,7 @@ struct debug_target : public target_ops void interrupt () override; void pass_ctrlc () override; void rcmd (const char *arg0, struct ui_file *arg1) override; - char *pid_to_exec_file (int arg0) override; + const char *pid_to_exec_file (int arg0) override; void log_command (const char *arg0) override; const target_section_table *get_section_table () override; thread_control_capabilities get_thread_control_capabilities () override; @@ -1983,28 +1983,28 @@ debug_target::rcmd (const char *arg0, struct ui_file *arg1) gdb_puts (")\n", gdb_stdlog); } -char * +const char * target_ops::pid_to_exec_file (int arg0) { return this->beneath ()->pid_to_exec_file (arg0); } -char * +const char * dummy_target::pid_to_exec_file (int arg0) { return NULL; } -char * +const char * debug_target::pid_to_exec_file (int arg0) { - char * result; + const char * result; gdb_printf (gdb_stdlog, "-> %s->pid_to_exec_file (...)\n", this->beneath ()->shortname ()); result = this->beneath ()->pid_to_exec_file (arg0); gdb_printf (gdb_stdlog, "<- %s->pid_to_exec_file (", this->beneath ()->shortname ()); target_debug_print_int (arg0); gdb_puts (") = ", gdb_stdlog); - target_debug_print_char_p (result); + target_debug_print_const_char_p (result); gdb_puts ("\n", gdb_stdlog); return result; } |