public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Fei Jie <feij.fnst@cn.fujitsu.com>
To: <gdb-patches@sourceware.org>
Subject: [PATCH v3 3/4] Add testcases to list.exp and dfp-test.exp
Date: Tue, 10 Nov 2015 07:57:00 -0000	[thread overview]
Message-ID: <1447142188-20759-4-git-send-email-feij.fnst@cn.fujitsu.com> (raw)
In-Reply-To: <1447142188-20759-1-git-send-email-feij.fnst@cn.fujitsu.com>

    add testcases which test list with more paraments to list.exp, and
    backtrace with parament '-1' to dfp-test.exp

gdb/testsuite/ChangeLog:

    *gdb.base/list.exp: Add new testcases.
    *gdb.base/dfp-test.exp: Likewise.
---
 gdb/testsuite/gdb.base/dfp-test.exp |  1 +
 gdb/testsuite/gdb.base/list.exp     | 49 +++++++++++++++++++++++++++++++++++++
 2 files changed, 50 insertions(+)

diff --git a/gdb/testsuite/gdb.base/dfp-test.exp b/gdb/testsuite/gdb.base/dfp-test.exp
index e648a6b..4caa50e 100644
--- a/gdb/testsuite/gdb.base/dfp-test.exp
+++ b/gdb/testsuite/gdb.base/dfp-test.exp
@@ -220,6 +220,7 @@ gdb_test "backtrace" ".*arg0_64 \\(arg0=0.1, arg1=1.0, arg2=2.0, arg3=3.0, arg4=
 gdb_breakpoint arg0_128
 gdb_continue_to_breakpoint "entry to arg0_128"
 gdb_test "backtrace" ".*arg0_128 \\(arg0=0.1, arg1=1.0, arg2=2.0, arg3=3.0, arg4=4.0, arg5=5.0\\).*" "backtrace at arg0_128"
+gdb_test "backtrace -1" ".*0x\[0-9\]\{1,16\}.*at\ .*${srcfile}.*"
 
 # Test calling inferior function with DFP arguments or return value.
 
diff --git a/gdb/testsuite/gdb.base/list.exp b/gdb/testsuite/gdb.base/list.exp
index 2aea9a3..c79369e 100644
--- a/gdb/testsuite/gdb.base/list.exp
+++ b/gdb/testsuite/gdb.base/list.exp
@@ -624,4 +624,53 @@ test_list "list -" 10 2 "7-8" "5-6"
 # the current line.
 test_list "list -" 10 1 "7" "6"
 
+# 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 set listsize to -1.
+set_listsize -1
+
+set_listsize 10
+# Test list with line number.
+gdb_test "list 12" \
+    "7\\s+x = 0.*16\\s+foo \\(x\\+\\+\\);"
+
+# Test list with +.
+gdb_test "list +" \
+    "17\\s+foo \\(x\\+\\+\\).*26\\s+foo \\(x\\+\\+\\);"
+
+# Test list with '+' number.
+gdb_test "list +1" \
+    "23\\s+foo \\(x\\+\\+\\).*32\\s+foo \\(x\\+\\+\\);"
+
+# Test list with starting line number and ','.
+gdb_test "list 20," \
+    "20\\s+foo \\(x\\+\\+\\).*29\\s+foo \\(x\\+\\+\\);"
+
+# Test list with ',' and ending line number.
+gdb_test "list ,25" \
+    "16\\s+foo \\(x\\+\\+\\).*25\\s+foo \\(x\\+\\+\\);"
+
+# Test list with address.
+gdb_test "list *${main_addr}" \
+    "${main_addr} is in main.*${srcfile}.*"
+
+# Test list with '-' last line number.
+gdb_test "list -${last_line}" \
+    "1\\s+#include \"list0.h\".*10\\s+foo \\(x\\+\\+\\);"
+
+# Test list with ',' and a little-out-of-ranged line number.
+set little_past_end [expr ${last_line} + 5 ]
+gdb_test "list ,${little_past_end}" \
+    ".*43\\s+\\} \\/\\* last line \\*\\/"
+
+# Test list with ',' and a much-out-of-ranged line number.
+set much_past_end [expr ${last_line} + 10 ]
+gdb_test "list ,${much_past_end}" \
+    "Line number 44 out of range.*"
+
 remote_exec build "rm -f list0.h"
-- 
1.8.3.1

  parent reply	other threads:[~2015-11-10  7:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-10  7:56 [PATCH v3 0/4] Add some testcases Fei Jie
2015-11-10  7:57 ` [PATCH v3 4/4] Add testcases to break.exp Fei Jie
2015-12-06 14:10   ` Joel Brobecker
2015-11-10  7:57 ` Fei Jie [this message]
2015-12-06 14:08   ` [PATCH v3 3/4] Add testcases to list.exp and dfp-test.exp Joel Brobecker
2015-11-10  7:57 ` [PATCH v3 2/4] Add testcases to display.exp Fei Jie
2015-12-06 14:00   ` Joel Brobecker
2015-11-10  7:57 ` [PATCH v3 1/4] Add testcases to default.exp Fei Jie
2015-12-06 13:51   ` Joel Brobecker
2015-11-10  8:02 ` [PATCH v3 0/4] Add some testcases 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=1447142188-20759-4-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).