This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: gdb: detection and/or fork+gethostbyname crash workaround?


On Tue, Jul 24, 2001 at 01:26:07PM -0700, Kevin Buettner wrote:
> [1] Actually, maybe there is.  It may be possible to place a
> breakpoint libc's fork() entry point.  When this breakpoint is hit,
> we call ptrace(PTRACE_SYSCALL,...) twice.  From my reading of the
> documentation, the first PTRACE_SYSCALL call will stop at the fork
> syscall's entry point, the second will stop when the syscall is about
> to return.  We could remove all breakpoints on the first stop (fork
> entry) and restore them on the second stop (fork exit).

Yeah, that's how PTRACE_SYSCALL works - see strace for the gory
details.  It can even be used to stop in both the parent and the child.

I've wanted to be able to even access PTRACE_SYSCALL from gdb; it can
be convenient for getting to a particular point in execution.  It would
require defining a new type of breakpoint, though.

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]