From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Jacobowitz To: Kevin Buettner Cc: "Glenn F. Maynard" , gdb@sourceware.cygnus.com Subject: Re: gdb: detection and/or fork+gethostbyname crash workaround? Date: Tue, 24 Jul 2001 14:22:00 -0000 Message-id: <20010724142240.A20056@nevyn.them.org> References: <20010723210115.B1359@zewt.org> <1010724155219.ZM20181@ocotillo.lan> <20010724142248.A2923@zewt.org> <1010724202607.ZM20680@ocotillo.lan> X-SW-Source: 2001-07/msg00352.html 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