From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Pedro Alves <pedro@codesourcery.com>
Cc: gdb-patches@sourceware.org
Subject: [patch] s390*: watchpoints regression [Re: [obv] s390*: Fix build regression]
Date: Sat, 17 Dec 2011 19:37:00 -0000 [thread overview]
Message-ID: <20111217191543.GA5564@host2.jankratochvil.net> (raw)
In-Reply-To: <201112171229.27796.pedro@codesourcery.com>
On Sat, 17 Dec 2011 13:29:27 +0100, Pedro Alves wrote:
> Looks like we're trying to peek/poke at the shell process,
> and failing?
Yes.
> I suspect that something like this pseudo patch:
>
> +s390_new_thread (struct lwp_info *lp)
> +{
> + if (num_lwps (GET_PID (ptid)) > 1)
> + s390_fix_watch_points (lp);
> +}
I can confirm it works.
On x86* it now sets DR_CONTROL to 0 already for the wrapper shell. When there
exist watchpoints they are suppressed so it still sets 0 and it works. But
I do not think GDB should mess with watchpoint registers already for the
wrapper shell.
In the hypothetical case the wrapper shell sets DR registers they get
inherited now by the inferior. Not that it needs to be handled but it IMO
suggests DR_CONTROL should be rather set for the real inferior.
But I do not see some easy enough way how to delay the DR setting till the new
inferior so I just verified your code which works.
OK to check it in this way?
Thanks,
Jan
2011-12-17 Pedro Alves <pedro@codesourcery.com>
Jan Kratochvil <jan.kratochvil@redhat.com>
* s390-nat.c (s390_new_thread_lwp, s390_new_thread): New functions.
(_initialize_s390_nat): Install now s390_new_thread, not
s390_fix_watch_points.
--- a/gdb/s390-nat.c
+++ b/gdb/s390-nat.c
@@ -667,6 +667,38 @@ s390_read_description (struct target_ops *ops)
tdesc_s390_linux32);
}
+/* Helper for s390_new_thread. */
+
+static int
+s390_new_thread_lwp (struct lwp_info *lp, void *new_lp_voidp)
+{
+ struct lwp_info *new_lp = new_lp_voidp;
+
+ if (lp == new_lp)
+ {
+ /* Continue traversal. */
+ return 0;
+ }
+
+ s390_fix_watch_points (new_lp);
+
+ /* Stop traversal. */
+ return 1;
+}
+
+/* Execute s390_fix_watch_points only when there is at least one other LWP
+ besides the new one. This excludes the initial shell wrapper process which
+ works around a problem of s390x failing to PTRACE_POKEUSR_AREA when the
+ initial shell wrapper runs. s390_fix_watch_points is fortunately not needed
+ for the initial creation of a single threaded process - watchpoints are not
+ yet inserted into inferior in such case. */
+
+static void
+s390_new_thread (struct lwp_info *lp)
+{
+ iterate_over_lwps (pid_to_ptid (GET_PID (lp->ptid)), s390_new_thread_lwp, lp);
+}
+
void _initialize_s390_nat (void);
void
@@ -695,5 +727,5 @@ _initialize_s390_nat (void)
/* Register the target. */
linux_nat_add_target (t);
- linux_nat_set_new_thread (t, s390_fix_watch_points);
+ linux_nat_set_new_thread (t, s390_new_thread);
}
next prev parent reply other threads:[~2011-12-17 19:16 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-17 12:22 [obv] s390*: Fix build regression, remains execution regression Jan Kratochvil
2011-12-17 12:33 ` Pedro Alves
2011-12-17 19:37 ` Jan Kratochvil [this message]
2011-12-17 19:44 ` [patch] s390*: watchpoints regression [Re: [obv] s390*: Fix build regression] Pedro Alves
2011-12-17 19:45 ` Jan Kratochvil
2011-12-17 19:56 ` [patch] s390*: watchpoints regression [repost] Jan Kratochvil
2011-12-17 20:13 ` Pedro Alves
2011-12-17 20:35 ` Pedro Alves
2011-12-17 21:08 ` Jan Kratochvil
2011-12-18 6:37 ` Joel Brobecker
2011-12-18 10:11 ` Jan Kratochvil
2011-12-18 11:38 ` Joel Brobecker
2011-12-18 12:38 ` Code formatting [Re: [patch] s390*: watchpoints regression [repost]] Jan Kratochvil
2011-12-18 15:50 ` Mark Kettenis
2011-12-18 17:24 ` Eli Zaretskii
2011-12-18 17:57 ` Jan Kratochvil
2011-12-18 18:45 ` Eli Zaretskii
2011-12-20 14:29 ` Pedro Alves
2011-12-18 11:42 ` [patch] s390*: watchpoints regression [repost] Eli Zaretskii
2011-12-19 21:37 ` Ulrich Weigand
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=20111217191543.GA5564@host2.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=pedro@codesourcery.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