import gdb-1999-08-02 snapshot
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / list.exp
index d77ce53962d0226807f7bc783ef6a5f5d9817555..f319ba07c94acdc76d1873df62041c88d31f0177 100644 (file)
@@ -282,6 +282,48 @@ proc test_list_forward {} {
     gdb_stop_suppressing_tests;
 }
 
+# Test that repeating the list linenum command doesn't print the same
+# lines over again.  Note that this test makes sure that the argument
+# linenum is dropped, when we repeat the previous command. 'x/5i $pc'
+# works the same way.  
+
+proc test_repeat_list_command {} {
+    global gdb_prompt
+
+    set testcnt 0
+
+    send_gdb "list list0.c:10\n"
+    gdb_expect {
+       -re "5\[ \t\]+int x;.*14\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { incr testcnt }
+       -re ".*$gdb_prompt $" { fail "list list0.c:10" ; gdb_suppress_tests }
+       timeout { fail "list list0.c:10 (timeout)" ; gdb_suppress_tests }
+    }
+
+    send_gdb "\n"
+    gdb_expect {
+       -re "15\[ \t\]+foo \[(\]+.*\[)\]+;.*24\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { incr testcnt }
+       -re ".*$gdb_prompt $" { fail "list 15-24" ; gdb_suppress_tests }
+       timeout { fail "list 15-24 (timeout)" ; gdb_suppress_tests }
+    }
+
+    send_gdb "\n"
+    gdb_expect {
+       -re "25\[ \t\]+foo \[(\]+.*\[)\]+;.*34\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { incr testcnt }
+       -re ".*$gdb_prompt $" { fail "list 25-34" ; gdb_suppress_tests }
+       timeout { fail "list 25-34 (timeout)" ; gdb_suppress_tests }
+    }
+
+    send_gdb "\n"
+    gdb_expect {
+       -re "35\[ \t\]+foo \\(.*\\);.*42\[ \t\]+.*\}\r\n$gdb_prompt $" { incr testcnt }
+       -re ".*$gdb_prompt $" { fail "list 35-42" ; gdb_suppress_tests }
+       timeout { fail "list 35-42 (timeout)" ; gdb_suppress_tests }
+    }
+
+    pass "repeat list commands to page forward using 'return' ($testcnt tests)"
+    gdb_stop_suppressing_tests;
+}
+
 proc test_list_backwards {} {
     global gdb_prompt
 
@@ -513,6 +555,7 @@ if [ set_listsize 10 ] then {
     test_list_function
     test_list_forward
     test_list_backwards
+    test_repeat_list_command
     test_list_range
     test_list_filename_and_function
     test_forward_search
This page took 0.02458 seconds and 4 git commands to generate.