From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 111584 invoked by alias); 11 Dec 2015 21:19:24 -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 111572 invoked by uid 89); 11 Dec 2015 21:19:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.6 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 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, 11 Dec 2015 21:19:23 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 117878F4F5; Fri, 11 Dec 2015 21:19:22 +0000 (UTC) Received: from [10.3.113.161] (ovpn-113-161.phx2.redhat.com [10.3.113.161]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tBBLJKOC006132; Fri, 11 Dec 2015 16:19:20 -0500 Subject: Re: [PATCH v3 2/2] Implement 'catch syscall' for gdbserver To: Pedro Alves , gdb-patches@sourceware.org References: <1448506425-24691-1-git-send-email-jistone@redhat.com> <1449196006-13759-1-git-send-email-jistone@redhat.com> <1449196006-13759-2-git-send-email-jistone@redhat.com> <5661929E.7020406@redhat.com> <566248F2.5020908@redhat.com> Cc: philippe.waroquiers@skynet.be, sergiodj@redhat.com, eliz@gnu.org, xdje42@gmail.com From: Josh Stone Message-ID: <566B3DD8.9050206@redhat.com> Date: Fri, 11 Dec 2015 21:19:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <566248F2.5020908@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2015-12/txt/msg00244.txt.bz2 On 12/04/2015 06:16 PM, Josh Stone wrote: > On 12/04/2015 05:18 AM, Pedro Alves wrote: >> Quick question: What is supposed to happen to the QCatchSyscalls >> when the process execs? I'm thinking of 64-bit inferior execing >> 32-bit inferior, etc. The syscall numbers aren't necessarily shared >> between the different architectures. This implementation deletes discards >> the previous QCatchSyscalls on exec, and I think that's what makes sense, >> but, I think that this should be explicit in the packet's description. > > Yes, I think it should be cleared to avoid any assumption about the > architecture. I'll add a note in the description codifying this. After exploration, I'm having second thoughts about this point. Yes, the current implementation clears it, but only when PTRACE_O_TRACEEXEC is enabled to actually get that event. That's only if the client sent "qSupports:exec-events+". Otherwise, the server doesn't even know an exec happened, so it can't really promise to reset the syscall table. Since the server doesn't promise to always catch execs, I think we should actually go the other way to stay consistent. Let the syscall list be carried over, and document that clients should probably send a new list after execs in case the architecture changed. Some clients may just choose to live with the assumption that the arch is consistent in their environment. Thoughts? >> I'm not sure gdb clears the inferior's "syscalls to the caught" VEC >> on exec events, but it probably does (if it doesn't, I think it should.) > > I'll see if I can find out. AFAICT the only time anything is removed from syscall_catchpoint's VEC syscalls_to_be_caught is in breakpoint_ops->remove_location and ->dtor, respectively remove_catch_syscall and dtor_catch_syscall. And since this list isn't stored in the lwp structure itself, the exec doesn't really affect anything. Right?