From: "David S. Miller" <davem@davemloft.net>
To: drow@false.org
Cc: gdb-patches@sources.redhat.com
Subject: [PATCH]: PTRACE_PEEKUSER redux...
Date: Fri, 07 Apr 2006 05:04:00 -0000 [thread overview]
Message-ID: <20060406.220357.102230498.davem@davemloft.net> (raw)
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;
next reply other threads:[~2006-04-07 5:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-07 5:04 David S. Miller [this message]
2006-04-07 13:16 ` Daniel Jacobowitz
2006-04-07 21:35 ` David S. Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060406.220357.102230498.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=drow@false.org \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox