Clone the mi-*.exp tests into mi0-*.exp.
This commit is contained in:
parent
f6eb6cffba
commit
b85045e00b
19 changed files with 4897 additions and 0 deletions
|
@ -1,3 +1,25 @@
|
||||||
|
2001-06-16 Andrew Cagney <ac131313@redhat.com>
|
||||||
|
|
||||||
|
MI0 was the never enabled MI interface included in GDB 5.0.
|
||||||
|
* mi0-basics.exp: Copy mi-basics.exp.
|
||||||
|
* mi0-break.exp: Copy mi-break.exp.
|
||||||
|
* mi0-console.exp: Copy mi-console.exp.
|
||||||
|
* mi0-disassemble.exp: Copy mi-disassemble.exp.
|
||||||
|
* mi0-eval.exp: Copy mi-eval.exp.
|
||||||
|
* mi0-hack-cli.exp: Copy mi-hack-cli.exp.
|
||||||
|
* mi0-read-memory.exp: Copy mi-read-memory.exp.
|
||||||
|
* mi0-regs.exp: Copy mi-regs.exp.
|
||||||
|
* mi0-return.exp: Copy mi-return.exp.
|
||||||
|
* mi0-simplerun.exp: Copy mi-simplerun.exp.
|
||||||
|
* mi0-stack.exp: Copy mi-stack.exp.
|
||||||
|
* mi0-stepi.exp: Copy mi-stepi.exp.
|
||||||
|
* mi0-until.exp: Copy mi-until.exp.
|
||||||
|
* mi0-var-block.exp: Copy mi-var-block.exp.
|
||||||
|
* mi0-var-child.exp: Copy mi-var-child.exp.
|
||||||
|
* mi0-var-cmd.exp: Copy mi-var-cmd.exp.
|
||||||
|
* mi0-var-display.exp: Copy mi-var-display.exp.
|
||||||
|
* mi0-watch.exp: Copy mi-watch.exp.
|
||||||
|
|
||||||
2001-05-11 Fernando Nasser <fnasser@redhat.com>
|
2001-05-11 Fernando Nasser <fnasser@redhat.com>
|
||||||
|
|
||||||
* mi-var-child.exp: Adjust for the fact that now (char *) can be
|
* mi-var-child.exp: Adjust for the fact that now (char *) can be
|
||||||
|
|
177
gdb/testsuite/gdb.mi/mi0-basics.exp
Normal file
177
gdb/testsuite/gdb.mi/mi0-basics.exp
Normal file
|
@ -0,0 +1,177 @@
|
||||||
|
# Copyright 1999, 2000 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
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# 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 basic Machine interface (MI) operations
|
||||||
|
#
|
||||||
|
# Verify that, using the MI, we can load a program and do
|
||||||
|
# other basic things that are used by all test files through mi_gdb_exit,
|
||||||
|
# mi_gdb_start, mi_delete_breakpoints, mi_gdb_reinitialize_dir and
|
||||||
|
# mi_gdb_load, so we can safely use those.
|
||||||
|
#
|
||||||
|
# The goal is not to test gdb functionality, which is done by other tests,
|
||||||
|
# but the command syntax and correct output response to MI operations.
|
||||||
|
#
|
||||||
|
|
||||||
|
load_lib mi-support.exp
|
||||||
|
|
||||||
|
gdb_exit
|
||||||
|
if [mi_gdb_start] {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
set testfile "basics"
|
||||||
|
set srcfile ${testfile}.c
|
||||||
|
set binfile ${objdir}/${subdir}/${testfile}
|
||||||
|
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
|
||||||
|
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
||||||
|
}
|
||||||
|
|
||||||
|
# In this file we want to test if the operations needed by the following
|
||||||
|
# procedures work, so it makes no sense using them here.
|
||||||
|
|
||||||
|
# mi_delete_breakpoints
|
||||||
|
# mi_gdb_reinitialize_dir $srcdir/$subdir
|
||||||
|
# mi_gdb_load ${binfile}
|
||||||
|
|
||||||
|
# Test if the MI interpreter has been configured
|
||||||
|
|
||||||
|
proc test_mi_interpreter_selection {} {
|
||||||
|
global mi_gdb_prompt
|
||||||
|
global gdb_prompt
|
||||||
|
|
||||||
|
# All this test expects is to get the prompt back
|
||||||
|
# with no syntax error message
|
||||||
|
send_gdb "-gdb-version\n"
|
||||||
|
gdb_expect {
|
||||||
|
-re "GNU gdb .*\r\n$mi_gdb_prompt$" \
|
||||||
|
{ pass "acceptance of MI operations"
|
||||||
|
return 1}
|
||||||
|
-re ".*\r\n$mi_gdb_prompt$" \
|
||||||
|
{ fail "acceptance of MI operations"
|
||||||
|
note "Skipping all other MI tests." }
|
||||||
|
-re "Undefined command.*$gdb_prompt $" \
|
||||||
|
{ fail "acceptance of MI operations"
|
||||||
|
note "Skipping all other MI tests." }
|
||||||
|
-re ".*$gdb_prompt $" \
|
||||||
|
{ fail "acceptance of MI operations"
|
||||||
|
note "Skipping all other MI tests." }
|
||||||
|
timeout { fail "acceptance of MI operations (timeout)"
|
||||||
|
note "Skipping all other MI tests." }
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
proc test_exec_and_symbol_mi_operatons {} {
|
||||||
|
global mi_gdb_prompt
|
||||||
|
global binfile
|
||||||
|
|
||||||
|
# Load symbols and specify executable on a single operation
|
||||||
|
# Tests:
|
||||||
|
# -file-exec-and-symbols
|
||||||
|
|
||||||
|
# Can't use mi_gdb_test as if this doesn't work,
|
||||||
|
# we must give up on the whole test file
|
||||||
|
send_gdb "-file-exec-and-symbols ${binfile}\n"
|
||||||
|
gdb_expect {
|
||||||
|
-re "\[\r\n\]*\\\^done\r\n$mi_gdb_prompt$" \
|
||||||
|
{ pass "file-exec-and-symbols operation" }
|
||||||
|
timeout { fail "file-exec-and-symbols operation (timeout)"
|
||||||
|
note "Skipping all other MI tests."
|
||||||
|
return 0}
|
||||||
|
}
|
||||||
|
|
||||||
|
# The following is not used by mi-support.exp, but we test here so
|
||||||
|
# we get done with loading a program basics.
|
||||||
|
|
||||||
|
# Do it again, but now load symbols and specify executable with
|
||||||
|
# two separate operations
|
||||||
|
# Tests:
|
||||||
|
# -file-clear
|
||||||
|
# -file-exec-file
|
||||||
|
# -file-symbol-file
|
||||||
|
|
||||||
|
# FIXME: file-clear is not implemented yet.
|
||||||
|
# mi_gdb_test "-file-clear" \
|
||||||
|
# "\\\^done" \
|
||||||
|
# "file-clear operation"
|
||||||
|
|
||||||
|
mi_gdb_test "-file-exec-file ${binfile}" \
|
||||||
|
"\\\^done" \
|
||||||
|
"file-exec-file operation"
|
||||||
|
|
||||||
|
mi_gdb_test "-file-symbol-file ${binfile}" \
|
||||||
|
"\\\^done" \
|
||||||
|
"file-symbol-file operation"
|
||||||
|
|
||||||
|
# FIXME: if we cannot load we have to skip all other tests.
|
||||||
|
}
|
||||||
|
|
||||||
|
proc test_breakpoints_deletion {} {
|
||||||
|
global mi_gdb_prompt
|
||||||
|
global srcfile
|
||||||
|
|
||||||
|
# Clear all breakpoints and list to confirm
|
||||||
|
# Tests:
|
||||||
|
# -break-delete (all)
|
||||||
|
# -break-list
|
||||||
|
|
||||||
|
# The all parameter is actually no parameter.
|
||||||
|
mi_gdb_test "200-break-delete" \
|
||||||
|
"\\\^done" \
|
||||||
|
"break-delete (all) operation"
|
||||||
|
|
||||||
|
mi_gdb_test "201-break-list" \
|
||||||
|
".*\\\^done,BreakpointTable=\\\{\\\}" \
|
||||||
|
"all breakpoints removed"
|
||||||
|
}
|
||||||
|
|
||||||
|
proc test_dir_specification {} {
|
||||||
|
global mi_gdb_prompt
|
||||||
|
global srcdir
|
||||||
|
global subdir
|
||||||
|
|
||||||
|
# Clear the search directories, then specify one to be searched
|
||||||
|
# Tests:
|
||||||
|
# -environment-directory
|
||||||
|
# -environment-directory arg
|
||||||
|
|
||||||
|
#exp_internal 1
|
||||||
|
mi_gdb_test "202-environment-directory" \
|
||||||
|
"\\\^done" \
|
||||||
|
"environment-directory operation"
|
||||||
|
|
||||||
|
mi_gdb_test "203-environment-directory ${srcdir}/${subdir}" \
|
||||||
|
"\\\^done" \
|
||||||
|
"environment-directory arg operation"
|
||||||
|
#exp_internal 0
|
||||||
|
}
|
||||||
|
|
||||||
|
if [test_mi_interpreter_selection] {
|
||||||
|
test_exec_and_symbol_mi_operatons
|
||||||
|
test_breakpoints_deletion
|
||||||
|
test_dir_specification
|
||||||
|
}
|
||||||
|
|
||||||
|
mi_gdb_exit
|
||||||
|
return 0
|
||||||
|
|
||||||
|
# Local variables:
|
||||||
|
# change-log-default-name: "ChangeLog-mi"
|
||||||
|
# End:
|
141
gdb/testsuite/gdb.mi/mi0-break.exp
Normal file
141
gdb/testsuite/gdb.mi/mi0-break.exp
Normal file
|
@ -0,0 +1,141 @@
|
||||||
|
# Copyright 1999 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
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# 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
|
||||||
|
#
|
||||||
|
# Verify that, using the MI, we can run a simple program and perform basic
|
||||||
|
# debugging activities like: insert breakpoints, run the program,
|
||||||
|
# step, next, continue until it ends and, last but not least, quit.
|
||||||
|
#
|
||||||
|
# The goal is not to test gdb functionality, which is done by other tests,
|
||||||
|
# but to verify the correct output response to MI operations.
|
||||||
|
#
|
||||||
|
|
||||||
|
load_lib mi-support.exp
|
||||||
|
|
||||||
|
gdb_exit
|
||||||
|
if [mi_gdb_start] {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
set testfile "basics"
|
||||||
|
set srcfile ${testfile}.c
|
||||||
|
set binfile ${objdir}/${subdir}/${testfile}
|
||||||
|
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
|
||||||
|
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
||||||
|
}
|
||||||
|
|
||||||
|
mi_delete_breakpoints
|
||||||
|
mi_gdb_reinitialize_dir $srcdir/$subdir
|
||||||
|
mi_gdb_load ${binfile}
|
||||||
|
|
||||||
|
proc test_tbreak_creation_and_listing {} {
|
||||||
|
global mi_gdb_prompt
|
||||||
|
global srcfile
|
||||||
|
global hex
|
||||||
|
|
||||||
|
# Insert some breakpoints and list them
|
||||||
|
# Also, disable some so they do not interfere with other tests
|
||||||
|
# Tests:
|
||||||
|
# -break-insert -t main
|
||||||
|
# -break-insert -t basics.c:callee2
|
||||||
|
# -break-insert -t basics.c:15
|
||||||
|
# -break-insert -t srcfile:6
|
||||||
|
# -break-list
|
||||||
|
|
||||||
|
mi_gdb_test "222-break-insert -t main" \
|
||||||
|
"222\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\}" \
|
||||||
|
"break-insert -t operation"
|
||||||
|
|
||||||
|
mi_gdb_test "333-break-insert -t basics.c:callee2" \
|
||||||
|
"333\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"callee2\",file=\".*basics.c\",line=\"22\",times=\"0\"\}" \
|
||||||
|
"insert temp breakpoint at basics.c:callee2"
|
||||||
|
|
||||||
|
mi_gdb_test "444-break-insert -t basics.c:15" \
|
||||||
|
"444\\^done,bkpt=\{number=\"3\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"callee3\",file=\".*basics.c\",line=\"15\",times=\"0\"\}" \
|
||||||
|
"insert temp breakpoint at basics.c:15 (callee3)"
|
||||||
|
|
||||||
|
# Getting the quoting right is tricky. That is "\"<file>\":6"
|
||||||
|
mi_gdb_test "555-break-insert -t \"\\\"${srcfile}\\\":6\"" \
|
||||||
|
"555\\^done,bkpt=\{number=\"4\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"6\",times=\"0\"\}" \
|
||||||
|
"insert temp breakpoint at \"<fullfilename>\":6 (callee4)"
|
||||||
|
|
||||||
|
mi_gdb_test "666-break-list" \
|
||||||
|
"666\\^done,BreakpointTable=\{hdr=\{.*\},bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\},.*\}\}" \
|
||||||
|
"list of breakpoints"
|
||||||
|
|
||||||
|
mi_gdb_test "777-break-delete" \
|
||||||
|
"777\\^done" \
|
||||||
|
"delete temp breakpoints"
|
||||||
|
}
|
||||||
|
|
||||||
|
proc test_rbreak_creation_and_listing {} {
|
||||||
|
global mi_gdb_prompt
|
||||||
|
global srcfile
|
||||||
|
global hex
|
||||||
|
|
||||||
|
# Insert some breakpoints and list them
|
||||||
|
# Also, disable some so they do not interfere with other tests
|
||||||
|
# Tests:
|
||||||
|
# -break-insert -r main
|
||||||
|
# -break-insert -r callee2
|
||||||
|
# -break-insert -r callee
|
||||||
|
# -break-insert -r .*llee
|
||||||
|
# -break-list
|
||||||
|
|
||||||
|
setup_xfail "*-*-*"
|
||||||
|
mi_gdb_test "122-break-insert -r main" \
|
||||||
|
"122\\^done,bkpt=\{number=\"5\",addr=\"$hex\",file=\".*basics.c\",line=\"32\"\}" \
|
||||||
|
"break-insert -r operation"
|
||||||
|
|
||||||
|
setup_xfail "*-*-*"
|
||||||
|
mi_gdb_test "133-break-insert -r callee2" \
|
||||||
|
"133\\^done,bkpt=\{number=\"6\",addr=\"$hex\",file=\".*basics.c\",line=\"22\"\}" \
|
||||||
|
"insert breakpoint with regexp callee2"
|
||||||
|
|
||||||
|
setup_xfail "*-*-*"
|
||||||
|
mi_gdb_test "144-break-insert -r callee" \
|
||||||
|
"144\\^done,bkpt=\{number=\"7\",addr=\"$hex\",file=\".*basics.c\",line=\"27\"\},bkpt=\{number=\"8\",addr=\"$hex\",file=\".*basics.c\",line=\"22\"\},bkpt=\{number=\"9\",addr=\"$hex\",file=\".*basics.c\",line=\"17\"\},bkpt=\{number=\"10\",addr=\"$hex\",file=\".*basics.c\",line=\"8\"\}" \
|
||||||
|
"insert breakpoint with regexp callee"
|
||||||
|
|
||||||
|
setup_xfail "*-*-*"
|
||||||
|
mi_gdb_test "155-break-insert -r \.\*llee" \
|
||||||
|
"155\\^done,bkpt=\{number=\"11\",addr=\"$hex\",file=\".*basics.c\",line=\"27\"\},bkpt=\{number=\"12\",addr=\"$hex\",file=\".*basics.c\",line=\"22\"\},bkpt=\{number=\"13\",addr=\"$hex\",file=\".*basics.c\",line=\"17\"\},bkpt=\{number=\"14\",addr=\"$hex\",file=\".*basics.c\",line=\"8\"\}" \
|
||||||
|
"insert breakpoint with regexp .*llee"
|
||||||
|
|
||||||
|
setup_xfail "*-*-*"
|
||||||
|
mi_gdb_test "166-break-list" \
|
||||||
|
"166\\^done,BreakpointTable=\{hdr=\{.*\},bkpt=\{number=\"5\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\},.*\}\}" \
|
||||||
|
"list of breakpoints"
|
||||||
|
|
||||||
|
mi_gdb_test "177-break-delete" \
|
||||||
|
"177\\^done" \
|
||||||
|
"delete temp breakpoints"
|
||||||
|
}
|
||||||
|
|
||||||
|
test_tbreak_creation_and_listing
|
||||||
|
test_rbreak_creation_and_listing
|
||||||
|
|
||||||
|
mi_gdb_exit
|
||||||
|
return 0
|
||||||
|
|
||||||
|
# Local variables:
|
||||||
|
# change-log-default-name: "ChangeLog-mi"
|
||||||
|
# End:
|
112
gdb/testsuite/gdb.mi/mi0-console.exp
Normal file
112
gdb/testsuite/gdb.mi/mi0-console.exp
Normal file
|
@ -0,0 +1,112 @@
|
||||||
|
# Copyright 1999, 2000, 2001 Cygnus Solutions.
|
||||||
|
|
||||||
|
# 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
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# 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
|
||||||
|
#
|
||||||
|
# Verify that, using the MI, we can run a simple program and perform basic
|
||||||
|
# debugging activities like: insert breakpoints, run the program,
|
||||||
|
# step, next, continue until it ends and, last but not least, quit.
|
||||||
|
#
|
||||||
|
# The goal is not to test gdb functionality, which is done by other tests,
|
||||||
|
# but to verify the correct output response to MI operations.
|
||||||
|
#
|
||||||
|
|
||||||
|
# This test only works when talking to a target that routes its output
|
||||||
|
# through GDB. Check that we're either talking to a simulator or a
|
||||||
|
# remote target.
|
||||||
|
|
||||||
|
load_lib mi-support.exp
|
||||||
|
|
||||||
|
gdb_exit
|
||||||
|
if [mi_gdb_start] {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
set testfile "mi-console"
|
||||||
|
set srcfile ${testfile}.c
|
||||||
|
set binfile ${objdir}/${subdir}/${testfile}
|
||||||
|
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
|
||||||
|
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
||||||
|
}
|
||||||
|
|
||||||
|
mi_delete_breakpoints
|
||||||
|
mi_gdb_reinitialize_dir $srcdir/$subdir
|
||||||
|
mi_gdb_load ${binfile}
|
||||||
|
|
||||||
|
# Halt in main
|
||||||
|
mi_gdb_test "200-break-insert main" \
|
||||||
|
"200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*mi-console.c\",line=\"13\",times=\"0\"\}" \
|
||||||
|
"break-insert operation"
|
||||||
|
mi_run_cmd
|
||||||
|
gdb_expect {
|
||||||
|
-re "000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"main\",args=\{\},file=\".*mi-console.c\",line=\"13\"\}\r\n$mi_gdb_prompt$" {
|
||||||
|
pass "run to main"
|
||||||
|
}
|
||||||
|
timeout {
|
||||||
|
fail "run to main (timeout)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Next over the hello() call which will produce lots of output
|
||||||
|
send_gdb "47-exec-next\n"
|
||||||
|
gdb_expect {
|
||||||
|
-re "47\\^running\r\n$mi_gdb_prompt" {
|
||||||
|
pass "Started step over hello"
|
||||||
|
}
|
||||||
|
timeout {
|
||||||
|
fail "Started step over hello (timeout)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gdb_expect {
|
||||||
|
-re "@\"H\"\r\n.*@\"e\"\r\n.*@\"l\"\r\n.*@\"l\"\r\n.*@\"o\"\r\n.*@\" \"\r\n.*@\"\\\\\\\\\"\r\n.*@\"\\\\\"\"\r\n.*@\"!\"\r\n.*@\"\\\\r\"\r\n.*@\"\\\\n\"\r\n" {
|
||||||
|
pass "Hello message"
|
||||||
|
}
|
||||||
|
-re "Hello" {
|
||||||
|
|
||||||
|
# Probably a native system where GDB doesn't have direct
|
||||||
|
# control over the inferior console.
|
||||||
|
# For this to work, GDB would need to run the inferior process
|
||||||
|
# under a PTY and then use the even-loops ability to wait on
|
||||||
|
# multiple event sources to channel the output back through the
|
||||||
|
# MI.
|
||||||
|
|
||||||
|
fail "Hello message (known bug)"
|
||||||
|
}
|
||||||
|
timeout {
|
||||||
|
fail "Hello message (timeout)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gdb_expect {
|
||||||
|
-re "47\\*stopped.*$mi_gdb_prompt$" {
|
||||||
|
pass "Finished step over hello"
|
||||||
|
}
|
||||||
|
timeout {
|
||||||
|
fail "Finished step over hello (timeout)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mi_gdb_exit
|
||||||
|
return 0
|
||||||
|
|
||||||
|
# Local variables:
|
||||||
|
# change-log-default-name: "ChangeLog-mi"
|
||||||
|
# End:
|
227
gdb/testsuite/gdb.mi/mi0-disassemble.exp
Normal file
227
gdb/testsuite/gdb.mi/mi0-disassemble.exp
Normal file
|
@ -0,0 +1,227 @@
|
||||||
|
# Copyright 1999, 2000 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
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
# The goal is not to test gdb functionality, which is done by other tests,
|
||||||
|
# but to verify the correct output response to MI operations.
|
||||||
|
#
|
||||||
|
|
||||||
|
load_lib mi-support.exp
|
||||||
|
|
||||||
|
gdb_exit
|
||||||
|
if [mi_gdb_start] {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
set testfile "basics"
|
||||||
|
set srcfile ${testfile}.c
|
||||||
|
set binfile ${objdir}/${subdir}/${testfile}
|
||||||
|
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
|
||||||
|
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
||||||
|
}
|
||||||
|
|
||||||
|
mi_delete_breakpoints
|
||||||
|
mi_gdb_reinitialize_dir $srcdir/$subdir
|
||||||
|
mi_gdb_load ${binfile}
|
||||||
|
|
||||||
|
proc test_breakpoints_creation_and_listing {} {
|
||||||
|
global mi_gdb_prompt
|
||||||
|
global srcfile
|
||||||
|
global hex
|
||||||
|
|
||||||
|
# Insert some breakpoints and list them
|
||||||
|
# Also, disable some so they do not interfere with other tests
|
||||||
|
# Tests:
|
||||||
|
# -break-insert
|
||||||
|
# -break-list
|
||||||
|
# -break-disable
|
||||||
|
# -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\"\}" \
|
||||||
|
"break-insert operation"
|
||||||
|
|
||||||
|
mi_gdb_test "204-break-list" \
|
||||||
|
"204\\^done,BreakpointTable=\{hdr=\{.*\},bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\}\}" \
|
||||||
|
"list of breakpoints"
|
||||||
|
}
|
||||||
|
|
||||||
|
proc test_running_the_program {} {
|
||||||
|
global mi_gdb_prompt
|
||||||
|
global hex
|
||||||
|
|
||||||
|
# Run the program without args
|
||||||
|
# Tests:
|
||||||
|
# -exec-run
|
||||||
|
|
||||||
|
# mi_gdb_test cannot be used for asynchronous commands because there are
|
||||||
|
# two prompts involved and this can lead to a race condition.
|
||||||
|
# FIXME: We are accepting a duplicate file and line info temporarely.
|
||||||
|
# The following is equivalent to a send_gdb "000-exec-run\n"
|
||||||
|
mi_run_cmd
|
||||||
|
# The running part has been checked already by mi_run_cmd
|
||||||
|
gdb_expect {
|
||||||
|
-re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"main\",args=\{\},file=\".*basics.c\",line=\"32\"\}\r\n$mi_gdb_prompt$" {
|
||||||
|
pass "run to main"
|
||||||
|
}
|
||||||
|
-re ".*$mi_gdb_prompt$" {fail "run to main (2)"}
|
||||||
|
timeout {fail "run to main (timeout 2)"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
proc test_disassembly_only {} {
|
||||||
|
global mi_gdb_prompt
|
||||||
|
global hex
|
||||||
|
global decimal
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
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" \
|
||||||
|
"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"
|
||||||
|
}
|
||||||
|
|
||||||
|
proc test_disassembly_lines_limit {} {
|
||||||
|
global mi_gdb_prompt
|
||||||
|
global hex
|
||||||
|
global decimal
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
mi_gdb_test "print/x \$pc" "" ""
|
||||||
|
mi_gdb_test "222-data-disassemble -f basics.c -l 32 -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" \
|
||||||
|
"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" \
|
||||||
|
"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"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
proc test_disassembly_mixed {} {
|
||||||
|
global mi_gdb_prompt
|
||||||
|
global hex
|
||||||
|
global decimal
|
||||||
|
|
||||||
|
# Test disassembly more only for the current function.
|
||||||
|
# Tests:
|
||||||
|
# -data-disassembly -f basics.c -l 21 -- 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=\".*\"\}\}\}\}" \
|
||||||
|
"data-disassemble file, line assembly mixed"
|
||||||
|
|
||||||
|
#
|
||||||
|
# In mixed mode, the lowest level of granularity is the source line.
|
||||||
|
# So we are going to get the disassembly for the source line at
|
||||||
|
# which we are now, even if we have specified that the range is only 2 insns.
|
||||||
|
#
|
||||||
|
mi_gdb_test "003-data-disassemble -s \$pc -e \"\$pc+4\" -- 1" \
|
||||||
|
"003\\^done,asm_insns=\{src_and_asm_line=\{line=\"$decimal\",file=\".*basics.c\",line_asm_insn=\{\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}.*\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}\}\}\}" \
|
||||||
|
"data-disassemble range assembly mixed"
|
||||||
|
}
|
||||||
|
|
||||||
|
proc test_disassembly_mixed_lines_limit {} {
|
||||||
|
global mi_gdb_prompt
|
||||||
|
global hex
|
||||||
|
global decimal
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
mi_gdb_test "print/x \$pc" "" ""
|
||||||
|
mi_gdb_test "222-data-disassemble -f basics.c -l 32 -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=\{\}\}\}" \
|
||||||
|
"data-disassemble file, line, number (zero lines) assembly mixed"
|
||||||
|
|
||||||
|
mi_gdb_test "222-data-disassemble -f basics.c -l 32 -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"
|
||||||
|
}
|
||||||
|
|
||||||
|
proc test_disassembly_bogus_args {} {
|
||||||
|
global mi_gdb_prompt
|
||||||
|
global hex
|
||||||
|
|
||||||
|
# Test that bogus input to disassembly command is rejected.
|
||||||
|
# Tests:
|
||||||
|
# -data-disassembly -f foo -l abc -n 0 -- 0
|
||||||
|
# -data-disassembly -s foo -e bar -- 0
|
||||||
|
# -data-disassembly -s $pc -f basics.c -- 0
|
||||||
|
# -data-disassembly -f basics.c -l 32 -- 9
|
||||||
|
|
||||||
|
mi_gdb_test "123-data-disassemble -f foo -l abc -n 0 -- 0" \
|
||||||
|
".*123\\^error,msg=\"mi_cmd_disassemble: Invalid filename.\"" \
|
||||||
|
"data-disassemble bogus filename"
|
||||||
|
|
||||||
|
mi_gdb_test "321-data-disassemble -s foo -e bar -- 0" \
|
||||||
|
"321\\^error,msg=\"No symbol \\\\\"foo\\\\\" in current context.\"" \
|
||||||
|
"data-disassemble bogus address"
|
||||||
|
|
||||||
|
mi_gdb_test "456-data-disassemble -s \$pc -f basics.c -- 0" \
|
||||||
|
"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" \
|
||||||
|
"789\\^error,msg=\"mi_cmd_disassemble: Mixed_mode argument must be 0 or 1.\"" \
|
||||||
|
"data-disassemble wrong mode arg"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
test_breakpoints_creation_and_listing
|
||||||
|
test_running_the_program
|
||||||
|
test_disassembly_only
|
||||||
|
test_disassembly_mixed
|
||||||
|
test_disassembly_bogus_args
|
||||||
|
test_disassembly_lines_limit
|
||||||
|
test_disassembly_mixed_lines_limit
|
||||||
|
|
||||||
|
mi_gdb_exit
|
||||||
|
return 0
|
||||||
|
|
||||||
|
# Local variables:
|
||||||
|
# change-log-default-name: "ChangeLog-mi"
|
||||||
|
# End:
|
105
gdb/testsuite/gdb.mi/mi0-eval.exp
Normal file
105
gdb/testsuite/gdb.mi/mi0-eval.exp
Normal file
|
@ -0,0 +1,105 @@
|
||||||
|
# Copyright 1999, 2000 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
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# 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
|
||||||
|
#
|
||||||
|
# Verify -data-evaluate-expression. There are really minimal tests.
|
||||||
|
|
||||||
|
# The goal is not to test gdb functionality, which is done by other tests,
|
||||||
|
# but to verify the correct output response to MI operations.
|
||||||
|
#
|
||||||
|
|
||||||
|
load_lib mi-support.exp
|
||||||
|
|
||||||
|
gdb_exit
|
||||||
|
if [mi_gdb_start] {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
set testfile "basics"
|
||||||
|
set srcfile ${testfile}.c
|
||||||
|
set binfile ${objdir}/${subdir}/${testfile}
|
||||||
|
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
|
||||||
|
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
||||||
|
}
|
||||||
|
|
||||||
|
mi_delete_breakpoints
|
||||||
|
mi_gdb_reinitialize_dir $srcdir/$subdir
|
||||||
|
mi_gdb_reinitialize_dir $srcdir/$subdir
|
||||||
|
mi_gdb_load ${binfile}
|
||||||
|
|
||||||
|
proc test_running_the_program {} {
|
||||||
|
global mi_gdb_prompt
|
||||||
|
global hex
|
||||||
|
|
||||||
|
# Run the program without args, then specify srgs and rerun the program
|
||||||
|
# Tests:
|
||||||
|
# -exec-run
|
||||||
|
|
||||||
|
mi_gdb_test "300-break-insert callee4" \
|
||||||
|
"300\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"8\",times=\"0\"\}" \
|
||||||
|
"insert breakpoint at callee4"
|
||||||
|
|
||||||
|
# mi_gdb_test cannot be used for asynchronous commands because there are
|
||||||
|
# two prompts involved and this can lead to a race condition.
|
||||||
|
# The following is equivalent to a send_gdb "000-exec-run\n"
|
||||||
|
mi_run_cmd
|
||||||
|
# The running part has been checked already by mi_run_cmd
|
||||||
|
gdb_expect {
|
||||||
|
-re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"callee4\",args=\{\},file=\".*basics.c\",line=\"8\"\}\r\n$mi_gdb_prompt$" \
|
||||||
|
{ pass "run to callee4" }
|
||||||
|
-re ".*$mi_gdb_prompt$" {fail "run to callee4 (2)"}
|
||||||
|
timeout {fail "run to callee4 (timeout 2)"}
|
||||||
|
}
|
||||||
|
|
||||||
|
send_gdb "101-exec-next\n"
|
||||||
|
gdb_expect {
|
||||||
|
-re "101\\^running\r\n$mi_gdb_prompt" {
|
||||||
|
gdb_expect {
|
||||||
|
-re "\[\r\n\]*101\\*stopped,reason=\"end-stepping-range\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"callee4\",args=\{\},file=\".*basics.c\",line=\"9\"\}\r\n$mi_gdb_prompt$" \
|
||||||
|
{ pass "next in callee4" }
|
||||||
|
-re ".*$mi_gdb_prompt$" {fail "next in callee4 (2)"}
|
||||||
|
timeout {fail "next in callee4 (timeout 2)"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
-re ".*$mi_gdb_prompt$" {fail "next in callee4 (1)"}
|
||||||
|
timeout {fail "next in callee4 (timeout 1)"}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
test_running_the_program
|
||||||
|
|
||||||
|
mi_gdb_test "211-data-evaluate-expression A" "211\\^done,value=\"1\"" "eval A"
|
||||||
|
|
||||||
|
mi_gdb_test "311-data-evaluate-expression &A" "311\\^done,value=\"$hex\"" "eval &A"
|
||||||
|
|
||||||
|
mi_gdb_test "411-data-evaluate-expression A+3" "411\\^done,value=\"4\"" "eval A+3"
|
||||||
|
|
||||||
|
mi_gdb_test "511-data-evaluate-expression \"A + 3\"" "511\\^done,value=\"4\"" "eval A + 3"
|
||||||
|
|
||||||
|
|
||||||
|
mi_gdb_exit
|
||||||
|
return 0
|
||||||
|
|
||||||
|
# Local variables:
|
||||||
|
# change-log-default-name: "ChangeLog-mi"
|
||||||
|
# End:
|
||||||
|
|
43
gdb/testsuite/gdb.mi/mi0-hack-cli.exp
Normal file
43
gdb/testsuite/gdb.mi/mi0-hack-cli.exp
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
# Copyright 1999 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
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# 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
|
||||||
|
|
||||||
|
|
||||||
|
# Some basic checks for the CLI.
|
||||||
|
|
||||||
|
load_lib mi-support.exp
|
||||||
|
|
||||||
|
gdb_exit
|
||||||
|
if [mi_gdb_start] {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
mi_gdb_test "show architecture\n" \
|
||||||
|
"&\"show architecture\\\\n\"\r\n~\"The target architecture.*\"\r\n\\^done" \
|
||||||
|
"show architecture"
|
||||||
|
|
||||||
|
mi_gdb_test "47show architecture\n" \
|
||||||
|
"&\"show architecture\\\\n\"\r\n~\"The target architecture.*\"\r\n47\\^done" \
|
||||||
|
"47show architecture"
|
||||||
|
|
||||||
|
mi_gdb_exit
|
||||||
|
return 0
|
||||||
|
|
||||||
|
# Local variables:
|
||||||
|
# change-log-default-name: "ChangeLog-mi"
|
||||||
|
# End:
|
103
gdb/testsuite/gdb.mi/mi0-read-memory.exp
Normal file
103
gdb/testsuite/gdb.mi/mi0-read-memory.exp
Normal file
|
@ -0,0 +1,103 @@
|
||||||
|
# Copyright 1999, 2000 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
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# 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 basic Machine interface (MI) operations
|
||||||
|
#
|
||||||
|
# Verify that, using the MI, we can load a program and do
|
||||||
|
# other basic things that are used by all test files through mi_gdb_exit,
|
||||||
|
# mi_gdb_start, mi_delete_breakpoints, mi_gdb_reinitialize_dir and
|
||||||
|
# mi_gdb_load, so we can safely use those.
|
||||||
|
#
|
||||||
|
# The goal is not to test gdb functionality, which is done by other tests,
|
||||||
|
# but the command syntax and correct output response to MI operations.
|
||||||
|
#
|
||||||
|
|
||||||
|
load_lib mi-support.exp
|
||||||
|
|
||||||
|
gdb_exit
|
||||||
|
if [mi_gdb_start] {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
set testfile "mi-read-memory"
|
||||||
|
set srcfile ${testfile}.c
|
||||||
|
set binfile ${objdir}/${subdir}/${testfile}
|
||||||
|
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
|
||||||
|
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
mi_run_to_main
|
||||||
|
|
||||||
|
#mi_next "do initialization"
|
||||||
|
send_gdb "101-exec-next\n"
|
||||||
|
gdb_expect {
|
||||||
|
-re "101\\^running\r\n$mi_gdb_prompt" {
|
||||||
|
gdb_expect {
|
||||||
|
-re "\[\r\n\]*101\\*stopped,reason=\"end-stepping-range\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"main\",args=\{\},file=\".*mi-read-memory.c\",line=\"20\"\}.*$mi_gdb_prompt$" \
|
||||||
|
{ pass "do initialization" }
|
||||||
|
-re ".*$mi_gdb_prompt$" {fail "do initialization (2)"}
|
||||||
|
timeout {fail "do initialization (timeout 2)"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
-re ".*$mi_gdb_prompt$" {fail "do initialization (1)"}
|
||||||
|
timeout {fail "do initialization (timeout 1)"}
|
||||||
|
}
|
||||||
|
|
||||||
|
mi_gdb_test "1-data-read-memory" \
|
||||||
|
"1\\^error,msg=\".*\"" \
|
||||||
|
"no arguments"
|
||||||
|
|
||||||
|
|
||||||
|
mi_gdb_test "2-data-read-memory bytes x 1 3 2" \
|
||||||
|
"2\\^done,addr=\"$hex\",nr-bytes=\"6\",total-bytes=\"6\",next-row=\"$hex\",prev-row=\"$hex\",next-page=\"$hex\",prev-page=\"$hex\",memory={{addr=\"$hex\",data={\"0x00\",\"0x01\"}},{addr=\"$hex\",data={\"0x02\",\"0x03\"}},{addr=\"$hex\",data={\"0x04\",\"0x05\"}}}" \
|
||||||
|
"3x2, one byte"
|
||||||
|
|
||||||
|
|
||||||
|
mi_gdb_test "9-data-read-memory -o -6 -- -0+bytes+6 x 1 3 2" \
|
||||||
|
"9\\^done,addr=\"$hex\",nr-bytes=\"6\",total-bytes=\"6\",next-row=\"$hex\",prev-row=\"$hex\",next-page=\"$hex\",prev-page=\"$hex\",memory={{addr=\"$hex\",data={\"0x00\",\"0x01\"}},{addr=\"$hex\",data={\"0x02\",\"0x03\"}},{addr=\"$hex\",data={\"0x04\",\"0x05\"}}}" \
|
||||||
|
"3x2, one byte offset by -6"
|
||||||
|
|
||||||
|
|
||||||
|
mi_gdb_test "3-data-read-memory \"(shorts + 128)\" x 2 1 2" \
|
||||||
|
"3\\^done,addr=\"$hex\",nr-bytes=\"4\",total-bytes=\"4\",next-row=\"$hex\",prev-row=\"$hex\",next-page=\"$hex\",prev-page=\"$hex\",memory={{addr=\"$hex\",data={\"0x0100\",\"0x0102\"}}}" \
|
||||||
|
"expression in quotes"
|
||||||
|
|
||||||
|
|
||||||
|
mi_gdb_test "4-data-read-memory bytes+16 x 1 8 4 x" \
|
||||||
|
"4\\^done,addr=\"$hex\",nr-bytes=\"32\",total-bytes=\"32\",next-row=\"$hex\",prev-row=\"$hex\",next-page=\"$hex\",prev-page=\"$hex\",memory={{addr=\"$hex\",data={\"0x10\",\"0x11\",\"0x12\",\"0x13\"},ascii=\"xxxx\"},{addr=\"$hex\",data={\"0x14\",\"0x15\",\"0x16\",\"0x17\"},ascii=\"xxxx\"},{addr=\"$hex\",data={\"0x18\",\"0x19\",\"0x1a\",\"0x1b\"},ascii=\"xxxx\"},{addr=\"$hex\",data={\"0x1c\",\"0x1d\",\"0x1e\",\"0x1f\"},ascii=\"xxxx\"},{addr=\"$hex\",data={\"0x20\",\"0x21\",\"0x22\",\"0x23\"},ascii=\" !\\\\\"#\"},{addr=\"$hex\",data={\"0x24\",\"0x25\",\"0x26\",\"0x27\"},ascii=\"\\$%&'\"},{addr=\"$hex\",data={\"0x28\",\"0x29\",\"0x2a\",\"0x2b\"},ascii=\"().+\"},{addr=\"$hex\",data={\"0x2c\",\"0x2d\",\"0x2e\",\"0x2f\"},ascii=\",-\./\"}}" \
|
||||||
|
"ascii and data"
|
||||||
|
|
||||||
|
|
||||||
|
mi_gdb_test "5-data-read-memory shorts+64 d 2 1 1" \
|
||||||
|
"5\\^done,addr=\"$hex\",nr-bytes=\"2\",total-bytes=\"2\",next-row=\"$hex\",prev-row=\"$hex\",next-page=\"$hex\",prev-page=\"$hex\",memory={{addr=\"$hex\",data={\"128\"}}}" \
|
||||||
|
"decimal"
|
||||||
|
|
||||||
|
mi_gdb_test "6-data-read-memory shorts+64 o 2 1 1" \
|
||||||
|
"6\\^done,addr=\"$hex\",nr-bytes=\"2\",total-bytes=\"2\",next-row=\"$hex\",prev-row=\"$hex\",next-page=\"$hex\",prev-page=\"$hex\",memory={{addr=\"$hex\",data={\"0200\"}}}" \
|
||||||
|
"octal"
|
||||||
|
|
||||||
|
|
||||||
|
mi_gdb_exit
|
||||||
|
return 0
|
||||||
|
|
||||||
|
# Local variables:
|
||||||
|
# change-log-default-name: "ChangeLog-mi"
|
||||||
|
# End:
|
183
gdb/testsuite/gdb.mi/mi0-regs.exp
Normal file
183
gdb/testsuite/gdb.mi/mi0-regs.exp
Normal file
|
@ -0,0 +1,183 @@
|
||||||
|
# Copyright 1999, 2000 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
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# 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
|
||||||
|
#
|
||||||
|
# Verify that, using the MI, we can run a simple program and look at registers.
|
||||||
|
#
|
||||||
|
# The goal is not to test gdb functionality, which is done by other tests,
|
||||||
|
# but to verify the correct output response to MI operations.
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
load_lib mi-support.exp
|
||||||
|
|
||||||
|
gdb_exit
|
||||||
|
if [mi_gdb_start] {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
set testfile "basics"
|
||||||
|
set srcfile ${testfile}.c
|
||||||
|
set binfile ${objdir}/${subdir}/${testfile}
|
||||||
|
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
|
||||||
|
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
||||||
|
}
|
||||||
|
|
||||||
|
mi_delete_breakpoints
|
||||||
|
mi_gdb_reinitialize_dir $srcdir/$subdir
|
||||||
|
mi_gdb_load ${binfile}
|
||||||
|
|
||||||
|
proc test_breakpoints_creation_and_listing {} {
|
||||||
|
global mi_gdb_prompt
|
||||||
|
global srcfile
|
||||||
|
global hex
|
||||||
|
|
||||||
|
# Insert some breakpoints and list them
|
||||||
|
# Also, disable some so they do not interfere with other tests
|
||||||
|
# Tests:
|
||||||
|
# -break-insert
|
||||||
|
# -break-list
|
||||||
|
# -break-disable
|
||||||
|
# -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\"\}" \
|
||||||
|
"break-insert operation"
|
||||||
|
|
||||||
|
mi_gdb_test "204-break-list" \
|
||||||
|
"204\\^done,BreakpointTable=\{hdr=\{.*\},bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\}\}" \
|
||||||
|
"list of breakpoints"
|
||||||
|
}
|
||||||
|
|
||||||
|
proc test_running_the_program {} {
|
||||||
|
global mi_gdb_prompt
|
||||||
|
global hex
|
||||||
|
|
||||||
|
# Run the program without args
|
||||||
|
# Tests:
|
||||||
|
# -exec-run
|
||||||
|
|
||||||
|
# mi_gdb_test cannot be used for asynchronous commands because there are
|
||||||
|
# two prompts involved and this can lead to a race condition.
|
||||||
|
# FIXME: We are accepting a duplicate file and line info temporarely.
|
||||||
|
# The following is equivalent to a send_gdb "000-exec-run\n"
|
||||||
|
mi_run_cmd
|
||||||
|
# The running part has been checked already by mi_run_cmd
|
||||||
|
gdb_expect {
|
||||||
|
-re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"main\",args=\{\},file=\".*basics.c\",line=\"32\"\}\r\n$mi_gdb_prompt$" {
|
||||||
|
pass "run to main"
|
||||||
|
}
|
||||||
|
-re ".*$mi_gdb_prompt$" {fail "run to main (2)"}
|
||||||
|
timeout {fail "run to main (timeout 2)"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
proc sparc_register_tests_no_exec { } {
|
||||||
|
# Test the generic IDT chip.
|
||||||
|
mi_gdb_test "111-data-list-register-values" \
|
||||||
|
".*111\\^error,msg=\"mi_cmd_data_list_register_values: Usage: -data-list-register-values <format> \\\[<regnum1>...<regnumN>\\\]\"" \
|
||||||
|
"wrong arguments"
|
||||||
|
|
||||||
|
mi_gdb_test "111-data-list-register-values x" \
|
||||||
|
".*111\\^error,msg=\"mi_cmd_data_list_register_values: No registers\.\"" \
|
||||||
|
"no executable"
|
||||||
|
}
|
||||||
|
|
||||||
|
# These tests exercise IDT-specific MIPS registers for several
|
||||||
|
# different processor models.
|
||||||
|
|
||||||
|
# This should detect the actual processor in use and change
|
||||||
|
# the expected results appropriately. FIXME
|
||||||
|
|
||||||
|
proc sparc_register_tests { } {
|
||||||
|
global hex
|
||||||
|
global decimal
|
||||||
|
set octal "\[0-7\]+"
|
||||||
|
set binary "\[0-1\]+"
|
||||||
|
set float "-?\[0-9\]+(\.\[0-9\]+)?(e\[+\-\]\[0-9\]+)?"
|
||||||
|
set float2 "\-?\[0-9\]+"
|
||||||
|
|
||||||
|
mi_gdb_test "111-data-list-register-names" \
|
||||||
|
"111\\^done,register-names=\{\"g0\",\"g1\",\"g2\",\"g3\",\"g4\",\"g5\",\"g6\",\"g7\",\"o0\",\"o1\",\"o2\",\"o3\",\"o4\",\"o5\",\"sp\",\"o7\",\"l0\",\"l1\",\"l2\",\"l3\",\"l4\",\"l5\",\"l6\",\"l7\",\"i0\",\"i1\",\"i2\",\"i3\",\"i4\",\"i5\",\"fp\",\"i7\",\"f0\",\"f1\",\"f2\",\"f3\",\"f4\",\"f5\",\"f6\",\"f7\",\"f8\",\"f9\",\"f10\",\"f11\",\"f12\",\"f13\",\"f14\",\"f15\",\"f16\",\"f17\",\"f18\",\"f19\",\"f20\",\"f21\",\"f22\",\"f23\",\"f24\",\"f25\",\"f26\",\"f27\",\"f28\",\"f29\",\"f30\",\"f31\",\"y\",\"psr\",\"wim\",\"tbr\",\"pc\",\"npc\",\"fpsr\",\"cpsr\"\}" \
|
||||||
|
"list register names"
|
||||||
|
|
||||||
|
mi_gdb_test "222-data-list-register-values x" \
|
||||||
|
"222\\^done,register-values=\{\{number=\"0\",value=\"$hex\"\}.*\{number=\"71\",value=\"$hex\"\}\}" \
|
||||||
|
"register values x"
|
||||||
|
|
||||||
|
mi_gdb_test "333-data-list-register-values f" \
|
||||||
|
"333\\^done,register-values=\{\{number=\"0\",value=\"$float\"\},\{number=\"1\",value=\"$float\"\},.*\{number=\"71\",value=\"$float\"\}\}" \
|
||||||
|
"register values f"
|
||||||
|
|
||||||
|
mi_gdb_test "444-data-list-register-values d" \
|
||||||
|
"444\\^done,register-values=\{\{number=\"0\",value=\"$decimal\"\}.*\{number=\"71\",value=\"$decimal\"\}\}" \
|
||||||
|
"register values d"
|
||||||
|
|
||||||
|
mi_gdb_test "555-data-list-register-values o" \
|
||||||
|
"555\\^done,register-values=\{\{number=\"0\",value=\"$octal\"\}.*\{number=\"71\",value=\"$octal\"\}\}" \
|
||||||
|
"register values o"
|
||||||
|
|
||||||
|
mi_gdb_test "666-data-list-register-values t" \
|
||||||
|
"666\\^done,register-values=\{\{number=\"0\",value=\"$binary\"\}.*\{number=\"71\",value=\"$binary\"\}\}" \
|
||||||
|
"register values t"
|
||||||
|
|
||||||
|
# On the sparc, registers 0-31 are int, 32-63 float, 64-71 int
|
||||||
|
|
||||||
|
mi_gdb_test "777-data-list-register-values N" \
|
||||||
|
"777\\^done,register-values=\{\{number=\"0\",value=\"$decimal\"\}.*\{number=\"31\",value=\"$decimal\"\},\{number=\"32\",value=\"$float\"\}.*\{number=\"63\",value=\"$float\"\},\{number=\"64\",value=\"$decimal\"\}.*\{number=\"71\",value=\"$decimal\"\}\}" \
|
||||||
|
"register values N"
|
||||||
|
|
||||||
|
mi_gdb_test "888-data-list-register-values r" \
|
||||||
|
"888\\^done,register-values=\{\{number=\"0\",value=\"$hex\"\}.*\{number=\"71\",value=\"$hex\"\}\}" \
|
||||||
|
"register values r"
|
||||||
|
|
||||||
|
mi_gdb_test "999-data-list-register-names 68 69 70 71" \
|
||||||
|
"999\\^done,register-names=\{\"pc\",\"npc\",\"fpsr\",\"cpsr\"\}" \
|
||||||
|
"list names of some regs"
|
||||||
|
|
||||||
|
mi_gdb_test "001-data-list-register-values x 68 69 70 71" \
|
||||||
|
"001\\^done,register-values=\{\{number=\"68\",value=\"$hex\"\},\{number=\"69\",value=\"$hex\"\},\{number=\"70\",value=\"$hex\"\},\{number=\"71\",value=\"$hex\"\}\}" \
|
||||||
|
"list values of some regs"
|
||||||
|
|
||||||
|
# Don't know how useful this test is
|
||||||
|
|
||||||
|
mi_gdb_test "002-data-list-changed-registers" \
|
||||||
|
"002\\^done,changed-registers=\{\"1\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\",\"15\",\"16\",\"23\",\"24\",\"25\",\"26\",\"27\",\"28\",\"30\",\"31\",\"65\",\"68\",\"69\"\}" \
|
||||||
|
"list changed registers"
|
||||||
|
}
|
||||||
|
|
||||||
|
if [istarget "sparc-*-*"] then {
|
||||||
|
sparc_register_tests_no_exec
|
||||||
|
test_breakpoints_creation_and_listing
|
||||||
|
test_running_the_program
|
||||||
|
sparc_register_tests
|
||||||
|
} else {
|
||||||
|
verbose "mi-regs.exp tests ignored for this target"
|
||||||
|
}
|
||||||
|
|
||||||
|
mi_gdb_exit
|
||||||
|
return 0
|
||||||
|
|
||||||
|
# Local variables:
|
||||||
|
# change-log-default-name: "ChangeLog-mi"
|
||||||
|
# End:
|
||||||
|
|
||||||
|
|
||||||
|
|
94
gdb/testsuite/gdb.mi/mi0-return.exp
Normal file
94
gdb/testsuite/gdb.mi/mi0-return.exp
Normal file
|
@ -0,0 +1,94 @@
|
||||||
|
# Copyright 1999, 2000 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
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
# The goal is not to
|
||||||
|
# test gdb functionality, which is done by other tests, but to verify
|
||||||
|
# the correct output response to MI operations.
|
||||||
|
#
|
||||||
|
|
||||||
|
load_lib mi-support.exp
|
||||||
|
|
||||||
|
gdb_exit
|
||||||
|
if [mi_gdb_start] {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
set testfile "basics"
|
||||||
|
set srcfile ${testfile}.c
|
||||||
|
set binfile ${objdir}/${subdir}/${testfile}
|
||||||
|
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
|
||||||
|
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
||||||
|
}
|
||||||
|
|
||||||
|
mi_delete_breakpoints
|
||||||
|
mi_gdb_reinitialize_dir $srcdir/$subdir
|
||||||
|
mi_gdb_reinitialize_dir $srcdir/$subdir
|
||||||
|
mi_gdb_load ${binfile}
|
||||||
|
|
||||||
|
proc test_running_to_callee4 {} {
|
||||||
|
global mi_gdb_prompt
|
||||||
|
global hex
|
||||||
|
|
||||||
|
mi_gdb_test "200-break-insert callee4" \
|
||||||
|
"200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"8\",times=\"0\"\}" \
|
||||||
|
"break-insert operation"
|
||||||
|
|
||||||
|
mi_run_cmd
|
||||||
|
|
||||||
|
gdb_expect {
|
||||||
|
-re "000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"callee4\",args=\{\},file=\".*basics.c\",line=\"8\"\}\r\n$mi_gdb_prompt$" {
|
||||||
|
pass "run to callee4"
|
||||||
|
}
|
||||||
|
timeout {
|
||||||
|
fail "run to callee4 (timeout)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mi_gdb_test "205-break-delete" \
|
||||||
|
"205\\^done.*" \
|
||||||
|
"delete all breakpoints"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
proc test_return_simple {} {
|
||||||
|
global mi_gdb_prompt
|
||||||
|
global hex
|
||||||
|
|
||||||
|
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 ".*\r\n$mi_gdb_prompt$" { fail "return from callee4 now" }
|
||||||
|
timeout { fail "return from callee4 now (timeout)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
test_running_to_callee4
|
||||||
|
test_return_simple
|
||||||
|
|
||||||
|
mi_gdb_exit
|
||||||
|
return 0
|
||||||
|
|
||||||
|
# Local variables:
|
||||||
|
# change-log-default-name: "ChangeLog-mi"
|
||||||
|
# End:
|
232
gdb/testsuite/gdb.mi/mi0-simplerun.exp
Normal file
232
gdb/testsuite/gdb.mi/mi0-simplerun.exp
Normal file
|
@ -0,0 +1,232 @@
|
||||||
|
# Copyright 1999, 2000 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
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# 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
|
||||||
|
#
|
||||||
|
# Verify that, using the MI, we can run a simple program and perform basic
|
||||||
|
# debugging activities like: insert breakpoints, run the program,
|
||||||
|
# step, next, continue until it ends and, last but not least, quit.
|
||||||
|
#
|
||||||
|
# The goal is not to test gdb functionality, which is done by other tests,
|
||||||
|
# but to verify the correct output response to MI operations.
|
||||||
|
#
|
||||||
|
|
||||||
|
load_lib mi-support.exp
|
||||||
|
|
||||||
|
gdb_exit
|
||||||
|
if [mi_gdb_start] {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
set testfile "basics"
|
||||||
|
set srcfile ${testfile}.c
|
||||||
|
set binfile ${objdir}/${subdir}/${testfile}
|
||||||
|
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
|
||||||
|
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
||||||
|
}
|
||||||
|
|
||||||
|
mi_delete_breakpoints
|
||||||
|
mi_gdb_reinitialize_dir $srcdir/$subdir
|
||||||
|
mi_gdb_reinitialize_dir $srcdir/$subdir
|
||||||
|
mi_gdb_load ${binfile}
|
||||||
|
|
||||||
|
proc test_breakpoints_creation_and_listing {} {
|
||||||
|
global mi_gdb_prompt
|
||||||
|
global srcfile
|
||||||
|
global hex
|
||||||
|
|
||||||
|
# Insert some breakpoints and list them
|
||||||
|
# Also, disable some so they do not interfere with other tests
|
||||||
|
# Tests:
|
||||||
|
# -break-insert
|
||||||
|
# -break-list
|
||||||
|
# -break-disable
|
||||||
|
# -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\"\}" \
|
||||||
|
"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\"\}" \
|
||||||
|
"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 "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 "204-break-list" \
|
||||||
|
"204\\^done,BreakpointTable=\{hdr=\{.*\},bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\},.*\}\}" \
|
||||||
|
"list of breakpoints"
|
||||||
|
|
||||||
|
mi_gdb_test "205-break-disable 2 3 4" \
|
||||||
|
"205\\^done.*" \
|
||||||
|
"disabling of breakpoints"
|
||||||
|
|
||||||
|
mi_gdb_test "206-break-info 2" \
|
||||||
|
"206\\^done,BreakpointTable=\{hdr=\{.*\},bkpt=\{number=\"2\",.*,enabled=\"n\",.*\}\}" \
|
||||||
|
"list of breakpoints, 16 disabled"
|
||||||
|
}
|
||||||
|
|
||||||
|
proc test_running_the_program {} {
|
||||||
|
global mi_gdb_prompt
|
||||||
|
global hex
|
||||||
|
|
||||||
|
# Run the program without args, then specify srgs and rerun the program
|
||||||
|
# Tests:
|
||||||
|
# -exec-run
|
||||||
|
# -gdb-set
|
||||||
|
|
||||||
|
# mi_gdb_test cannot be used for asynchronous commands because there are
|
||||||
|
# two prompts involved and this can lead to a race condition.
|
||||||
|
# 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=\"0\",frame=\{addr=\"$hex\",func=\"main\",args=\{\},file=\".*basics.c\",line=\"32\"\}\r\n$mi_gdb_prompt$" {
|
||||||
|
pass "run to main"
|
||||||
|
}
|
||||||
|
timeout {
|
||||||
|
fail "run to main (timeout)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
proc test_controlled_execution {} {
|
||||||
|
global mi_gdb_prompt
|
||||||
|
global hex
|
||||||
|
|
||||||
|
# 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).
|
||||||
|
# Tests:
|
||||||
|
# -exec-continue
|
||||||
|
# -exec-next
|
||||||
|
# -exec-step
|
||||||
|
# -exec-finish
|
||||||
|
|
||||||
|
# mi_gdb_test cannot be used for asynchronous commands because there are
|
||||||
|
# two prompts involved and this can lead to a race condition.
|
||||||
|
send_gdb "220-exec-next\n"
|
||||||
|
gdb_expect {
|
||||||
|
-re "220\\^running\r\n${mi_gdb_prompt}220\\*stopped,reason=\"end-stepping-range\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"main\",args=\{\},file=\".*basics.c\",line=\"33\"\}\r\n$mi_gdb_prompt$" {
|
||||||
|
pass "next at main"
|
||||||
|
}
|
||||||
|
timeout {
|
||||||
|
fail "next at main (timeout)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# FIXME: A string argument is not printed right; should be fixed and
|
||||||
|
# we should look for the right thing here.
|
||||||
|
# NOTE: The ``\\\\\"'' is for \".
|
||||||
|
send_gdb "221-exec-step\n"
|
||||||
|
gdb_expect {
|
||||||
|
-re "221\\^running\r\n${mi_gdb_prompt}221\\*stopped,reason=\"end-stepping-range\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"callee1\",args=\{\{name=\"intarg\",value=\"2\"\},\{name=\"strarg\",value=\"$hex \\\\\"A string argument\.\\\\\"\"\},\{name=\"fltarg\",value=\"3.5\"\}\},file=\".*basics.c\",line=\"27\"\}\r\n$mi_gdb_prompt$" {
|
||||||
|
pass "step at main"
|
||||||
|
}
|
||||||
|
timeout {
|
||||||
|
fail "step at main (timeout)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# FIXME: A string argument is not printed right; should be fixed and
|
||||||
|
# we should look for the right thing here.
|
||||||
|
send_gdb "222-exec-step 3\n"
|
||||||
|
gdb_expect 30 {
|
||||||
|
-re "222\\^running\r\n${mi_gdb_prompt}222\\*stopped,reason=\"end-stepping-range\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"callee4\",args=\{\},file=\".*basics.c\",line=\"8\"\}\r\n$mi_gdb_prompt$" {
|
||||||
|
pass "step to callee4"
|
||||||
|
}
|
||||||
|
timeout {
|
||||||
|
fail "step to callee4 (timeout)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# 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"''
|
||||||
|
send_gdb "223-exec-finish\n"
|
||||||
|
gdb_expect 30 {
|
||||||
|
-re "223\\^running\r\n${mi_gdb_prompt}223\\*stopped,reason=\"function-finished\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"callee3\",args=\{.*\},file=\".*basics.c\",line=\"18\"\},gdb-result-var=\".1\",return-value=\"0\"\r\n$mi_gdb_prompt$" {
|
||||||
|
pass "exec-finish"
|
||||||
|
}
|
||||||
|
timeout {
|
||||||
|
fail "exec-finish (timeout)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
proc test_controlling_breakpoints {} {
|
||||||
|
global mi_gdb_prompt
|
||||||
|
|
||||||
|
# Enable, delete, set ignore counts in breakpoints
|
||||||
|
# (disable was already tested above)
|
||||||
|
# Tests:
|
||||||
|
# -break-delete
|
||||||
|
# -break-enable
|
||||||
|
# -break-after
|
||||||
|
# -break-condition
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
proc test_program_termination {} {
|
||||||
|
global mi_gdb_prompt
|
||||||
|
|
||||||
|
# Run to completion: normal and forced
|
||||||
|
# Tests:
|
||||||
|
# -exec-abort
|
||||||
|
# (normal termination of inferior)
|
||||||
|
|
||||||
|
# FIXME: "stopped" doesn't seem appropriate.
|
||||||
|
# mi_gdb_test cannot be used for asynchronous commands because there are
|
||||||
|
# two prompts involved and this can lead to a race condition.
|
||||||
|
send_gdb "999-exec-continue\n"
|
||||||
|
gdb_expect {
|
||||||
|
-re "999\\^running\r\n$mi_gdb_prompt" {
|
||||||
|
gdb_expect {
|
||||||
|
-re "999\\*stopped,reason=\"exited-normally\"\r\n$mi_gdb_prompt$" {
|
||||||
|
pass "continue to end"
|
||||||
|
}
|
||||||
|
-re ".*$mi_gdb_prompt$" {fail "continue to end (2)"}
|
||||||
|
timeout {fail "continue to end (timeout 2)"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
-re ".*$mi_gdb_prompt$" {fail "continue to end (1)"}
|
||||||
|
timeout {fail "continue to end (timeout 1)"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
test_breakpoints_creation_and_listing
|
||||||
|
test_running_the_program
|
||||||
|
test_controlled_execution
|
||||||
|
test_controlling_breakpoints
|
||||||
|
test_program_termination
|
||||||
|
|
||||||
|
mi_gdb_exit
|
||||||
|
return 0
|
||||||
|
|
||||||
|
# Local variables:
|
||||||
|
# change-log-default-name: "ChangeLog-mi"
|
||||||
|
# End:
|
||||||
|
|
||||||
|
|
222
gdb/testsuite/gdb.mi/mi0-stack.exp
Normal file
222
gdb/testsuite/gdb.mi/mi0-stack.exp
Normal file
|
@ -0,0 +1,222 @@
|
||||||
|
# Copyright 2000 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
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# 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
|
||||||
|
#
|
||||||
|
# Verify that stack commands work.
|
||||||
|
|
||||||
|
# The goal is not to test gdb functionality, which is done by other tests,
|
||||||
|
# but to verify the correct output response to MI operations.
|
||||||
|
#
|
||||||
|
|
||||||
|
load_lib mi-support.exp
|
||||||
|
|
||||||
|
gdb_exit
|
||||||
|
if [mi_gdb_start] {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
set testfile "basics"
|
||||||
|
set srcfile ${testfile}.c
|
||||||
|
set binfile ${objdir}/${subdir}/${testfile}
|
||||||
|
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
|
||||||
|
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
||||||
|
}
|
||||||
|
|
||||||
|
mi_delete_breakpoints
|
||||||
|
mi_gdb_reinitialize_dir $srcdir/$subdir
|
||||||
|
mi_gdb_reinitialize_dir $srcdir/$subdir
|
||||||
|
mi_gdb_load ${binfile}
|
||||||
|
|
||||||
|
|
||||||
|
mi_gdb_test "200-break-insert callee4" \
|
||||||
|
"200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"8\",times=\"0\"\}" \
|
||||||
|
"break-insert operation"
|
||||||
|
|
||||||
|
mi_run_cmd
|
||||||
|
# The running part has been checked already by mi_run_cmd
|
||||||
|
gdb_expect {
|
||||||
|
-re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"callee4\",args=\{\},file=\".*basics.c\",line=\"8\"\}\r\n$mi_gdb_prompt$" {
|
||||||
|
pass "run to callee4"
|
||||||
|
}
|
||||||
|
-re ".*$mi_gdb_prompt$" {fail "run to callee4 (2)"}
|
||||||
|
timeout {fail "run to callee4 (timeout 2)"}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
proc test_stack_frame_listing {} {
|
||||||
|
global mi_gdb_prompt
|
||||||
|
global hex
|
||||||
|
|
||||||
|
# Obtain a stack trace
|
||||||
|
# Tests:
|
||||||
|
# -stack-list-frames
|
||||||
|
# -stack-list-frames 1 1
|
||||||
|
# -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\",.*\}\}" \
|
||||||
|
"stack frame listing"
|
||||||
|
mi_gdb_test "232-stack-list-frames 1 1" \
|
||||||
|
"232\\^done,stack=\{frame=\{level=\"1 \",addr=\"$hex\",func=\"callee3\",.*\}\}" \
|
||||||
|
"stack frame listing 1 1"
|
||||||
|
mi_gdb_test "233-stack-list-frames 1 3" \
|
||||||
|
"233\\^done,stack=\{frame=\{level=\"1 \",addr=\"$hex\",func=\"callee3\",.*\},frame=\{level=\"2 \",addr=\"$hex\",func=\"callee2\",.*\},frame=\{level=\"3 \",addr=\"$hex\",func=\"callee1\",.*\}\}" \
|
||||||
|
"stack frame listing 1 3"
|
||||||
|
|
||||||
|
mi_gdb_test "234-stack-list-frames 1" \
|
||||||
|
"234\\^error,msg=\"mi_cmd_stack_list_frames: Usage.*FRAME_LOW FRAME_HIGH.*\"" \
|
||||||
|
"stack frame listing wrong"
|
||||||
|
}
|
||||||
|
|
||||||
|
proc test_stack_args_listing {} {
|
||||||
|
global mi_gdb_prompt
|
||||||
|
global hex
|
||||||
|
|
||||||
|
# Obtain lists for args for the stack frames
|
||||||
|
# Tests:
|
||||||
|
# -stack-list-arguments 0
|
||||||
|
# -stack-list-arguments 0 1 1
|
||||||
|
# -stack-list-arguments 0 1 3
|
||||||
|
# -stack-list-arguments 1
|
||||||
|
# -stack-list-arguments 1 1 1
|
||||||
|
# -stack-list-arguments 1 1 3
|
||||||
|
# -stack-list-arguments
|
||||||
|
|
||||||
|
mi_gdb_test "231-stack-list-arguments 0" \
|
||||||
|
"231\\^done,stack-args=\{frame=\{level=\"0\",args=\{\}\},frame=\{level=\"1\",args=\{name=\"strarg\"\}\},frame=\{level=\"2\",args=\{name=\"intarg\",name=\"strarg\"\}\},frame=\{level=\"3\",args=\{name=\"intarg\",name=\"strarg\",name=\"fltarg\"\}\},frame=\{level=\"4\",args=\{\}\}\}" \
|
||||||
|
"stack args listing 0"
|
||||||
|
|
||||||
|
mi_gdb_test "232-stack-list-arguments 0 1 1" \
|
||||||
|
"232\\^done,stack-args=\{frame=\{level=\"1\",args=\{name=\"strarg\"\}\}\}" \
|
||||||
|
"stack args listing 0 1 1"
|
||||||
|
|
||||||
|
mi_gdb_test "233-stack-list-arguments 0 1 3" \
|
||||||
|
"233\\^done,stack-args=\{frame=\{level=\"1\",args=\{name=\"strarg\"\}\},frame=\{level=\"2\",args=\{name=\"intarg\",name=\"strarg\"\}\},frame=\{level=\"3\",args=\{name=\"intarg\",name=\"strarg\",name=\"fltarg\"\}\}\}" \
|
||||||
|
"stack args listing 0 1 3"
|
||||||
|
|
||||||
|
mi_gdb_test "231-stack-list-arguments 1" \
|
||||||
|
"231\\^done,stack-args=\{frame=\{level=\"0\",args=\{\}\},frame=\{level=\"1\",args=\{\{name=\"strarg\",value=\"$hex \\\\\"A string argument.\\\\\"\"\}\}\},frame=\{level=\"2\",args=\{\{name=\"intarg\",value=\"2\"\},\{name=\"strarg\",value=\"$hex \\\\\"A string argument.\\\\\"\"\}\}\},frame=\{level=\"3\",args=\{\{name=\"intarg\",value=\"2\"\},\{name=\"strarg\",value=\"$hex \\\\\"A string argument.\\\\\"\"\},\{name=\"fltarg\",value=\"3.5\"\}\}\},frame=\{level=\"4\",args=\{\}\}\}" \
|
||||||
|
"stack args listing 1"
|
||||||
|
|
||||||
|
mi_gdb_test "232-stack-list-arguments 1 1 1" \
|
||||||
|
"232\\^done,stack-args=\{frame=\{level=\"1\",args=\{\{name=\"strarg\",value=\"$hex \\\\\"A string argument.\\\\\"\"\}\}\}\}" \
|
||||||
|
"stack args listing 1 1 1"
|
||||||
|
|
||||||
|
mi_gdb_test "233-stack-list-arguments 1 1 3" \
|
||||||
|
"233\\^done,stack-args=\{frame=\{level=\"1\",args=\{\{name=\"strarg\",value=\"$hex \\\\\"A string argument.\\\\\"\"\}\}\},frame=\{level=\"2\",args=\{\{name=\"intarg\",value=\"2\"\},\{name=\"strarg\",value=\"$hex \\\\\"A string argument.\\\\\"\"\}\}\},frame=\{level=\"3\",args=\{\{name=\"intarg\",value=\"2\"\},\{name=\"strarg\",value=\"$hex \\\\\"A string argument.\\\\\"\"\},\{name=\"fltarg\",value=\"3.5\"\}\}\}\}" \
|
||||||
|
"stack args listing 1 1 3"
|
||||||
|
|
||||||
|
mi_gdb_test "234-stack-list-arguments" \
|
||||||
|
"234\\^error,msg=\"mi_cmd_stack_list_args: Usage.*PRINT_VALUES.*FRAME_LOW FRAME_HIGH.*\"" \
|
||||||
|
"stack args listing wrong"
|
||||||
|
}
|
||||||
|
|
||||||
|
proc test_stack_info_depth {} {
|
||||||
|
global mi_gdb_prompt
|
||||||
|
global hex
|
||||||
|
|
||||||
|
# Obtain depth of stack
|
||||||
|
# Tests:
|
||||||
|
# -stack-info-depth
|
||||||
|
# -stack-info-depth 3
|
||||||
|
# -stack-info-depth 99
|
||||||
|
|
||||||
|
mi_gdb_test "231-stack-info-depth" \
|
||||||
|
"231\\^done,depth=\"5\"" \
|
||||||
|
"stack info-depth"
|
||||||
|
|
||||||
|
mi_gdb_test "231-stack-info-depth 3" \
|
||||||
|
"231\\^done,depth=\"3\"" \
|
||||||
|
"stack info-depth 3"
|
||||||
|
|
||||||
|
mi_gdb_test "231-stack-info-depth 99" \
|
||||||
|
"231\\^done,depth=\"5\"" \
|
||||||
|
"stack info-depth 99"
|
||||||
|
|
||||||
|
mi_gdb_test "231-stack-info-depth 99 99" \
|
||||||
|
"231\\^error,msg=\"mi_cmd_stack_info_depth: Usage: .MAX_DEPTH.\"" \
|
||||||
|
"stack info-depth wrong usage"
|
||||||
|
}
|
||||||
|
|
||||||
|
proc test_stack_locals_listing {} {
|
||||||
|
global mi_gdb_prompt
|
||||||
|
global hex
|
||||||
|
|
||||||
|
# Obtain lists for locals for the stack frames
|
||||||
|
# Tests:
|
||||||
|
# -stack-list-locals 0
|
||||||
|
# -stack-list-locals 1
|
||||||
|
# -stack-list-arguments
|
||||||
|
|
||||||
|
mi_gdb_test "232-stack-list-locals 0" \
|
||||||
|
"232\\^done,locals=\{name=\"A\",name=\"B\",name=\"C\"\}" \
|
||||||
|
"stack locals listing 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=\"0\",frame=\{addr=\"$hex\",func=\"callee4\",args=\{\},file=\".*basics.c\",line=\"13\"\}\r\n$mi_gdb_prompt$" {
|
||||||
|
pass "next's in callee4"
|
||||||
|
}
|
||||||
|
timeout { fail "next in callee4 (timeout)" }
|
||||||
|
}
|
||||||
|
|
||||||
|
mi_gdb_test "232-stack-list-locals 1" \
|
||||||
|
"232\\^done,locals=\{\{name=\"A\",value=\"1\"\},\{name=\"B\",value=\"2\"\},\{name=\"C\",value=\"3\"\}\}" \
|
||||||
|
"stack locals listing 1"
|
||||||
|
|
||||||
|
mi_gdb_test "234-stack-list-locals" \
|
||||||
|
"234\\^error,msg=\"mi_cmd_stack_list_locals: Usage.*PRINT_VALUES.*\"" \
|
||||||
|
"stack locals listing wrong"
|
||||||
|
|
||||||
|
mi_gdb_test "232-stack-select-frame 1" \
|
||||||
|
"232\\^done" \
|
||||||
|
"stack select frame 1"
|
||||||
|
|
||||||
|
mi_gdb_test "232-stack-list-locals 1" \
|
||||||
|
"232\\^done,locals=\{\}" \
|
||||||
|
"stack locals listing for new frame"
|
||||||
|
|
||||||
|
# this should be a no-op
|
||||||
|
|
||||||
|
mi_gdb_test "232-stack-select-frame" \
|
||||||
|
"232\\^done" \
|
||||||
|
"stack select same frame"
|
||||||
|
|
||||||
|
mi_gdb_test "232-stack-list-locals 1" \
|
||||||
|
"232\\^done,locals=\{\}" \
|
||||||
|
"stack locals for same frame (level 1)"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
test_stack_frame_listing
|
||||||
|
test_stack_args_listing
|
||||||
|
test_stack_locals_listing
|
||||||
|
test_stack_info_depth
|
||||||
|
|
||||||
|
|
||||||
|
mi_gdb_exit
|
||||||
|
return 0
|
||||||
|
|
||||||
|
# Local variables:
|
||||||
|
# change-log-default-name: "ChangeLog-mi"
|
||||||
|
# End:
|
||||||
|
|
110
gdb/testsuite/gdb.mi/mi0-stepi.exp
Normal file
110
gdb/testsuite/gdb.mi/mi0-stepi.exp
Normal file
|
@ -0,0 +1,110 @@
|
||||||
|
# Copyright 1999, 2000 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
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
# The goal is not to
|
||||||
|
# test gdb functionality, which is done by other tests, but to verify
|
||||||
|
# the correct output response to MI operations.
|
||||||
|
#
|
||||||
|
|
||||||
|
load_lib mi-support.exp
|
||||||
|
|
||||||
|
gdb_exit
|
||||||
|
if [mi_gdb_start] {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
set testfile "basics"
|
||||||
|
set srcfile ${testfile}.c
|
||||||
|
set binfile ${objdir}/${subdir}/${testfile}
|
||||||
|
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
|
||||||
|
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
||||||
|
}
|
||||||
|
|
||||||
|
mi_delete_breakpoints
|
||||||
|
mi_gdb_reinitialize_dir $srcdir/$subdir
|
||||||
|
mi_gdb_reinitialize_dir $srcdir/$subdir
|
||||||
|
mi_gdb_load ${binfile}
|
||||||
|
|
||||||
|
proc test_running_to_main {} {
|
||||||
|
global mi_gdb_prompt
|
||||||
|
global hex
|
||||||
|
|
||||||
|
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\"\}" \
|
||||||
|
"break-insert operation"
|
||||||
|
|
||||||
|
mi_run_cmd
|
||||||
|
|
||||||
|
gdb_expect {
|
||||||
|
-re "000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"main\",args=\{\},file=\".*basics.c\",line=\"32\"\}\r\n$mi_gdb_prompt$" {
|
||||||
|
pass "run to main"
|
||||||
|
}
|
||||||
|
timeout {
|
||||||
|
fail "run to main (timeout)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
proc test_stepi_nexti {} {
|
||||||
|
global mi_gdb_prompt
|
||||||
|
global hex
|
||||||
|
|
||||||
|
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=\"0\",frame=\{addr=\"$hex\",func=\"main\",args=\{\},file=\".*basics.c\",line=\"3.\"\}\r\n$mi_gdb_prompt$" {
|
||||||
|
pass "step-instruction at main"
|
||||||
|
}
|
||||||
|
timeout {
|
||||||
|
fail "step-instruction at main (timeout)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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=\"0\",frame=\{addr=\"$hex\",func=\"main\",args=\{\},file=\".*basics.c\",line=\"3.\"\}\r\n$mi_gdb_prompt$" {
|
||||||
|
pass "next-instruction at main"
|
||||||
|
}
|
||||||
|
timeout {
|
||||||
|
fail "next-instruction at main (timeout)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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=\"0\",frame=\{addr=\"$hex\",func=\"main\",args=\{\},file=\".*basics.c\",line=\"3.\"\}\r\n$mi_gdb_prompt$" {
|
||||||
|
pass "next-instruction at main"
|
||||||
|
}
|
||||||
|
timeout {
|
||||||
|
fail "next-instruction at main (timeout)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
test_running_to_main
|
||||||
|
test_stepi_nexti
|
||||||
|
|
||||||
|
mi_gdb_exit
|
||||||
|
return 0
|
||||||
|
|
||||||
|
# Local variables:
|
||||||
|
# change-log-default-name: "ChangeLog-mi"
|
||||||
|
# End:
|
||||||
|
|
127
gdb/testsuite/gdb.mi/mi0-until.exp
Normal file
127
gdb/testsuite/gdb.mi/mi0-until.exp
Normal file
|
@ -0,0 +1,127 @@
|
||||||
|
# Copyright 1999, 2000 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
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# 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-until.
|
||||||
|
|
||||||
|
# The goal is not to
|
||||||
|
# test gdb functionality, which is done by other tests, but to verify
|
||||||
|
# the correct output response to MI operations.
|
||||||
|
#
|
||||||
|
|
||||||
|
load_lib mi-support.exp
|
||||||
|
|
||||||
|
gdb_exit
|
||||||
|
if [mi_gdb_start] {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
set testfile "until"
|
||||||
|
set srcfile ${testfile}.c
|
||||||
|
set binfile ${objdir}/${subdir}/${testfile}
|
||||||
|
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
|
||||||
|
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
||||||
|
}
|
||||||
|
|
||||||
|
mi_delete_breakpoints
|
||||||
|
mi_gdb_reinitialize_dir $srcdir/$subdir
|
||||||
|
mi_gdb_reinitialize_dir $srcdir/$subdir
|
||||||
|
mi_gdb_load ${binfile}
|
||||||
|
|
||||||
|
proc test_running_to_foo {} {
|
||||||
|
global mi_gdb_prompt
|
||||||
|
global hex
|
||||||
|
|
||||||
|
mi_gdb_test "200-break-insert 10" \
|
||||||
|
"200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"foo\",file=\".*until.c\",line=\"10\",times=\"0\"\}" \
|
||||||
|
"break-insert operation"
|
||||||
|
|
||||||
|
mi_run_cmd
|
||||||
|
|
||||||
|
gdb_expect {
|
||||||
|
-re "000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"foo\",args=\{\},file=\".*until.c\",line=\"10\"\}\r\n$mi_gdb_prompt$" {
|
||||||
|
pass "run to main"
|
||||||
|
}
|
||||||
|
timeout {
|
||||||
|
fail "run to main (timeout)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mi_gdb_test "100-break-delete 1" "100\\^done" "break-delete 1"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
proc test_until {} {
|
||||||
|
global mi_gdb_prompt
|
||||||
|
global hex
|
||||||
|
|
||||||
|
send_gdb "111-exec-until\n"
|
||||||
|
gdb_expect {
|
||||||
|
-re "111\\^running\r\n${mi_gdb_prompt}111\\*stopped,reason=\"end-stepping-range\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"foo\",args=\{\},file=\".*until.c\",line=\"12\"\}\r\n$mi_gdb_prompt$" {
|
||||||
|
pass "until after while loop"
|
||||||
|
}
|
||||||
|
timeout {
|
||||||
|
fail "until after while loop (timeout)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
send_gdb "222-exec-until 15\n"
|
||||||
|
gdb_expect {
|
||||||
|
-re "222\\^running\r\n${mi_gdb_prompt}222\\*stopped,reason=\"location-reached\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"foo\",args=\{\},file=\".*until.c\",line=\"15\"\}\r\n$mi_gdb_prompt$" {
|
||||||
|
pass "until line number"
|
||||||
|
}
|
||||||
|
timeout {
|
||||||
|
fail "until line number (timeout)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
send_gdb "333-exec-until until.c:17\n"
|
||||||
|
gdb_expect {
|
||||||
|
-re "333\\^running\r\n${mi_gdb_prompt}333\\*stopped,reason=\"location-reached\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"foo\",args=\{\},file=\".*until.c\",line=\"17\"\}\r\n$mi_gdb_prompt$" {
|
||||||
|
pass "until line number:file"
|
||||||
|
}
|
||||||
|
timeout {
|
||||||
|
fail "until line number:file (timeout)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# This is supposed to NOT stop at line 25. It stops right after foo is over.
|
||||||
|
|
||||||
|
send_gdb "444-exec-until until.c:25\n"
|
||||||
|
gdb_expect {
|
||||||
|
-re "444\\^running\r\n${mi_gdb_prompt}444\\*stopped,reason=\"location-reached\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"main\",args=\{\},file=\".*until.c\",line=\"24\"\}\r\n$mi_gdb_prompt$" {
|
||||||
|
pass "until after current function"
|
||||||
|
}
|
||||||
|
timeout {
|
||||||
|
fail "until after current function (timeout)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
test_running_to_foo
|
||||||
|
test_until
|
||||||
|
|
||||||
|
mi_gdb_exit
|
||||||
|
return 0
|
||||||
|
|
||||||
|
# Local variables:
|
||||||
|
# change-log-default-name: "ChangeLog-mi"
|
||||||
|
# End:
|
233
gdb/testsuite/gdb.mi/mi0-var-block.exp
Normal file
233
gdb/testsuite/gdb.mi/mi0-var-block.exp
Normal file
|
@ -0,0 +1,233 @@
|
||||||
|
# Copyright (C) 1999 2000 s Solutions
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# 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
|
||||||
|
#
|
||||||
|
# Verify that, using the MI, we can create, update, delete variables.
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
load_lib mi-support.exp
|
||||||
|
|
||||||
|
gdb_exit
|
||||||
|
if [mi_gdb_start] {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
set testfile "var-cmd"
|
||||||
|
set srcfile ${testfile}.c
|
||||||
|
set binfile ${objdir}/${subdir}/${testfile}
|
||||||
|
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
|
||||||
|
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
||||||
|
}
|
||||||
|
|
||||||
|
mi_delete_breakpoints
|
||||||
|
mi_gdb_reinitialize_dir $srcdir/$subdir
|
||||||
|
mi_gdb_load ${binfile}
|
||||||
|
|
||||||
|
mi_gdb_test "200-break-insert do_block_tests" \
|
||||||
|
"200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_block_tests\",file=\".*var-cmd.c\",line=\"154\",times=\"0\"\}" \
|
||||||
|
"break-insert operation"
|
||||||
|
|
||||||
|
mi_run_cmd
|
||||||
|
# The running part has been checked already by mi_run_cmd
|
||||||
|
gdb_expect {
|
||||||
|
-re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"do_block_tests\",args=\{\},file=\".*var-cmd.c\",line=\"154\"\}\r\n$mi_gdb_prompt$" {
|
||||||
|
pass "run to do_block_tests"
|
||||||
|
}
|
||||||
|
-re ".*$mi_gdb_prompt$" {fail "run to do_block_tests (2)"}
|
||||||
|
timeout {fail "run to do_block_tests (timeout 2)"}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Test: c_variable-3.2
|
||||||
|
# Desc: create cb and foo
|
||||||
|
mi_gdb_test "-var-create cb * cb" \
|
||||||
|
"\\^done,name=\"cb\",numchild=\"0\",type=\"int\"" \
|
||||||
|
"create local variable cb"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-create foo * foo" \
|
||||||
|
"&\"mi_cmd_var_create: unable to create variable object\\\\n\".*\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
|
||||||
|
"create local variable foo"
|
||||||
|
|
||||||
|
# step to "foo = 123;"
|
||||||
|
send_gdb "-exec-step\n"
|
||||||
|
gdb_expect {
|
||||||
|
-re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"do_block_tests\",args=\{\},file=\".*var-cmd.c\",line=\"158\"\}\r\n$mi_gdb_prompt$" {
|
||||||
|
pass "step at do_block_tests"
|
||||||
|
}
|
||||||
|
timeout {
|
||||||
|
fail "step at do_block_tests (timeout)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Be paranoid and assume 3.2 created foo
|
||||||
|
mi_gdb_test "-var-delete foo" \
|
||||||
|
"&\"Variable object not found\\\\n\".*\\^error,msg=\"Variable object not found\"" \
|
||||||
|
"delete var foo"
|
||||||
|
|
||||||
|
|
||||||
|
# Test: c_variable-3.3
|
||||||
|
# Desc: create foo
|
||||||
|
mi_gdb_test "-var-create foo * foo" \
|
||||||
|
"\\^done,name=\"foo\",numchild=\"0\",type=\"int\"" \
|
||||||
|
"create local variable foo"
|
||||||
|
|
||||||
|
# step to "foo2 = 123;"
|
||||||
|
send_gdb "-exec-step\n"
|
||||||
|
gdb_expect {
|
||||||
|
-re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"do_block_tests\",args=\{\},file=\".*var-cmd.c\",line=\"161\"\}\r\n$mi_gdb_prompt$" {
|
||||||
|
pass "step at do_block_tests"
|
||||||
|
}
|
||||||
|
timeout {
|
||||||
|
fail "step at do_block_tests (timeout)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Test: c_variable-3.4
|
||||||
|
# Desc: check foo, cb changed
|
||||||
|
mi_gdb_test "-var-update *" \
|
||||||
|
"\\^done,changelist=\{name=\"foo\",in_scope=\"true\",type_changed=\"false\",name=\"cb\",in_scope=\"true\",type_changed=\"false\"\}" \
|
||||||
|
"update all vars: cb foo changed"
|
||||||
|
|
||||||
|
# step to "foo = 321;"
|
||||||
|
send_gdb "-exec-step\n"
|
||||||
|
gdb_expect {
|
||||||
|
-re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"do_block_tests\",args=\{\},file=\".*var-cmd.c\",line=\"164\"\}\r\n$mi_gdb_prompt$" {
|
||||||
|
pass "step at do_block_tests"
|
||||||
|
}
|
||||||
|
timeout {
|
||||||
|
fail "step at do_block_tests (timeout)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Test: c_variable-3.5
|
||||||
|
# Desc: create inner block foo
|
||||||
|
mi_gdb_test "-var-create inner_foo * foo" \
|
||||||
|
"\\^done,name=\"inner_foo\",numchild=\"0\",type=\"int\"" \
|
||||||
|
"create local variable inner_foo"
|
||||||
|
|
||||||
|
# step to "foo2 = 0;"
|
||||||
|
send_gdb "-exec-step\n"
|
||||||
|
gdb_expect {
|
||||||
|
-re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"do_block_tests\",args=\{\},file=\".*var-cmd.c\",line=\"166\"\}\r\n$mi_gdb_prompt$" {
|
||||||
|
pass "step at do_block_tests"
|
||||||
|
}
|
||||||
|
timeout { fail "step at do_block_tests (timeout)" }
|
||||||
|
}
|
||||||
|
|
||||||
|
# Test: c_variable-3.6
|
||||||
|
# Desc: create foo2
|
||||||
|
mi_gdb_test "-var-create foo2 * foo2" \
|
||||||
|
"\\^done,name=\"foo2\",numchild=\"0\",type=\"int\"" \
|
||||||
|
"create local variable foo2"
|
||||||
|
|
||||||
|
# Test: c_variable-3.7
|
||||||
|
# Desc: check that outer foo in scope and inner foo out of scope
|
||||||
|
# Note: also a known gdb problem
|
||||||
|
setup_xfail *-*-*
|
||||||
|
mi_gdb_test "-var-update inner_foo" \
|
||||||
|
"\\^done,changelist=\{FIXME\}" \
|
||||||
|
"update inner_foo: should be out of scope: KNOWN PROBLEM"
|
||||||
|
clear_xfail *-*-*
|
||||||
|
|
||||||
|
setup_xfail *-*-*
|
||||||
|
mi_gdb_test "-var-evaluate-expression inner_foo" \
|
||||||
|
"\\^done,value=\{FIXME\}" \
|
||||||
|
"evaluate inner_foo: should be out of scope: KNOWN PROBLEM"
|
||||||
|
clear_xfail *-*-*
|
||||||
|
|
||||||
|
mi_gdb_test "-var-update foo" \
|
||||||
|
"\\^done,changelist=\{\}" \
|
||||||
|
"update foo: did not change"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-delete inner_foo" \
|
||||||
|
"\\^done,ndeleted=\"1\"" \
|
||||||
|
"delete var inner_foo"
|
||||||
|
|
||||||
|
# step to "foo = 0;"
|
||||||
|
send_gdb "-exec-step\n"
|
||||||
|
gdb_expect {
|
||||||
|
-re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"do_block_tests\",args=\{\},file=\".*var-cmd.c\",line=\"168\"\}\r\n$mi_gdb_prompt$" {
|
||||||
|
pass "step at do_block_tests"
|
||||||
|
}
|
||||||
|
timeout { fail "step at do_block_tests (timeout)" }
|
||||||
|
}
|
||||||
|
|
||||||
|
# Test: c_variable-3.8
|
||||||
|
# Desc: check that foo2 out of scope (known gdb problem)
|
||||||
|
setup_xfail *-*-*
|
||||||
|
mi_gdb_test "-var-update foo2" \
|
||||||
|
"\\^done,changelist=\{FIXME\}" \
|
||||||
|
"update foo2: should be out of scope: KNOWN PROBLEM"
|
||||||
|
clear_xfail *-*-*
|
||||||
|
|
||||||
|
# step to "cb = 21;"
|
||||||
|
send_gdb "-exec-step\n"
|
||||||
|
gdb_expect {
|
||||||
|
-re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"do_block_tests\",args=\{\},file=\".*var-cmd.c\",line=\"171\"\}\r\n$mi_gdb_prompt$" {
|
||||||
|
pass "step at do_block_tests"
|
||||||
|
}
|
||||||
|
timeout { fail "step at do_block_tests (timeout)" }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Test: c_variable-3.9
|
||||||
|
# Desc: check that only cb is in scope (known gdb problem)
|
||||||
|
setup_xfail *-*-*
|
||||||
|
mi_gdb_test "-var-update foo2" \
|
||||||
|
"\\^done,changelist=\{FIXME\}" \
|
||||||
|
"update foo2 should be out of scope: KNOWN PROBLEM"
|
||||||
|
clear_xfail *-*-*
|
||||||
|
setup_xfail *-*-*
|
||||||
|
mi_gdb_test "-var-update foo" \
|
||||||
|
"\\^done,changelist=\{FIXME\}" \
|
||||||
|
"update foo should be out of scope: KNOWN PROBLEM"
|
||||||
|
clear_xfail *-*-*
|
||||||
|
mi_gdb_test "-var-update cb" \
|
||||||
|
"\\^done,changelist=\{\}" \
|
||||||
|
"update cb"
|
||||||
|
|
||||||
|
# Test: c_variable-3.10
|
||||||
|
# Desc: names of editable variables
|
||||||
|
#gdbtk_test c_variable-3.10 {names of editable variables} {
|
||||||
|
# editable_variables
|
||||||
|
#} {{foo cb foo2} {}}
|
||||||
|
|
||||||
|
# Done with block tests
|
||||||
|
mi_gdb_test "-var-delete foo" \
|
||||||
|
"\\^done,ndeleted=\"1\"" \
|
||||||
|
"delete var foo"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-delete foo2" \
|
||||||
|
"\\^done,ndeleted=\"1\"" \
|
||||||
|
"delete var foo2"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-delete cb" \
|
||||||
|
"\\^done,ndeleted=\"1\"" \
|
||||||
|
"delete var cb"
|
||||||
|
|
||||||
|
mi_gdb_exit
|
||||||
|
return 0
|
||||||
|
|
||||||
|
# Local variables:
|
||||||
|
# change-log-default-name: "ChangeLog-mi"
|
||||||
|
# End:
|
||||||
|
|
||||||
|
|
1334
gdb/testsuite/gdb.mi/mi0-var-child.exp
Normal file
1334
gdb/testsuite/gdb.mi/mi0-var-child.exp
Normal file
File diff suppressed because it is too large
Load diff
609
gdb/testsuite/gdb.mi/mi0-var-cmd.exp
Normal file
609
gdb/testsuite/gdb.mi/mi0-var-cmd.exp
Normal file
|
@ -0,0 +1,609 @@
|
||||||
|
# Copyright (C) 1999 2000 Cygnus Solutions
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# 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
|
||||||
|
#
|
||||||
|
# Verify that, using the MI, we can create, update, delete variables.
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
load_lib mi-support.exp
|
||||||
|
|
||||||
|
gdb_exit
|
||||||
|
if [mi_gdb_start] {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
set testfile "var-cmd"
|
||||||
|
set srcfile ${testfile}.c
|
||||||
|
set binfile ${objdir}/${subdir}/${testfile}
|
||||||
|
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
|
||||||
|
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
||||||
|
}
|
||||||
|
|
||||||
|
mi_delete_breakpoints
|
||||||
|
mi_gdb_reinitialize_dir $srcdir/$subdir
|
||||||
|
mi_gdb_load ${binfile}
|
||||||
|
|
||||||
|
|
||||||
|
##### #####
|
||||||
|
# #
|
||||||
|
# Variable Creation tests #
|
||||||
|
# #
|
||||||
|
##### #####
|
||||||
|
|
||||||
|
# Test: c_variable-1.1
|
||||||
|
# Desc: Create global variable
|
||||||
|
|
||||||
|
mi_gdb_test "111-var-create global_simple * global_simple" \
|
||||||
|
"111\\^done,name=\"global_simple\",numchild=\"6\",type=\"simpleton\"" \
|
||||||
|
"create global variable"
|
||||||
|
|
||||||
|
# Test: c_variable-1.2
|
||||||
|
# Desc: Create non-existent variable
|
||||||
|
|
||||||
|
mi_gdb_test "112-var-create bogus_unknown_variable * bogus_unknown_variable" \
|
||||||
|
"&\"mi_cmd_var_create: unable to create variable object\\\\n\".*112\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
|
||||||
|
"create non-existent variable"
|
||||||
|
|
||||||
|
# Test: c_variable-1.3
|
||||||
|
# Desc: Create out of scope variable
|
||||||
|
|
||||||
|
mi_gdb_test "113-var-create argc * argc" \
|
||||||
|
"&\"mi_cmd_var_create: unable to create variable object\\\\n\".*113\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
|
||||||
|
"create out of scope variable"
|
||||||
|
|
||||||
|
mi_gdb_test "200-break-insert do_locals_tests" \
|
||||||
|
"200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_locals_tests\",file=\".*var-cmd.c\",line=\"106\",times=\"0\"\}" \
|
||||||
|
"break-insert operation"
|
||||||
|
|
||||||
|
mi_run_cmd
|
||||||
|
# The running part has been checked already by mi_run_cmd
|
||||||
|
gdb_expect {
|
||||||
|
-re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"do_locals_tests\",args=\{\},file=\".*var-cmd.c\",line=\"106\"\}\r\n$mi_gdb_prompt$" {
|
||||||
|
pass "run to do_locals_tests"
|
||||||
|
}
|
||||||
|
-re ".*$mi_gdb_prompt$" {fail "run todo_locals_tests (2)"}
|
||||||
|
timeout {fail "run to do_locals_tests (timeout 2)"}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Test: c_variable-1.4
|
||||||
|
# Desc: create local variables
|
||||||
|
|
||||||
|
mi_gdb_test "-var-create linteger * linteger" \
|
||||||
|
"\\^done,name=\"linteger\",numchild=\"0\",type=\"int\"" \
|
||||||
|
"create local variable linteger"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-create lpinteger * lpinteger" \
|
||||||
|
"\\^done,name=\"lpinteger\",numchild=\"1\",type=\"int \\*\"" \
|
||||||
|
"create local variable lpinteger"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-create lcharacter * lcharacter" \
|
||||||
|
"\\^done,name=\"lcharacter\",numchild=\"0\",type=\"char\"" \
|
||||||
|
"create local variablelcharacter "
|
||||||
|
|
||||||
|
mi_gdb_test "-var-create lpcharacter * lpcharacter" \
|
||||||
|
"\\^done,name=\"lpcharacter\",numchild=\"0\",type=\"char \\*\"" \
|
||||||
|
"create local variable lpcharacter"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-create llong * llong" \
|
||||||
|
"\\^done,name=\"llong\",numchild=\"0\",type=\"long int\"" \
|
||||||
|
"create local variable llong"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-create lplong * lplong" \
|
||||||
|
"\\^done,name=\"lplong\",numchild=\"1\",type=\"long int \\*\"" \
|
||||||
|
"create local variable lplong"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-create lfloat * lfloat" \
|
||||||
|
"\\^done,name=\"lfloat\",numchild=\"0\",type=\"float\"" \
|
||||||
|
"create local variable lfloat"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-create lpfloat * lpfloat" \
|
||||||
|
"\\^done,name=\"lpfloat\",numchild=\"1\",type=\"float \\*\"" \
|
||||||
|
"create local variable lpfloat"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-create ldouble * ldouble" \
|
||||||
|
"\\^done,name=\"ldouble\",numchild=\"0\",type=\"double\"" \
|
||||||
|
"create local variable ldouble"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-create lpdouble * lpdouble" \
|
||||||
|
"\\^done,name=\"lpdouble\",numchild=\"1\",type=\"double \\*\"" \
|
||||||
|
"create local variable lpdouble"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-create lsimple * lsimple" \
|
||||||
|
"\\^done,name=\"lsimple\",numchild=\"6\",type=\"struct _simple_struct\"" \
|
||||||
|
"create local variable lsimple"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-create lpsimple * lpsimple" \
|
||||||
|
"\\^done,name=\"lpsimple\",numchild=\"6\",type=\"struct _simple_struct \\*\"" \
|
||||||
|
"create local variable lpsimple"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-create func * func" \
|
||||||
|
"\\^done,name=\"func\",numchild=\"0\",type=\"void \\(\\*\\)\\(\\)\"" \
|
||||||
|
"create local variable func"
|
||||||
|
|
||||||
|
# Test: c_variable-1.5
|
||||||
|
# Desc: create lsimple.character
|
||||||
|
mi_gdb_test "-var-create lsimple.character * lsimple.character" \
|
||||||
|
"\\^done,name=\"lsimple.character\",numchild=\"0\",type=\"char\"" \
|
||||||
|
"create lsimple.character"
|
||||||
|
|
||||||
|
# Test: c_variable-1.6
|
||||||
|
# Desc: create lpsimple->integer
|
||||||
|
mi_gdb_test "-var-create lsimple->integer * lsimple->integer" \
|
||||||
|
"\\^done,name=\"lsimple->integer\",numchild=\"0\",type=\"int\"" \
|
||||||
|
"create lsimple->integer"
|
||||||
|
|
||||||
|
# Test: c_variable-1.7
|
||||||
|
# Desc: ceate lsimple.integer
|
||||||
|
mi_gdb_test "-var-create lsimple.integer * lsimple.integer" \
|
||||||
|
"\\^done,name=\"lsimple.integer\",numchild=\"0\",type=\"int\"" \
|
||||||
|
"create lsimple->integer"
|
||||||
|
|
||||||
|
|
||||||
|
# Test: c_variable-1.9
|
||||||
|
# Desc: create type name
|
||||||
|
# Type names (like int, long, etc..) are all proper expressions to gdb.
|
||||||
|
# make sure variable code does not allow users to create variables, though.
|
||||||
|
mi_gdb_test "-var-create int * int" \
|
||||||
|
"&\"Attempt to use a type name as an expression.mi_cmd_var_create: unable to create variable object\\\\n\".*\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
|
||||||
|
"create int"
|
||||||
|
|
||||||
|
|
||||||
|
##### #####
|
||||||
|
# #
|
||||||
|
# Value changed tests #
|
||||||
|
# #
|
||||||
|
##### #####
|
||||||
|
|
||||||
|
# Test: c_variable-2.1
|
||||||
|
# Desc: check whether values changed at do_block_tests
|
||||||
|
mi_gdb_test "-var-update *" \
|
||||||
|
"\\^done,changelist=\{\}" \
|
||||||
|
"update all vars"
|
||||||
|
|
||||||
|
# Step over "linteger = 1234;"
|
||||||
|
send_gdb "-exec-step\n"
|
||||||
|
gdb_expect {
|
||||||
|
-re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"do_locals_tests\",args=\{\},file=\".*var-cmd.c\",line=\"107\"\}\r\n$mi_gdb_prompt$" {
|
||||||
|
pass "step at do_locals_tests"
|
||||||
|
}
|
||||||
|
timeout {
|
||||||
|
fail "step at do_locals_tests (timeout)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Test: c_variable-2.2
|
||||||
|
# Desc: check whether only linteger changed values
|
||||||
|
mi_gdb_test "-var-update *" \
|
||||||
|
"\\^done,changelist=\{name=\"linteger\",in_scope=\"true\",type_changed=\"false\"\}" \
|
||||||
|
"update all vars: linteger changed"
|
||||||
|
|
||||||
|
# Step over "lpinteger = &linteger;"
|
||||||
|
send_gdb "-exec-step\n"
|
||||||
|
gdb_expect {
|
||||||
|
-re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"do_locals_tests\",args=\{\},file=\".*var-cmd.c\",line=\"108\"\}\r\n$mi_gdb_prompt$" {
|
||||||
|
pass "step at do_locals_tests"
|
||||||
|
}
|
||||||
|
timeout {
|
||||||
|
fail "step at do_locals_tests (timeout)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Test: c_variable-2.3
|
||||||
|
# Desc: check whether only lpinteger changed
|
||||||
|
mi_gdb_test "-var-update *" \
|
||||||
|
"\\^done,changelist=\{name=\"lpinteger\",in_scope=\"true\",type_changed=\"false\"\}" \
|
||||||
|
"update all vars: lpinteger changed"
|
||||||
|
|
||||||
|
# Step over "lcharacter = 'a';"
|
||||||
|
send_gdb "-exec-step\n"
|
||||||
|
gdb_expect {
|
||||||
|
-re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"do_locals_tests\",args=\{\},file=\".*var-cmd.c\",line=\"109\"\}\r\n$mi_gdb_prompt$" {
|
||||||
|
pass "step at do_locals_tests"
|
||||||
|
}
|
||||||
|
timeout {
|
||||||
|
fail "step at do_locals_tests (timeout)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Test: c_variable-2.4
|
||||||
|
# Desc: check whether only lcharacter changed
|
||||||
|
mi_gdb_test "-var-update *" \
|
||||||
|
"\\^done,changelist=\{name=\"lcharacter\",in_scope=\"true\",type_changed=\"false\"\}" \
|
||||||
|
"update all vars: lcharacter changed"
|
||||||
|
|
||||||
|
# Step over "lpcharacter = &lcharacter;"
|
||||||
|
send_gdb "-exec-step\n"
|
||||||
|
gdb_expect {
|
||||||
|
-re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"do_locals_tests\",args=\{\},file=\".*var-cmd.c\",line=\"110\"\}\r\n$mi_gdb_prompt$" {
|
||||||
|
pass "step at do_locals_tests"
|
||||||
|
}
|
||||||
|
timeout {
|
||||||
|
fail "step at do_locals_tests (timeout)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Test: c_variable-2.5
|
||||||
|
# Desc: check whether only lpcharacter changed
|
||||||
|
mi_gdb_test "-var-update *" \
|
||||||
|
"\\^done,changelist=\{name=\"lpcharacter\",in_scope=\"true\",type_changed=\"false\"\}" \
|
||||||
|
"update all vars: lpcharacter changed"
|
||||||
|
|
||||||
|
|
||||||
|
# Step over:
|
||||||
|
# llong = 2121L;
|
||||||
|
# lplong = &llong;
|
||||||
|
# lfloat = 2.1;
|
||||||
|
# lpfloat = &lfloat;
|
||||||
|
# ldouble = 2.718281828459045;
|
||||||
|
# lpdouble = &ldouble;
|
||||||
|
# lsimple.integer = 1234;
|
||||||
|
# lsimple.unsigned_integer = 255;
|
||||||
|
# lsimple.character = 'a';
|
||||||
|
|
||||||
|
send_gdb "-exec-step 9\n"
|
||||||
|
gdb_expect {
|
||||||
|
-re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"do_locals_tests\",args=\{\},file=\".*var-cmd.c\",line=\"119\"\}\r\n$mi_gdb_prompt$" {
|
||||||
|
pass "step at do_locals_tests"
|
||||||
|
}
|
||||||
|
timeout {
|
||||||
|
fail "step at do_locals_tests (timeout)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Test: c_variable-2.6
|
||||||
|
# Desc: check whether llong, lplong, lfloat, lpfloat, ldouble, lpdouble, lsimple.integer,
|
||||||
|
# lsimple.unsigned_character lsimple.integer lsimple.character changed
|
||||||
|
mi_gdb_test "-var-update *" \
|
||||||
|
"\\^done,changelist=\{name=\"lsimple.integer\",in_scope=\"true\",type_changed=\"false\",name=\"lsimple->integer\",in_scope=\"true\",type_changed=\"false\",name=\"lsimple.character\",in_scope=\"true\",type_changed=\"false\",name=\"lpdouble\",in_scope=\"true\",type_changed=\"false\",name=\"ldouble\",in_scope=\"true\",type_changed=\"false\",name=\"lpfloat\",in_scope=\"true\",type_changed=\"false\",name=\"lfloat\",in_scope=\"true\",type_changed=\"false\",name=\"lplong\",in_scope=\"true\",type_changed=\"false\",name=\"llong\",in_scope=\"true\",type_changed=\"false\"\}" \
|
||||||
|
"update all vars: many changed"
|
||||||
|
|
||||||
|
# Step over:
|
||||||
|
# lsimple.signed_character = 21;
|
||||||
|
# lsimple.char_ptr = &lcharacter;
|
||||||
|
# lpsimple = &lsimple;
|
||||||
|
# func = nothing;
|
||||||
|
|
||||||
|
send_gdb "-exec-step 4\n"
|
||||||
|
gdb_expect {
|
||||||
|
-re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"do_locals_tests\",args=\{\},file=\".*var-cmd.c\",line=\"125\"\}\r\n$mi_gdb_prompt$" {
|
||||||
|
pass "step at do_locals_tests"
|
||||||
|
}
|
||||||
|
timeout {
|
||||||
|
fail "step at do_locals_tests (timeout)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Test: c_variable-2.7
|
||||||
|
# Desc: check whether (lsimple.signed_character, lsimple.char_ptr) lpsimple, func changed
|
||||||
|
mi_gdb_test "-var-update *" \
|
||||||
|
"\\^done,changelist=\{name=\"func\",in_scope=\"true\",type_changed=\"false\",name=\"lpsimple\",in_scope=\"true\",type_changed=\"false\"\}" \
|
||||||
|
"update all vars: func and lpsimple changed"
|
||||||
|
|
||||||
|
# Step over
|
||||||
|
# linteger = 4321;
|
||||||
|
# lcharacter = 'b';
|
||||||
|
# llong = 1212L;
|
||||||
|
# lfloat = 1.2;
|
||||||
|
# ldouble = 5.498548281828172;
|
||||||
|
# lsimple.integer = 255;
|
||||||
|
# lsimple.unsigned_integer = 4321;
|
||||||
|
# lsimple.character = 'b';
|
||||||
|
|
||||||
|
send_gdb "-exec-step 8\n"
|
||||||
|
gdb_expect {
|
||||||
|
-re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"do_locals_tests\",args=\{\},file=\".*var-cmd.c\",line=\"133\"\}\r\n$mi_gdb_prompt$" {
|
||||||
|
pass "step at do_locals_tests"
|
||||||
|
}
|
||||||
|
timeout {
|
||||||
|
fail "step at do_locals_tests (timeout)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Test: c_variable-2.8
|
||||||
|
# Desc: check whether linteger, lcharacter, llong, lfoat, ldouble, lsimple.integer,
|
||||||
|
# lpsimple.integer lsimple.character changed
|
||||||
|
# Note: this test also checks that lpsimple->integer and lsimple.integer have
|
||||||
|
# changed (they are the same)
|
||||||
|
mi_gdb_test "-var-update *" \
|
||||||
|
"\\^done,changelist=\{name=\"lsimple.integer\",in_scope=\"true\",type_changed=\"false\",name=\"lsimple->integer\",in_scope=\"true\",type_changed=\"false\",name=\"lsimple.character\",in_scope=\"true\",type_changed=\"false\",name=\"ldouble\",in_scope=\"true\",type_changed=\"false\",name=\"lfloat\",in_scope=\"true\",type_changed=\"false\",name=\"llong\",in_scope=\"true\",type_changed=\"false\",name=\"lcharacter\",in_scope=\"true\",type_changed=\"false\",name=\"linteger\",in_scope=\"true\",type_changed=\"false\"\}" \
|
||||||
|
"update all vars: func and lpsimple changed"
|
||||||
|
|
||||||
|
|
||||||
|
###
|
||||||
|
#
|
||||||
|
# Test assignment to variables. More tests on assignment are in other files.
|
||||||
|
#
|
||||||
|
###
|
||||||
|
mi_gdb_test "-var-assign global_simple 0" \
|
||||||
|
"&\"mi_cmd_var_assign: Variable object is not editable\\\\n\".*\\^error,msg=\"mi_cmd_var_assign: Variable object is not editable\"" \
|
||||||
|
"assign to global_simple"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-assign linteger 3333" \
|
||||||
|
"\\^done,value=\"3333\"" \
|
||||||
|
"assign to linteger"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-evaluate-expression linteger" \
|
||||||
|
"\\^done,value=\"3333\"" \
|
||||||
|
"eval linteger"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-assign lpinteger \"&linteger + 3\"" \
|
||||||
|
"\\^done,value=\"$hex\"" \
|
||||||
|
"assign to lpinteger"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-evaluate-expression lpinteger" \
|
||||||
|
"\\^done,value=\"$hex\"" \
|
||||||
|
"eval lpinteger"
|
||||||
|
|
||||||
|
# reset the values to the original ones so that the rest of the file doesn't suffer.
|
||||||
|
|
||||||
|
mi_gdb_test "-var-assign linteger 4321" \
|
||||||
|
"\\^done,value=\"4321\"" \
|
||||||
|
"assign to linteger"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-assign lpinteger &linteger" \
|
||||||
|
"\\^done,value=\"$hex\"" \
|
||||||
|
"assign to lpinteger"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-assign lcharacter 'z'" \
|
||||||
|
"\\^done,value=\"122 'z'\"" \
|
||||||
|
"assign to lcharacter"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-evaluate-expression lcharacter" \
|
||||||
|
"\\^done,value=\"122 'z'\"" \
|
||||||
|
"eval lcharacter"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-assign llong 1313L" \
|
||||||
|
"\\^done,value=\"1313\"" \
|
||||||
|
"assign to llong"
|
||||||
|
mi_gdb_test "-var-evaluate-expression llong" \
|
||||||
|
"\\^done,value=\"1313\"" \
|
||||||
|
"eval llong"
|
||||||
|
mi_gdb_test "-var-assign llong 1212L" \
|
||||||
|
"\\^done,value=\"1212\"" \
|
||||||
|
"assign to llong"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-assign lplong &llong+4" \
|
||||||
|
"\\^done,value=\"$hex\"" \
|
||||||
|
"assign to lplong"
|
||||||
|
mi_gdb_test "-var-evaluate-expression lplong" \
|
||||||
|
"\\^done,value=\"$hex\"" \
|
||||||
|
"eval lplong"
|
||||||
|
mi_gdb_test "-var-assign lplong &llong" \
|
||||||
|
"\\^done,value=\"$hex\"" \
|
||||||
|
"assign to lplong"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-assign lfloat 3.4" \
|
||||||
|
"\\^done,value=\"3.4.*\"" \
|
||||||
|
"assign to lfloat"
|
||||||
|
mi_gdb_test "-var-evaluate-expression lfloat" \
|
||||||
|
"\\^done,value=\"3.4.*\"" \
|
||||||
|
"eval lfloat"
|
||||||
|
mi_gdb_test "-var-assign lfloat 1.2" \
|
||||||
|
"\\^done,value=\"1.2.*\"" \
|
||||||
|
"assign to lfloat"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-assign lpfloat &lfloat+4" \
|
||||||
|
"\\^done,value=\"$hex\"" \
|
||||||
|
"assign to lpfloat"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-assign ldouble 5.333318284590435" \
|
||||||
|
"\\^done,value=\"5.333318284590435\"" \
|
||||||
|
"assign to ldouble"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-assign func do_block_tests" \
|
||||||
|
"\\^done,value=\"$hex <do_block_tests>\"" \
|
||||||
|
"assign to func"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-assign lsimple.character 'd'" \
|
||||||
|
"\\^done,value=\"100 'd'\"" \
|
||||||
|
"assign to lsimple.character"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-assign lsimple->integer 222" \
|
||||||
|
"\\^done,value=\"222\"" \
|
||||||
|
"assign to lsimple->integer"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-assign lsimple.integer 333" \
|
||||||
|
"\\^done,value=\"333\"" \
|
||||||
|
"assign to lsimple.integer"
|
||||||
|
|
||||||
|
######
|
||||||
|
# End of assign tests
|
||||||
|
#####
|
||||||
|
|
||||||
|
mi_gdb_test "-break-insert subroutine1" \
|
||||||
|
"\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"subroutine1\",file=\".*var-cmd.c\",line=\"146\",times=\"0\"\}" \
|
||||||
|
"break-insert subroutine1"
|
||||||
|
send_gdb "-exec-continue\n"
|
||||||
|
gdb_expect {
|
||||||
|
-re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"breakpoint-hit\",bkptno=\"2\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"subroutine1\",args=\{\{name=\"i\",value=\"4321\"\},\{name=\"l\",value=\"$hex\"\}\},file=\".*var-cmd.c\",line=\"146\"\}\r\n$mi_gdb_prompt$" {
|
||||||
|
pass "continue to subroutine1"
|
||||||
|
}
|
||||||
|
timeout {
|
||||||
|
fail "continue to subroutine1 (timeout)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Test: c_variable-2.10
|
||||||
|
# Desc: create variable for locals i,l in subroutine1
|
||||||
|
mi_gdb_test "-var-create i * i" \
|
||||||
|
"\\^done,name=\"i\",numchild=\"0\",type=\"int\"" \
|
||||||
|
"create i"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-create l * l" \
|
||||||
|
"\\^done,name=\"l\",numchild=\"1\",type=\"long int \\*\"" \
|
||||||
|
"create l"
|
||||||
|
|
||||||
|
# Test: c_variable-2.11
|
||||||
|
# Desc: create do_locals_tests local in subroutine1
|
||||||
|
mi_gdb_test "-var-create linteger * linteger" \
|
||||||
|
"&\"mi_cmd_var_create: unable to create variable object\\\\n\".*\\^error,msg=\"mi_cmd_var_create: unable to create variable object\"" \
|
||||||
|
"create linteger"
|
||||||
|
|
||||||
|
send_gdb "-exec-step\n"
|
||||||
|
gdb_expect {
|
||||||
|
-re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"subroutine1\",args=\{\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}\},file=\".*var-cmd.c\",line=\"147\"\}\r\n$mi_gdb_prompt$" {
|
||||||
|
pass "step at subroutine1"
|
||||||
|
}
|
||||||
|
timeout {
|
||||||
|
fail "step at subroutine1 (timeout)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Test: c_variable-2.12
|
||||||
|
# Desc: change global_simple.integer
|
||||||
|
# Note: This also tests whether we are reporting changes in structs properly.
|
||||||
|
# gdb normally would say that global_simple has changed, but we
|
||||||
|
# special case that, since it is not what a human expects to
|
||||||
|
# see.
|
||||||
|
|
||||||
|
setup_xfail *-*-*
|
||||||
|
mi_gdb_test "-var-update *" \
|
||||||
|
"\\^done,changelist=\{FIXME: WHAT IS CORRECT HERE\}" \
|
||||||
|
"update all vars: changed FIXME"
|
||||||
|
clear_xfail *-*-*
|
||||||
|
|
||||||
|
send_gdb "-exec-step\n"
|
||||||
|
gdb_expect {
|
||||||
|
-re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"subroutine1\",args=\{\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}\},file=\".*var-cmd.c\",line=\"148\"\}\r\n$mi_gdb_prompt$" {
|
||||||
|
pass "step at subroutine1"
|
||||||
|
}
|
||||||
|
timeout { fail "step at subroutine1 (timeout)" }
|
||||||
|
}
|
||||||
|
|
||||||
|
# Test: c_variable-2.13
|
||||||
|
# Desc: change subroutine1 local i
|
||||||
|
mi_gdb_test "-var-update *" \
|
||||||
|
"\\^done,changelist=\{name=\"i\",in_scope=\"true\",type_changed=\"false\"\}" \
|
||||||
|
"update all vars: i changed"
|
||||||
|
|
||||||
|
send_gdb "-exec-step\n"
|
||||||
|
gdb_expect {
|
||||||
|
-re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"subroutine1\",args=\{\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}\},file=\".*var-cmd.c\",line=\"149\"\}\r\n$mi_gdb_prompt$" {
|
||||||
|
pass "step at subroutine1"
|
||||||
|
}
|
||||||
|
timeout { fail "step at subroutine1 (timeout)" }
|
||||||
|
}
|
||||||
|
|
||||||
|
# Test: c_variable-2.14
|
||||||
|
# Desc: change do_locals_tests local llong
|
||||||
|
mi_gdb_test "-var-update *" \
|
||||||
|
"\\^done,changelist=\{name=\"llong\",in_scope=\"true\",type_changed=\"false\"\}" \
|
||||||
|
"update all vars: llong changed"
|
||||||
|
|
||||||
|
send_gdb "-exec-next\n"
|
||||||
|
gdb_expect {
|
||||||
|
-re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"do_locals_tests\",args=\{\},file=\".*var-cmd.c\",line=\"136\"\}\r\n$mi_gdb_prompt$" {
|
||||||
|
pass "next out of subroutine1"
|
||||||
|
}
|
||||||
|
timeout { fail "next out of subroutine1 (timeout)" }
|
||||||
|
}
|
||||||
|
|
||||||
|
# Test: c_variable-2.15
|
||||||
|
# Desc: check for out of scope subroutine1 locals
|
||||||
|
mi_gdb_test "-var-update *" \
|
||||||
|
"\\^done,changelist=\{name=\"l\",in_scope=\"false\",name=\"i\",in_scope=\"false\"\}" \
|
||||||
|
"update all vars: all now out of scope"
|
||||||
|
|
||||||
|
# Done with locals/globals tests. Erase all variables
|
||||||
|
#delete_all_variables
|
||||||
|
mi_gdb_test "-var-delete global_simple" \
|
||||||
|
"\\^done,ndeleted=\"1\"" \
|
||||||
|
"delete var"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-delete linteger" \
|
||||||
|
"\\^done,ndeleted=\"1\"" \
|
||||||
|
"delete var linteger"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-delete lpinteger" \
|
||||||
|
"\\^done,ndeleted=\"1\"" \
|
||||||
|
"delete var lpinteger"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-delete lcharacter" \
|
||||||
|
"\\^done,ndeleted=\"1\"" \
|
||||||
|
"delete var lcharacter"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-delete lpcharacter" \
|
||||||
|
"\\^done,ndeleted=\"1\"" \
|
||||||
|
"delete var lpcharacter"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-delete llong" \
|
||||||
|
"\\^done,ndeleted=\"1\"" \
|
||||||
|
"delete var llong"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-delete lplong" \
|
||||||
|
"\\^done,ndeleted=\"1\"" \
|
||||||
|
"delete var lplong"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-delete lfloat" \
|
||||||
|
"\\^done,ndeleted=\"1\"" \
|
||||||
|
"delete var lfloat"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-delete lpfloat" \
|
||||||
|
"\\^done,ndeleted=\"1\"" \
|
||||||
|
"delete var lpfloat"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-delete ldouble" \
|
||||||
|
"\\^done,ndeleted=\"1\"" \
|
||||||
|
"delete var ldouble"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-delete lpdouble" \
|
||||||
|
"\\^done,ndeleted=\"1\"" \
|
||||||
|
"delete var lpdouble"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-delete lsimple" \
|
||||||
|
"\\^done,ndeleted=\"1\"" \
|
||||||
|
"delete var lsimple"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-delete lpsimple" \
|
||||||
|
"\\^done,ndeleted=\"1\"" \
|
||||||
|
"delete var lpsimple"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-delete func" \
|
||||||
|
"\\^done,ndeleted=\"1\"" \
|
||||||
|
"delete var func"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-delete lsimple.character" \
|
||||||
|
"\\^done,ndeleted=\"1\"" \
|
||||||
|
"delete var lsimple.character"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-delete lsimple->integer" \
|
||||||
|
"\\^done,ndeleted=\"1\"" \
|
||||||
|
"delete var lsimple->integer"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-delete lsimple.integer" \
|
||||||
|
"\\^done,ndeleted=\"1\"" \
|
||||||
|
"delete var lsimple.integer"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-delete i" \
|
||||||
|
"\\^done,ndeleted=\"1\"" \
|
||||||
|
"delete var i"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-delete l" \
|
||||||
|
"\\^done,ndeleted=\"1\"" \
|
||||||
|
"delete var l"
|
||||||
|
|
||||||
|
mi_gdb_exit
|
||||||
|
return 0
|
||||||
|
|
||||||
|
# Local variables:
|
||||||
|
# change-log-default-name: "ChangeLog-mi"
|
||||||
|
# End:
|
||||||
|
|
628
gdb/testsuite/gdb.mi/mi0-var-display.exp
Normal file
628
gdb/testsuite/gdb.mi/mi0-var-display.exp
Normal file
|
@ -0,0 +1,628 @@
|
||||||
|
# Copyright (C) 1999 2000 Cygnus Solutions
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# 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
|
||||||
|
#
|
||||||
|
# Verify that, using the MI, we can create, update, delete variables.
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
load_lib mi-support.exp
|
||||||
|
|
||||||
|
gdb_exit
|
||||||
|
if [mi_gdb_start] {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
set testfile "var-cmd"
|
||||||
|
set srcfile ${testfile}.c
|
||||||
|
set binfile ${objdir}/${subdir}/${testfile}
|
||||||
|
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
|
||||||
|
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
||||||
|
}
|
||||||
|
|
||||||
|
mi_delete_breakpoints
|
||||||
|
mi_gdb_reinitialize_dir $srcdir/$subdir
|
||||||
|
mi_gdb_load ${binfile}
|
||||||
|
|
||||||
|
mi_gdb_test "200-break-insert 260" \
|
||||||
|
"200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_children_tests\",file=\".*var-cmd.c\",line=\"260\",times=\"0\"\}" \
|
||||||
|
"break-insert operation"
|
||||||
|
|
||||||
|
mi_run_cmd
|
||||||
|
# The running part has been checked already by mi_run_cmd
|
||||||
|
gdb_expect {
|
||||||
|
-re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"do_children_tests\",args=\{\},file=\".*var-cmd.c\",line=\"260\"\}\r\n$mi_gdb_prompt$" {
|
||||||
|
pass "run to do_children_tests"
|
||||||
|
}
|
||||||
|
-re ".*$mi_gdb_prompt$" {fail "run to do_children_tests (2)"}
|
||||||
|
timeout {fail "run to do_children_tests (timeout 2)"}
|
||||||
|
}
|
||||||
|
|
||||||
|
##### #####
|
||||||
|
# #
|
||||||
|
# Display tests #
|
||||||
|
# #
|
||||||
|
##### #####
|
||||||
|
|
||||||
|
# Test: c_variable-6.1
|
||||||
|
# Desc: create variable bar
|
||||||
|
mi_gdb_test "-var-create bar * bar" \
|
||||||
|
"\\^done,name=\"bar\",numchild=\"0\",type=\"int\"" \
|
||||||
|
"create local variable bar"
|
||||||
|
|
||||||
|
# Test: c_variable-6.2
|
||||||
|
# Desc: type of variable bar
|
||||||
|
mi_gdb_test "-var-info-type bar" \
|
||||||
|
"\\^done,type=\"int\"" \
|
||||||
|
"info type variable bar"
|
||||||
|
|
||||||
|
# Test: c_variable-6.3
|
||||||
|
# Desc: format of variable bar
|
||||||
|
mi_gdb_test "-var-show-format bar" \
|
||||||
|
"\\^done,format=\"natural\"" \
|
||||||
|
"show format variable bar"
|
||||||
|
|
||||||
|
# Test: c_variable-6.4
|
||||||
|
# Desc: value of variable bar
|
||||||
|
mi_gdb_test "-var-evaluate-expression bar" \
|
||||||
|
"\\^done,value=\"2121\"" \
|
||||||
|
"eval variable bar"
|
||||||
|
|
||||||
|
# Test: c_variable-6.5
|
||||||
|
# Desc: change format of bar to hex
|
||||||
|
mi_gdb_test "-var-set-format bar hexadecimal" \
|
||||||
|
"\\^done,format=\"hexadecimal\"" \
|
||||||
|
"set format variable bar"
|
||||||
|
|
||||||
|
# Test: c_variable-6.6
|
||||||
|
# Desc: value of bar with new format
|
||||||
|
mi_gdb_test "-var-evaluate-expression bar" \
|
||||||
|
"\\^done,value=\"0x849\"" \
|
||||||
|
"eval variable bar with new format"
|
||||||
|
|
||||||
|
# Test: c_variable-6.7
|
||||||
|
# Desc: change value of bar
|
||||||
|
mi_gdb_test "-var-assign bar 3" \
|
||||||
|
"\\^done,value=\"0x3\"" \
|
||||||
|
"assing to variable bar"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-set-format bar decimal" \
|
||||||
|
"\\^done,format=\"decimal\"" \
|
||||||
|
"set format variable bar"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-evaluate-expression bar" \
|
||||||
|
"\\^done,value=\"3\"" \
|
||||||
|
"eval variable bar with new value"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-delete bar" \
|
||||||
|
"\\^done,ndeleted=\"1\"" \
|
||||||
|
"delete var bar"
|
||||||
|
|
||||||
|
# Test: c_variable-6.11
|
||||||
|
# Desc: create variable foo
|
||||||
|
mi_gdb_test "-var-create foo * foo" \
|
||||||
|
"\\^done,name=\"foo\",numchild=\"1\",type=\"int \\*\"" \
|
||||||
|
"create local variable foo"
|
||||||
|
|
||||||
|
# Test: c_variable-6.12
|
||||||
|
# Desc: type of variable foo
|
||||||
|
mi_gdb_test "-var-info-type foo" \
|
||||||
|
"\\^done,type=\"int \\*\"" \
|
||||||
|
"info type variable foo"
|
||||||
|
|
||||||
|
# Test: c_variable-6.13
|
||||||
|
# Desc: format of variable foo
|
||||||
|
mi_gdb_test "-var-show-format foo" \
|
||||||
|
"\\^done,format=\"natural\"" \
|
||||||
|
"show format variable foo"
|
||||||
|
|
||||||
|
# Test: c_variable-6.14
|
||||||
|
# Desc: value of variable foo
|
||||||
|
mi_gdb_test "-var-evaluate-expression foo" \
|
||||||
|
"\\^done,value=\"$hex\"" \
|
||||||
|
"eval variable foo"
|
||||||
|
|
||||||
|
# Test: c_variable-6.15
|
||||||
|
# Desc: change format of var to octal
|
||||||
|
mi_gdb_test "-var-set-format foo octal" \
|
||||||
|
"\\^done,format=\"octal\"" \
|
||||||
|
"set format variable foo"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-show-format foo" \
|
||||||
|
"\\^done,format=\"octal\"" \
|
||||||
|
"show format variable foo"
|
||||||
|
|
||||||
|
# Test: c_variable-6.16
|
||||||
|
# Desc: value of foo with new format
|
||||||
|
mi_gdb_test "-var-evaluate-expression foo" \
|
||||||
|
"\\^done,value=\"\[0-7\]+\"" \
|
||||||
|
"eval variable foo"
|
||||||
|
|
||||||
|
# Test: c_variable-6.17
|
||||||
|
# Desc: change value of foo
|
||||||
|
mi_gdb_test "-var-assign foo 3" \
|
||||||
|
"\\^done,value=\"03\"" \
|
||||||
|
"assing to variable foo"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-set-format foo decimal" \
|
||||||
|
"\\^done,format=\"decimal\"" \
|
||||||
|
"set format variable foo"
|
||||||
|
|
||||||
|
# Test: c_variable-6.18
|
||||||
|
# Desc: check new value of foo
|
||||||
|
mi_gdb_test "-var-evaluate-expression foo" \
|
||||||
|
"\\^done,value=\"3\"" \
|
||||||
|
"eval variable foo"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-delete foo" \
|
||||||
|
"\\^done,ndeleted=\"1\"" \
|
||||||
|
"delete var foo"
|
||||||
|
|
||||||
|
# Test: c_variable-6.21
|
||||||
|
# Desc: create variable weird and children
|
||||||
|
mi_gdb_test "-var-create weird * weird" \
|
||||||
|
"\\^done,name=\"weird\",numchild=\"11\",type=\"weird_struct \\*\"" \
|
||||||
|
"create local variable weird"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-list-children weird" \
|
||||||
|
"\\^done,numchild=\"11\",children=\{child=\{name=\"weird.integer\",exp=\"integer\",numchild=\"0\",type=\"int\"\},child=\{name=\"weird.character\",exp=\"character\",numchild=\"0\",type=\"char\"\},child={name=\"weird.char_ptr\",exp=\"char_ptr\",numchild=\"0\",type=\"char \\*\"\},child=\{name=\"weird.long_int\",exp=\"long_int\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.int_ptr_ptr\",exp=\"int_ptr_ptr\",numchild=\"1\",type=\"int \\*\\*\"\},child=\{name=\"weird.long_array\",exp=\"long_array\",numchild=\"10\",type=\"long int \\\[10\\\]\"\},child=\{name=\"weird.func_ptr\",exp=\"func_ptr\",numchild=\"0\",type=\"void \\(\\*\\)\\(\\)\"\},child=\{name=\"weird.func_ptr_struct\",exp=\"func_ptr_struct\",numchild=\"0\",type=\"struct _struct_decl \\(\\*\\)\\(\\)\"\},child=\{name=\"weird.func_ptr_ptr\",exp=\"func_ptr_ptr\",numchild=\"0\",type=\"struct _struct_decl \\*\\(\\*\\)\\(\\)\"\},child=\{name=\"weird.u1\",exp=\"u1\",numchild=\"4\",type=\"union \{\\.\\.\\.\}\"\},child=\{name=\"weird.s2\",exp=\"s2\",numchild=\"4\",type=\"struct \{\\.\\.\\.\}\"\}\}" \
|
||||||
|
"get children local variable weird"
|
||||||
|
|
||||||
|
|
||||||
|
# Test: c_variable-6.23
|
||||||
|
# Desc: change format of weird.func_ptr and weird.func_ptr_ptr
|
||||||
|
mi_gdb_test "-var-set-format weird.func_ptr hexadecimal" \
|
||||||
|
"\\^done,format=\"hexadecimal\"" \
|
||||||
|
"set format variable weird.func_ptr"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-show-format weird.func_ptr" \
|
||||||
|
"\\^done,format=\"hexadecimal\"" \
|
||||||
|
"show format variable weird.func_ptr"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-set-format weird.func_ptr_ptr hexadecimal" \
|
||||||
|
"\\^done,format=\"hexadecimal\"" \
|
||||||
|
"set format variable weird.func_ptr_ptr"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-show-format weird.func_ptr_ptr" \
|
||||||
|
"\\^done,format=\"hexadecimal\"" \
|
||||||
|
"show format variable weird.func_ptr_ptr"
|
||||||
|
|
||||||
|
# Test: c_variable-6.24
|
||||||
|
# Desc: format of weird and children
|
||||||
|
mi_gdb_test "-var-set-format weird natural" \
|
||||||
|
"\\^done,format=\"natural\"" \
|
||||||
|
"set format variable weird"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-set-format weird.integer natural" \
|
||||||
|
"\\^done,format=\"natural\"" \
|
||||||
|
"set format variable weird.integer"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-set-format weird.character natural" \
|
||||||
|
"\\^done,format=\"natural\"" \
|
||||||
|
"set format variable weird.character"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-set-format weird.char_ptr natural" \
|
||||||
|
"\\^done,format=\"natural\"" \
|
||||||
|
"set format variable weird.char_ptr"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-set-format weird.long_int natural" \
|
||||||
|
"\\^done,format=\"natural\"" \
|
||||||
|
"set format variable weird.long_int"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-set-format weird.int_ptr_ptr natural" \
|
||||||
|
"\\^done,format=\"natural\"" \
|
||||||
|
"set format variable weird.int_ptr_ptr"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-set-format weird.long_array natural" \
|
||||||
|
"\\^done,format=\"natural\"" \
|
||||||
|
"set format variable weird.long_array"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-set-format weird.func_ptr hexadecimal" \
|
||||||
|
"\\^done,format=\"hexadecimal\"" \
|
||||||
|
"set format variable weird.func_ptr"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-set-format weird.func_ptr_struct hexadecimal" \
|
||||||
|
"\\^done,format=\"hexadecimal\"" \
|
||||||
|
"set format variable weird.func_ptr_struct"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-set-format weird.func_ptr_ptr natural" \
|
||||||
|
"\\^done,format=\"natural\"" \
|
||||||
|
"set format variable weird.func_ptr_ptr"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-set-format weird.u1 natural" \
|
||||||
|
"\\^done,format=\"natural\"" \
|
||||||
|
"set format variable weird.u1"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-set-format weird.s2 natural" \
|
||||||
|
"\\^done,format=\"natural\"" \
|
||||||
|
"set format variable weird.s2"
|
||||||
|
|
||||||
|
# Test: c_variable-6.25
|
||||||
|
# Desc: value of weird and children
|
||||||
|
#gdbtk_test c_variable-6.25 {value of weird and children} {
|
||||||
|
# set values {}
|
||||||
|
# foreach v [lsort [array names var]] f [list x "" "" x x x x d d d d d] {
|
||||||
|
# lappend values [value $v $f]
|
||||||
|
# }
|
||||||
|
|
||||||
|
# set values
|
||||||
|
#} {ok ok ok ok ok ok ok ok weird.long_array ok weird.s2 weird.u1}
|
||||||
|
|
||||||
|
# Test: c_variable-6.26
|
||||||
|
# Desc: change format of weird and children to octal
|
||||||
|
#gdbtk_test c_variable-6.26 {change format of weird and children to octal} {
|
||||||
|
# set formats {}
|
||||||
|
# foreach v [lsort [array names var]] {
|
||||||
|
# $var($v) format octal
|
||||||
|
# lappend formats [$var($v) format]
|
||||||
|
# }
|
||||||
|
|
||||||
|
# set formats
|
||||||
|
#} {octal octal octal octal octal octal octal octal octal octal octal octal}
|
||||||
|
|
||||||
|
# Test: c_variable-6.27
|
||||||
|
# Desc: value of weird and children with new format
|
||||||
|
#gdbtk_test c_variable-6.27 {value of foo with new format} {
|
||||||
|
# set values {}
|
||||||
|
# foreach v [lsort [array names var]] {
|
||||||
|
# lappend values [value $v o]
|
||||||
|
# }
|
||||||
|
|
||||||
|
# set values
|
||||||
|
#} {ok ok ok ok ok ok ok ok weird.long_array ok weird.s2 weird.u1}
|
||||||
|
|
||||||
|
# Test: c_variable-6.30
|
||||||
|
# Desc: create more children of weird
|
||||||
|
#gdbtk_test c_variable-6.30 {create more children of weird} {
|
||||||
|
# foreach v [array names var] {
|
||||||
|
# get_children $v
|
||||||
|
# }
|
||||||
|
|
||||||
|
# # Do it twice to get more children
|
||||||
|
# foreach v [array names var] {
|
||||||
|
# get_children $v
|
||||||
|
# }
|
||||||
|
|
||||||
|
# lsort [array names var]
|
||||||
|
#} {weird weird.char_ptr weird.character weird.func_ptr weird.func_ptr_ptr weird.func_ptr_struct weird.int_ptr_ptr weird.int_ptr_ptr.*int_ptr_ptr weird.int_ptr_ptr.*int_ptr_ptr.**int_ptr_ptr weird.integer weird.long_array weird.long_array.0 weird.long_array.1 weird.long_array.2 weird.long_array.3 weird.long_array.4 weird.long_array.5 weird.long_array.6 weird.long_array.7 weird.long_array.8 weird.long_array.9 weird.long_int weird.s2 weird.s2.g weird.s2.h weird.s2.i weird.s2.i.0 weird.s2.i.1 weird.s2.i.2 weird.s2.i.3 weird.s2.i.4 weird.s2.i.5 weird.s2.i.6 weird.s2.i.7 weird.s2.i.8 weird.s2.i.9 weird.s2.u2 weird.s2.u2.f weird.s2.u2.u1s1 weird.s2.u2.u1s2 weird.u1 weird.u1.a weird.u1.b weird.u1.c weird.u1.d}
|
||||||
|
|
||||||
|
# Test: c_variable-6.31
|
||||||
|
# Desc: check that all children of weird change
|
||||||
|
# Ok, obviously things like weird.s2 and weird.u1 will not change!
|
||||||
|
#gdbtk_test *c_variable-6.31 {check that all children of weird change (ops, we are now reporting array names as changed in this case - seems harmless though)} {
|
||||||
|
# $var(weird) value 0x2121
|
||||||
|
# check_update
|
||||||
|
#} {{weird.integer weird.character weird.char_ptr weird.long_int weird.int_ptr_ptr weird.int_ptr_ptr.*int_ptr_ptr weird.int_ptr_ptr.*int_ptr_ptr.**int_ptr_ptr weird.long_array.0 weird.long_array.1 weird.long_array.2 weird.long_array.3 weird.long_array.4 weird.long_array.5 weird.long_array.6 weird.long_array.7 weird.long_array.8 weird.long_array.9 weird.func_ptr weird.func_ptr_struct weird.func_ptr_ptr weird.u1.a weird.u1.b weird.u1.c weird.u1.d weird.s2.u2.f weird.s2.g weird.s2.h weird.s2.i.0 weird.s2.i.1 weird.s2.i.2 weird.s2.i.3 weird.s2.i.4 weird.s2.i.5 weird.s2.i.6 weird.s2.i.7 weird.s2.i.8 weird.s2.i.9} {weird.s2.i weird.s2.u2 weird weird.s2.u2.u1s1 weird.s2.u2.u1s2 weird.s2 weird.long_array weird.u1} {}}
|
||||||
|
|
||||||
|
mi_gdb_test "-var-delete weird" \
|
||||||
|
"\\^done,ndeleted=\"12\"" \
|
||||||
|
"delete var weird"
|
||||||
|
|
||||||
|
|
||||||
|
##### #####
|
||||||
|
# #
|
||||||
|
# Special Display Tests #
|
||||||
|
# #
|
||||||
|
##### #####
|
||||||
|
|
||||||
|
# Stop in "do_special_tests"
|
||||||
|
mi_gdb_test "200-break-insert do_special_tests" \
|
||||||
|
"200\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_special_tests\",file=\".*var-cmd.c\",line=\"282\",times=\"0\"\}" \
|
||||||
|
"break-insert operation"
|
||||||
|
|
||||||
|
send_gdb "-exec-continue\n"
|
||||||
|
gdb_expect {
|
||||||
|
-re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"breakpoint-hit\",bkptno=\"2\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"do_special_tests\",args=\{\},file=\".*var-cmd.c\",line=\"282\"\}\r\n$mi_gdb_prompt$" {
|
||||||
|
pass "continue to do_special_tests"
|
||||||
|
}
|
||||||
|
timeout {
|
||||||
|
fail "continue to do_special_tests (timeout)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Test: c_variable-7.10
|
||||||
|
# Desc: create union u
|
||||||
|
mi_gdb_test "-var-create u * u" \
|
||||||
|
"\\^done,name=\"u\",numchild=\"2\",type=\"union named_union\"" \
|
||||||
|
"create local variable u"
|
||||||
|
|
||||||
|
# Test: c_variable-7.11
|
||||||
|
# Desc: value of u
|
||||||
|
mi_gdb_test "-var-evaluate-expression u" \
|
||||||
|
"\\^done,value=\"\{\\.\\.\\.\}\"" \
|
||||||
|
"eval variable u"
|
||||||
|
|
||||||
|
# Test: c_variable-7.12
|
||||||
|
# Desc: type of u
|
||||||
|
mi_gdb_test "-var-info-type u" \
|
||||||
|
"\\^done,type=\"union named_union\"" \
|
||||||
|
"info type variable u"
|
||||||
|
|
||||||
|
# Test: c_variable-7.13
|
||||||
|
# Desc: is u editable
|
||||||
|
mi_gdb_test "-var-show-attributes u" \
|
||||||
|
"\\^done,attr=\"noneditable\"" \
|
||||||
|
"is u editable"
|
||||||
|
|
||||||
|
# Test: c_variable-7.14
|
||||||
|
# Desc: number of children of u
|
||||||
|
mi_gdb_test "-var-info-num-children u" \
|
||||||
|
"\\^done,numchild=\"2\"" \
|
||||||
|
"get number of children of u"
|
||||||
|
|
||||||
|
# Test: c_variable-7.15
|
||||||
|
# Desc: children of u
|
||||||
|
mi_gdb_test "-var-list-children u" \
|
||||||
|
"\\^done,numchild=\"2\",children=\{child=\{name=\"u.integer\",exp=\"integer\",numchild=\"0\",type=\"int\"\},child=\{name=\"u.char_ptr\",exp=\"char_ptr\",numchild=\"0\",type=\"char \\*\"\}\}" \
|
||||||
|
"get children of u"
|
||||||
|
|
||||||
|
# Test: c_variable-7.20
|
||||||
|
# Desc: create anonu
|
||||||
|
mi_gdb_test "-var-create anonu * anonu" \
|
||||||
|
"\\^done,name=\"anonu\",numchild=\"3\",type=\"union \{\\.\\.\\.\}\"" \
|
||||||
|
"create local variable anonu"
|
||||||
|
|
||||||
|
# Test: c_variable-7.21
|
||||||
|
# Desc: value of anonu
|
||||||
|
mi_gdb_test "-var-evaluate-expression anonu" \
|
||||||
|
"\\^done,value=\"\{\\.\\.\\.\}\"" \
|
||||||
|
"eval variable anonu"
|
||||||
|
|
||||||
|
# Test: c_variable-7.22
|
||||||
|
# Desc: type of anonu
|
||||||
|
mi_gdb_test "-var-info-type anonu" \
|
||||||
|
"\\^done,type=\"union \{\\.\\.\\.\}\"" \
|
||||||
|
"info type variable anonu"
|
||||||
|
|
||||||
|
# Test: c_variable-7.23
|
||||||
|
# Desc: is anonu editable
|
||||||
|
mi_gdb_test "-var-show-attributes anonu" \
|
||||||
|
"\\^done,attr=\"noneditable\"" \
|
||||||
|
"is anonu editable"
|
||||||
|
|
||||||
|
# Test: c_variable-7.24
|
||||||
|
# Desc: number of children of anonu
|
||||||
|
mi_gdb_test "-var-info-num-children anonu" \
|
||||||
|
"\\^done,numchild=\"3\"" \
|
||||||
|
"get number of children of anonu"
|
||||||
|
|
||||||
|
# Test: c_variable-7.25
|
||||||
|
# Desc: children of anonu
|
||||||
|
mi_gdb_test "-var-list-children anonu" \
|
||||||
|
"\\^done,numchild=\"3\",children=\{child=\{name=\"anonu.a\",exp=\"a\",numchild=\"0\",type=\"int\"\},child=\{name=\"anonu.b\",exp=\"b\",numchild=\"0\",type=\"char\"\},child=\{name=\"anonu.c\",exp=\"c\",numchild=\"0\",type=\"long int\"\}\}" \
|
||||||
|
"get children of anonu"
|
||||||
|
|
||||||
|
# Test: c_variable-7.30
|
||||||
|
# Desc: create struct s
|
||||||
|
mi_gdb_test "-var-create s * s" \
|
||||||
|
"\\^done,name=\"s\",numchild=\"6\",type=\"struct _simple_struct\"" \
|
||||||
|
"create local variable s"
|
||||||
|
|
||||||
|
|
||||||
|
# Test: c_variable-7.31
|
||||||
|
# Desc: value of s
|
||||||
|
mi_gdb_test "-var-evaluate-expression s" \
|
||||||
|
"\\^done,value=\"\{\\.\\.\\.\}\"" \
|
||||||
|
"eval variable s"
|
||||||
|
|
||||||
|
# Test: c_variable-7.32
|
||||||
|
# Desc: type of s
|
||||||
|
mi_gdb_test "-var-info-type s" \
|
||||||
|
"\\^done,type=\"struct _simple_struct\"" \
|
||||||
|
"info type variable s"
|
||||||
|
|
||||||
|
# Test: c_variable-7.33
|
||||||
|
# Desc: is s editable
|
||||||
|
mi_gdb_test "-var-show-attributes s" \
|
||||||
|
"\\^done,attr=\"noneditable\"" \
|
||||||
|
"is s editable"
|
||||||
|
|
||||||
|
# Test: c_variable-7.34
|
||||||
|
# Desc: number of children of s
|
||||||
|
mi_gdb_test "-var-info-num-children s" \
|
||||||
|
"\\^done,numchild=\"6\"" \
|
||||||
|
"get number of children of s"
|
||||||
|
|
||||||
|
# Test: c_variable-7.35
|
||||||
|
# Desc: children of s
|
||||||
|
mi_gdb_test "-var-list-children s" \
|
||||||
|
"\\^done,numchild=\"6\",children=\{child=\{name=\"s.integer\",exp=\"integer\",numchild=\"0\",type=\"int\"\},child=\{name=\"s.unsigned_integer\",exp=\"unsigned_integer\",numchild=\"0\",type=\"unsigned int\"\},child=\{name=\"s.character\",exp=\"character\",numchild=\"0\",type=\"char\"\},child=\{name=\"s.signed_character\",exp=\"signed_character\",numchild=\"0\",type=\"signed char\"\},child=\{name=\"s.char_ptr\",exp=\"char_ptr\",numchild=\"0\",type=\"char \\*\"\},child=\{name=\"s.array_of_10\",exp=\"array_of_10\",numchild=\"10\",type=\"int \\\[10\\\]\"\}\}" \
|
||||||
|
"get children of s"
|
||||||
|
#} {integer unsigned_integer character signed_character char_ptr array_of_10}
|
||||||
|
|
||||||
|
# Test: c_variable-7.40
|
||||||
|
# Desc: create anons
|
||||||
|
mi_gdb_test "-var-create anons * anons" \
|
||||||
|
"\\^done,name=\"anons\",numchild=\"3\",type=\"struct \{\\.\\.\\.\}\"" \
|
||||||
|
"create local variable anons"
|
||||||
|
|
||||||
|
# Test: c_variable-7.41
|
||||||
|
# Desc: value of anons
|
||||||
|
mi_gdb_test "-var-evaluate-expression anons" \
|
||||||
|
"\\^done,value=\"\{\\.\\.\\.\}\"" \
|
||||||
|
"eval variable anons"
|
||||||
|
|
||||||
|
# Test: c_variable-7.42
|
||||||
|
# Desc: type of anons
|
||||||
|
mi_gdb_test "-var-info-type anons" \
|
||||||
|
"\\^done,type=\"struct \{\\.\\.\\.\}\"" \
|
||||||
|
"info type variable anons"
|
||||||
|
|
||||||
|
# Test: c_variable-7.43
|
||||||
|
# Desc: is anons editable
|
||||||
|
mi_gdb_test "-var-show-attributes anons" \
|
||||||
|
"\\^done,attr=\"noneditable\"" \
|
||||||
|
"is anons editable"
|
||||||
|
|
||||||
|
# Test: c_variable-7.44
|
||||||
|
# Desc: number of children of anons
|
||||||
|
mi_gdb_test "-var-info-num-children anons" \
|
||||||
|
"\\^done,numchild=\"3\"" \
|
||||||
|
"get number of children of anons"
|
||||||
|
|
||||||
|
# Test: c_variable-7.45
|
||||||
|
# Desc: children of anons
|
||||||
|
mi_gdb_test "-var-list-children anons" \
|
||||||
|
"\\^done,numchild=\"3\",children=\{child=\{name=\"anons.a\",exp=\"a\",numchild=\"0\",type=\"int\"\},child=\{name=\"anons.b\",exp=\"b\",numchild=\"0\",type=\"char\"\},child=\{name=\"anons.c\",exp=\"c\",numchild=\"0\",type=\"long int\"\}\}" \
|
||||||
|
"get children of anons"
|
||||||
|
|
||||||
|
|
||||||
|
# Test: c_variable-7.50
|
||||||
|
# Desc: create enum e
|
||||||
|
mi_gdb_test "-var-create e * e" \
|
||||||
|
"\\^done,name=\"e\",numchild=\"0\",type=\"enum foo\"" \
|
||||||
|
"create local variable e"
|
||||||
|
|
||||||
|
setup_xfail "*-*-*"
|
||||||
|
# Test: c_variable-7.51
|
||||||
|
# Desc: value of e
|
||||||
|
mi_gdb_test "-var-evaluate-expression e" \
|
||||||
|
"\\^done,value=\"FIXME\"" \
|
||||||
|
"eval variable e"
|
||||||
|
clear_xfail "*-*-*"
|
||||||
|
|
||||||
|
# Test: c_variable-7.52
|
||||||
|
# Desc: type of e
|
||||||
|
mi_gdb_test "-var-info-type e" \
|
||||||
|
"\\^done,type=\"enum foo\"" \
|
||||||
|
"info type variable e"
|
||||||
|
|
||||||
|
# Test: c_variable-7.53
|
||||||
|
# Desc: is e editable
|
||||||
|
mi_gdb_test "-var-show-attributes e" \
|
||||||
|
"\\^done,attr=\"editable\"" \
|
||||||
|
"is e editable"
|
||||||
|
|
||||||
|
# Test: c_variable-7.54
|
||||||
|
# Desc: number of children of e
|
||||||
|
mi_gdb_test "-var-info-num-children e" \
|
||||||
|
"\\^done,numchild=\"0\"" \
|
||||||
|
"get number of children of e"
|
||||||
|
|
||||||
|
# Test: c_variable-7.55
|
||||||
|
# Desc: children of e
|
||||||
|
mi_gdb_test "-var-list-children e" \
|
||||||
|
"\\^done,numchild=\"0\"" \
|
||||||
|
"get children of e"
|
||||||
|
|
||||||
|
# Test: c_variable-7.60
|
||||||
|
# Desc: create anone
|
||||||
|
mi_gdb_test "-var-create anone * anone" \
|
||||||
|
"\\^done,name=\"anone\",numchild=\"0\",type=\"enum \{\\.\\.\\.\}\"" \
|
||||||
|
"create local variable anone"
|
||||||
|
|
||||||
|
setup_xfail "*-*-*"
|
||||||
|
# Test: c_variable-7.61
|
||||||
|
# Desc: value of anone
|
||||||
|
mi_gdb_test "-var-evaluate-expression anone" \
|
||||||
|
"\\^done,value=\"A\"" \
|
||||||
|
"eval variable anone"
|
||||||
|
clear_xfail "*-*-*"
|
||||||
|
|
||||||
|
|
||||||
|
# Test: c_variable-7.70
|
||||||
|
# Desc: create anone
|
||||||
|
mi_gdb_test "-var-create anone * anone" \
|
||||||
|
"&\"Duplicate variable object name\\\\n\".*\\^error,msg=\"Duplicate variable object name\"" \
|
||||||
|
"create duplicate local variable anone"
|
||||||
|
|
||||||
|
|
||||||
|
# Test: c_variable-7.72
|
||||||
|
# Desc: type of anone
|
||||||
|
mi_gdb_test "-var-info-type anone" \
|
||||||
|
"\\^done,type=\"enum \{\\.\\.\\.\}\"" \
|
||||||
|
"info type variable anone"
|
||||||
|
|
||||||
|
|
||||||
|
# Test: c_variable-7.73
|
||||||
|
# Desc: is anone editable
|
||||||
|
mi_gdb_test "-var-show-attributes anone" \
|
||||||
|
"\\^done,attr=\"editable\"" \
|
||||||
|
"is anone editable"
|
||||||
|
|
||||||
|
# Test: c_variable-7.74
|
||||||
|
# Desc: number of children of anone
|
||||||
|
mi_gdb_test "-var-info-num-children anone" \
|
||||||
|
"\\^done,numchild=\"0\"" \
|
||||||
|
"get number of children of anone"
|
||||||
|
|
||||||
|
# Test: c_variable-7.75
|
||||||
|
# Desc: children of anone
|
||||||
|
mi_gdb_test "-var-list-children anone" \
|
||||||
|
"\\^done,numchild=\"0\"" \
|
||||||
|
"get children of anone"
|
||||||
|
|
||||||
|
|
||||||
|
# Record fp
|
||||||
|
|
||||||
|
send_gdb "p/x \$fp\n"
|
||||||
|
gdb_expect {
|
||||||
|
-re ".*($hex).*\\^done\r\n$mi_gdb_prompt$" {
|
||||||
|
pass "print FP register"
|
||||||
|
set fp $expect_out(1,string)
|
||||||
|
}
|
||||||
|
# -re ".*" { fail "print FP register"}
|
||||||
|
timeout { fail "print FP register (timeout)"}
|
||||||
|
}
|
||||||
|
|
||||||
|
mi_gdb_test "200-break-insert incr_a" \
|
||||||
|
"200\\^done,bkpt=\{number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"incr_a\",file=\".*var-cmd.c\",line=\"85\",times=\"0\"\}" \
|
||||||
|
"break-insert operation"
|
||||||
|
send_gdb "-exec-continue\n"
|
||||||
|
gdb_expect {
|
||||||
|
-re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"breakpoint-hit\",bkptno=\"3\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"incr_a\",args=\{\{name=\"a\",value=\"2\.*\"\}\},file=\".*var-cmd.c\",line=\"85\"\}\r\n$mi_gdb_prompt$" {
|
||||||
|
pass "continue to incr_a"
|
||||||
|
}
|
||||||
|
timeout {
|
||||||
|
fail "continue to incr_a (timeout)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Test: c_variable-7.81
|
||||||
|
# Desc: Create variables in different scopes
|
||||||
|
mi_gdb_test "-var-create a1 * a" \
|
||||||
|
"\\^done,name=\"a1\",numchild=\"0\",type=\"char\"" \
|
||||||
|
"create local variable a1"
|
||||||
|
|
||||||
|
mi_gdb_test "-var-create a2 $fp a" \
|
||||||
|
"\\^done,name=\"a2\",numchild=\"0\",type=\"int\"" \
|
||||||
|
"create variable a2 in different scope"
|
||||||
|
|
||||||
|
#gdbtk_test c_variable-7.81 {create variables in different scopes} {
|
||||||
|
# set a1 [gdb_variable create -expr a]
|
||||||
|
# set a2 [gdb_variable create -expr a -frame $fp]
|
||||||
|
|
||||||
|
# set vals {}
|
||||||
|
# lappend vals [$a1 value]
|
||||||
|
# lappend vals [$a2 value]
|
||||||
|
# set vals
|
||||||
|
#} {2 1}
|
||||||
|
|
||||||
|
|
||||||
|
mi_gdb_exit
|
||||||
|
return 0
|
||||||
|
|
||||||
|
# Local variables:
|
||||||
|
# change-log-default-name: "ChangeLog-mi"
|
||||||
|
# End:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
195
gdb/testsuite/gdb.mi/mi0-watch.exp
Normal file
195
gdb/testsuite/gdb.mi/mi0-watch.exp
Normal file
|
@ -0,0 +1,195 @@
|
||||||
|
# Copyright 1999, 2000 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
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# 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
|
||||||
|
#
|
||||||
|
# Verify that, using the MI, we can run a simple program and perform basic
|
||||||
|
# debugging activities like: insert breakpoints, run the program,
|
||||||
|
# step, next, continue until it ends and, last but not least, quit.
|
||||||
|
#
|
||||||
|
# The goal is not to test gdb functionality, which is done by other tests,
|
||||||
|
# but to verify the correct output response to MI operations.
|
||||||
|
#
|
||||||
|
|
||||||
|
load_lib mi-support.exp
|
||||||
|
|
||||||
|
gdb_exit
|
||||||
|
if [mi_gdb_start] {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
set testfile "basics"
|
||||||
|
set srcfile ${testfile}.c
|
||||||
|
set binfile ${objdir}/${subdir}/${testfile}
|
||||||
|
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
|
||||||
|
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
||||||
|
}
|
||||||
|
|
||||||
|
mi_delete_breakpoints
|
||||||
|
mi_gdb_reinitialize_dir $srcdir/$subdir
|
||||||
|
mi_gdb_load ${binfile}
|
||||||
|
|
||||||
|
proc test_watchpoint_creation_and_listing {} {
|
||||||
|
global mi_gdb_prompt
|
||||||
|
global srcfile
|
||||||
|
global hex
|
||||||
|
|
||||||
|
# Insert a watchpoint and list
|
||||||
|
# Tests:
|
||||||
|
# -break-watch C
|
||||||
|
# -break-list
|
||||||
|
|
||||||
|
mi_gdb_test "111-break-watch C" \
|
||||||
|
"111\\^done,wpt=\{number=\"2\",exp=\"C\"\}" \
|
||||||
|
"break-watch operation"
|
||||||
|
|
||||||
|
mi_gdb_test "222-break-list" \
|
||||||
|
"222\\^done,BreakpointTable=\{hdr=\{.*\},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\"\}\}" \
|
||||||
|
"list of watchpoints"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
# UNUSED at the time
|
||||||
|
proc test_awatch_creation_and_listing {} {
|
||||||
|
global mi_gdb_prompt
|
||||||
|
global srcfile
|
||||||
|
global hex
|
||||||
|
|
||||||
|
# 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\"\}" \
|
||||||
|
"break-watch -a operation"
|
||||||
|
|
||||||
|
mi_gdb_test "444-break-list" \
|
||||||
|
"444\\^done,BreakpointTable=\{hdr=\{.*\},bkpt=\{number=\"3\",type=\"watchpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\},.*\}\}" \
|
||||||
|
"list of watchpoints awatch"
|
||||||
|
|
||||||
|
mi_gdb_test "777-break-delete 3" \
|
||||||
|
"777\\^done" \
|
||||||
|
"delete access watchpoint"
|
||||||
|
}
|
||||||
|
|
||||||
|
# UNUSED at the time
|
||||||
|
proc test_rwatch_creation_and_listing {} {
|
||||||
|
global mi_gdb_prompt
|
||||||
|
global srcfile
|
||||||
|
global hex
|
||||||
|
|
||||||
|
# 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\"\}" \
|
||||||
|
"break-insert -r operation"
|
||||||
|
|
||||||
|
mi_gdb_test "300-break-list" \
|
||||||
|
"300\\^done,BreakpointTable=\{hdr=\{.*\},bkpt=\{number=\"5\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\},.*\}\}" \
|
||||||
|
"list of breakpoints"
|
||||||
|
|
||||||
|
mi_gdb_test "177-break-delete 4" \
|
||||||
|
"177\\^done" \
|
||||||
|
"delete read watchpoint"
|
||||||
|
}
|
||||||
|
|
||||||
|
proc test_running_the_program {} {
|
||||||
|
global mi_gdb_prompt
|
||||||
|
global hex
|
||||||
|
|
||||||
|
# Run the program without args, then specify srgs and rerun the program
|
||||||
|
# Tests:
|
||||||
|
# -exec-run
|
||||||
|
|
||||||
|
mi_gdb_test "300-break-insert callee4" \
|
||||||
|
"300\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"8\",times=\"0\"\}" \
|
||||||
|
"insert breakpoint at callee4"
|
||||||
|
|
||||||
|
# mi_gdb_test cannot be used for asynchronous commands because there are
|
||||||
|
# two prompts involved and this can lead to a race condition.
|
||||||
|
# The following is equivalent to a send_gdb "000-exec-run\n"
|
||||||
|
mi_run_cmd
|
||||||
|
# The running part has been checked already by mi_run_cmd
|
||||||
|
gdb_expect {
|
||||||
|
-re "\[\r\n\]*000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"callee4\",args=\{\},file=\".*basics.c\",line=\"8\"\}\r\n$mi_gdb_prompt$" \
|
||||||
|
{ pass "run to callee4" }
|
||||||
|
-re ".*$mi_gdb_prompt$" {fail "run to callee4 (2)"}
|
||||||
|
timeout {fail "run to callee4 (timeout 2)"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
proc test_watchpoint_triggering {} {
|
||||||
|
global mi_gdb_prompt
|
||||||
|
global hex
|
||||||
|
|
||||||
|
# Continue execution until the watchpoint is reached, continue again,
|
||||||
|
# to see the watchpoint go out of scope.
|
||||||
|
# Does:
|
||||||
|
# -exec-continue (Here wp triggers)
|
||||||
|
# -exec-continue (Here wp goes out of scope)
|
||||||
|
|
||||||
|
send_gdb "222-exec-continue\n"
|
||||||
|
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=\"0\",frame=\{addr=\"$hex\",func=\"callee4\",args=\{\},file=\".*basics.c\",line=\"13\"\}\r\n$mi_gdb_prompt$" {
|
||||||
|
pass "watchpoint trigger"
|
||||||
|
}
|
||||||
|
-re ".*$mi_gdb_prompt$" {fail "watchpoint trigger (2)"}
|
||||||
|
timeout {fail "watchpoint trigger (timeout 2)"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
-re ".*$mi_gdb_prompt$" {fail "watchpoint trigger (1)"}
|
||||||
|
timeout {fail "watchpoint trigger (timeout 1)"}
|
||||||
|
}
|
||||||
|
|
||||||
|
send_gdb "223-exec-continue\n"
|
||||||
|
gdb_expect {
|
||||||
|
-re "223\\^running\r\n$mi_gdb_prompt" {
|
||||||
|
gdb_expect {
|
||||||
|
-re "\[\r\n\]*223\\*stopped,reason=\"watchpoint-scope\",wpnum=\"2\",thread-id=\"0\",frame=\{addr=\"$hex\",func=\"callee3\",args=\{.*\},file=\".*basics.c\",line=\"18\"\}\r\n$mi_gdb_prompt$" {
|
||||||
|
pass "wp out of scope"
|
||||||
|
}
|
||||||
|
-re ".*$mi_gdb_prompt$" {fail "wp out of scope (2)"}
|
||||||
|
timeout {fail "wp out of scope (timeout 2)"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
-re ".*$mi_gdb_prompt$" {fail "wp out of scope (1)"}
|
||||||
|
timeout {fail "wp out of scope (timeout 1)"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
test_running_the_program
|
||||||
|
test_watchpoint_creation_and_listing
|
||||||
|
#test_rwatch_creation_and_listing
|
||||||
|
#test_awatch_creation_and_listing
|
||||||
|
test_watchpoint_triggering
|
||||||
|
|
||||||
|
mi_gdb_exit
|
||||||
|
return 0
|
||||||
|
|
||||||
|
# Local variables:
|
||||||
|
# change-log-default-name: "ChangeLog-mi"
|
||||||
|
# End:
|
||||||
|
|
Loading…
Reference in a new issue