From b8db102de3021178e81c42925bd6bcbcd3524dec Mon Sep 17 00:00:00 2001 From: Michael Snyder Date: Thu, 27 Apr 2006 23:03:42 +0000 Subject: [PATCH] 2006-04-26 Michael Snyder * linux-fork.c (_initialize_linux_fork): Rename "delete-fork" command to "delete fork" (no hyphen), compatible with other "delete" commands. (info_forks_command): Accept a fork ID argument, for info on a single fork. Report if no matching forks. 2006-04-26 Michael Snyder * gdb.base/multi-forks.exp: Modify patterns for "run to exit", which may have to consume output from other forks. Add tests to make sure that "delete fork" succeeded. 2006-04-27 Michael Snyder * gdb.texinfo (delete-fork): Command renamed to "delete fork". --- gdb/ChangeLog | 8 +++++ gdb/doc/ChangeLog | 4 +++ gdb/doc/gdb.texinfo | 10 +++---- gdb/linux-fork.c | 25 +++++++++++++--- gdb/testsuite/ChangeLog | 6 ++++ gdb/testsuite/gdb.base/multi-forks.exp | 41 ++++++++++++++++---------- 6 files changed, 69 insertions(+), 25 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index be4990c335d..a92b514310b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,11 @@ +2006-04-26 Michael Snyder + + * linux-fork.c (_initialize_linux_fork): Rename "delete-fork" + command to "delete fork" (no hyphen), compatible with other + "delete" commands. + (info_forks_command): Accept a fork ID argument, for info + on a single fork. Report if no matching forks. + 2006-04-25 Mark Kettenis From Masaki MURANAKA : diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 60fe4d05277..dc5f4f1374c 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,7 @@ +2006-04-27 Michael Snyder + + * gdb.texinfo (delete-fork): Command renamed to "delete fork". + 2006-04-22 Andrew Cagney * gdb.texinfo (Contributors): Credit frame unwinder contributors. diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index a7d182ba843..3230dcb40a8 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -2576,7 +2576,7 @@ as shown in the first field of the @samp{info forks} display. To quit debugging one of the forked processes, you can either detach from it by using the @w{@code{detach-fork}} command (allowing it to run independently), or delete (and kill) it using the -@w{@code{delete-fork}} command. +@w{@code{delete fork}} command. @table @code @kindex detach-fork @var{fork-id} @@ -2585,8 +2585,8 @@ Detach from the process identified by @value{GDBN} fork number @var{fork-id}, and remove it from the fork list. The process will be allowed to run independently. -@kindex delete-fork @var{fork-id} -@item delete-fork @var{fork-id} +@kindex delete fork @var{fork-id} +@item delete fork @var{fork-id} Kill the process identified by @value{GDBN} fork number @var{fork-id}, and remove it from the fork list. @@ -2675,8 +2675,8 @@ are not affected by restoring a checkpoint. In general, a checkpoint only restores things that reside in the program being debugged, not in the debugger. -@kindex delete-checkpoint @var{checkpoint-id} -@item delete-checkpoint @var{checkpoint-id} +@kindex delete checkpoint @var{checkpoint-id} +@item delete checkpoint @var{checkpoint-id} Delete the previously-saved checkpoint identified by @var{checkpoint-id}. @end table diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c index bb4468268c2..e96275b8d57 100644 --- a/gdb/linux-fork.c +++ b/gdb/linux-fork.c @@ -448,9 +448,18 @@ info_forks_command (char *arg, int from_tty) 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 ("* "); @@ -490,6 +499,13 @@ info_forks_command (char *arg, int from_tty) 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': @@ -670,11 +686,12 @@ Fork a duplicate process (experimental).")); restart : 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, and remove it from the fork list. */ @@ -691,7 +708,7 @@ Detach from a fork/checkpoint (experimental).")); /* Command aliases (let "fork" and "checkpoint" be used interchangeably). */ - add_com_alias ("delete-fork", "delete-checkpoint", class_obscure, 1); + add_alias_cmd ("fork", "checkpoint", class_obscure, 1, &deletelist); add_com_alias ("detach-fork", "detach-checkpoint", class_obscure, 1); add_info_alias ("forks", "checkpoints", 0); diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 83cef557de8..d673d257295 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2006-04-26 Michael Snyder + + * gdb.base/multi-forks.exp: Modify patterns for "run to exit", + which may have to consume output from other forks. + Add tests to make sure that "delete fork" succeeded. + 2006-04-20 Michael Snyder * 2006-03-22 Jim Blandy diff --git a/gdb/testsuite/gdb.base/multi-forks.exp b/gdb/testsuite/gdb.base/multi-forks.exp index 82fdc507eaf..5a706d71252 100644 --- a/gdb/testsuite/gdb.base/multi-forks.exp +++ b/gdb/testsuite/gdb.base/multi-forks.exp @@ -67,7 +67,7 @@ gdb_test "set follow child" "" "" send_gdb "continue\n" gdb_expect { - -re ".*Break.* main .*$gdb_prompt $" {} + -re ".*Break.* main .*$gdb_prompt.*$" {} -re ".*$gdb_prompt $" {fail "run to exit 1"} default {fail "run to exit 1 (timeout)"} } @@ -84,7 +84,7 @@ gdb_test "set follow parent" "" "" send_gdb "continue\n" gdb_expect { - -re ".*Break.* main .*$gdb_prompt $" {} + -re ".*Break.* main .*$gdb_prompt.*$" {} -re ".*$gdb_prompt $" {fail "run to exit 2"} default {fail "run to exit 2 (timeout)"} } @@ -136,22 +136,31 @@ gdb_test "detach-fork 3" "Detached .*" "Detach 3" gdb_test "detach-fork 4" "Detached .*" "Detach 4" # -# Test delete-fork +# Test delete fork # -gdb_test "delete-fork 5" "" "Delete 5" -gdb_test "delete-fork 6" "" "Delete 6" -gdb_test "delete-fork 7" "" "Delete 7" -gdb_test "delete-fork 8" "" "Delete 8" -gdb_test "delete-fork 9" "" "Delete 9" -gdb_test "delete-fork 10" "" "Delete 10" -gdb_test "delete-fork 11" "" "Delete 11" -gdb_test "delete-fork 12" "" "Delete 12" -gdb_test "delete-fork 13" "" "Delete 13" -gdb_test "delete-fork 14" "" "Delete 14" -gdb_test "delete-fork 15" "" "Delete 15" - - +gdb_test "delete fork 5" "" "Delete 5" +gdb_test "info fork 5" "No fork number 5." "Did delete 5" +gdb_test "delete fork 6" "" "Delete 6" +gdb_test "info fork 6" "No fork number 6." "Did delete 6" +gdb_test "delete fork 7" "" "Delete 7" +gdb_test "info fork 7" "No fork number 7." "Did delete 7" +gdb_test "delete fork 8" "" "Delete 8" +gdb_test "info fork 8" "No fork number 8." "Did delete 8" +gdb_test "delete fork 9" "" "Delete 9" +gdb_test "info fork 9" "No fork number 9." "Did delete 9" +gdb_test "delete fork 10" "" "Delete 10" +gdb_test "info fork 10" "No fork number 10." "Did delete 10" +gdb_test "delete fork 11" "" "Delete 11" +gdb_test "info fork 11" "No fork number 11." "Did delete 11" +gdb_test "delete fork 12" "" "Delete 12" +gdb_test "info fork 12" "No fork number 12." "Did delete 12" +gdb_test "delete fork 13" "" "Delete 13" +gdb_test "info fork 13" "No fork number 13." "Did delete 13" +gdb_test "delete fork 14" "" "Delete 14" +gdb_test "info fork 14" "No fork number 14." "Did delete 14" +gdb_test "delete fork 15" "" "Delete 15" +gdb_test "info fork 15" "No fork number 15." "Did delete 15" return 0 -- 2.30.2