2004-02-13 Andrew Cagney <cagney@redhat.com>

* gdb.mi/mi1-basics.exp, gdb.mi/mi1-break.exp: Delete file.
	* gdb.mi/mi1-console.exp, gdb.mi/mi1-disassemble.exp: Delete file.
	* gdb.mi/mi1-eval.exp, gdb.mi/mi1-hack-cli.exp: Delete file.
	* gdb.mi/mi1-pthreads.exp, gdb.mi/mi1-read-memory.exp: Delete file.
	* gdb.mi/mi1-regs.exp, gdb.mi/mi1-return.exp: Delete file.
	* gdb.mi/mi1-simplerun.exp, gdb.mi/mi1-stack.exp: Delete file.
	* gdb.mi/mi1-stepi.exp, gdb.mi/mi1-symbol.exp: Delete file.
	* gdb.mi/mi1-until.exp, gdb.mi/mi1-var-block.exp: Delete file.
	* gdb.mi/mi1-var-child.exp, gdb.mi/mi1-var-cmd.exp: Delete file.
	* gdb.mi/mi1-var-display.exp, gdb.mi/mi1-watch.exp: Delete file.
This commit is contained in:
Andrew Cagney 2004-02-13 19:59:25 +00:00
parent 4dde8e6152
commit dac15b6656
21 changed files with 13 additions and 4605 deletions

View File

@ -1,3 +1,16 @@
2004-02-13 Andrew Cagney <cagney@redhat.com>
* gdb.mi/mi1-basics.exp, gdb.mi/mi1-break.exp: Delete file.
* gdb.mi/mi1-console.exp, gdb.mi/mi1-disassemble.exp: Delete file.
* gdb.mi/mi1-eval.exp, gdb.mi/mi1-hack-cli.exp: Delete file.
* gdb.mi/mi1-pthreads.exp, gdb.mi/mi1-read-memory.exp: Delete file.
* gdb.mi/mi1-regs.exp, gdb.mi/mi1-return.exp: Delete file.
* gdb.mi/mi1-simplerun.exp, gdb.mi/mi1-stack.exp: Delete file.
* gdb.mi/mi1-stepi.exp, gdb.mi/mi1-symbol.exp: Delete file.
* gdb.mi/mi1-until.exp, gdb.mi/mi1-var-block.exp: Delete file.
* gdb.mi/mi1-var-child.exp, gdb.mi/mi1-var-cmd.exp: Delete file.
* gdb.mi/mi1-var-display.exp, gdb.mi/mi1-watch.exp: Delete file.
2004-02-11 Jeff Johnston <jjohnstn@redhat.com>
* gdb.asm/ia64.inc (gdbasm_startup): Make sure first instruction

View File

@ -1,174 +0,0 @@
# 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
set MIFLAGS "-i=mi1"
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=\\\{.*,body=\\\[\\\]\\\}" \
"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

View File

@ -1,138 +0,0 @@
# 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
set MIFLAGS "-i=mi1"
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=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"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" \
"1\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[bkpt=\{number=\"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

View File

@ -1,97 +0,0 @@
# Copyright 1999, 2000, 2001, 2002 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.
#
# 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
set MIFLAGS "-i=mi1"
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}
mi_run_to_main
# 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.
kfail "gdb/623" "Hello message"
}
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

View File

@ -1,178 +0,0 @@
# Copyright 1999, 2000, 2002 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
set MIFLAGS "-i=mi1"
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_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"
}
mi_run_to_main
test_disassembly_only
test_disassembly_mixed
test_disassembly_bogus_args
test_disassembly_lines_limit
test_disassembly_mixed_lines_limit
mi_gdb_exit
return 0

View File

@ -1,62 +0,0 @@
# Copyright 1999, 2000, 2002 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
set MIFLAGS "-i=mi1"
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_runto callee4
mi_next_to "callee4" "" "basics.c" "9" "next at callee4"
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

View File

@ -1,40 +0,0 @@
# 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
set MIFLAGS "-i=mi1"
gdb_exit
if [mi_gdb_start] {
continue
}
mi_gdb_test "show architecture" \
"&\"show architecture\\\\n\"\r\n~\"The target architecture.*\"\r\n\\^done" \
"show architecture"
mi_gdb_test "47show architecture" \
"&\"show architecture\\\\n\"\r\n~\"The target architecture.*\"\r\n47\\^done" \
"47show architecture"
mi_gdb_exit
return 0

View File

@ -1,221 +0,0 @@
# Copyright 2002, 2003, 2004 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# 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
# This file tests MI thread commands.
# Specifically, we are testing the MI command set and the console (in MI)
# command set ("interpreter-exec") and that the commands that are executed
# via these command pathways are properly executed. Console commands
# executed via MI should use MI output wrappers, MI event handlers, etc.
# This only works with native configurations
if {![isnative]} {
return
}
load_lib mi-support.exp
set MIFLAGS "-i=mi1"
gdb_exit
if {[mi_gdb_start]} {
continue
}
# The procs below dealing with parsing cli/mi output for the threadlist
# is duplicated in gdb669.exp. Any changes here will probably need to
# be made there as well.
proc get_mi_thread_list {name} {
global expect_out
# MI will return a list of thread ids:
#
# -thread-list-ids
# ^done,thread-ids=[thread-id="1",thread-id="2",...],number-of-threads="N"
# (gdb)
mi_gdb_test "-thread-list-ids" \
{\^done,thread-ids={(thread-id="[0-9]+"(,)?)+},number-of-threads="[0-9]+"} \
"-thread_list_ids ($name)"
set output {}
if {[info exists expect_out(buffer)]} {
set output $expect_out(buffer)
}
set thread_list {}
if {![regexp {thread-ids=\{(thread-id="[0-9]+"(,)?)*\}} $output threads]} {
fail "finding threads in MI output ($name)"
} else {
pass "finding threads in MI output ($name)"
# Make list of console threads
set start [expr {[string first \{ $threads] + 1}]
set end [expr {[string first \} $threads] - 1}]
set threads [string range $threads $start $end]
foreach thread [split $threads ,] {
if {[scan $thread {thread-id="%d"} num]} {
lappend thread_list $num
}
}
}
return $thread_list
}
# Check that MI and the console know of the same threads.
# Appends NAME to all test names.
proc check_mi_and_console_threads {name} {
global expect_out
mi_gdb_test "-thread-list-ids" \
{\^done,thread-ids={(thread-id="[0-9]+"(,)*)+},number-of-threads="[0-9]+"} \
"-thread-list-ids ($name)"
set mi_output {}
if {[info exists expect_out(buffer)]} {
set mi_output $expect_out(buffer)
}
# GDB will return a list of thread ids and some more info:
#
# (gdb)
# -interpreter-exec console "info threads"
# ~" 4 Thread 2051 (LWP 7734) 0x401166b1 in __libc_nanosleep () at __libc_nanosleep:-1"
# ~" 3 Thread 1026 (LWP 7733) () at __libc_nanosleep:-1"
# ~" 2 Thread 2049 (LWP 7732) 0x401411f8 in __poll (fds=0x804bb24, nfds=1, timeout=2000) at ../sysdeps/unix/sysv/linux/poll.c:63"
# ~"* 1 Thread 1024 (LWP 7731) main (argc=1, argv=0xbfffdd94) at ../../../src/gdb/testsuite/gdb.mi/pthreads.c:160"
# FIXME: kseitz/2002-09-05: Don't use the hack-cli method.
mi_gdb_test "info threads" \
{.*(~".*"[\r\n]*)+.*} \
"info threads ($name)"
set console_output {}
if {[info exists $expect_out(buffer)]} {
set console_output $expect_out(buffer)
}
# Make a list of all known threads to console (gdb's thread IDs)
set console_thread_list {}
foreach line [split $console_output \n] {
if {[string index $line 0] == "~"} {
# This is a line from the console; trim off "~", " ", "*", and "\""
set line [string trim $line ~\ \"\*]
if {[scan $line "%d" id] == 1} {
lappend console_thread_list $id
}
}
}
# Now find the result string from MI
set mi_result ""
foreach line [split $mi_output \n] {
if {[string range $line 0 4] == "^done"} {
set mi_result $line
}
}
if {$mi_result == ""} {
fail "finding MI result string ($name)"
} else {
pass "finding MI result string ($name)"
}
# Finally, extract the thread ids and compare them to the console
set num_mi_threads_str ""
if {![regexp {number-of-threads="[0-9]+"} $mi_result num_mi_threads_str]} {
fail "finding number of threads in MI output ($name)"
} else {
pass "finding number of threads in MI output ($name)"
# Extract the number of threads from the MI result
if {![scan $num_mi_threads_str {number-of-threads="%d"} num_mi_threads]} {
fail "got number of threads from MI ($name)"
} else {
pass "got number of threads from MI ($name)"
# Check if MI and console have same number of threads
if {$num_mi_threads != [llength $console_thread_list]} {
fail "console and MI have same number of threads ($name)"
} else {
pass "console and MI have same number of threads ($name)"
# Get MI thread list
set mi_thread_list [get_mi_thread_list $name]
# Check if MI and console have the same threads
set fails 0
foreach ct [lsort $console_thread_list] mt [lsort $mi_thread_list] {
if {$ct != $mt} {
incr fails
}
}
if {$fails > 0} {
fail "MI and console have same threads ($name)"
# Send a list of failures to the log
send_log "Console has thread ids: $console_thread_list\n"
send_log "MI has thread ids: $mi_thread_list\n"
} else {
pass "MI and console have same threads ($name)"
}
}
}
}
}
# This procedure tests the various thread commands in MI.
proc check_mi_thread_command_set {} {
mi_runto done_making_threads
set thread_list [get_mi_thread_list "in check_mi_thread_command_set"]
mi_gdb_test "-thread-select" \
{\^error,msg="mi_cmd_thread_select: USAGE: threadnum."} \
"check_mi_thread_command_set: -thread-select"
mi_gdb_test "-thread-select 123456789" \
{\^error,msg="Thread ID 123456789 not known\."} \
"check_mi_thread_command_set: -thread-select 123456789"
foreach thread $thread_list {
# line and file are optional.
# many of the threads are blocked in libc calls,
# and many people have libc's with no symbols.
mi_gdb_test "-thread-select $thread" \
"\\^done,new-thread-id=\"$thread\",frame={.*}(,line=\"(-)?\[0-9\]+\",file=\".*\")?" \
"check_mi_thread_command_set: -thread-select $thread"
}
}
#
# Start here
#
set testfile "pthreads"
set srcfile "$testfile.c"
set binfile "$objdir/$subdir/mi1-$testfile"
set options [list debug incdir=$objdir]
if {[gdb_compile_pthreads "$srcdir/$subdir/$srcfile" $binfile executable $options] != "" } {
return -1
}
mi_gdb_reinitialize_dir $srcdir/$subdir
mi_gdb_load $binfile
check_mi_thread_command_set
mi_gdb_exit

View File

@ -1,89 +0,0 @@
# Copyright 1999, 2000, 2002 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
set MIFLAGS "-i=mi1"
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"
mi_next_to "main" "" "mi-read-memory.c" "20" "next at main"
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

View File

@ -1,129 +0,0 @@
# Copyright 1999, 2000, 2002 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
set MIFLAGS "-i=mi1"
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 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\]+)?)|(nan\\($hex\\)))"
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"
mi_gdb_test "002-data-list-changed-registers" \
"002\\^done,changed-registers=\\\[(\"${decimal}\"(,\"${decimal}\")*)?\\\]" \
"list changed registers"
}
if [istarget "sparc-*-*"] then {
sparc_register_tests_no_exec
mi_run_to_main
sparc_register_tests
} else {
verbose "mi-regs.exp tests ignored for this target"
}
mi_gdb_exit
return 0

View File

@ -1,72 +0,0 @@
# Copyright 1999, 2000, 2002 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
set MIFLAGS "-i=mi1"
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_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)"
}
}
}
mi_runto callee4
mi_gdb_test "205-break-delete" \
"205\\^done.*" \
"delete all breakpoints"
test_return_simple
mi_gdb_exit
return 0

View File

@ -1,199 +0,0 @@
# 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
set MIFLAGS "-i=mi1"
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=\\\[.*\\\],body=\\\[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=\\\[.*\\\],body=\\\[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=\"\[01\]\",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)"
}
}
}
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_next_to "main" "" "basics.c" "33" "next at main"
# FIXME: A string argument is not printed right; should be fixed and
# we should look for the right thing here.
# NOTE: The ``\\\\\"'' is for \".
mi_step_to "callee1" \
"\{name=\"intarg\",value=\"2\"\},\{name=\"strarg\",value=\"$hex \\\\\"A string argument\.\\\\\"\"\},\{name=\"fltarg\",value=\"3.5\"\}" \
"basics.c" "27" "step at main"
# FIXME: A string argument is not printed right; should be fixed and
# we should look for the right thing here.
mi_execute_to "exec-step 3" "end-stepping-range" "callee4" "" \
"basics.c" "8" "" "step to callee4"
# FIXME: A string argument is not printed right; should be fixed and
# we should look for the right thing here.
# NOTE: The ``.'' is part of ``gdb-result-var="$1"''
mi_finish_to "callee3" ".*" "basics.c" "18" ".1" "0" "exec-finish"
}
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

View File

@ -1,203 +0,0 @@
# Copyright 2000, 2002 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
set MIFLAGS "-i=mi1"
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_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=\"\[01\]\",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)"
}
mi_runto callee4
test_stack_frame_listing
test_stack_args_listing
test_stack_locals_listing
test_stack_info_depth
mi_gdb_exit
return 0

View File

@ -1,86 +0,0 @@
# Copyright 1999, 2000, 2002 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
set MIFLAGS "-i=mi1"
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_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=\"\[01\]\",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=\"\[01\]\",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=\"\[01\]\",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)"
}
}
}
mi_run_to_main
test_stepi_nexti
mi_gdb_exit
return 0

View File

@ -1,61 +0,0 @@
# Copyright 2003 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
#
# 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
set MIFLAGS "-i=mi1"
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_run_to_main
proc test_list_lines {} {
global mi_gdb_prompt
global hex
global decimal
global srcfile
# Test list-lines.
# Tests:
# -symbol-list-lines ${srcfile}
mi_gdb_test "-symbol-list-lines ${srcfile}" \
"\\^done,lines=\[\{pc=\"$hex\",line=\"$decimal\"\}.*\]" \
"symbol-list-lines for source file ${srcfile}"
}
test_list_lines
mi_gdb_exit
return 0

View File

@ -1,127 +0,0 @@
# 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
set MIFLAGS "-i=mi1"
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=\"\[01\]\",frame=\{addr=\"$hex\",func=\"foo\",args=\\\[\\\],file=\".*until.c\",line=\"10\"\}\r\n$mi_gdb_prompt$" {
pass "run to main"
}
-re ".*$mi_gdb_prompt$" {
fail "run to main (2)"
}
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=\"\[01\]\",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=\"\[01\]\",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=\"\[01\]\",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=\"\[01\]\",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

View File

@ -1,173 +0,0 @@
# Copyright (C) 1999, 2000, 2002 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 create, update, delete variables.
#
load_lib mi-support.exp
set MIFLAGS "-i=mi1"
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_runto do_block_tests
# 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;"
mi_step_to "do_block_tests" "" "var-cmd.c" "158" "step at do_block_test"
# 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;"
mi_step_to "do_block_tests" "" "var-cmd.c" "161" "step at do_block_test"
# 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;"
mi_step_to "do_block_tests" "" "var-cmd.c" "164" "step at do_block_test"
# 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;"
mi_step_to "do_block_tests" "" "var-cmd.c" "166" "step at do_block_test"
# 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;"
mi_step_to "do_block_tests" "" "var-cmd.c" "168" "step at do_block_test"
# 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;"
mi_step_to "do_block_tests" "" "var-cmd.c" "171" "step at do_block_test"
# 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

File diff suppressed because it is too large Load Diff

View File

@ -1,560 +0,0 @@
# Copyright (C) 1999, 2000, 2002 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 create, update, delete variables.
#
load_lib mi-support.exp
set MIFLAGS "-i=mi1"
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_runto do_locals_tests
# 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=\"1\",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 \\(\\*\\)\\((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;"
mi_step_to "do_locals_tests" "" "var-cmd.c" "107" "step at do_locals_test"
# 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;"
mi_step_to "do_locals_tests" "" "var-cmd.c" 108 "step at do_locals_tests (2)"
# 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';"
mi_step_to "do_locals_tests" "" "var-cmd.c" "109" "step at do_locals_tests (3)"
# 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;"
mi_step_to "do_locals_tests" "" "var-cmd.c" "110" "step at do_locals_tests (4)"
# 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';
mi_execute_to "exec-step 9" "end-stepping-range" "do_locals_tests" "" \
"var-cmd.c" "119" "" "step at do_locals_tests (5)"
# 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;
mi_execute_to "exec-step 4" "end-stepping-range" "do_locals_tests" "" \
"var-cmd.c" "125" "" "step at do_locals_tests (6)"
# 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';
mi_execute_to "exec-step 8" "end-stepping-range" "do_locals_tests" "" \
"var-cmd.c" "133" "" "step at do_locals_tests (7)"
# 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-update *" \
"\\^done,changelist=\{name=\"linteger\",in_scope=\"true\",type_changed=\"false\"\}" \
"update all vars: linteger changed after assign"
mi_gdb_test "-var-assign linteger 3333" \
"\\^done,value=\"3333\"" \
"assign to linteger again, same value"
mi_gdb_test "-var-update *" \
"\\^done,changelist=\{\}" \
"update all vars: linteger not changed after same assign"
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-update *" \
"\\^done,changelist=\{name=\"lpinteger\",in_scope=\"true\",type_changed=\"false\"\}" \
"update all vars: lpinteger changed after assign"
mi_gdb_test "-var-update *" \
"\\^done,changelist=\{\}" \
"update all vars: no changes for second update"
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.4567" \
"\\^done,value=\"3.45.*\"" \
"assign to lfloat"
mi_gdb_test "-var-evaluate-expression lfloat" \
"\\^done,value=\"3.45.*\"" \
"eval lfloat"
mi_gdb_test "-var-assign lfloat 1.2345" \
"\\^done,value=\"1.23.*\"" \
"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"
mi_continue_to "2" "subroutine1" \
"\{name=\"i\",value=\"4321\"\},\{name=\"l\",value=\"$hex\"\}" \
"var-cmd.c" "146" "continue to subroutine1"
# 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"
mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \
"var-cmd.c" "147" "step at subroutine1"
# 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 *-*-*
mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \
"var-cmd.c" "148" "step at subroutine1 (2)"
# 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"
mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \
"var-cmd.c" "149" "step at subroutine1 (3)"
# 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"
mi_next_to "do_locals_tests" "" "var-cmd.c" "136" "next out of subroutine1"
# 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"
# Test whether we can follow the name of a variable through multiple
# stack frames.
mi_gdb_test "-break-insert do_special_tests" \
{\^done,bkpt=.*} \
"set breakpoint at do_special_tests"
mi_continue_to {.*} do_special_tests {.*} {.*var-cmd.c} {.*} {stop in do_special_tests}
mi_gdb_test "-var-create selected_a @ a" \
{\^done,name="selected_a",numchild="0",type="int"} \
"create selected_a"
mi_gdb_test "-break-insert incr_a" \
{\^done,bkpt=.*} \
"set breakpoint at incr_a"
mi_continue_to {.*} incr_a {.*} {.*var-cmd.c} {.*} {stop in incr_a}
mi_gdb_test "-var-update selected_a" \
{\^done,changelist=\{name="selected_a",in_scope="true",new_type="char",new_num_children="0"\}} \
"update selected_a in incr_a"
mi_next "step a line in incr_a"
mi_next "return from incr_a to do_special_tests"
mi_gdb_test "-var-update selected_a" \
{\^done,changelist=\{name="selected_a",in_scope="true",new_type="int",new_num_children="0"\}} \
"update selected_a in do_special_tests"
mi_gdb_exit
return 0

View File

@ -1,627 +0,0 @@
# Copyright (C) 1999, 2000, 2002 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 create, update, delete variables.
#
load_lib mi-support.exp
set MIFLAGS "-i=mi1"
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=\"\[01\]\",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=\"1\",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 \\(\\*\\)\\((void|)\\)\"\},child=\{name=\"weird.func_ptr_struct\",exp=\"func_ptr_struct\",numchild=\"0\",type=\"struct _struct_decl \\(\\*\\)\\((int, char \\*, long int|)\\)\"\},child=\{name=\"weird.func_ptr_ptr\",exp=\"func_ptr_ptr\",numchild=\"0\",type=\"struct _struct_decl \\*\\(\\*\\)\\((int, char \\*, long int|)\\)\"\},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=\"\[01\]\",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=\"1\",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=\"1\",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=\"\[01\]\",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"
}
-re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"breakpoint-hit\",bkptno=\"3\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"incr_a\",args=\\\[\{name=\"a\",value=\"\.*\"\}\\\],file=\".*var-cmd.c\",line=\"8\[345\]\"\}\r\n$mi_gdb_prompt$" {
fail "continue to incr_a (compiler debug info incorrect)"
}
-re "\\^running\r\n${mi_gdb_prompt}.*\r\n$mi_gdb_prompt$" {
fail "continue to incr_a (unknown output)"
}
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

View File

@ -1,166 +0,0 @@
# Copyright 1999, 2000, 2002 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
set MIFLAGS "-i=mi1"
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=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"8\",times=\"1\"\},bkpt=\{number=\"2\",type=\".*watchpoint\",disp=\"keep\",enabled=\"y\",addr=\"\",what=\"C\",times=\"0\"\}\\\]\}" \
"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=\\\[.*\\\],body=\\\[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=\\\[.*\\\],body=\\\[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_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=\"\[01\]\",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=\"\[01\]\",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)"}
}
}
mi_runto callee4
test_watchpoint_creation_and_listing
#test_rwatch_creation_and_listing
#test_awatch_creation_and_listing
test_watchpoint_triggering
mi_gdb_exit
return 0