/* GNU/Linux native-dependent code for debugging multiple forks.
- Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
This file is part of GDB.
registers_changed ();
reinit_frame_cache ();
- /* We must select a new frame before making any inferior calls to
- avoid warnings. */
- select_frame (get_current_frame ());
-
stop_pc = read_pc ();
nullify_last_target_wait_ptid ();
struct fork_info *fp;
int cur_line;
ULONGEST pc;
+ int requested = -1;
+ struct fork_info *printed = NULL;
+
+ if (arg && *arg)
+ requested = (int) parse_and_eval_long (arg);
for (fp = fork_list; fp; fp = fp->next)
{
+ if (requested > 0 && fp->num != requested)
+ continue;
+
+ printed = fp;
if (ptid_equal (fp->ptid, inferior_ptid))
{
printf_filtered ("* ");
putchar_filtered ('\n');
}
+ if (printed == NULL)
+ {
+ if (requested > 0)
+ printf_filtered (_("No fork number %d.\n"), requested);
+ else
+ printf_filtered (_("No forks.\n"));
+ }
}
/* Save/restore mode variable 'detach_fork':
restart <n>: restore program context from a checkpoint.\n\
Argument 'n' is checkpoint ID, as displayed by 'info checkpoints'."));
- /* Delete-checkpoint command: kill the process and remove it from
+ /* Delete checkpoint command: kill the process and remove it from
fork list. */
- add_com ("delete-checkpoint", class_obscure, delete_fork_command, _("\
-Delete a fork/checkpoint (experimental)."));
+ add_cmd ("checkpoint", class_obscure, delete_fork_command, _("\
+Delete a fork/checkpoint (experimental)."),
+ &deletelist);
- /* Detach-checkpoint command: release the process to run independantly,
+ /* Detach checkpoint command: release the process to run independently,
and remove it from the fork list. */
- add_com ("detach-checkpoint", class_obscure, detach_fork_command, _("\
-Detach from a fork/checkpoint (experimental)."));
+ add_cmd ("checkpoint", class_obscure, detach_fork_command, _("\
+Detach from a fork/checkpoint (experimental)."),
+ &detachlist);
/* Info checkpoints command: list all forks/checkpoints
currently under gdb's control. */
/* Command aliases (let "fork" and "checkpoint" be used
interchangeably). */
- add_com_alias ("delete-fork", "delete-checkpoint", class_obscure, 1);
- add_com_alias ("detach-fork", "detach-checkpoint", class_obscure, 1);
+ add_alias_cmd ("fork", "checkpoint", class_obscure, 1, &deletelist);
+ add_alias_cmd ("fork", "checkpoint", class_obscure, 1, &detachlist);
add_info_alias ("forks", "checkpoints", 0);
/* "fork <n>" (by analogy to "thread <n>"). */