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.
This commit is contained in:
Michael Chastain 2004-08-15 10:15:58 +00:00
parent a6ed5501f7
commit 45f07fef90
19 changed files with 368 additions and 205 deletions

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

View 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} \

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

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

View 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})"
}

View 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)"
}

View 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 {} {

View 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)" }

View 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)"

View 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)"}

View 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} \

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

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

View 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})"
}

View 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)"
}

View 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 {} {

View 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)" }

View 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)"

View 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)"}