This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: gdb 6.3 misses breakpoint on Linux when inferior does clone()
- From: Daniel Jacobowitz <drow at false dot org>
- To: Mark Kettenis <mark dot kettenis at xs4all dot nl>
- Cc: tronics93-gdb at yahoo dot com, gdb at sources dot redhat dot com
- Date: Sat, 11 Jun 2005 20:22:52 -0400
- Subject: Re: gdb 6.3 misses breakpoint on Linux when inferior does clone()
- References: <20050531170523.45257.qmail@web31913.mail.mud.yahoo.com> <20050601132331.GA19300@nevyn.them.org> <200506112331.j5BNVc4L020335@elgar.sibelius.xs4all.nl>
On Sun, Jun 12, 2005 at 01:31:38AM +0200, Mark Kettenis wrote:
> Date: Wed, 1 Jun 2005 09:23:31 -0400
> From: Daniel Jacobowitz <drow@false.org>
>
> On Tue, May 31, 2005 at 10:05:22AM -0700, tronics93-gdb@yahoo.com wrote:
> > The following code snippet gets the flags passed in to clone() (on
> > x86):
> >
> > unsigned long regs[FRAME_SIZE];
> >
> > if (ptrace(PTRACE_GETREGS, pid, 0, ®s) < 0)
> > perror("ptrace_getregs failed:");
> >
> > printf("syscall=%d, arg1=%#x, arg2=%#x\n", regs[ORIG_EAX],
> > regs[EBX], regs[ECX]);
>
> Only if you're stopped at the clone. Hmm. Good point; perhaps we can
> recover them from registers when we receive the clone event.
>
> But having to do that in a machine-dependent manner really sucks...
>
> It could probably be implemented if someone spent the time.
>
> ...so that time is probably better spent on implementing the proper
> machine-independent functionality in the Linux kernel!
Except that what we implement in GDB, we don't need to test for at
runtime and handle dependencies on the kernel version. For the special
case of CLONE_VM there's a third option, which may be superior: write
to one thread's memory and see where the value shows up.
--
Daniel Jacobowitz
CodeSourcery, LLC