aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/gnu-nat.c11
-rw-r--r--gdb/procfs.c14
-rw-r--r--gdb/target.c13
-rw-r--r--gdb/windows-nat.c10
4 files changed, 11 insertions, 37 deletions
diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c
index f99aeb1..1d3b5f1 100644
--- a/gdb/gnu-nat.c
+++ b/gdb/gnu-nat.c
@@ -2215,16 +2215,7 @@ gnu_nat_target::attach (const char *args, int from_tty)
void
gnu_nat_target::detach (inferior *inf, int from_tty)
{
- if (from_tty)
- {
- const char *exec_file = get_exec_file (0);
-
- if (exec_file)
- printf_unfiltered ("Detaching from program `%s' pid %d\n",
- exec_file, gnu_current_inf->pid);
- else
- printf_unfiltered ("Detaching from pid %d\n", gnu_current_inf->pid);
- }
+ target_announce_detach (from_tty);
inf_detach (gnu_current_inf);
diff --git a/gdb/procfs.c b/gdb/procfs.c
index ddc8623..840201d 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -1786,19 +1786,7 @@ procfs_target::attach (const char *args, int from_tty)
void
procfs_target::detach (inferior *inf, int from_tty)
{
- int pid = inferior_ptid.pid ();
-
- if (from_tty)
- {
- const char *exec_file;
-
- exec_file = get_exec_file (0);
- if (exec_file == NULL)
- exec_file = "";
-
- printf_filtered (_("Detaching from program: %s, %s\n"), exec_file,
- target_pid_to_str (ptid_t (pid)).c_str ());
- }
+ target_announce_detach (from_tty);
do_detach ();
diff --git a/gdb/target.c b/gdb/target.c
index a48845d..c25ce69 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -3628,13 +3628,14 @@ target_announce_detach (int from_tty)
if (!from_tty)
return;
- exec_file = get_exec_file (0);
- if (exec_file == NULL)
- exec_file = "";
-
pid = inferior_ptid.pid ();
- printf_unfiltered (_("Detaching from program: %s, %s\n"), exec_file,
- target_pid_to_str (ptid_t (pid)).c_str ());
+ exec_file = get_exec_file (0);
+ if (exec_file == nullptr)
+ printf_unfiltered ("Detaching from pid %s\n",
+ target_pid_to_str (ptid_t (pid)).c_str ());
+ else
+ printf_unfiltered (_("Detaching from program: %s, %s\n"), exec_file,
+ target_pid_to_str (ptid_t (pid)).c_str ());
}
/* See target.h */
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index c85f7c0..bdf6ac9 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -1962,14 +1962,8 @@ windows_nat_target::detach (inferior *inf, int from_tty)
}
DebugSetProcessKillOnExit (FALSE);
- if (detached && from_tty)
- {
- const char *exec_file = get_exec_file (0);
- if (exec_file == 0)
- exec_file = "";
- printf_unfiltered ("Detaching from program: %s, Pid %u\n", exec_file,
- (unsigned) current_event.dwProcessId);
- }
+ if (detached)
+ target_announce_detach (from_tty);
x86_cleanup_dregs ();
switch_to_no_thread ();