Introduce target_announce_attach

This introduces target_announce_attach, by analog with
target_announce_detach.  Then it converts existing targets to use
this, rather than emitting their own output by hand.
This commit is contained in:
Tom Tromey 2021-12-26 21:49:48 -07:00
parent 10a85f29c7
commit bc521517b7
9 changed files with 30 additions and 77 deletions

View file

@ -2170,16 +2170,7 @@ gnu_nat_target::attach (const char *args, int from_tty)
if (pid == getpid ()) /* Trying to masturbate? */
error (_("I refuse to debug myself!"));
if (from_tty)
{
const char *exec_file = get_exec_file (0);
if (exec_file)
printf_unfiltered ("Attaching to program `%s', pid %d\n",
exec_file, pid);
else
printf_unfiltered ("Attaching to pid %d\n", pid);
}
target_announce_attach (from_tty, pid);
inf_debug (inf, "attaching to pid: %d", pid);