This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] Fix for power-pc gdb.server/non-existing-program.exp
- From: "Carl E. Love" <cel at us dot ibm dot com>
- To: Edjunior Barbosa Machado <emachado at linux dot vnet dot ibm dot com>, Ulrich Weigand <Ulrich dot Weigand at de dot ibm dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Wed, 24 Aug 2016 09:50:42 -0700
- Subject: [PATCH] Fix for power-pc gdb.server/non-existing-program.exp
- Authentication-results: sourceware.org; auth=none
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