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 3/3] Add testcases for list function
Date: Wed, 04 Nov 2015 07:10:00 -0000	[thread overview]
Message-ID: <1446620987-4140-4-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 list.exp, test list under more conditions
---
 gdb/testsuite/gdb.base/list.exp | 48 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/gdb/testsuite/gdb.base/list.exp b/gdb/testsuite/gdb.base/list.exp
index 2aea9a3..cf06cd5 100644
--- a/gdb/testsuite/gdb.base/list.exp
+++ b/gdb/testsuite/gdb.base/list.exp
@@ -624,4 +624,52 @@ 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)
+    }
+}
+send_gdb "set listsize 10\n"
+#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 '+' line 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.*list0\.c.*"
+
+#Test list with '-' max line number
+gdb_test "list -43" \
+    "1\\s+#include \"list0.h\".*10\\s+foo \\(x\\+\\+\\);"
+
+#Test list with starting line num and out-of-ranged ending line
+gdb_test " list 1,48" \
+    "1\\s+#include \"list0.h\".*43\\s+\\} \\/\\* last line \\*\\/"
+
+#Test list with ',' and out-of-ranged ending line
+gdb_test "list ,44" \
+    ".*43\\s+\\} \\/\\* last line \\*\\/"
+
+#Test list with ',' and out-of-ranged ending line(which is 10 more than max line number)
+gdb_test "list ,53" \
+    "Line number 44 out of range.*"
+
 remote_exec build "rm -f list0.h"
-- 
1.8.3.1


  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 ` [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  7:10 ` Fei Jie [this message]
2015-11-04 21:42   ` [PATCH 3/3] Add testcases for list function 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-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