From: Pedro Alves <palves@redhat.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 5/6] List displays in ascending order
Date: Thu, 22 Oct 2015 12:36:00 -0000 [thread overview]
Message-ID: <1445507944-9197-6-git-send-email-palves@redhat.com> (raw)
In-Reply-To: <1445507944-9197-1-git-send-email-palves@redhat.com>
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
next prev parent reply other threads:[~2015-10-22 10:06 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` [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
2016-01-11 14:40 ` Pedro Alves
2016-01-12 11:22 ` Pedro Alves
2016-01-13 0:37 ` Pedro Alves
2015-10-22 11:23 ` [PATCH 1/6] Make gdb.python/py-inferior.exp test names unique Pedro Alves
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
2015-10-22 16:16 ` Eli Zaretskii
2015-10-22 12:36 ` Pedro Alves [this message]
2015-11-24 18:44 ` [PATCH 0/6] PR 17539 - inferiors/threads etc. print in reverse order Pedro Alves
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1445507944-9197-6-git-send-email-palves@redhat.com \
--to=palves@redhat.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox