From: Fei Jie <feij.fnst@cn.fujitsu.com>
To: <gdb-patches@sourceware.org>
Subject: [PATCH 1/3] Add testcases for examine function
Date: Wed, 04 Nov 2015 07:10:00 -0000 [thread overview]
Message-ID: <1446620987-4140-2-git-send-email-feij.fnst@cn.fujitsu.com> (raw)
In-Reply-To: <1446620987-4140-1-git-send-email-feij.fnst@cn.fujitsu.com>
use examine to display the content of main function's address
in different formats and examine address that can not be accessed
---
gdb/testsuite/gdb.base/testexamine.exp | 42 ++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
create mode 100644 gdb/testsuite/gdb.base/testexamine.exp
diff --git a/gdb/testsuite/gdb.base/testexamine.exp b/gdb/testsuite/gdb.base/testexamine.exp
new file mode 100644
index 0000000..16d916d
--- /dev/null
+++ b/gdb/testsuite/gdb.base/testexamine.exp
@@ -0,0 +1,42 @@
+if {[prepare_for_testing testprint.exp testprint display.c \
+ {debug nowarnings}]} {
+ untested testprint.exp
+ return -1
+}
+
+if ![runto_main] then {
+ fail "Can not run to main."
+}
+
+#Get main address
+set main_addr ""
+gdb_test_multiple "print/x &main" "getting main's address" {
+ -re "$decimal = \($hex\)\r\n$gdb_prompt $" {
+ set main_addr $expect_out(1,string)
+ }
+}
+
+#Test x(examine)
+gdb_test "x" \
+ "Argument required.*"
+gdb_test "x/x $main_addr" \
+ ".*<main>.*0xe5894855"
+gdb_test "x/d $main_addr" \
+ ".*<main>.*-443987883"
+gdb_test "x/u $main_addr" \
+ ".*<main>.*3850979413"
+gdb_test "x/o $main_addr" \
+ ".*<main>.*034542244125"
+gdb_test "x/t $main_addr" \
+ ".*<main>.*11100101100010010100100001010101"
+gdb_test "x/a $main_addr" \
+ ".*<main>.*0xb8e5894855"
+gdb_test "x/c $main_addr" \
+ ".*<main>.*85\ \'U\'"
+gdb_test "x/f $main_addr" \
+ ".*<main>.*3.923498621684153e-312"
+gdb_test "x 0x000000000000" \
+ "Cannot access memory at address 0x0"
+
+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 ` [PATCH 2/3] Add testcases for display function Fei Jie
2015-11-04 21:39 ` Joel Brobecker
2015-11-04 7:10 ` Fei Jie [this message]
2015-11-04 21:30 ` [PATCH 1/3] Add testcases for examine function Joel Brobecker
2015-11-04 21:37 ` Andrew Burgess
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 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-2-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