Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Apr 2012 10:49:35 -0700
From:      Dmitry Mikulin <dmitrym@juniper.net>
To:        Konstantin Belousov <kostikbel@gmail.com>
Cc:        "toolchain@freebsd.org" <toolchain@freebsd.org>
Subject:   Re: gdb support for follow-fork
Message-ID:  <4F8C5BAF.70507@juniper.net>
In-Reply-To: <20120416045551.GZ2358@deviant.kiev.zoral.com.ua>
References:  <4F8737E9.6010300@juniper.net> <20120416045551.GZ2358@deviant.kiev.zoral.com.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
> Yes, could you, please, split the patch somewhat ?
> It would be much easier to review if you were able to provide relatively
> small pieces with descriptions.

I don't think I can split it into independent functioning pieces, but I can group the changes logically and explain them in a bit more detail. I'll go by groups of files.

1. These files contain added initialization for a new fbsd target specific file fbsd-nat.c. The same change is applied to every supported target architecture. A call to _initialize_fbsdnat() is added and fbsd-nat.o is added to the make files.
gnu/usr.bin/gdb/arch/arm/init.c
gnu/usr.bin/gdb/arch/arm/Makefile
gnu/usr.bin/gdb/arch/powerpc/init.c
gnu/usr.bin/gdb/arch/powerpc/Makefile
gnu/usr.bin/gdb/arch/sparc64/init.c
gnu/usr.bin/gdb/arch/ia64/init.c
gnu/usr.bin/gdb/arch/ia64/Makefile
gnu/usr.bin/gdb/arch/mips/init.c
gnu/usr.bin/gdb/arch/mips/Makefile
gnu/usr.bin/gdb/arch/i386/init.c
gnu/usr.bin/gdb/arch/i386/Makefile
gnu/usr.bin/gdb/arch/powerpc64/init.c
gnu/usr.bin/gdb/arch/powerpc64/Makefile
gnu/usr.bin/gdb/arch/amd64/init.c
gnu/usr.bin/gdb/arch/amd64/Makefile

2. Added target specific verions of follow_fork() and follow_exec()
contrib/gdb/gdb/target.c
contrib/gdb/gdb/target.h

3. Added an external interface to check if the thread list is empty.
contrib/gdb/gdb/thread.c
contrib/gdb/gdb/gdbthread.h

4. Added 2 new interfaces to clear step-resume breakpoint info; switched to target specific follow-fork.
contrib/gdb/gdb/infrun.c

5. Fix for a problem re-loading binaries after fork-exec.
contrib/gdb/gdb/objfiles.c

6. This is where the 'meat' of the implementation is.
fbsd-nat.c is a new file which contains FreeBSD specific  functions to handle follow-fork and follow-exec.
fbsd_wait() is added to handle stops attributed to fork() and exec() and to translate those stops into target independent info that handle_inferior_event() can understand.
fbsd_follow_fork() manages the switch-over from parent to child when gdb is to follow the child or manages a clean detach from the child when gdb is to follow the parent.
fbsd_follow_exec() manages the switch-over from one symbol file to another when gdb is stopped after a successful exec() in the inferior.
gnu/usr.bin/gdb/libgdb/fbsd-nat.c

The changes here deal with the fact that thread state if a process gdb is tracing changes after fork()  when we follow the child and exec().
gnu/usr.bin/gdb/libgdb/fbsd-threads.c






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4F8C5BAF.70507>