This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 2/9 v2] Introduce nat/linux-namespaces.[ch]
- From: Gary Benson <gbenson at redhat dot com>
- To: Alban Crequy <alban at endocode dot com>
- Cc: gdb-patches at sourceware dot org, Eli Zaretskii <eliz at gnu dot org>, Pedro Alves <palves at redhat dot com>, Doug Evans <dje at google dot com>, Iago López Galeiras <iago at endocode dot com>
- Date: Thu, 7 May 2015 09:41:58 +0100
- Subject: Re: [PATCH 2/9 v2] Introduce nat/linux-namespaces.[ch]
- Authentication-results: sourceware.org; auth=none
- References: <1429186791-6867-1-git-send-email-gbenson at redhat dot com> <1430395542-16017-3-git-send-email-gbenson at redhat dot com> <20150501000739 dot 740 dot 47967 at domU-12-31-39-0A-A0-4F> <20150501092817 dot GA28105 at blade dot nx> <CALdWxcuP1crzx7rTFbVcOtgn5abxxHn31kq2s+v9LmPK=buwqQ at mail dot gmail dot com> <20150501202948 dot GA11582 at blade dot nx> <CALdWxct0j=jb1wV8oTtwYgxKMesU1UYhUaGusM_gFR5tnM4ybw at mail dot gmail dot com>
Alban Crequy wrote:
> On Fri, May 1, 2015 at 1:29 PM, Gary Benson <gbenson@redhat.com> wrote:
> > Alban Crequy wrote:
> > > On Fri, May 1, 2015 at 11:28 AM, Gary Benson <gbenson@redhat.com> 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/