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]

[PATCH] Fix for power-pc gdb.server/non-existing-program.exp


Fix for power-pc gdb.server/non-existing-program.exp

The ptrace function reports an error when it is called on a process that
has already terminated.  This commit fixes the issue by checking in function
ppc_arch_setup() and returning without fetching the registers for the
inferior.  Function ppc_arch_setup() is defined in:

   gdbserver/linux-ppc-low.c

gdbserver/ChangeLog

2016-08-24  Carl Love  <cel@us.ibm.com>

      	* gdbserver/linux-ppc-low.c: check if process has exited already.

---
 gdb/gdbserver/linux-ppc-low.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/gdb/gdbserver/linux-ppc-low.c b/gdb/gdbserver/linux-ppc-low.c
index 1d013f1..eedca57 100644
--- a/gdb/gdbserver/linux-ppc-low.c
+++ b/gdb/gdbserver/linux-ppc-low.c
@@ -620,6 +620,15 @@ ppc_arch_setup (void)
 #ifdef __powerpc64__
   long msr;
   struct regcache *regcache;
+  int tid;
+
+  tid = lwpid_of (current_thread);
+  if (getpgid(tid) <= 0) {
+	  /* process doesn't exist, exit or subsequent call to ptrace will fail
+		  on on-existent process */
+	  fflush(stdout);
+     return;
+  }
 
   /* On a 64-bit host, assume 64-bit inferior process with no
      AltiVec registers.  Reset ppc_hwcap to ensure that the
-- 
1.8.3.1




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