From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28845 invoked by alias); 10 Jan 2004 06:52:17 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 28838 invoked from network); 10 Jan 2004 06:52:16 -0000 Received: from unknown (HELO nevyn.them.org) (66.93.172.17) by sources.redhat.com with SMTP; 10 Jan 2004 06:52:16 -0000 Received: from drow by nevyn.them.org with local (Exim 4.30 #1 (Debian)) id 1AfCyl-0008Ah-OX; Sat, 10 Jan 2004 01:52:15 -0500 Date: Sat, 10 Jan 2004 06:52:00 -0000 From: Daniel Jacobowitz To: Joel Brobecker Cc: gdb-patches@sources.redhat.com Subject: Re: question about GDB, ptrace, and /proc... Message-ID: <20040110065215.GA31344@nevyn.them.org> Mail-Followup-To: Joel Brobecker , gdb-patches@sources.redhat.com References: <20040110055300.GV4978@gnat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040110055300.GV4978@gnat.com> User-Agent: Mutt/1.5.1i X-SW-Source: 2004-01/txt/msg00261.txt.bz2 On Sat, Jan 10, 2004 at 09:53:00AM +0400, Joel Brobecker wrote: > Hello, > > while reading some linux-specific code such as linux-nat.c for instance, > I was a bit surprised to see some calls to functions which seem to use > /proc. For instance, there is a call to child_pid_to_exec_file() inside > linux_handle_extended_wait() in linux-nat.c which causes GDB to read > into the /proc filesystem. > > I was surprised, because I thought the linux ports were using ptrace, > meaning using ptrace exclusively. Does GDB also need /proc, or is /proc > only optional? Or does GDB support both interfaces on Linux? The Linux /proc filesystem is not at all like the Solaris-style /proc. It can not be used as a replacement for ptrace. However, for some things (like child_pid_to_exec_file) it's the only option. And for others (lin_lwp_xfer_memory) it's dramatically more efficient. Right now, GDB will behave gracefully if /proc is unavailable, for most uses. However I wouldn't consider that a guarantee if I were you. As time goes by more and more Linux userspace functionality relies on /proc. -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer