Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: dje@google.com (Doug Evans)
To: gdb-patches@sourceware.org, sergiodj@linux.vnet.ibm.com
Subject: [RFC] mask off is-syscall bit for TRAP_IS_SYSCALL
Date: Mon, 28 Sep 2009 19:39:00 -0000	[thread overview]
Message-ID: <20090928193905.32592843AC@ruffy.mtv.corp.google.com> (raw)

Hi.

On one system I use (bi-arch ubuntu-hardy clone),
i386-disp-step.exp is failing because the wait status
value linux_nat_wait_1 gets when hitting a system call is 0857f
which gets passed to the upper layers which then get confused
by a signal of 0x85 (== 0x80 | SIGTRAP).

This patch fixes things by masking off the 0x80 bit before
passing the signal number to up the call chain.

Ok to check in?

2009-09-28  Doug Evans  <dje@google.com>

	* linux-nat.c (TRAP_REMOVE_SYSCALL_FLAG): New macro.
	(linux_nat_wait_1): Mask off is-syscall bit in wait status for
	TRAP_IS_SYSCALL before passing value to caller.

Index: linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/linux-nat.c,v
retrieving revision 1.148
diff -u -p -r1.148 linux-nat.c
--- linux-nat.c	28 Sep 2009 18:39:29 -0000	1.148
+++ linux-nat.c	28 Sep 2009 19:29:21 -0000
@@ -70,6 +70,7 @@
 /* To be used when one needs to know wether a
    WSTOPSIG (status) is a syscall */
 #define TRAP_IS_SYSCALL (SIGTRAP | 0x80)
+#define TRAP_REMOVE_SYSCALL_FLAG(status) ((status) & ~(0x80 << 8))
 
 /* This comment documents high-level logic of this file. 
 
@@ -3012,6 +3013,12 @@ retry:
 
 	  lp = linux_nat_filter_event (lwpid, status, options);
 
+	  /* If this was a syscall trap, we no longer need or want
+	     the 0x80 flag, remove it.  */
+	  if (WIFSTOPPED (status)
+	      && WSTOPSIG (status) == TRAP_IS_SYSCALL)
+	    status = TRAP_REMOVE_SYSCALL_FLAG (status);
+
 	  if (lp
 	      && ptid_is_pid (ptid)
 	      && ptid_get_pid (lp->ptid) != ptid_get_pid (ptid))


             reply	other threads:[~2009-09-28 19:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-28 19:39 Doug Evans [this message]
2009-09-28 19:46 ` Sérgio Durigan Júnior
2009-09-28 19:58 ` Pedro Alves
2009-09-28 23:27   ` Pedro Alves
2009-09-29 12:45 Doug Evans
2009-09-29 14:32 ` 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=20090928193905.32592843AC@ruffy.mtv.corp.google.com \
    --to=dje@google.com \
    --cc=gdb-patches@sourceware.org \
    --cc=sergiodj@linux.vnet.ibm.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