From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5370 invoked by alias); 28 Sep 2009 19:39:22 -0000 Received: (qmail 5360 invoked by uid 22791); 28 Sep 2009 19:39:21 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.33.17) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 28 Sep 2009 19:39:15 +0000 Received: from zps75.corp.google.com (zps75.corp.google.com [172.25.146.75]) by smtp-out.google.com with ESMTP id n8SJd81p020812; Mon, 28 Sep 2009 20:39:08 +0100 Received: from ruffy.mtv.corp.google.com (ruffy.mtv.corp.google.com [172.18.118.116]) by zps75.corp.google.com with ESMTP id n8SJd58t023634; Mon, 28 Sep 2009 12:39:06 -0700 Received: by ruffy.mtv.corp.google.com (Postfix, from userid 67641) id 32592843AC; Mon, 28 Sep 2009 12:39:05 -0700 (PDT) To: gdb-patches@sourceware.org, sergiodj@linux.vnet.ibm.com Subject: [RFC] mask off is-syscall bit for TRAP_IS_SYSCALL Message-Id: <20090928193905.32592843AC@ruffy.mtv.corp.google.com> Date: Mon, 28 Sep 2009 19:39:00 -0000 From: dje@google.com (Doug Evans) X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-09/txt/msg00885.txt.bz2 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 * 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))