From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26034 invoked by alias); 8 Mar 2012 13:55:41 -0000 Received: (qmail 26022 invoked by uid 22791); 8 Mar 2012 13:55:40 -0000 X-SWARE-Spam-Status: No, hits=-6.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 08 Mar 2012 13:55:24 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q28DtOAn015607 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 8 Mar 2012 08:55:24 -0500 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q28DtM6K014875; Thu, 8 Mar 2012 08:55:23 -0500 Message-ID: <4F58BA4A.9090903@redhat.com> Date: Thu, 08 Mar 2012 13:55:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.1) Gecko/20120216 Thunderbird/10.0.1 MIME-Version: 1.0 To: Jan Kratochvil CC: gdb-patches@sourceware.org Subject: Re: [patch 2/3] attach-fail-reasons: Say more than ptrace: Operation not permitted. References: <20120306061710.GB24004@host2.jankratochvil.net> In-Reply-To: <20120306061710.GB24004@host2.jankratochvil.net> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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: 2012-03/txt/msg00263.txt.bz2 On 03/06/2012 06:17 AM, Jan Kratochvil wrote: > +void > +linux_ptrace_attach_warnings (pid_t pid) > +{ > + pid_t tracerpid; > + > + tracerpid = linux_proc_get_tracerpid (pid); ... > +extern pid_t linux_proc_get_tracerpid (int lwpid); .. Would be neater with `pid_t lwpid'. I agree this is a useful addition. linux_ptrace_attach_warnings has a tiny race, in that by the time you open /proc/pid/... you may be looking at a different process. There's no way to fix that, I think, and this will be right in the large majority of the cases, so we can just live with it, IMO. You may have considered the following already, but I haven't seen it mentioned. I think it may be better if the new warning strings are actually part of the thrown error string: - for example, frontends that display the error to the user as a dialog box or similar show the whole warning+error automatically, instead of having the warning get lost in the console noise (if it's visible at all). - It's perhaps better for gdbserver as well, as we can forward the whole error string to GDB so that GDB shows it to the user (the `E.' thing) (although we could forward warnings as well with the O packet, though we don't do that presently). - If some code in GDB, or most likely a python script, wraps "attach", and catches the error, it presumably will also want to capture the warnings. Having everything in the exception seems cleaner. (Note this is not an objection. Your patch is useful as it is.) -- Pedro Alves