From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 77489 invoked by alias); 7 May 2015 08:42:08 -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 77468 invoked by uid 89); 7 May 2015 08:42:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_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; Thu, 07 May 2015 08:42:06 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t478g0dQ012684 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 7 May 2015 04:42:00 -0400 Received: from blade.nx (ovpn-116-21.ams2.redhat.com [10.36.116.21]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t478fx1F008294; Thu, 7 May 2015 04:42:00 -0400 Received: by blade.nx (Postfix, from userid 1000) id AAB5A263C9B; Thu, 7 May 2015 09:41:58 +0100 (BST) Date: Thu, 07 May 2015 08:42:00 -0000 From: Gary Benson To: Alban Crequy Cc: gdb-patches@sourceware.org, Eli Zaretskii , Pedro Alves , Doug Evans , Iago =?iso-8859-1?Q?L=F3pez?= Galeiras Subject: Re: [PATCH 2/9 v2] Introduce nat/linux-namespaces.[ch] Message-ID: <20150507084158.GA27258@blade.nx> References: <1429186791-6867-1-git-send-email-gbenson@redhat.com> <1430395542-16017-3-git-send-email-gbenson@redhat.com> <20150501000739.740.47967@domU-12-31-39-0A-A0-4F> <20150501092817.GA28105@blade.nx> <20150501202948.GA11582@blade.nx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-IsSubscribed: yes X-SW-Source: 2015-05/txt/msg00134.txt.bz2 Alban Crequy wrote: > On Fri, May 1, 2015 at 1:29 PM, Gary Benson wrote: > > Alban Crequy wrote: > > > On Fri, May 1, 2015 at 11:28 AM, Gary Benson wrote: > > > > The scenario I'm targeting is that you have an application you > > > > want to debug running in a container. You don't want to run > > > > GDB as root on the container host, so you start a second > > > > container with just the privileges you need and run GDB from > > > > there. > > > > > > How do you get the pid of the process to give as a parameter to > > > "gdb -p" if gdb is running in a different pid namespace than the > > > process to debug? > > > > It's the PID on the host, I've just been finding them with ps. > > But if you get the pid of the process to debug on the host, that pid > is not meaningful in the container where GDB is running. How can > tell gdb to attach to the pid if that pid is not visible in gdb's > container? Docker has an option --pid=host that starts a container without creating a PID namespace for it. I'm starting the debugger container with that option so it can see the host PID namespace. Cheers, Gary -- http://gbenson.net/