2004-08-15 Michael Chastain <mec.gnu@mindspring.com>
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.mi / mi-cli.exp
index 62501e03a19bb8c7e75a6e6d283c35850fca56e8..4b493ab761ad863cd2ba70fbb8298d2987f404c1 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2002, 2003 Free Software Foundation, Inc.
+# Copyright 2002, 2003, 2004 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -14,9 +14,6 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
 
-# Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@prep.ai.mit.edu
-
 # This file tests that GDB's console can be accessed via the MI.
 # Specifically, we are testing the "interpreter-exec" command and that
 # the commands that are executed via this command are properly executed.
@@ -67,6 +64,11 @@ mi_gdb_test "-interpreter-exec console \"file $binfile\"" \
 
 mi_run_to_main
 
+set line_main_head   [gdb_get_line_number "main ("]
+set line_main_body   [expr $line_main_head + 2]
+set line_main_hello  [gdb_get_line_number "Hello, World!"]
+set line_main_return [expr $line_main_hello + 2]
+
 mi_gdb_test "-interpreter-exec console \"set args foobar\"" \
   {\^done} \
   "-interpreter-exec console \"set args foobar\""
@@ -91,8 +93,9 @@ mi_gdb_test "-interpreter-exec console \"set listsize 1\"" \
   {\^done} \
   "-interpreter-exec console \"set listsize 1\""
 
+# {.*\~"32[ \t(\\t)]*callee1.*\\n".*\^done }
 mi_gdb_test "-interpreter-exec console \"list\"" \
-  {.*\~"32[ \t(\\t)]*callee1.*\\n".*\^done} \
+  ".*\~\"$line_main_body\[\\\\t \]*callee1.*;\\\\n\".*\\^done" \
   "-interpreter-exec console \"list\""
 
 # # NOTE: cagney/2003-02-03: Not yet.
@@ -150,43 +153,43 @@ mi_gdb_test "500-stack-select-frame 0" \
   "-stack-select-frame 0"
 
 # NOTE: cagney/2003-02-03: Not yet.
-# mi_gdb_test "-break-insert -t basics.c:35" \
+# mi_gdb_test "-break-insert -t basics.c:$line_main_hello" \
 #   {.*=breakpoint-create,number="3".*\^done} \
-#   "-break-insert -t basics.c:35"
-mi_gdb_test "600-break-insert -t basics.c:35" \
+#   "-break-insert -t basics.c:\$line_main_hello"
+mi_gdb_test "600-break-insert -t basics.c:$line_main_hello" \
        {600\^done,bkpt=.number="3",type="breakpoint".*\}} \
-       "-break-insert -t basics.c:35"
+       "-break-insert -t basics.c:\$line_main_hello"
 
 # mi_gdb_test "-exec-continue" \
-#   {.*\*stopped.*,file=".*basics.c",line="35"\}} \
-#   "-exec-continue to line 35"
+#   {.*\*stopped.*,file=".*basics.c",line="$line_main_hello"\}} \
+#   "-exec-continue to line \$line_main_hello"
 send_gdb "700-exec-continue\n"
 gdb_expect {
-    -re "700\\^running\[\r\n\]+$mi_gdb_prompt.*\\*stopped.*,file=.*basics.c.,line=.35.*$mi_gdb_prompt$" {
-       pass "-exec-continue to line 35"
+    -re "700\\^running\[\r\n\]+$mi_gdb_prompt.*\\*stopped.*,file=.*basics.c.,line=.$line_main_hello.*$mi_gdb_prompt$" {
+       pass "-exec-continue to line \$line_main_hello"
     }
     timeout {
-       fail "-exec-continue to line 35"
+       fail "-exec-continue to line \$line_main_hello"
     }
 }
 
 # NOTE: cagney/2003-02-03: Not yet.
 # mi_gdb_test "-exec-next" \
-#   {.*\*stopped,reason="end-stepping-range",.*,file=".*basics.c",line="37"\}} \
-#   "-exec-next to line 37"
+#   {.*\*stopped,reason="end-stepping-range",.*,file=".*basics.c",line="$line_main_return"\}} \
+#   "-exec-next to line \$line_main_return"
 send_gdb "800-exec-next\n"
 gdb_expect {
-    -re "800\\^running\[\r\n\]+$mi_gdb_prompt.*\\*stopped,reason=.end-stepping-range.*,file=.*basics.c.,line=.37.*$mi_gdb_prompt$" {
-       pass "-exec-next to line 37"
+    -re "800\\^running\[\r\n\]+$mi_gdb_prompt.*\\*stopped,reason=.end-stepping-range.*,file=.*basics.c.,line=.$line_main_return.*$mi_gdb_prompt$" {
+       pass "-exec-next to line \$line_main_return"
     }
     timeout {
-       fail "-exec-next to line 37"
+       fail "-exec-next to line \$line_main_return"
     }
 }
 
 mi_gdb_test "-interpreter-exec console \"list\"" \
-  {\~"37[ \t(\\t)]*return 0;\\n".*\^done} \
-  "-interpreter-exec console \"list\" at basics.c:37"
+  "\~\"$line_main_return\[\\\\t ]*return 0;\\\\n\".*\\^done" \
+  "-interpreter-exec console \"list\" at basics.c:\$line_main_return"
 
 mi_gdb_test "-interpreter-exec console \"help set args\"" \
   {\~"Set argument list to give program being debugged when it is started\.\\nFollow this command with any number of args, to be passed to the program\.".*\^done} \
This page took 0.089268 seconds and 4 git commands to generate.