aboutsummaryrefslogtreecommitdiff
path: root/gdb/inf-ptrace.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2016-07-01 11:16:32 +0100
committerPedro Alves <palves@redhat.com>2016-07-01 11:25:50 +0100
commit0f48b757071509040d800ff9f7c8726e5828bd1a (patch)
treeeb2429adfee161dd0e931e75ed9c79981e784e49 /gdb/inf-ptrace.c
parent25d49b862ca7cc65e2ed3fd18e5e445ebb3fb2bc (diff)
downloadgdb-0f48b757071509040d800ff9f7c8726e5828bd1a.zip
gdb-0f48b757071509040d800ff9f7c8726e5828bd1a.tar.gz
gdb-0f48b757071509040d800ff9f7c8726e5828bd1a.tar.bz2
Factor out "Detaching from program" message printing
Several targets have a copy of the same code that prints "Detaching from program ..." in their target_detach implementation. Factor that out to a common function. (For now, I left the couple targets that print this a bit differently alone. Maybe this could be further pulled out into infcmd.c. If we did that, and those targets want to continue printing differently, this new function could be converted to a target method.) gdb/ChangeLog: 2016-07-01 Pedro Alves <palves@redhat.com> * darwin-nat.c (darwin_detach): Use target_announce_detach. * inf-ptrace.c (inf_ptrace_detach): Likewise. * nto-procfs.c (procfs_detach): Likewise. * remote.c (remote_detach_1): Likewise. * target.c (target_announce_detach): New function. * target.h (target_announce_detach): New declaration.
Diffstat (limited to 'gdb/inf-ptrace.c')
-rw-r--r--gdb/inf-ptrace.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c
index 329d8fb..dd11043 100644
--- a/gdb/inf-ptrace.c
+++ b/gdb/inf-ptrace.c
@@ -240,15 +240,7 @@ inf_ptrace_detach (struct target_ops *ops, const char *args, int from_tty)
pid_t pid = ptid_get_pid (inferior_ptid);
int sig = 0;
- if (from_tty)
- {
- char *exec_file = get_exec_file (0);
- if (exec_file == 0)
- exec_file = "";
- printf_unfiltered (_("Detaching from program: %s, %s\n"), exec_file,
- target_pid_to_str (pid_to_ptid (pid)));
- gdb_flush (gdb_stdout);
- }
+ target_announce_detach (from_tty);
if (args)
sig = atoi (args);