This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Regression] Segfault on native-extended-gdbserver + fork


On 01/29/2018 04:25 PM, Simon Marchi wrote:

> It's true that it's a bit of a lie to say "[Inferior PID detached]" if there never actually was an inferior for that PID.  Since we never print "[Inferior PID detached]" on native in that case, I am fine with removing the call from remote.c.  Sergio, that would fix the crash you found I think?

A tangent:

We should probably change that message from:

 [Inferior PID detached]

to something like:

 [Inferior ID (process PID) detached]

I.e.:
 [Inferior 24822 detached]
vs:
 [Inferior 1 (process 24822) detached]

In patch form, something like this:

>From 6c1db47bc19669d9c84024d09f8a63b5eb78b6c2 Mon Sep 17 00:00:00 2001
From: Pedro Alves <palves@redhat.com>
Date: Mon, 29 Jan 2018 16:41:25 +0000
Subject: [PATCH] change output

---
 gdb/inferior.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gdb/inferior.c b/gdb/inferior.c
index 38b7369275b..2986b510314 100644
--- a/gdb/inferior.c
+++ b/gdb/inferior.c
@@ -234,7 +234,8 @@ exit_inferior (int pid)
   exit_inferior_1 (inf, 0);
 
   if (print_inferior_events)
-    printf_unfiltered (_("[Inferior %d exited]\n"), pid);
+    printf_unfiltered (_("[Inferior %d (%s) exited]\n"),
+		       inf->num, target_pid_to_str (ptid_t (pid)));
 }
 
 void
@@ -264,7 +265,8 @@ detach_inferior (inferior *inf)
   exit_inferior_1 (inf, 0);
 
   if (print_inferior_events)
-    printf_unfiltered (_("[Inferior %d detached]\n"), pid);
+    printf_unfiltered (_("[Inferior %d (%s) detached]\n"),
+		       inf->num, target_pid_to_str (ptid_t (pid)));
 }
 
 /* See inferior.h.  */
-- 
2.14.3


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]