This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFC] Rename "delete-fork" to "delete fork"
- From: Michael Snyder <msnyder at redhat dot com>
- To: GDB Patches <gdb-patches at sources dot redhat dot com>, Daniel Jacobowitz <drow at false dot org>
- Date: Wed, 26 Apr 2006 16:47:27 -0700
- Subject: [RFC] Rename "delete-fork" to "delete fork"
Hi,
This is to remove the ambiguity between 'delete' and 'delete-fork'
(by using the already-in-place mechanism that I should have used
in the first place).
I will still need to handle "detach-fork", which will probably
require making "detach" into a prefix command like "delete".
Thought I'd do that in a separate step.
I also elaborated the "info fork" command so that it could take
a fork id as argument -- mainly because it facilitates testing.
Michael
2006-04-26 Michael Snyder <msnyder@redhat.com>
* 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 <msnyder@redhat.com>
* 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.
Index: linux-fork.c
===================================================================
RCS file: /cvs/src/src/gdb/linux-fork.c,v
retrieving revision 1.6
diff -p -r1.6 linux-fork.c
*** linux-fork.c 24 Mar 2006 23:08:16 -0000 1.6
--- linux-fork.c 26 Apr 2006 23:37:26 -0000
*************** info_forks_command (char *arg, int from_
*** 448,456 ****
--- 448,465 ----
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 ("* ");
*************** info_forks_command (char *arg, int from_
*** 490,495 ****
--- 499,511 ----
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':
*************** Fork a duplicate process (experimental).
*** 670,680 ****
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
fork list. */
! add_com ("delete-checkpoint", class_obscure, delete_fork_command, _("\
! Delete a fork/checkpoint (experimental)."));
/* Detach-checkpoint command: release the process to run independantly,
and remove it from the fork list. */
--- 686,697 ----
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
fork list. */
! 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. */
*************** Detach from a fork/checkpoint (experimen
*** 691,697 ****
/* 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_info_alias ("forks", "checkpoints", 0);
--- 708,714 ----
/* Command aliases (let "fork" and "checkpoint" be used
interchangeably). */
! 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);
Index: testsuite/gdb.base/multi-forks.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/multi-forks.exp,v
retrieving revision 1.3
diff -p -r1.3 multi-forks.exp
*** testsuite/gdb.base/multi-forks.exp 15 Jan 2006 19:07:33 -0000 1.3
--- testsuite/gdb.base/multi-forks.exp 26 Apr 2006 23:37:26 -0000
*************** gdb_test "set follow child" "" ""
*** 67,73 ****
send_gdb "continue\n"
gdb_expect {
! -re ".*Break.* main .*$gdb_prompt $" {}
-re ".*$gdb_prompt $" {fail "run to exit 1"}
default {fail "run to exit 1 (timeout)"}
}
--- 67,73 ----
send_gdb "continue\n"
gdb_expect {
! -re ".*Break.* main .*$gdb_prompt.*$" {}
-re ".*$gdb_prompt $" {fail "run to exit 1"}
default {fail "run to exit 1 (timeout)"}
}
*************** gdb_test "set follow parent" "" ""
*** 84,90 ****
send_gdb "continue\n"
gdb_expect {
! -re ".*Break.* main .*$gdb_prompt $" {}
-re ".*$gdb_prompt $" {fail "run to exit 2"}
default {fail "run to exit 2 (timeout)"}
}
--- 84,90 ----
send_gdb "continue\n"
gdb_expect {
! -re ".*Break.* main .*$gdb_prompt.*$" {}
-re ".*$gdb_prompt $" {fail "run to exit 2"}
default {fail "run to exit 2 (timeout)"}
}
*************** gdb_test "detach-fork 3" "Detached .*" "
*** 136,157 ****
gdb_test "detach-fork 4" "Detached .*" "Detach 4"
#
! # 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"
!
!
return 0
--- 136,166 ----
gdb_test "detach-fork 4" "Detached .*" "Detach 4"
#
! # Test delete fork
#
! 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