From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: gdb-patches@sourceware.org
Subject: [patch] Fix for newer kernels with: t (tracing stop)
Date: Sat, 04 Jun 2016 12:29:00 -0000 [thread overview]
Message-ID: <20160604122904.GA11651@host1.jankratochvil.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 1075 bytes --]
Hi,
I did provide wrong ptrace data which should fail on their write.
error (_("Unexpected error setting hardware debug registers"));
But GDB did not print that error, only inferior did hang, because the data was
not written.
It is because this error/exception gets suppressed by:
linux_resume_one_lwp():
1578 if (!check_ptrace_stopped_lwp_gone (lp))
1579 throw_exception (ex);
Which happens because check_ptrace_stopped_lwp_gone()
expects 'T (tracing stop)' while recent Linux kernels
provide 't (tracing stop)' instad.
What does lowercase t means in ps state code
http://stackoverflow.com/questions/35895886/what-does-lowercase-t-means-in-ps-state-code
Found it on:
kernel-4.4.6-301.fc23.aarch64
by:
gdb/nat/aarch64-linux-hw-point.c
- ctrl |= ((1 << len) - 1) << 5;
+ ctrl |= (((1 << len) - 1)&~1) << 5;
It does not change testsuite results on that F-23.aarch64 machine.
I see no real regessions on rawhide.x86_64 machine (with F-23 kernel) although
there were some fuzzy results I will need to check more.
OK for check-in?
Thanks,
Jan
[-- Attachment #2: tracestop.patch --]
[-- Type: text/plain, Size: 2465 bytes --]
gdb/ChangeLog
2016-06-04 Jan Kratochvil <jan.kratochvil@redhat.com>
* nat/linux-procfs.c (linux_proc_pid_has_state): Add parameter state2.
(linux_proc_pid_is_stopped): Update caller.
(linux_proc_pid_is_trace_stopped_nowarn): Add 't (tracing stop)'.
(linux_proc_pid_is_zombie_maybe_warn): Update caller.
--- a/gdb/nat/linux-procfs.c
+++ b/gdb/nat/linux-procfs.c
@@ -129,17 +129,20 @@ linux_proc_pid_is_gone (pid_t pid)
}
}
-/* Return non-zero if 'State' of /proc/PID/status contains STATE. If
- WARN, warn on failure to open the /proc file. */
+/* Return non-zero if 'State' of /proc/PID/status contains STATE or STATE2.
+ STATE2 can be NULL. If WARN, warn on failure to open the /proc file. */
static int
-linux_proc_pid_has_state (pid_t pid, const char *state, int warn)
+linux_proc_pid_has_state (pid_t pid, const char *state, const char *state2,
+ int warn)
{
char buffer[100];
int have_state;
have_state = linux_proc_pid_get_state (pid, buffer, sizeof buffer, warn);
- return (have_state > 0 && strstr (buffer, state) != NULL);
+ return (have_state > 0
+ && (strstr (buffer, state) != NULL
+ || (state2 != NULL && strstr (buffer, state2) != NULL)));
}
/* Detect `T (stopped)' in `/proc/PID/status'.
@@ -148,16 +151,18 @@ linux_proc_pid_has_state (pid_t pid, const char *state, int warn)
int
linux_proc_pid_is_stopped (pid_t pid)
{
- return linux_proc_pid_has_state (pid, "T (stopped)", 1);
+ return linux_proc_pid_has_state (pid, "T (stopped)", NULL, 1);
}
-/* Detect `T (tracing stop)' in `/proc/PID/status'.
- Other states including `T (stopped)' are reported as false. */
+/* Detect `t (tracing stop)' or `T (tracing stop)' (present in older
+ kernels) in `/proc/PID/status'. Other states including `T (stopped)'
+ are reported as false. */
int
linux_proc_pid_is_trace_stopped_nowarn (pid_t pid)
{
- return linux_proc_pid_has_state (pid, "T (tracing stop)", 1);
+ return linux_proc_pid_has_state (pid, "t (tracing stop)", "T (tracing stop)",
+ 1);
}
/* Return non-zero if PID is a zombie. If WARN, warn on failure to
@@ -166,7 +171,7 @@ linux_proc_pid_is_trace_stopped_nowarn (pid_t pid)
static int
linux_proc_pid_is_zombie_maybe_warn (pid_t pid, int warn)
{
- return linux_proc_pid_has_state (pid, "Z (zombie)", warn);
+ return linux_proc_pid_has_state (pid, "Z (zombie)", NULL, warn);
}
/* See linux-procfs.h declaration. */
next reply other threads:[~2016-06-04 12:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-04 12:29 Jan Kratochvil [this message]
2016-07-22 15:35 ` Pedro Alves
2016-07-22 16:04 ` Pedro Alves
2016-07-24 20:08 ` Jan Kratochvil
2016-07-25 12:02 ` [pushed 1/2] linux-procfs: Introduce enum proc_state Pedro Alves
2016-07-25 12:02 ` [pushed 2/2] linux-procfs: Handle lowercase "t (tracing stop)" state Pedro Alves
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=20160604122904.GA11651@host1.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--cc=gdb-patches@sourceware.org \
/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