• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revision2f341b6e28e27fadd8160d95337c3aa854bcba3b (tree)
Time2015-11-25 03:37:26
AuthorPedro Alves <palves@redh...>
CommiterPedro Alves

Log Message

List checkpoints in ascending order

Before:

(gdb) info checkpoints
3 process 29132 at 0x4008ad, file foo.c, line 81
2 process 29131 at 0x4008ad, file foo.c, line 81
1 process 29130 at 0x4008ad, file foo.c, line 81
      • 0 Thread 0x7ffff7fc5740 (LWP 29128) (main process) at 0x4008ad, file foo.c, line 81

After:

(gdb) info checkpoints
      • 0 Thread 0x7ffff7fc5740 (LWP 29128) (main process) at 0x4008ad, file foo.c, line 81
        1 process 29130 at 0x4008ad, file foo.c, line 81
        2 process 29131 at 0x4008ad, file foo.c, line 81
        3 process 29132 at 0x4008ad, file foo.c, line 81

gdb/ChangeLog:
2015-11-24 Pedro Alves <palves@redhat.com>

PR 17539

        • printcmd.c (display_command): Append new display at the end of
          the list.

gdb/testsuite/ChangeLog:
2015-11-24 Pedro Alves <palves@redhat.com>

PR 17539

        • gdb.base/display.exp: Expect displays to be sorted in ascending
        1. Use multi_line.
        • gdb.base/solib-display.exp: Likewise.

Change Summary

Incremental Difference

--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,6 +1,12 @@
11 2015-11-24 Pedro Alves <palves@redhat.com>
22
33 PR 17539
4+ * printcmd.c (display_command): Append new display at the end of
5+ the list.
6+
7+2015-11-24 Pedro Alves <palves@redhat.com>
8+
9+ PR 17539
410 * inferior.c (add_inferior_silent): Append the new inferior to the
511 end of the list.
612 * progspace.c (add_program_space): Append the new pspace to the
--- a/gdb/linux-fork.c
+++ b/gdb/linux-fork.c
@@ -63,6 +63,21 @@ forks_exist_p (void)
6363 return (fork_list != NULL);
6464 }
6565
66+/* Return the last fork in the list. */
67+
68+static struct fork_info *
69+find_last_fork (void)
70+{
71+ struct fork_info *last;
72+
73+ if (fork_list == NULL)
74+ return NULL;
75+
76+ for (last = fork_list; last->next != NULL; last = last->next)
77+ ;
78+ return last;
79+}
80+
6681 /* Add a fork to the internal fork list. */
6782
6883 struct fork_info *
@@ -83,8 +98,16 @@ add_fork (pid_t pid)
8398 fp = XCNEW (struct fork_info);
8499 fp->ptid = ptid_build (pid, pid, 0);
85100 fp->num = ++highest_fork_num;
86- fp->next = fork_list;
87- fork_list = fp;
101+
102+ if (fork_list == NULL)
103+ fork_list = fp;
104+ else
105+ {
106+ struct fork_info *last = find_last_fork ();
107+
108+ last->next = fp;
109+ }
110+
88111 return fp;
89112 }
90113
@@ -353,12 +376,13 @@ linux_fork_killall (void)
353376 void
354377 linux_fork_mourn_inferior (void)
355378 {
379+ struct fork_info *last;
380+ int status;
381+
356382 /* Wait just one more time to collect the inferior's exit status.
357383 Do not check whether this succeeds though, since we may be
358384 dealing with a process that we attached to. Such a process will
359385 only report its exit status to its original parent. */
360- int status;
361-
362386 waitpid (ptid_get_pid (inferior_ptid), &status, 0);
363387
364388 /* OK, presumably inferior_ptid is the one who has exited.
@@ -371,7 +395,8 @@ linux_fork_mourn_inferior (void)
371395 inferior_ptid yet. */
372396 gdb_assert (fork_list);
373397
374- fork_load_infrun_state (fork_list);
398+ last = find_last_fork ();
399+ fork_load_infrun_state (last);
375400 printf_filtered (_("[Switching to %s]\n"),
376401 target_pid_to_str (inferior_ptid));
377402
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,6 +1,13 @@
11 2015-11-24 Pedro Alves <palves@redhat.com>
22
33 PR 17539
4+ * gdb.base/display.exp: Expect displays to be sorted in ascending
5+ order. Use multi_line.
6+ * gdb.base/solib-display.exp: Likewise.
7+
8+2015-11-24 Pedro Alves <palves@redhat.com>
9+
10+ PR 17539
411 * gdb.base/foll-exec-mode.exp: Adjust to GDB listing inferiors and
512 threads in ascending order.
613 * gdb.base/foll-fork.exp: Likewise.
--- a/gdb/testsuite/gdb.base/checkpoint.exp
+++ b/gdb/testsuite/gdb.base/checkpoint.exp
@@ -87,7 +87,7 @@ gdb_test "continue 10" "breakpoint 1.*" "break1 ten"
8787 gdb_test "checkpoint" ".*" ""
8888
8989 gdb_test "info checkpoints" \
90- " 10 .* 9 .* 8 .* 7 .* 6 .* 5 .* 4 .* 3 .* 2 .* 1 .*" \
90+ " 1 .* 2 .* 3 .* 4 .* 5 .* 6 .* 7 .* 8 .* 9 .* 10 .*" \
9191 "info checkpoints one"
9292
9393 delete_breakpoints
@@ -294,7 +294,7 @@ gdb_test "continue" \
294294 # There should be still at least five forks left
295295 #
296296
297-gdb_test "info checkpoints" " 5 .* 4 .* 3 .* 2 .* 1 .*" \
297+gdb_test "info checkpoints" " 1 .* 2 .* 3 .* 4 .* 5 .*" \
298298 "info checkpoints two"
299299
300300 #