Revision | 2f341b6e28e27fadd8160d95337c3aa854bcba3b (tree) |
---|---|
Time | 2015-11-25 03:37:26 |
Author | Pedro Alves <palves@redh...> |
Commiter | Pedro Alves |
List checkpoints in ascending order
Before:
After:
gdb/ChangeLog:
2015-11-24 Pedro Alves <palves@redhat.com>
PR 17539
gdb/testsuite/ChangeLog:
2015-11-24 Pedro Alves <palves@redhat.com>
PR 17539
@@ -1,6 +1,12 @@ | ||
1 | 1 | 2015-11-24 Pedro Alves <palves@redhat.com> |
2 | 2 | |
3 | 3 | 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 | |
4 | 10 | * inferior.c (add_inferior_silent): Append the new inferior to the |
5 | 11 | end of the list. |
6 | 12 | * progspace.c (add_program_space): Append the new pspace to the |
@@ -63,6 +63,21 @@ forks_exist_p (void) | ||
63 | 63 | return (fork_list != NULL); |
64 | 64 | } |
65 | 65 | |
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 | + | |
66 | 81 | /* Add a fork to the internal fork list. */ |
67 | 82 | |
68 | 83 | struct fork_info * |
@@ -83,8 +98,16 @@ add_fork (pid_t pid) | ||
83 | 98 | fp = XCNEW (struct fork_info); |
84 | 99 | fp->ptid = ptid_build (pid, pid, 0); |
85 | 100 | 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 | + | |
88 | 111 | return fp; |
89 | 112 | } |
90 | 113 |
@@ -353,12 +376,13 @@ linux_fork_killall (void) | ||
353 | 376 | void |
354 | 377 | linux_fork_mourn_inferior (void) |
355 | 378 | { |
379 | + struct fork_info *last; | |
380 | + int status; | |
381 | + | |
356 | 382 | /* Wait just one more time to collect the inferior's exit status. |
357 | 383 | Do not check whether this succeeds though, since we may be |
358 | 384 | dealing with a process that we attached to. Such a process will |
359 | 385 | only report its exit status to its original parent. */ |
360 | - int status; | |
361 | - | |
362 | 386 | waitpid (ptid_get_pid (inferior_ptid), &status, 0); |
363 | 387 | |
364 | 388 | /* OK, presumably inferior_ptid is the one who has exited. |
@@ -371,7 +395,8 @@ linux_fork_mourn_inferior (void) | ||
371 | 395 | inferior_ptid yet. */ |
372 | 396 | gdb_assert (fork_list); |
373 | 397 | |
374 | - fork_load_infrun_state (fork_list); | |
398 | + last = find_last_fork (); | |
399 | + fork_load_infrun_state (last); | |
375 | 400 | printf_filtered (_("[Switching to %s]\n"), |
376 | 401 | target_pid_to_str (inferior_ptid)); |
377 | 402 |
@@ -1,6 +1,13 @@ | ||
1 | 1 | 2015-11-24 Pedro Alves <palves@redhat.com> |
2 | 2 | |
3 | 3 | 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 | |
4 | 11 | * gdb.base/foll-exec-mode.exp: Adjust to GDB listing inferiors and |
5 | 12 | threads in ascending order. |
6 | 13 | * gdb.base/foll-fork.exp: Likewise. |
@@ -87,7 +87,7 @@ gdb_test "continue 10" "breakpoint 1.*" "break1 ten" | ||
87 | 87 | gdb_test "checkpoint" ".*" "" |
88 | 88 | |
89 | 89 | 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 .*" \ | |
91 | 91 | "info checkpoints one" |
92 | 92 | |
93 | 93 | delete_breakpoints |
@@ -294,7 +294,7 @@ gdb_test "continue" \ | ||
294 | 294 | # There should be still at least five forks left |
295 | 295 | # |
296 | 296 | |
297 | -gdb_test "info checkpoints" " 5 .* 4 .* 3 .* 2 .* 1 .*" \ | |
297 | +gdb_test "info checkpoints" " 1 .* 2 .* 3 .* 4 .* 5 .*" \ | |
298 | 298 | "info checkpoints two" |
299 | 299 | |
300 | 300 | # |