* [PATCH 4/6] List checkpoints in ascending order
2015-10-22 10:56 [PATCH 0/6] PR 17539 - inferiors/threads etc. print in reverse order Pedro Alves
@ 2015-10-22 10:57 ` Pedro Alves
2015-10-22 10:58 ` [PATCH 2/6] Linux: dump the signalled thread first Pedro Alves
` (5 subsequent siblings)
6 siblings, 0 replies; 16+ messages in thread
From: Pedro Alves @ 2015-10-22 10:57 UTC (permalink / raw)
To: gdb-patches
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-10-22 Pedro Alves <palves@redhat.com>
PR 17539
* printcmd.c (display_command): Append new display at the end of
the list.
gdb/testsuite/ChangeLog:
2015-10-22 Pedro Alves <palves@redhat.com>
PR 17539
* gdb.base/display.exp: Expect displays to be sorted in ascending
order. Use multi_line.
* gdb.base/solib-display.exp: Likewise.
---
gdb/linux-fork.c | 35 ++++++++++++++++++++++++++++++-----
gdb/testsuite/gdb.base/checkpoint.exp | 4 ++--
2 files changed, 32 insertions(+), 7 deletions(-)
diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c
index 9a469d4..786670a 100644
--- a/gdb/linux-fork.c
+++ b/gdb/linux-fork.c
@@ -63,6 +63,21 @@ forks_exist_p (void)
return (fork_list != NULL);
}
+/* Return the last fork in the list. */
+
+static struct fork_info *
+find_last_fork (void)
+{
+ struct fork_info *last;
+
+ if (fork_list == NULL)
+ return NULL;
+
+ for (last = fork_list; last->next != NULL; last = last->next)
+ ;
+ return last;
+}
+
/* Add a fork to the internal fork list. */
struct fork_info *
@@ -83,8 +98,16 @@ add_fork (pid_t pid)
fp = XCNEW (struct fork_info);
fp->ptid = ptid_build (pid, pid, 0);
fp->num = ++highest_fork_num;
- fp->next = fork_list;
- fork_list = fp;
+
+ if (fork_list == NULL)
+ fork_list = fp;
+ else
+ {
+ struct fork_info *last = find_last_fork ();
+
+ last->next = fp;
+ }
+
return fp;
}
@@ -353,12 +376,13 @@ linux_fork_killall (void)
void
linux_fork_mourn_inferior (void)
{
+ struct fork_info *last;
+ int status;
+
/* Wait just one more time to collect the inferior's exit status.
Do not check whether this succeeds though, since we may be
dealing with a process that we attached to. Such a process will
only report its exit status to its original parent. */
- int status;
-
waitpid (ptid_get_pid (inferior_ptid), &status, 0);
/* OK, presumably inferior_ptid is the one who has exited.
@@ -371,7 +395,8 @@ linux_fork_mourn_inferior (void)
inferior_ptid yet. */
gdb_assert (fork_list);
- fork_load_infrun_state (fork_list);
+ last = find_last_fork ();
+ fork_load_infrun_state (last);
printf_filtered (_("[Switching to %s]\n"),
target_pid_to_str (inferior_ptid));
diff --git a/gdb/testsuite/gdb.base/checkpoint.exp b/gdb/testsuite/gdb.base/checkpoint.exp
index 4a476be..e76d711 100644
--- 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"
gdb_test "checkpoint" ".*" ""
gdb_test "info checkpoints" \
- " 10 .* 9 .* 8 .* 7 .* 6 .* 5 .* 4 .* 3 .* 2 .* 1 .*" \
+ " 1 .* 2 .* 3 .* 4 .* 5 .* 6 .* 7 .* 8 .* 9 .* 10 .*" \
"info checkpoints one"
delete_breakpoints
@@ -294,7 +294,7 @@ gdb_test "continue" \
# There should be still at least five forks left
#
-gdb_test "info checkpoints" " 5 .* 4 .* 3 .* 2 .* 1 .*" \
+gdb_test "info checkpoints" " 1 .* 2 .* 3 .* 4 .* 5 .*" \
"info checkpoints two"
#
--
1.9.3
^ permalink raw reply [flat|nested] 16+ messages in thread* [PATCH 2/6] Linux: dump the signalled thread first
2015-10-22 10:56 [PATCH 0/6] PR 17539 - inferiors/threads etc. print in reverse order Pedro Alves
2015-10-22 10:57 ` [PATCH 4/6] List checkpoints in ascending order Pedro Alves
@ 2015-10-22 10:58 ` Pedro Alves
2015-10-22 11:07 ` [PATCH 3/6] List inferiors/threads/pspaces in ascending order Pedro Alves
` (4 subsequent siblings)
6 siblings, 0 replies; 16+ messages in thread
From: Pedro Alves @ 2015-10-22 10:58 UTC (permalink / raw)
To: gdb-patches
... like the kernel does.
gcore-thread.exp has a check to make sure the signalled thread is the
current thread after loading the core back, but that just works by
accident, because the signalled thread happened to be the last thread
on the thread list, and gdb currently iterates over threads in reverse
order.
So this fixes gcore-thread.exp once we start walking threads in
ascending number.
gdb/ChangeLog:
2015-10-22 Pedro Alves <palves@redhat.com>
* linux-tdep.c (find_stop_signal): Delete.
(struct linux_corefile_thread_data) <pid>: Remove field.
(linux_corefile_thread_callback): Rename to ...
(linux_corefile_thread): ... this. Now takes a struct
linux_corefile_thread_data pointer rather than a void pointer.
Remove thread state and thread pid checks.
(linux_make_corefile_notes): Prefer dumping the signalled thread
first. Use ALL_NON_EXITED_THREADS instead of
iterate_over_threads.
---
gdb/linux-tdep.c | 126 +++++++++++++++++++++++++++----------------------------
1 file changed, 63 insertions(+), 63 deletions(-)
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index 7c24eaa..2e7b87f 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -1342,18 +1342,6 @@ find_signalled_thread (struct thread_info *info, void *data)
return 0;
}
-static enum gdb_signal
-find_stop_signal (void)
-{
- struct thread_info *info =
- iterate_over_threads (find_signalled_thread, NULL);
-
- if (info)
- return info->suspend.stop_signal;
- else
- return GDB_SIGNAL_0;
-}
-
/* Generate corefile notes for SPU contexts. */
static char *
@@ -1656,62 +1644,49 @@ linux_get_siginfo_data (struct gdbarch *gdbarch, LONGEST *size)
struct linux_corefile_thread_data
{
struct gdbarch *gdbarch;
- int pid;
bfd *obfd;
char *note_data;
int *note_size;
enum gdb_signal stop_signal;
};
-/* Called by gdbthread.c once per thread. Records the thread's
- register state for the corefile note section. */
+/* Records the thread's register state for the corefile note
+ section. */
-static int
-linux_corefile_thread_callback (struct thread_info *info, void *data)
+static void
+linux_corefile_thread (struct thread_info *info,
+ struct linux_corefile_thread_data *args)
{
- struct linux_corefile_thread_data *args
- = (struct linux_corefile_thread_data *) data;
-
- /* It can be current thread
- which cannot be removed by update_thread_list. */
- if (info->state == THREAD_EXITED)
- return 0;
-
- if (ptid_get_pid (info->ptid) == args->pid)
- {
- struct cleanup *old_chain;
- struct regcache *regcache;
- gdb_byte *siginfo_data;
- LONGEST siginfo_size = 0;
-
- regcache = get_thread_arch_regcache (info->ptid, args->gdbarch);
-
- old_chain = save_inferior_ptid ();
- inferior_ptid = info->ptid;
- target_fetch_registers (regcache, -1);
- siginfo_data = linux_get_siginfo_data (args->gdbarch, &siginfo_size);
- do_cleanups (old_chain);
-
- old_chain = make_cleanup (xfree, siginfo_data);
-
- args->note_data = linux_collect_thread_registers
- (regcache, info->ptid, args->obfd, args->note_data,
- args->note_size, args->stop_signal);
-
- /* Don't return anything if we got no register information above,
- such a core file is useless. */
- if (args->note_data != NULL)
- if (siginfo_data != NULL)
- args->note_data = elfcore_write_note (args->obfd,
- args->note_data,
- args->note_size,
- "CORE", NT_SIGINFO,
- siginfo_data, siginfo_size);
-
- do_cleanups (old_chain);
- }
-
- return !args->note_data;
+ struct cleanup *old_chain;
+ struct regcache *regcache;
+ gdb_byte *siginfo_data;
+ LONGEST siginfo_size = 0;
+
+ regcache = get_thread_arch_regcache (info->ptid, args->gdbarch);
+
+ old_chain = save_inferior_ptid ();
+ inferior_ptid = info->ptid;
+ target_fetch_registers (regcache, -1);
+ siginfo_data = linux_get_siginfo_data (args->gdbarch, &siginfo_size);
+ do_cleanups (old_chain);
+
+ old_chain = make_cleanup (xfree, siginfo_data);
+
+ args->note_data = linux_collect_thread_registers
+ (regcache, info->ptid, args->obfd, args->note_data,
+ args->note_size, args->stop_signal);
+
+ /* Don't return anything if we got no register information above,
+ such a core file is useless. */
+ if (args->note_data != NULL)
+ if (siginfo_data != NULL)
+ args->note_data = elfcore_write_note (args->obfd,
+ args->note_data,
+ args->note_size,
+ "CORE", NT_SIGINFO,
+ siginfo_data, siginfo_size);
+
+ do_cleanups (old_chain);
}
/* Fill the PRPSINFO structure with information about the process being
@@ -1927,6 +1902,7 @@ linux_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size)
char *note_data = NULL;
gdb_byte *auxv;
int auxv_len;
+ struct thread_info *curr_thr, *signalled_thr, *thr;
if (! gdbarch_iterate_over_regset_sections_p (gdbarch))
return NULL;
@@ -1963,13 +1939,37 @@ linux_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size)
}
END_CATCH
+ /* Like the kernel, prefer dumping the signalled thread first.
+ "First thread" is what tools use to infer the signalled thread.
+ In case there's more than one signalled thread, prefer the
+ current thread, if it is signalled. */
+ curr_thr = inferior_thread ();
+ if (curr_thr->suspend.stop_signal != GDB_SIGNAL_0)
+ signalled_thr = curr_thr;
+ else
+ {
+ signalled_thr = iterate_over_threads (find_signalled_thread, NULL);
+ if (signalled_thr == NULL)
+ signalled_thr = curr_thr;
+ }
+
thread_args.gdbarch = gdbarch;
- thread_args.pid = ptid_get_pid (inferior_ptid);
thread_args.obfd = obfd;
thread_args.note_data = note_data;
thread_args.note_size = note_size;
- thread_args.stop_signal = find_stop_signal ();
- iterate_over_threads (linux_corefile_thread_callback, &thread_args);
+ thread_args.stop_signal = signalled_thr->suspend.stop_signal;
+
+ linux_corefile_thread (signalled_thr, &thread_args);
+ ALL_NON_EXITED_THREADS (thr)
+ {
+ if (thr == signalled_thr)
+ continue;
+ if (ptid_get_pid (thr->ptid) != ptid_get_pid (inferior_ptid))
+ continue;
+
+ linux_corefile_thread (thr, &thread_args);
+ }
+
note_data = thread_args.note_data;
if (!note_data)
return NULL;
--
1.9.3
^ permalink raw reply [flat|nested] 16+ messages in thread* [PATCH 3/6] List inferiors/threads/pspaces in ascending order
2015-10-22 10:56 [PATCH 0/6] PR 17539 - inferiors/threads etc. print in reverse order Pedro Alves
2015-10-22 10:57 ` [PATCH 4/6] List checkpoints in ascending order Pedro Alves
2015-10-22 10:58 ` [PATCH 2/6] Linux: dump the signalled thread first Pedro Alves
@ 2015-10-22 11:07 ` Pedro Alves
2015-10-22 16:03 ` Eli Zaretskii
2016-01-08 20:39 ` Regression for gdb.threads/fork-plus-threads.exp [Re: [PATCH 3/6] List inferiors/threads/pspaces in ascending order] Jan Kratochvil
2015-10-22 11:23 ` [PATCH 1/6] Make gdb.python/py-inferior.exp test names unique Pedro Alves
` (3 subsequent siblings)
6 siblings, 2 replies; 16+ messages in thread
From: Pedro Alves @ 2015-10-22 11:07 UTC (permalink / raw)
To: gdb-patches
Before:
(gdb) info threads
Id Target Id Frame
3 Thread 0x7ffff77c3700 (LWP 29035) callme () at foo.c:30
2 Thread 0x7ffff7fc4700 (LWP 29034) 0x000000000040087b in child_function_2 (arg=0x0) at foo.c:60
* 1 Thread 0x7ffff7fc5740 (LWP 29030) 0x0000003b37209237 in pthread_join (threadid=140737353893632, thread_return=0x0) at pthread_join.c:92
After:
(gdb) info threads
Id Target Id Frame
* 1 Thread 0x7ffff7fc5740 (LWP 29030) 0x0000003b37209237 in pthread_join (threadid=140737353893632, thread_return=0x0) at pthread_join.c:92
2 Thread 0x7ffff7fc4700 (LWP 29034) 0x000000000040087b in child_function_2 (arg=0x0) at foo.c:60
3 Thread 0x7ffff77c3700 (LWP 29035) callme () at foo.c:30
gdb/doc/ChangeLog:
2015-10-22 Pedro Alves <palves@redhat.com>
PR 17539
* gdb.texinfo (Inferiors and Programs): Adjust "maint info
program-spaces" example to ascending order listing.
(Threads): Adjust "info threads" example to ascending order
listing.
(Forks): Adjust "info inferiors" example to ascending order
listing.
gdb/ChangeLog:
2015-10-22 Pedro Alves <palves@redhat.com>
PR 17539
* inferior.c (add_inferior_silent): Append the new inferior to the
end of the list.
* progspace.c (add_program_space): Append the new pspace to the
end of the list.
* thread.c (new_thread): Append the new thread to the end of the
list.
gdb/testsuite/ChangeLog:
2015-10-22 Pedro Alves <palves@redhat.com>
PR 17539
* gdb.base/foll-exec-mode.exp: Adjust to GDB listing inferiors and
threads in ascending order.
* gdb.base/foll-fork.exp: Likewise.
* gdb.base/foll-vfork.exp: Likewise.
* gdb.base/multi-forks.exp: Likewise.
* gdb.mi/mi-nonstop.exp: Likewise.
* gdb.mi/mi-nsintrall.exp: Likewise.
* gdb.multi/base.exp: Likewise.
* gdb.multi/multi-arch.exp: Likewise.
* gdb.python/py-inferior.exp: Likewise.
* gdb.threads/break-while-running.exp: Likewise.
* gdb.threads/execl.exp: Likewise.
* gdb.threads/gcore-thread.exp: Likewise.
* gdb.threads/info-threads-cur-sal.exp: Likewise.
* gdb.threads/kill.exp: Likewise.
* gdb.threads/linux-dp.exp: Likewise.
* gdb.threads/multiple-step-overs.exp: Likewise.
* gdb.threads/next-bp-other-thread.exp: Likewise.
* gdb.threads/step-bg-decr-pc-switch-thread.exp: Likewise.
* gdb.threads/step-over-lands-on-breakpoint.exp: Likewise.
* gdb.threads/step-over-trips-on-watchpoint.exp: Likewise.
* gdb.threads/thread-find.exp: Likewise.
* gdb.threads/tls.exp: Likewise.
* lib/mi-support.exp (mi_reverse_list): Delete.
(mi_check_thread_states): No longer reverse list.
---
gdb/doc/gdb.texinfo | 8 +-
gdb/inferior.c | 13 +-
gdb/progspace.c | 12 +-
gdb/testsuite/gdb.base/foll-exec-mode.exp | 2 +-
gdb/testsuite/gdb.base/foll-fork.exp | 6 +-
gdb/testsuite/gdb.base/foll-vfork.exp | 2 +-
gdb/testsuite/gdb.base/multi-forks.exp | 30 +--
gdb/testsuite/gdb.mi/mi-nonstop.exp | 2 +-
gdb/testsuite/gdb.mi/mi-nsintrall.exp | 4 +-
gdb/testsuite/gdb.multi/base.exp | 18 +-
gdb/testsuite/gdb.multi/multi-arch.exp | 2 +-
gdb/testsuite/gdb.python/py-inferior.exp | 4 +-
gdb/testsuite/gdb.threads/break-while-running.exp | 8 +-
gdb/testsuite/gdb.threads/execl.exp | 2 +-
gdb/testsuite/gdb.threads/gcore-thread.exp | 4 +-
gdb/testsuite/gdb.threads/info-threads-cur-sal.exp | 10 +-
gdb/testsuite/gdb.threads/kill.exp | 2 +-
gdb/testsuite/gdb.threads/linux-dp.exp | 2 +-
gdb/testsuite/gdb.threads/multiple-step-overs.exp | 2 +-
gdb/testsuite/gdb.threads/next-bp-other-thread.exp | 2 +-
.../gdb.threads/step-bg-decr-pc-switch-thread.exp | 2 +-
.../gdb.threads/step-over-lands-on-breakpoint.exp | 2 +-
.../gdb.threads/step-over-trips-on-watchpoint.exp | 2 +-
gdb/testsuite/gdb.threads/thread-find.exp | 218 ++++-----------------
gdb/testsuite/gdb.threads/tls.exp | 2 +-
gdb/testsuite/lib/mi-support.exp | 13 +-
gdb/thread.c | 13 +-
27 files changed, 122 insertions(+), 265 deletions(-)
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 3c1f785..63a8273 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -2791,9 +2791,9 @@ example, the list of inferiors bound to the program space.
@smallexample
(@value{GDBP}) maint info program-spaces
Id Executable
+* 1 hello
2 goodbye
Bound inferiors: ID 1 (process 21561)
-* 1 hello
@end smallexample
Here we can see that no inferior is running the program @code{hello},
@@ -2938,9 +2938,9 @@ For example,
@smallexample
(@value{GDBP}) info threads
Id Target Id Frame
- 3 process 35 thread 27 0x34e5 in sigpause ()
- 2 process 35 thread 23 0x34e5 in sigpause ()
* 1 process 35 thread 13 main (argc=1, argv=0x7ffffff8)
+ 2 process 35 thread 23 0x34e5 in sigpause ()
+ 3 process 35 thread 27 0x34e5 in sigpause ()
at threadtest.c:68
@end smallexample
@@ -3254,8 +3254,8 @@ process 12020 is executing new program: prog2
Program exited normally.
(@value{GDBP}) info inferiors
Id Description Executable
-* 2 <null> prog2
1 <null> prog1
+* 2 <null> prog2
@end smallexample
@item same
diff --git a/gdb/inferior.c b/gdb/inferior.c
index ae8b2a1..157e236 100644
--- a/gdb/inferior.c
+++ b/gdb/inferior.c
@@ -135,8 +135,17 @@ add_inferior_silent (int pid)
inf->control.stop_soon = NO_STOP_QUIETLY;
inf->num = ++highest_inferior_num;
- inf->next = inferior_list;
- inferior_list = inf;
+
+ if (inferior_list == NULL)
+ inferior_list = inf;
+ else
+ {
+ struct inferior *last;
+
+ for (last = inferior_list; last->next != NULL; last = last->next)
+ ;
+ last->next = inf;
+ }
inf->environment = make_environ ();
init_environ (inf->environment);
diff --git a/gdb/progspace.c b/gdb/progspace.c
index 3d7e475..ff164b8 100644
--- a/gdb/progspace.c
+++ b/gdb/progspace.c
@@ -133,8 +133,16 @@ add_program_space (struct address_space *aspace)
program_space_alloc_data (pspace);
- pspace->next = program_spaces;
- program_spaces = pspace;
+ if (program_spaces == NULL)
+ program_spaces = pspace;
+ else
+ {
+ struct program_space *last;
+
+ for (last = program_spaces; last->next != NULL; last = last->next)
+ ;
+ last->next = pspace;
+ }
return pspace;
}
diff --git a/gdb/testsuite/gdb.base/foll-exec-mode.exp b/gdb/testsuite/gdb.base/foll-exec-mode.exp
index 3dc44a2..ee193e2 100644
--- a/gdb/testsuite/gdb.base/foll-exec-mode.exp
+++ b/gdb/testsuite/gdb.base/foll-exec-mode.exp
@@ -147,7 +147,7 @@ proc do_follow_exec_mode_tests { mode cmd infswitch } {
if {$mode == "same"} {
set expected_re "\\* 1.*process.*"
} else {
- set expected_re "\\* 2.*process.*$testfile2 \r\n 1.*null.*$testfile.*"
+ set expected_re " 1.*null.*$testfile.*\r\n\\* 2.*process.*$testfile2 .*"
}
# Check that the inferior list is correct:
diff --git a/gdb/testsuite/gdb.base/foll-fork.exp b/gdb/testsuite/gdb.base/foll-fork.exp
index 0d7c7fd..5993973 100644
--- a/gdb/testsuite/gdb.base/foll-fork.exp
+++ b/gdb/testsuite/gdb.base/foll-fork.exp
@@ -144,7 +144,7 @@ proc test_follow_fork { who detach cmd } {
# Follow parent / keep child: two inferiors under debug, the
# parent is the current inferior.
- gdb_test "info inferiors" " 2 .*process.*\\* 1 .*process.*" \
+ gdb_test "info inferiors" "\\* 1 .*process.* 2 .*process.*" \
"info inferiors"
gdb_test "inferior 2" "Switching to inferior 2 .*"
@@ -155,14 +155,14 @@ proc test_follow_fork { who detach cmd } {
# Follow child / detach parent: the child is under debug and is
# the current inferior. The parent is listed but is not under
# debug.
- gdb_test "info inferiors" "\\* 2 .*process.* 1 .*<null>.*" \
+ gdb_test "info inferiors" " 1 .*<null>.*\\* 2 .*process.*" \
"info inferiors"
} elseif {$who == "child" && $detach == "off"} {
# Follow child / keep parent: two inferiors under debug, the
# child is the current inferior.
- gdb_test "info inferiors" "\\* 2 .*process.* 1 .*process.*" \
+ gdb_test "info inferiors" " 1 .*process.*\\* 2 .*process.*" \
"info inferiors"
gdb_test "inferior 1" "Switching to inferior 1 .*"
diff --git a/gdb/testsuite/gdb.base/foll-vfork.exp b/gdb/testsuite/gdb.base/foll-vfork.exp
index 78c5cc8..82922d8 100644
--- a/gdb/testsuite/gdb.base/foll-vfork.exp
+++ b/gdb/testsuite/gdb.base/foll-vfork.exp
@@ -408,7 +408,7 @@ proc vfork_relations_in_info_inferiors { variant } {
}
gdb_test "info inferiors" \
- ".*is vfork child of inferior 1.*is vfork parent of inferior 2" \
+ ".*is vfork parent of inferior 2.*is vfork child of inferior 1" \
"info inferiors shows vfork parent/child relation"
if { $variant == "exec" } {
diff --git a/gdb/testsuite/gdb.base/multi-forks.exp b/gdb/testsuite/gdb.base/multi-forks.exp
index 0582ba4..2b0b81d 100644
--- a/gdb/testsuite/gdb.base/multi-forks.exp
+++ b/gdb/testsuite/gdb.base/multi-forks.exp
@@ -158,13 +158,13 @@ gdb_test_no_output "set detach off" "set detach off"
for {set i 1} {$i <= 15} {incr i} {
gdb_test "continue" "Breakpoint .* main .*exit.*" "Run to exit $i"
- gdb_test "info inferior" " 5 .* 4 .* 3 .* 2 .*" "info inferior $i"
+ gdb_test "info inferior" " 2 .* 3 .* 4 .* 5 .*" "info inferior $i"
gdb_test "inferior $i + 1" "(_dl_sysinfo_int80|fork|__kernel_(v|)syscall).*" \
"inferior $i"
}
gdb_test "continue" "Breakpoint .* main .*exit.*" "Run to exit 16"
-gdb_test "info inferiors" " 5 .* 4 .* 3 .* 2 .*" "info inferior 16"
+gdb_test "info inferior" " 2 .* 3 .* 4 .* 5 .*" "info inferior 16"
gdb_test "inferior 2" " main .*" "restart final"
#
@@ -185,27 +185,9 @@ gdb_test "detach inferior 5" "Detaching .*" "Detach 5"
# Test kill inferior
#
-gdb_test_no_output "kill inferior 6" "Kill 6"
-gdb_test "info inferior 6" "<null>.*" "Did kill 6"
-gdb_test_no_output "kill inferior 7" "Kill 7"
-gdb_test "info inferior 7" "<null>.*" "Did kill 7"
-gdb_test_no_output "kill inferior 8" "Kill 8"
-gdb_test "info inferior 8" "<null>.*" "Did kill 8"
-gdb_test_no_output "kill inferior 9" "Kill 9"
-gdb_test "info inferior 9" "<null>.*" "Did kill 9"
-gdb_test_no_output "kill inferior 10" "Kill 10"
-gdb_test "info inferior 10" "<null>.*" "Did kill 10"
-gdb_test_no_output "kill inferior 11" "Kill 11"
-gdb_test "info inferior 11" "<null>.*" "Did kill 11"
-gdb_test_no_output "kill inferior 12" "Kill 12"
-gdb_test "info inferior 12" "<null>.*" "Did kill 12"
-gdb_test_no_output "kill inferior 13" "Kill 13"
-gdb_test "info inferior 13" "<null>.*" "Did kill 13"
-gdb_test_no_output "kill inferior 14" "Kill 14"
-gdb_test "info inferior 14" "<null>.*" "Did kill 14"
-gdb_test_no_output "kill inferior 15" "Kill 15"
-gdb_test "info inferior 15" "<null>.*" "Did kill 15"
-gdb_test_no_output "kill inferior 16" "Kill 16"
-gdb_test "info inferior 16" "<null>.*" "Did kill 16"
+for {set i 6} { $i <= 16} {incr i} {
+ gdb_test_no_output "kill inferior $i" "Kill $i"
+ gdb_test "info inferior $i" "<null>.*" "Did kill $i"
+}
return 0
diff --git a/gdb/testsuite/gdb.mi/mi-nonstop.exp b/gdb/testsuite/gdb.mi/mi-nonstop.exp
index 4678506..d2cb95b 100644
--- a/gdb/testsuite/gdb.mi/mi-nonstop.exp
+++ b/gdb/testsuite/gdb.mi/mi-nonstop.exp
@@ -94,7 +94,7 @@ mi_expect_interrupt "got interrupt"
sleep 1
mi_check_thread_states {"stopped" "stopped" "stopped"} "thread state, stop 4"
-mi_gdb_test "-exec-continue --all" ".*\\*running,thread-id=\"3\"\r\n\\*running,thread-id=\"2\"\r\n\\*running,thread-id=\"1\"" \
+mi_gdb_test "-exec-continue --all" ".*\\*running,thread-id=\"1\"\r\n\\*running,thread-id=\"2\"\r\n\\*running,thread-id=\"3\"" \
"resume all"
mi_expect_stop "breakpoint-hit" "break_at_me" "\[^\n\]*" "non-stop.c" "\[0-9\]*" {"" "disp=\"keep\""} "w0,i2 stop"
diff --git a/gdb/testsuite/gdb.mi/mi-nsintrall.exp b/gdb/testsuite/gdb.mi/mi-nsintrall.exp
index d181e07..3d67a21 100644
--- a/gdb/testsuite/gdb.mi/mi-nsintrall.exp
+++ b/gdb/testsuite/gdb.mi/mi-nsintrall.exp
@@ -67,10 +67,10 @@ mi_delete_breakpoints
# Here we create a response string. Note we don't want \r\n at the end,
# since mi_gdb_test will append this itself.
set running_re ""
-for {set i 6} {$i > 1} {incr i -1} {
+for {set i 1} {$i < 6} {incr i} {
set running_re "$running_re\\*running,thread-id=\"$i\"\r\n"
}
-set running_re "$running_re\\*running,thread-id=\"1\""
+set running_re "$running_re\\*running,thread-id=\"6\""
mi_gdb_test "-exec-continue --all" "\[^\n\]*\r\n$running_re" \
"resume all, no breakpoint"
diff --git a/gdb/testsuite/gdb.multi/base.exp b/gdb/testsuite/gdb.multi/base.exp
index de53209..78b913c 100644
--- a/gdb/testsuite/gdb.multi/base.exp
+++ b/gdb/testsuite/gdb.multi/base.exp
@@ -59,7 +59,7 @@ gdb_test "add-inferior -exec ${binfile3}" \
# Check that we have multiple spaces.
gdb_test "info inferiors" \
- "Executable.*${exec3}.*${exec2}.*${exec1}.*"
+ "Executable.*${exec1}.*${exec2}.*${exec3}.*"
# Test info inferiors with args
@@ -68,16 +68,16 @@ set see2 0
set see3 0
gdb_test_multiple "info inferior 2 3" "info inferior 2 3" {
- -re ". 3 \[^\r\n\]*${exec3}" {
- set see3 1
+ -re ". 1 \[^\r\n\]*${exec1}" {
+ set see1 1
exp_continue
}
-re ". 2 \[^\r\n\]*${exec2}" {
set see2 1
exp_continue
}
- -re ". 1 \[^\r\n\]*${exec1}" {
- set see1 1
+ -re ". 3 \[^\r\n\]*${exec3}" {
+ set see3 1
exp_continue
}
-re "$gdb_prompt $" {
@@ -94,16 +94,16 @@ set see2 0
set see3 0
gdb_test_multiple "info inferior 1-2" "info inferior 1-2" {
- -re ". 3 \[^\r\n\]*${exec3}" {
- set see3 1
+ -re ". 1 \[^\r\n\]*${exec1}" {
+ set see1 1
exp_continue
}
-re ". 2 \[^\r\n\]*${exec2}" {
set see2 1
exp_continue
}
- -re ". 1 \[^\r\n\]*${exec1}" {
- set see1 1
+ -re ". 3 \[^\r\n\]*${exec3}" {
+ set see3 1
exp_continue
}
-re "$gdb_prompt $" {
diff --git a/gdb/testsuite/gdb.multi/multi-arch.exp b/gdb/testsuite/gdb.multi/multi-arch.exp
index 4b255ee..70d0a09 100644
--- a/gdb/testsuite/gdb.multi/multi-arch.exp
+++ b/gdb/testsuite/gdb.multi/multi-arch.exp
@@ -95,4 +95,4 @@ if ![runto_main] then {
# Check we do have two inferiors loaded.
gdb_test "info inferiors" \
- "Executable.*${exec2}.*${exec1}.*"
+ "Executable.*${exec1}.*${exec2}.*"
diff --git a/gdb/testsuite/gdb.python/py-inferior.exp b/gdb/testsuite/gdb.python/py-inferior.exp
index 8a20542..9966d2e 100644
--- a/gdb/testsuite/gdb.python/py-inferior.exp
+++ b/gdb/testsuite/gdb.python/py-inferior.exp
@@ -230,10 +230,10 @@ with_test_prefix "is_valid" {
"check inferior validity 3"
gdb_test_no_output "remove-inferiors 2" "remove-inferiors 3"
- gdb_test "python print (inf_list\[0\].is_valid())" "False" \
+ gdb_test "python print (inf_list\[0\].is_valid())" "True" \
"check inferior validity 4"
- gdb_test "python print (inf_list\[1\].is_valid())" "True" \
+ gdb_test "python print (inf_list\[1\].is_valid())" "False" \
"check inferior validity 5"
}
diff --git a/gdb/testsuite/gdb.threads/break-while-running.exp b/gdb/testsuite/gdb.threads/break-while-running.exp
index e9babb1..ce850b1 100644
--- a/gdb/testsuite/gdb.threads/break-while-running.exp
+++ b/gdb/testsuite/gdb.threads/break-while-running.exp
@@ -78,7 +78,7 @@ proc test { update_thread_list always_inserted non_stop } {
# without the user explicitly fetching the thread list.
if {$update_thread_list} {
gdb_test "info threads" \
- "\\\(running\\\).*\\\(running\\\).* main .*" \
+ "main .*\\\(running\\\).*\\\(running\\\).*" \
"only main stopped"
}
@@ -107,7 +107,7 @@ proc test { update_thread_list always_inserted non_stop } {
if {$non_stop == "on"} {
gdb_test "info threads" \
- "\\\(running\\\).* breakpoint_function .* main .*" \
+ "main .* breakpoint_function .*\\\(running\\\)" \
"one thread running"
# Unblock the other thread, which should then trip on the same
@@ -131,7 +131,7 @@ proc test { update_thread_list always_inserted non_stop } {
}
gdb_test "info threads" \
- " breakpoint_function .* breakpoint_function .* main .*" \
+ " main .* breakpoint_function .* breakpoint_function .*" \
"all threads stopped"
} else {
# This test is not merged with the non-stop one because in
@@ -142,7 +142,7 @@ proc test { update_thread_list always_inserted non_stop } {
-re "\\\(running\\\).*$gdb_prompt $" {
fail $test
}
- -re "breakpoint_function .* main .*$gdb_prompt $" {
+ -re "main .* breakpoint_function .*$gdb_prompt $" {
pass $test
}
}
diff --git a/gdb/testsuite/gdb.threads/execl.exp b/gdb/testsuite/gdb.threads/execl.exp
index 66457bd..b86b612 100644
--- a/gdb/testsuite/gdb.threads/execl.exp
+++ b/gdb/testsuite/gdb.threads/execl.exp
@@ -44,7 +44,7 @@ gdb_test "b [gdb_get_line_number "breakpoint here"]" \
gdb_test "continue" ".*breakpoint here.*" "continue to exec"
-gdb_test "info threads" ".*3 *Thread.*2 *Thread.*1 *Thread.*" "info threads before exec"
+gdb_test "info threads" "1 *Thread.*2 *Thread.*3 *Thread.*" "info threads before exec"
# When continuing from this point we'll hit the breakpoint in main()
# again, this time in the exec'd process.
diff --git a/gdb/testsuite/gdb.threads/gcore-thread.exp b/gdb/testsuite/gdb.threads/gcore-thread.exp
index 7ef751f..812e3b8 100644
--- a/gdb/testsuite/gdb.threads/gcore-thread.exp
+++ b/gdb/testsuite/gdb.threads/gcore-thread.exp
@@ -127,7 +127,7 @@ foreach name { corefile core0file } { with_test_prefix $name {
# mapping various OS's may do? Let's assume that there must
# be at least two threads:
- gdb_test "info threads" ".*${nl} 2 ${horiz}${nl}\\* 1 .*" \
+ gdb_test "info threads" "\\* 1 ${horiz}${nl} 2 ${horiz}.*" \
"corefile contains at least two threads"
# One thread in the corefile should be in the "thread2" function.
@@ -137,6 +137,6 @@ foreach name { corefile core0file } { with_test_prefix $name {
# The thread2 thread should be marked as the current thread.
- gdb_test "info threads" ".*${nl}\\* ${horiz} thread2 .*" \
+ gdb_test "info threads" "\\* ${horiz} thread2 .*${nl}" \
"thread2 is current thread in corefile"
}}
diff --git a/gdb/testsuite/gdb.threads/info-threads-cur-sal.exp b/gdb/testsuite/gdb.threads/info-threads-cur-sal.exp
index 3cad0a2..529d3db 100644
--- a/gdb/testsuite/gdb.threads/info-threads-cur-sal.exp
+++ b/gdb/testsuite/gdb.threads/info-threads-cur-sal.exp
@@ -41,14 +41,20 @@ gdb_test "list $line" \
# There used to be a bug where "info threads" would set the current
# SAL to the location of the last thread displayed.
gdb_test "info threads" \
- "\r\n\[ \t\]*Id\[ \t\]+Target\[ \t\]+Id\[ \t\]+Frame\[ \t\]*\r\n\\* 2 *Thread \[^\r\n\]* at \[^\r\n\]*\r\n 1 *Thread \[^\r\n\]* .* \[^\r\n\]*" \
+ [multi_line \
+ "\[ \t\]*Id\[ \t\]+Target\[ \t\]+Id\[ \t\]+Frame\[ \t\]*" \
+ " 1 *Thread \[^\r\n\]* .* \[^\r\n\]*" \
+ "\\* 2 *Thread \[^\r\n\]* at \[^\r\n\]*"] \
"info threads before break"
# Check that "break" is still operating on the same file by default.
gdb_test "break $line" ".*${srcfile2}.*" "break on line"
gdb_test "info threads" \
- "\r\n\[ \t\]*Id\[ \t\]+Target\[ \t\]+Id\[ \t\]+Frame\[ \t\]*\r\n\\* 2 *Thread \[^\r\n\]* at \[^\r\n\]*\r\n 1 *Thread \[^\r\n\]* .* \[^\r\n\]*" \
+ [multi_line \
+ "\[ \t\]*Id\[ \t\]+Target\[ \t\]+Id\[ \t\]+Frame\[ \t\]*" \
+ " 1 *Thread \[^\r\n\]* .* \[^\r\n\]*" \
+ "\\* 2 *Thread \[^\r\n\]* at \[^\r\n\]*"] \
"info threads before list"
# And that so is "list".
diff --git a/gdb/testsuite/gdb.threads/kill.exp b/gdb/testsuite/gdb.threads/kill.exp
index b8b7965..787e812 100644
--- a/gdb/testsuite/gdb.threads/kill.exp
+++ b/gdb/testsuite/gdb.threads/kill.exp
@@ -48,7 +48,7 @@ proc test {threaded} {
gdb_continue_to_breakpoint "break here" ".*break here.*"
if {$threaded} {
- gdb_test "info threads" "6.*5.*4.*3.*2.*1.*" "all threads started"
+ gdb_test "info threads" "1.*2.*3.*4.*5.*6.*" "all threads started"
}
# This kills and ensures no output other than the prompt comes out,
diff --git a/gdb/testsuite/gdb.threads/linux-dp.exp b/gdb/testsuite/gdb.threads/linux-dp.exp
index e612978..a089cac 100644
--- a/gdb/testsuite/gdb.threads/linux-dp.exp
+++ b/gdb/testsuite/gdb.threads/linux-dp.exp
@@ -168,7 +168,7 @@ set nthreads 6
gdb_breakpoint [gdb_get_line_number "linuxthreads.exp: info threads 2"]
gdb_continue_to_breakpoint "main thread's sleep"
set info_threads_ptn ".*"
-for {set i $nthreads} {$i > 0} {incr i -1} {
+for {set i 1} {$i < $nthreads} {incr i} {
append info_threads_ptn "$i *Thread .*"
}
append info_threads_ptn "\[\r\n\]+$gdb_prompt $"
diff --git a/gdb/testsuite/gdb.threads/multiple-step-overs.exp b/gdb/testsuite/gdb.threads/multiple-step-overs.exp
index 475e0f4..99c3e30 100644
--- a/gdb/testsuite/gdb.threads/multiple-step-overs.exp
+++ b/gdb/testsuite/gdb.threads/multiple-step-overs.exp
@@ -46,7 +46,7 @@ proc setup {} {
gdb_breakpoint [gdb_get_line_number "set wait-threads breakpoint here"]
gdb_continue_to_breakpoint "run to breakpoint"
- gdb_test "info threads" "3 .* 2 .*\\\* 1.*" "info threads shows all threads"
+ gdb_test "info threads" "\\\* 1 .* 2 .* 3 .*" "info threads shows all threads"
gdb_test_no_output "set scheduler-locking on"
diff --git a/gdb/testsuite/gdb.threads/next-bp-other-thread.exp b/gdb/testsuite/gdb.threads/next-bp-other-thread.exp
index 297a696..df9b73b 100644
--- a/gdb/testsuite/gdb.threads/next-bp-other-thread.exp
+++ b/gdb/testsuite/gdb.threads/next-bp-other-thread.exp
@@ -35,7 +35,7 @@ foreach schedlock {"off" "step" "on" } {
gdb_breakpoint [gdb_get_line_number "set wait-thread breakpoint here"]
gdb_continue_to_breakpoint "run to wait-thread breakpoint"
- gdb_test "info threads" "2 .*\\\* 1.*" "info threads shows all threads"
+ gdb_test "info threads" "\\\* 1 .* 2 .*" "info threads shows all threads"
delete_breakpoints
diff --git a/gdb/testsuite/gdb.threads/step-bg-decr-pc-switch-thread.exp b/gdb/testsuite/gdb.threads/step-bg-decr-pc-switch-thread.exp
index b19b1f7..1199fb1 100644
--- a/gdb/testsuite/gdb.threads/step-bg-decr-pc-switch-thread.exp
+++ b/gdb/testsuite/gdb.threads/step-bg-decr-pc-switch-thread.exp
@@ -48,7 +48,7 @@ delete_breakpoints
gdb_breakpoint [gdb_get_line_number "set breakpoint here"]
gdb_continue_to_breakpoint "run to nop breakpoint"
-gdb_test "info threads" "\\\* 2 .* 1.*" "info threads shows all threads"
+gdb_test "info threads" " 1 .*\\\* 2 .*" "info threads shows all threads"
gdb_test "next" "while.*" "next over nop"
diff --git a/gdb/testsuite/gdb.threads/step-over-lands-on-breakpoint.exp b/gdb/testsuite/gdb.threads/step-over-lands-on-breakpoint.exp
index b38f23b..79f4aa7 100644
--- a/gdb/testsuite/gdb.threads/step-over-lands-on-breakpoint.exp
+++ b/gdb/testsuite/gdb.threads/step-over-lands-on-breakpoint.exp
@@ -40,7 +40,7 @@ proc do_test {displaced command} {
gdb_breakpoint [gdb_get_line_number "set wait-thread breakpoint here"]
gdb_continue_to_breakpoint "run to wait-thread breakpoint"
- gdb_test "info threads" "2 .*\\\* 1.*" "info threads shows all threads"
+ gdb_test "info threads" "\\\* 1 .* 2 .*" "info threads shows all threads"
gdb_test_no_output "set scheduler-locking on"
diff --git a/gdb/testsuite/gdb.threads/step-over-trips-on-watchpoint.exp b/gdb/testsuite/gdb.threads/step-over-trips-on-watchpoint.exp
index 7e27f97..aeedc4a 100644
--- a/gdb/testsuite/gdb.threads/step-over-trips-on-watchpoint.exp
+++ b/gdb/testsuite/gdb.threads/step-over-trips-on-watchpoint.exp
@@ -59,7 +59,7 @@ proc do_test { displaced with_bp } {
gdb_breakpoint [gdb_get_line_number "set wait-thread breakpoint here"]
gdb_continue_to_breakpoint "run to wait-thread breakpoint"
- gdb_test "info threads" "2 .*\\\* 1.*" "info threads shows all threads"
+ gdb_test "info threads" "\\\* 1 .* 2 .*" "info threads shows all threads"
gdb_test_no_output "set scheduler-locking on"
diff --git a/gdb/testsuite/gdb.threads/thread-find.exp b/gdb/testsuite/gdb.threads/thread-find.exp
index 1cd39de..1af6bbd 100644
--- a/gdb/testsuite/gdb.threads/thread-find.exp
+++ b/gdb/testsuite/gdb.threads/thread-find.exp
@@ -55,29 +55,11 @@ gdb_test "thread apply 6 thread name threadname_6" \
"name thread 6"
# Collect thread ids, if any.
+
gdb_test_multiple "info threads" "collect thread id" {
- -re ". 6 .*\[Tt\]hread (\[0-9a-fA-Fx\]+).* \"threadname_6\" \[^\r\n\]*" {
- set thread6 $expect_out(1,string)
- exp_continue
- }
- -re ". 5 .*\[Tt\]hread (\[0-9a-fA-Fx\]+).* \"threadname_5\" \[^\r\n\]*" {
- set thread5 $expect_out(1,string)
- exp_continue
- }
- -re ". 4 .*\[Tt\]hread (\[0-9a-fA-Fx\]+).* \"threadname_4\" \[^\r\n\]*" {
- set thread4 $expect_out(1,string)
- exp_continue
- }
- -re ". 3 .*\[Tt\]hread (\[0-9a-fA-Fx\]+).* \"threadname_3\" \[^\r\n\]*" {
- set thread3 $expect_out(1,string)
- exp_continue
- }
- -re ". 2 .*\[Tt\]hread (\[0-9a-fA-Fx\]+).* \"threadname_2\" \[^\r\n\]*" {
- set thread2 $expect_out(1,string)
- exp_continue
- }
- -re ". 1 .*\[Tt\]hread (\[0-9a-fA-Fx\]+).* \"threadname_1\" \[^\r\n\]*" {
- set thread1 $expect_out(1,string)
+ -re ". (\[0-9\]+) \[^\r\n\]*\[Tt\]hread (\[0-9a-fA-Fx\]+)\[^\r\n\]* \"threadname_\[0-9\]+\" \[^\r\n\]*" {
+ set thr_num $expect_out(1,string)
+ set thread$thr_num $expect_out(2,string)
exp_continue
}
-re ".*$gdb_prompt $" {
@@ -90,29 +72,11 @@ if { [info exists thread6] } then {
}
# Collect process ids, if any.
+
gdb_test_multiple "info threads" "collect thread id" {
- -re ". 6 .*\[Pp\]rocess (\[0-9a-fA-Fx\]+).* \"threadname_6\" \[^\r\n\]*" {
- set process6 $expect_out(1,string)
- exp_continue
- }
- -re ". 5 .*\[Pp\]rocess (\[0-9a-fA-Fx\]+).* \"threadname_5\" \[^\r\n\]*" {
- set process5 $expect_out(1,string)
- exp_continue
- }
- -re ". 4 .*\[Pp\]rocess (\[0-9a-fA-Fx\]+).* \"threadname_4\" \[^\r\n\]*" {
- set process4 $expect_out(1,string)
- exp_continue
- }
- -re ". 3 .*\[Pp\]rocess (\[0-9a-fA-Fx\]+).* \"threadname_3\" \[^\r\n\]*" {
- set process3 $expect_out(1,string)
- exp_continue
- }
- -re ". 2 .*\[Pp\]rocess (\[0-9a-fA-Fx\]+).* \"threadname_2\" \[^\r\n\]*" {
- set process2 $expect_out(1,string)
- exp_continue
- }
- -re ". 1 .*\[Pp\]rocess (\[0-9a-fA-Fx\]+).* \"threadname_1\" \[^\r\n\]*" {
- set process1 $expect_out(1,string)
+ -re ". (\[0-9\]+) \[^\r\n\]*\[Pp\]rocess (\[0-9a-fA-Fx\]+)\[^\r\n\]* \"threadname_\[0-9\]+\" \[^\r\n\]*" {
+ set thr_num $expect_out(1,string)
+ set process$thr_num $expect_out(2,string)
exp_continue
}
-re ".*$gdb_prompt $" {
@@ -125,29 +89,11 @@ if { [info exists process6] } then {
}
# Collect lwp ids, if any.
+
gdb_test_multiple "info threads" "collect thread id" {
- -re ". 6 .*LWP (\[0-9a-fA-Fx\]+).* \"threadname_6\" \[^\r\n\]*" {
- set lwp6 $expect_out(1,string)
- exp_continue
- }
- -re ". 5 .*LWP (\[0-9a-fA-Fx\]+).* \"threadname_5\" \[^\r\n\]*" {
- set lwp5 $expect_out(1,string)
- exp_continue
- }
- -re ". 4 .*LWP (\[0-9a-fA-Fx\]+).* \"threadname_4\" \[^\r\n\]*" {
- set lwp4 $expect_out(1,string)
- exp_continue
- }
- -re ". 3 .*LWP (\[0-9a-fA-Fx\]+).* \"threadname_3\" \[^\r\n\]*" {
- set lwp3 $expect_out(1,string)
- exp_continue
- }
- -re ". 2 .*LWP (\[0-9a-fA-Fx\]+).* \"threadname_2\" \[^\r\n\]*" {
- set lwp2 $expect_out(1,string)
- exp_continue
- }
- -re ". 1 .*LWP (\[0-9a-fA-Fx\]+).* \"threadname_1\" \[^\r\n\]*" {
- set lwp1 $expect_out(1,string)
+ -re ". (\[0-9\]+) \[^\r\n\]*LWP (\[0-9a-fA-Fx\]+)\[^\r\n\]* \"threadname_\[0-9\]+\" \[^\r\n\]*" {
+ set thr_num $expect_out(1,string)
+ set lwp$thr_num $expect_out(2,string)
exp_continue
}
-re ".*$gdb_prompt $" {
@@ -241,36 +187,13 @@ gdb_test "thread find foobarbaz" "No threads match .*" "no thread"
# Test regular expression
#
-set see1 0
-set see2 0
-set see3 0
-set see4 0
-set see5 0
-set see6 0
-
+for {set i 1} {$i <= 6} {incr i} {
+ set see$i 0
+}
gdb_test_multiple "thread find threadname_\[345\]" "test regular exp" {
- -re "Thread 6 has name \[^\r\n\]*" {
- set see6 1
- exp_continue
- }
- -re "Thread 5 has name \[^\r\n\]*" {
- set see5 1
- exp_continue
- }
- -re "Thread 4 has name \[^\r\n\]*" {
- set see4 1
- exp_continue
- }
- -re "Thread 3 has name \[^\r\n\]*" {
- set see3 1
- exp_continue
- }
- -re "Thread 2 has name \[^\r\n\]*" {
- set see2 1
- exp_continue
- }
- -re "Thread 1 has name \[^\r\n\]*" {
- set see1 1
+ -re "Thread (\[0-9\]+) has name \[^\r\n\]*" {
+ set thr_num $expect_out(1,string)
+ set see$thr_num 1
exp_continue
}
-re ".*$gdb_prompt $" {
@@ -286,36 +209,13 @@ gdb_test_multiple "thread find threadname_\[345\]" "test regular exp" {
# Test info threads on a subset of threads
#
-set see1 0
-set see2 0
-set see3 0
-set see4 0
-set see5 0
-set see6 0
-
+for {set i 1} {$i <= 6} {incr i} {
+ set see$i 0
+}
gdb_test_multiple "info threads 2 4 6" "info threads 2 4 6" {
- -re ". 6 \[^\r\n\]*\"threadname_6\" \[^\r\n\]*" {
- set see6 1
- exp_continue
- }
- -re ". 5 \[^\r\n\]*\"threadname_5\" \[^\r\n\]*" {
- set see5 1
- exp_continue
- }
- -re ". 4 \[^\r\n\]*\"threadname_4\" \[^\r\n\]*" {
- set see4 1
- exp_continue
- }
- -re ". 3 \[^\r\n\]*\"threadname_3\" \[^\r\n\]*" {
- set see3 1
- exp_continue
- }
- -re ". 2 \[^\r\n\]*\"threadname_2\" \[^\r\n\]*" {
- set see2 1
- exp_continue
- }
- -re ". 1 \[^\r\n\]*\"threadname_1\" \[^\r\n\]*" {
- set see1 1
+ -re ". (\[0-9\]+) \[^\r\n\]*\"threadname_\[0-9\]+\" \[^\r\n\]*" {
+ set thr_num $expect_out(1,string)
+ set see$thr_num 1
exp_continue
}
-re "$gdb_prompt $" {
@@ -331,36 +231,13 @@ gdb_test_multiple "info threads 2 4 6" "info threads 2 4 6" {
# Test info threads on a range
#
-set see1 0
-set see2 0
-set see3 0
-set see4 0
-set see5 0
-set see6 0
-
+for {set i 1} {$i <= 6} {incr i} {
+ set see$i 0
+}
gdb_test_multiple "info threads 3-5" "info threads 3-5" {
- -re ". 6 .*\"threadname_6\" \[^\r\n\]*" {
- set see6 1
- exp_continue
- }
- -re ". 5 .*\"threadname_5\" \[^\r\n\]*" {
- set see5 1
- exp_continue
- }
- -re ". 4 .*\"threadname_4\" \[^\r\n\]*" {
- set see4 1
- exp_continue
- }
- -re ". 3 .*\"threadname_3\" \[^\r\n\]*" {
- set see3 1
- exp_continue
- }
- -re ". 2 .*\"threadname_2\" \[^\r\n\]*" {
- set see2 1
- exp_continue
- }
- -re ". 1 .*\"threadname_1\" \[^\r\n\]*" {
- set see1 1
+ -re ". (\[0-9\]+) \[^\r\n\]*\"threadname_\[0-9\]+\" \[^\r\n\]*" {
+ set thr_num $expect_out(1,string)
+ set see$thr_num 1
exp_continue
}
-re "$gdb_prompt $" {
@@ -378,36 +255,13 @@ gdb_test "info threads 5-3" "inverted range" "test inverted range"
# Test degenerate range
-set see1 0
-set see2 0
-set see3 0
-set see4 0
-set see5 0
-set see6 0
-
+for {set i 1} {$i <= 6} {incr i} {
+ set see$i 0
+}
gdb_test_multiple "info threads 3-3" "info threads 3-3" {
- -re ". 6 .*\"threadname_6\" \[^\r\n\]*" {
- set see6 1
- exp_continue
- }
- -re ". 5 .*\"threadname_5\" \[^\r\n\]*" {
- set see5 1
- exp_continue
- }
- -re ". 4 .*\"threadname_4\" \[^\r\n\]*" {
- set see4 1
- exp_continue
- }
- -re ". 3 .*\"threadname_3\" \[^\r\n\]*" {
- set see3 1
- exp_continue
- }
- -re ". 2 .*\"threadname_2\" \[^\r\n\]*" {
- set see2 1
- exp_continue
- }
- -re ". 1 .*\"threadname_1\" \[^\r\n\]*" {
- set see1 1
+ -re ". (\[0-9\]+) .*\"threadname_\[0-9\]+\" \[^\r\n\]*" {
+ set thr_num $expect_out(1,string)
+ set see$thr_num 1
exp_continue
}
-re ".*$gdb_prompt $" {
diff --git a/gdb/testsuite/gdb.threads/tls.exp b/gdb/testsuite/gdb.threads/tls.exp
index 3e74899..8d322db 100644
--- a/gdb/testsuite/gdb.threads/tls.exp
+++ b/gdb/testsuite/gdb.threads/tls.exp
@@ -205,7 +205,7 @@ gdb_test "continue" ".*Breakpoint 3.*still alive.*" "continue to synch point"
set no_of_threads 0
send_gdb "info thread\n"
gdb_expect {
- -re "^info thread\[ \t\r\n\]+ *Id .*Frame\[ \t\r\n\]+(\[0-9\]+) *Thread.*$gdb_prompt $" {
+ -re "^info thread\[ \t\r\n\]+ *Id .*Frame\[ \t\r\n\]+.*(\[0-9\]+) *Thread\[^\r\n\]+\r\n$gdb_prompt $" {
set no_of_threads $expect_out(1,string)
pass "get number of threads"
}
diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
index dd6c41a..07a84ea 100644
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -1965,19 +1965,8 @@ proc mi_load_shlibs { args } {
mi_gdb_test "set solib-search-path [file dirname [lindex $args 0]]" "\^done" ""
}
-proc mi_reverse_list { list } {
- if { [llength $list] <= 1 } {
- return $list
- }
- set tail [lrange $list 1 [llength $list]]
- set rtail [mi_reverse_list $tail]
- lappend rtail [lindex $list 0]
- return $rtail
-}
-
-proc mi_check_thread_states { xstates test } {
+proc mi_check_thread_states { states test } {
global expect_out
- set states [mi_reverse_list $xstates]
set pattern ".*\\^done,threads=\\\["
foreach s $states {
set pattern "${pattern}(.*)state=\"$s\""
diff --git a/gdb/thread.c b/gdb/thread.c
index 6d410fb..b47d990 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -236,8 +236,17 @@ new_thread (ptid_t ptid)
tp->ptid = ptid;
tp->num = ++highest_thread_num;
- tp->next = thread_list;
- thread_list = tp;
+
+ if (thread_list == NULL)
+ thread_list = tp;
+ else
+ {
+ struct thread_info *last;
+
+ for (last = thread_list; last->next != NULL; last = last->next)
+ ;
+ last->next = tp;
+ }
/* Nothing to follow yet. */
tp->pending_follow.kind = TARGET_WAITKIND_SPURIOUS;
--
1.9.3
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [PATCH 3/6] List inferiors/threads/pspaces in ascending order
2015-10-22 11:07 ` [PATCH 3/6] List inferiors/threads/pspaces in ascending order Pedro Alves
@ 2015-10-22 16:03 ` Eli Zaretskii
2016-01-08 20:39 ` Regression for gdb.threads/fork-plus-threads.exp [Re: [PATCH 3/6] List inferiors/threads/pspaces in ascending order] Jan Kratochvil
1 sibling, 0 replies; 16+ messages in thread
From: Eli Zaretskii @ 2015-10-22 16:03 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches
> From: Pedro Alves <palves@redhat.com>
> Date: Thu, 22 Oct 2015 10:59:01 +0100
>
> Before:
> (gdb) info threads
> Id Target Id Frame
> 3 Thread 0x7ffff77c3700 (LWP 29035) callme () at foo.c:30
> 2 Thread 0x7ffff7fc4700 (LWP 29034) 0x000000000040087b in child_function_2 (arg=0x0) at foo.c:60
> * 1 Thread 0x7ffff7fc5740 (LWP 29030) 0x0000003b37209237 in pthread_join (threadid=140737353893632, thread_return=0x0) at pthread_join.c:92
>
> After:
> (gdb) info threads
> Id Target Id Frame
> * 1 Thread 0x7ffff7fc5740 (LWP 29030) 0x0000003b37209237 in pthread_join (threadid=140737353893632, thread_return=0x0) at pthread_join.c:92
> 2 Thread 0x7ffff7fc4700 (LWP 29034) 0x000000000040087b in child_function_2 (arg=0x0) at foo.c:60
> 3 Thread 0x7ffff77c3700 (LWP 29035) callme () at foo.c:30
>
> gdb/doc/ChangeLog:
> 2015-10-22 Pedro Alves <palves@redhat.com>
>
> PR 17539
> * gdb.texinfo (Inferiors and Programs): Adjust "maint info
> program-spaces" example to ascending order listing.
> (Threads): Adjust "info threads" example to ascending order
> listing.
> (Forks): Adjust "info inferiors" example to ascending order
> listing.
>
> gdb/ChangeLog:
> 2015-10-22 Pedro Alves <palves@redhat.com>
>
> PR 17539
> * inferior.c (add_inferior_silent): Append the new inferior to the
> end of the list.
> * progspace.c (add_program_space): Append the new pspace to the
> end of the list.
> * thread.c (new_thread): Append the new thread to the end of the
> list.
>
> gdb/testsuite/ChangeLog:
> 2015-10-22 Pedro Alves <palves@redhat.com>
>
> PR 17539
> * gdb.base/foll-exec-mode.exp: Adjust to GDB listing inferiors and
> threads in ascending order.
> * gdb.base/foll-fork.exp: Likewise.
> * gdb.base/foll-vfork.exp: Likewise.
> * gdb.base/multi-forks.exp: Likewise.
> * gdb.mi/mi-nonstop.exp: Likewise.
> * gdb.mi/mi-nsintrall.exp: Likewise.
> * gdb.multi/base.exp: Likewise.
> * gdb.multi/multi-arch.exp: Likewise.
> * gdb.python/py-inferior.exp: Likewise.
> * gdb.threads/break-while-running.exp: Likewise.
> * gdb.threads/execl.exp: Likewise.
> * gdb.threads/gcore-thread.exp: Likewise.
> * gdb.threads/info-threads-cur-sal.exp: Likewise.
> * gdb.threads/kill.exp: Likewise.
> * gdb.threads/linux-dp.exp: Likewise.
> * gdb.threads/multiple-step-overs.exp: Likewise.
> * gdb.threads/next-bp-other-thread.exp: Likewise.
> * gdb.threads/step-bg-decr-pc-switch-thread.exp: Likewise.
> * gdb.threads/step-over-lands-on-breakpoint.exp: Likewise.
> * gdb.threads/step-over-trips-on-watchpoint.exp: Likewise.
> * gdb.threads/thread-find.exp: Likewise.
> * gdb.threads/tls.exp: Likewise.
> * lib/mi-support.exp (mi_reverse_list): Delete.
> (mi_check_thread_states): No longer reverse list.
Thanks, the documentation part is OK.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Regression for gdb.threads/fork-plus-threads.exp [Re: [PATCH 3/6] List inferiors/threads/pspaces in ascending order]
2015-10-22 11:07 ` [PATCH 3/6] List inferiors/threads/pspaces in ascending order Pedro Alves
2015-10-22 16:03 ` Eli Zaretskii
@ 2016-01-08 20:39 ` Jan Kratochvil
2016-01-11 14:40 ` Pedro Alves
1 sibling, 1 reply; 16+ messages in thread
From: Jan Kratochvil @ 2016-01-08 20:39 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches
On Thu, 22 Oct 2015 11:59:01 +0200, Pedro Alves wrote:
7e0aa6aa9983c745aedc203db0cc360a0ad47cac is the first bad commit
commit 7e0aa6aa9983c745aedc203db0cc360a0ad47cac
Author: Pedro Alves <palves@redhat.com>
Date: Tue Nov 24 18:11:21 2015 +0000
List inferiors/threads/pspaces in ascending order
PASS->FAIL:
FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: inferior 1 exited
FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: no threads left (timeout)
FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: only inferior 1 left (the program exited)
-PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: inferior 1 exited
+warning: Error removing breakpoint 1^M
+Error in re-setting breakpoint 1: Warning:^M
+Cannot insert breakpoint 1.^M
+Cannot access memory at address 0x8048700^M
+^M
+Warning:^M
+Cannot insert breakpoint 1.^M
+Cannot access memory at address 0x8048700^M
+^M
+(gdb) FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: inferior 1 exited
I haven't tried to debug it.
It happens on Fedora 23 x86_64 with -m32 for the testsuite.
Jan
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: Regression for gdb.threads/fork-plus-threads.exp [Re: [PATCH 3/6] List inferiors/threads/pspaces in ascending order]
2016-01-08 20:39 ` Regression for gdb.threads/fork-plus-threads.exp [Re: [PATCH 3/6] List inferiors/threads/pspaces in ascending order] Jan Kratochvil
@ 2016-01-11 14:40 ` Pedro Alves
2016-01-12 11:22 ` Pedro Alves
0 siblings, 1 reply; 16+ messages in thread
From: Pedro Alves @ 2016-01-11 14:40 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: gdb-patches
On 01/08/2016 08:39 PM, Jan Kratochvil wrote:
> On Thu, 22 Oct 2015 11:59:01 +0200, Pedro Alves wrote:
>
> 7e0aa6aa9983c745aedc203db0cc360a0ad47cac is the first bad commit
> commit 7e0aa6aa9983c745aedc203db0cc360a0ad47cac
> Author: Pedro Alves <palves@redhat.com>
> Date: Tue Nov 24 18:11:21 2015 +0000
> List inferiors/threads/pspaces in ascending order
>
> PASS->FAIL:
> FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: inferior 1 exited
> FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: no threads left (timeout)
> FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: only inferior 1 left (the program exited)
>
> -PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: inferior 1 exited
> +warning: Error removing breakpoint 1^M
> +Error in re-setting breakpoint 1: Warning:^M
> +Cannot insert breakpoint 1.^M
> +Cannot access memory at address 0x8048700^M
> +^M
> +Warning:^M
> +Cannot insert breakpoint 1.^M
> +Cannot access memory at address 0x8048700^M
> +^M
> +(gdb) FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: inferior 1 exited
>
> I haven't tried to debug it.
>
> It happens on Fedora 23 x86_64 with -m32 for the testsuite.
I see it too on F20, and indeed only with -m32. I don't know why yet.
Thanks,
Pedro Alves
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Regression for gdb.threads/fork-plus-threads.exp [Re: [PATCH 3/6] List inferiors/threads/pspaces in ascending order]
2016-01-11 14:40 ` Pedro Alves
@ 2016-01-12 11:22 ` Pedro Alves
2016-01-13 0:37 ` Pedro Alves
0 siblings, 1 reply; 16+ messages in thread
From: Pedro Alves @ 2016-01-12 11:22 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: gdb-patches
On 01/11/2016 02:39 PM, Pedro Alves wrote:
> On 01/08/2016 08:39 PM, Jan Kratochvil wrote:
>> On Thu, 22 Oct 2015 11:59:01 +0200, Pedro Alves wrote:
>>
>> 7e0aa6aa9983c745aedc203db0cc360a0ad47cac is the first bad commit
>> commit 7e0aa6aa9983c745aedc203db0cc360a0ad47cac
>> Author: Pedro Alves <palves@redhat.com>
>> Date: Tue Nov 24 18:11:21 2015 +0000
>> List inferiors/threads/pspaces in ascending order
>>
>> PASS->FAIL:
>> FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: inferior 1 exited
>> FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: no threads left (timeout)
>> FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: only inferior 1 left (the program exited)
>>
>> -PASS: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: inferior 1 exited
>> +warning: Error removing breakpoint 1^M
>> +Error in re-setting breakpoint 1: Warning:^M
>> +Cannot insert breakpoint 1.^M
>> +Cannot access memory at address 0x8048700^M
>> +^M
>> +Warning:^M
>> +Cannot insert breakpoint 1.^M
>> +Cannot access memory at address 0x8048700^M
>> +^M
>> +(gdb) FAIL: gdb.threads/fork-plus-threads.exp: detach-on-fork=off: inferior 1 exited
>>
>> I haven't tried to debug it.
>>
>> It happens on Fedora 23 x86_64 with -m32 for the testsuite.
>
> I see it too on F20, and indeed only with -m32. I don't know why yet.
This looks like just exposed a preexisting problem.
When the second fork happens, we do a breakpoint reset, which wipes all locations and tries
to recreate locations for inferior 2. Because that inferior is either running or exits and
is now zombie, prologue skipping fails to read memory, and thus a breakpoint that used to be
at line 64 (after prologue) ends up re-set to line 60 (before prologue). We then try to
remove the old breakpoint at line 64 from inferior 2, which fails, because the inferior is
either running or zombie.
The reason we didn't see this before is that the code cache masked it. Before, we
resumed the threads in the opposite order (newest first), and "luckily" the sequence
of events in this particular test would be such that the code cache hasn't been flushed
yet when we went to prologue skipping.
"set code-cache off" makes the problem visible even before the patch.
This doesn't trigger with native-extended-gdbserver/-m32 because gdbserver can
read memory even when the inferior is running.
This is also yet another instance of breakpoint re-setting being too coarse [1]...
If inferior 1 forked inferior 3, why would we need to re-set breakpoint locations
of inferior 2? I think we can avoid revamping breakpoint re-set completely, by
instead limiting re-sets to the program space that triggered it.
[1] - https://sourceware.org/gdb/wiki/BreakpointReset
Thanks,
Pedro Alves
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 1/6] Make gdb.python/py-inferior.exp test names unique
2015-10-22 10:56 [PATCH 0/6] PR 17539 - inferiors/threads etc. print in reverse order Pedro Alves
` (2 preceding siblings ...)
2015-10-22 11:07 ` [PATCH 3/6] List inferiors/threads/pspaces in ascending order Pedro Alves
@ 2015-10-22 11:23 ` Pedro Alves
2015-10-22 11:50 ` [PATCH 6/6] NEWS: "info" commands now list in ascending order Pedro Alves
` (2 subsequent siblings)
6 siblings, 0 replies; 16+ messages in thread
From: Pedro Alves @ 2015-10-22 11:23 UTC (permalink / raw)
To: gdb-patches
Before we had:
$ cat testsuite/gdb.sum | grep "PASS" | sort | uniq -c | sort -n
...
1 PASS: gdb.python/py-inferior.exp: write str
2 PASS: gdb.python/py-inferior.exp: Get inferior list length
2 PASS: gdb.python/py-inferior.exp: py start_addr = gdb.selected_frame ().read_var ('search_buf')
2 PASS: gdb.python/py-inferior.exp: Switch to first inferior
3 PASS: gdb.python/py-inferior.exp: find mixed-sized pattern
4 PASS: gdb.python/py-inferior.exp: py length = search_buf.type.sizeof
4 PASS: gdb.python/py-inferior.exp: py start_addr = search_buf.address
5 PASS: gdb.python/py-inferior.exp: Check inferior validity
$
gdb/testsuite/ChangeLog:
2015-10-22 Pedro Alves <palves@redhat.com>
* gdb.python/py-inferior.exp: Use with_test_prefix. Consistently
use lowercase.
---
gdb/testsuite/gdb.python/py-inferior.exp | 217 +++++++++++++++++--------------
1 file changed, 117 insertions(+), 100 deletions(-)
diff --git a/gdb/testsuite/gdb.python/py-inferior.exp b/gdb/testsuite/gdb.python/py-inferior.exp
index b8ac9c8..8a20542 100644
--- a/gdb/testsuite/gdb.python/py-inferior.exp
+++ b/gdb/testsuite/gdb.python/py-inferior.exp
@@ -99,135 +99,152 @@ set one_pattern_found "${newline}.${dec_number}"
# Test string pattern.
-gdb_test "set *(int32_t*) &int8_search_buf\[10\] = 0x61616161" "" ""
-gdb_test "py search_buf = gdb.selected_frame ().read_var ('int8_search_buf')" "" ""
-gdb_test_no_output "py start_addr = search_buf.address"
-gdb_test_no_output "py length = search_buf.type.sizeof"
-
-gdb_test "py print (gdb.inferiors()\[0\].search_memory (start_addr, length, 'aaa'))" \
- "${one_pattern_found}" "find string pattern"
-
-# Test not finding pattern because search range too small, with
-# potential find at the edge of the range.
-
-gdb_test "py print (gdb.inferiors()\[0\].search_memory (start_addr, 10+3, 'aaaa'))" \
- "${pattern_not_found}" "pattern not found at end of range"
-
-# Increase the search range by 1 and we should find the pattern.
-
-gdb_test "py print (gdb.inferiors()\[0\].search_memory (start_addr, 10+3+1, 'aaa'))" \
- "${one_pattern_found}" "pattern found at end of range"
+with_test_prefix "string" {
+ gdb_test "set *(int32_t*) &int8_search_buf\[10\] = 0x61616161"
+ gdb_test "py search_buf = gdb.selected_frame ().read_var ('int8_search_buf')"
+ gdb_test_no_output "py start_addr = search_buf.address"
+ gdb_test_no_output "py length = search_buf.type.sizeof"
+
+ gdb_test "py print (gdb.inferiors()\[0\].search_memory (start_addr, length, 'aaa'))" \
+ "${one_pattern_found}" "find string pattern"
+
+ # Test not finding pattern because search range too small, with
+ # potential find at the edge of the range.
+ gdb_test "py print (gdb.inferiors()\[0\].search_memory (start_addr, 10+3, 'aaaa'))" \
+ "${pattern_not_found}" "pattern not found at end of range"
+
+ # Increase the search range by 1 and we should find the pattern.
+ gdb_test "py print (gdb.inferiors()\[0\].search_memory (start_addr, 10+3+1, 'aaa'))" \
+ "${one_pattern_found}" "pattern found at end of range"
+}
# Import struct to pack the following patterns.
gdb_test_no_output "py from struct import *"
# Test 16-bit pattern.
-gdb_test_no_output "set int16_search_buf\[10\] = 0x1234"
-gdb_test_no_output "py search_buf = gdb.selected_frame ().read_var ('int16_search_buf')"
-gdb_test_no_output "py start_addr = search_buf.address"
-gdb_test_no_output "py length = search_buf.type.sizeof"
-gdb_test_no_output "py pattern = pack('${python_pack_char}H',0x1234)"
-
-gdb_test "py print (gdb.inferiors()\[0\].search_memory (start_addr, length, pattern))" \
- "${one_pattern_found}" "find 16-bit pattern, with value pattern"
+with_test_prefix "16-bit" {
+ gdb_test_no_output "set int16_search_buf\[10\] = 0x1234"
+ gdb_test_no_output "py search_buf = gdb.selected_frame ().read_var ('int16_search_buf')"
+ gdb_test_no_output "py start_addr = search_buf.address"
+ gdb_test_no_output "py length = search_buf.type.sizeof"
+ gdb_test_no_output "py pattern = pack('${python_pack_char}H',0x1234)"
+ gdb_test "py print (gdb.inferiors()\[0\].search_memory (start_addr, length, pattern))" \
+ "${one_pattern_found}" "find 16-bit pattern, with value pattern"
+}
# Test 32-bit pattern.
-gdb_test_no_output "set int32_search_buf\[10\] = 0x12345678"
-gdb_test_no_output "py search_buf = gdb.selected_frame ().read_var ('int32_search_buf')"
-gdb_test_no_output "py start_addr = search_buf.address"
-gdb_test_no_output "py length = search_buf.type.sizeof"
-gdb_test_no_output "py pattern = pack('${python_pack_char}I',0x12345678)"
-
-gdb_test "py print (gdb.inferiors()\[0\].search_memory (start_addr, length, pattern))" \
- "${one_pattern_found}" "find 32-bit pattern, with python pattern"
+with_test_prefix "32-bit" {
+ gdb_test_no_output "set int32_search_buf\[10\] = 0x12345678"
+ gdb_test_no_output "py search_buf = gdb.selected_frame ().read_var ('int32_search_buf')"
+ gdb_test_no_output "py start_addr = search_buf.address"
+ gdb_test_no_output "py length = search_buf.type.sizeof"
+ gdb_test_no_output "py pattern = pack('${python_pack_char}I',0x12345678)"
+ gdb_test "py print (gdb.inferiors()\[0\].search_memory (start_addr, length, pattern))" \
+ "${one_pattern_found}" "find 32-bit pattern, with python pattern"
+}
# Test 64-bit pattern.
-gdb_test_no_output "set int64_search_buf\[10\] = 0xfedcba9876543210LL"
-gdb_test_no_output "py search_buf = gdb.selected_frame ().read_var ('int64_search_buf')"
-gdb_test_no_output "py start_addr = search_buf.address"
-gdb_test_no_output "py length = search_buf.type.sizeof"
-gdb_test_no_output "py pattern = pack('${python_pack_char}Q', 0xfedcba9876543210)"
-
-gdb_test "py print (gdb.inferiors()\[0\].search_memory (start_addr, length, pattern))" \
- "${one_pattern_found}" "find 64-bit pattern, with value pattern"
+with_test_prefix "64-bit" {
+ gdb_test_no_output "set int64_search_buf\[10\] = 0xfedcba9876543210LL"
+ gdb_test_no_output "py search_buf = gdb.selected_frame ().read_var ('int64_search_buf')"
+ gdb_test_no_output "py start_addr = search_buf.address"
+ gdb_test_no_output "py length = search_buf.type.sizeof"
+ gdb_test_no_output "py pattern = pack('${python_pack_char}Q', 0xfedcba9876543210)"
+ gdb_test "py print (gdb.inferiors()\[0\].search_memory (start_addr, length, pattern))" \
+ "${one_pattern_found}" "find 64-bit pattern, with value pattern"
+}
# Test mixed-sized patterns.
-gdb_test_no_output "set *(int8_t*) &search_buf\[10\] = 0x62"
-gdb_test_no_output "set *(int16_t*) &search_buf\[11\] = 0x6363"
-gdb_test_no_output "set *(int32_t*) &search_buf\[13\] = 0x64646464"
-gdb_test_no_output "py search_buf = gdb.selected_frame ().read_var ('search_buf')"
-gdb_test_no_output "py start_addr = search_buf\[0\].address"
-gdb_test_no_output "py pattern1 = pack('B', 0x62)"
-gdb_test_no_output "py pattern2 = pack('${python_pack_char}H', 0x6363)"
-gdb_test_no_output "py pattern3 = pack('${python_pack_char}I', 0x64646464)"
-
-gdb_test "py print (gdb.inferiors()\[0\].search_memory (start_addr, 100, pattern1))" \
- "${one_pattern_found}" "find mixed-sized pattern"
-gdb_test "py print (gdb.inferiors()\[0\].search_memory (start_addr, 100, pattern2))" \
- "${one_pattern_found}" "find mixed-sized pattern"
-gdb_test "py print (gdb.inferiors()\[0\].search_memory (start_addr, 100, pattern3))" \
- "${one_pattern_found}" "find mixed-sized pattern"
+with_test_prefix "mixed-sized" {
+ gdb_test_no_output "set *(int8_t*) &search_buf\[10\] = 0x62"
+ gdb_test_no_output "set *(int16_t*) &search_buf\[11\] = 0x6363"
+ gdb_test_no_output "set *(int32_t*) &search_buf\[13\] = 0x64646464"
+ gdb_test_no_output "py search_buf = gdb.selected_frame ().read_var ('search_buf')"
+ gdb_test_no_output "py start_addr = search_buf\[0\].address"
+ gdb_test_no_output "py pattern1 = pack('B', 0x62)"
+ gdb_test_no_output "py pattern2 = pack('${python_pack_char}H', 0x6363)"
+ gdb_test_no_output "py pattern3 = pack('${python_pack_char}I', 0x64646464)"
+
+ gdb_test "py print (gdb.inferiors()\[0\].search_memory (start_addr, 100, pattern1))" \
+ "${one_pattern_found}" "find mixed-sized pattern 1"
+ gdb_test "py print (gdb.inferiors()\[0\].search_memory (start_addr, 100, pattern2))" \
+ "${one_pattern_found}" "find mixed-sized pattern 2"
+ gdb_test "py print (gdb.inferiors()\[0\].search_memory (start_addr, 100, pattern3))" \
+ "${one_pattern_found}" "find mixed-sized pattern 3"
+}
# Test search spanning a large range, in the particular case of native
# targets, test the search spanning multiple chunks.
# Remote targets may implement the search differently.
set CHUNK_SIZE 16000
-
-gdb_test_no_output "set *(int32_t*) &search_buf\[0*${CHUNK_SIZE}+100\] = 0x12345678"
-gdb_test_no_output "set *(int32_t*) &search_buf\[1*${CHUNK_SIZE}+100\] = 0x12345678"
-gdb_test_no_output "py start_addr = gdb.selected_frame ().read_var ('search_buf')"
-gdb_test_no_output "py end_addr = start_addr + gdb.selected_frame ().read_var ('search_buf_size')"
-gdb_test_no_output "py pattern = pack('${python_pack_char}I', 0x12345678)"
-gdb_test_no_output "py first = gdb.inferiors()\[0\].search_memory (start_addr,end_addr - start_addr, pattern)"
-gdb_test "py print (first)" "${one_pattern_found}" "search spanning large range 1st result"
-gdb_test_no_output "py start_addr = first + 1"
-gdb_test_no_output "py second = gdb.inferiors()\[0\].search_memory (start_addr, end_addr - start_addr, pattern)"
-gdb_test "py print (second)" "${one_pattern_found}" "search spanning large range 2nd result"
-gdb_test_no_output "py start_addr = second + 1"
-gdb_test_no_output "py third = gdb.inferiors()\[0\].search_memory (start_addr, end_addr - start_addr, pattern)"
-gdb_test "py print (third)" "${pattern_not_found}" "search spanning large range 3rd result"
+with_test_prefix "large range" {
+ gdb_test_no_output "set *(int32_t*) &search_buf\[0*${CHUNK_SIZE}+100\] = 0x12345678"
+ gdb_test_no_output "set *(int32_t*) &search_buf\[1*${CHUNK_SIZE}+100\] = 0x12345678"
+ gdb_test_no_output "py start_addr = gdb.selected_frame ().read_var ('search_buf')"
+ gdb_test_no_output "py end_addr = start_addr + gdb.selected_frame ().read_var ('search_buf_size')"
+ gdb_test_no_output "py pattern = pack('${python_pack_char}I', 0x12345678)"
+
+ gdb_test_no_output "py first = gdb.inferiors()\[0\].search_memory (start_addr,end_addr - start_addr, pattern)"
+ gdb_test "py print (first)" "${one_pattern_found}" "search spanning large range 1st result"
+ gdb_test_no_output "py start_addr = first + 1"
+ gdb_test_no_output "py second = gdb.inferiors()\[0\].search_memory (start_addr, end_addr - start_addr, pattern)"
+ gdb_test "py print (second)" "${one_pattern_found}" "search spanning large range 2nd result"
+ gdb_test_no_output "py start_addr = second + 1"
+ gdb_test_no_output "py third = gdb.inferiors()\[0\].search_memory (start_addr, end_addr - start_addr, pattern)"
+ gdb_test "py print (third)" "${pattern_not_found}" "search spanning large range 3rd result"
+}
# For native targets, test a pattern straddling a chunk boundary.
if [isnative] {
- gdb_test_no_output "set *(int32_t*) &search_buf\[${CHUNK_SIZE}-1\] = 0xfdb97531"
- gdb_test_no_output "py pattern = pack('${python_pack_char}I', 0xfdb97531)"
- gdb_test_no_output "py start_addr = gdb.selected_frame ().read_var ('search_buf')"
- gdb_test "py print (gdb.inferiors()\[0\].search_memory (start_addr, end_addr - start_addr, pattern))" \
- "${one_pattern_found}" "find pattern straddling chunk boundary"
+ with_test_prefix "straddling" {
+ gdb_test_no_output "set *(int32_t*) &search_buf\[${CHUNK_SIZE}-1\] = 0xfdb97531"
+ gdb_test_no_output "py pattern = pack('${python_pack_char}I', 0xfdb97531)"
+ gdb_test_no_output "py start_addr = gdb.selected_frame ().read_var ('search_buf')"
+ gdb_test "py print (gdb.inferiors()\[0\].search_memory (start_addr, end_addr - start_addr, pattern))" \
+ "${one_pattern_found}" "find pattern straddling chunk boundary"
+ }
}
# Test Inferior is_valid. This must always be the last test in
# this testcase as it kills the inferior.
-gdb_py_test_silent_cmd "python inf_list = gdb.inferiors()" "get initial list" 1
-gdb_test "python print (len(inf_list))" "1" "Get inferior list length"
-gdb_test "python print (inf_list\[0\].is_valid())" "True" \
- "Check inferior validity"
-gdb_test "add-inferior" "Added inferior 2.*" "add empty inferior 2"
-gdb_py_test_silent_cmd "python inf_list = gdb.inferiors()" "get new list" 1
-gdb_test "python print (len(inf_list))" "2" "Get inferior list length"
-gdb_test "python print (inf_list\[0\].is_valid())" "True" \
- "Check inferior validity"
-gdb_test "python print (inf_list\[1\].is_valid())" "True" \
- "Check inferior validity"
-gdb_test_no_output "remove-inferiors 2" "remove-inferiors 3"
-gdb_test "python print (inf_list\[0\].is_valid())" "False" \
- "Check inferior validity"
-gdb_test "python print (inf_list\[1\].is_valid())" "True" \
- "Check inferior validity"
+with_test_prefix "is_valid" {
+ gdb_py_test_silent_cmd "python inf_list = gdb.inferiors()" "get initial list" 1
+ gdb_test "python print (len(inf_list))" "1" "get inferior list length 1"
+ gdb_test "python print (inf_list\[0\].is_valid())" "True" \
+ "check inferior validity 1"
+
+ gdb_test "add-inferior" "Added inferior 2.*" "add empty inferior 2"
+ gdb_py_test_silent_cmd "python inf_list = gdb.inferiors()" "get new list" 1
+ gdb_test "python print (len(inf_list))" "2" "get inferior list length 2"
+ gdb_test "python print (inf_list\[0\].is_valid())" "True" \
+ "check inferior validity 2"
+
+ gdb_test "python print (inf_list\[1\].is_valid())" "True" \
+ "check inferior validity 3"
+
+ gdb_test_no_output "remove-inferiors 2" "remove-inferiors 3"
+ gdb_test "python print (inf_list\[0\].is_valid())" "False" \
+ "check inferior validity 4"
+
+ gdb_test "python print (inf_list\[1\].is_valid())" "True" \
+ "check inferior validity 5"
+}
# Test gdb.selected_inferior()
-gdb_test "inferior 1" ".*" "Switch to first inferior"
-gdb_test "py print (gdb.selected_inferior().num)" "1" "First inferior selected"
-
-gdb_test "add-inferior" "Added inferior 3" "Create new inferior"
-gdb_test "inferior 3" ".*" "Switch to third inferior"
-gdb_test "py print (gdb.selected_inferior().num)" "3" "Third inferior selected"
-gdb_test "inferior 1" ".*" "Switch to first inferior"
-gdb_test_no_output "remove-inferiors 3" "Remove second inferior"
+with_test_prefix "selected_inferior" {
+ gdb_test "inferior 1" ".*" "switch to first inferior"
+ gdb_test "py print (gdb.selected_inferior().num)" "1" "first inferior selected"
+
+ gdb_test "add-inferior" "Added inferior 3" "create new inferior"
+ gdb_test "inferior 3" ".*" "switch to third inferior"
+ gdb_test "py print (gdb.selected_inferior().num)" "3" "third inferior selected"
+ gdb_test "inferior 1" ".*" "switch back to first inferior"
+ gdb_test_no_output "remove-inferiors 3" "remove second inferior"
+}
--
1.9.3
^ permalink raw reply [flat|nested] 16+ messages in thread* [PATCH 6/6] NEWS: "info" commands now list in ascending order
2015-10-22 10:56 [PATCH 0/6] PR 17539 - inferiors/threads etc. print in reverse order Pedro Alves
` (3 preceding siblings ...)
2015-10-22 11:23 ` [PATCH 1/6] Make gdb.python/py-inferior.exp test names unique Pedro Alves
@ 2015-10-22 11:50 ` Pedro Alves
2015-10-22 16:00 ` Eli Zaretskii
2015-10-22 12:36 ` [PATCH 5/6] List displays " Pedro Alves
2015-11-24 18:44 ` [PATCH 0/6] PR 17539 - inferiors/threads etc. print in reverse order Pedro Alves
6 siblings, 1 reply; 16+ messages in thread
From: Pedro Alves @ 2015-10-22 11:50 UTC (permalink / raw)
To: gdb-patches
gdb/ChangeLog:
2015-10-22 Pedro Alves <palves@redhat.com>
* NEWS: Mention that a few "info" commands now list the
corresponding items in ascending order.
---
gdb/NEWS | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/gdb/NEWS b/gdb/NEWS
index b2b1e99..e16e861 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -24,6 +24,10 @@
* GDB now supports displaced stepping on AArch64 GNU/Linux.
+* "info threads", "info inferiors", "info display", "info checkpoints"
+ and "maint info program-spaces" now list the corresponding items in
+ ascending order, for consistency with all other "info" commands.
+
* New commands
maint set target-non-stop (on|off|auto)
--
1.9.3
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [PATCH 6/6] NEWS: "info" commands now list in ascending order
2015-10-22 11:50 ` [PATCH 6/6] NEWS: "info" commands now list in ascending order Pedro Alves
@ 2015-10-22 16:00 ` Eli Zaretskii
2015-10-22 16:06 ` Pedro Alves
0 siblings, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2015-10-22 16:00 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches
> From: Pedro Alves <palves@redhat.com>
> Date: Thu, 22 Oct 2015 10:59:04 +0100
>
> gdb/ChangeLog:
> 2015-10-22 Pedro Alves <palves@redhat.com>
>
> * NEWS: Mention that a few "info" commands now list the
> corresponding items in ascending order.
> ---
> gdb/NEWS | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/gdb/NEWS b/gdb/NEWS
> index b2b1e99..e16e861 100644
> --- a/gdb/NEWS
> +++ b/gdb/NEWS
> @@ -24,6 +24,10 @@
>
> * GDB now supports displaced stepping on AArch64 GNU/Linux.
>
> +* "info threads", "info inferiors", "info display", "info checkpoints"
> + and "maint info program-spaces" now list the corresponding items in
> + ascending order, for consistency with all other "info" commands.
^^
I'd suggest to add "alphabetic" where indicated.
Otherwise, this is fine, thanks.
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [PATCH 6/6] NEWS: "info" commands now list in ascending order
2015-10-22 16:00 ` Eli Zaretskii
@ 2015-10-22 16:06 ` Pedro Alves
2015-10-22 16:16 ` Eli Zaretskii
0 siblings, 1 reply; 16+ messages in thread
From: Pedro Alves @ 2015-10-22 16:06 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: gdb-patches
On 10/22/2015 04:00 PM, Eli Zaretskii wrote:
>> From: Pedro Alves <palves@redhat.com>
>> Date: Thu, 22 Oct 2015 10:59:04 +0100
>>
>> gdb/ChangeLog:
>> 2015-10-22 Pedro Alves <palves@redhat.com>
>>
>> * NEWS: Mention that a few "info" commands now list the
>> corresponding items in ascending order.
>> ---
>> gdb/NEWS | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> diff --git a/gdb/NEWS b/gdb/NEWS
>> index b2b1e99..e16e861 100644
>> --- a/gdb/NEWS
>> +++ b/gdb/NEWS
>> @@ -24,6 +24,10 @@
>>
>> * GDB now supports displaced stepping on AArch64 GNU/Linux.
>>
>> +* "info threads", "info inferiors", "info display", "info checkpoints"
>> + and "maint info program-spaces" now list the corresponding items in
>> + ascending order, for consistency with all other "info" commands.
> ^^
> I'd suggest to add "alphabetic" where indicated.
That would sound very confusing to me, as we sort by e.g., thread
ID, not thread name, and alphabetic would suggest to me that we
now sort by "name" or whatever else looks like a name.
Would "ascending ID order" or "ascending numerical order"
instead be OK with you?
>
> Otherwise, this is fine, thanks.
>
Thanks,
Pedro Alves
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 6/6] NEWS: "info" commands now list in ascending order
2015-10-22 16:06 ` Pedro Alves
@ 2015-10-22 16:16 ` Eli Zaretskii
0 siblings, 0 replies; 16+ messages in thread
From: Eli Zaretskii @ 2015-10-22 16:16 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches
> Date: Thu, 22 Oct 2015 16:07:30 +0100
> From: Pedro Alves <palves@redhat.com>
> CC: gdb-patches@sourceware.org
>
> > I'd suggest to add "alphabetic" where indicated.
>
> That would sound very confusing to me, as we sort by e.g., thread
> ID, not thread name, and alphabetic would suggest to me that we
> now sort by "name" or whatever else looks like a name.
>
> Would "ascending ID order" or "ascending numerical order"
> instead be OK with you?
Yes, of course. The point is just "ascending" doesn't say enough, we
should say more about the order. (I mistakenly thought it was
alphabetic.)
Thanks.
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 5/6] List displays in ascending order
2015-10-22 10:56 [PATCH 0/6] PR 17539 - inferiors/threads etc. print in reverse order Pedro Alves
` (4 preceding siblings ...)
2015-10-22 11:50 ` [PATCH 6/6] NEWS: "info" commands now list in ascending order Pedro Alves
@ 2015-10-22 12:36 ` Pedro Alves
2015-11-24 18:44 ` [PATCH 0/6] PR 17539 - inferiors/threads etc. print in reverse order Pedro Alves
6 siblings, 0 replies; 16+ messages in thread
From: Pedro Alves @ 2015-10-22 12:36 UTC (permalink / raw)
To: gdb-patches
Before:
(gdb) info display
Auto-display expressions now in effect:
Num Enb Expression
3: y 1
2: y 1
1: y 1
After:
(gdb) info display
Auto-display expressions now in effect:
Num Enb Expression
1: y 1
2: y 1
3: y 1
gdb/ChangeLog:
2015-10-22 Pedro Alves <palves@redhat.com>
PR 17539
* printcmd.c (display_command): Append new display at the end of
the list.
gdb/testsuite/ChangeLog:
2015-10-22 Pedro Alves <palves@redhat.com>
PR 17539
* gdb.base/display.exp: Expect displays to be sorted in ascending
order. Use multi_line.
* gdb.base/solib-display.exp: Likewise.
---
gdb/printcmd.c | 14 +++++++++++--
gdb/testsuite/gdb.base/display.exp | 35 +++++++++++++++++++++++++++-----
gdb/testsuite/gdb.base/solib-display.exp | 19 ++++++++++++++---
3 files changed, 58 insertions(+), 10 deletions(-)
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 1744abd..c676fc7 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1543,11 +1543,21 @@ display_command (char *arg, int from_tty)
newobj->exp = expr;
newobj->block = innermost_block;
newobj->pspace = current_program_space;
- newobj->next = display_chain;
newobj->number = ++display_number;
newobj->format = fmt;
newobj->enabled_p = 1;
- display_chain = newobj;
+ newobj->next = NULL;
+
+ if (display_chain == NULL)
+ display_chain = newobj;
+ else
+ {
+ struct display *last;
+
+ for (last = display_chain; last->next != NULL; last = last->next)
+ ;
+ last->next = newobj;
+ }
if (from_tty)
do_one_display (newobj);
diff --git a/gdb/testsuite/gdb.base/display.exp b/gdb/testsuite/gdb.base/display.exp
index 6e21d9e..1d02629 100644
--- a/gdb/testsuite/gdb.base/display.exp
+++ b/gdb/testsuite/gdb.base/display.exp
@@ -83,8 +83,23 @@ gdb_test "disp/s &sum" ".*5: x/s &sum $hex.*sum.:.*" "display/s &sum"
# Hit the displays
#
-gdb_test "cont" ".*\[Ww\]atchpoint 3: sum.*\[1-9\]*: x/s &sum.*\[1-9\]*: /f f = 3.1415\r\n\[1-9\]*: x/i &k.*\r\n\[1-9\]*: /x j = 0x0\r\n\[1-9\]*: i = 0.*" "first disp"
-gdb_test "cont" ".*\[Ww\]atchpoint 3: sum.*\[1-9\]*: x/s &sum.*\[1-9\]*: /f f = 4.1415\r\n\[1-9\]*: x/i &k.*\r\n\[1-9\]*: /x j = 0x0.*\[1-9\]*: i = 0.*" "second disp"
+gdb_test "cont" [multi_line \
+ ".*\[Ww\]atchpoint 3: sum.*" \
+ "\[1-9\]*: i = 0.*" \
+ "\[1-9\]*: /x j = 0x0" \
+ "\[1-9\]*: x/i &k.*" \
+ "\[1-9\]*: /f f = 3.1415" \
+ "\[1-9\]*: x/s &sum.*" \
+ ] "first disp"
+
+gdb_test "cont" [multi_line \
+ ".*\[Ww\]atchpoint 3: sum.*" \
+ "\[1-9\]*: i = 0.*" \
+ "\[1-9\]*: /x j = 0x0.*" \
+ "\[1-9\]*: x/i &k.*" \
+ "\[1-9\]*: /f f = 4.1415" \
+ "\[1-9\]*: x/s &sum.*" \
+ ] "second disp"
gdb_test "enab disp 6" ".*No display number 6..*" "catch err"
gdb_test_no_output "disab disp 1" "disab disp 1"
@@ -92,9 +107,19 @@ gdb_test_no_output "disab disp 2" "disab disp 2"
gdb_test_no_output "enab disp 1" "re-enab"
gdb_test_no_output "enab disp 1" "re-enab of enab"
gdb_test_no_output "undisp 5" "undisp"
-gdb_test "info disp" ".*Auto-display expressions now in effect.*y /f f.*y /1bi &k.*n /x j.*y i.*" "info disp"
-
-gdb_test "cont" ".*\[Ww\]atch.*5.1415.*.*i = 0.*" "next hit"
+gdb_test "info disp" [multi_line \
+ "Auto-display expressions now in effect.*" \
+ ".*y i" \
+ ".*n /x j" \
+ ".*y /1bi &k" \
+ ".*y /f f" \
+ ] "info disp"
+
+gdb_test "cont" [multi_line \
+ ".*\[Ww\]atch.*" \
+ ".*i = 0" \
+ ".*5.1415" \
+ ] "next hit"
gdb_test "undisp" \
"" \
diff --git a/gdb/testsuite/gdb.base/solib-display.exp b/gdb/testsuite/gdb.base/solib-display.exp
index d1b2c65..b2070c9 100644
--- a/gdb/testsuite/gdb.base/solib-display.exp
+++ b/gdb/testsuite/gdb.base/solib-display.exp
@@ -86,7 +86,11 @@ foreach libsepdebug {NO IN SEP} { with_test_prefix "$libsepdebug" {
continue
}
- gdb_test "" "3: c_global = 43\\r\\n2: b_global = 42\\r\\n1: a_global = 41" "after rerun"
+ gdb_test "" [multi_line \
+ "1: a_global = 41" \
+ "2: b_global = 42" \
+ "3: c_global = 43" \
+ ] "after rerun"
# Now rebuild the library without b_global
if { [gdb_compile_shlib ${srcfile_lib} ${binfile_lib} \
@@ -109,7 +113,12 @@ foreach libsepdebug {NO IN SEP} { with_test_prefix "$libsepdebug" {
continue
}
- gdb_test "" "3: c_global = 43\\r\\nwarning: .*b_global.*\\r\\n1: a_global = 41" "after rerun (2)"
+
+ gdb_test "" [multi_line \
+ "1: a_global = 41" \
+ "warning: .*b_global.*" \
+ "3: c_global = 43" \
+ ] "after rerun (2)"
# Now verify that displays which are not in the shared library
# are not cleared permaturely.
@@ -130,5 +139,9 @@ foreach libsepdebug {NO IN SEP} { with_test_prefix "$libsepdebug" {
gdb_test "" "6: a_static = 46\\r\\n4: main_global = 44\\r\\n.*"
gdb_test "break [gdb_get_line_number "break here" ${testfile}.c]" \
".*Breakpoint.* at .*"
- gdb_test "continue" "6: a_static = 46\\r\\n5: a_local = 45\\r\\n4: main_global = 44\\r\\n.*"
+ gdb_test "continue" [multi_line \
+ "4: main_global = 44" \
+ "5: a_local = 45" \
+ "6: a_static = 46" \
+ ]
}}
--
1.9.3
^ permalink raw reply [flat|nested] 16+ messages in thread* Re: [PATCH 0/6] PR 17539 - inferiors/threads etc. print in reverse order
2015-10-22 10:56 [PATCH 0/6] PR 17539 - inferiors/threads etc. print in reverse order Pedro Alves
` (5 preceding siblings ...)
2015-10-22 12:36 ` [PATCH 5/6] List displays " Pedro Alves
@ 2015-11-24 18:44 ` Pedro Alves
6 siblings, 0 replies; 16+ messages in thread
From: Pedro Alves @ 2015-11-24 18:44 UTC (permalink / raw)
To: GDB Patches
On 10/22/2015 10:58 AM, Pedro Alves wrote:
> PR 17539 points out that "info inferiors" lists inferiors in
> decreasing order. I audited the "info" sub commands, and GDB is
> inconsistent on this issue in several places. Some commands list in
> ascending order, while others in descending order.
>
...
> This patch series switches all "descending order" commands I found to
> ascending order, and adjusts manual and testsuite accordingly.
>
> Pedro Alves (6):
> Make gdb.python/py-inferior.exp test names unique
> Linux: dump the signalled thread first
> List inferiors/threads/pspaces in ascending order
> List checkpoints in ascending order
> List displays in ascending order
> NEWS: "info" commands now list in ascending order
This is now pushed.
Thanks,
Pedro Alves
^ permalink raw reply [flat|nested] 16+ messages in thread