Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@cygnus.com>
To: Daniel Jacobowitz <dmj+@andrew.cmu.edu>,
	"Glenn F. Maynard" <g_gdb@zewt.org>
Cc: gdb@sourceware.cygnus.com
Subject: Re: gdb: detection and/or fork+gethostbyname crash workaround?
Date: Tue, 24 Jul 2001 13:44:00 -0000	[thread overview]
Message-ID: <1010724204353.ZM20741@ocotillo.lan> (raw)
In-Reply-To: <20010724132604.A18052@nevyn.them.org>

On Jul 24,  1:26pm, Daniel Jacobowitz wrote:

> > That's what I tried (x86 Linux); a process can't ptrace itself.  I could
> > fork a process to test this, I suppose; I'll try that.  (Wouldn't it
> > be the return status from ptrace(), though?  I assume it'd return something
> > like EPERM if a process is already being debugged.)
> 
> Try ptrace( PTRACE_TRACEME, ...) ?

Actually, what I had in mind was for a child process to call
ptrace (PTRACE_ATTACH, ...) with the pid of the parent.  (And then, if
that succeeds immediately call ptrace (PTRACE_DETACH,...).

The reason for for not using PTRACE_PTRACEME is that it is unlikely
that the parent will know what to do with various wait messages
that'll be sent to it.  (I.e, you don't want to call PTRACE_TRACEME
unless your parent is actually a debugger.)

However, there are other approaches that Glenn may wish to try.  See

    http://sources.redhat.com/ml/gdb/2001-07/msg00346.html

We should also try to fix GDB so that all breakpoints are removed
when the inferior decides to do a fork().  (The trick will be to
restore them, but the footnote in the above link outlines how it
might be done.)

Kevin


  reply	other threads:[~2001-07-24 13:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-23 18:01 Glenn F. Maynard
2001-07-24  9:23 ` Kevin Buettner
2001-07-24 11:22   ` Glenn F. Maynard
2001-07-24 13:26     ` Kevin Buettner
2001-07-24 13:57       ` Glenn F. Maynard
2001-07-24 14:49         ` Kevin Buettner
2001-07-24 14:22       ` Daniel Jacobowitz
2001-07-24 13:26     ` Daniel Jacobowitz
2001-07-24 13:44       ` Kevin Buettner [this message]
2001-07-24 13:54     ` Mark Kettenis
2001-07-24 13:00 Michael Elizabeth Chastain
2001-07-24 13:53 ` Kevin Buettner
2001-07-24 14:26   ` Glenn F. Maynard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1010724204353.ZM20741@ocotillo.lan \
    --to=kevinb@cygnus.com \
    --cc=dmj+@andrew.cmu.edu \
    --cc=g_gdb@zewt.org \
    --cc=gdb@sourceware.cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox