Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Fei Jie <feij.fnst@cn.fujitsu.com>
To: <gdb-patches@sourceware.org>
Subject: [PATCH v2 3/4] Add testcases to list.exp and dfp-test.exp
Date: Mon, 09 Nov 2015 08:20:00 -0000	[thread overview]
Message-ID: <1447057215-7574-4-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 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..c61f88f 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 ',NUM' (NUM is out of range but NUM-listsize is not).
+set little_past_end [expr ${last_line} + 5 ]
+gdb_test "list ,${little_past_end}" \
+    ".*43\\s+\\} \\/\\* last line \\*\\/"
+
+# Test list with ',NUM' (both NUM and NUM-listsize are out of range).
+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


  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 ` Fei Jie [this message]
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 2/4] Add testcases to display.exp Fei Jie

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-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