From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 43917 invoked by alias); 8 Mar 2015 20:30: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 43906 invoked by uid 89); 8 Mar 2015 20:30:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: glazunov.sibelius.xs4all.nl Received: from sibelius.xs4all.nl (HELO glazunov.sibelius.xs4all.nl) (83.163.83.176) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Sun, 08 Mar 2015 20:30:07 +0000 Received: from glazunov.sibelius.xs4all.nl (kettenis@localhost [127.0.0.1]) by glazunov.sibelius.xs4all.nl (8.14.5/8.14.3) with ESMTP id t28KTxDv017265; Sun, 8 Mar 2015 21:29:59 +0100 (CET) Received: (from kettenis@localhost) by glazunov.sibelius.xs4all.nl (8.14.5/8.14.3/Submit) id t28KToYr022852; Sun, 8 Mar 2015 21:29:50 +0100 (CET) Date: Sun, 08 Mar 2015 20:30:00 -0000 Message-Id: <201503082029.t28KToYr022852@glazunov.sibelius.xs4all.nl> From: Mark Kettenis To: palves@redhat.com CC: gdb-patches@sourceware.org In-reply-to: <54FA1EB3.2050706@redhat.com> (message from Pedro Alves on Fri, 06 Mar 2015 21:40:03 +0000) Subject: Re: [PATCH 2/6] Introduce throw_ptrace_error References: <1425671886-7798-1-git-send-email-palves@redhat.com> <1425671886-7798-3-git-send-email-palves@redhat.com> <201503062103.t26L3tef004332@glazunov.sibelius.xs4all.nl> <54FA1EB3.2050706@redhat.com> X-SW-Source: 2015-03/txt/msg00203.txt.bz2 > Date: Fri, 06 Mar 2015 21:40:03 +0000 > From: Pedro Alves > > On 03/06/2015 09:03 PM, Mark Kettenis wrote: > >> From: Pedro Alves > >> Date: Fri, 6 Mar 2015 19:58:02 +0000 > >> > >> This adds a new function that is meant to be called instead of > >> perror_with_name whenever we get an error out of ptrace. The > >> idea is to convert some errno errors to different GDB exceptions in > >> a following patch. > > > > What is ptrace-specific about throwing an error? This really feels > > like the wrong direction to me. > > Not exactly sure what you mean. Throwing an error is > of course not ptrace-specific. What is ptrace-specific is the > interpretation of errno. The end result of the series is that > an ESRCH as a result of a ptrace error ends up throwing > a THREAD_NOT_FOUND_ERROR error instead of a GENERIC_ERROR. Then > callers up the chain can actually distinguish the errors. > > Please take a look at patch 3. It should make things clearer. I think your interpretation of ESRCH is too Linux-centric. You're once again duct-taping around the Linux kernel's whoefully insufficient threads debugging capabilities. It really should not be possible for a thread to just disappear without the debugger being notified. Do I sound like a broken record? I think at this point the right approach is to make linux_resume_one_lwp() call ptrace() directly instead of calling down into the inf_ptrace_resume(). That way you can simply check errno in the place where it matters.