From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 108223 invoked by alias); 7 May 2015 10:39:03 -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 106625 invoked by uid 89); 7 May 2015 10:39:02 -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 10:39:01 +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 (8.14.4/8.14.4) with ESMTP id t47ActjJ007523 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 7 May 2015 06:38:56 -0400 Received: from blade.nx (ovpn-116-110.ams2.redhat.com [10.36.116.110]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t47Acs4b006981; Thu, 7 May 2015 06:38:55 -0400 Received: by blade.nx (Postfix, from userid 1000) id DE74E263CB1; Thu, 7 May 2015 11:38:53 +0100 (BST) Date: Thu, 07 May 2015 10:39: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: <20150507103853.GA978@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: <20150501202948.GA11582@blade.nx> X-IsSubscribed: yes X-SW-Source: 2015-05/txt/msg00137.txt.bz2 Gary Benson wrote: > Alban Crequy wrote: > > On Fri, May 1, 2015 at 11:28 AM, Gary Benson wrote: > > > Alban Crequy wrote: > > > > On Thu, Apr 30, 2015 at 2:05 PM, 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. I'm > not sure how well that'd work if you had hundreds or thousands of > containers running though... It'd be nice to have a command like ps > but that was limited to one container and that listed both inner and > outer PIDs [snip] FWIW the command I was looking for is "docker top": bash-4.2# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 615386bf33ac rhel7:0 "bash" 11 minutes ago Up 11 minutes rhel7 bash-4.2# docker top 615386bf33ac UID PID PPID C STIME TTY TIME CMD root 2209 939 0 11:18 pts/1 00:00:00 bash root 2595 939 0 11:23 ? 00:00:00 nsenter-exec --nspid 2209 -- gdb -p 1 root 2596 2595 0 11:23 ? 00:00:00 gdb -p 1 root 2653 939 0 11:24 pts/4 00:00:00 nsenter-exec --nspid 2209 --console /dev/pts/4 -- bash root 2654 2653 0 11:24 pts/4 00:00:00 bash root 2674 2654 0 11:26 pts/4 00:00:01 /usr/bin/python /usr/bin/debuginfo-install gdb-7.6.1-64.el7.x86_64 root 2675 2674 7 11:26 pts/4 00:00:22 /usr/bin/python /usr/libexec/urlgrabber-ext-down root 2676 2674 1 11:26 pts/4 00:00:03 /usr/bin/python /usr/libexec/urlgrabber-ext-down Cheers, Gary -- http://gbenson.net/