From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2417 invoked by alias); 1 Apr 2016 16:38:09 -0000 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 Received: (qmail 2402 invoked by uid 89); 1 Apr 2016 16:38:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 01 Apr 2016 16:38:06 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3252A7F6C1; Fri, 1 Apr 2016 16:38:05 +0000 (UTC) Received: from [10.3.113.129] (ovpn-113-129.phx2.redhat.com [10.3.113.129]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u31Gc3OR015109; Fri, 1 Apr 2016 12:38:03 -0400 Subject: Re: [PATCH v4] Implement 'catch syscall' for gdbserver To: Yao Qi References: <1449196006-13759-2-git-send-email-jistone@redhat.com> <1452308954-13679-1-git-send-email-jistone@redhat.com> <5694EC0E.2080904@redhat.com> <56954F8C.6010100@redhat.com> <56955283.1060502@redhat.com> <56955B84.7050905@redhat.com> <86mvphs6kv.fsf@gmail.com> <56FAC588.6060200@redhat.com> <56FB1486.60208@redhat.com> <86io04rw7k.fsf@gmail.com> <56FC78E3.6020300@redhat.com> <86bn5tqy29.fsf@gmail.com> Cc: Pedro Alves , gdb-patches@sourceware.org, philippe.waroquiers@skynet.be, sergiodj@redhat.com, eliz@gnu.org, xdje42@gmail.com, scox@redhat.com From: Josh Stone Message-ID: <56FEA3EB.9060306@redhat.com> Date: Fri, 01 Apr 2016 16:38:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1 MIME-Version: 1.0 In-Reply-To: <86bn5tqy29.fsf@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2016-04/txt/msg00010.txt.bz2 On 04/01/2016 06:05 AM, Yao Qi wrote: > Josh Stone writes: > >> Well, sure, but I have no idea where that somewhere else could be. >> >> Note these architectures do work for other syscall returns. It's just >> that execve is a bit special by switching the whole process out. > > I talked with a kernel people, looks GDB can't fetch the syscall number > on execve exit. > >> >> I suppose we could try to save the number on syscall entry, and just >> report that again when it returns. But it's not 100% sure that we'll > > Yes, that is what I am thinking too. I guess then it's a question whether we try to save this as much as possible, or only for cases that look like execve (on entry). >> see every entry first. For instance, one could 'catch execve' first, >> which will continue until PTRACE_EVENT_EXEC mid-syscall, then turn on >> 'catch syscall' and see what returns. >> (This is similar to what test_catch_syscall_mid_vfork checks.) > > Yeah, we can't guarantee syscall enter comes into first. I doubt > 'lp->syscall_state' is confused in this case too, no? This is one of the things I fixed. We know that events like PTRACE_EVENT_EXEC are mid-syscall, even if we didn't see the entry, so a syscall event that follows must be a return. And other ptrace stops are never mid-syscall, so a syscall that follows those must be an entry. This is set in linux_handle_extended_wait and wait_lwp.