Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* question about GDB, ptrace, and /proc...
@ 2004-01-10  5:53 Joel Brobecker
  2004-01-10  6:52 ` Daniel Jacobowitz
  0 siblings, 1 reply; 2+ messages in thread
From: Joel Brobecker @ 2004-01-10  5:53 UTC (permalink / raw)
  To: gdb-patches

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?

-- 
Joel


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: question about GDB, ptrace, and /proc...
  2004-01-10  5:53 question about GDB, ptrace, and /proc Joel Brobecker
@ 2004-01-10  6:52 ` Daniel Jacobowitz
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Jacobowitz @ 2004-01-10  6:52 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-01-10  6:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-10  5:53 question about GDB, ptrace, and /proc Joel Brobecker
2004-01-10  6:52 ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox