2004-08-15 Michael Chastain <mec.gnu@mindspring.com>
authorMichael Chastain <mec@google.com>
Sun, 15 Aug 2004 10:15:58 +0000 (10:15 +0000)
committerMichael Chastain <mec@google.com>
Sun, 15 Aug 2004 10:15:58 +0000 (10:15 +0000)
* gdb.mi/mi-cli.exp: Use gdb_get_line_number.  Remove reference
to bug-gnu@prep.ai.mit.edu.
* gdb.mi/mi-disassemble.exp: Likewise.
* gdb.mi/mi-eval.exp: Likewise.
* gdb.mi/mi-file.exp: Likewise.  Also, add comment about the
default line number.
* gdb.mi/mi-return.exp: Likewise.
* gdb.mi/mi-simplerun.exp: Likewise.
* gdb.mi/mi-stack.exp: Likewise.
* gdb.mi/mi-stepi.exp: Likewise.  Also, replace wildcarded line
number with explicit range test.
* gdb.mi/mi-watch.exp: Likewise.
* gdb.mi/mi2-break.exp: Likewise.
* gdb.mi/mi2-cli.exp: Likewise.
* gdb.mi/mi2-disassemble.exp: Likewise.
* gdb.mi/mi2-eval.exp: Likewise.
* gdb.mi/mi2-file.exp: Likewise.  Also, add comment about the
default line number.
* gdb.mi/mi2-return.exp: Likewise.
* gdb.mi/mi2-simplerun.exp: Likewise.
* gdb.mi/mi2-stack.exp: Likewise.
* gdb.mi/mi2-stepi.exp: Likewise.  Also, replace wildcarded line
number with explicit range test.
* gdb.mi/mi2-watch.exp: Likewise.

19 files changed:
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.mi/mi-cli.exp
gdb/testsuite/gdb.mi/mi-disassemble.exp
gdb/testsuite/gdb.mi/mi-eval.exp
gdb/testsuite/gdb.mi/mi-file.exp
gdb/testsuite/gdb.mi/mi-return.exp
gdb/testsuite/gdb.mi/mi-simplerun.exp
gdb/testsuite/gdb.mi/mi-stack.exp
gdb/testsuite/gdb.mi/mi-stepi.exp
gdb/testsuite/gdb.mi/mi-watch.exp
gdb/testsuite/gdb.mi/mi2-cli.exp
gdb/testsuite/gdb.mi/mi2-disassemble.exp
gdb/testsuite/gdb.mi/mi2-eval.exp
gdb/testsuite/gdb.mi/mi2-file.exp
gdb/testsuite/gdb.mi/mi2-return.exp
gdb/testsuite/gdb.mi/mi2-simplerun.exp
gdb/testsuite/gdb.mi/mi2-stack.exp
gdb/testsuite/gdb.mi/mi2-stepi.exp
gdb/testsuite/gdb.mi/mi2-watch.exp

index a6e92d42c3d6d3b9c199ea3c9c031d84edea61fc..cbff391ec4ee1c1fb96540af32d1d02f9a502336 100644 (file)
@@ -1,3 +1,30 @@
+2004-08-15  Michael Chastain  <mec.gnu@mindspring.com>
+
+       * gdb.mi/mi-cli.exp: Use gdb_get_line_number.  Remove reference
+       to bug-gnu@prep.ai.mit.edu.
+       * gdb.mi/mi-disassemble.exp: Likewise.
+       * gdb.mi/mi-eval.exp: Likewise.
+       * gdb.mi/mi-file.exp: Likewise.  Also, add comment about the
+       default line number.
+       * gdb.mi/mi-return.exp: Likewise.
+       * gdb.mi/mi-simplerun.exp: Likewise.
+       * gdb.mi/mi-stack.exp: Likewise.
+       * gdb.mi/mi-stepi.exp: Likewise.  Also, replace wildcarded line
+       number with explicit range test.
+       * gdb.mi/mi-watch.exp: Likewise.
+       * gdb.mi/mi2-break.exp: Likewise.
+       * gdb.mi/mi2-cli.exp: Likewise.
+       * gdb.mi/mi2-disassemble.exp: Likewise.
+       * gdb.mi/mi2-eval.exp: Likewise.
+       * gdb.mi/mi2-file.exp: Likewise.  Also, add comment about the
+       default line number.
+       * gdb.mi/mi2-return.exp: Likewise.
+       * gdb.mi/mi2-simplerun.exp: Likewise.
+       * gdb.mi/mi2-stack.exp: Likewise.
+       * gdb.mi/mi2-stepi.exp: Likewise.  Also, replace wildcarded line
+       number with explicit range test.
+       * gdb.mi/mi2-watch.exp: Likewise.
+
 2004-08-15  Michael Chastain  <mec.gnu@mindspring.com>
 
        * gdb.cp/ctti.exp: Tweak srcfile and objfile to have no slashes.
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} \
index 0d27f36a4829a6a4f05e0b6f37ef6860f9d239bc..0b124976a7e7e75471fea9251117b5b0e0e1e690 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2001, 2002, 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
-
 #
 # Test Machine interface (MI) operations for disassembly.
 #
@@ -48,17 +45,20 @@ proc test_disassembly_only {} {
     global hex
     global decimal
 
+    set line_main_head [gdb_get_line_number "main ("]
+    set line_main_body [expr $line_main_head + 2]
+
     # Test disassembly more only for the current function.
     # Tests:
     # -data-disassemble -s $pc -e "$pc+8" -- 0
-    # -data-disassembly -f basics.c -l 32 -- 0
+    # -data-disassembly -f basics.c -l $line_main_body -- 0
 
     mi_gdb_test "print/x \$pc" "" ""
     mi_gdb_test "111-data-disassemble -s \$pc -e \"\$pc + 12\" -- 0" \
            "111\\^done,asm_insns=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\},\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}.*\]" \
              "data-disassemble from pc to pc+12 assembly only"
 
-    mi_gdb_test "222-data-disassemble  -f basics.c -l 32 -- 0" \
+    mi_gdb_test "222-data-disassemble  -f basics.c -l $line_main_body -- 0" \
            "222\\^done,asm_insns=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"0\",inst=\".*\"\},.*,\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}\\\]" \
               "data-disassemble file & line, assembly only"
 }
@@ -68,22 +68,25 @@ proc test_disassembly_lines_limit {} {
     global hex
     global decimal
 
+    set line_main_head [gdb_get_line_number "main ("]
+    set line_main_body [expr $line_main_head + 2]
+
     # Test disassembly more only for the current function.
     # Tests:
-    # -data-disassembly -f basics.c -l 32 -n 20 -- 0
-    # -data-disassembly -f basics.c -l 32 -n 0 -- 0
-    # -data-disassembly -f basics.c -l 32 -n 50 -- 0
+    # -data-disassembly -f basics.c -l $line_main_body -n 20 -- 0
+    # -data-disassembly -f basics.c -l $line_main_body -n 0 -- 0
+    # -data-disassembly -f basics.c -l $line_main_body -n 50 -- 0
 
     mi_gdb_test "print/x \$pc" "" ""
-    mi_gdb_test "222-data-disassemble  -f basics.c -l 32 -n 20 -- 0" \
+    mi_gdb_test "222-data-disassemble  -f basics.c -l $line_main_body -n 20 -- 0" \
            "222\\^done,asm_insns=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"0\",inst=\".*\"\},.*,\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}\\\]" \
               "data-disassemble file, line, number assembly only"
 
-    mi_gdb_test "222-data-disassemble  -f basics.c -l 32 -n 0 -- 0" \
+    mi_gdb_test "222-data-disassemble  -f basics.c -l $line_main_body -n 0 -- 0" \
            "222\\^done,asm_insns=\\\[\\\]" \
               "data-disassemble file, line, number (zero lines) assembly only"
 
-    mi_gdb_test "222-data-disassemble  -f basics.c -l 32 -n 50 -- 0" \
+    mi_gdb_test "222-data-disassemble  -f basics.c -l $line_main_body -n 50 -- 0" \
            "222\\^done,asm_insns=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"0\",inst=\".*\"\},.*,\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}\\\]" \
               "data-disassemble file, line, number (more than main lines) assembly only"
 }
@@ -94,13 +97,16 @@ proc test_disassembly_mixed {} {
     global hex
     global decimal
 
+    set line_callee2_head       [gdb_get_line_number "callee2 ("]
+    set line_callee2_open_brace [expr $line_callee2_head + 1]
+
     # Test disassembly more only for the current function.
     # Tests:
-    # -data-disassembly -f basics.c -l 21 -- 1
+    # -data-disassembly -f basics.c -l $line_callee2_open_brace -- 1
     # -data-disassembly -s $pc -e "$pc+8" -- 1
 
-    mi_gdb_test "002-data-disassemble -f basics.c -l 21 -- 1" \
-           "002\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"21\",file=\".*basics.c\",line_asm_insn=\\\[\{address=\"$hex\",func-name=\"callee2\",offset=\"0\",inst=\".*\"\}.*\\\]\}.*,src_and_asm_line=\{line=\"$decimal\",file=\".*basics.c\",line_asm_insn=\\\[.*\{address=\"$hex\",func-name=\"callee2\",offset=\"$decimal\",inst=\".*\"\}\\\]\}\\\]" \
+    mi_gdb_test "002-data-disassemble -f basics.c -l $line_callee2_open_brace -- 1" \
+           "002\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"$line_callee2_open_brace\",file=\".*basics.c\",line_asm_insn=\\\[\{address=\"$hex\",func-name=\"callee2\",offset=\"0\",inst=\".*\"\}.*\\\]\}.*,src_and_asm_line=\{line=\"$decimal\",file=\".*basics.c\",line_asm_insn=\\\[.*\{address=\"$hex\",func-name=\"callee2\",offset=\"$decimal\",inst=\".*\"\}\\\]\}\\\]" \
              "data-disassemble file, line assembly mixed"
 
     #
@@ -118,22 +124,26 @@ proc test_disassembly_mixed_lines_limit {} {
     global hex
     global decimal
 
+    set line_main_head       [gdb_get_line_number "main ("]
+    set line_main_open_brace [expr $line_main_head + 1]
+    set line_main_body       [expr $line_main_head + 2]
+
     # Test disassembly more only for the current function.
     # Tests:
-    # -data-disassembly -f basics.c -l 32 -n 20 -- 1
-    # -data-disassembly -f basics.c -l 32 -n 0 -- 1
-    # -data-disassembly -f basics.c -l 32 -n 50 -- 1
+    # -data-disassembly -f basics.c -l $line_main_body -n 20 -- 1
+    # -data-disassembly -f basics.c -l $line_main_body -n 0 -- 1
+    # -data-disassembly -f basics.c -l $line_main_body -n 50 -- 1
 
     mi_gdb_test "print/x \$pc" "" ""
-    mi_gdb_test "222-data-disassemble  -f basics.c -l 32 -n 20 -- 1" \
+    mi_gdb_test "222-data-disassemble  -f basics.c -l $line_main_body -n 20 -- 1" \
            "222\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"$decimal\",file=\".*basics.c\",line_asm_insn=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"0\",inst=\".*\"\},.*,\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}\\\]\}\]" \
               "data-disassemble file, line, number assembly mixed"
 
-    mi_gdb_test "222-data-disassemble  -f basics.c -l 32 -n 0 -- 1" \
-           "222\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"31\",file=\".*basics.c\",line_asm_insn=\\\[\\\]\}\\\]" \
+    mi_gdb_test "222-data-disassemble  -f basics.c -l $line_main_body -n 0 -- 1" \
+           "222\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"$line_main_open_brace\",file=\".*basics.c\",line_asm_insn=\\\[\\\]\}\\\]" \
               "data-disassemble file, line, number (zero lines) assembly mixed"
 
-    mi_gdb_test "222-data-disassemble  -f basics.c -l 32 -n 50 -- 1" \
+    mi_gdb_test "222-data-disassemble  -f basics.c -l $line_main_body -n 50 -- 1" \
            "222\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"$decimal\",file=\".*basics.c\",line_asm_insn=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"0\",inst=\".*\"\}.*,\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}\\\]\}\]" \
               "data-disassemble file, line, number (more than main lines) assembly mixed"
 }
@@ -142,6 +152,9 @@ proc test_disassembly_bogus_args {} {
     global mi_gdb_prompt
     global hex
 
+    set line_main_head [gdb_get_line_number "main ("]
+    set line_main_body [expr $line_main_head + 2]
+
     # Test that bogus input to disassembly command is rejected.
     # Tests:
     # -data-disassembly -f foo -l abc -n 0 -- 0
@@ -161,7 +174,7 @@ proc test_disassembly_bogus_args {} {
              "456\\^error,msg=\"mi_cmd_disassemble: Usage: \\( .-f filename -l linenum .-n howmany.. | .-s startaddr -e endaddr.\\) .--. mixed_mode.\"" \
              "data-disassemble mix different args"
 
-    mi_gdb_test "789-data-disassemble -f basics.c -l 32 -- 9" \
+    mi_gdb_test "789-data-disassemble -f basics.c -l $line_main_body -- 9" \
              "789\\^error,msg=\"mi_cmd_disassemble: Mixed_mode argument must be 0 or 1.\"" \
              "data-disassemble wrong mode arg"
 
index 3d76cc6c47f164b924628b8644e63cc84e8249c9..a07f607e52cb32106c9a971d885e482514a808cc 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2001, 2002, 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
-
 #
 # Test essential Machine interface (MI) operations
 #
@@ -46,8 +43,11 @@ mi_gdb_reinitialize_dir $srcdir/$subdir
 mi_gdb_reinitialize_dir $srcdir/$subdir
 mi_gdb_load ${binfile}
 
+set line_callee4_head [gdb_get_line_number "callee4 ("]
+set line_callee4_body [expr $line_callee4_head + 2]
+
 mi_runto callee4
-mi_next_to "callee4" "" "basics.c" "9" "next at callee4"
+mi_next_to "callee4" "" "basics.c" [expr $line_callee4_body + 1] "next at callee4"
 
 mi_gdb_test "211-data-evaluate-expression A" "211\\^done,value=\"1\"" "eval A"
 
index 610749622bb66f45469f0edd8a713992731599ad..0ce4fd64948ea0bafaae7e5a8de02438244f8a23 100644 (file)
@@ -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
-
 #
 # Test essential Machine interface (MI) operations
 #
@@ -54,8 +51,19 @@ proc test_file_list_exec_source_file {} {
     set srcfilepath [string_to_regexp ${srcdir}/${subdir}/${srcfile}]
 
     # get the path and absolute path to the current executable
+    #
+    # In gdb 6.2 (at least), the default line number is set by
+    # select_source_symtab to the first line of "main" minus
+    # the value of "lines_to_list" (which defaults to 10) plus one.
+    # --chastain 2004-08-13
+
+    set line_main_head [gdb_get_line_number "main ("]
+    set line_main_body [expr $line_main_head + 2]
+    set gdb_lines_to_list 10
+    set line_default [expr $line_main_body - $gdb_lines_to_list + 1]
+
     mi_gdb_test "111-file-list-exec-source-file" \
-           "111\\\^done,line=\"23\",file=\"${srcfilepath}\",fullname=\"/.*/${srcfile}\"" \
+           "111\\\^done,line=\"$line_default\",file=\"${srcfilepath}\",fullname=\"/.*/${srcfile}\"" \
                "request path info of current source file (${srcfile})"
 }
 
index 41b48654213d2a3a307bf1ae57b9d6e3a91fe11c..d599940599bf271229e2be628f8022000ccd2adb 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2001, 2002, 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
-
 # Test Machine interface (MI) operations 
 # Verify that, using the MI, we can run a simple program and perform
 # exec-return.  
@@ -51,9 +48,12 @@ proc test_return_simple {} {
     global mi_gdb_prompt
     global hex
 
+    set line_callee3_head         [gdb_get_line_number "callee3 ("]
+    set line_callee3_close_brace  [expr $line_callee3_head + 3]
+
     send_gdb "111-exec-return\n"
     gdb_expect {
-       -re "111\\^done,frame=\{level=\"0\",addr=\"$hex\",func=\"callee3\",args=\\\[.*\\\],file=\".*basics.c\",line=\"18\"\}\r\n$mi_gdb_prompt$" {pass "return from callee4 now"}
+       -re "111\\^done,frame=\{level=\"0\",addr=\"$hex\",func=\"callee3\",args=\\\[.*\\\],file=\".*basics.c\",line=\"$line_callee3_close_brace\"\}\r\n$mi_gdb_prompt$" {pass "return from callee4 now"}
        -re ".*\r\n$mi_gdb_prompt$" { fail "return from callee4 now" }
        timeout { fail "return from callee4 now (timeout)"
        }
index 15a1fca2d45b0f251a0fe9c604bb3805801c15df..9e9385e95717382e64324e94bdb56f0eacdecd66 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2001, 2002, 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
-
 #
 # Test essential Machine interface (MI) operations
 #
@@ -53,6 +50,13 @@ proc test_breakpoints_creation_and_listing {} {
     global srcfile
     global hex
 
+    set line_callee4_head  [gdb_get_line_number "callee4 ("]
+    set line_callee3_head  [gdb_get_line_number "callee3 ("]
+    set line_callee2_head  [gdb_get_line_number "callee2 ("]
+    set line_callee2_body  [expr $line_callee2_head + 2]
+    set line_main_head     [gdb_get_line_number "main ("]
+    set line_main_body     [expr $line_main_head + 2]
+
     # Insert some breakpoints and list them
     # Also, disable some so they do not interfere with other tests
     # Tests:
@@ -62,23 +66,23 @@ proc test_breakpoints_creation_and_listing {} {
     # -break-info
 
     mi_gdb_test "200-break-insert main" \
-             "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\}" \
+             "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\"\}" \
              "break-insert operation"
 
     mi_gdb_test "201-break-insert basics.c:callee2" \
-             "201\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee2\",file=\".*basics.c\",line=\"22\",times=\"0\"\}" \
+             "201\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee2\",file=\".*basics.c\",line=\"$line_callee2_body\",times=\"0\"\}" \
              "insert breakpoint at basics.c:callee2"
 
-    mi_gdb_test "202-break-insert basics.c:15" \
-             "202\\^done,bkpt=\{number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee3\",file=\".*basics.c\",line=\"15\",times=\"0\"\}" \
-             "insert breakpoint at basics.c:15 (callee3)"
+    mi_gdb_test "202-break-insert basics.c:$line_callee3_head" \
+             "202\\^done,bkpt=\{number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee3\",file=\".*basics.c\",line=\"$line_callee3_head\",times=\"0\"\}" \
+             "insert breakpoint at basics.c:\$line_callee3_head"
 
-    mi_gdb_test "203-break-insert \"\\\"${srcfile}\\\":6\"" \
-             "203\\^done,bkpt=\{number=\"4\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"6\",times=\"0\"\}" \
-             "insert breakpoint at \"<fullfilename>\":6 (callee4)"
+    mi_gdb_test "203-break-insert \"\\\"${srcfile}\\\":$line_callee4_head\"" \
+             "203\\^done,bkpt=\{number=\"4\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"$line_callee4_head\",times=\"0\"\}" \
+             "insert breakpoint at \"<fullfilename>\":\$line_callee4_head"
 
     mi_gdb_test "204-break-list" \
-           "204\\^done,BreakpointTable=\{.*,hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\},.*\}\\\]\}" \
+           "204\\^done,BreakpointTable=\{.*,hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\"\},.*\}\\\]\}" \
                 "list of breakpoints"
 
     mi_gdb_test "205-break-disable 2 3 4" \
@@ -94,6 +98,9 @@ proc test_running_the_program {} {
     global mi_gdb_prompt
     global hex
 
+    set line_main_head     [gdb_get_line_number "main ("]
+    set line_main_body     [expr $line_main_head + 2]
+
     # Run the program without args, then specify srgs and rerun the program
     # Tests:
     # -exec-run
@@ -104,7 +111,7 @@ proc test_running_the_program {} {
     # The following is equivalent to a send_gdb "000-exec-run\n"
     mi_run_cmd
     gdb_expect {
-       -re "000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"32\"\}\r\n$mi_gdb_prompt$" {
+       -re "000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"$line_main_body\"\}\r\n$mi_gdb_prompt$" {
            pass "run to main"
        }
        -re ".*$mi_gdb_prompt$" {
@@ -120,6 +127,15 @@ proc test_controlled_execution {} {
     global mi_gdb_prompt
     global hex
 
+    set line_callee4_head         [gdb_get_line_number "callee4 ("]
+    set line_callee4_body         [expr $line_callee4_head + 2]
+    set line_callee3_head         [gdb_get_line_number "callee3 ("]
+    set line_callee3_close_brace  [expr $line_callee3_head + 3]
+    set line_callee1_head         [gdb_get_line_number "callee1 ("]
+    set line_callee1_body         [expr $line_callee1_head + 2]
+    set line_main_head            [gdb_get_line_number "main ("]
+    set line_main_body            [expr $line_main_head + 2]
+
     # Continue execution until a breakpoint is reached, step into calls, verifying
     # if the arguments are correctly shown, continue to the end of a called
     # function, step over a call (next).
@@ -129,24 +145,24 @@ proc test_controlled_execution {} {
     # -exec-step
     # -exec-finish
 
-    mi_next_to "main" "" "basics.c" "33" "next at main"
+    mi_next_to "main" "" "basics.c" [expr $line_main_body + 1] "next at main"
 
     # FIXME: A string argument is not printed right; should be fixed and
     #        we should look for the right thing here.
     # NOTE: The ``\\\\\"'' is for \".
     mi_step_to "callee1" \
        "\{name=\"intarg\",value=\"2\"\},\{name=\"strarg\",value=\"$hex \\\\\"A string argument\.\\\\\"\"\},\{name=\"fltarg\",value=\"3.5\"\}" \
-       "basics.c" "27" "step at main"
+       "basics.c" "$line_callee1_body" "step at main"
 
     # FIXME: A string argument is not printed right; should be fixed and
     #        we should look for the right thing here.
     mi_execute_to "exec-step 3" "end-stepping-range" "callee4" "" \
-       "basics.c" "8" "" "step to callee4"
+       "basics.c" $line_callee4_body "" "step to callee4"
 
     # FIXME: A string argument is not printed right; should be fixed and
     #        we should look for the right thing here.
     # NOTE: The ``.'' is part of ``gdb-result-var="$1"''
-    mi_finish_to "callee3" ".*" "basics.c" "18" ".1" "0" "exec-finish"
+    mi_finish_to "callee3" ".*" "basics.c" $line_callee3_close_brace ".1" "0" "exec-finish"
 }
 
 proc test_controlling_breakpoints {} {
index 335ff03ebfb9432672d46fcdf93d392756ea7018..2bd12fabe38b77ea94faedc3aa5e818edebb059d 100644 (file)
@@ -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
-
 #
 # Test essential Machine interface (MI) operations
 #
@@ -50,6 +47,9 @@ proc test_stack_frame_listing {} {
     global mi_gdb_prompt
     global hex
 
+    set line_callee4_head [gdb_get_line_number "callee4 ("]
+    set line_callee4_body [expr $line_callee4_head + 2]
+
     # Obtain a stack trace
     # Tests:
     # -stack-list-frames
@@ -57,7 +57,7 @@ proc test_stack_frame_listing {} {
     # -stack-list-frames 1 3
 
     mi_gdb_test "231-stack-list-frames" \
-           "231\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"8\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\},frame=\{level=\"2\",addr=\"$hex\",func=\"callee2\",.*\},frame=\{level=\"3\",addr=\"$hex\",func=\"callee1\",.*\},frame=\{level=\"4\",addr=\"$hex\",func=\"main\",.*\}\\\]" \
+           "231\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"$line_callee4_body\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\},frame=\{level=\"2\",addr=\"$hex\",func=\"callee2\",.*\},frame=\{level=\"3\",addr=\"$hex\",func=\"callee1\",.*\},frame=\{level=\"4\",addr=\"$hex\",func=\"main\",.*\}\\\]" \
                 "stack frame listing"
     mi_gdb_test "232-stack-list-frames 1 1" \
            "232\\^done,stack=\\\[frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\}\\\]" \
@@ -156,10 +156,12 @@ proc test_stack_locals_listing {} {
            "232\\^done,locals=\\\[name=\"A\",name=\"B\",name=\"C\"\\\]" \
                 "stack locals listing 0"
 
+set line_callee4_return_0 [gdb_get_line_number "return 0;"]
+
 # step until A, B, C, have some reasonable values.
 send_gdb "-exec-next 3\n"
 gdb_expect {
-    -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\\\[\\\],file=\".*basics.c\",line=\"13\"\}\r\n$mi_gdb_prompt$" {
+    -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\\\[\\\],file=\".*basics.c\",line=\"$line_callee4_return_0\"\}\r\n$mi_gdb_prompt$" {
        pass "next's in callee4"
     }
     timeout { fail "next in callee4 (timeout)" }
index 720006d727870b8ff24d95dc5ce5ff26d7c19842..867fc39481dd7a33dd0a0eeaff4a42a1b9a330d9 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2001, 2002, 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
-
 # Test Machine interface (MI) operations 
 # Verify that, using the MI, we can run a simple program and perform
 # exec-step-instruction and exec-next-instruction.  
@@ -50,10 +47,19 @@ proc test_stepi_nexti {} {
     global mi_gdb_prompt
     global hex
 
+    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!"]
+
     send_gdb "111-exec-step-instruction\n"
     gdb_expect {
-       -re "111\\^running\r\n${mi_gdb_prompt}111\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"3.\"\}\r\n$mi_gdb_prompt$" {
-           pass "step-instruction at main"
+       -re "111\\^running\r\n${mi_gdb_prompt}111\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"(\[0-9\]+)\"\}\r\n$mi_gdb_prompt$" {
+           set line $expect_out(1,string)
+           if { $line >= $line_main_body && $line <= $line_main_hello } {
+               pass "step-instruction at main"
+           } else {
+               fail "step-instruction at main"
+           }
        }
        timeout {
            fail "step-instruction at main (timeout)"
@@ -61,8 +67,13 @@ proc test_stepi_nexti {} {
     }
     send_gdb "222-exec-next-instruction\n"
     gdb_expect {
-       -re "222\\^running\r\n${mi_gdb_prompt}222\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"3.\"\}\r\n$mi_gdb_prompt$" {
-           pass "next-instruction at main"
+       -re "222\\^running\r\n${mi_gdb_prompt}222\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"(\[0-9\]+)\"\}\r\n$mi_gdb_prompt$" {
+           set line $expect_out(1,string)
+           if { $line >= $line_main_body && $line <= $line_main_hello } {
+               pass "next-instruction at main"
+           } else {
+               fail "next-instruction at main"
+           }
        }
        timeout {
            fail "next-instruction at main (timeout)"
@@ -70,8 +81,13 @@ proc test_stepi_nexti {} {
     }
     send_gdb "333-exec-next-instruction\n"
     gdb_expect {
-       -re "333\\^running\r\n${mi_gdb_prompt}333\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"3.\"\}\r\n$mi_gdb_prompt$" {
-           pass "next-instruction at main"
+       -re "333\\^running\r\n${mi_gdb_prompt}333\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"(\[0-9\]+)\"\}\r\n$mi_gdb_prompt$" {
+           set line $expect_out(1,string)
+           if { $line >= $line_main_body && $line <= $line_main_hello } {
+               pass "next-instruction at main"
+           } else {
+               fail "next-instruction at main"
+           }
        }
        timeout {
            fail "next-instruction at main (timeout)"
index 81098847c2695d617f2730c8bcdc2257f1dabb33..8fe9173f1bc582a4c9471ec28aae76ec87e6b64d 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2001, 2002, 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
-
 #
 # Test essential Machine interface (MI) operations
 #
@@ -52,6 +49,9 @@ proc test_watchpoint_creation_and_listing {} {
     global srcfile
     global hex
 
+    set line_callee4_head [gdb_get_line_number "callee4 ("]
+    set line_callee4_body [expr $line_callee4_head + 2]
+
     # Insert a watchpoint and list
     # Tests:
     # -break-watch C
@@ -62,7 +62,7 @@ proc test_watchpoint_creation_and_listing {} {
              "break-watch operation"
 
     mi_gdb_test "222-break-list" \
-           "222\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"8\",times=\"1\"\},bkpt=\{number=\"2\",type=\".*watchpoint\",disp=\"keep\",enabled=\"y\",addr=\"\",what=\"C\",times=\"0\"\}\\\]\}" \
+           "222\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"$line_callee4_body\",times=\"1\"\},bkpt=\{number=\"2\",type=\".*watchpoint\",disp=\"keep\",enabled=\"y\",addr=\"\",what=\"C\",times=\"0\"\}\\\]\}" \
                 "list of watchpoints"
 
 }
@@ -73,17 +73,20 @@ proc test_awatch_creation_and_listing {} {
     global srcfile
     global hex
 
+    set line_main_head [gdb_get_line_number "main ("]
+    set line_main_body [expr $line_main_head + 2]
+
     # Insert an access watchpoint and list it
     # Tests:
     # -break-watch -a A
     # -break-list
 
     mi_gdb_test "333-break-watch -a A" \
-             "333\\^done,bkpt=\{number=\"1\",addr=\"$hex\",file=\".*basics.c\",line=\"32\"\}" \
+             "333\\^done,bkpt=\{number=\"1\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_main_body\"\}" \
              "break-watch -a operation"
 
     mi_gdb_test "444-break-list" \
-           "444\\^done,BreakpointTable=\{.*,hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"3\",type=\"watchpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\},.*\}\\\]\}" \
+           "444\\^done,BreakpointTable=\{.*,hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"3\",type=\"watchpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\"\},.*\}\\\]\}" \
                 "list of watchpoints awatch"
 
     mi_gdb_test "777-break-delete 3" \
@@ -97,17 +100,20 @@ proc test_rwatch_creation_and_listing {} {
     global srcfile
     global hex
 
+    set line_main_head [gdb_get_line_number "main ("]
+    set line_main_body [expr $line_main_head + 2]
+
     # Insert a read watchpoint and list it.
     # Tests:
     # -break-insert -r B
     # -break-list
 
     mi_gdb_test "200-break-watch -r C" \
-             "200\\^done,bkpt=\{number=\"5\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"32\",times=\"0\"\}" \
+             "200\\^done,bkpt=\{number=\"5\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\"\}" \
              "break-insert -r operation"
 
     mi_gdb_test "300-break-list" \
-           "300\\^done,BreakpointTable=\{.*,hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"5\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\},.*\}\\\}\}" \
+           "300\\^done,BreakpointTable=\{.*,hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"5\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\"\},.*\}\\\}\}" \
                 "list of breakpoints"
 
     mi_gdb_test "177-break-delete 4" \
@@ -119,6 +125,10 @@ proc test_watchpoint_triggering {} {
     global mi_gdb_prompt
     global hex
 
+    set line_callee4_return_0     [gdb_get_line_number "return 0;"]
+    set line_callee3_head         [gdb_get_line_number "callee3 ("]
+    set line_callee3_close_brace  [expr $line_callee3_head + 3]
+
     # Continue execution until the watchpoint is reached,  continue again, 
     # to see the watchpoint go out of scope.
     # Does:
@@ -129,7 +139,7 @@ proc test_watchpoint_triggering {} {
     gdb_expect {
       -re "222\\^running\r\n$mi_gdb_prompt" {
         gdb_expect {
-           -re "222\\*stopped,reason=\"watchpoint-trigger\",wpt=\{number=\"2\",exp=\"C\"\},value=\{old=\".*\",new=\"3\"\},thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\\\[\\\],file=\".*basics.c\",line=\"13\"\}\r\n$mi_gdb_prompt$" {
+           -re "222\\*stopped,reason=\"watchpoint-trigger\",wpt=\{number=\"2\",exp=\"C\"\},value=\{old=\".*\",new=\"3\"\},thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\\\[\\\],file=\".*basics.c\",line=\"$line_callee4_return_0\"\}\r\n$mi_gdb_prompt$" {
             pass "watchpoint trigger"
           }
           -re ".*$mi_gdb_prompt$" {fail "watchpoint trigger (2)"}
@@ -144,7 +154,7 @@ proc test_watchpoint_triggering {} {
     gdb_expect {
       -re "223\\^running\r\n$mi_gdb_prompt" {
         gdb_expect {
-           -re "\[\r\n\]*223\\*stopped,reason=\"watchpoint-scope\",wpnum=\"2\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee3\",args=\\\[.*\\\],file=\".*basics.c\",line=\"18\"\}\r\n$mi_gdb_prompt$" {
+           -re "\[\r\n\]*223\\*stopped,reason=\"watchpoint-scope\",wpnum=\"2\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee3\",args=\\\[.*\\\],file=\".*basics.c\",line=\"$line_callee3_close_brace\"\}\r\n$mi_gdb_prompt$" {
             pass "wp out of scope"
           }
           -re ".*$mi_gdb_prompt$" {fail "wp out of scope (2)"}
index 10295a90ce24e4f7af22bc819f0718d06e7f9efb..3a0793d420bb0faaca0ec54af182d47484cf23e8 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} \
index 9cbda17afbbefdf35dfe768e82bbb07681743697..a56b027ee215acdd18357be7133e93081635c4de 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2001, 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
-
 #
 # Test Machine interface (MI) operations for disassembly.
 #
@@ -48,17 +45,20 @@ proc test_disassembly_only {} {
     global hex
     global decimal
 
+    set line_main_head [gdb_get_line_number "main ("]
+    set line_main_body [expr $line_main_head + 2]
+
     # Test disassembly more only for the current function.
     # Tests:
     # -data-disassemble -s $pc -e "$pc+8" -- 0
-    # -data-disassembly -f basics.c -l 32 -- 0
+    # -data-disassembly -f basics.c -l $line_main_body -- 0
 
     mi_gdb_test "print/x \$pc" "" ""
     mi_gdb_test "111-data-disassemble -s \$pc -e \"\$pc + 12\" -- 0" \
            "111\\^done,asm_insns=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\},\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}.*\]" \
              "data-disassemble from pc to pc+12 assembly only"
 
-    mi_gdb_test "222-data-disassemble  -f basics.c -l 32 -- 0" \
+    mi_gdb_test "222-data-disassemble  -f basics.c -l $line_main_body -- 0" \
            "222\\^done,asm_insns=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"0\",inst=\".*\"\},.*,\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}\\\]" \
               "data-disassemble file & line, assembly only"
 }
@@ -68,22 +68,25 @@ proc test_disassembly_lines_limit {} {
     global hex
     global decimal
 
+    set line_main_head [gdb_get_line_number "main ("]
+    set line_main_body [expr $line_main_head + 2]
+
     # Test disassembly more only for the current function.
     # Tests:
-    # -data-disassembly -f basics.c -l 32 -n 20 -- 0
-    # -data-disassembly -f basics.c -l 32 -n 0 -- 0
-    # -data-disassembly -f basics.c -l 32 -n 50 -- 0
+    # -data-disassembly -f basics.c -l $line_main_body -n 20 -- 0
+    # -data-disassembly -f basics.c -l $line_main_body -n 0 -- 0
+    # -data-disassembly -f basics.c -l $line_main_body -n 50 -- 0
 
     mi_gdb_test "print/x \$pc" "" ""
-    mi_gdb_test "222-data-disassemble  -f basics.c -l 32 -n 20 -- 0" \
+    mi_gdb_test "222-data-disassemble  -f basics.c -l $line_main_body -n 20 -- 0" \
            "222\\^done,asm_insns=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"0\",inst=\".*\"\},.*,\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}\\\]" \
               "data-disassemble file, line, number assembly only"
 
-    mi_gdb_test "222-data-disassemble  -f basics.c -l 32 -n 0 -- 0" \
+    mi_gdb_test "222-data-disassemble  -f basics.c -l $line_main_body -n 0 -- 0" \
            "222\\^done,asm_insns=\\\[\\\]" \
               "data-disassemble file, line, number (zero lines) assembly only"
 
-    mi_gdb_test "222-data-disassemble  -f basics.c -l 32 -n 50 -- 0" \
+    mi_gdb_test "222-data-disassemble  -f basics.c -l $line_main_body -n 50 -- 0" \
            "222\\^done,asm_insns=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"0\",inst=\".*\"\},.*,\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}\\\]" \
               "data-disassemble file, line, number (more than main lines) assembly only"
 }
@@ -94,13 +97,16 @@ proc test_disassembly_mixed {} {
     global hex
     global decimal
 
+    set line_callee2_head       [gdb_get_line_number "callee2 ("]
+    set line_callee2_open_brace [expr $line_callee2_head + 1]
+
     # Test disassembly more only for the current function.
     # Tests:
-    # -data-disassembly -f basics.c -l 21 -- 1
+    # -data-disassembly -f basics.c -l $line_callee2_open_brace -- 1
     # -data-disassembly -s $pc -e "$pc+8" -- 1
 
-    mi_gdb_test "002-data-disassemble -f basics.c -l 21 -- 1" \
-           "002\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"21\",file=\".*basics.c\",line_asm_insn=\\\[\{address=\"$hex\",func-name=\"callee2\",offset=\"0\",inst=\".*\"\}.*\\\]\}.*,src_and_asm_line=\{line=\"$decimal\",file=\".*basics.c\",line_asm_insn=\\\[.*\{address=\"$hex\",func-name=\"callee2\",offset=\"$decimal\",inst=\".*\"\}\\\]\}\\\]" \
+    mi_gdb_test "002-data-disassemble -f basics.c -l $line_callee2_open_brace -- 1" \
+           "002\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"$line_callee2_open_brace\",file=\".*basics.c\",line_asm_insn=\\\[\{address=\"$hex\",func-name=\"callee2\",offset=\"0\",inst=\".*\"\}.*\\\]\}.*,src_and_asm_line=\{line=\"$decimal\",file=\".*basics.c\",line_asm_insn=\\\[.*\{address=\"$hex\",func-name=\"callee2\",offset=\"$decimal\",inst=\".*\"\}\\\]\}\\\]" \
              "data-disassemble file, line assembly mixed"
 
     #
@@ -118,22 +124,26 @@ proc test_disassembly_mixed_lines_limit {} {
     global hex
     global decimal
 
+    set line_main_head       [gdb_get_line_number "main ("]
+    set line_main_open_brace [expr $line_main_head + 1]
+    set line_main_body       [expr $line_main_head + 2]
+
     # Test disassembly more only for the current function.
     # Tests:
-    # -data-disassembly -f basics.c -l 32 -n 20 -- 1
-    # -data-disassembly -f basics.c -l 32 -n 0 -- 1
-    # -data-disassembly -f basics.c -l 32 -n 50 -- 1
+    # -data-disassembly -f basics.c -l $line_main_body -n 20 -- 1
+    # -data-disassembly -f basics.c -l $line_main_body -n 0 -- 1
+    # -data-disassembly -f basics.c -l $line_main_body -n 50 -- 1
 
     mi_gdb_test "print/x \$pc" "" ""
-    mi_gdb_test "222-data-disassemble  -f basics.c -l 32 -n 20 -- 1" \
+    mi_gdb_test "222-data-disassemble  -f basics.c -l $line_main_body -n 20 -- 1" \
            "222\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"$decimal\",file=\".*basics.c\",line_asm_insn=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"0\",inst=\".*\"\},.*,\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}\\\]\}\]" \
               "data-disassemble file, line, number assembly mixed"
 
-    mi_gdb_test "222-data-disassemble  -f basics.c -l 32 -n 0 -- 1" \
-           "222\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"31\",file=\".*basics.c\",line_asm_insn=\\\[\\\]\}\\\]" \
+    mi_gdb_test "222-data-disassemble  -f basics.c -l $line_main_body -n 0 -- 1" \
+           "222\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"$line_main_open_brace\",file=\".*basics.c\",line_asm_insn=\\\[\\\]\}\\\]" \
               "data-disassemble file, line, number (zero lines) assembly mixed"
 
-    mi_gdb_test "222-data-disassemble  -f basics.c -l 32 -n 50 -- 1" \
+    mi_gdb_test "222-data-disassemble  -f basics.c -l $line_main_body -n 50 -- 1" \
            "222\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"$decimal\",file=\".*basics.c\",line_asm_insn=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"0\",inst=\".*\"\}.*,\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}\\\]\}\]" \
               "data-disassemble file, line, number (more than main lines) assembly mixed"
 }
@@ -142,6 +152,9 @@ proc test_disassembly_bogus_args {} {
     global mi_gdb_prompt
     global hex
 
+    set line_main_head [gdb_get_line_number "main ("]
+    set line_main_body [expr $line_main_head + 2]
+
     # Test that bogus input to disassembly command is rejected.
     # Tests:
     # -data-disassembly -f foo -l abc -n 0 -- 0
@@ -161,7 +174,7 @@ proc test_disassembly_bogus_args {} {
              "456\\^error,msg=\"mi_cmd_disassemble: Usage: \\( .-f filename -l linenum .-n howmany.. | .-s startaddr -e endaddr.\\) .--. mixed_mode.\"" \
              "data-disassemble mix different args"
 
-    mi_gdb_test "789-data-disassemble -f basics.c -l 32 -- 9" \
+    mi_gdb_test "789-data-disassemble -f basics.c -l $line_main_body -- 9" \
              "789\\^error,msg=\"mi_cmd_disassemble: Mixed_mode argument must be 0 or 1.\"" \
              "data-disassemble wrong mode arg"
 
index de3043dbc33f45b4a98860e269cc62e3cd662267..1d181913aaabf25e085c211a8e61f053bc970fc7 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2001, 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
-
 #
 # Test essential Machine interface (MI) operations
 #
@@ -46,8 +43,11 @@ mi_gdb_reinitialize_dir $srcdir/$subdir
 mi_gdb_reinitialize_dir $srcdir/$subdir
 mi_gdb_load ${binfile}
 
+set line_callee4_head [gdb_get_line_number "callee4 ("]
+set line_callee4_body [expr $line_callee4_head + 2]
+
 mi_runto callee4
-mi_next_to "callee4" "" "basics.c" "9" "next at callee4"
+mi_next_to "callee4" "" "basics.c" [expr $line_callee4_body + 1] "next at callee4"
 
 mi_gdb_test "211-data-evaluate-expression A" "211\\^done,value=\"1\"" "eval A"
 
index 1f46bad1d25724ee94661458edca864bc61dce2a..1e81df6d6a427cbcdc0127a9f2104556190347ce 100644 (file)
@@ -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
-
 #
 # Test essential Machine interface (MI) operations
 #
@@ -54,8 +51,19 @@ proc test_file_list_exec_source_file {} {
     set srcfilepath [string_to_regexp ${srcdir}/${subdir}/${srcfile}]
 
     # get the path and absolute path to the current executable
+    #
+    # In gdb 6.2 (at least), the default line number is set by
+    # select_source_symtab to the first line of "main" minus
+    # the value of "lines_to_list" (which defaults to 10) plus one.
+    # --chastain 2004-08-13
+
+    set line_main_head [gdb_get_line_number "main ("]
+    set line_main_body [expr $line_main_head + 2]
+    set gdb_lines_to_list 10
+    set line_default [expr $line_main_body - $gdb_lines_to_list + 1]
+
     mi_gdb_test "111-file-list-exec-source-file" \
-           "111\\\^done,line=\"23\",file=\"${srcfilepath}\",fullname=\"/.*/${srcfile}\"" \
+           "111\\\^done,line=\"$line_default\",file=\"${srcfilepath}\",fullname=\"/.*/${srcfile}\"" \
                "request path info of current source file (${srcfile})"
 }
 
index 4843799a0413dc0ee62cadf696e64210d0c27d5e..670329e79be88e3cd8695cd21ce265673226519f 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2001, 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
-
 # Test Machine interface (MI) operations 
 # Verify that, using the MI, we can run a simple program and perform
 # exec-return.  
@@ -51,9 +48,12 @@ proc test_return_simple {} {
     global mi_gdb_prompt
     global hex
 
+    set line_callee3_head         [gdb_get_line_number "callee3 ("]
+    set line_callee3_close_brace  [expr $line_callee3_head + 3]
+
     send_gdb "111-exec-return\n"
     gdb_expect {
-       -re "111\\^done,frame=\{level=\"0\",addr=\"$hex\",func=\"callee3\",args=\\\[.*\\\],file=\".*basics.c\",line=\"18\"\}\r\n$mi_gdb_prompt$" {pass "return from callee4 now"}
+       -re "111\\^done,frame=\{level=\"0\",addr=\"$hex\",func=\"callee3\",args=\\\[.*\\\],file=\".*basics.c\",line=\"$line_callee3_close_brace\"\}\r\n$mi_gdb_prompt$" {pass "return from callee4 now"}
        -re ".*\r\n$mi_gdb_prompt$" { fail "return from callee4 now" }
        timeout { fail "return from callee4 now (timeout)"
        }
index 2688d22d901d3e5d9404a9e2dde936be7eceea9e..6fdaffde056d6d3f166659453d690fa2f8228d03 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2001, 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
-
 #
 # Test essential Machine interface (MI) operations
 #
@@ -53,6 +50,13 @@ proc test_breakpoints_creation_and_listing {} {
     global srcfile
     global hex
 
+    set line_callee4_head  [gdb_get_line_number "callee4 ("]
+    set line_callee3_head  [gdb_get_line_number "callee3 ("]
+    set line_callee2_head  [gdb_get_line_number "callee2 ("]
+    set line_callee2_body  [expr $line_callee2_head + 2]
+    set line_main_head     [gdb_get_line_number "main ("]
+    set line_main_body     [expr $line_main_head + 2]
+
     # Insert some breakpoints and list them
     # Also, disable some so they do not interfere with other tests
     # Tests:
@@ -62,23 +66,23 @@ proc test_breakpoints_creation_and_listing {} {
     # -break-info
 
     mi_gdb_test "200-break-insert main" \
-             "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\}" \
+             "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\"\}" \
              "break-insert operation"
 
     mi_gdb_test "201-break-insert basics.c:callee2" \
-             "201\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee2\",file=\".*basics.c\",line=\"22\",times=\"0\"\}" \
+             "201\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee2\",file=\".*basics.c\",line=\"$line_callee2_body\",times=\"0\"\}" \
              "insert breakpoint at basics.c:callee2"
 
-    mi_gdb_test "202-break-insert basics.c:15" \
-             "202\\^done,bkpt=\{number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee3\",file=\".*basics.c\",line=\"15\",times=\"0\"\}" \
-             "insert breakpoint at basics.c:15 (callee3)"
+    mi_gdb_test "202-break-insert basics.c:$line_callee3_head" \
+             "202\\^done,bkpt=\{number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee3\",file=\".*basics.c\",line=\"$line_callee3_head\",times=\"0\"\}" \
+             "insert breakpoint at basics.c:\$line_callee3_head"
 
-    mi_gdb_test "203-break-insert \"\\\"${srcfile}\\\":6\"" \
-             "203\\^done,bkpt=\{number=\"4\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"6\",times=\"0\"\}" \
-             "insert breakpoint at \"<fullfilename>\":6 (callee4)"
+    mi_gdb_test "203-break-insert \"\\\"${srcfile}\\\":$line_callee4_head\"" \
+             "203\\^done,bkpt=\{number=\"4\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"$line_callee4_head\",times=\"0\"\}" \
+             "insert breakpoint at \"<fullfilename>\":\$line_callee4_head"
 
     mi_gdb_test "204-break-list" \
-           "204\\^done,BreakpointTable=\{.*,hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\},.*\}\\\]\}" \
+           "204\\^done,BreakpointTable=\{.*,hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\"\},.*\}\\\]\}" \
                 "list of breakpoints"
 
     mi_gdb_test "205-break-disable 2 3 4" \
@@ -94,6 +98,9 @@ proc test_running_the_program {} {
     global mi_gdb_prompt
     global hex
 
+    set line_main_head     [gdb_get_line_number "main ("]
+    set line_main_body     [expr $line_main_head + 2]
+
     # Run the program without args, then specify srgs and rerun the program
     # Tests:
     # -exec-run
@@ -104,7 +111,7 @@ proc test_running_the_program {} {
     # The following is equivalent to a send_gdb "000-exec-run\n"
     mi_run_cmd
     gdb_expect {
-       -re "000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"32\"\}\r\n$mi_gdb_prompt$" {
+       -re "000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"$line_main_body\"\}\r\n$mi_gdb_prompt$" {
            pass "run to main"
        }
        -re ".*$mi_gdb_prompt$" {
@@ -120,6 +127,15 @@ proc test_controlled_execution {} {
     global mi_gdb_prompt
     global hex
 
+    set line_callee4_head         [gdb_get_line_number "callee4 ("]
+    set line_callee4_body         [expr $line_callee4_head + 2]
+    set line_callee3_head         [gdb_get_line_number "callee3 ("]
+    set line_callee3_close_brace  [expr $line_callee3_head + 3]
+    set line_callee1_head         [gdb_get_line_number "callee1 ("]
+    set line_callee1_body         [expr $line_callee1_head + 2]
+    set line_main_head            [gdb_get_line_number "main ("]
+    set line_main_body            [expr $line_main_head + 2]
+
     # Continue execution until a breakpoint is reached, step into calls, verifying
     # if the arguments are correctly shown, continue to the end of a called
     # function, step over a call (next).
@@ -129,24 +145,24 @@ proc test_controlled_execution {} {
     # -exec-step
     # -exec-finish
 
-    mi_next_to "main" "" "basics.c" "33" "next at main"
+    mi_next_to "main" "" "basics.c" [expr $line_main_body + 1] "next at main"
 
     # FIXME: A string argument is not printed right; should be fixed and
     #        we should look for the right thing here.
     # NOTE: The ``\\\\\"'' is for \".
     mi_step_to "callee1" \
        "\{name=\"intarg\",value=\"2\"\},\{name=\"strarg\",value=\"$hex \\\\\"A string argument\.\\\\\"\"\},\{name=\"fltarg\",value=\"3.5\"\}" \
-       "basics.c" "27" "step at main"
+       "basics.c" "$line_callee1_body" "step at main"
 
     # FIXME: A string argument is not printed right; should be fixed and
     #        we should look for the right thing here.
     mi_execute_to "exec-step 3" "end-stepping-range" "callee4" "" \
-       "basics.c" "8" "" "step to callee4"
+       "basics.c" $line_callee4_body "" "step to callee4"
 
     # FIXME: A string argument is not printed right; should be fixed and
     #        we should look for the right thing here.
     # NOTE: The ``.'' is part of ``gdb-result-var="$1"''
-    mi_finish_to "callee3" ".*" "basics.c" "18" ".1" "0" "exec-finish"
+    mi_finish_to "callee3" ".*" "basics.c" $line_callee3_close_brace ".1" "0" "exec-finish"
 }
 
 proc test_controlling_breakpoints {} {
index 45377d3704a23c46d8a2cc2d08429065370488cd..6f524f8f3ac3f3b7cdae3f7fd744134c379480be 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+# Copyright 2000, 2001, 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
-
 #
 # Test essential Machine interface (MI) operations
 #
@@ -50,6 +47,9 @@ proc test_stack_frame_listing {} {
     global mi_gdb_prompt
     global hex
 
+    set line_callee4_head [gdb_get_line_number "callee4 ("]
+    set line_callee4_body [expr $line_callee4_head + 2]
+
     # Obtain a stack trace
     # Tests:
     # -stack-list-frames
@@ -57,7 +57,7 @@ proc test_stack_frame_listing {} {
     # -stack-list-frames 1 3
 
     mi_gdb_test "231-stack-list-frames" \
-           "231\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"8\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\},frame=\{level=\"2\",addr=\"$hex\",func=\"callee2\",.*\},frame=\{level=\"3\",addr=\"$hex\",func=\"callee1\",.*\},frame=\{level=\"4\",addr=\"$hex\",func=\"main\",.*\}\\\]" \
+           "231\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"$line_callee4_body\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\},frame=\{level=\"2\",addr=\"$hex\",func=\"callee2\",.*\},frame=\{level=\"3\",addr=\"$hex\",func=\"callee1\",.*\},frame=\{level=\"4\",addr=\"$hex\",func=\"main\",.*\}\\\]" \
                 "stack frame listing"
     mi_gdb_test "232-stack-list-frames 1 1" \
            "232\\^done,stack=\\\[frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\}\\\]" \
@@ -155,10 +155,12 @@ proc test_stack_locals_listing {} {
            "232\\^done,locals=\\\[name=\"A\",name=\"B\",name=\"C\"\\\]" \
                 "stack locals listing 0"
 
+set line_callee4_return_0 [gdb_get_line_number "return 0;"]
+
 # step until A, B, C, have some reasonable values.
 send_gdb "-exec-next 3\n"
 gdb_expect {
-    -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\\\[\\\],file=\".*basics.c\",line=\"13\"\}\r\n$mi_gdb_prompt$" {
+    -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\\\[\\\],file=\".*basics.c\",line=\"$line_callee4_return_0\"\}\r\n$mi_gdb_prompt$" {
        pass "next's in callee4"
     }
     timeout { fail "next in callee4 (timeout)" }
index a27e044f1c33356cac6ecc0fcb1729903d318c05..99276d7f2b90fb7071b3f9ab38ef09f7c6d7af1f 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2001, 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
-
 # Test Machine interface (MI) operations 
 # Verify that, using the MI, we can run a simple program and perform
 # exec-step-instruction and exec-next-instruction.  
@@ -50,10 +47,19 @@ proc test_stepi_nexti {} {
     global mi_gdb_prompt
     global hex
 
+    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!"]
+
     send_gdb "111-exec-step-instruction\n"
     gdb_expect {
-       -re "111\\^running\r\n${mi_gdb_prompt}111\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"3.\"\}\r\n$mi_gdb_prompt$" {
-           pass "step-instruction at main"
+       -re "111\\^running\r\n${mi_gdb_prompt}111\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"(\[0-9\]+)\"\}\r\n$mi_gdb_prompt$" {
+           set line $expect_out(1,string)
+           if { $line >= $line_main_body && $line <= $line_main_hello } {
+               pass "step-instruction at main"
+           } else {
+               fail "step-instruction at main"
+           }
        }
        timeout {
            fail "step-instruction at main (timeout)"
@@ -61,8 +67,13 @@ proc test_stepi_nexti {} {
     }
     send_gdb "222-exec-next-instruction\n"
     gdb_expect {
-       -re "222\\^running\r\n${mi_gdb_prompt}222\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"3.\"\}\r\n$mi_gdb_prompt$" {
-           pass "next-instruction at main"
+       -re "222\\^running\r\n${mi_gdb_prompt}222\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"(\[0-9\]+)\"\}\r\n$mi_gdb_prompt$" {
+           set line $expect_out(1,string)
+           if { $line >= $line_main_body && $line <= $line_main_hello } {
+               pass "next-instruction at main"
+           } else {
+               fail "next-instruction at main"
+           }
        }
        timeout {
            fail "next-instruction at main (timeout)"
@@ -70,8 +81,13 @@ proc test_stepi_nexti {} {
     }
     send_gdb "333-exec-next-instruction\n"
     gdb_expect {
-       -re "333\\^running\r\n${mi_gdb_prompt}333\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"3.\"\}\r\n$mi_gdb_prompt$" {
-           pass "next-instruction at main"
+       -re "333\\^running\r\n${mi_gdb_prompt}333\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"(\[0-9\]+)\"\}\r\n$mi_gdb_prompt$" {
+           set line $expect_out(1,string)
+           if { $line >= $line_main_body && $line <= $line_main_hello } {
+               pass "next-instruction at main"
+           } else {
+               fail "next-instruction at main"
+           }
        }
        timeout {
            fail "next-instruction at main (timeout)"
index 0f0a80fd3bb1d7ff5fb47f134689bdd6871db400..301505e9683e720e7cdb8056de22eb420b1c45ca 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2001, 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
-
 #
 # Test essential Machine interface (MI) operations
 #
@@ -52,6 +49,9 @@ proc test_watchpoint_creation_and_listing {} {
     global srcfile
     global hex
 
+    set line_callee4_head [gdb_get_line_number "callee4 ("]
+    set line_callee4_body [expr $line_callee4_head + 2]
+
     # Insert a watchpoint and list
     # Tests:
     # -break-watch C
@@ -62,7 +62,7 @@ proc test_watchpoint_creation_and_listing {} {
              "break-watch operation"
 
     mi_gdb_test "222-break-list" \
-           "222\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"8\",times=\"1\"\},bkpt=\{number=\"2\",type=\".*watchpoint\",disp=\"keep\",enabled=\"y\",addr=\"\",what=\"C\",times=\"0\"\}\\\]\}" \
+           "222\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"$line_callee4_body\",times=\"1\"\},bkpt=\{number=\"2\",type=\".*watchpoint\",disp=\"keep\",enabled=\"y\",addr=\"\",what=\"C\",times=\"0\"\}\\\]\}" \
                 "list of watchpoints"
 
 }
@@ -73,17 +73,20 @@ proc test_awatch_creation_and_listing {} {
     global srcfile
     global hex
 
+    set line_main_head [gdb_get_line_number "main ("]
+    set line_main_body [expr $line_main_head + 2]
+
     # Insert an access watchpoint and list it
     # Tests:
     # -break-watch -a A
     # -break-list
 
     mi_gdb_test "333-break-watch -a A" \
-             "333\\^done,bkpt=\{number=\"1\",addr=\"$hex\",file=\".*basics.c\",line=\"32\"\}" \
+             "333\\^done,bkpt=\{number=\"1\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_main_body\"\}" \
              "break-watch -a operation"
 
     mi_gdb_test "444-break-list" \
-           "444\\^done,BreakpointTable=\{.*,hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"3\",type=\"watchpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\},.*\}\\\]\}" \
+           "444\\^done,BreakpointTable=\{.*,hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"3\",type=\"watchpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\"\},.*\}\\\]\}" \
                 "list of watchpoints awatch"
 
     mi_gdb_test "777-break-delete 3" \
@@ -97,17 +100,20 @@ proc test_rwatch_creation_and_listing {} {
     global srcfile
     global hex
 
+    set line_main_head [gdb_get_line_number "main ("]
+    set line_main_body [expr $line_main_head + 2]
+
     # Insert a read watchpoint and list it.
     # Tests:
     # -break-insert -r B
     # -break-list
 
     mi_gdb_test "200-break-watch -r C" \
-             "200\\^done,bkpt=\{number=\"5\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"32\",times=\"0\"\}" \
+             "200\\^done,bkpt=\{number=\"5\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\"\}" \
              "break-insert -r operation"
 
     mi_gdb_test "300-break-list" \
-           "300\\^done,BreakpointTable=\{.*,hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"5\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\},.*\}\\\}\}" \
+           "300\\^done,BreakpointTable=\{.*,hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"5\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\"\},.*\}\\\}\}" \
                 "list of breakpoints"
 
     mi_gdb_test "177-break-delete 4" \
@@ -119,6 +125,10 @@ proc test_watchpoint_triggering {} {
     global mi_gdb_prompt
     global hex
 
+    set line_callee4_return_0     [gdb_get_line_number "return 0;"]
+    set line_callee3_head         [gdb_get_line_number "callee3 ("]
+    set line_callee3_close_brace  [expr $line_callee3_head + 3]
+
     # Continue execution until the watchpoint is reached,  continue again, 
     # to see the watchpoint go out of scope.
     # Does:
@@ -129,7 +139,7 @@ proc test_watchpoint_triggering {} {
     gdb_expect {
       -re "222\\^running\r\n$mi_gdb_prompt" {
         gdb_expect {
-           -re "222\\*stopped,reason=\"watchpoint-trigger\",wpt=\{number=\"2\",exp=\"C\"\},value=\{old=\".*\",new=\"3\"\},thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\\\[\\\],file=\".*basics.c\",line=\"13\"\}\r\n$mi_gdb_prompt$" {
+           -re "222\\*stopped,reason=\"watchpoint-trigger\",wpt=\{number=\"2\",exp=\"C\"\},value=\{old=\".*\",new=\"3\"\},thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\\\[\\\],file=\".*basics.c\",line=\"$line_callee4_return_0\"\}\r\n$mi_gdb_prompt$" {
             pass "watchpoint trigger"
           }
           -re ".*$mi_gdb_prompt$" {fail "watchpoint trigger (2)"}
@@ -144,7 +154,7 @@ proc test_watchpoint_triggering {} {
     gdb_expect {
       -re "223\\^running\r\n$mi_gdb_prompt" {
         gdb_expect {
-           -re "\[\r\n\]*223\\*stopped,reason=\"watchpoint-scope\",wpnum=\"2\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee3\",args=\\\[.*\\\],file=\".*basics.c\",line=\"18\"\}\r\n$mi_gdb_prompt$" {
+           -re "\[\r\n\]*223\\*stopped,reason=\"watchpoint-scope\",wpnum=\"2\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee3\",args=\\\[.*\\\],file=\".*basics.c\",line=\"$line_callee3_close_brace\"\}\r\n$mi_gdb_prompt$" {
             pass "wp out of scope"
           }
           -re ".*$mi_gdb_prompt$" {fail "wp out of scope (2)"}