aboutsummaryrefslogtreecommitdiff
path: root/gdb/nto-procfs.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2019-12-13 15:09:37 -0700
committerTom Tromey <tromey@adacore.com>2019-12-16 14:08:11 -0700
commitd9fa87f4f6e732f5feb41f2fa7dc6faddb1fb627 (patch)
tree04a2a5d7cb398a0c76b0086e83fd9b53a83f69c8 /gdb/nto-procfs.c
parentc0c3707ff46ccfb78ea175dd42d628d8c90dca8b (diff)
downloadgdb-d9fa87f4f6e732f5feb41f2fa7dc6faddb1fb627.zip
gdb-d9fa87f4f6e732f5feb41f2fa7dc6faddb1fb627.tar.gz
gdb-d9fa87f4f6e732f5feb41f2fa7dc6faddb1fb627.tar.bz2
Constify get_exec_file
I noticed that get_exec_file could return a "const char *". This patch implements this change. I couldn't build all the code -- but I did build Linux native and a mingw cross. Consequently, the NTO code has a hack, where it casts away const. I think this can be removed, but that required more work there, and since I couldn't compile it, I felt it best not to try. Let me know what you think. gdb/ChangeLog 2019-12-16 Tom Tromey <tromey@adacore.com> * windows-nat.c (windows_nat_target::attach): Update. * remote.c (extended_remote_target::attach): Update. * procfs.c (procfs_target::attach): Update. * nto-procfs.c (nto_procfs_target::attach): Update. (nto_procfs_target::create_inferior): Update. * inf-ptrace.c (inf_ptrace_target::attach): Update. * gnu-nat.c (gnu_nat_target::attach): Update. (gnu_nat_target::detach): Update. * darwin-nat.c (darwin_nat_target::attach): Update. * corefile.c (get_exec_file): Constify result. Remove extraneous return. * bsd-kvm.c (bsd_kvm_target_open): Update. * gdbsupport/common-inferior.h (get_exec_file): Constify result. gdb/gdbserver/ChangeLog 2019-12-16 Tom Tromey <tromey@adacore.com> * server.c (get_exec_file): Constify result. Change-Id: I29c60f7313a7def0dcb290ff0c2a4c1dea4f981f
Diffstat (limited to 'gdb/nto-procfs.c')
-rw-r--r--gdb/nto-procfs.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c
index dcb0494..42b2348 100644
--- a/gdb/nto-procfs.c
+++ b/gdb/nto-procfs.c
@@ -693,7 +693,6 @@ nto_procfs_target::pid_to_exec_file (const int pid)
void
nto_procfs_target::attach (const char *args, int from_tty)
{
- char *exec_file;
int pid;
struct inferior *inf;
@@ -704,7 +703,7 @@ nto_procfs_target::attach (const char *args, int from_tty)
if (from_tty)
{
- exec_file = (char *) get_exec_file (0);
+ const char *exec_file = get_exec_file (0);
if (exec_file)
printf_unfiltered ("Attaching to program `%s', %s\n", exec_file,
@@ -1215,7 +1214,7 @@ nto_procfs_target::create_inferior (const char *exec_file,
argv = xmalloc ((allargs.size () / (unsigned) 2 + 2) *
sizeof (*argv));
- argv[0] = get_exec_file (1);
+ argv[0] = const_cast<char *> (get_exec_file (1));
if (!argv[0])
{
if (exec_file)