2005-11-21  Michael Snyder  <msnyder@redhat.com>

	* gcore.c: Add restore-corefile-command.

	(call_target_sbrk): Abstracted from derive_heap_segment.
	(derive_heap_segment): Call call_target_sbrk instead of
	coding it inline.
	(load_core_sections): Callback for bfd_map_over_sections.
	(rcore_command): Implements restore-corefile-command ('rcore').
	(__initialize_gcore): Add new command rcore/restore-corefile.
class_obscure
2005-11-21  Michael Snyder  <msnyder@redhat.com>

	* linux-nat.c: Add crude checkpoint/restart using forks.

	(child_follow_fork): Put a conditional around PTRACE_DETACH.
	FIXME needs to be done in the parent branch too.
	(__initialize_linux_nat): Call checkpoint_init.
	(struct fork_info): Analog of thread_info.
	(fork_load_infrun_state, fork_save_infrun_state):
	Save and restore necessary info for fork context switch.
	(add_fork, free_fork, delete_fork, find_fork_id, init_fork_list,
	find_fork_ptid, iterate_over_forks, valid_fork_id, pid_to_fork_id,
	fork_id_to_ptid, in_fork_list): Analogs to thread_list methods.
	(info_forks_command): Implement "info forks" (info checkpoints).
	(delete_checkpoint): Implement "delete-checkpoint" command.
	(checkpoint_command): Implement "checkpoint" command.
	(restart_command): Implement "restart" command.
	(checkpoint_init): Initialization for checkpoint sub-module.

	* infrun.c (set_last_target_status): Supporting function
	for checkpoint/restart based on forks (linux).
2005-11-23  Michael Snyder  <msnyder@redhat.com>

	* linux-nat.c: Adapt fork list to work with follow_fork.

	(child_follow_fork): Add non-detached fork to fork list.
	Handle follow-child as well as follow-parent.
	(fork_load_infrun_state, fork_save_infrun_state):
	Don't save any actual infrun state except for last_ptid.
	Just save registers, and add the option of NOT restoring them.
	Also don't leak regcache objects.
	(add_fork): Accept a pid instead of a ptid.
	(find_fork_pid): New function.
	(pid_to_fork_id): Delete function.
	(detach_fork_command): New command.
	(checkpoint_command): Remember previous setting of detach_fork.
	Don't call add_fork, it's now done by child_follow_fork.
	FIXME get rid of call to target_fetch_registers.
	(checkpoint_init): Add setshow detach-on-fork.
	Add detach-fork.
2005-11-25  Michael Snyder  <msnyder@redhat.com>

	* gdb.base/foll-fork.exp: Add PASS cases for linux.
2005-11-25  Michael Snyder  <msnyder@redhat.com>

	* linux-nat.c (child_follow_fork): Add verbose messages when
	detaching from parent or child (to match HPUX tests in testsuite).
2005-11-25  Michael Snyder  <msnyder@redhat.com>

	* infrun.c (set_last_target_status): Remove, replace with following.
	(nullify_last_target_wait_ptid): New function.  Now we don't need
	to save this bit of state in linux-nat.

	* linux-nat.c (struct fork_info): Get rid of last_target_ptid,
	last_target_waitstatus, and inferior status.
	(fork_load_infrun_state): Forget about infrun status and target
	wait ptid.  Call nullify_last_target_wait_ptid instead.
	(fork_save_infrun_state): Forget about infrun status and target
	wait ptid.
	(free_fork): Forget about infrun status.
	(detach_fork_command): Output cleanup.

	* linux-nat.c (child_follow_fork): Add verbose messages when
	detaching from parent or child (to match HPUX tests in testsuite).
2005-11-25  Michael Snyder  <msnyder@redhat.com>

	* linux-nat.c (restart_auto_finish): New set/show variable.
	(restart_command): Automatically do "finish" a few times
	on request.
2005-11-26  Michael Snyder  <msnyder@redhat.com>

	* linux-fork.h: New file.
	* linux-nat.c: Include linux-fork.h, remove forward declarations.
	(kill_inferior): Loop over forks and PTRACE_KILL them all.
	(add_fork): Special case -- insert original fork as special
	zeroeth element in list.
	(info_forks_command): Use current PC instead of savedregs pc
	for current fork.  If no SAL, print a minsym.  Identify the
	zeroeth fork as "main process".
2005-11-26  Michael Snyder  <msnyder@redhat.com>

	* linux-nat.c (super_mourn_inferior): New function pointer.
	(child_mourn_inferior): New method, overrides to_mourn_inferior.
	Handles multiple forks.
	(linux_target): Intercept to_mourn_inferior, save pointer to
	parent method.
2005-11-28  Michael Snyder  <msnyder@redhat.com>

	* linux-fork.c: New file.  Move fork list and fork commands here.
	* linux-fork.h: Now acts as interface between linux-nat and linux-fork.
	* linux-nat.c: Move all fork-related functions to linux-fork.c.
	(child_mourn_inferior): Use new API to linux-fork, instead of
	manipulating the fork list directly.
	(kill_inferior): Ditto.
2005-11-28  Michael Snyder  <msnyder@redhat.com>

	* linux-fork.c: New file.  Move fork list and fork commands here.
	* linux-fork.h: Now acts as interface between linux-nat and linux-fork.
	* linux-nat.c: Move all fork-related functions to linux-fork.c.
	(child_mourn_inferior): Use new API to linux-fork, instead of
	manipulating the fork list directly.
	(kill_inferior): Ditto.
2005-11-28  Michael Snyder  <msnyder@redhat.com>

	* gdb.base/multi-forks.c: New file.
	* gdb.base/multi-forks.exp: New file.  Test debugging of
	multiple forked inferior processes (don't detach when inferior
	calls fork).
2005-11-28  Michael Snyder  <msnyder@redhat.com>

	* Makefile.in: Add linux-fork.c.
	* config/i386/linux.mh: Add linux-fork.o.
2005-11-29  Michael Snyder  <msnyder@redhat.com>

	* linux-fork.c (process_command): New command, new function.
	Switch fork contexts by process id, rather than fork id.
	(linux_fork_context): New function.  Abstract out the guts
	of restart_command, to be called by process_command and
	fork_command.
	(fork_command): New function.  Look up a fork id, call
	linux_fork_context.
	(_initialize_linux_fork): Add new "process" command.
2005-11-30  Michael Snyder  <msnyder@redhat.com>

	* linux-fork.c (struct fork_info): Add fields for saving
	file offsets of all open file descriptors.
	(free_fork): Free storage for file offsets.
	(call_lseek): New function.  Call lseek in the inferior.
	(fork_save_infrun_state): Use /proc and call_lseek to save
	file offsets for all open file descriptors in inferior.
	(fork_load_infrun_state): Use call_lseek to restore file offsets.
	(restart_command): Fix oversight, save fork id.
2005-12-01  Michael Snyder  <msnyder@redhat.com>

	* linux-fork.c (fork_save_infrun_state): Close the DIR.
	(info_forks_command): Print bare filename, not full path.
	* linux-nat.c (kill_inferior): For multi-fork, pop target
	and call generic_mourn_inferior, not target_mourn_inferior.
2005-12-05  Michael Snyder  <msnyder@redhat.com>

	* gdb.base/checkpoint.c: New file.
	* gdb.base/checkpoint.exp: New file.  Test checkpoint/restart
	on Linux (using fork).
	* gdb.base/pi.txt: New file, test load for checkpoint.exp test.
2005-12-06  Michael Snyder  <msnyder@redhat.com>

	* linux-fork.c (linux_fork_mourn_inferior): Guard against null.
	(delete_fork_command): Guard against not-found.  Replace strtol
	with parse_and_eval_long.  Announce result.
	(detach_fork_command): Ditto.
2005-12-06  Michael Snyder  <msnyder@redhat.com>

	* linux-fork.c (linux_fork_mourn_inferior): Guard against null.
	(delete_fork_command): Guard against not-found.  Replace strtol
	with parse_and_eval_long.  Announce result.
	(detach_fork_command): Ditto.