From: Fei Jie <feij.fnst@cn.fujitsu.com>
To: <gdb-patches@sourceware.org>
Subject: [PATCH 2/3] Add testcases for display function
Date: Wed, 04 Nov 2015 07:10:00 -0000 [thread overview]
Message-ID: <1446620987-4140-3-git-send-email-feij.fnst@cn.fujitsu.com> (raw)
In-Reply-To: <1446620987-4140-1-git-send-email-feij.fnst@cn.fujitsu.com>
add testcases to test display under different conditions
---
gdb/testsuite/gdb.base/display.c | 5 +++++
gdb/testsuite/gdb.base/testdisplay.exp | 35 ++++++++++++++++++++++++++++++++++
2 files changed, 40 insertions(+)
create mode 100644 gdb/testsuite/gdb.base/testdisplay.exp
diff --git a/gdb/testsuite/gdb.base/display.c b/gdb/testsuite/gdb.base/display.c
index cd833e2..6db289c 100644
--- a/gdb/testsuite/gdb.base/display.c
+++ b/gdb/testsuite/gdb.base/display.c
@@ -4,6 +4,11 @@
#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/testdisplay.exp b/gdb/testsuite/gdb.base/testdisplay.exp
new file mode 100644
index 0000000..984465e2
--- /dev/null
+++ b/gdb/testsuite/gdb.base/testdisplay.exp
@@ -0,0 +1,35 @@
+set srcfile display.c
+
+if { [prepare_for_testing testdisplay.exp "testdisplay" display.c {debug nowarnings}] } {
+ untest testdisplay.exp
+ return -1
+}
+
+set bp_location [gdb_get_line_number "set breakpoint 1 here"]
+send_gdb "break $bp_location\n"
+send_gdb "run\n"
+
+#Test disp(display)
+gdb_test "display f" "1: f = 3.1415"
+gdb_test "display/x f" "2: /x f = 0x3"
+gdb_test "display/d f" "3: /d f = 3"
+gdb_test "display/u f" "4: /u f = 3"
+gdb_test "display/o f" "5: /o f = 03"
+gdb_test "display/t f" "6: /t f = 11"
+gdb_test "display/a f" "7: /a f = 0x3"
+gdb_test "display/c f" "8: /c f = 3\ \'\\\\003\'"
+gdb_test "display/f f" "9: /f f = 3.1415"
+
+gdb_test "display int_array" \
+ "10: int_array = \\{0, 1\\}"
+gdb_test "display human" \
+ "11: human = {name = 0 '\\\\000', age = 0}"
+
+#Test disable/enable display
+gdb_test "disable display 999" \
+ "No display number 999\."
+gdb_test_no_output "disable display 9"
+gdb_test_no_output "enable display 9"
+
+gdb_exit
+return 0
--
1.8.3.1
next prev parent reply other threads:[~2015-11-04 7:10 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-04 7:10 [PATCH 0/3] Add tesecases for examine/display/list Fei Jie
2015-11-04 7:10 ` Fei Jie [this message]
2015-11-04 21:39 ` [PATCH 2/3] Add testcases for display function Joel Brobecker
2015-11-04 7:10 ` [PATCH 3/3] Add testcases for list function Fei Jie
2015-11-04 21:42 ` Joel Brobecker
2015-11-04 7:10 ` [PATCH 1/3] Add testcases for examine function Fei Jie
2015-11-04 21:30 ` Joel Brobecker
2015-11-04 21:37 ` Andrew Burgess
2015-11-04 21:21 ` [PATCH 0/3] Add tesecases for examine/display/list Joel Brobecker
2015-11-05 8:02 ` fj
2015-11-16 1:30 ` fj
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=1446620987-4140-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