Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH]: PTRACE_PEEKUSER redux...
@ 2006-04-07  5:04 David S. Miller
  2006-04-07 13:16 ` Daniel Jacobowitz
  0 siblings, 1 reply; 3+ messages in thread
From: David S. Miller @ 2006-04-07  5:04 UTC (permalink / raw)
  To: drow; +Cc: gdb-patches


Daniel, I've been thinking about that PTRACE_PEEKUSER dependency issue
in linux-nat.c some more.  And it's kind of unreasonable to expect
people to get the latest and greatest Sparc Linux kernel in order to
get a working gdb setup.

Especially when we can handle this gracefully, and without much pain.

In all cases, no matter what ptrace operation is specified, if the
child does not exist the error return we will get is -ESRCH (task not
found for pid) or -EPERM (trying to trace init or similar).

Specifically checking for those two error codes allows us to cleanly
handle Linux targets that do not need to implement PTRACE_PEEKUSER.

Therefore, what do you think about the following patch?

2006-04-06  David S. Miller  <davem@sunset.davemloft.net>

	* linux-nat.c (linux_nat_thread_alive): Thread is alive
	as long as errno is neither -ESRCH nor -EPERM.  This allows
	to handle cleanly the case where PTRACE_PEEKUSER is not
	a supported ptrace operation for a given Linux target.

--- linux-nat.c.~1~	2006-04-05 18:08:11.000000000 -0700
+++ linux-nat.c	2006-04-06 21:55:49.000000000 -0700
@@ -2382,7 +2383,7 @@ linux_nat_thread_alive (ptid_t ptid)
 			"LLTA: PTRACE_PEEKUSER %s, 0, 0 (%s)\n",
 			target_pid_to_str (ptid),
 			errno ? safe_strerror (errno) : "OK");
-  if (errno)
+  if (errno == -ESRCH || errno == -EPERM)
     return 0;
 
   return 1;


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-04-07 21:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-07  5:04 [PATCH]: PTRACE_PEEKUSER redux David S. Miller
2006-04-07 13:16 ` Daniel Jacobowitz
2006-04-07 21:35   ` David S. Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox