From: Fei Jie <feij.fnst@cn.fujitsu.com>
To: <gdb-patches@sourceware.org>
Subject: [PATCH v2 2/4] Add testcases to display.exp
Date: Mon, 09 Nov 2015 08:20:00 -0000 [thread overview]
Message-ID: <1447057215-7574-3-git-send-email-feij.fnst@cn.fujitsu.com> (raw)
In-Reply-To: <1447057215-7574-1-git-send-email-feij.fnst@cn.fujitsu.com>
add testcases to display different types of data and variables
*display/d/u/o/t/a/c
*display array and structure
gdb/testsuite/ChangeLog:
* gdb.base/display.c: Add variable types.
* gdb.base/display.exp: Add testcases to test display.
---
gdb/testsuite/gdb.base/display.c | 6 ++++++
gdb/testsuite/gdb.base/display.exp | 17 ++++++++++++++---
2 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/gdb/testsuite/gdb.base/display.c b/gdb/testsuite/gdb.base/display.c
index cd833e2..2ade4d7 100644
--- a/gdb/testsuite/gdb.base/display.c
+++ b/gdb/testsuite/gdb.base/display.c
@@ -4,6 +4,12 @@
#define LOOP 10
int sum = 0;
+int int_array[2] = {0, 1};
+struct
+ {
+ char name;
+ int age;
+ } human;
/* Call to force a variable onto the stack so we can see its address. */
void force_mem (int *arg) { }
diff --git a/gdb/testsuite/gdb.base/display.exp b/gdb/testsuite/gdb.base/display.exp
index 6e21d9e..8cbf875 100644
--- a/gdb/testsuite/gdb.base/display.exp
+++ b/gdb/testsuite/gdb.base/display.exp
@@ -80,13 +80,24 @@ gdb_test "disp/x j" ".*2: /x j = 0x0.*" "display j"
gdb_test "disp/i &k" ".*3: x/i &k(\r\n| ) $hex:.*" "display &k"
gdb_test "disp/f f" ".*4: /f f = 3.1415*" "display/f f"
gdb_test "disp/s &sum" ".*5: x/s &sum $hex.*sum.:.*" "display/s &sum"
+gdb_test "disp/d f" "6: /d f = 3" "display/d f"
+gdb_test "disp/u f" "7: /u f = 3" "display/u f"
+gdb_test "disp/o f" "8: /o f = 03" "display/o f"
+gdb_test "disp/t f" "9: /t f = 11" "display/t f"
+gdb_test "disp/a f" "10: /a f = 0x3" "display/a f"
+gdb_test "disp/c f" "11: /c f = 3\ \'\\\\003\'" "display/c f"
+
+gdb_test "disp int_array" \
+ "12: int_array = \\{0, 1\\}" "display array"
+gdb_test "disp human" \
+ "13: human = {name = 0 '\\\\000', age = 0}" "display struct"
# 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" ".*\[Ww\]atchpoint 3: sum.*\[1-9\]*: human.*\[1-9\]*: int_array.*\[1-9\]*: /c f = 3 \'\\\\003\'\r\n\[0-9\]*: /a f = 0x3\r\n\[1-9\]*: /t f = 11\r\n\[1-9\]*: /o f = 03\r\n\[1-9\]*: /u f = 3\r\n\[1-9\]*: /d f = 3\r\n\[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\]*: human.*\[1-9\]*: int_array.*\[1-9\]*: /c f = 4 \'\\\\004\'\r\n\[0-9\]*: /a f = 0x4\r\n\[1-9\]*: /t f = 100\r\n\[1-9\]*: /o f = 04\r\n\[1-9\]*: /u f = 4\r\n\[1-9\]*: /d f = 4\r\n\[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\r\n\[1-9\]*: i = 0.*" "second disp"
-gdb_test "enab disp 6" ".*No display number 6..*" "catch err"
+gdb_test "enab disp 14" ".*No display number 14..*" "catch err"
gdb_test_no_output "disab disp 1" "disab disp 1"
gdb_test_no_output "disab disp 2" "disab disp 2"
gdb_test_no_output "enab disp 1" "re-enab"
--
1.8.3.1
prev parent reply other threads:[~2015-11-09 8:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-09 8:20 [PATCH v2 0/4] Add some testcases Fei Jie
2015-11-09 8:20 ` [PATCH v2 4/4] Add testcases to break.exp Fei Jie
2015-11-09 9:36 ` Andrew Burgess
2015-11-10 1:15 ` fj
2015-11-09 8:20 ` [PATCH v2 1/4] Add testcases to default.exp Fei Jie
2015-11-09 8:20 ` [PATCH v2 3/4] Add testcases to list.exp and dfp-test.exp Fei Jie
2015-11-09 8:20 ` Fei Jie [this message]
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=1447057215-7574-3-git-send-email-feij.fnst@cn.fujitsu.com \
--to=feij.fnst@cn.fujitsu.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).