diff options
Diffstat (limited to 'gdb/testsuite')
98 files changed, 2248 insertions, 5725 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 1501073..2b4faeb 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,232 @@ +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 + executed is an alloc instruction. + +2004-02-11 David Carlton <carlton@kealia.com> + + * gdb.cp/breakpoint.exp: New. + * gdb.cp/breakpoint.cc: New. + +2004-02-11 Michael Chastain <mec.gnu@mindspring.com> + + Partial fix for PR gdb/1543. + * gdb.cp/ambiguous.exp, gdb.cp/annota2.exp, gdb.cp/annota3.exp, + gdb.cp/anon-union.exp, gdb.cp/casts.exp, gdb.cp/classes.exp, + gdb.cp/cplusfuncs.exp, gdb.cp/ctti.exp, gdb.exp/demangle.exp, + gdb.cp/derivation.exp, gdb.cp/exception.exp, gdb.cp/hang.exp, + gdb.cp/inherit.exp, gdb.cp/local.exp, gdb.cp/maint.exp, + gdb.cp/member-ptr.exp, gdb.cp/method.exp, gdb.cp/misc.exp, + gdb.cp/namespace.exp, gdb.cp/overload.exp, gdb.cp/ovldbreak.exp, + gdb.cp/psmang.exp, gdb.cp/ref-types.exp, gdb.cp/templates.exp, + gdb.cp/userdef.exp, gdb.cp/virtfunc.exp: Remove reference + to bug-gdb@prep.ai.mit.edu . + * gdb.cp/bs15503.cc, gdb.cp/class2.cc, gdb.cp/cttiadd.cc, + gdb.cp/cttiadd1.cc, gdb.cp/cttiadd2.cc, gdb.cp/cttiadd3.cc, + gdb.cp/exception.cc, gdb.cp/member-ptr.cc, gdb.cp/namespace1.cc: + Likewise. + +2004-02-10 Andrew Cagney <cagney@redhat.com> + + * lib/gdb.exp (gdb_expect_list): Recover from internal-errors + using gdb_internal_error_resync. + +2004-02-09 Daniel Jacobowitz <drow@mvista.com> + + * gdb.threads/thread-specific.exp: Stop early if no threads are + found. + +2004-02-09 Michael Chastain <mec.gnu@mindspring.com> + + * gdb.base/pending.exp: Remove extra \n from gdb_test calls. + +2004-02-08 Daniel Jacobowitz <drow@mvista.com> + + * lib/gdb.exp (gdb_breakpoint): Fail on unexpected pending + breakpoints. + +2004-02-07 Daniel Jacobowitz <drow@mvista.com> + + * config/sim.exp (gdb_load): Handle $arg == "". + * lib/gdb.exp (gdb_run_cmd): Honor gdb,do_reload_on_run. + * gdb.objc/basicclass.exp: Use gdb_run_cmd. + +2004-02-07 Elena Zannoni <ezannoni@redhat.com> + + * gdb.base/maint.exp: Update test to reflect + obstack changes. + +2004-02-04 Jeff Johnston <jjohnstn@redhat.com> + + * gdb.base/pendshr.c (pendfunc): New function that calls + pendfunc1. + * gdb.base/pending.c: Call pendfunc instead of pendfunc1. + +2004-02-04 Fred Fish <fnf@redhat.com> + + * gdb.arch/gdb1431.c: Add underbar prefixed version of global + function symbols and update copyright years. + * gdb.arch/gdb1291.c: Ditto. + +2004-02-03 Michael Chastain <mec.gnu@mindspring.com> + + * gdb.cp/virtfunc.exp: Accept both "ctor()" and "ctor(void)". + +2004-02-03 Michael Chastain <mec.gnu@mindspring.com> + + * gdb.cp/inherit.exp: Accept both "ctor()" and "ctor(void)". + +2004-02-03 Michael Chastain <mec.gnu@mindspring.com> + + * gdb.cp/inherit.exp: Accept output with gcc 3.2-7-rh. + +2004-02-02 Fred Fish <fnf@redhat.com> + + * gdb.base/bang.exp: Use gdb_run_cmd so this tests works with + remote targets. Update copyright years. + +2004-02-02 Jeff Johnston <jjohnstn@redhat.com> + + * lib/gdb.exp (gdb_breakpoint): Add pending breakpoint + support. + * gdb.base/langs.exp: Fix test which attempts to create + breakpoint on non-existent function to handle new pending + support. + * gdb.base/shlib-call.exp: Use gdb_breakpoint to set + a breakpoint. + * gdb.base/pending.exp: New test. + * gdb.base/pending.c: New file. + * gdb.base/pendshr.c: Ditto. + +2004-02-02 David Carlton <carlton@kealia.com> + + * gdb.cp/overload.exp: Add overloadNamespace tests. + * gdb.cp/overload.cc (dummyClass, dummyInstance): New. + (overloadNamespace, XXX): New. + (main): Call XXX::marker2. + +2004-02-01 Fred Fish <fnf@redhat.com> + + * gdb.base/dump.exp: Use runto_main instead of "runto main". + * gdb.base/finish.exp: Ditto. + * gdb.base/gcore.exp: Ditto. + * gdb.base/huge.exp: Ditto. + * gdb.base/info-proc.exp: Ditto. + * gdb.base/return2.exp: Ditto. + * gdb.threads/gcore-thread.exp: Ditto. + +2004-02-01 Daniel Jacobowitz <drow@mvista.com> + + * gdb.threads/thread-specific.exp: Add missing anchor to regexp. + +2004-02-01 Mark Kettenis <kettenis@gnu.org> + + * gdb.base/fileio.c (test_open): Replace O_RDONLY with O_RDWR such + that opening the file succeeds on OpenBSD. + +2004-02-01 Daniel Jacobowitz <drow@mvista.com> + + * gdb.threads/thread-specific.c: New file. + * gdb.threads/threads-specific.exp: New test script. + * lib/gdb.exp (gdb_test_multiple): Allow user patterns access + to expect_out. + +2004-02-01 Mark Kettenis <kettenis@gnu.org> + + * gdb.base/call-ar-st.exp: Call get_debug_format. Remove xfail on + sparc*-*-solaris* into a kfail PR gdb/1539 on sparc-*-* for stabs + only on the "print_small_structs from print_long_arg_list" test. + +2004-02-01 Daniel Jacobowitz <drow@mvista.com> + + * gdb.base/completion.exp: Kill a stray backslash. + + From Jim Ingham <jingham@apple.com>: + * gdb.base/completion.exp: Test that "complete file ./gdb.base/compl" + agrees with the result from sending a tab. + +2004-01-31 Daniel Jacobowitz <drow@mvista.com> + + * gdb.base/chng-syms.exp: Remove stray newline. + +2004-01-31 Mark Kettenis <kettenis@gnu.org> + + * gdb.asm/asm-source.exp: Set asm-note to "openbsd" for + *-*-openbsd*. + * gdb.asm/openbsd.inc: New file. + +2004-01-30 Mark Kettenis <kettenis@gnu.org> + + * gdb.asm/asm-source.exp: Strip -Wl, from link-flags. Don't + append -static to link-flags for *-*-freebsd*, *-*netbsd* and + *-*solaris2*. Remove commented out default settings for + asm-flags. Replace gdb_compile with target_link. + +2004-01-29 Michael Chastain <mec.gnu@mindspring.com> + + * gdb.cp/inherit.exp: Rewrite. Use gdb_test_multiple and gdb + for all tests. Remove old hp-ux and cygnus xfail cases. + +2004-01-29 Paul N. Hilfinger <Hilfinger@gnat.com> + + * gdb.base/chng-syms.exp: New file. + * gdb.base/chng-syms.c: New file. + +2004-01-24 Michael Chastain <mec.gnu@mindspring.com> + + * gdb.cp/local.exp: Rewrite "ptype Local". Add "ptype l". + Provide arms for current output in all my configurations. + +2004-01-24 Michael Chastain <mec.gnu@mindspring.com> + + * lib/compiler.c: Add hp_cc_compiler and hp_aCC_compiler. + * lib/compiler.cc: Likewise. + * lib/gdb.exp (get_compiler_info): Always call gdb_compile to + get the right preprocessor. Eval the output directly. Remove + special tests for hp_cc_compiler and hp_aCC_compiler. Remove + hp_f77_compiler and hp_f90_compiler completely. + (gdb_preprocess): Delete. + (get_compiler): Delete. + +2004-01-24 Mark Kettenis <kettenis@gnu.org> + + * gdb.base/charset.c, gdb.base/dump.c, gdb.base/huge.c: Include + <string.h>. + +2004-01-24 Nick Roberts <nick@nick.uklinux.net> + + * gdb.mi/mi-stack.exp: Update copyright. + +2004-01-23 David Carlton <carlton@kealia.com> + + * gdb.cp/rtti.exp: Don't include full path in ${srcfile}. Add + test for cp_lookup_transparent_type. + * gdb.cp/rtti1.cc: Update copyright. Add n2::func and refer_to; + call them. + +2004-01-23 Daniel Jacobowitz <drow@mvista.com> + + * gdb.mi/mi-var-child.exp: Update copyright year. Move new test + after -var-update. + +2004-01-23 David Carlton <carlton@kealia.com> + + * gdb.cp/namespace.cc (C::ensureRefs): New. + * gdb.cp/namespace1.cc (C::ensureOtherRefs): New. + 2004-01-20 Nick Roberts <nick@nick.uklinux.net> * gdb.mi/mi-stack.exp (test_stack_locals_listing): Test for diff --git a/gdb/testsuite/config/sim.exp b/gdb/testsuite/config/sim.exp index 5d8a93d..6ecdc52 100644 --- a/gdb/testsuite/config/sim.exp +++ b/gdb/testsuite/config/sim.exp @@ -1,5 +1,5 @@ # Test Framework Driver for GDB driving a builtin simulator -# Copyright 1994, 1997, 1998 Free Software Foundation, Inc. +# Copyright 1994, 1997, 1998, 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 @@ -55,7 +55,9 @@ proc gdb_load { arg } { global GDB global gdb_prompt - if [gdb_file_cmd $arg] then { return -1 } + if { $arg != "" } { + if [gdb_file_cmd $arg] then { return -1 } + } gdb_target_sim diff --git a/gdb/testsuite/gdb.arch/gdb1291.c b/gdb/testsuite/gdb.arch/gdb1291.c index 2178f70..7e70e6e 100755 --- a/gdb/testsuite/gdb.arch/gdb1291.c +++ b/gdb/testsuite/gdb.arch/gdb1291.c @@ -1,4 +1,4 @@ -/* Copyright 2003 Free Software Foundation, Inc.
+/* Copyright 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
@@ -29,6 +29,7 @@ main() asm(".text\n"
" .align 5\n"
"sub:\n"
+ "_sub:\n"
" mov.l r14,@-r15\n"
" mov.w .STACK2,r3\n"
" sub r3,r15\n"
diff --git a/gdb/testsuite/gdb.arch/gdb1431.c b/gdb/testsuite/gdb.arch/gdb1431.c index 0041042..64f5c60 100755 --- a/gdb/testsuite/gdb.arch/gdb1431.c +++ b/gdb/testsuite/gdb.arch/gdb1431.c @@ -1,4 +1,4 @@ -/* Copyright 2003 Free Software Foundation, Inc.
+/* Copyright 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
@@ -31,6 +31,7 @@ main() asm(".text\n"
" .align 5\n"
"sub1:\n"
+ "_sub1:\n"
" mov.l r14,@-r15\n"
" add #-128,r15\n"
" add #-128,r15\n"
@@ -48,6 +49,7 @@ asm(".text\n" asm(".text\n"
" .align 5\n"
"sub2:\n"
+ "_sub2:\n"
" mov.l r14,@-r15\n"
" mov.w .STACK2,r3\n"
" sub r3,r15\n"
diff --git a/gdb/testsuite/gdb.asm/asm-source.exp b/gdb/testsuite/gdb.asm/asm-source.exp index 301b778..75e64b4 100644 --- a/gdb/testsuite/gdb.asm/asm-source.exp +++ b/gdb/testsuite/gdb.asm/asm-source.exp @@ -70,7 +70,7 @@ switch -glob -- [istarget] { } "m32r*-*" { set asm-arch m32r - append link-flags " -Wl,--whole-archive -lgloss -Wl,--no-whole-archive" + append link-flags "--whole-archive -lgloss --no-whole-archive" } "m6811-*-*" { set asm-arch m68hc11 @@ -118,26 +118,19 @@ if { "${asm-arch}" == "" } { gdb_suppress_entire_file "Assembly source test -- not implemented for this target." } -# On FreeBSD and NetBSD, the final link will fail because of -# unresolved symbols. It turns out that libc.so references symbols -# that are normally provided by crt1.o, which isn't linked in since we -# specify -nostartfiles. Using -nostdlib doesn't help since -# target_compile automatically adds -lm. Linking statically avoids -# this mess. -# -# On Solaris, linking dynamically results in a binary that dumps core. -# -if {[istarget "*-*-freebsd*"] || [istarget "*-*-netbsd*"] - || [istarget "*-*-solaris2*"]} then { - append link-flags " -static" -} - # On NetBSD/ELF we need a special NetBSD-identifying note section. if { [istarget "*-*-netbsdelf*"] || [istarget "x86_64-*-netbsd*"] } then { set asm-note "netbsd" } +# On OpenBSD/ELF we need a similar note section. We make no attempt +# of handing a.out here since most OpenBSD/a.out systems use a rather +# outdated assembler that doesn't assemble this test's code anyway. +if { [istarget "*-*-openbsd*"] } then { + set asm-note "openbsd" +} + # Watch out, we are invoking the assembler, but the testsuite sets multilib # switches according to compiler syntax. If we pass these options straight # to the assembler, they won't always make sense. If we don't pass them to @@ -164,7 +157,6 @@ remote_exec build "rm -f ${subdir}/note.inc" remote_download host ${srcdir}/${subdir}/${asm-note}.inc ${subdir}/note.inc if { "${asm-flags}" == "" } { - #set asm-flags "-Wa,-gstabs,-I${srcdir}/${subdir},-I${objdir}/${subdir}" set asm-flags "-gstabs -I${srcdir}/${subdir} -I${objdir}/${subdir}" } @@ -175,11 +167,13 @@ if {[target_assemble ${srcdir}/${subdir}/${srcfile2} asmsrc2.o "${asm-flags}"] ! gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } -set opts "debug ldflags=-nostartfiles" -foreach i ${link-flags} { - append opts " ldflags=$i" -} -if { [gdb_compile "asmsrc1.o asmsrc2.o" "${binfile}" executable $opts] != "" } { +# We deliberately don't use gdb_compile here to link together the +# assembled object files. Using gdb_compile, and therefore the C +# compiler, is conceptually wrong, since we're testing raw assembler +# code here that provides its own startup code. Using target_link +# also avoids a lot of problems on many systems, most notably on +# *-*-*bsd* and *-*-solaris2*. +if {[target_link "asmsrc1.o asmsrc2.o" "${binfile}" ${link-flags}] != "" } then { gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } diff --git a/gdb/testsuite/gdb.asm/ia64.inc b/gdb/testsuite/gdb.asm/ia64.inc index d55cd22..31f37c1 100644 --- a/gdb/testsuite/gdb.asm/ia64.inc +++ b/gdb/testsuite/gdb.asm/ia64.inc @@ -36,6 +36,7 @@ comment "crt0 startup" .macro gdbasm_startup + gdbasm_enter mov r32=r0 nop.i 0 nop.i 0 diff --git a/gdb/testsuite/gdb.asm/openbsd.inc b/gdb/testsuite/gdb.asm/openbsd.inc new file mode 100644 index 0000000..90e3dbd --- /dev/null +++ b/gdb/testsuite/gdb.asm/openbsd.inc @@ -0,0 +1,12 @@ + comment "openbsd .note" + +.section ".note.openbsdbsd.ident", "a" + .p2align 2 + + .long 8 + .long 4 + .long 1 + .ascii "OpenBSD\0\0" + .long 200311 + + .p2align 2 diff --git a/gdb/testsuite/gdb.base/Makefile.in b/gdb/testsuite/gdb.base/Makefile.in index e59f57b..9f382db 100644 --- a/gdb/testsuite/gdb.base/Makefile.in +++ b/gdb/testsuite/gdb.base/Makefile.in @@ -3,7 +3,7 @@ srcdir = @srcdir@ EXECUTABLES = all-types annota1 bitfields break \ call-ar-st call-rt-st call-strs callfuncs callfwmall \ - commands compiler condbreak constvars coremaker \ + chng-syms commands compiler condbreak constvars coremaker \ dbx-test display ending-run execd-prog exprs \ foll-exec foll-fork foll-vfork funcargs int-type interrupt jump \ langs list long_long mips_pro miscexprs nodebug opaque overlays \ diff --git a/gdb/testsuite/gdb.base/bang.exp b/gdb/testsuite/gdb.base/bang.exp index f584074..1e18328 100644 --- a/gdb/testsuite/gdb.base/bang.exp +++ b/gdb/testsuite/gdb.base/bang.exp @@ -1,4 +1,4 @@ -# Copyright 2003 Free Software Foundation, Inc. +# Copyright 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 @@ -35,7 +35,13 @@ gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} # Verify that we can run the program and that it terminates normally. -gdb_test "run" \ - ".*Program exited normally\." \ - "run program" +gdb_run_cmd +gdb_expect { + -re ".*Program exited normally\.\r\n$gdb_prompt $" { + pass "run program" + } + timeout { + fail "run program (timeout)" + } +} diff --git a/gdb/testsuite/gdb.base/call-ar-st.exp b/gdb/testsuite/gdb.base/call-ar-st.exp index 1431bc5..9b0e539 100644 --- a/gdb/testsuite/gdb.base/call-ar-st.exp +++ b/gdb/testsuite/gdb.base/call-ar-st.exp @@ -105,6 +105,8 @@ if ![runto_main] then { continue } +get_debug_format + #go -until 1209 gdb_test "tbreak 1209" \ "Breakpoint \[0-9\]+.*file.*$srcfile, line 1209.*" \ @@ -500,11 +502,14 @@ set ws "\[\n\r\t \]+" if {![gdb_skip_float_test "print_small_structs from print_long_arg_list"] && \ ![gdb_skip_stdio_test "print_small_structs from print_long_arg_list"] } { - # On Solaris, some of the args are passed by ref, others by value, - # and GDB gets confused and says "Invalid cast" because it thinks - # it has to cast the structure into a pointer to structure. A real - # GDB bug, probably for all Sparc configs, but obscure. -sts 1999-08-17. - setup_xfail "sparc*-*-solaris*" + + # On 32-bit SPARC, some of the args are passed by ref, others by + # value, and GDB gets confused and says "Invalid cast" because it + # thinks it has to cast the structure into a pointer to structure. + if { [test_debug_format "stabs"] } then { + setup_kfail "gdb/1539" "sparc-*-*" + } + send_gdb "print print_small_structs(struct1, struct2, struct3, struct4, flags, flags_combo, three_char, five_char, int_char_combo, d1, d2, d3, f1, f2, f3)\n" gdb_expect_list "print print_small_structs from print_long_arg_list" ".*$gdb_prompt $" { "\[\t\r\n \]+alpha" diff --git a/gdb/testsuite/gdb.base/charset.c b/gdb/testsuite/gdb.base/charset.c index ece684a..a7b7123 100644 --- a/gdb/testsuite/gdb.base/charset.c +++ b/gdb/testsuite/gdb.base/charset.c @@ -2,6 +2,7 @@ Jim Blandy <jimb@cygnus.com> --- December 2001 */ #include <stdio.h> +#include <string.h> /* X_string is a null-terminated string in the X charset whose diff --git a/gdb/testsuite/gdb.base/chng-syms.c b/gdb/testsuite/gdb.base/chng-syms.c new file mode 100644 index 0000000..3394f5c --- /dev/null +++ b/gdb/testsuite/gdb.base/chng-syms.c @@ -0,0 +1,22 @@ +/* + * Test that GDB cleans up properly after errors that result when a + * breakpoint is reset. + */ + +/* VARIABLE is a macro defined on the compiler command line. */ + +#include <stdlib.h> + +int VARIABLE = 42; + +void stop_here () +{ + VARIABLE *= 2; +} + +int main () +{ + stop_here (); + exit (0); +} + diff --git a/gdb/testsuite/gdb.base/chng-syms.exp b/gdb/testsuite/gdb.base/chng-syms.exp new file mode 100644 index 0000000..18f847f --- /dev/null +++ b/gdb/testsuite/gdb.base/chng-syms.exp @@ -0,0 +1,120 @@ +# Copyright 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 + +# Author: Paul N. Hilfinger (Hilfinger@gnat.com) + +# Test that GDB cleans up properly after errors that result when a +# breakpoint is reset. + +if $tracelevel then { + strace $tracelevel +} + +set prms_id 0 +set bug_id 0 + +# IDT/SIM apparently doesn't have enough file descriptors to allow the +# problem checked by this test to occur. +if [istarget "mips-idt-*"] { + return 0; +} + +set testfile "chng-syms" +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DVARIABLE=var1}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +set oldtimeout $timeout +set timeout 10 +verbose "Timeout is now 10 seconds" 2 + +proc expect_to_stop_here { ident } { + global gdb_prompt + global decimal + + # the "at foo.c:36" output we get with -g. + # the "in func" output we get without -g. + gdb_expect { + -re "Breakpoint \[0-9\]*, stop_here .*$gdb_prompt $" { + return 1 + } + -re "$gdb_prompt $" { + fail "running to stop_here $ident" + return 0 + } + timeout { + fail "running to stop_here $ident (timeout)" + return 0 + } + } + return 1 +} + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +gdb_test "break stop_here if (var1 == 42)" \ + "Breakpoint.*at.* file .*$srcfile, line.*" \ + "setting conditional breakpoint on function" +gdb_run_cmd + +expect_to_stop_here "first time" + +gdb_continue_to_end "breakpoint first time through" + +# Now we recompile the executable, but without a variable named "var1", first +# waiting to insure that even on fast machines, the file modification times +# are distinct. This will force GDB to reload the file on the +# next "run" command, causing an error when GDB tries to tries to reset +# the breakpoint. + +sleep 2 +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DVARIABLE=var2}] != "" } { + +# Complication: Since GDB generally holds an open file descriptor on the +# executable at this point, there are some systems in which the +# re-compilation will fail. In such cases, we'll consider the test +# (vacuously) passed providing that re-running it succeeds as before. + + gdb_run_cmd + expect_to_stop_here "after re-compile fails" + gdb_continue_to_end "after re-compile fails" + +} else { + + gdb_run_cmd + gdb_expect { + -re "Error in re-setting .*No symbol .var1..*Program exited normally.*" { + pass "running with invalidated bpt condition after executable changes" + } + timeout { + fail "(timeout) running with invalidated bpt condition after executable changes" + } + } + +} + +set timeout $oldtimeout +verbose "Timeout is now $timeout seconds" 2 +return 0 diff --git a/gdb/testsuite/gdb.base/completion.exp b/gdb/testsuite/gdb.base/completion.exp index ccf00cf..1698a30 100644 --- a/gdb/testsuite/gdb.base/completion.exp +++ b/gdb/testsuite/gdb.base/completion.exp @@ -657,6 +657,15 @@ gdb_test "cd ${fullsrcdir}" \ "Working directory [string_to_regexp ${fullsrcdir}].*" \ "cd to \${srcdir}" +send_gdb "complete file ./gdb.base/compl\n" +sleep 1 +gdb_expect { + -re "file ./gdb.base/completion\\.exp.*$gdb_prompt $" + { pass "complete-command 'file ./gdb.base/compl'"} + -re ".*$gdb_prompt $" { fail "complete-command 'file ./gdb.base/compl'" } + timeout { fail "(timeout) complete-command 'file ./gdb.base/compl'" } +} + send_gdb "file ./gdb.base/complet\t" sleep 1 gdb_expect { @@ -664,7 +673,6 @@ gdb_expect { { send_gdb "\n" gdb_expect { -re "\r\nA program is being debugged already\\. Kill it\\? \\(y or n\\) $" -\ { send_gdb "n\n" gdb_expect { -re "\r\nProgram not killed\\.\r\n$gdb_prompt $"\ diff --git a/gdb/testsuite/gdb.base/dump.c b/gdb/testsuite/gdb.base/dump.c index 784edf6..bc68778 100644 --- a/gdb/testsuite/gdb.base/dump.c +++ b/gdb/testsuite/gdb.base/dump.c @@ -1,3 +1,5 @@ +#include <string.h> + #define ARRSIZE 32 int intarray[ARRSIZE], intarray2[ARRSIZE]; diff --git a/gdb/testsuite/gdb.base/dump.exp b/gdb/testsuite/gdb.base/dump.exp index 0bc4472..e09a60c 100644 --- a/gdb/testsuite/gdb.base/dump.exp +++ b/gdb/testsuite/gdb.base/dump.exp @@ -1,4 +1,4 @@ -# Copyright 2002 Free Software Foundation, Inc. +# Copyright 2002, 2004 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -264,7 +264,7 @@ gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} # Run to main. -if { ! [ runto main ] } then { +if { ! [ runto_main ] } then { gdb_suppress_entire_file "Program failed to run, so remaining tests in this file will automatically fail." } diff --git a/gdb/testsuite/gdb.base/fileio.c b/gdb/testsuite/gdb.base/fileio.c index 4fda0fd..c9ef715 100644 --- a/gdb/testsuite/gdb.base/fileio.c +++ b/gdb/testsuite/gdb.base/fileio.c @@ -75,7 +75,7 @@ test_open () /* Test opening */ errno = 0; - ret = open (FILENAME, O_CREAT | O_TRUNC | O_RDONLY, S_IWUSR | S_IRUSR); + ret = open (FILENAME, O_CREAT | O_TRUNC | O_RDWR, S_IWUSR | S_IRUSR); printf ("open 1: ret = %d, errno = %d %s\n", ret, errno, ret >= 0 ? "OK" : ""); if (ret >= 0) diff --git a/gdb/testsuite/gdb.base/finish.exp b/gdb/testsuite/gdb.base/finish.exp index 064f26e..8818233 100644 --- a/gdb/testsuite/gdb.base/finish.exp +++ b/gdb/testsuite/gdb.base/finish.exp @@ -1,4 +1,4 @@ -# Copyright 2000 Free Software Foundation, Inc. +# Copyright 2000, 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 @@ -100,7 +100,7 @@ proc finish_void { } { proc finish_tests { } { global gdb_prompt - if { ! [ runto main ] } then { + if { ! [ runto_main ] } then { gdb_suppress_entire_file "Run to main failed, so all tests in this file will automatically fail." } diff --git a/gdb/testsuite/gdb.base/gcore.exp b/gdb/testsuite/gdb.base/gcore.exp index 0576638..33fcba4 100644 --- a/gdb/testsuite/gdb.base/gcore.exp +++ b/gdb/testsuite/gdb.base/gcore.exp @@ -1,4 +1,4 @@ -# Copyright 2002, 2003 Free Software Foundation, Inc. +# Copyright 2002, 2003, 2004 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -61,7 +61,7 @@ gdb_expect { } } -if { ! [ runto main ] } then { +if { ! [ runto_main ] } then { gdb_suppress_entire_file "Run to main failed, so all tests in this file will automatically fail." } diff --git a/gdb/testsuite/gdb.base/huge.c b/gdb/testsuite/gdb.base/huge.c index 419b92c..446bb18 100644 --- a/gdb/testsuite/gdb.base/huge.c +++ b/gdb/testsuite/gdb.base/huge.c @@ -2,6 +2,8 @@ * Test GDB's ability to read a very large data object from target memory. */ +#include <string.h> + /* A value that will produce a target data object large enough to crash GDB. 0x200000 is big enough on GNU/Linux, other systems may need a larger number. */ diff --git a/gdb/testsuite/gdb.base/huge.exp b/gdb/testsuite/gdb.base/huge.exp index fa50d01..733ddee 100644 --- a/gdb/testsuite/gdb.base/huge.exp +++ b/gdb/testsuite/gdb.base/huge.exp @@ -1,4 +1,4 @@ -# Copyright 2001 Free Software Foundation, Inc. +# Copyright 2001, 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 @@ -49,7 +49,7 @@ gdb_load ${binfile} set timeout 30 -if { ! [ runto main ] } then { +if { ! [ runto_main ] } then { gdb_suppress_entire_file "Run to main failed, so all tests in this file will automatically fail." } diff --git a/gdb/testsuite/gdb.base/info-proc.exp b/gdb/testsuite/gdb.base/info-proc.exp index d0da68f..fc68601 100644 --- a/gdb/testsuite/gdb.base/info-proc.exp +++ b/gdb/testsuite/gdb.base/info-proc.exp @@ -1,4 +1,4 @@ -# Copyright 2002, 2003 Free Software Foundation, Inc. +# Copyright 2002, 2003, 2004 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -74,7 +74,7 @@ gdb_expect { gdb_test "info proc" "No current process.*" "info proc without a process" -if { ! [ runto main ] } then { +if { ! [ runto_main ] } then { gdb_suppress_entire_file "Run to main failed, so all tests in this file will automatically fail." } diff --git a/gdb/testsuite/gdb.base/langs.exp b/gdb/testsuite/gdb.base/langs.exp index 8006bbf..a81df66 100644 --- a/gdb/testsuite/gdb.base/langs.exp +++ b/gdb/testsuite/gdb.base/langs.exp @@ -65,8 +65,15 @@ gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_load $binfile -gdb_test "b langs0" "Function \"langs0\" not defined\.|Breakpoint .* (deferred).*" \ - "break on nonexistent function in langs.exp" +gdb_test_multiple "b langs0" "break on nonexistent function in langs.exp" { + -re "Function \"langs0\" not defined\..*Make breakpoint pending on future shared library load.*y or n. $" { + + gdb_test "n" "" "break on nonexistent function in langs.exp" + } + -re "Breakpoint .* (deferred).*$gdb_prompt $" { + pass "break on nonexistent function in langs.exp" + } +} if {$hp_aCC_compiler} { set isfixed 1 diff --git a/gdb/testsuite/gdb.base/maint.exp b/gdb/testsuite/gdb.base/maint.exp index 3e98c00..53d5825 100644 --- a/gdb/testsuite/gdb.base/maint.exp +++ b/gdb/testsuite/gdb.base/maint.exp @@ -191,6 +191,11 @@ gdb_expect { send_gdb "maint print statistics\n" gdb_expect { -re "Statistics for.*break.*Number of \"minimal\" symbols read.*Number of \"partial\" symbols read.*Number of \"types\" defined.*Number of psym tables \\(not yet expanded\\).*Number of symbol tables.*Number of symbol tables with line tables.*Number of symbol tables with blockvectors.*Total memory used for psymbol obstack.*Total memory used for psymbol cache.*Total memory used for symbol obstack.*Total memory used for type obstack.*$gdb_prompt $"\ + { + # Old output for gdb 6.0 and earlier + pass "maint print statistics" + } + -re "Statistics for.*break.*Number of \"minimal\" symbols read.*Number of \"partial\" symbols read.*Number of \"types\" defined.*Number of psym tables \\(not yet expanded\\).*Number of symbol tables.*Number of symbol tables with line tables.*Number of symbol tables with blockvectors.*Total memory used for objfile obstack.*Total memory used for psymbol cache.*Total memory used for macro cache.*$gdb_prompt $"\ { pass "maint print statistics" } -re ".*$gdb_prompt $" { fail "maint print statistics" } timeout { fail "(timeout) maint print statistics" } diff --git a/gdb/testsuite/gdb.base/pending.c b/gdb/testsuite/gdb.base/pending.c new file mode 100644 index 0000000..a83a451 --- /dev/null +++ b/gdb/testsuite/gdb.base/pending.c @@ -0,0 +1,35 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 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 */ + +#include <stdio.h> + +int k = 0; + +extern void pendfunc (int x); + +int main() +{ + pendfunc (3); /* break main here */ + pendfunc (4); + k = 1; + pendfunc (3); + return 0; +} diff --git a/gdb/testsuite/gdb.base/pending.exp b/gdb/testsuite/gdb.base/pending.exp new file mode 100644 index 0000000..2cef30a --- /dev/null +++ b/gdb/testsuite/gdb.base/pending.exp @@ -0,0 +1,266 @@ +# Copyright 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 was created by Jeff Johnston. (jjohnstn@redhat.com) +# The shared library compilation portion was copied from shlib-call.exp which was +# written by Elena Zannoni (ezannoni@redhat.com). + +if $tracelevel then { + strace $tracelevel +} + +# +# test running programs +# +set prms_id 0 +set bug_id 0 + +# are we on a target board? +if ![isnative] then { + return 0 +} + +set testfile "pending" +set libfile "pendshr" +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} + +if [get_compiler_info ${binfile}] { + return -1 +} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}.o" object {debug}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +# Build the shared libraries this test case needs. +# + +if {$gcc_compiled == 0} { + if [istarget "hppa*-hp-hpux*"] then { + set additional_flags "additional_flags=+z" + } elseif { [istarget "mips-sgi-irix*"] } { + # Disable SGI compiler's implicit -Dsgi + set additional_flags "additional_flags=-Usgi" + } else { + # don't know what the compiler is... + set additional_flags "" + } +} else { + if { ([istarget "powerpc*-*-aix*"] + || [istarget "rs6000*-*-aix*"]) } { + set additional_flags "" + } else { + set additional_flags "additional_flags=-fpic" + } +} + +if {[gdb_compile "${srcdir}/${subdir}/${libfile}.c" "${objdir}/${subdir}/${libfile}.o" object [list debug $additional_flags]] != ""} { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if [istarget "hppa*-*-hpux*"] { + remote_exec build "ld -b ${objdir}/${subdir}/${libfile}.o -o ${objdir}/${subdir}/${libfile}.sl" +} else { + set additional_flags "additional_flags=-shared" + if {[gdb_compile "${objdir}/${subdir}/${libfile}.o" "${objdir}/${subdir}/${libfile}.sl" executable [list debug $additional_flags]] != ""} { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." + } +} + +if { ($gcc_compiled + && ([istarget "powerpc*-*-aix*"] + || [istarget "rs6000*-*-aix*"] )) } { + set additional_flags "additional_flags=-L${objdir}/${subdir}" +} elseif { [istarget "mips-sgi-irix*"] } { + set additional_flags "additional_flags=-rpath ${objdir}/${subdir}" +} else { + set additional_flags "" +} +if {[gdb_compile "${objdir}/${subdir}/${testfile}.o ${objdir}/${subdir}/${libfile}.sl" "${binfile}" executable [list debug $additional_flags]] != ""} { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +if [target_info exists gdb_stub] { + gdb_step_for_stub; +} +# +# Test setting, querying, and modifying pending breakpoints +# + +gdb_test_multiple "break pendfunc1" "set pending breakpoint" { + -re ".*Make breakpoint pending.*y or n. $" { + gdb_test "y" "Breakpoint.*pendfunc1.*pending." "set pending breakpoint" + } +} + +gdb_test "info break" \ + "Num Type\[ \]+Disp Enb Address\[ \]+What.* +\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*pendfunc1.*" \ +"single pending breakpoint info" + +# +# Test breaking at existing function +# + +set mainline [gdb_get_line_number "break main here"] + +gdb_test "break main" \ + "Breakpoint.*at.* file .*$srcfile, line $mainline.*" \ + "breakpoint function" + +gdb_test "info break" \ + "Num Type\[ \]+Disp Enb Address\[ \]+What.* +\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*pendfunc1.* +\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline" \ +"pending plus real breakpoint info" + + +# +# Test not setting a pending breakpoint +# +gdb_test_multiple "break pendfunc2" "Don't set pending breakpoint" { + -re ".*Make breakpoint pending.*y or n. $" { + gdb_test "n" "" "Don't set pending breakpoint" + } +} + +# +# Add condition to pending breakpoint +# + +gdb_test "condition 1 k == 1" "" + +gdb_test "info break" \ + "Num Type\[ \]+Disp Enb Address\[ \]+What.* +\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*pendfunc1.* +\[\t \]+stop only if k == 1.* +\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline" \ +"pending plus condition" + +# +# Disable pending breakpoint +# + +gdb_test "disable 1" "" + +gdb_test "info break" \ + "Num Type\[ \]+Disp Enb Address\[ \]+What.* +\[0-9\]+\[\t \]+breakpoint keep n.*PENDING.*pendfunc1.* +\[\t \]+stop only if k == 1.* +\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline" \ +"pending disabled" + +# +# Add commands to pending breakpoint +# +gdb_test "commands 1\nprint k\nend" "" \ + "Set commands for pending breakpoint" + +gdb_test "info break" \ + "Num Type\[ \]+Disp Enb Address\[ \]+What.* +\[0-9\]+\[\t \]+breakpoint keep n.*PENDING.*pendfunc1.* +\[\t \]+stop only if k == 1.* +\[\t \]+print k.* +\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline" \ +"pending disabled plus commands" + +# +# Try a pending break for a line in a source file with a condition +# + +gdb_test_multiple "break pendshr.c:26 if x > 3" "Set pending breakpoint 2" { + -re ".*Make breakpoint pending.*y or n. $" { + gdb_test "y" "Breakpoint.*pendshr.c:26.*pending." \ + "Set pending breakpoint 2" + } +} + +gdb_test "info break" \ + "Num Type\[ \]+Disp Enb Address\[ \]+What.* +\[0-9\]+\[\t \]+breakpoint keep n.*PENDING.*pendfunc1.* +\[\t \]+stop only if k == 1.* +\[\t \]+print k.* +\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline.* +\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*pendshr.c:26 if x > 3.*" \ +"multiple pending breakpoints" + +# +# Run to main which should resolve a pending breakpoint +# + +gdb_test "run" \ +"Breakpoint.*at.* +Pending breakpoint \"pendshr.c:26 if x > 3\" resolved.* +Breakpoint.*, main.*$mainline.*" \ +"running to main" + +# +# Re-enable the first pending breakpoint which should resolve +# + +gdb_test "enable 1" \ +"Breakpoint.*at.* +Pending breakpoint \"pendfunc1.* resolved.*" \ +"re-enabling pending breakpoint that can resolve instantly" + +# +# Continue to verify conditionals and commands for breakpoints are honored +# + +gdb_test "continue" \ +".*Breakpoint.*pendfunc1.*at.*pendshr.c:26.*4;" \ +"continue to resolved breakpoint 2" + +gdb_test "continue" \ +".*Breakpoint.*pendfunc1.*at.*pendshr.c:26.* +\[$\]1 = 1." \ +"continue to resolved breakpoint 1" + +delete_breakpoints + +gdb_breakpoint "main" + +# +# Set non-existent pending breakpoint +# +gdb_test_multiple "break imaginary" "set imaginary pending breakpoint" { + -re ".*Make breakpoint pending.*y or n. $" { + gdb_test "y" "Breakpoint.*imaginary.*pending." \ + "set imaginary pending breakpoint" + } +} + +# +# rerun program and make sure that any pending breakpoint remains and no +# error messages are issued for the missing function +# + +rerun_to_main +gdb_test "info break" \ + "Num Type\[ \]+Disp Enb Address\[ \]+What.* +\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline.* +\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*imaginary.*" \ +"verify pending breakpoint after restart" diff --git a/gdb/testsuite/gdb.base/pendshr.c b/gdb/testsuite/gdb.base/pendshr.c new file mode 100644 index 0000000..672fe8a --- /dev/null +++ b/gdb/testsuite/gdb.base/pendshr.c @@ -0,0 +1,33 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 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 */ + +#include <stdio.h> + +void pendfunc1 (int x) +{ + int y = x + 4; + printf ("in pendfunc1, x is %d\n", x); +} + +void pendfunc (int x) +{ + pendfunc1 (x); +} diff --git a/gdb/testsuite/gdb.base/return2.exp b/gdb/testsuite/gdb.base/return2.exp index c87d9e4..050ccf9 100644 --- a/gdb/testsuite/gdb.base/return2.exp +++ b/gdb/testsuite/gdb.base/return2.exp @@ -1,4 +1,4 @@ -# Copyright 2000, 2001 Free Software Foundation, Inc. +# Copyright 2000, 2001, 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 @@ -100,7 +100,7 @@ proc return_void { } { proc return2_tests { } { global gdb_prompt - if { ! [ runto main ] } then { + if { ! [ runto_main ] } then { gdb_suppress_entire_file "Run to main failed, so all tests in this file will automatically fail." } diff --git a/gdb/testsuite/gdb.base/shlib-call.exp b/gdb/testsuite/gdb.base/shlib-call.exp index 8fe8b22..4205253 100644 --- a/gdb/testsuite/gdb.base/shlib-call.exp +++ b/gdb/testsuite/gdb.base/shlib-call.exp @@ -1,4 +1,4 @@ -# Copyright 1997, 1998, 1999, 2000 Free Software Foundation, Inc. +# Copyright 1997, 1998, 1999, 2000, 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 @@ -291,7 +291,7 @@ send_gdb "set width 0\n" ; gdb_expect -re "$gdb_prompt $" # PR's 16495, 18213 # test that we can re-set breakpoints in shared libraries -gdb_test "break shr1" "Breakpoint 1.*" "set bp in shared library" +gdb_breakpoint "shr1" # FIXME: should not send "run" explicitly. Non-portable. diff --git a/gdb/testsuite/gdb.cp/ambiguous.exp b/gdb/testsuite/gdb.cp/ambiguous.exp index 6385dcb..f54e964 100644 --- a/gdb/testsuite/gdb.cp/ambiguous.exp +++ b/gdb/testsuite/gdb.cp/ambiguous.exp @@ -1,4 +1,4 @@ -# Copyright 1998, 1999, 2003 Free Software Foundation, Inc. +# Copyright 1998, 1999, 2003, 2004 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -14,9 +14,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # This file is part of the gdb testsuite # tests relating to ambiguous class members diff --git a/gdb/testsuite/gdb.cp/annota2.exp b/gdb/testsuite/gdb.cp/annota2.exp index f4f2433..7710cc4 100644 --- a/gdb/testsuite/gdb.cp/annota2.exp +++ b/gdb/testsuite/gdb.cp/annota2.exp @@ -1,4 +1,4 @@ -# Copyright 1999, 2000, 2001, 2002, 2003 +# Copyright 1999, 2000, 2001, 2002, 2003, 2004 # Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify @@ -15,9 +15,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # This file was written by Elena Zannoni (ezannoni@cygnus.com) if $tracelevel then { diff --git a/gdb/testsuite/gdb.cp/annota3.exp b/gdb/testsuite/gdb.cp/annota3.exp index c75a289..37be48d 100644 --- a/gdb/testsuite/gdb.cp/annota3.exp +++ b/gdb/testsuite/gdb.cp/annota3.exp @@ -1,4 +1,4 @@ -# Copyright 2003 Free Software Foundation, Inc. +# Copyright 2003, 2004 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -14,9 +14,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # This file was written by Elena Zannoni (ezannoni@cygnus.com) if $tracelevel then { diff --git a/gdb/testsuite/gdb.cp/anon-union.exp b/gdb/testsuite/gdb.cp/anon-union.exp index 0d5c777..4c34dcf 100644 --- a/gdb/testsuite/gdb.cp/anon-union.exp +++ b/gdb/testsuite/gdb.cp/anon-union.exp @@ -1,5 +1,5 @@ # Tests for anonymous union support. -# Copyright 1998, 1999, 2003 Free Software Foundation, Inc. +# Copyright 1998, 1999, 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 @@ -15,9 +15,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # Written by Satish Pai <pai@apollo.hp.com> 1997-08-19 # This file is part of the gdb testsuite diff --git a/gdb/testsuite/gdb.cp/breakpoint.cc b/gdb/testsuite/gdb.cp/breakpoint.cc new file mode 100644 index 0000000..266007c --- /dev/null +++ b/gdb/testsuite/gdb.cp/breakpoint.cc @@ -0,0 +1,41 @@ +/* Code to go along with tests in breakpoint.exp. + + Copyright 2004 Free Software Foundation, Inc. + + This file is part of GDB. + + 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. */ + +class C1 { +public: + class Nested { + public: + int + foo () + { + return 1; + } + }; +}; + +int main () +{ + C1::Nested c1; + + c1.foo(); + + return 0; +} diff --git a/gdb/testsuite/gdb.mi/mi1-symbol.exp b/gdb/testsuite/gdb.cp/breakpoint.exp index f0da197..c85f805 100644 --- a/gdb/testsuite/gdb.mi/mi1-symbol.exp +++ b/gdb/testsuite/gdb.cp/breakpoint.exp @@ -1,4 +1,4 @@ -# Copyright 2003 Free Software Foundation, Inc. +# Copyright 2004 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -14,48 +14,52 @@ # 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 is part of the gdb testsuite. -# -# 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 contains tests for breakpoints in C++. -load_lib mi-support.exp -set MIFLAGS "-i=mi1" +if $tracelevel then { + strace $tracelevel + } -gdb_exit -if [mi_gdb_start] { - continue -} +if { [skip_cplus_tests] } { continue } + +# +# test running programs +# +set prms_id 0 +set bug_id 0 -set testfile "basics" -set srcfile ${testfile}.c +set testfile "breakpoint" +set srcfile ${testfile}.cc set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } { + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { 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} +if [get_compiler_info ${binfile} "c++"] { + return -1 +} - mi_gdb_test "-symbol-list-lines ${srcfile}" \ - "\\^done,lines=\[\{pc=\"$hex\",line=\"$decimal\"\}.*\]" \ - "symbol-list-lines for source file ${srcfile}" +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} +proc test_breakpoint {name} { + # Restart the program every time, so that a single failure doesn't + # lead to a cascade. + if ![runto_main] then { + perror "couldn't run to main when testing ${name}" + continue + } else { + gdb_breakpoint "${name}" + gdb_test "continue" "Continuing.\r\n\r\nBreakpoint \[0-9\]*, ${name}.*" "continue to ${name}" + } } -test_list_lines +test_breakpoint "C1::Nested::foo" -mi_gdb_exit +gdb_exit return 0 diff --git a/gdb/testsuite/gdb.cp/bs15503.cc b/gdb/testsuite/gdb.cp/bs15503.cc index aec5a0b..5581ec5 100644 --- a/gdb/testsuite/gdb.cp/bs15503.cc +++ b/gdb/testsuite/gdb.cp/bs15503.cc @@ -15,9 +15,7 @@ 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 */ + */ #include <string> #include <iostream> diff --git a/gdb/testsuite/gdb.cp/casts.exp b/gdb/testsuite/gdb.cp/casts.exp index 5b6cabe..3aaf37c 100644 --- a/gdb/testsuite/gdb.cp/casts.exp +++ b/gdb/testsuite/gdb.cp/casts.exp @@ -1,4 +1,4 @@ -# Copyright 2002, 2003 Free Software Foundation, Inc. +# Copyright 2002, 2003, 2004 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -14,9 +14,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # This file is part of the gdb testsuite # Test casting, especially between class types or pointer-to-class diff --git a/gdb/testsuite/gdb.cp/class2.cc b/gdb/testsuite/gdb.cp/class2.cc index 16cf988..34263c8 100644 --- a/gdb/testsuite/gdb.cp/class2.cc +++ b/gdb/testsuite/gdb.cp/class2.cc @@ -1,6 +1,6 @@ /* This testcase is part of GDB, the GNU debugger. - Copyright 2003 Free Software Foundation, Inc. + Copyright 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 @@ -15,9 +15,7 @@ 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 */ + */ struct A { diff --git a/gdb/testsuite/gdb.cp/classes.exp b/gdb/testsuite/gdb.cp/classes.exp index 16a4c3b..12428be 100644 --- a/gdb/testsuite/gdb.cp/classes.exp +++ b/gdb/testsuite/gdb.cp/classes.exp @@ -15,9 +15,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # This file was written by Fred Fish. (fnf@cygnus.com) # And rewritten by Michael Chastain <mec.gnu@mindspring.com>. diff --git a/gdb/testsuite/gdb.cp/cplusfuncs.exp b/gdb/testsuite/gdb.cp/cplusfuncs.exp index 0a5e1b3..a509afb 100644 --- a/gdb/testsuite/gdb.cp/cplusfuncs.exp +++ b/gdb/testsuite/gdb.cp/cplusfuncs.exp @@ -1,4 +1,5 @@ -# Copyright 1992, 1997, 1999, 2001, 2002, 2003 Free Software Foundation, Inc. +# Copyright 1992, 1997, 1999, 2001, 2002, 2003, 2004 +# Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -14,9 +15,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # This file was written by Fred Fish. (fnf@cygnus.com) # Adapted for g++ 3.0 ABI by Michael Chastain. (chastain@redhat.com) diff --git a/gdb/testsuite/gdb.cp/ctti.exp b/gdb/testsuite/gdb.cp/ctti.exp index a5e75d8..7c23b49 100644 --- a/gdb/testsuite/gdb.cp/ctti.exp +++ b/gdb/testsuite/gdb.cp/ctti.exp @@ -14,9 +14,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # This file is part of the gdb testsuite # file written by Elena Zannoni (ezannoni@cygnus.com) # rewritten by Michael Chastain (mec.gnu@mindspring.com) diff --git a/gdb/testsuite/gdb.cp/cttiadd.cc b/gdb/testsuite/gdb.cp/cttiadd.cc index 1958605..ffba405 100644 --- a/gdb/testsuite/gdb.cp/cttiadd.cc +++ b/gdb/testsuite/gdb.cp/cttiadd.cc @@ -15,9 +15,7 @@ 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 */ + */ template<class T> T add(T v1, T v2) { diff --git a/gdb/testsuite/gdb.cp/cttiadd1.cc b/gdb/testsuite/gdb.cp/cttiadd1.cc index 3ef318a..9b149b3 100644 --- a/gdb/testsuite/gdb.cp/cttiadd1.cc +++ b/gdb/testsuite/gdb.cp/cttiadd1.cc @@ -1,6 +1,6 @@ /* This testcase is part of GDB, the GNU debugger. - Copyright 1998, 1999 Free Software Foundation, Inc. + Copyright 1998, 1999, 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 @@ -15,9 +15,7 @@ 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 */ + */ template<class T> T add(T v1, T v2); diff --git a/gdb/testsuite/gdb.cp/cttiadd2.cc b/gdb/testsuite/gdb.cp/cttiadd2.cc index a2f04b5..3538661 100644 --- a/gdb/testsuite/gdb.cp/cttiadd2.cc +++ b/gdb/testsuite/gdb.cp/cttiadd2.cc @@ -1,6 +1,6 @@ /* This testcase is part of GDB, the GNU debugger. - Copyright 1998, 1999 Free Software Foundation, Inc. + Copyright 1998, 1999, 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 @@ -15,9 +15,7 @@ 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 */ + */ template<class T> T add2(T v1, T v2) { diff --git a/gdb/testsuite/gdb.cp/cttiadd3.cc b/gdb/testsuite/gdb.cp/cttiadd3.cc index 60fb61a..2bea7bb 100644 --- a/gdb/testsuite/gdb.cp/cttiadd3.cc +++ b/gdb/testsuite/gdb.cp/cttiadd3.cc @@ -1,6 +1,6 @@ /* This testcase is part of GDB, the GNU debugger. - Copyright 1998, 1999 Free Software Foundation, Inc. + Copyright 1998, 1999, 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 @@ -15,9 +15,7 @@ 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 */ + */ template<class T> T add3(T v1, T v2) { diff --git a/gdb/testsuite/gdb.cp/demangle.exp b/gdb/testsuite/gdb.cp/demangle.exp index 7bd9fc5..848f66f 100644 --- a/gdb/testsuite/gdb.cp/demangle.exp +++ b/gdb/testsuite/gdb.cp/demangle.exp @@ -1,4 +1,4 @@ -# Copyright (C) 1992, 1997, 1999, 2003 Free Software Foundation, Inc. +# Copyright (C) 1992, 1997, 1999, 2003, 2004 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -14,9 +14,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # This file was written by Fred Fish. (fnf@cygnus.com) if $tracelevel then { diff --git a/gdb/testsuite/gdb.cp/derivation.exp b/gdb/testsuite/gdb.cp/derivation.exp index 6ef6dbe..d82ab1f 100644 --- a/gdb/testsuite/gdb.cp/derivation.exp +++ b/gdb/testsuite/gdb.cp/derivation.exp @@ -15,9 +15,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # This file was written by Elena Zannoni (ezannoni@cygnus.com) # And rewritten by Michael Chastain <mec.gnu@mindspring.com> diff --git a/gdb/testsuite/gdb.cp/exception.cc b/gdb/testsuite/gdb.cp/exception.cc index 4134fbc..cd124e5 100644 --- a/gdb/testsuite/gdb.cp/exception.cc +++ b/gdb/testsuite/gdb.cp/exception.cc @@ -15,9 +15,9 @@ 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 file for exception handling support. diff --git a/gdb/testsuite/gdb.cp/exception.exp b/gdb/testsuite/gdb.cp/exception.exp index d921ead..3193091 100644 --- a/gdb/testsuite/gdb.cp/exception.exp +++ b/gdb/testsuite/gdb.cp/exception.exp @@ -14,9 +14,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # This file is part of the gdb testsuite. # tests for exception-handling support # Written by Satish Pai <pai@apollo.hp.com> 1997-07-23 diff --git a/gdb/testsuite/gdb.cp/hang.exp b/gdb/testsuite/gdb.cp/hang.exp index 4c117a1..2308874 100644 --- a/gdb/testsuite/gdb.cp/hang.exp +++ b/gdb/testsuite/gdb.cp/hang.exp @@ -1,4 +1,4 @@ -# Copyright (C) 2002 Free Software Foundation, Inc. +# Copyright 2002, 2004 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -14,9 +14,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - if $tracelevel then { strace $tracelevel } diff --git a/gdb/testsuite/gdb.cp/inherit.exp b/gdb/testsuite/gdb.cp/inherit.exp index 993bfb1..72de1ac 100644 --- a/gdb/testsuite/gdb.cp/inherit.exp +++ b/gdb/testsuite/gdb.cp/inherit.exp @@ -1,5 +1,5 @@ -# Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003 -# Free Software Foundation, Inc. +# Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003, +# 2004 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -15,951 +15,1008 @@ # 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 was written by Fred Fish. (fnf@cygnus.com) +# And rewritten by Michael Chastain. (mec.gnu@mindspring.com) -set ws "\[\r\n\t \]+" -set nl "\[\r\n\]+" - -# The format of a g++ virtual base pointer. -set vbptr "(_vb\[$.\]|__vb_)\[0-9\]?" +set ws "\[\r\n\t \]+" +set nl "\[\r\n\]+" +set vhn "\\$\[0-9\]+" if $tracelevel then { - strace $tracelevel + strace $tracelevel } if { [skip_cplus_tests] } { continue } -# Note - create separate "inherit" executable from misc.cc - set testfile "inherit" set srcfile misc.cc set binfile ${objdir}/${subdir}/${testfile} - -# Create and source the file that provides information about the compiler -# used to compile the test case. - -if [get_compiler_info ${binfile} "c++"] { - return -1 -} - if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } -# -# Single inheritance, print individual members. -# - -proc test_print_si_members {} { - # Print all members of g_A using fully qualified form. - - gdb_test "print g_A.A::a" ".* = 1" "print g_A.A::a" - - gdb_test "print g_A.A::x" ".* = 2" "print g_A.A::x" - - # Print members of g_A using nonambiguous compact form. - - gdb_test "print g_A.a" ".* = 1" "print g_A.a" - - gdb_test "print g_A.x" ".* = 2" "print g_A.x" - - # Print all members of g_B using fully qualified form. - - gdb_test "print g_B.A::a" ".* = 3" "print g_B.A::a" - - gdb_test "print g_B.A::x" ".* = 4" "print g_B.A::x" - - gdb_test "print g_B.B::b" ".* = 5" "print g_B.B::b" - - gdb_test "print g_B.B::x" ".* = 6" "print g_B.B::x" - - # Print members of g_B using nonambiguous compact form. - - gdb_test "print g_B.a" ".* = 3" "print g_B.a" - - gdb_test "print g_B.b" ".* = 5" "print g_B.b" - - gdb_test "print g_B.x" ".* = 6" "print g_B.x" - - # Print all members of g_C using fully qualified form. - - gdb_test "print g_C.A::a" ".* = 7" "print g_C.A::a" - - gdb_test "print g_C.A::x" ".* = 8" "print g_C.A::x" - - gdb_test "print g_C.C::c" ".* = 9" "print g_C.C::c" - - gdb_test "print g_C.C::x" ".* = 10" "print g_C.C::x" - - # Print members of g_C using nonambiguous compact form. - - gdb_test "print g_C.a" ".* = 7" "print g_C.a" - - gdb_test "print g_C.c" ".* = 9" "print g_C.c" - - gdb_test "print g_C.x" ".* = 10" "print g_C.x" -} - -# # Single inheritance, print type definitions. -# -proc test_ptype_si {} { +proc test_ptype_si { } { global gdb_prompt global ws global nl - global hp_aCC_compiler # Print class A as a type. - send_gdb "ptype A\n" - gdb_expect { - -re "type = class A \{$nl.*\[ \]*int a;$nl\[ \]*int x;$nl.*\[ \]*\}$nl$gdb_prompt $" { - pass "ptype A (FIXME)" + set re_class "class A \{${ws}public:" + set re_fields "int a;${ws}int x;" + set re_synth_gcc_23 "A & operator=\\(A const ?&\\);${ws}A\\(A const ?&\\);${ws}A\\((void|)\\);" + + set name "ptype A (FIXME)" + gdb_test_multiple "ptype A" $name { + -re "type = $re_class${ws}$re_fields$nl\}$nl$gdb_prompt $" { + pass $name } - -re "type = struct A \{$nl\[ \]*int a;$nl\[ \]*int x;$nl\[ \]*\}$nl$gdb_prompt $" { - setup_xfail "*-*-*" - fail "ptype A (FIXME)" + -re "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" { + pass $name } - -re ".*$gdb_prompt $" { fail "ptype A" } - timeout { fail "ptype A (timeout)" ; return } } # Print class A as an explicit class. - send_gdb "ptype class A\n" - gdb_expect { - -re "type = class A \{$nl.*\[ \]*int a;$nl\[ \]*int x;$nl.*\[ \]*\}$nl$gdb_prompt $" { - pass "ptype class A (FIXME)" + set name "ptype class A (FIXME)" + gdb_test_multiple "ptype class A" $name { + -re "type = $re_class${ws}$re_fields$nl\}$nl$gdb_prompt $" { + pass $name } - -re "type = struct A \{$nl\[ \]*int a;$nl\[ \]*int x;$nl\[ \]*\}$nl$gdb_prompt $" { - if {!$hp_aCC_compiler} {setup_xfail "*-*-*"} - fail "ptype class A (FIXME)" + -re "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" { + pass $name } - -re ".*$gdb_prompt $" { fail "ptype class A" } - timeout { fail "ptype class A (timeout)" ; return } } # Print type of an object of type A. - send_gdb "ptype g_A\n" - gdb_expect { - -re "type = class A \{$nl.*\[ \]*int a;$nl\[ \]*int x;$nl.*\[ \]*\}$nl$gdb_prompt $" { - pass "ptype g_A (FIXME)" + set name "ptype g_A (FIXME)" + gdb_test_multiple "ptype g_A" $name { + -re "type = $re_class${ws}$re_fields$nl\}$nl$gdb_prompt $" { + pass $name } - -re "type = struct A \{$nl\[ \]*int a;$nl\[ \]*int x;$nl\[ \]*\}$nl$gdb_prompt $" { - if {!$hp_aCC_compiler} {setup_xfail "*-*-*"} - fail "ptype g_A (FIXME)" + -re "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" { + pass $name } - -re ".*$gdb_prompt $" { fail "ptype g_A" } - timeout { fail "ptype g_A (timeout)" ; return } } # Print class B as a type. - gdb_test "ptype B" "type = class B : public A \{$nl\[ \]*public:$nl\[ \]*int b;$nl\[ \]*int x;$nl.*\}" "ptype B" + set re_class "class B : public A \{${ws}public:" + set re_fields "int b;${ws}int x;" + set re_synth_gcc_23 "B & operator=\\(B const ?&\\);${ws}B\\(B const ?&\\);${ws}B\\((void|)\\);" + + set name "ptype B" + gdb_test_multiple "ptype B" $name { + -re "type = $re_class${ws}$re_fields$nl\}$nl$gdb_prompt $" { + pass $name + } + -re "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" { + pass $name + } + } # Print class B as an explicit class. - gdb_test "ptype class B" "type = class B : public A \{$nl\[ \]*public:$nl\[ \]*int b;$nl\[ \]*int x;$nl.*\}" "ptype class B" + set name "ptype class B" + gdb_test_multiple "ptype class B" $name { + -re "type = $re_class${ws}$re_fields$nl\}$nl$gdb_prompt $" { + pass $name + } + -re "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" { + pass $name + } + } # Print type of an object of type B. - gdb_test "ptype g_B" "type = class B : public A \{$nl\[ \]*public:$nl\[ \]*int b;$nl\[ \]*int x;$nl.*\}" "ptype g_B" + set name "ptype g_B" + gdb_test_multiple "ptype g_B" $name { + -re "type = $re_class${ws}$re_fields$nl\}$nl$gdb_prompt $" { + pass $name + } + -re "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" { + pass $name + } + } # Print class C as a type. - gdb_test "ptype C" "type = class C : public A \{$nl\[ \]*public:$nl\[ \]*int c;$nl\[ \]*int x;$nl.*\}" "ptype C" + set re_class "class C : public A \{${ws}public:" + set re_fields "int c;${ws}int x;" + set re_synth_gcc_23 "C & operator=\\(C const ?&\\);${ws}C\\(C const ?&\\);${ws}C\\((void|)\\);" + + set name "ptype C" + gdb_test_multiple "ptype C" $name { + -re "type = $re_class${ws}$re_fields$nl\}$nl$gdb_prompt $" { + pass $name + } + -re "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" { + pass $name + } + } # Print class C as an explicit class. - gdb_test "ptype class C" "type = class C : public A \{$nl\[ \]*public:$nl\[ \]*int c;$nl\[ \]*int x;$nl.*\}" "ptype class C" + set name "ptype class C" + gdb_test_multiple "ptype class C" $name { + -re "type = $re_class${ws}$re_fields$nl\}$nl$gdb_prompt $" { + pass $name + } + -re "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" { + pass $name + } + } # Print type of an object of type g_C. - gdb_test "ptype g_C" "type = class C : public A \{$nl\[ \]*public:$nl\[ \]*int c;$nl\[ \]*int x;$nl.*\}" "ptype g_C" - - # gcc cygnus-2.3.3 (Q1) has this bug, but it was fixed as of - # cygnus-2.3.3-930417. PR 2819. - send_gdb "ptype tagless_struct\n" - gdb_expect { - -re "type = class \{${ws}public:${ws}int one;${ws}int two;${ws}tagless_struct & operator=\\(tagless_struct (const ?)?&\\);${ws}tagless_struct\\(tagless_struct (const ?)?&\\);${ws}tagless_struct\\(\\);${ws}\}$nl$gdb_prompt $" { - pass "ptype tagless struct" + set name "ptype g_C" + gdb_test_multiple "ptype g_C" $name { + -re "type = $re_class${ws}$re_fields$nl\}$nl$gdb_prompt $" { + pass $name + } + -re "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" { + pass $name } - -re "type = class \{${ws}public:${ws}int one;${ws}int two;;${ws}\}$nl$gdb_prompt $" { - pass "ptype tagless struct" + } + + # Print a structure with no tag. + + set re_tag "tagless_struct" + set XX_tag "\\._1" + set re_class "(class $re_tag \{${ws}public:|class \{${ws}public:|struct $re_tag \{|struct \{)" + set XX_class "(class $XX_tag \{${ws}public:|struct $XX_tag \{)" + set re_fields "int one;${ws}int two;" + set re_synth_gcc_23 "$re_tag & operator=\\($re_tag const ?&\\);${ws}$re_tag\\($re_tag const ?&\\);${ws}$re_tag\\((void|)\\);" + set XX_synth_gcc_23 "($re_tag|$XX_tag) & operator=\\($XX_tag const ?&\\);${ws}$XX_tag\\($XX_tag const ?&\\);${ws}$XX_tag\\((void|)\\);" + + set name "ptype tagless struct" + gdb_test_multiple "ptype tagless_struct" $name { + -re "type = $XX_class${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gdwarf-2 + pass "$name (obsolete gcc or gdb)" } - -re "type = (struct|class).*\{.*int one;.*int two;.*\}$nl$gdb_prompt $" { - pass "ptype tagless struct (obsolete gcc or gdb)" + -re "type = $re_class${ws}$re_fields${ws}$XX_synth_gcc_23$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gstabs+ + pass "$name (obsolete gcc or gdb)" } - -re ".*$gdb_prompt $" { - fail "ptype tagless struct" + -re "type = $re_class${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gdwarf-2 + # gcc HEAD 2004-01-21 -gdwarf-2 + pass "$name (obsolete gcc or gdb)" } - timeout { - fail "ptype tagless struct (timeout)" + -re "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gstabs+ + # gcc HEAD 2004-01-21 -gstabs+ + pass "$name" } } - send_gdb "ptype v_tagless\n" - gdb_expect { - -re "type = class \{${ws}public:${ws}int one;${ws}int two;${ws}tagless_struct & operator=\\(tagless_struct (const ?)?&\\);${ws}tagless_struct\\(tagless_struct (const ?)?&\\);${ws}tagless_struct\\(\\);${ws}\}$nl$gdb_prompt $" { - pass "ptype variable of type tagless struct" + set name "ptype variable of type tagless struct" + gdb_test_multiple "ptype v_tagless" $name { + -re "type = $XX_class${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gdwarf-2 + pass "$name (obsolete gcc or gdb)" } - -re "type = class \{${ws}public:${ws}int one;${ws}int two;;${ws}\}$nl$gdb_prompt $" { - pass "ptype tagless struct" + -re "type = $re_class${ws}$re_fields${ws}$XX_synth_gcc_23$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gstabs+ + pass "$name (obsolete gcc or gdb)" } - -re "type = (struct|class).*\{.*int one;.*int two;.*\}$nl$gdb_prompt $" { - pass "ptype variable of type tagless struct (obsolete gcc or gdb)" + -re "type = $re_class${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gdwarf-2 + # gcc HEAD 2004-01-21 -gdwarf-2 + pass "$name (obsolete gcc or gdb)" } - -re ".*$gdb_prompt $" { - fail "ptype variable of type tagless struct" - } - timeout { - fail "ptype variable of type tagless struct (timeout)" + -re "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gstabs+ + # gcc HEAD 2004-01-21 -gstabs+ + pass "$name" } } } -# -# Single inheritance, print complete classes. -# - -proc test_print_si_classes {} { - # Print all members of g_A. - - gdb_test "print g_A" ".* = \{a = 1, x = 2\}" "print g_A" - - # Print all members of g_B. - - gdb_test "print g_B" ".* = \{\<(class |)A\> = \{a = 3, x = 4\}, b = 5, x = 6\}" "print g_B" - - # Print all members of g_C. - - gdb_test "print g_C" ".* = \{\<(class |)A\> = \{a = 7, x = 8\}, c = 9, x = 10\}" "print g_C" -} - -# -# Single inheritance, print anonymous unions. -# GDB versions prior to 4.14 entered an infinite loop when printing -# the type of a class containing an anonymous union, and they were also -# incapable of printing the member of an anonymous union. -# We test the printing of the member first, and perform the other tests -# only if the test succeeds, to avoid the infinite loop. -# +# Multiple inheritance, print type definitions. -proc test_print_anon_union {} { +proc test_ptype_mi { } { global gdb_prompt global ws global nl - gdb_test "print g_anon_union.a" ".* = 2" "print anonymous union member" - send_gdb "print g_anon_union\n" - gdb_expect { - -re ".* = \{one = 1, ( = |)\{a = 2, b = 2\}\}$nl$gdb_prompt $" { - pass "print variable of type anonymous union" + set re_class "class D : public B, public C \{${ws}public:" + set re_fields "int d;${ws}int x;" + set re_synth_gcc_23 "D & operator=\\(D const ?&\\);${ws}D\\(D const ?&\\);${ws}D\\((void|)\\);" + + # ptype D: type, class, object. + + set name "ptype D" + gdb_test_multiple "ptype D" $name { + -re "type = $re_class${ws}$re_fields$nl\}$nl$gdb_prompt $" { + pass $name + } + -re "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" { + pass $name + } + } + + set name "ptype class D" + gdb_test_multiple "ptype class D" $name { + -re "type = $re_class${ws}$re_fields$nl\}$nl$gdb_prompt $" { + pass $name } - -re ".* = .*\{one = 1, ( = |)\{a = 2, b = .*\}\}$nl$gdb_prompt $" { - pass "print variable of type anonymous union (obsolete gcc or gdb)" + -re "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" { + pass $name } - -re ".*$nl$gdb_prompt $" { - fail "print variable of type anonymous union" + } + + set name "ptype g_D" + gdb_test_multiple "ptype g_D" $name { + -re "type = $re_class${ws}$re_fields$nl\}$nl$gdb_prompt $" { + pass $name } - timeout { - fail "print variableof type anonymous union (timeout)" + -re "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" { + pass $name } } - send_gdb "ptype g_anon_union\n" - gdb_expect { - -re "type = class class_with_anon_union \{${ws}public:${ws}int one;${ws}union \{${ws}public:${ws}int a;${ws}long int b;${ws}union \{\.\.\.\} & operator=\\(union \{\.\.\.\} &\\);${ws}\\\$_0 \\(union \{\.\.\.\} &\\);${ws}\\\$_0 \\(\\);${ws}\};${ws}class_with_anon_union & operator=\\(class_with_anon_union const &\\);${ws}class_with_anon_union\\(class_with_anon_union const &\\);${ws}class_with_anon_union\\(void\\);${ws}\}$nl$gdb_prompt $" { - pass "print type of anonymous union" + + set re_class "class E : public D \{${ws}public:" + set re_fields "int e;${ws}int x;" + set re_synth_gcc_23 "E & operator=\\(E const ?&\\);${ws}E\\(E const ?&\\);${ws}E\\((void|)\\);" + + # ptype E: type, class, object. + + set name "ptype E" + gdb_test_multiple "ptype E" $name { + -re "type = $re_class${ws}$re_fields$nl\}$nl$gdb_prompt $" { + pass $name } - -re "type = class class_with_anon_union \{${ws}public:${ws}int one;${ws}union \{${ws}int a;${ws}long int b;${ws}\};${ws}class_with_anon_union & operator=\\(class_with_anon_union const ?&\\);${ws}class_with_anon_union\\(class_with_anon_union const ?&\\);${ws}class_with_anon_union\\((void|)\\);${ws}\}$nl$gdb_prompt $" { - pass "print type of anonymous union" + -re "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" { + pass $name } - -re "type = class class_with_anon_union \{${ws}public:${ws}int one;${ws}union \{${ws}int a;${ws}long int b;${ws}\};${ws}\}$nl$gdb_prompt $" { - pass "print type of anonymous union" + } + + set name "ptype class E" + gdb_test_multiple "ptype class E" $name { + -re "type = $re_class${ws}$re_fields$nl\}$nl$gdb_prompt $" { + pass $name } - -re "type = (struct|class).*\{.*int one;.*union \{.*int a;.*(long|long int|int) b;.*\};.*\}$nl$gdb_prompt $" { - pass "print type of anonymous union (obsolete gcc or gdb)" + -re "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" { + pass $name } - -re ".*$nl$gdb_prompt $" { - fail "print type of anonymous union" + } + + set name "ptype g_E" + gdb_test_multiple "ptype g_E" $name { + -re "type = $re_class${ws}$re_fields$nl\}$nl$gdb_prompt $" { + pass $name } - timeout { - fail "print type of anonymous union (timeout)" + -re "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" { + pass $name } } } -# -# Multiple inheritance, print individual members. -# +# Single virtual inheritance, print type definitions. -proc test_print_mi_members {} { +proc test_ptype_vi { } { global gdb_prompt + global ws global nl - global hp_aCC_compiler - - # Print all members of g_A. - - gdb_test "print g_A.A::a" ".* = 1" "print g_A.A::a" - - gdb_test "print g_A.A::x" ".* = 2" "print g_A.A::x" - # Print all members of g_B. + # ptype vA: type, class, object. - gdb_test "print g_B.A::a" ".* = 3" "print g_B.A::a" + set re_class "class vA \{${ws}public:" + set re_fields "int va;${ws}int vx;" + set re_synth_gcc_23 "vA & operator=\\(vA const ?&\\);${ws}vA\\(vA const ?&\\);${ws}vA\\((void|)\\);" - gdb_test "print g_B.A::x" ".* = 4" "print g_B.A::x" + set name "ptype vA" + gdb_test_multiple "ptype vA" $name { + -re "type = $re_class${ws}$re_fields$nl\}$nl$gdb_prompt $" { + pass $name + } + -re "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" { + pass $name + } + } - gdb_test "print g_B.B::b" ".* = 5" "print g_B.B::b" + set name "ptype class vA" + gdb_test_multiple "ptype class vA" $name { + -re "type = $re_class${ws}$re_fields$nl\}$nl$gdb_prompt $" { + pass $name + } + -re "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" { + pass $name + } + } - gdb_test "print g_B.B::x" ".* = 6" "print g_B.B::x" + set name "ptype g_vA" + gdb_test_multiple "ptype g_vA" $name { + -re "type = $re_class${ws}$re_fields$nl\}$nl$gdb_prompt $" { + pass $name + } + -re "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" { + pass $name + } + } - # Print all members of g_C. + # ptype vB: type, class, object. - gdb_test "print g_C.A::a" ".* = 7" "print g_C.A::a" + set re_class "class vB : public virtual vA \{(${ws}private:|)" + set re_vbptr "vA \\*(_vb.2vA|_vb.vA);${ws}" + set re_access "public:" + set re_fields "int vb;${ws}int vx;" + set re_synth_gcc_2 "vB & operator=\\(vB const ?&\\);${ws}vB\\(int, vB const ?&\\);${ws}vB\\(int\\);" + set re_synth_gcc_3 "vB & operator=\\(vB const ?&\\);${ws}vB\\(vB const ?&\\);${ws}vB\\((void|)\\);" - gdb_test "print g_C.A::x" ".* = 8" "print g_C.A::x" + set name "ptype vB" + gdb_test_multiple "ptype vB" $name { + -re "type = $re_class${ws}$re_vbptr${ws}$re_access${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gdwarf-2 + pass $name + } + -re "type = $re_class${ws}$re_vbptr${ws}$re_access${ws}$re_fields${ws}$re_synth_gcc_2$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gstabs+ + pass $name + } + -re "type = $re_class${ws}$re_access${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gdwarf-2 + # gcc HEAD 2004-01-21 -gdwarf-2 + pass "$name (aCC)" + } + -re "type = $re_class${ws}$re_access${ws}$re_fields${ws}$re_synth_gcc_3$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gstabs+ + # gcc HEAD 2004-01-21 -gstabs+ + pass "$name (aCC)" + } + } - gdb_test "print g_C.C::c" ".* = 9" "print g_C.C::c" + set name "ptype class vB" + gdb_test_multiple "ptype class vB" $name { + -re "type = $re_class${ws}$re_vbptr${ws}$re_access${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gdwarf-2 + pass $name + } + -re "type = $re_class${ws}$re_vbptr${ws}$re_access${ws}$re_fields${ws}$re_synth_gcc_2$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gstabs+ + pass $name + } + -re "type = $re_class${ws}$re_access${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gdwarf-2 + # gcc HEAD 2004-01-21 -gdwarf-2 + pass "$name (aCC)" + } + -re "type = $re_class${ws}$re_access${ws}$re_fields${ws}$re_synth_gcc_3$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gstabs+ + # gcc HEAD 2004-01-21 -gstabs+ + pass "$name (aCC)" + } + } - gdb_test "print g_C.C::x" ".* = 10" "print g_C.C::x" + set name "ptype g_vB" + gdb_test_multiple "ptype g_vB" $name { + -re "type = $re_class${ws}$re_vbptr${ws}$re_access${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gdwarf-2 + pass $name + } + -re "type = $re_class${ws}$re_vbptr${ws}$re_access${ws}$re_fields${ws}$re_synth_gcc_2$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gstabs+ + pass $name + } + -re "type = $re_class${ws}$re_access${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gdwarf-2 + # gcc HEAD 2004-01-21 -gdwarf-2 + pass "$name (aCC)" + } + -re "type = $re_class${ws}$re_access${ws}$re_fields${ws}$re_synth_gcc_3$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gstabs+ + # gcc HEAD 2004-01-21 -gstabs+ + pass "$name (aCC)" + } + } - # Print all members of g_D. + # ptype vC: type, class, object. - # The following is ambiguous, and gdb should detect this. - # For now, accept gdb's behavior as an expected failure if it - # simply prints either member correctly. + set re_class "class vC : public virtual vA \{(${ws}private:|)" + set re_vbptr "vA \\*(_vb.2vA|_vb.vA);${ws}" + set re_access "public:" + set re_fields "int vc;${ws}int vx;" + set re_synth_gcc_2 "vC & operator=\\(vC const ?&\\);${ws}vC\\(int, vC const ?&\\);${ws}vC\\(int\\);" + set re_synth_gcc_3 "vC & operator=\\(vC const ?&\\);${ws}vC\\(vC const ?&\\);${ws}vC\\((void|)\\);" - send_gdb "print g_D.A::a\n" - gdb_expect { - -re "warning: A ambiguous; using D::C::A. Use a cast to disambiguate.$nl\\$\[0-9\]* = 15$nl$gdb_prompt $" { - pass "print g_D.A::a" + set name "ptype vC" + gdb_test_multiple "ptype vC" $name { + -re "type = $re_class${ws}$re_vbptr${ws}$re_access${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gdwarf-2 + pass $name } - -re "warning: A ambiguous; using D::B::A. Use a cast to disambiguate.$nl\\$\[0-9\]* = 11$nl$gdb_prompt $" { - pass "print g_D.A::a (using B)" + -re "type = $re_class${ws}$re_vbptr${ws}$re_access${ws}$re_fields${ws}$re_synth_gcc_2$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gstabs+ + pass $name } - -re ".* = 15$nl$gdb_prompt $" { - kfail "gdb/68" "print g_D.A::a" + -re "type = $re_class${ws}$re_access${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gdwarf-2 + # gcc HEAD 2004-01-21 -gdwarf-2 + pass "$name (aCC)" } - -re ".* = 11$nl$gdb_prompt $" { - kfail "gdb/68" "print g_D.A::a" + -re "type = $re_class${ws}$re_access${ws}$re_fields${ws}$re_synth_gcc_3$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gstabs+ + # gcc HEAD 2004-01-21 -gstabs+ + pass "$name (aCC)" } - -re ".*$gdb_prompt $" { fail "print g_D.A::a" } - timeout { fail "print g_D.A::a (timeout)" ; return } } - # The following is ambiguous, and gdb should detect this. - # For now, accept gdb's behavior as an expected failure if it - # simply prints either member correctly. - - send_gdb "print g_D.A::x\n" - gdb_expect { - -re "warning: A ambiguous; using D::C::A. Use a cast to disambiguate.$nl\\$\[0-9\]* = 16$nl$gdb_prompt $" { - pass "print g_D.A::x" + set name "ptype class vC" + gdb_test_multiple "ptype class vC" $name { + -re "type = $re_class${ws}$re_vbptr${ws}$re_access${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gdwarf-2 + pass $name } - -re "warning: A ambiguous; using D::B::A. Use a cast to disambiguate.$nl\\$\[0-9\]* = 12$nl$gdb_prompt $" { - pass "print g_D.A::x (using B)" + -re "type = $re_class${ws}$re_vbptr${ws}$re_access${ws}$re_fields${ws}$re_synth_gcc_2$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gstabs+ + pass $name } - -re ".* = 16$nl$gdb_prompt $" { - kfail "gdb/68" "print g_D.A::x" + -re "type = $re_class${ws}$re_access${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gdwarf-2 + # gcc HEAD 2004-01-21 -gdwarf-2 + pass "$name (aCC)" } - -re ".* = 12$nl$gdb_prompt $" { - kfail "gdb/68" "print g_D.A::x" + -re "type = $re_class${ws}$re_access${ws}$re_fields${ws}$re_synth_gcc_3$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gstabs+ + # gcc HEAD 2004-01-21 -gstabs+ + pass "$name (aCC)" } - -re ".*$gdb_prompt $" { fail "print g_D.A::x" } - timeout { fail "print g_D.A::x (timeout)" ; return } } - gdb_test "print g_D.B::b" ".* = 13" "print g_D.B::b" - - gdb_test "print g_D.B::x" ".* = 14" "print g_D.B::x" - - gdb_test "print g_D.C::c" ".* = 17" "print g_D.C::c" - - gdb_test "print g_D.C::x" ".* = 18" "print g_D.C::x" + set name "ptype g_vC" + gdb_test_multiple "ptype g_vC" $name { + -re "type = $re_class${ws}$re_vbptr${ws}$re_access${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gdwarf-2 + pass $name + } + -re "type = $re_class${ws}$re_vbptr${ws}$re_access${ws}$re_fields${ws}$re_synth_gcc_2$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gstabs+ + pass $name + } + -re "type = $re_class${ws}$re_access${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gdwarf-2 + # gcc HEAD 2004-01-21 -gdwarf-2 + pass "$name (aCC)" + } + -re "type = $re_class${ws}$re_access${ws}$re_fields${ws}$re_synth_gcc_3$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gstabs+ + # gcc HEAD 2004-01-21 -gstabs+ + pass "$name (aCC)" + } + } +} - gdb_test "print g_D.D::d" ".* = 19" "print g_D.D::d" +# Multiple virtual inheritance, print type definitions. - gdb_test "print g_D.D::x" ".* = 20" "print g_D.D::x" +proc test_ptype_mvi { } { + global gdb_prompt + global ws + global nl - # Print all members of g_E. + # ptype vD: type, class, object. - # The following is ambiguous, and gdb should detect this. - # For now, accept gdb's behavior as an expected failure if it - # simply prints either member correctly. + set re_class "class vD : public virtual vB, public virtual vC \{(${ws}private:|)" + set re_vbptr "vC \\*(_vb.2vC|_vb.vC);${ws}vB \\*(_vb.2vB|_vb.vB);" + set re_access "public:" + set re_fields "int vd;${ws}int vx;" + set re_synth_gcc_2 "vD & operator=\\(vD const ?&\\);${ws}vD\\(int, vD const ?&\\);${ws}vD\\(int\\);" + set re_synth_gcc_3 "vD & operator=\\(vD const ?&\\);${ws}vD\\(vD const ?&\\);${ws}vD\\((void|)\\);" - send_gdb "print g_E.A::a\n" - gdb_expect { - -re ".* = 21$nl$gdb_prompt $" { - kfail "gdb/68" "print g_E.A::a" + set name "ptype vD" + gdb_test_multiple "ptype vD" $name { + -re "type = $re_class${ws}$re_vbptr${ws}$re_access${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gdwarf-2 + pass $name } - -re ".* = 25$nl$gdb_prompt $" { - kfail "gdb/68" "print g_E.A::a" + -re "type = $re_class${ws}$re_vbptr${ws}$re_access${ws}$re_fields${ws}$re_synth_gcc_2$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gstabs+ + pass $name + } + -re "type = $re_class${ws}$re_access${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gdwarf-2 + # gcc HEAD 2004-01-21 -gdwarf-2 + pass "$name" + } + -re "type = $re_class${ws}$re_access${ws}$re_fields${ws}$re_synth_gcc_3$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gstabs+ + # gcc HEAD 2004-01-21 -gstabs+ + pass "$name" } - -re ".*$gdb_prompt $" { fail "print g_E.A::a" } - timeout { fail "print g_E.A::a (timeout)" ; return } } - # The following is ambiguous, and gdb should detect this. - # For now, accept gdb's behavior as an expected failure if it - # simply prints either member correctly. - - send_gdb "print g_E.A::x\n" - gdb_expect { - -re "warning: A ambiguous; using E::D::C::A. Use a cast to disambiguate.$nl\\$\[0-9\]* = 26$nl$gdb_prompt $" { - pass "print g_E.A::x" + set name "ptype class vD" + gdb_test_multiple "ptype class vD" $name { + -re "type = $re_class${ws}$re_vbptr${ws}$re_access${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gdwarf-2 + pass $name } - -re "warning: A ambiguous; using E::D::B::A. Use a cast to disambiguate.$nl\\$\[0-9\]* = 22$nl$gdb_prompt $" { - pass "print g_E.A::x (using B)" + -re "type = $re_class${ws}$re_vbptr${ws}$re_access${ws}$re_fields${ws}$re_synth_gcc_2$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gstabs+ + pass $name } - -re ".* = 26$nl$gdb_prompt $" { - kfail "gdb/68" "print g_E.A::x" + -re "type = $re_class${ws}$re_access${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gdwarf-2 + # gcc HEAD 2004-01-21 -gdwarf-2 + pass "$name" } - -re ".* = 22$nl$gdb_prompt $" { - kfail "gdb/68" "print g_E.A::x" + -re "type = $re_class${ws}$re_access${ws}$re_fields${ws}$re_synth_gcc_3$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gstabs+ + # gcc HEAD 2004-01-21 -gstabs+ + pass "$name" } - -re ".*$gdb_prompt $" { fail "print g_E.A::x" } - timeout { fail "print g_E.A::x (timeout)" ; return } } - gdb_test "print g_E.B::b" ".* = 23" "print g_E.B::b" - - gdb_test "print g_E.B::x" ".* = 24" "print g_E.B::x" - - gdb_test "print g_E.C::c" ".* = 27" "print g_E.C::c" + set name "ptype g_vD" + gdb_test_multiple "ptype g_vD" $name { + -re "type = $re_class${ws}$re_vbptr${ws}$re_access${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gdwarf-2 + pass $name + } + -re "type = $re_class${ws}$re_vbptr${ws}$re_access${ws}$re_fields${ws}$re_synth_gcc_2$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gstabs+ + pass $name + } + -re "type = $re_class${ws}$re_access${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gdwarf-2 + # gcc HEAD 2004-01-21 -gdwarf-2 + pass "$name" + } + -re "type = $re_class${ws}$re_access${ws}$re_fields${ws}$re_synth_gcc_3$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gstabs+ + # gcc HEAD 2004-01-21 -gstabs+ + pass "$name" + } + } - gdb_test "print g_E.C::x" ".* = 28" "print g_E.C::x" + # ptype vE: type, class, object. - gdb_test "print g_E.D::d" ".* = 29" "print g_E.D::d" + set re_class "class vE : public virtual vD \{(${ws}private:|)" + set re_vbptr "vD \\*(_vb.2vD|_vb.vD);" + set re_access "public:" + set re_fields "int ve;${ws}int vx;" + set re_synth_gcc_2 "vE & operator=\\(vE const ?&\\);${ws}vE\\(int, vE const ?&\\);${ws}vE\\(int\\);" + set re_synth_gcc_3 "vE & operator=\\(vE const ?&\\);${ws}vE\\(vE const ?&\\);${ws}vE\\((void|)\\);" - gdb_test "print g_E.D::x" ".* = 30" "print g_E.D::x" + set name "ptype vE" + gdb_test_multiple "ptype vE" $name { + -re "type = $re_class${ws}$re_vbptr${ws}$re_access${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gdwarf-2 + pass $name + } + -re "type = $re_class${ws}$re_vbptr${ws}$re_access${ws}$re_fields${ws}$re_synth_gcc_2$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gstabs+ + pass $name + } + -re "type = $re_class${ws}$re_access${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gdwarf-2 + # gcc HEAD 2004-01-21 -gdwarf-2 + pass "$name" + } + -re "type = $re_class${ws}$re_access${ws}$re_fields${ws}$re_synth_gcc_3$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gstabs+ + # gcc HEAD 2004-01-21 -gstabs+ + pass "$name" + } + } - gdb_test "print g_E.E::e" ".* = 31" "print g_E.E::e" + set name "ptype class vE" + gdb_test_multiple "ptype class vE" $name { + -re "type = $re_class${ws}$re_vbptr${ws}$re_access${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gdwarf-2 + pass $name + } + -re "type = $re_class${ws}$re_vbptr${ws}$re_access${ws}$re_fields${ws}$re_synth_gcc_2$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gstabs+ + pass $name + } + -re "type = $re_class${ws}$re_access${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gdwarf-2 + # gcc HEAD 2004-01-21 -gdwarf-2 + pass "$name" + } + -re "type = $re_class${ws}$re_access${ws}$re_fields${ws}$re_synth_gcc_3$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gstabs+ + # gcc HEAD 2004-01-21 -gstabs+ + pass "$name" + } + } - gdb_test "print g_E.E::x" ".* = 32" "print g_E.E::x" + set name "ptype g_vE" + gdb_test_multiple "ptype g_vE" $name { + -re "type = $re_class${ws}$re_vbptr${ws}$re_access${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gdwarf-2 + pass $name + } + -re "type = $re_class${ws}$re_vbptr${ws}$re_access${ws}$re_fields${ws}$re_synth_gcc_2$nl\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gstabs+ + pass $name + } + -re "type = $re_class${ws}$re_access${ws}$re_fields$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gdwarf-2 + # gcc HEAD 2004-01-21 -gdwarf-2 + pass "$name" + } + -re "type = $re_class${ws}$re_access${ws}$re_fields${ws}$re_synth_gcc_3$nl\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gstabs+ + # gcc HEAD 2004-01-21 -gstabs+ + pass "$name" + } + } } -# -# Multiple inheritance, print type definitions. -# +# Single inheritance, print individual members. -proc test_ptype_mi {} { - global nl +proc test_print_si_members { } { + global vhn - gdb_test "ptype D" "type = class D : public B, public C \{$nl\[ \]*public:$nl\[ \]*int d;$nl\[ \]*int x;$nl.*\}" "ptype D" + # Print all members of g_A using fully qualified form. + gdb_test "print g_A.A::a" "$vhn = 1" + gdb_test "print g_A.A::x" "$vhn = 2" - gdb_test "ptype class D" "type = class D : public B, public C \{$nl\[ \]*public:$nl\[ \]*int d;$nl\[ \]*int x;$nl.*\}" "ptype class D" + # Print members of g_A using nonambiguous compact form. + gdb_test "print g_A.a" "$vhn = 1" + gdb_test "print g_A.x" "$vhn = 2" - gdb_test "ptype g_D" "type = class D : public B, public C \{$nl\[ \]*public:$nl\[ \]*int d;$nl\[ \]*int x;$nl.*\}" "ptype g_D" + # Print all members of g_B using fully qualified form. + gdb_test "print g_B.A::a" "$vhn = 3" + gdb_test "print g_B.A::x" "$vhn = 4" + gdb_test "print g_B.B::b" "$vhn = 5" + gdb_test "print g_B.B::x" "$vhn = 6" - gdb_test "ptype E" "type = class E : public D \{$nl\[ \]*public:$nl\[ \]*int e;$nl\[ \]*int x;$nl.*\}" "ptype E" + # Print members of g_B using nonambiguous compact form. + gdb_test "print g_B.a" "$vhn = 3" + gdb_test "print g_B.b" "$vhn = 5" + gdb_test "print g_B.x" "$vhn = 6" - gdb_test "ptype class E" "type = class E : public D \{$nl\[ \]*public:$nl\[ \]*int e;$nl\[ \]*int x;$nl.*\}" "ptype class E" + # Print all members of g_C using fully qualified form. + gdb_test "print g_C.A::a" "$vhn = 7" + gdb_test "print g_C.A::x" "$vhn = 8" + gdb_test "print g_C.C::c" "$vhn = 9" + gdb_test "print g_C.C::x" "$vhn = 10" - gdb_test "ptype g_E" "type = class E : public D \{$nl\[ \]*public:$nl\[ \]*int e;$nl\[ \]*int x;$nl.*\}" "ptype g_E" + # Print members of g_C using nonambiguous compact form. + gdb_test "print g_C.a" "$vhn = 7" + gdb_test "print g_C.c" "$vhn = 9" + gdb_test "print g_C.x" "$vhn = 10" } -# -# Multiple inheritance, print complete classes. -# - -proc test_print_mi_classes {} { - # Print all members of g_D. - - gdb_test "print g_D" ".* = \{\<(class |)B\> = \{\<(class |)A\> = \{a = 11, x = 12\}, b = 13, x = 14\}, \<(class |)C\> = \{\<(class |)A\> = \{a = 15, x = 16\}, c = 17, x = 18\}, d = 19, x = 20\}" "print g_D" +# Single inheritance, print complete classes. - # Print all members of g_E. +proc test_print_si_classes { } { + global vhn - gdb_test "print g_E" ".* = \{\<(class |)D\> = \{\<(class |)B\> = \{\<(class |)A\> = \{a = 21, x = 22\}, b = 23, x = 24\}, \<(class |)C\> = \{\<(class |)A\> = \{a = 25, x = 26\}, c = 27, x = 28\}, d = 29, x = 30\}, e = 31, x = 32\}" "print g_E" + # Print all members of g_A, g_B, g_C. + gdb_test "print g_A" "$vhn = \{a = 1, x = 2\}" + gdb_test "print g_B" "$vhn = \{<(class A|A)> = \{a = 3, x = 4\}, b = 5, x = 6\}" + gdb_test "print g_C" "$vhn = \{<(class A|A)> = \{a = 7, x = 8\}, c = 9, x = 10\}" } -# -# Single virtual inheritance, print individual members. -# +# Multiple inheritance, print individual members. -proc test_print_svi_members {} { +proc test_print_mi_members {} { global gdb_prompt - global decimal global nl + global vhn - # Print all members of g_vA. - - gdb_test "print g_vA.vA::va" ".* = 1" "print g_vA.vA::va" - - gdb_test "print g_vA.vA::vx" ".* = 2" "print g_vA.vA::vx" - - # Print members of g_vA using compact form. - - gdb_test "print g_vA.va" ".* = 1" "print g_vA.va" + # Print all members of g_A. + gdb_test "print g_A.A::a" "$vhn = 1" + gdb_test "print g_A.A::x" "$vhn = 2" - gdb_test "print g_vA.vx" ".* = 2" "print g_vA.vx" + # Print all members of g_B. + gdb_test "print g_B.A::a" "$vhn = 3" + gdb_test "print g_B.A::x" "$vhn = 4" + gdb_test "print g_B.B::b" "$vhn = 5" + gdb_test "print g_B.B::x" "$vhn = 6" - # Print all members of g_vB. + # Print all members of g_C. + gdb_test "print g_C.A::a" "$vhn = 7" + gdb_test "print g_C.A::x" "$vhn = 8" + gdb_test "print g_C.C::c" "$vhn = 9" + gdb_test "print g_C.C::x" "$vhn = 10" - send_gdb "print g_vB.vA::va\n" - gdb_expect { - -re ".* = 3$nl$gdb_prompt $" { pass "print g_vB.vA::va" } - -re ".*virtual baseclass botch.*$gdb_prompt $" { - # Does not happen with gcc cygnus-2.4.5-930828 - fail "print g_vB.vA::va (known bug with gcc cygnus-2.4.5-930417)" - # Many of the rest of these tests have the same problem. - return 0 + # Print all members of g_D. + # + # g_D.A::a and g_D.A::x are ambiguous member accesses, and gdb + # should detect these. There are no ways to PASS these tests + # because I don't know what the gdb message will be. -- chastain + # 2004-01-27. + + set name "print g_D.A::a" + gdb_test_multiple "print g_D.A::a" $name { + -re "$vhn = (15|11)$nl$gdb_prompt $" { + kfail "gdb/68" "print g_D.A::a" } - -re ".*$gdb_prompt $" { fail "print g_vB.vA::va" } - timeout { fail "print g_vB.vA::va (timeout)" ; return } } - gdb_test "print g_vB.vA::vx" ".* = 4" "print g_vB.vA::vx" - - gdb_test "print g_vB.vB::vb" ".* = 5" "print g_vB.vB::vb" - - gdb_test "print g_vB.vB::vx" ".* = 6" "print g_vB.vB::vx" - - # Print members of g_vB using compact form. - - gdb_test "print g_vB.va" ".* = 3" "print g_vB.va" - - gdb_test "print g_vB.vb" ".* = 5" "print g_vB.vb" - - gdb_test "print g_vB.vx" ".* = 6" "print g_vB.vx" + set name "print g_D.A::x" + gdb_test_multiple "print g_D.A::x" $name { + -re "$vhn = (16|12)$nl$gdb_prompt $" { + kfail "gdb/68" "print g_D.A::x" + } + } - # Print all members of g_vC. + gdb_test "print g_D.B::b" "$vhn = 13" + gdb_test "print g_D.B::x" "$vhn = 14" + gdb_test "print g_D.C::c" "$vhn = 17" + gdb_test "print g_D.C::x" "$vhn = 18" + gdb_test "print g_D.D::d" "$vhn = 19" + gdb_test "print g_D.D::x" "$vhn = 20" - gdb_test "print g_vC.vA::va" ".* = 7" "print g_vC.vA::va" + # Print all members of g_E. + # g_E.A::a and g_E.A::x are ambiguous. - gdb_test "print g_vC.vA::vx" ".* = 8" "print g_vC.vA::vx" + set name "print g_E.A::a" + gdb_test_multiple "print g_E.A::a" $name { + -re "$vhn = (21|25)$nl$gdb_prompt $" { + kfail "gdb/68" "print g_E.A::a" + } + } - gdb_test "print g_vC.vC::vc" ".* = 9" "print g_vC.vC::vc" + set name "print g_E.A::x" + gdb_test_multiple "print g_E.A::x" $name { + -re "$vhn = (26|22)$nl$gdb_prompt $" { + kfail "gdb/68" "print g_E.A::x" + } + } - gdb_test "print g_vC.vC::vx" ".* = 10" "print g_vC.vC::vx" + gdb_test "print g_E.B::b" "$vhn = 23" + gdb_test "print g_E.B::x" "$vhn = 24" + gdb_test "print g_E.C::c" "$vhn = 27" + gdb_test "print g_E.C::x" "$vhn = 28" + gdb_test "print g_E.D::d" "$vhn = 29" + gdb_test "print g_E.D::x" "$vhn = 30" + gdb_test "print g_E.E::e" "$vhn = 31" + gdb_test "print g_E.E::x" "$vhn = 32" +} - # Print members of g_vC using compact form. +# Multiple inheritance, print complete classes. - gdb_test "print g_vC.va" ".* = 7" "print g_vC.va" +proc test_print_mi_classes { } { + global vhn - gdb_test "print g_vC.vc" ".* = 9" "print g_vC.vc" + # Print all members of g_D. + gdb_test "print g_D" "$vhn = \{\<(class |)B\> = \{\<(class |)A\> = \{a = 11, x = 12\}, b = 13, x = 14\}, \<(class |)C\> = \{\<(class |)A\> = \{a = 15, x = 16\}, c = 17, x = 18\}, d = 19, x = 20\}" - gdb_test "print g_vC.vx" ".* = 10" "print g_vC.vx" + # Print all members of g_E. + gdb_test "print g_E" "$vhn = \{\<(class |)D\> = \{\<(class |)B\> = \{\<(class |)A\> = \{a = 21, x = 22\}, b = 23, x = 24\}, \<(class |)C\> = \{\<(class |)A\> = \{a = 25, x = 26\}, c = 27, x = 28\}, d = 29, x = 30\}, e = 31, x = 32\}" } +# Single inheritance, print anonymous unions. +# GDB versions prior to 4.14 entered an infinite loop when printing +# the type of a class containing an anonymous union, and they were also +# incapable of printing the member of an anonymous union. +# We test the printing of the member first, and perform the other tests +# only if the test succeeds, to avoid the infinite loop. # -# Single virtual inheritance, print type definitions. -# +# GDB HEAD 2004-01-27 with hp aCC A.03.45 crashes on the first test. +# -- chastain 2004-01-27 -proc test_ptype_vi {} { +proc test_print_anon_union {} { global gdb_prompt global ws global nl - global vbptr + global vhn - # This class does not use any C++-specific features, so it's fine for - # it to print as "struct". - send_gdb "ptype vA\n" - gdb_expect { - -re "type = class vA \{$nl\[ \]*public:$nl\[ \]*int va;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" { - pass "ptype vA" - } - -re "type = struct vA \{$nl\[ \]*int va;$nl\[ \]*int vx;$nl\}$nl$gdb_prompt $" { - pass "ptype vA" - } - -re ".*$gdb_prompt $" { fail "ptype vA" } - timeout { fail "ptype vA (timeout)" ; return } - } + gdb_test "print g_anon_union.a" "$vhn = 2" "print anonymous union member" - # This class does not use any C++-specific features, so it's fine for - # it to print as "struct". - send_gdb "ptype class vA\n" - gdb_expect { - -re "type = class vA \{$nl\[ \]*public:$nl\[ \]*int va;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" { - pass "ptype class vA" - } - -re "type = struct vA \{$nl\[ \]*int va;$nl\[ \]*int vx;$nl\}$nl$gdb_prompt $" { - pass "ptype class vA" + set name "print variable of type anonymous union" + gdb_test_multiple "print g_anon_union" $name { + -re "$vhn = \{one = 1, \{a = 2, b = 2\}\}$nl$gdb_prompt $" { + pass $name } - -re ".*$gdb_prompt $" { fail "ptype class vA" } - timeout { fail "ptype class vA (timeout)" ; return } } - # This class does not use any C++-specific features, so it's fine for - # it to print as "struct". - send_gdb "ptype g_vA\n" - gdb_expect { - -re "type = class vA \{$nl\[ \]*public:$nl\[ \]*int va;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" { - pass "ptype g_vA" - } - -re "type = struct vA \{$nl\[ \]*int va;$nl\[ \]*int vx;$nl\}$nl$gdb_prompt $" { - pass "ptype g_vA" - } - -re ".*$gdb_prompt $" { fail "ptype g_vA" } - timeout { fail "ptype g_vA (timeout)" ; return } - } + set re_class "class class_with_anon_union \{${ws}public:" + set re_fields "int one;${ws}" + set re_anon_union "union \{${ws}int a;${ws}long int b;${ws}\};" + set re_synth_gcc_23 "class_with_anon_union & operator=\\(class_with_anon_union const ?&\\);${ws}class_with_anon_union\\(class_with_anon_union const ?&\\);${ws}class_with_anon_union\\((void|)\\);" - send_gdb "ptype vB\n" - gdb_expect { - -re "ptype vB${nl}type = class vB : public virtual vA \{$nl private:${ws}vA \\*${vbptr}vA;$nl public:${ws}int vb;${ws}int vx;$nl.*\}$nl$gdb_prompt $" { - pass "ptype vB" + set name "print type of anonymous union" + gdb_test_multiple "ptype g_anon_union" $name { + -re "type = $re_class${ws}$re_fields${ws}$re_anon_union$nl\}$nl$gdb_prompt $" { + pass $name } - -re "ptype vB${nl}type = class vB : public virtual vA \{$nl public:${ws}int vb;${ws}int vx;$nl.*\}$nl$gdb_prompt $" { - pass "ptype vB (aCC)" + -re "type = $re_class${ws}$re_fields${ws}$re_anon_union${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" { + pass $name } - -re ".*$gdb_prompt $" { fail "ptype vB" } - timeout { fail "ptype vB (timeout)" } } +} - send_gdb "ptype class vB\n" - gdb_expect { - -re "type = class vB : public virtual vA \{$nl\[ \]*private:$nl\[ \]*vA \\*${vbptr}vA;$nl\[ \]*public:$nl\[ \]*int vb;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" { - pass "ptype class vB" - } - -re "type = class vB : public virtual vA \{$nl\[ \]*public:$nl\[ \]*int vb;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" { - pass "ptype class vB (aCC)" - } - -re ".*$gdb_prompt $" { fail "ptype class vB" } - timeout { fail "ptype class vB (timeout)" } - } - send_gdb "ptype g_vB\n" - gdb_expect { - -re "type = class vB : public virtual vA \{$nl\[ \]*private:$nl\[ \]*vA \\*${vbptr}vA;$nl\[ \]*public:$nl\[ \]*int vb;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" { - pass "ptype g_vB" - } - -re "type = class vB : public virtual vA \{$nl\[ \]*public:$nl\[ \]*int vb;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" { - pass "ptype g_vB (aCC)" - } - -re ".*$gdb_prompt $" { fail "ptype g_vB" } - timeout { fail "ptype g_vB (timeout)" } - } +# Single virtual inheritance, print individual members. - send_gdb "ptype vC\n" - gdb_expect { - -re "type = class vC : public virtual vA \{$nl\[ \]*private:$nl\[ \]*vA \\*${vbptr}vA;$nl\[ \]*public:$nl\[ \]*int vc;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" { - pass "ptype vC" - } - -re "type = class vC : public virtual vA \{$nl\[ \]*public:$nl\[ \]*int vc;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" { - pass "ptype vC (aCC)" - } - -re ".*$gdb_prompt $" { fail "ptype vC" } - timeout { fail "ptype vC (timeout)" } - } +proc test_print_svi_members { } { + global vhn - send_gdb "ptype class vC\n" - gdb_expect { - -re "type = class vC : public virtual vA \{$nl\[ \]*private:$nl\[ \]*vA \\*${vbptr}vA;$nl\[ \]*public:$nl\[ \]*int vc;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" { - pass "ptype class vC" - } - -re "type = class vC : public virtual vA \{$nl\[ \]*public:$nl\[ \]*int vc;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" { - pass "ptype class vC (aCC)" - } - -re ".*$gdb_prompt $" { fail "ptype class vC" } - timeout { fail "ptype class vC (timeout)" } - } + # Print all members of g_vA. + gdb_test "print g_vA.vA::va" "$vhn = 1" + gdb_test "print g_vA.vA::vx" "$vhn = 2" - send_gdb "ptype g_vC\n" - gdb_expect { - -re "type = class vC : public virtual vA \{$nl\[ \]*private:$nl\[ \]*vA \\*${vbptr}vA;$nl\[ \]*public:$nl\[ \]*int vc;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" { - pass "ptype g_vC" - } - -re "type = class vC : public virtual vA \{$nl\[ \]*public:$nl\[ \]*int vc;$nl\[ \]*int vx;$nl.*\}$nl$gdb_prompt $" { - pass "ptype g_vC (aCC)" - } - -re ".*$gdb_prompt $" { fail "ptype g_vC" } - timeout { fail "ptype g_vC (timeout)" } - } + # Print members of g_vA using compact form. + gdb_test "print g_vA.va" "$vhn = 1" + gdb_test "print g_vA.vx" "$vhn = 2" + + # Print all members of g_vB. + gdb_test "print g_vB.vA::va" "$vhn = 3" + gdb_test "print g_vB.vA::vx" "$vhn = 4" + gdb_test "print g_vB.vB::vb" "$vhn = 5" + gdb_test "print g_vB.vB::vx" "$vhn = 6" + + # Print members of g_vB using compact form. + gdb_test "print g_vB.va" "$vhn = 3" + gdb_test "print g_vB.vb" "$vhn = 5" + gdb_test "print g_vB.vx" "$vhn = 6" + + # Print all members of g_vC. + gdb_test "print g_vC.vA::va" "$vhn = 7" + gdb_test "print g_vC.vA::vx" "$vhn = 8" + gdb_test "print g_vC.vC::vc" "$vhn = 9" + gdb_test "print g_vC.vC::vx" "$vhn = 10" + + # Print members of g_vC using compact form. + gdb_test "print g_vC.va" "$vhn = 7" "print g_vC.va" + gdb_test "print g_vC.vc" "$vhn = 9" "print g_vC.vc" + gdb_test "print g_vC.vx" "$vhn = 10" "print g_vC.vx" } -# # Single virtual inheritance, print complete classes. -# -proc test_print_svi_classes {} { +proc test_print_svi_classes { } { global gdb_prompt global hex - global decimal global nl - global vbptr + global vhn # Print all members of g_vA. - - gdb_test "print g_vA" ".* = \{va = 1, vx = 2\}" "print g_vA" + gdb_test "print g_vA" "$vhn = \{va = 1, vx = 2\}" # Print all members of g_vB. - - send_gdb "print g_vB\n" - gdb_expect { - -re ".* = \{\<class vA\> = \{va = 3, vx = 4\}, vb = 5, vx = 6, Virtual table at $hex\}$nl$gdb_prompt $" { - pass "print g_vB (aCC)" - } - -re ".* = \{\<class vA\> = \{va = 3, vx = 4\}, vb = 5, vx = 6, __vfp = $hex\}$nl$gdb_prompt $" { - pass "print g_vB (aCC)" - } - -re ".* = \{\<vA\> = \{va = 3, vx = 4\}, ${vbptr}vA = $hex, vb = 5, vx = 6\}$nl$gdb_prompt $" { - pass "print g_vB" + set re_vbptr_2 "(_vb.2vA|_vb.vA)" + set re_vbptr_3 "_vptr.vB" + + set name "print g_vB" + gdb_test_multiple "print g_vB" $name { + -re "$vhn = \{<vA> = \{va = 3, vx = 4\}, $re_vbptr_2 = $hex, vb = 5, vx = 6\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gdwarf-2 + # gcc 2.95.3 -gstabs+ + pass $name + } + -re "$vhn = \{<vA> = \{va = 3, vx = 4\}, $re_vbptr_3 = $hex, vb = 5, vx = 6\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gdwarf-2 + # gcc HEAD 2004-01-21 -gdwarf-2 + # gcc HEAD 2004-01-21 -gstabs+ + pass "$name (FIXME v3 vtbl ptr)" + } + -re "$vhn = \{<vA> = \{va = 3, vx = 4\}, $re_vbptr_3 = $hex <VTT for vB>, vb = 5, vx = 6\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gstabs+ + pass $name } - -re ".* = \{\<vA\> = \{va = 3, vx = 4\}, _vptr.vB = $hex, vb = 5, vx = 6\}$nl$gdb_prompt $" { - pass "print g_vB (FIXME v3 vtbl ptr)" - } - -re ".* = \{\<vA\> = \{va = 3, vx = 4\}, _vptr.vB = $hex <VTT for vB>, vb = 5, vx = 6\}$nl$gdb_prompt $" { - # Happens with gcc 3.3 -gstabs+ - # Does not happen with gcc 3.2.3 -gstabs+. - # Does not happen gcc HEAD%20030624 (pre-3.4) -gstabs+. - # -- chastain 2003-06-29 - pass "print g_vB" - } - - -re ".*invalid address 0x0.*$gdb_prompt $" { - # Does not happen with gcc cygnus-2.4.5-930828 - fail "print g_vB (known bug with gcc cygnus-2.4.5-930417)" - # Many of the rest of these tests have the same problem. - return 0 - } - -re ".*$gdb_prompt $" { fail "print g_vB" } - timeout { fail "print g_vB (timeout)" ; return } } # Print all members of g_vC. - - send_gdb "print g_vC\n" - gdb_expect { - -re ".* = \{\<class vA\> = \{va = 7, vx = 8\}, vc = 9, vx = 10, Virtual table at $hex\}$nl$gdb_prompt $" { - pass "print g_vC (aCC)" - } - -re ".* = \{\<class vA\> = \{va = 7, vx = 8\}, vc = 9, vx = 10, __vfp = $hex\}$nl$gdb_prompt $" { - pass "print g_vC (aCC)" + set re_vbptr_2 "(_vb.2vA|_vb.vA)" + set re_vbptr_3 "_vptr.vC" + + set name "print g_vC" + gdb_test_multiple "print g_vC" $name { + -re "$vhn = \{<vA> = \{va = 7, vx = 8\}, $re_vbptr_2 = $hex, vc = 9, vx = 10\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gdwarf-2 + # gcc 2.95.3 -gstabs+ + pass $name + } + -re "$vhn = \{<vA> = \{va = 7, vx = 8\}, $re_vbptr_3 = $hex, vc = 9, vx = 10\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gdwarf-2 + # gcc HEAD 2004-01-21 -gdwarf-2 + # gcc HEAD 2004-01-21 -gstabs+ + pass "$name (FIXME v3 vtbl ptr)" + } + -re "$vhn = \{<vA> = \{va = 7, vx = 8\}, $re_vbptr_3 = $hex <VTT for vC>, vc = 9, vx = 10\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gstabs+ + pass $name } - -re ".* = \{\<vA\> = \{va = 7, vx = 8\}, ${vbptr}vA = $hex, vc = 9, vx = 10\}$nl$gdb_prompt $" { - pass "print g_vC" - } - -re ".* = \{\<vA\> = \{va = 7, vx = 8\}, _vptr.vC = $hex, vc = 9, vx = 10\}$nl$gdb_prompt $" { - pass "print g_vC (FIXME v3 vtbl ptr)" - } - -re ".* = \{\<vA\> = \{va = 7, vx = 8\}, _vptr.vC = $hex <VTT for vC>, vc = 9, vx = 10\}$nl$gdb_prompt $" { - # Happens with gcc 3.3 -gstabs+ - # Does not happen with gcc 3.2.3 -gstabs+. - # Does not happen gcc HEAD%20030624 (pre-3.4) -gstabs+. - # -- chastain 2003-06-29 - pass "print g_vC" - } - -re ".*$gdb_prompt $" { fail "print g_vC" } - timeout { fail "print g_vC (timeout)" } } } -# # Multiple virtual inheritance, print individual members. -# -proc test_print_mvi_members {} { - global gdb_prompt - global decimal - global nl +proc test_print_mvi_members { } { + global vhn # Print all members of g_vD. - - send_gdb "print g_vD.vA::va\n" - gdb_expect { - -re ".* = 19$nl$gdb_prompt $" { pass "print g_vD.vA::va" } - -re ".*virtual baseclass botch.*$gdb_prompt $" { - # Does not happen with gcc cygnus-2.4.5-930828 - fail "print g_vD.vA::va (known bug with gcc cygnus-2.4.5-930417)" - # Many of the rest of these tests have the same problem. - return 0 - } - -re ".*$gdb_prompt $" { fail "print g_vD.vA::va" } - timeout { fail "print g_vD.vA::va (timeout)" ; return } - } - - gdb_test "print g_vD.vA::vx" ".* = 20" "print g_vD.vA::vx" - - gdb_test "print g_vD.vB::vb" ".* = 21" "print g_vD.vB::vb" - - gdb_test "print g_vD.vB::vx" ".* = 22" "print g_vD.vB::vx" - - gdb_test "print g_vD.vC::vc" ".* = 23" "print g_vD.vC::vc" - - gdb_test "print g_vD.vC::vx" ".* = 24" "print g_vD.vC::vx" - - gdb_test "print g_vD.vD::vd" ".* = 25" "print g_vD.vD::vd" - - gdb_test "print g_vD.vD::vx" ".* = 26" "print g_vD.vD::vx" + gdb_test "print g_vD.vA::va" "$vhn = 19" + gdb_test "print g_vD.vA::vx" "$vhn = 20" + gdb_test "print g_vD.vB::vb" "$vhn = 21" + gdb_test "print g_vD.vB::vx" "$vhn = 22" + gdb_test "print g_vD.vC::vc" "$vhn = 23" + gdb_test "print g_vD.vC::vx" "$vhn = 24" + gdb_test "print g_vD.vD::vd" "$vhn = 25" + gdb_test "print g_vD.vD::vx" "$vhn = 26" # Print all members of g_vE. - - gdb_test "print g_vE.vA::va" ".* = 0" "print g_vE.vA::va" - - gdb_test "print g_vE.vA::vx" ".* = 0" "print g_vE.vA::vx" - - gdb_test "print g_vE.vB::vb" ".* = 0" "print g_vE.vB::vb" - - gdb_test "print g_vE.vB::vx" ".* = 0" "print g_vE.vB::vx" - - gdb_test "print g_vE.vC::vc" ".* = 0" "print g_vE.vC::vc" - - gdb_test "print g_vE.vC::vx" ".* = 0" "print g_vE.vC::vx" - - gdb_test "print g_vE.vD::vd" ".* = 0" "print g_vE.vD::vd" - - gdb_test "print g_vE.vD::vx" ".* = 0" "print g_vE.vD::vx" - - gdb_test "print g_vE.vE::ve" ".* = 27" "print g_vE.vE::ve" - - gdb_test "print g_vE.vE::vx" ".* = 28" "print g_vE.vE::vx" + gdb_test "print g_vE.vA::va" "$vhn = 0" + gdb_test "print g_vE.vA::vx" "$vhn = 0" + gdb_test "print g_vE.vB::vb" "$vhn = 0" + gdb_test "print g_vE.vB::vx" "$vhn = 0" + gdb_test "print g_vE.vC::vc" "$vhn = 0" + gdb_test "print g_vE.vC::vx" "$vhn = 0" + gdb_test "print g_vE.vD::vd" "$vhn = 0" + gdb_test "print g_vE.vD::vx" "$vhn = 0" + gdb_test "print g_vE.vE::ve" "$vhn = 27" + gdb_test "print g_vE.vE::vx" "$vhn = 28" } -# -# Multiple virtual inheritance, print type definitions. -# +# Multiple virtual inheritance, print complete classes. -proc test_ptype_mvi {} { +proc test_print_mvi_classes { } { global gdb_prompt + global hex global ws global nl - global vbptr - - send_gdb "ptype vD\n" - gdb_expect { - -re "type = class vD : public virtual vB, public virtual vC \{${ws}private:${ws}vC \\*${vbptr}vC;${ws}vB \\*${vbptr}vB;${ws}public:${ws}int vd;${ws}int vx;$nl.*\}.*$gdb_prompt $" { - pass "ptype vD" - } - -re ".*class vD : public virtual vB, public virtual vC \{${ws}public:${ws}int vd;${ws}int vx;.*\}.*$gdb_prompt $" { - pass "ptype vD" - } - -re ".*$gdb_prompt $" { fail "ptype vD" } - timeout { fail "(timeout) ptype vD" } - } - - send_gdb "ptype class vD\n" - gdb_expect { - -re "type = class vD : public virtual vB, public virtual vC \{${ws}private:${ws}vC \\*${vbptr}vC;${ws}vB \\*${vbptr}vB;${ws}public:${ws}int vd;${ws}int vx;$nl.*\}.*$gdb_prompt $" { - pass "ptype class vD" - } - -re ".*class vD : public virtual vB, public virtual vC \{${ws}public:${ws}int vd;${ws}int vx;.*\}.*$gdb_prompt $" { - pass "ptype class vD" - } - -re ".*$gdb_prompt $" { fail "ptype class vD" } - timeout { fail "(timeout) ptype class vD" } - } - - send_gdb "ptype g_vD\n" - gdb_expect { - -re "type = class vD : public virtual vB, public virtual vC \{${ws}private:${ws}vC \\*${vbptr}vC;${ws}vB \\*${vbptr}vB;${ws}public:${ws}int vd;${ws}int vx;$nl.*\}.*$gdb_prompt $" { - pass "ptype g_vD" - } - -re ".*class vD : public virtual vB, public virtual vC \{${ws}public:${ws}int vd;${ws}int vx;\r\n.*\}.*$gdb_prompt $" { - pass "ptype g_vD" - } - -re ".*$gdb_prompt $" { fail "ptype g_vD" } - timeout { fail "(timeout) ptype g_vD" } - } - - send_gdb "ptype vE\n" - gdb_expect { - -re "type = class vE : public virtual vD \{${ws}private:${ws}vD \\*${vbptr}vD;${ws}public:${ws}int ve;${ws}int vx;$nl.*\}.*$gdb_prompt $" { - pass "ptype vE" - } - -re ".*class vE : public virtual vD \{${ws}public:${ws}int ve;${ws}int vx;\r\n.*\}.*$gdb_prompt $" { - pass "ptype vE" - } - -re ".*$gdb_prompt $" { fail "ptype vE" } - timeout { fail "(timeout) ptype vE" } - } + global vhn - send_gdb "ptype class vE\n" - gdb_expect { - -re "type = class vE : public virtual vD \{${ws}private:${ws}vD \\*${vbptr}vD;${ws}public:${ws}int ve;${ws}int vx;$nl.*\}.*$gdb_prompt $" { - pass "ptype class vE" - } - -re "type = class vE : public virtual vD \{${ws}public:${ws}int ve;${ws}int vx;\r\n.*\}.*$gdb_prompt $" { - pass "ptype class vE" - } - -re ".*$gdb_prompt $" { fail "ptype class vE" } - timeout { fail "(timeout) ptype class vE" } - } + # Virtual base pointers for everybody. - send_gdb "ptype g_vE\n" - gdb_expect { - -re "type = class vE : public virtual vD \{${ws}private:${ws}vD \\*${vbptr}vD;${ws}public:${ws}int ve;${ws}int vx;$nl.*\}.*$gdb_prompt $" { - pass "ptype g_vE" - } - -re "type = class vE : public virtual vD \{${ws}public:${ws}int ve;${ws}int vx;\r\n.*\}.*$gdb_prompt $" { - pass "ptype g_vE" - } - -re ".*$gdb_prompt $" { fail "ptype g_vE" } - timeout { fail "(timeout) ptype g_vE" } - } -} - -# -# Multiple virtual inheritance, print complete classes. -# - -proc test_print_mvi_classes {} { - global gdb_prompt - global hex - global decimal - global nl - global vbptr + set re_vbptr_2_vA "(_vb.2vA|_vb.vA)" + set re_vbptr_2_vB "(_vb.2vB|_vb.vB)" + set re_vbptr_2_vC "(_vb.2vC|_vb.vC)" + set re_vbptr_2_vD "(_vb.2vD|_vb.vD)" + set re_vbptr_3_vA "_vptr.vA" + set re_vbptr_3_vB "_vptr.vB" + set re_vbptr_3_vC "_vptr.vC" + set re_vbptr_3_vD "_vptr.vD" + set re_vbptr_3_vE "_vptr.vE" # Print all members of g_vD. - send_gdb "print g_vD\n" - gdb_expect { - -re ".* = \{\<class vB\> = \{\<class vA\> = \{va = 19, vx = 20\}, vb = 21, vx = 22, Virtual table at $hex\}, \<class vC\> = \{vc = 23, vx = 24, Virtual table at $hex\}, vd = 25, vx = 26, Virtual table at $hex\}$nl$gdb_prompt $" { - pass "print g_vD (aCC)" - } - -re ".* = \{\<class vB\> = \{\<class vA\> = \{va = 19, vx = 20\}, vb = 21, vx = 22, __vfp = $hex\}, \<class vC\> = \{vc = 23, vx = 24, __vfp = $hex\}, vd = 25, vx = 26, __vfp = $hex\}$nl$gdb_prompt $" { - pass "print g_vD (aCC)" + set name "print g_vD" + gdb_test_multiple "print g_vD" $name { + -re "$vhn = \{<vB> = \{<vA> = \{va = 19, vx = 20\}, $re_vbptr_2_vA = $hex, vb = 21, vx = 22\}, <vC> = \{$re_vbptr_2_vA = $hex, vc = 23, vx = 24\}, $re_vbptr_2_vC = $hex, $re_vbptr_2_vB = $hex, vd = 25, vx = 26\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gdwarf-2 + # gcc 2.95.3 -gstabs+ + pass $name } - -re ".* = \{\<vB\> = \{\<vA\> = \{va = 19, vx = 20\}, ${vbptr}vA = $hex, vb = 21, vx = 22\}, \<vC\> = \{${vbptr}vA = $hex, vc = 23, vx = 24\}, ${vbptr}vC = $hex, ${vbptr}vB = $hex, vd = 25, vx = 26\}$nl$gdb_prompt $" { - pass "print g_vD" + -re "$vhn = \{<vB> = \{<vA> = \{va = 19, vx = 20\}, $re_vbptr_3_vB = $hex, vb = 21, vx = 22\}, <vC> = \{$re_vbptr_3_vC = $hex, vc = 23, vx = 24\}, $re_vbptr_3_vD = $hex, vd = 25, vx = 26\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gdwarf-2 + # gcc HEAD 2004-01-21 -gdwarf-2 + # gcc HEAD 2004-01-21 -gstabs+ + pass "$name (FIXME v3 vtbl ptr)" } - -re ".* = \{\<vB\> = \{\<vA\> = \{va = 19, vx = 20\}, _vptr.vB = $hex, vb = 21, vx = 22\}, \<vC\> = \{_vptr.vC = $hex, vc = 23, vx = 24\}, _vptr.vD = $hex, vd = 25, vx = 26\}$nl$gdb_prompt $" { - pass "print g_vD (FIXME v3 vtbl ptr)" + -re "$vhn = \{<vB> = \{<vA> = \{va = 19, vx = 20\}, $re_vbptr_3_vB = $hex, vb = 21, vx = 22\}, <vC> = \{$re_vbptr_3_vC = $hex <VTT for vD>, vc = 23, vx = 24\}, $re_vbptr_3_vD = $hex, vd = 25, vx = 26\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gstabs+ + pass "$name" } - -re ".* = \{\<vB\> = \{\<vA\> = \{va = 19, vx = 20\}, _vptr.vB = $hex, vb = 21, vx = 22\}, \<vC\> = \{_vptr.vC = $hex <VTT for vD>, vc = 23, vx = 24\}, _vptr.vD = $hex, vd = 25, vx = 26\}$nl$gdb_prompt $" { - # Happens with gcc 3.3 -gstabs+ - # Does not happen with gcc 3.2.3 -gstabs+. - # Does not happen gcc HEAD%20030624 (pre-3.4) -gstabs+. - # -- chastain 2003-06-29 - pass "print g_vD" - } - -re ".*invalid address 0x0.*$gdb_prompt $" { - # Does not happen with gcc cygnus-2.4.5-930828 - fail "print g_vD (known bug with gcc cygnus-2.4.5-930417)" - # Many of the rest of these tests have the same problem. - return 0 - } - -re ".*$gdb_prompt $" { fail "print g_vD" } - timeout { fail "print g_vD (timeout)" ; return } } # Print all members of g_vE. - send_gdb "print g_vE\n" - gdb_expect { - -re ".* = \{\<class vD\> = \{\<class vB\> = \{\<class vA\> = \{va = 0, vx = 0\}, vb = 0, vx = 0, Virtual table at $hex\}, \<class vC\> = \{vc = 0, vx = 0, Virtual table at $hex\}, vd = 0, vx = 0, Virtual table at $hex\}, ve = 27, vx = 28, Virtual table at $hex\}$nl$gdb_prompt $" { - pass "print g_vE (aCC)" - } - -re ".* = \{\<class vD\> = \{\<class vB\> = \{\<class vA\> = \{va = 0, vx = 0\}, vb = 0, vx = 0, __vfp = $hex\}, \<class vC\> = \{vc = 0, vx = 0, __vfp = $hex\}, vd = 0, vx = 0, __vfp = $hex\}, ve = 27, vx = 28, __vfp = $hex\}$nl$gdb_prompt $" { - pass "print g_vE (aCC)" + set name "print g_vE" + gdb_test_multiple "print g_vE" $name { + -re "$vhn = \{<vD> = \{<vB> = \{<vA> = \{va = 0, vx = 0\}, $re_vbptr_2_vA = $hex, vb = 0, vx = 0\}, <vC> = \{$re_vbptr_2_vA = $hex, vc = 0, vx = 0\}, $re_vbptr_2_vC = $hex, $re_vbptr_2_vB = $hex, vd = 0, vx = 0\}, $re_vbptr_2_vD = $hex, ve = 27, vx = 28\}$nl$gdb_prompt $" { + # gcc 2.95.3 -gdwarf-2 + # gcc 2.95.3 -gstabs+ + pass $name } - -re ".* = \{\<vD\> = \{\<vB\> = \{\<vA\> = \{va = 0, vx = 0\}, ${vbptr}vA = $hex, vb = 0, vx = 0\}, \<vC\> = \{${vbptr}vA = $hex, vc = 0, vx = 0\}, ${vbptr}vC = $hex, ${vbptr}vB = $hex, vd = 0, vx = 0\}, ${vbptr}vD = $hex, ve = 27, vx = 28\}$nl$gdb_prompt $" { - pass "print g_vE" + -re "$vhn = \{<vD> = \{<vB> = \{<vA> = \{va = 0, vx = 0\}, $re_vbptr_3_vB = $hex, vb = 0, vx = 0\}, <vC> = \{$re_vbptr_3_vC = $hex, vc = 0, vx = 0\}, $re_vbptr_3_vD = $hex, vd = 0, vx = 0\}, $re_vbptr_3_vE = $hex, ve = 27, vx = 28\}$nl$gdb_prompt $" { + # gcc 3.3.2 -gdwarf-2 + # gcc 3.3.2 -gstabs+ + # gcc HEAD 2004-01-21 -gdwarf-2 + # gcc HEAD 2004-01-21 -gstabs+ + pass "$name (FIXME v3 vtbl ptr)" } - -re ".* = \{\<vD\> = \{\<vB\> = \{\<vA\> = \{va = 0, vx = 0\}, _vptr.vB = $hex *(\<VTT for vD\>)?, vb = 0, vx = 0\}, \<vC\> = \{_vptr.vC = $hex *(\<VTT for vD\>)?, vc = 0, vx = 0\}, _vptr.vD = $hex, vd = 0, vx = 0\}, _vptr.vE = $hex, ve = 27, vx = 28\}$nl$gdb_prompt $" { - pass "print g_vE (FIXME v3 vtbl ptr)" + -re "$vhn = \{<vD> = \{<vB> = \{<vA> = \{va = 0, vx = 0\}, $re_vbptr_3_vB = $hex, vb = 0, vx = 0\}, <vC> = \{$re_vbptr_3_vC = $hex <VTT for vD>, vc = 0, vx = 0\}, $re_vbptr_3_vD = $hex, vd = 0, vx = 0\}, $re_vbptr_3_vE = $hex, ve = 27, vx = 28\}$nl$gdb_prompt $" { + # gcc 3.2.7-rh -gstabs+ + pass "$name (FIXME v3 vtbl ptr)" } - -re ".*$gdb_prompt $" { fail "print g_vE" } - timeout { fail "print g_vE (timeout)" } } } -proc do_tests {} { +proc do_tests { } { global prms_id global bug_id global subdir @@ -980,10 +1037,9 @@ proc do_tests {} { gdb_test "set language c++" "" gdb_test "set width 0" "" - # Get the debug format for the compiled test case. - - if { ![ runto_main] } { - gdb_suppress_tests; + if { ![runto_main] } then { + perror "couldn't run to main" + return } test_ptype_si @@ -991,10 +1047,9 @@ proc do_tests {} { test_ptype_vi test_ptype_mvi - gdb_stop_suppressing_tests; - - if { ![ runto 'inheritance2' ] } { - gdb_suppress_tests; + if { ![runto 'inheritance2'] } then { + perror "couldn't run to inheritance2" + return } test_print_si_members @@ -1003,10 +1058,9 @@ proc do_tests {} { test_print_mi_classes test_print_anon_union - gdb_stop_suppressing_tests; - - if { ![ runto 'inheritance4' ] } { - gdb_suppress_tests; + if { ![runto 'inheritance4'] } { + perror "couldn't run to inheritance4" + return } test_print_svi_members diff --git a/gdb/testsuite/gdb.cp/local.exp b/gdb/testsuite/gdb.cp/local.exp index f4e8d22..5cd2ee9 100644 --- a/gdb/testsuite/gdb.cp/local.exp +++ b/gdb/testsuite/gdb.cp/local.exp @@ -15,9 +15,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # tests for local variables # Written by Satish Pai <pai@apollo.hp.com> 1997-07-08 # Cleaned by Michael Chastain <mec@shout.net> 2002-04-08 @@ -73,53 +70,104 @@ if ![runto 'marker1'] then { gdb_test "up" ".*foobar.*" "up from marker1" -# Local classes in g++ get names like "main.1::InnerLocal", just like local -# static variables. Some targets use "___" instead of ".". +set sep "(\[.\]|___)\[0-9\]" -# --- -# Pattern 1: -# PASS -# dwarf-2 -# gcc 2.95.3 +# ptype on a local variable. # -# Pattern 2: -# FAIL -# This has a duplicate "char loc_foo" line. This is a bug. -# Historically this has been an XFAIL. -# dwarf-2 -# gcc 2.96-rh, 3.0.4, gcc-3_1-branch, HEAD +# This test has six arms. The first three arms accept normal output: +# no synthetic methods; synthetic methods before user methods; +# synthetic methods after user methods. # -# Pattern 3: -# PASS -# stabs+ -# gcc 2.95.3, 2.96-rh, 3.0.4, gcc-3_1-branch, HEAD +# The next two arms accept "foobar__Fi.0::Local" instead of "Local". +# This is a bug. It happens in various places with various versions of +# gcc and gdb and various debugging types. # -# Pattern 4: -# This an old pattern from the hppa aCC version of this file. -# I left it alone. +# The last arm accepts the user methods in duplicate. This bug happens +# with gcc 3.3.2 -gdwarf-2, and has been fixed in gcc HEAD 2004-01-22. # -# chastain 2002-04-08 +# -- chastain 2004-01-24 -# pattern #5 -# PASS -# stabs+ -# gcc HEAD abi-2 -# -# chastain 2004-01-02 +set re_class "((struct|class) Local \{${ws}public:|struct Local \{)" +set re_fields "int loc1;" +set re_methods "char loc_foo\\(char\\);" +set re_synth_gcc_23 "Local & operator=\\(Local const ?&\\);${ws}Local\\(Local const ?&\\);${ws}Local\\((void|)\\);" -set sep "(\[.\]|___)\[0-9\]" +set XX_class "((struct|class) foobar__Fi.0::Local \{${ws}public:|struct foobar__Fi.0:Local \{)" +set XX_synth_gcc_2 "Local & operator=\\(foobar__Fi.0::Local const ?&\\);${ws}Local\\(foobar__Fi.0::Local const ?&\\);${ws}Local\\((void|)\\);" +set YY_methods "$re_methods${ws}$re_methods" -send_gdb "ptype Local\n" -gdb_expect { - -re "type = class Local \{\[\r\n\t \]*public:\[\r\n\t \]*int loc1;\[\r\n\t \]*char loc_foo\\((const *|)char\\);\[\r\n\t \]*\}.*$gdb_prompt $" { pass "ptype Local" } - -re "type = class Local \{\[\r\n\t \]*public:\[\r\n\t \]*int loc1;\[\r\n\t \]*char loc_foo\\((const *|)char\\);\[\r\n\t \]*char loc_foo\\((const *|)char\\);\[\r\n\t \]*\}.*$gdb_prompt $" { - kfail "gdb/483" "ptype Local" - } - -re "type = class Local \{\[\r\n\t \]*public:\[\r\n\t \]*int loc1;\[\r\n\t \]*Local & operator *=\\((foobar__Fi${sep}::|)Local const *&\\);\[\r\n\t \]*Local\\((foobar__Fi${sep}::|)Local const *&\\);\[\r\n\t \]*Local\\((void|)\\);\[\r\n\t \]*char loc_foo\\(char\\);\[\r\n\t \]*\}.*$gdb_prompt $" { pass "ptype Local" } - -re "type = class Local \{\r\n\[\t \]*public:\r\n\[\t \]*int loc1;\r\n\r\n\[\t \]*char loc_foo\\(char\\);\r\n\[\t \]*\\(Local at.*local\\.cc:\[0-9\]*\\)\r\n\}.*$gdb_prompt $" { xpass "ptype Local (old aCC)" } - -re "type = class Local \{\[\r\n\t \]*public:\[\r\n\t \]*int loc1;\[\r\n\t \]*char loc_foo\\(char\\);\[\r\n\t \]*Local & operator *=\\((foobar__Fi${sep}::|)Local const *&\\);\[\r\n\t \]*Local\\((foobar__Fi${sep}::|)Local const *&\\);\[\r\n\t \]*Local\\((void|)\\);\[\r\n\t \]*\}.*$gdb_prompt $" { pass "ptype Local" } - -re ".*$gdb_prompt $" { fail "ptype Local" } - timeout { fail "(timeout) ptype Local" } +set name "ptype l" +gdb_test_multiple "ptype l" $name { + -re "type = $re_class${ws}$re_fields${ws}$re_methods$nl\}$nl$gdb_prompt $" { + # gdb 6.0, gcc 2.95.3, dwarf-2 + # gdb 6.0, gcc HEAD 2004-01-22, dwarf-2 + # gdb HEAD 2004-01-23, gcc HEAD 2004-01,22, dwarf-2 + pass "$name" + } + -re "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23${ws}$re_methods$nl\}$nl$gdb_prompt $" { + # gdb 6.0, gcc 3.3.2, stabs+ + # gdb HEAD 2004-01-23, gcc 3.3.2, stabs+ + pass "$name" + } + -re "type = $re_class${ws}$re_fields${ws}$re_methods${ws}$re_synth_gcc_23${ws}$nl\}$nl$gdb_prompt $" { + # gdb 6.0, gcc HEAD 2004-01-22, stabs+ + # gdb HEAD 2004-01-23, gcc HEAD 2004-01-22, stabs+ + pass "$name" + } + -re "type = $XX_class${ws}$re_fields${ws}$re_methods$nl\}$nl$gdb_prompt $" { + # gdb HEAD 2004-01-23, gcc 2.95.3, dwarf-2 + kfail "gdb/1516" "$name" + } + -re "type = ($re_class|$XX_class)${ws}$re_fields${ws}($re_synth_gcc_23|$XX_synth_gcc_2)${ws}$re_methods$nl\}$nl$gdb_prompt $" { + # gdb 6.0, gcc 2.95.3, stabs+ + # gdb HEAD 2004-01-23, gcc 2.95.3, stabs+ + kfail "gdb/1516" "$name" + } + -re "type = ($re_class|$XX_class)${ws}$re_fields${ws}$YY_methods$nl\}$nl$gdb_prompt $" { + # gdb 6.0, gcc 3.3.2, dwarf-2 + # gdb HEAD 2004-01-23, gcc 3.2.2, dwarf-2 + kfail "gdb/483" "$name" + } +} + +# This is the same test with "ptype Local" (the type name) +# instead of "ptype l" (the variable name). + +set name "ptype Local" +gdb_test_multiple "ptype Local" $name { + -re "type = $re_class${ws}$re_fields${ws}$re_methods$nl\}$nl$gdb_prompt $" { + # gdb 6.0, gcc 2.95.3, dwarf-2 + # gdb 6.0, gcc HEAD 2004-01-22, dwarf-2 + # gdb HEAD 2004-01-23, gcc HEAD 2004-01-22, dwarf-2 + pass "$name" + } + -re "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23${ws}$re_methods$nl\}$nl$gdb_prompt $" { + # gdb 6.0, gcc 3.3.2, stabs+ + # gdb HEAD 2004-01-23, gcc 3.3.2, stabs+ + pass "$name" + } + -re "type = $re_class${ws}$re_fields${ws}$re_methods${ws}$re_synth_gcc_23${ws}$nl\}$nl$gdb_prompt $" { + # gdb 6.0, gcc HEAD 2004-01-22, stabs+ + # gdb HEAD 2004-01-23, gcc HEAD 2004-01-22, stabs+ + pass "$name" + } + -re "type = $XX_class${ws}$re_fields${ws}$re_methods$nl\}$nl$gdb_prompt $" { + kfail "gdb/1516" "$name" + } + -re "type = ($re_class|$XX_class)${ws}$re_fields${ws}($re_synth_gcc_23|$XX_synth_gcc_2)${ws}$re_methods$nl\}$nl$gdb_prompt $" { + # gdb 6.0, gcc 2.95.3, stabs+ + # gdb HEAD 2004-01-23, gcc 2.95.3, stabs+ + kfail "gdb/1516" "$name" + } + -re "type = ($re_class|$XX_class)${ws}$re_fields${ws}$YY_methods$nl\}$nl$gdb_prompt $" { + # gdb 6.0, gcc 3.3.2, dwarf-2 + # gdb HEAD 2004-01-23, gcc 3.2.2, dwarf-2 + kfail "gdb/483" "$name" + } + -re "No symbol \"Local\" in current context.$nl$gdb_prompt $" { + # gdb HEAD 2004-01-23, gcc 2.95.3, dwarf-2 + fail "$name" + } } gdb_test "break marker2" diff --git a/gdb/testsuite/gdb.cp/maint.exp b/gdb/testsuite/gdb.cp/maint.exp index 710e14a..fd93333 100644 --- a/gdb/testsuite/gdb.cp/maint.exp +++ b/gdb/testsuite/gdb.cp/maint.exp @@ -1,4 +1,4 @@ -# Copyright 2003 Free Software Foundation Inc. +# Copyright 2003, 2004 Free Software Foundation Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -14,9 +14,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # This file tests C++-specific maintenance commands and help on those. diff --git a/gdb/testsuite/gdb.cp/member-ptr.cc b/gdb/testsuite/gdb.cp/member-ptr.cc index 8851a85..e668c46 100644 --- a/gdb/testsuite/gdb.cp/member-ptr.cc +++ b/gdb/testsuite/gdb.cp/member-ptr.cc @@ -1,6 +1,6 @@ /* This testcase is part of GDB, the GNU debugger. - Copyright 1998, 1999 Free Software Foundation, Inc. + Copyright 1998, 1999, 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 @@ -15,9 +15,9 @@ 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 */ extern "C" { #include <stdio.h> diff --git a/gdb/testsuite/gdb.cp/member-ptr.exp b/gdb/testsuite/gdb.cp/member-ptr.exp index 83a70a0..f6a9d40 100644 --- a/gdb/testsuite/gdb.cp/member-ptr.exp +++ b/gdb/testsuite/gdb.cp/member-ptr.exp @@ -16,9 +16,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # Tests for pointer-to-member support # Written by Satish Pai <pai@apollo.hp.com> 1997-08-19 # Rewritten by Michael Chastain <mec.gnu@mindspring.com> 2004-01-11 diff --git a/gdb/testsuite/gdb.cp/method.exp b/gdb/testsuite/gdb.cp/method.exp index 0e8e485..87666d8 100644 --- a/gdb/testsuite/gdb.cp/method.exp +++ b/gdb/testsuite/gdb.cp/method.exp @@ -14,9 +14,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # tests for misc. C++ method stuff # Written by Satish Pai <pai@apollo.hp.com> 1997-07-08 diff --git a/gdb/testsuite/gdb.cp/misc.exp b/gdb/testsuite/gdb.cp/misc.exp index a2d122f..2758cd0 100644 --- a/gdb/testsuite/gdb.cp/misc.exp +++ b/gdb/testsuite/gdb.cp/misc.exp @@ -15,9 +15,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # This file was written by Fred Fish. (fnf@cygnus.com) if $tracelevel then { diff --git a/gdb/testsuite/gdb.cp/namespace.cc b/gdb/testsuite/gdb.cp/namespace.cc index 6a68373..ee55168 100644 --- a/gdb/testsuite/gdb.cp/namespace.cc +++ b/gdb/testsuite/gdb.cp/namespace.cc @@ -97,6 +97,13 @@ namespace C }; }; + void ensureRefs () { + // NOTE (2004-04-23, carlton): This function is here only to make + // sure that GCC 3.4 outputs debug info for these classes. + static CClass *c = new CClass(); + static CClass::NestedClass *n = new CClass::NestedClass(); + } + namespace { int cX = 6; diff --git a/gdb/testsuite/gdb.cp/namespace.exp b/gdb/testsuite/gdb.cp/namespace.exp index eb03a3e..4b3f1e2 100644 --- a/gdb/testsuite/gdb.cp/namespace.exp +++ b/gdb/testsuite/gdb.cp/namespace.exp @@ -15,9 +15,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # tests for namespaces # Originally written by Satish Pai <pai@apollo.hp.com> 1997-07-23 diff --git a/gdb/testsuite/gdb.cp/namespace1.cc b/gdb/testsuite/gdb.cp/namespace1.cc index 5d66810..c3ad692 100644 --- a/gdb/testsuite/gdb.cp/namespace1.cc +++ b/gdb/testsuite/gdb.cp/namespace1.cc @@ -13,9 +13,9 @@ 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 */ namespace C { @@ -24,6 +24,12 @@ namespace C int z; }; + void ensureOtherRefs () { + // NOTE (2004-04-23, carlton): This function is here only to make + // sure that GCC 3.4 outputs debug info for this class. + static OtherFileClass *c = new OtherFileClass(); + } + namespace { int cXOtherFile = 29; }; diff --git a/gdb/testsuite/gdb.cp/overload.cc b/gdb/testsuite/gdb.cp/overload.cc index 56afc96..a41e14d 100644 --- a/gdb/testsuite/gdb.cp/overload.cc +++ b/gdb/testsuite/gdb.cp/overload.cc @@ -53,6 +53,31 @@ int intToChar (char c) void marker1() {} +// Now test how overloading and namespaces interact. + +class dummyClass {}; + +dummyClass dummyInstance; + +int overloadNamespace(int i) +{ + return 1; +} + +int overloadNamespace(dummyClass d) +{ + return 2; +} + +namespace XXX { + int overloadNamespace (char c) + { + return 3; + } + + void marker2() {} +} + int main () { char arg2 = 2; @@ -81,7 +106,8 @@ int main () intToChar(1); marker1(); // marker1-returns-here - return 0; // marker1-returns-here + XXX::marker2(); // marker1-returns-here + return 0; } foo::foo (int i) { ifoo = i; ccpfoo = NULL; } diff --git a/gdb/testsuite/gdb.cp/overload.exp b/gdb/testsuite/gdb.cp/overload.exp index 2925b50..b09c58e 100644 --- a/gdb/testsuite/gdb.cp/overload.exp +++ b/gdb/testsuite/gdb.cp/overload.exp @@ -15,9 +15,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # written by Elena Zannoni (ezannoni@cygnus.com) # Rewritten by Michael Chastain <mec.gnu@mindspring.com> @@ -296,6 +293,21 @@ gdb_test "list \"foo::overloadfnarg(int, int (*)(int))\"" \ "int foo::overloadfnarg.*\\(int arg, int \\(\\*foo\\) \\(int\\)\\).*" \ "list overloaded function with function ptr args - quotes around argument" +# Now some tests to see how overloading and namespaces interact. + +gdb_test "print overloadNamespace(1)" ".\[0-9\]* = 1" +gdb_test "print overloadNamespace('a')" ".\[0-9\]* = 1" +gdb_test "print overloadNamespace(dummyInstance)" ".\[0-9\]* = 2" + +if ![runto 'XXX::marker2'] then { + perror "couldn't run to XXX::marker2" + continue +} + +gdb_test "print overloadNamespace(1)" ".\[0-9\]* = 3" "print overloadNamespace(1) in XXX" +gdb_test "print overloadNamespace('a')" ".\[0-9\]* = 3" "print overloadNamespace('a') in XXX" +gdb_test "print overloadNamespace(dummyInstance)" ".\[0-9\]* = 2" "print overloadNamespace(dummyInstance) in XXX" + # One last mysterious test. # I wonder what this is for? diff --git a/gdb/testsuite/gdb.cp/ovldbreak.exp b/gdb/testsuite/gdb.cp/ovldbreak.exp index 043243d..b6dfa5c 100644 --- a/gdb/testsuite/gdb.cp/ovldbreak.exp +++ b/gdb/testsuite/gdb.cp/ovldbreak.exp @@ -1,4 +1,4 @@ -# Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc. +# Copyright (C) 1998, 1999, 2001, 2004 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -14,9 +14,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # written by Elena Zannoni (ezannoni@cygnus.com) # modified by Michael Chastain (chastain@redhat.com) diff --git a/gdb/testsuite/gdb.cp/psmang.exp b/gdb/testsuite/gdb.cp/psmang.exp index 31dd346..b137379 100644 --- a/gdb/testsuite/gdb.cp/psmang.exp +++ b/gdb/testsuite/gdb.cp/psmang.exp @@ -1,4 +1,4 @@ -# Copyright 2002 Free Software Foundation, Inc. +# Copyright 2002, 2004 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -14,9 +14,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # This file is part of the gdb testsuite # Looking up methods by name, in programs with multiple compilation units. diff --git a/gdb/testsuite/gdb.cp/ref-types.exp b/gdb/testsuite/gdb.cp/ref-types.exp index 98dc2d6..764ba8b 100644 --- a/gdb/testsuite/gdb.cp/ref-types.exp +++ b/gdb/testsuite/gdb.cp/ref-types.exp @@ -15,9 +15,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # written by Elena Zannoni (ezannoni@cygnus.com) if $tracelevel then { diff --git a/gdb/testsuite/gdb.cp/rtti.exp b/gdb/testsuite/gdb.cp/rtti.exp index 1241665..0a8a2d7 100644 --- a/gdb/testsuite/gdb.cp/rtti.exp +++ b/gdb/testsuite/gdb.cp/rtti.exp @@ -46,8 +46,9 @@ set srcfile2 "${srcdir}/${subdir}/${testfile}2.cc" set objfile2 "${objdir}/${subdir}/${testfile}2.o" set binfile ${objdir}/${subdir}/${testfile} -# gdb_get_line_number needs this to be called srcfile. -set srcfile "${srcfile1}" +# gdb_get_line_number needs this to be called srcfile. Except that it +# gets confused if the directories are included. :-( +set srcfile "${testfile}1.cc" if { [gdb_compile "${srcfile1}" "${objfile1}" object {debug c++}] != "" } { gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." @@ -78,8 +79,8 @@ if ![runto_main] then { # First, run to after we've constructed the object: -gdb_breakpoint [gdb_get_line_number "constructs-done"] -gdb_continue_to_breakpoint "end of constructors" +gdb_breakpoint [gdb_get_line_number "main-constructs-done"] +gdb_continue_to_breakpoint "end of constructors in main" gdb_test_multiple "print *e1" "print *e1" { -re "warning: RTTI symbol not found for class 'n1::D1'.*$gdb_prompt $" { @@ -131,5 +132,13 @@ gdb_test_multiple "print *e2" "print *e2" { } } +# Now we test the hack that's been implemented to get around some +# instances of PR gdb/1511. + +gdb_breakpoint [gdb_get_line_number "func-constructs-done"] +gdb_continue_to_breakpoint "end of constructors in func" + +gdb_test "print *obj" "\\$\[0-9\]* = {<n2::Base2> = .*}" + gdb_exit return 0 diff --git a/gdb/testsuite/gdb.cp/rtti1.cc b/gdb/testsuite/gdb.cp/rtti1.cc index 6e9d862..de8e12f 100644 --- a/gdb/testsuite/gdb.cp/rtti1.cc +++ b/gdb/testsuite/gdb.cp/rtti1.cc @@ -1,6 +1,6 @@ /* Code to go along with tests in rtti.exp. - Copyright 2003 Free Software Foundation, Inc. + Copyright 2003, 2004 Free Software Foundation, Inc. Contributed by David Carlton <carlton@bactrian.org> and by Kealia, Inc. @@ -55,6 +55,26 @@ namespace n1 { } // n1 +// NOTE: carlton/2004-01-23: This call exists only to convince GCC to +// keep around a reference to 'obj' in n2::func - GCC 3.4 had been +// optimizing it away. +void refer_to (n2::C2 *obj) +{ + // Do nothing. +} + +namespace n2 +{ + void func () + { + C2 *obj = create2 (); + + refer_to (obj); // func-constructs-done + + return; + } +} + int main() { using namespace n1; @@ -63,5 +83,7 @@ int main() C1 *e1 = create1(); C2 *e2 = create2(); - return 0; // constructs-done + n2::func(); // main-constructs-done + + return 0; } diff --git a/gdb/testsuite/gdb.cp/templates.exp b/gdb/testsuite/gdb.cp/templates.exp index 0f7a573..8763a93 100644 --- a/gdb/testsuite/gdb.cp/templates.exp +++ b/gdb/testsuite/gdb.cp/templates.exp @@ -15,9 +15,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # This file was written by Fred Fish. (fnf@cygnus.com) set ws "\[\r\n\t \]+" diff --git a/gdb/testsuite/gdb.cp/userdef.exp b/gdb/testsuite/gdb.cp/userdef.exp index 4575249..5c9c933 100644 --- a/gdb/testsuite/gdb.cp/userdef.exp +++ b/gdb/testsuite/gdb.cp/userdef.exp @@ -1,5 +1,5 @@ # Tests of overloaded operators resolution. -# Copyright 1998, 1999, 2002 Free Software Foundation, Inc. +# Copyright 1998, 1999, 2002, 2004 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -15,9 +15,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # written by Elena Zannoni (ezannoni@cygnus.com) # # source file "userdef.cc" diff --git a/gdb/testsuite/gdb.cp/virtfunc.exp b/gdb/testsuite/gdb.cp/virtfunc.exp index 958900a..bd931a6 100644 --- a/gdb/testsuite/gdb.cp/virtfunc.exp +++ b/gdb/testsuite/gdb.cp/virtfunc.exp @@ -15,9 +15,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# Please email any bugs, comments, and/or additions to this file to: -# bug-gdb@prep.ai.mit.edu - # This file was written by Fred Fish. (fnf@cygnus.com) # And rewritten by Michael Chastain <mec.gnu@mindspring.com>. @@ -176,7 +173,7 @@ proc test_ptype_of_classes {} { "" "int a;" \ "public:" "virtual int f\\((void|)\\);" \ "A & operator=\\(A const ?&\\);${ws}A\\(int, A const ?&\\);${ws}A\\(int\\);" \ - "A & operator=\\(A const ?&\\);${ws}A\\(A const ?&\\);${ws}A\\(\\);" \ + "A & operator=\\(A const ?&\\);${ws}A\\(A const ?&\\);${ws}A\\((void|)\\);" \ "" # class B @@ -187,7 +184,7 @@ proc test_ptype_of_classes {} { "" "int b;" \ "public:" "virtual int f\\((void|)\\);" \ "B & operator=\\(B const ?&\\);${ws}B\\(int, B const ?&\\);${ws}B\\(int\\);" \ - "B & operator=\\(B const ?&\\);${ws}B\\(B const ?&\\);${ws}B\\(\\);" \ + "B & operator=\\(B const ?&\\);${ws}B\\(B const ?&\\);${ws}B\\((void|)\\);" \ "" # class C @@ -198,7 +195,7 @@ proc test_ptype_of_classes {} { "public:" "int c;" \ "" "" \ "C & operator=\\(C const ?&\\);${ws}C\\(int, C const ?&\\);${ws}C\\(int\\);" \ - "C & operator=\\(C const ?&\\);${ws}C\\(C const ?&\\);${ws}C\\(\\);" \ + "C & operator=\\(C const ?&\\);${ws}C\\(C const ?&\\);${ws}C\\((void|)\\);" \ "" # class AD @@ -220,7 +217,7 @@ proc test_ptype_of_classes {} { "public:" "int d;" \ "" "static void s\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vd\\((void|)\\);${ws}int fd\\((void|)\\);" \ "D & operator=\\(D const ?&\\);${ws}D\\(int, D const ?&\\);${ws}D\\(int\\);" \ - "D & operator=\\(D const ?&\\);${ws}D\\(D const ?&\\);${ws}D\\(\\);" \ + "D & operator=\\(D const ?&\\);${ws}D\\(D const ?&\\);${ws}D\\((void|)\\);" \ "" # class E @@ -232,7 +229,7 @@ proc test_ptype_of_classes {} { "public:" "int e;" \ "" "virtual int f\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vv\\((void|)\\);" \ "E & operator=\\(E const ?&\\);${ws}E\\(int, E const ?&\\);${ws}E\\(int\\);" \ - "E & operator=\\(E const ?&\\);${ws}E\\(E const ?&\\);${ws}E\\(\\);" \ + "E & operator=\\(E const ?&\\);${ws}E\\(E const ?&\\);${ws}E\\((void|)\\);" \ "" # An instance of D @@ -243,7 +240,7 @@ proc test_ptype_of_classes {} { "public:" "int d;" \ "" "static void s\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vd\\((void|)\\);${ws}int fd\\((void|)\\);" \ "D & operator=\\(D const ?&\\);${ws}D\\(int, D const ?&\\);${ws}D\\(int\\);" \ - "D & operator=\\(D const ?&\\);${ws}D\\(D const ?&\\);${ws}D\\(\\);" \ + "D & operator=\\(D const ?&\\);${ws}D\\(D const ?&\\);${ws}D\\((void|)\\);" \ "" # An instance of D * @@ -254,7 +251,7 @@ proc test_ptype_of_classes {} { "public:" "int d;" \ "" "static void s\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vd\\((void|)\\);${ws}int fd\\((void|)\\);" \ "D & operator=\\(D const ?&\\);${ws}D\\(int, D const ?&\\);${ws}D\\(int\\);" \ - "D & operator=\\(D const ?&\\);${ws}D\\(D const ?&\\);${ws}D\\(\\);" \ + "D & operator=\\(D const ?&\\);${ws}D\\(D const ?&\\);${ws}D\\((void|)\\);" \ " ?\\*" # An instance of AD * @@ -277,7 +274,7 @@ proc test_ptype_of_classes {} { "" "int a;" \ "public:" "virtual int f\\((void|)\\);" \ "A & operator=\\(A const ?&\\);${ws}A\\(int, A const ?&\\);${ws}A\\(int\\);" \ - "A & operator=\\(A const ?&\\);${ws}A\\(A const ?&\\);${ws}A\\(\\);" \ + "A & operator=\\(A const ?&\\);${ws}A\\(A const ?&\\);${ws}A\\((void|)\\);" \ "" # An instance of B @@ -288,7 +285,7 @@ proc test_ptype_of_classes {} { "" "int b;" \ "public:" "virtual int f\\((void|)\\);" \ "B & operator=\\(B const ?&\\);${ws}B\\(int, B const ?&\\);${ws}B\\(int\\);" \ - "B & operator=\\(B const ?&\\);${ws}B\\(B const ?&\\);${ws}B\\(\\);" \ + "B & operator=\\(B const ?&\\);${ws}B\\(B const ?&\\);${ws}B\\((void|)\\);" \ "" # An instance of C @@ -299,7 +296,7 @@ proc test_ptype_of_classes {} { "public:" "int c;" \ "" "" \ "C & operator=\\(C const ?&\\);${ws}C\\(int, C const ?&\\);${ws}C\\(int\\);" \ - "C & operator=\\(C const ?&\\);${ws}C\\(C const ?&\\);${ws}C\\(\\);" \ + "C & operator=\\(C const ?&\\);${ws}C\\(C const ?&\\);${ws}C\\((void|)\\);" \ "" # An instance of D @@ -310,7 +307,7 @@ proc test_ptype_of_classes {} { "public:" "int d;" \ "" "static void s\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vd\\((void|)\\);${ws}int fd\\((void|)\\);" \ "D & operator=\\(D const ?&\\);${ws}D\\(int, D const ?&\\);${ws}D\\(int\\);" \ - "D & operator=\\(D const ?&\\);${ws}D\\(D const ?&\\);${ws}D\\(\\);" \ + "D & operator=\\(D const ?&\\);${ws}D\\(D const ?&\\);${ws}D\\((void|)\\);" \ "" # An instance of E @@ -321,7 +318,7 @@ proc test_ptype_of_classes {} { "public:" "int e;" \ "" "virtual int f\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vv\\((void|)\\);" \ "E & operator=\\(E const ?&\\);${ws}E\\(int, E const ?&\\);${ws}E\\(int\\);" \ - "E & operator=\\(E const ?&\\);${ws}E\\(E const ?&\\);${ws}E\\(\\);" \ + "E & operator=\\(E const ?&\\);${ws}E\\(E const ?&\\);${ws}E\\((void|)\\);" \ "" # An instance of V @@ -354,7 +351,7 @@ proc test_ptype_of_classes {} { "" "int a;" \ "public:" "virtual int f\\((void|)\\);" \ "A & operator=\\(A const ?&\\);${ws}A\\(int, A const ?&\\);${ws}A\\(int\\);" \ - "A & operator=\\(A const ?&\\);${ws}A\\(A const ?&\\);${ws}A\\(\\);" \ + "A & operator=\\(A const ?&\\);${ws}A\\(A const ?&\\);${ws}A\\((void|)\\);" \ " ?\\*" # An instance of A * @@ -365,7 +362,7 @@ proc test_ptype_of_classes {} { "" "int a;" \ "public:" "virtual int f\\((void|)\\);" \ "A & operator=\\(A const ?&\\);${ws}A\\(int, A const ?&\\);${ws}A\\(int\\);" \ - "A & operator=\\(A const ?&\\);${ws}A\\(A const ?&\\);${ws}A\\(\\);" \ + "A & operator=\\(A const ?&\\);${ws}A\\(A const ?&\\);${ws}A\\((void|)\\);" \ " ?\\*" # An instance of B * @@ -376,7 +373,7 @@ proc test_ptype_of_classes {} { "" "int b;" \ "public:" "virtual int f\\((void|)\\);" \ "B & operator=\\(B const ?&\\);${ws}B\\(int, B const ?&\\);${ws}B\\(int\\);" \ - "B & operator=\\(B const ?&\\);${ws}B\\(B const ?&\\);${ws}B\\(\\);" \ + "B & operator=\\(B const ?&\\);${ws}B\\(B const ?&\\);${ws}B\\((void|)\\);" \ " ?\\*" # An instance of D * @@ -387,7 +384,7 @@ proc test_ptype_of_classes {} { "public:" "int d;" \ "" "static void s\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vd\\((void|)\\);${ws}int fd\\((void|)\\);" \ "D & operator=\\(D const ?&\\);${ws}D\\(int, D const ?&\\);${ws}D\\(int\\);" \ - "D & operator=\\(D const ?&\\);${ws}D\\(D const ?&\\);${ws}D\\(\\);" \ + "D & operator=\\(D const ?&\\);${ws}D\\(D const ?&\\);${ws}D\\((void|)\\);" \ " ?\\*" # An instance of D * @@ -398,7 +395,7 @@ proc test_ptype_of_classes {} { "public:" "int d;" \ "" "static void s\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vd\\((void|)\\);${ws}int fd\\((void|)\\);" \ "D & operator=\\(D const ?&\\);${ws}D\\(int, D const ?&\\);${ws}D\\(int\\);" \ - "D & operator=\\(D const ?&\\);${ws}D\\(D const ?&\\);${ws}D\\(\\);" \ + "D & operator=\\(D const ?&\\);${ws}D\\(D const ?&\\);${ws}D\\((void|)\\);" \ " ?\\*" # An instance of V * @@ -464,7 +461,7 @@ proc test_ptype_of_classes {} { "public:" "int e;" \ "" "virtual int f\\((void|)\\);${ws}virtual int vg\\((void|)\\);${ws}virtual int vv\\((void|)\\);" \ "E & operator=\\(E const ?&\\);${ws}E\\(int, E const ?&\\);${ws}E\\(int\\);" \ - "E & operator=\\(E const ?&\\);${ws}E\\(E const ?&\\);${ws}E\\(\\);" \ + "E & operator=\\(E const ?&\\);${ws}E\\(E const ?&\\);${ws}E\\((void|)\\);" \ " ?\\*" # An instance of VB * diff --git a/gdb/testsuite/gdb.mi/mi-stack.exp b/gdb/testsuite/gdb.mi/mi-stack.exp index b805234a..966a86d 100644 --- a/gdb/testsuite/gdb.mi/mi-stack.exp +++ b/gdb/testsuite/gdb.mi/mi-stack.exp @@ -1,4 +1,4 @@ -# Copyright 2000, 2002 Free Software Foundation, Inc. +# Copyright 2000, 2002, 2004 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/gdb/testsuite/gdb.mi/mi-var-child.exp b/gdb/testsuite/gdb.mi/mi-var-child.exp index 3ba24b1..74a5894 100644 --- a/gdb/testsuite/gdb.mi/mi-var-child.exp +++ b/gdb/testsuite/gdb.mi/mi-var-child.exp @@ -1,4 +1,4 @@ -# Copyright (C) 1999, 2000, 2002 Free Software Foundation +# Copyright (C) 1999, 2000, 2002, 2004 Free Software Foundation # 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 @@ -827,16 +827,15 @@ mi_gdb_test "-var-update *" \ set line 208 mi_execute_to "exec-step 7" "end-stepping-range" do_children_tests {} {.*var-cmd.c} $line {} "step $line" -mi_gdb_test "-var-list-children --all-values struct_declarations.long_array" \ - "\\^done,numchild=\"10\",children=\\\[child=\{name=\"struct_declarations.long_array.0\",exp=\"0\",numchild=\"0\",value=\"1234\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.1\",exp=\"1\",numchild=\"0\",value=\"2345\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.2\",exp=\"2\",numchild=\"0\",value=\"3456\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.3\",exp=\"3\",numchild=\"0\",value=\"4567\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.4\",exp=\"4\",numchild=\"0\",value=\"5678\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.5\",exp=\"5\",numchild=\"0\",value=\"6789\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.6\",exp=\"6\",numchild=\"0\",value=\"7890\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.7\",exp=\"7\",numchild=\"0\",value=\"8901\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.8\",exp=\"8\",numchild=\"0\",value=\"9012\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.9\",exp=\"9\",numchild=\"0\",value=\"1234\",type=\"long int\"\}\\\]" \ - "listing of names and values of children" - # Test: c_variable-5.8 # Desc: check that long_array[3-9] changed mi_gdb_test "-var-update *" \ "\\^done,changelist=\\\[\{name=\"struct_declarations.long_array.3\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"struct_declarations.long_array.4\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"struct_declarations.long_array.5\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"struct_declarations.long_array.6\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"struct_declarations.long_array.7\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"struct_declarations.long_array.8\",in_scope=\"true\",type_changed=\"false\"\},\{name=\"struct_declarations.long_array.9\",in_scope=\"true\",type_changed=\"false\"\}\\\]" \ "update all vars struct_declarations.long_array.3-9 changed" +mi_gdb_test "-var-list-children --all-values struct_declarations.long_array" \ + "\\^done,numchild=\"10\",children=\\\[child=\{name=\"struct_declarations.long_array.0\",exp=\"0\",numchild=\"0\",value=\"1234\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.1\",exp=\"1\",numchild=\"0\",value=\"2345\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.2\",exp=\"2\",numchild=\"0\",value=\"3456\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.3\",exp=\"3\",numchild=\"0\",value=\"4567\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.4\",exp=\"4\",numchild=\"0\",value=\"5678\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.5\",exp=\"5\",numchild=\"0\",value=\"6789\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.6\",exp=\"6\",numchild=\"0\",value=\"7890\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.7\",exp=\"7\",numchild=\"0\",value=\"8901\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.8\",exp=\"8\",numchild=\"0\",value=\"9012\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.9\",exp=\"9\",numchild=\"0\",value=\"1234\",type=\"long int\"\}\\\]" \ + "listing of names and values of children" # Step over "weird->func_ptr = nothing;" set line 211 diff --git a/gdb/testsuite/gdb.mi/mi1-basics.exp b/gdb/testsuite/gdb.mi/mi1-basics.exp deleted file mode 100644 index 42d022d..0000000 --- a/gdb/testsuite/gdb.mi/mi1-basics.exp +++ /dev/null @@ -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 diff --git a/gdb/testsuite/gdb.mi/mi1-break.exp b/gdb/testsuite/gdb.mi/mi1-break.exp deleted file mode 100644 index 34a6ef7..0000000 --- a/gdb/testsuite/gdb.mi/mi1-break.exp +++ /dev/null @@ -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 diff --git a/gdb/testsuite/gdb.mi/mi1-console.exp b/gdb/testsuite/gdb.mi/mi1-console.exp deleted file mode 100644 index ab7f5ac..0000000 --- a/gdb/testsuite/gdb.mi/mi1-console.exp +++ /dev/null @@ -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 diff --git a/gdb/testsuite/gdb.mi/mi1-disassemble.exp b/gdb/testsuite/gdb.mi/mi1-disassemble.exp deleted file mode 100644 index 7292a35..0000000 --- a/gdb/testsuite/gdb.mi/mi1-disassemble.exp +++ /dev/null @@ -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 diff --git a/gdb/testsuite/gdb.mi/mi1-eval.exp b/gdb/testsuite/gdb.mi/mi1-eval.exp deleted file mode 100644 index 330e00d..0000000 --- a/gdb/testsuite/gdb.mi/mi1-eval.exp +++ /dev/null @@ -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 diff --git a/gdb/testsuite/gdb.mi/mi1-hack-cli.exp b/gdb/testsuite/gdb.mi/mi1-hack-cli.exp deleted file mode 100644 index 951981a..0000000 --- a/gdb/testsuite/gdb.mi/mi1-hack-cli.exp +++ /dev/null @@ -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 diff --git a/gdb/testsuite/gdb.mi/mi1-pthreads.exp b/gdb/testsuite/gdb.mi/mi1-pthreads.exp deleted file mode 100644 index df841b2..0000000 --- a/gdb/testsuite/gdb.mi/mi1-pthreads.exp +++ /dev/null @@ -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 - diff --git a/gdb/testsuite/gdb.mi/mi1-read-memory.exp b/gdb/testsuite/gdb.mi/mi1-read-memory.exp deleted file mode 100644 index 9a0acf4..0000000 --- a/gdb/testsuite/gdb.mi/mi1-read-memory.exp +++ /dev/null @@ -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 diff --git a/gdb/testsuite/gdb.mi/mi1-regs.exp b/gdb/testsuite/gdb.mi/mi1-regs.exp deleted file mode 100644 index bf59907..0000000 --- a/gdb/testsuite/gdb.mi/mi1-regs.exp +++ /dev/null @@ -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 diff --git a/gdb/testsuite/gdb.mi/mi1-return.exp b/gdb/testsuite/gdb.mi/mi1-return.exp deleted file mode 100644 index 539a61c..0000000 --- a/gdb/testsuite/gdb.mi/mi1-return.exp +++ /dev/null @@ -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 diff --git a/gdb/testsuite/gdb.mi/mi1-simplerun.exp b/gdb/testsuite/gdb.mi/mi1-simplerun.exp deleted file mode 100644 index 839903a..0000000 --- a/gdb/testsuite/gdb.mi/mi1-simplerun.exp +++ /dev/null @@ -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 diff --git a/gdb/testsuite/gdb.mi/mi1-stack.exp b/gdb/testsuite/gdb.mi/mi1-stack.exp deleted file mode 100644 index b8c7cab..0000000 --- a/gdb/testsuite/gdb.mi/mi1-stack.exp +++ /dev/null @@ -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 diff --git a/gdb/testsuite/gdb.mi/mi1-stepi.exp b/gdb/testsuite/gdb.mi/mi1-stepi.exp deleted file mode 100644 index a706637..0000000 --- a/gdb/testsuite/gdb.mi/mi1-stepi.exp +++ /dev/null @@ -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 diff --git a/gdb/testsuite/gdb.mi/mi1-until.exp b/gdb/testsuite/gdb.mi/mi1-until.exp deleted file mode 100644 index a036b93..0000000 --- a/gdb/testsuite/gdb.mi/mi1-until.exp +++ /dev/null @@ -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 diff --git a/gdb/testsuite/gdb.mi/mi1-var-block.exp b/gdb/testsuite/gdb.mi/mi1-var-block.exp deleted file mode 100644 index 0ff9356..0000000 --- a/gdb/testsuite/gdb.mi/mi1-var-block.exp +++ /dev/null @@ -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 diff --git a/gdb/testsuite/gdb.mi/mi1-var-child.exp b/gdb/testsuite/gdb.mi/mi1-var-child.exp deleted file mode 100644 index 92ae381..0000000 --- a/gdb/testsuite/gdb.mi/mi1-var-child.exp +++ /dev/null @@ -1,1203 +0,0 @@ -# Copyright (C) 1999, 2000, 2002 Free Software Foundation - -# 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_children_tests - -##### ##### -# # -# children tests # -# # -##### ##### - - -# Test: c_variable-4.2 -# Desc: create variable "struct_declarations" -mi_gdb_test "-var-create struct_declarations * struct_declarations" \ - "\\^done,name=\"struct_declarations\",numchild=\"11\",type=\"struct _struct_decl\"" \ - "create local variable struct_declarations" - -# Test: c_variable-4.3 -# Desc: children of struct_declarations -# STABS doesn't give us argument types for the func ptr structs, but -# Dwarf 2 does. -mi_gdb_test "-var-list-children struct_declarations" \ - "\\^done,numchild=\"11\",children=\{child=\{name=\"struct_declarations.integer\",exp=\"integer\",numchild=\"0\",type=\"int\"\},child=\{name=\"struct_declarations.character\",exp=\"character\",numchild=\"0\",type=\"char\"\},child={name=\"struct_declarations.char_ptr\",exp=\"char_ptr\",numchild=\"1\",type=\"char \\*\"\},child=\{name=\"struct_declarations.long_int\",exp=\"long_int\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.int_ptr_ptr\",exp=\"int_ptr_ptr\",numchild=\"1\",type=\"int \\*\\*\"\},child=\{name=\"struct_declarations.long_array\",exp=\"long_array\",numchild=\"10\",type=\"long int \\\[10\\\]\"\},child=\{name=\"struct_declarations.func_ptr\",exp=\"func_ptr\",numchild=\"0\",type=\"void \\(\\*\\)\\((void)?\\)\"\},child=\{name=\"struct_declarations.func_ptr_struct\",exp=\"func_ptr_struct\",numchild=\"0\",type=\"struct _struct_decl \\(\\*\\)\\((int, char \\*, long int)?\\)\"\},child=\{name=\"struct_declarations.func_ptr_ptr\",exp=\"func_ptr_ptr\",numchild=\"0\",type=\"struct _struct_decl \\*\\(\\*\\)\\((int, char \\*, long int)?\\)\"\},child=\{name=\"struct_declarations.u1\",exp=\"u1\",numchild=\"4\",type=\"union \{\\.\\.\\.\}\"\},child=\{name=\"struct_declarations.s2\",exp=\"s2\",numchild=\"4\",type=\"struct \{\\.\\.\\.\}\"\}\}" \ - "get children of struct_declarations" - -#gdbtk_test c_variable-4.3 {children of struct_declarations} { -# get_children struct_declarations -#} {integer character char_ptr long_int int_ptr_ptr long_array func_ptr func_ptr_struct func_ptr_ptr u1 s2} - -# Test: c_variable-4.4 -# Desc: number of children of struct_declarations -mi_gdb_test "-var-info-num-children struct_declarations" \ - "\\^done,numchild=\"11\"" \ - "get number of children of struct_declarations" - -# Test: c_variable-4.5 -# Desc: children of struct_declarations.integer -mi_gdb_test "-var-list-children struct_declarations.integer" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.integer" - -# Test: c_variable-4.6 -# Desc: number of children of struct_declarations.integer -mi_gdb_test "-var-info-num-children struct_declarations.integer" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.integer" - -# Test: c_variable-4.7 -# Desc: children of struct_declarations.character -mi_gdb_test "-var-list-children struct_declarations.character" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.character" - -# Test: c_variable-4.8 -# Desc: number of children of struct_declarations.character -mi_gdb_test "-var-info-num-children struct_declarations.character" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.character" - -# Test: c_variable-4.9 -# Desc: children of struct_declarations.char_ptr -mi_gdb_test "-var-list-children struct_declarations.char_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"struct_declarations.char_ptr.\\*char_ptr\",exp=\"\\*char_ptr\",numchild=\"0\",type=\"char\"\}\}" \ - "get children of struct_declarations.char_ptr" - -# Test: c_variable-4.10 -# Desc: number of children of struct_declarations.char_ptr -mi_gdb_test "-var-info-num-children struct_declarations.char_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of struct_declarations.char_ptr" - -# Test: c_variable-4.11 -# Desc: children of struct_declarations.long_int -mi_gdb_test "-var-list-children struct_declarations.long_int" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.long_int" - -# Test: c_variable-4.12 -# Desc: number of children of struct_declarations.long_int -mi_gdb_test "-var-info-num-children struct_declarations.long_int" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.long_int" - -# Test: c_variable-4.13 -# Desc: children of int_ptr_ptr -mi_gdb_test "-var-list-children struct_declarations.int_ptr_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"struct_declarations.int_ptr_ptr.\\*int_ptr_ptr\",exp=\"\\*int_ptr_ptr\",numchild=\"1\",type=\"int \\*\"\}\}" \ - "get children of struct_declarations.int_ptr_ptr" - -#gdbtk_test c_variable-4.13 {children of int_ptr_ptr} { -# get_children struct_declarations.int_ptr_ptr -#} {*int_ptr_ptr} - -# Test: c_variable-4.14 -# Desc: number of children of int_ptr_ptr -mi_gdb_test "-var-info-num-children struct_declarations.int_ptr_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of struct_declarations.int_ptr_ptr" - - -# Test: c_variable-4.15 -# Desc: children of struct_declarations.long_array -mi_gdb_test "-var-list-children struct_declarations.long_array" \ - "\\^done,numchild=\"10\",children=\{child=\{name=\"struct_declarations.long_array.0\",exp=\"0\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.1\",exp=\"1\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.2\",exp=\"2\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.3\",exp=\"3\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.4\",exp=\"4\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.5\",exp=\"5\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.6\",exp=\"6\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.7\",exp=\"7\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.8\",exp=\"8\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.long_array.9\",exp=\"9\",numchild=\"0\",type=\"long int\"\}\}" \ - "get children of struct_declarations.long_array" - -# Test: c_variable-4.16 -# Desc: number of children of struct_declarations.long_array -mi_gdb_test "-var-info-num-children struct_declarations.long_array" \ - "\\^done,numchild=\"10\"" \ - "get number of children of struct_declarations.long_array" - -# Test: c_variable-4.17 -# Desc: children of struct_declarations.func_ptr -mi_gdb_test "-var-list-children struct_declarations.func_ptr" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.func_ptr" - - -# Test: c_variable-4.18 -# Desc: number of children of struct_declarations.func_ptr -mi_gdb_test "-var-info-num-children struct_declarations.func_ptr" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.func_ptr" - - -# Test: c_variable-4.19 -# Desc: children of struct_declarations.func_ptr_struct -mi_gdb_test "-var-list-children struct_declarations.func_ptr_struct" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.func_ptr_struct" - -# Test: c_variable-4.20 -# Desc: number of children of struct_declarations.func_ptr_struct -mi_gdb_test "-var-info-num-children struct_declarations.func_ptr_struct" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.func_ptr_struct" - - -# Test: c_variable-4.21 -# Desc: children of struct_declarations.func_ptr_ptr -mi_gdb_test "-var-list-children struct_declarations.func_ptr_ptr" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.func_ptr_ptr" - -# Test: c_variable-4.22 -# Desc: number of children of struct_declarations.func_ptr_ptr -mi_gdb_test "-var-info-num-children struct_declarations.func_ptr_ptr" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.func_ptr_ptr" - - -# Test: c_variable-4.23 -# Desc: children of struct_declarations.u1 -mi_gdb_test "-var-list-children struct_declarations.u1" \ - "\\^done,numchild=\"4\",children=\{child=\{name=\"struct_declarations.u1.a\",exp=\"a\",numchild=\"0\",type=\"int\"\},child=\{name=\"struct_declarations.u1.b\",exp=\"b\",numchild=\"1\",type=\"char \\*\"\},child=\{name=\"struct_declarations.u1.c\",exp=\"c\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.u1.d\",exp=\"d\",numchild=\"0\",type=\"enum foo\"\}\}" \ - "get children of struct_declarations.u1" - -# Test: c_variable-4.24 -# Desc: number of children of struct_declarations.u1 -mi_gdb_test "-var-info-num-children struct_declarations.u1" \ - "\\^done,numchild=\"4\"" \ - "get number of children of struct_declarations.u1" - -# Test: c_variable-4.25 -# Desc: children of struct_declarations.s2 -mi_gdb_test "-var-list-children struct_declarations.s2" \ - "\\^done,numchild=\"4\",children=\{child=\{name=\"struct_declarations.s2.u2\",exp=\"u2\",numchild=\"3\",type=\"union \{\\.\\.\\.\}\"\},child=\{name=\"struct_declarations.s2.g\",exp=\"g\",numchild=\"0\",type=\"int\"\},child=\{name=\"struct_declarations.s2.h\",exp=\"h\",numchild=\"0\",type=\"char\"\},child=\{name=\"struct_declarations.s2.i\",exp=\"i\",numchild=\"10\",type=\"long int \\\[10\\\]\"\}\}" \ - "get children of struct_declarations.s2" -#gdbtk_test c_variable-4.25 {children of struct_declarations.s2} { -# get_children struct_declarations.s2 -#} {u2 g h i} - -# Test: c_variable-4.26 -# Desc: number of children of struct_declarations.s2 -mi_gdb_test "-var-info-num-children struct_declarations.s2" \ - "\\^done,numchild=\"4\"" \ - "get number of children of struct_declarations.s2" - - -# Test: c_variable-4.27 -# Desc: children of struct_declarations.long_array.1 -mi_gdb_test "-var-list-children struct_declarations.long_array.1" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.long_array.1" - -# Test: c_variable-4.28 -# Desc: number of children of struct_declarations.long_array.1 -mi_gdb_test "-var-info-num-children struct_declarations.long_array.1" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.long_array.1" - -# Test: c_variable-4.29 -# Desc: children of struct_declarations.long_array.2 -mi_gdb_test "-var-list-children struct_declarations.long_array.2" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.long_array.2" - -# Test: c_variable-4.30 -# Desc: number of children of struct_declarations.long_array.2 -mi_gdb_test "-var-info-num-children struct_declarations.long_array.2" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.long_array.2" - -# Test: c_variable-4.31 -# Desc: children of struct_declarations.long_array.3 -mi_gdb_test "-var-list-children struct_declarations.long_array.3" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.long_array.3" - -# Test: c_variable-4.32 -# Desc: number of children of struct_declarations.long_array.3 -mi_gdb_test "-var-info-num-children struct_declarations.long_array.3" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.long_array.3" - -# Test: c_variable-4.33 -# Desc: children of struct_declarations.long_array.4 -mi_gdb_test "-var-list-children struct_declarations.long_array.4" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.long_array.4" - -# Test: c_variable-4.34 -# Desc: number of children of struct_declarations.long_array.4 -mi_gdb_test "-var-info-num-children struct_declarations.long_array.4" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.long_array.4" - -# Test: c_variable-4.35 -# Desc: children of struct_declarations.long_array.5 -mi_gdb_test "-var-list-children struct_declarations.long_array.5" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.long_array.5" - -# Test: c_variable-4.36 -# Desc: number of children of struct_declarations.long_array.5 -mi_gdb_test "-var-info-num-children struct_declarations.long_array.5" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.long_array.5" - -# Test: c_variable-4.37 -# Desc: children of struct_declarations.long_array.6 -mi_gdb_test "-var-list-children struct_declarations.long_array.6" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.long_array.6" - -# Test: c_variable-4.38 -# Desc: number of children of struct_declarations.long_array.6 -mi_gdb_test "-var-info-num-children struct_declarations.long_array.6" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.long_array.6" - -# Test: c_variable-4.39 -# Desc: children of struct_declarations.long_array.7 -mi_gdb_test "-var-list-children struct_declarations.long_array.7" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.long_array.7" - -# Test: c_variable-4.40 -# Desc: number of children of struct_declarations.long_array.7 -mi_gdb_test "-var-info-num-children struct_declarations.long_array.7" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.long_array.7" - -# Test: c_variable-4.41 -# Desc: children of struct_declarations.long_array.8 -mi_gdb_test "-var-list-children struct_declarations.long_array.8" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.long_array.8" - -# Test: c_variable-4.42 -# Desc: number of children of struct_declarations.long_array.8 -mi_gdb_test "-var-info-num-children struct_declarations.long_array.8" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.long_array.8" - - -# Test: c_variable-4.43 -# Desc: children of struct_declarations.long_array.9 -mi_gdb_test "-var-list-children struct_declarations.long_array.9" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.long_array.9" - -# Test: c_variable-4.44 -# Desc: number of children of struct_declarations.long_array.9 -mi_gdb_test "-var-info-num-children struct_declarations.long_array.9" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.long_array.9" - -# Test: c_variable-4.45 -# Desc: children of struct_declarations.u1.a -mi_gdb_test "-var-list-children struct_declarations.u1.a" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.u1.a" - -# Test: c_variable-4.46 -# Desc: number of children of struct_declarations.u1.a -mi_gdb_test "-var-info-num-children struct_declarations.u1.a" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.u1.a" - -# Test: c_variable-4.47 -# Desc: children of struct_declarations.u1.b -mi_gdb_test "-var-list-children struct_declarations.u1.b" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"struct_declarations.u1.b.\\*b\",exp=\"\\*b\",numchild=\"0\",type=\"char\"\}\}" \ - "get children of struct_declarations.u1.b" - -# Test: c_variable-4.48 -# Desc: number of children of struct_declarations.u1.b -mi_gdb_test "-var-info-num-children struct_declarations.u1.b" \ - "\\^done,numchild=\"1\"" \ - "get number of children of struct_declarations.u1.b" - -# Test: c_variable-4.49 -# Desc: children of struct_declarations.u1.c -mi_gdb_test "-var-list-children struct_declarations.u1.c" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.u1.c" - -# Test: c_variable-4.50 -# Desc: number of children of struct_declarations.u1.c -mi_gdb_test "-var-info-num-children struct_declarations.u1.c" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.u1.c" - -# Test: c_variable-4.51 -# Desc: children of struct_declarations.u1.d -mi_gdb_test "-var-list-children struct_declarations.u1.d" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.u1.d" - - -# Test: c_variable-4.52 -# Desc: number of children of struct_declarations.u1.d -mi_gdb_test "-var-info-num-children struct_declarations.u1.d" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.u1.d" - - -# Test: c_variable-4.53 -# Desc: children of struct_declarations.s2.u2 -mi_gdb_test "-var-list-children struct_declarations.s2.u2" \ - "\\^done,numchild=\"3\",children=\{child=\{name=\"struct_declarations.s2.u2.u1s1\",exp=\"u1s1\",numchild=\"4\",type=\"struct \{\\.\\.\\.\}\"\},child=\{name=\"struct_declarations.s2.u2.f\",exp=\"f\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.s2.u2.u1s2\",exp=\"u1s2\",numchild=\"2\",type=\"struct \{\\.\\.\\.\}\"\}\}" \ - "get children of struct_declarations.s2.u2" - -# Test: c_variable-4.54 -# Desc: number of children of struct_declarations.s2.u2 -mi_gdb_test "-var-info-num-children struct_declarations.s2.u2" \ - "\\^done,numchild=\"3\"" \ - "get number of children of struct_declarations.s2.u2" - -# Test: c_variable-4.55 -# Desc: children of struct_declarations.s2.g -mi_gdb_test "-var-list-children struct_declarations.s2.g" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.s2.g" - -# Test: c_variable-4.56 -# Desc: number of children of struct_declarations.s2.g -mi_gdb_test "-var-info-num-children struct_declarations.s2.g" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.s2.g" - - -# Test: c_variable-4.57 -# Desc: children of struct_declarations.s2.h -mi_gdb_test "-var-list-children struct_declarations.s2.h" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.s2.h" - -# Test: c_variable-4.58 -# Desc: number of children of struct_declarations.s2.h -mi_gdb_test "-var-info-num-children struct_declarations.s2.h" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.s2.h" - - -# Test: c_variable-4.59 -# Desc: children of struct_declarations.s2.i -mi_gdb_test "-var-list-children struct_declarations.s2.i" \ - "\\^done,numchild=\"10\",children=\{child=\{name=\"struct_declarations.s2.i.0\",exp=\"0\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.s2.i.1\",exp=\"1\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.s2.i.2\",exp=\"2\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.s2.i.3\",exp=\"3\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.s2.i.4\",exp=\"4\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.s2.i.5\",exp=\"5\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.s2.i.6\",exp=\"6\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.s2.i.7\",exp=\"7\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.s2.i.8\",exp=\"8\",numchild=\"0\",type=\"long int\"\},child=\{name=\"struct_declarations.s2.i.9\",exp=\"9\",numchild=\"0\",type=\"long int\"\}\}" \ - "get children of struct_declarations.s2.i" - -# Test: c_variable-4.60 -# Desc: number of children of struct_declarations.s2.i -mi_gdb_test "-var-info-num-children struct_declarations.s2.i" \ - "\\^done,numchild=\"10\"" \ - "get number of children of struct_declarations.s2.i" - -# Test: c_variable-4.61 -# Desc: children of struct_declarations.s2.u2.u1s1 -mi_gdb_test "-var-list-children struct_declarations.s2.u2.u1s1" \ - "\\^done,numchild=\"4\",children=\{child=\{name=\"struct_declarations.s2.u2.u1s1.d\",exp=\"d\",numchild=\"0\",type=\"int\"\},child=\{name=\"struct_declarations.s2.u2.u1s1.e\",exp=\"e\",numchild=\"10\",type=\"char \\\[10\\\]\"\},child=\{name=\"struct_declarations.s2.u2.u1s1.func\",exp=\"func\",numchild=\"0\",type=\"int \\*\\(\\*\\)\\((void)?\\)\"\},child=\{name=\"struct_declarations.s2.u2.u1s1.foo\",exp=\"foo\",numchild=\"0\",type=\"efoo\"\}\}" \ - "get children of struct_declarations.s2.u2.u1s1" - -# Test: c_variable-4.62 -# Desc: number of children of struct_declarations.s2.u2.u1s1 -mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.u1s1" \ - "\\^done,numchild=\"4\"" \ - "get number of children of struct_declarations.s2.u2.u1s1" - -# Test: c_variable-4.63 -# Desc: children of struct_declarations.s2.u2.f -mi_gdb_test "-var-list-children struct_declarations.s2.u2.f" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.s2.u2.f" - -# Test: c_variable-4.64 -# Desc: number of children of struct_declarations.s2.u2.f -mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.f" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.s2.u2.f" - -# Test: c_variable-4.65 -# Desc: children of struct_declarations.s2.u2.u1s2 -mi_gdb_test "-var-list-children struct_declarations.s2.u2.u1s2" \ - "\\^done,numchild=\"2\",children=\{child=\{name=\"struct_declarations.s2.u2.u1s2.array_ptr\",exp=\"array_ptr\",numchild=\"2\",type=\"char \\\[2\\\]\"\},child=\{name=\"struct_declarations.s2.u2.u1s2.func\",exp=\"func\",numchild=\"0\",type=\"int \\(\\*\\)\\((int, char \\*)?\\)\"\}\}" \ - "get children of struct_declarations.s2.u2.u1s2" - -# Test: c_variable-4.66 -# Desc: number of children of struct_declarations.s2.u2.u1s2 -mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.u1s2" \ - "\\^done,numchild=\"2\"" \ - "get number of children of struct_declarations.s2.u2.u1s2" - -# Test: c_variable-4.67 -# Desc: children of struct_declarations.s2.u2.u1s1.d -mi_gdb_test "-var-list-children struct_declarations.s2.u2.u1s1.d" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.s2.u2.u1s1.d" - -# Test: c_variable-4.68 -# Desc: number of children of struct_declarations.s2.u2.u1s1.d -mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.u1s1.d" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.s2.u2.u1s1.d" - -# Test: c_variable-4.69 -# Desc: children of struct_declarations.s2.u2.u1s1.e -mi_gdb_test "-var-list-children struct_declarations.s2.u2.u1s1.e" \ - "\\^done,numchild=\"10\",children=\{child=\{name=\"struct_declarations.s2.u2.u1s1.e.0\",exp=\"0\",numchild=\"0\",type=\"char\"\},child=\{name=\"struct_declarations.s2.u2.u1s1.e.1\",exp=\"1\",numchild=\"0\",type=\"char\"\},child=\{name=\"struct_declarations.s2.u2.u1s1.e.2\",exp=\"2\",numchild=\"0\",type=\"char\"\},child={name=\"struct_declarations.s2.u2.u1s1.e.3\",exp=\"3\",numchild=\"0\",type=\"char\"\},child=\{name=\"struct_declarations.s2.u2.u1s1.e.4\",exp=\"4\",numchild=\"0\",type=\"char\"\},child=\{name=\"struct_declarations.s2.u2.u1s1.e.5\",exp=\"5\",numchild=\"0\",type=\"char\"\},child=\{name=\"struct_declarations.s2.u2.u1s1.e.6\",exp=\"6\",numchild=\"0\",type=\"char\"\},child=\{name=\"struct_declarations.s2.u2.u1s1.e.7\",exp=\"7\",numchild=\"0\",type=\"char\"\},child=\{name=\"struct_declarations.s2.u2.u1s1.e.8\",exp=\"8\",numchild=\"0\",type=\"char\"\},child=\{name=\"struct_declarations.s2.u2.u1s1.e.9\",exp=\"9\",numchild=\"0\",type=\"char\"\}\}" \ - "get children of struct_declarations.s2.u2.u1s1.e" - -# Test: c_variable-4.70 -# Desc: number of children of struct_declarations.s2.u2.u1s1.e -mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.u1s1.e" \ - "\\^done,numchild=\"10\"" \ - "get number of children of struct_declarations.s2.u2.u1s1.e" - - -# Test: c_variable-4.71 -# Desc: children of struct_declarations.s2.u2.u1s1.func -mi_gdb_test "-var-list-children struct_declarations.s2.u2.u1s1.func" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.s2.u2.u1s1.func" - -# Test: c_variable-4.72 -# Desc: number of children of struct_declarations.s2.u2.u1s1.func -mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.u1s1.func" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.s2.u2.u1s1.func" - - -# Test: c_variable-4.73 -# Desc: children of struct_declarations.s2.u2.u1s1.foo -mi_gdb_test "-var-list-children struct_declarations.s2.u2.u1s1.foo" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.s2.u2.u1s1.foo" - -# Test: c_variable-4.74 -# Desc: number of children of struct_declarations.s2.u2.u1s1.foo -mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.u1s1.foo" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.s2.u2.u1s1.foo" - - -# Test: c_variable-4.75 -# Desc: children of struct_declarations.s2.u2.u1s2.array_ptr -mi_gdb_test "-var-list-children struct_declarations.s2.u2.u1s2.array_ptr" \ - "\\^done,numchild=\"2\",children=\{child=\{name=\"struct_declarations.s2.u2.u1s2.array_ptr.0\",exp=\"0\",numchild=\"0\",type=\"char\"\},child={name=\"struct_declarations.s2.u2.u1s2.array_ptr.1\",exp=\"1\",numchild=\"0\",type=\"char\"\}\}" \ - "get children of struct_declarations.s2.u2.u1s2.array_ptr" - -# Test: c_variable-4.76 -# Desc: number of children of struct_declarations.s2.u2.u1s2.array_ptr -mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.u1s2.array_ptr" \ - "\\^done,numchild=\"2\"" \ - "get number of children of struct_declarations.s2.u2.u1s2.array_ptr" - -# Test: c_variable-4.77 -# Desc: children of struct_declarations.s2.u2.u1s2.func -mi_gdb_test "-var-list-children struct_declarations.s2.u2.u1s2.func" \ - "\\^done,numchild=\"0\"" \ - "get children of struct_declarations.s2.u2.u1s2.func" - -# Test: c_variable-4.78 -# Desc: number of children of struct_declarations.s2.u2.u1s2.func -mi_gdb_test "-var-info-num-children struct_declarations.s2.u2.u1s2.func" \ - "\\^done,numchild=\"0\"" \ - "get number of children of struct_declarations.s2.u2.u1s2.func" - -# Test: c_variable-4.79 -# Desc: children of struct_declarations.int_ptr_ptr.*int_ptr_ptr -mi_gdb_test "-var-list-children struct_declarations.int_ptr_ptr.*int_ptr_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"struct_declarations.int_ptr_ptr.\\*int_ptr_ptr.\\*\\*int_ptr_ptr\",exp=\"\\*\\*int_ptr_ptr\",numchild=\"0\",type=\"int\"\}\}" \ - "get children of struct_declarations.int_ptr_ptr.*int_ptr_ptr" -#} {**int_ptr_ptr} - -# Test: c_variable-4.80 -# Desc: Number of children of struct_declarations.int_ptr_ptr.*int_ptr_ptr -mi_gdb_test "-var-info-num-children struct_declarations.int_ptr_ptr.*int_ptr_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of struct_declarations.int_ptr_ptr.*int_ptr_ptr" - - -# Step to "struct_declarations.integer = 123;" -set line 192 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step to line $line" - -# Test: c_variable-4.81 -# Desc: create local variable "weird" -mi_gdb_test "-var-create weird * weird" \ - "\\^done,name=\"weird\",numchild=\"11\",type=\"weird_struct \\*\"" \ - "create local variable weird" - -# Test: c_variable-4.82 -# Desc: children of 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 of weird" - -# Test: c_variable-4.83 -# Desc: number of children of weird -mi_gdb_test "-var-info-num-children weird" \ - "\\^done,numchild=\"11\"" \ - "get number of children of weird" - - -# Test: c_variable-4.84 -# Desc: children of weird->long_array -mi_gdb_test "-var-list-children weird.long_array" \ - "\\^done,numchild=\"10\",children=\{child=\{name=\"weird.long_array.0\",exp=\"0\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.1\",exp=\"1\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.2\",exp=\"2\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.3\",exp=\"3\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.4\",exp=\"4\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.5\",exp=\"5\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.6\",exp=\"6\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.7\",exp=\"7\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.8\",exp=\"8\",numchild=\"0\",type=\"long int\"\},child=\{name=\"weird.long_array.9\",exp=\"9\",numchild=\"0\",type=\"long int\"\}\}" \ - "get children of weird.long_array" -#gdbtk_test c_variable-4.84 {children of weird->long_array} { -# get_children weird.long_array -#} {0 1 2 3 4 5 6 7 8 9} - -# Test: c_variable-4.85 -# Desc: number of children of weird.long_array -mi_gdb_test "-var-info-num-children weird.long_array" \ - "\\^done,numchild=\"10\"" \ - "get number of children of weird.long_array" - -# Test: c_variable-4.86 -# Desc: children of weird.int_ptr_ptr -mi_gdb_test "-var-list-children weird.int_ptr_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"weird.int_ptr_ptr.\\*int_ptr_ptr\",exp=\"\\*int_ptr_ptr\",numchild=\"1\",type=\"int \\*\"\}\}" \ - "get children of weird.int_ptr_ptr" -#gdbtk_test c_variable-4.86 {children of weird->int_ptr_ptr} { -# get_children weird.int_ptr_ptr -#} {*int_ptr_ptr} - -# Test: c_variable-4.87 -# Desc: number of children of weird.int_ptr_ptr -mi_gdb_test "-var-info-num-children weird.int_ptr_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of weird.int_ptr_ptr" - -# Test: c_variable-4.88 -# Desc: children of *weird->int_ptr_ptr -mi_gdb_test "-var-list-children weird.int_ptr_ptr.*int_ptr_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"weird.int_ptr_ptr.\\*int_ptr_ptr.\\*\\*int_ptr_ptr\",exp=\"\\*\\*int_ptr_ptr\",numchild=\"0\",type=\"int\"\}\}" \ - "get children of weird.int_ptr_ptr.*int_ptr_ptr" -#gdbtk_test c_variable-4.88 {children of *weird->int_ptr_ptr} { -# get_children weird.int_ptr_ptr.*int_ptr_ptr -#} {**int_ptr_ptr} - -# Test: c_variable-4.89 -# Desc: number of children *weird->int_ptr_ptr -mi_gdb_test "-var-info-num-children weird.int_ptr_ptr.*int_ptr_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of weird.int_ptr_ptr.*int_ptr_ptr" - -# Test: c_variable-4.90 -# Desc: create weird->int_ptr_ptr -mi_gdb_test "-var-create weird->int_ptr_ptr * weird->int_ptr_ptr" \ - "\\^done,name=\"weird->int_ptr_ptr\",numchild=\"1\",type=\"int \\*\\*\"" \ - "create local variable weird->int_ptr_ptr" - -# Test: c_variable-4.91 -# Desc: children of weird->int_ptr_ptr -mi_gdb_test "-var-list-children weird->int_ptr_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"weird->int_ptr_ptr.\\*weird->int_ptr_ptr\",exp=\"\\*weird->int_ptr_ptr\",numchild=\"1\",type=\"int \\*\"\}\}" \ - "get children of weird->int_ptr_ptr" - - -# Test: c_variable-4.92 -# Desc: number of children of (weird->int_ptr_ptr) -mi_gdb_test "-var-info-num-children weird->int_ptr_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of weird->int_ptr_ptr" - -# Test: c_variable-4.93 -# Desc: children of *(weird->int_ptr_ptr) -mi_gdb_test "-var-list-children weird->int_ptr_ptr.*weird->int_ptr_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"weird->int_ptr_ptr.\\*weird->int_ptr_ptr.\\*\\*weird->int_ptr_ptr\",exp=\"\\*\\*weird->int_ptr_ptr\",numchild=\"0\",type=\"int\"\}\}" \ - "get children of weird->int_ptr_ptr.*weird->int_ptr_ptr" - -# Test: c_variable-4.94 -# Desc: number of children of *(weird->int_ptr_ptr) -mi_gdb_test "-var-info-num-children weird->int_ptr_ptr.*weird->int_ptr_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of weird->int_ptr_ptr.*weird->int_ptr_ptr" - -# Test: c_variable-4.95 -# Desc: children of *(*(weird->int_ptr_ptr)) -mi_gdb_test "-var-list-children weird->int_ptr_ptr.*weird->int_ptr_ptr.**weird->int_ptr_ptr" \ - "\\^done,numchild=\"0\"" \ - "get children of weird->int_ptr_ptr.*weird->int_ptr_ptr.**weird->int_ptr_ptr" - -# Test: c_variable-4.96 -# Desc: number of children of *(*(weird->int_ptr_ptr)) -mi_gdb_test "-var-info-num-children weird->int_ptr_ptr.*weird->int_ptr_ptr.**weird->int_ptr_ptr" \ - "\\^done,numchild=\"0\"" \ - "get number of children of weird->int_ptr_ptr.*weird->int_ptr_ptr.**weird->int_ptr_ptr" - -# Test: c_variable-4.97 -# Desc: is weird editable -mi_gdb_test "-var-show-attributes weird" \ - "\\^done,attr=\"editable\"" \ - "is weird editable" - -# Test: c_variable-4.98 -# Desc: is weird->int_ptr_ptr editable -mi_gdb_test "-var-show-attributes weird->int_ptr_ptr" \ - "\\^done,attr=\"editable\"" \ - "is weird->int_ptr_ptr editable" - -# Test: c_variable-4.99 -# Desc: is *(weird->int_ptr_ptr) editable -mi_gdb_test "-var-show-attributes weird.int_ptr_ptr.*int_ptr_ptr" \ - "\\^done,attr=\"editable\"" \ - "is weird.int_ptr_ptr.*int_ptr_ptr editable" - -# Test: c_variable-4.100 -# Desc: is *(*(weird->int_ptr_ptr)) editable -mi_gdb_test "-var-show-attributes weird.int_ptr_ptr.*int_ptr_ptr.**int_ptr_ptr" \ - "\\^done,attr=\"editable\"" \ - "is weird.int_ptr_ptr.*int_ptr_ptr.**int_ptr_ptr editable" - -# Test: c_variable-4.101 -# Desc: is weird->u1 editable -mi_gdb_test "-var-show-attributes weird.u1" \ - "\\^done,attr=\"noneditable\"" \ - "is weird.u1 editable" - -# Test: c_variable-4.102 -# Desc: is weird->s2 editable -mi_gdb_test "-var-show-attributes weird.s2" \ - "\\^done,attr=\"noneditable\"" \ - "is weird.s2 editable" - -# Test: c_variable-4.103 -# Desc: is struct_declarations.u1.a editable -mi_gdb_test "-var-show-attributes struct_declarations.u1.a" \ - "\\^done,attr=\"editable\"" \ - "is struct_declarations.u1.a editable" - -# Test: c_variable-4.104 -# Desc: is struct_declarations.u1.b editable -mi_gdb_test "-var-show-attributes struct_declarations.u1.b" \ - "\\^done,attr=\"editable\"" \ - "is struct_declarations.u1.b editable" - -# Test: c_variable-4.105 -# Desc: is struct_declarations.u1.c editable -mi_gdb_test "-var-show-attributes struct_declarations.u1.c" \ - "\\^done,attr=\"editable\"" \ - "is struct_declarations.u1.c editable" - -# Test: c_variable-4.106 -# Desc: is struct_declarations.long_array editable -mi_gdb_test "-var-show-attributes struct_declarations.long_array" \ - "\\^done,attr=\"noneditable\"" \ - "is struct_declarations.long_array editable" - -# Test: c_variable-4.107 -# Desc: is struct_declarations.long_array[0] editable -mi_gdb_test "-var-show-attributes struct_declarations.long_array.0" \ - "\\^done,attr=\"editable\"" \ - "is struct_declarations.long_array.0 editable" - -# Test: c_variable-4.108 -# Desc: is struct_declarations editable -mi_gdb_test "-var-show-attributes struct_declarations" \ - "\\^done,attr=\"noneditable\"" \ - "is struct_declarations editable" - -mi_gdb_test "-var-delete weird" \ - "\\^done,ndeleted=\"24\"" \ - "delete var weird" - -##### ##### -# # -# children and update tests # -# # -##### ##### - -# Test: c_variable-5.1 -# Desc: check that nothing changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{\}" \ - "update all vars. None changed" - -# Step over "struct_declarations.integer = 123;" -set line 193 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" - -# Test: c_variable-5.2 -# Desc: check that integer changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"struct_declarations.integer\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars struct_declarations.integer" - -# Step over: -# weird->char_ptr = "hello"; -# bar = 2121; -# foo = &bar; -set line 196 -mi_execute_to "exec-step 3" "end-stepping-range" do_children_tests {} {.*var-cmd.c} $line {} "step $line" - -# Test: c_variable-5.3 -# Desc: check that char_ptr changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"struct_declarations.char_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"struct_declarations.char_ptr.\\*char_ptr\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars struct_declarations.char_ptr" - -# Step over "struct_declarations.int_ptr_ptr = &foo;" -set line 197 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" - -# Test: c_variable-5.4 -# Desc: check that int_ptr_ptr and children changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"weird->int_ptr_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"weird->int_ptr_ptr.\\*weird->int_ptr_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"weird->int_ptr_ptr.\\*weird->int_ptr_ptr.\\*\\*weird->int_ptr_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"struct_declarations.int_ptr_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"struct_declarations.int_ptr_ptr.\\*int_ptr_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"struct_declarations.int_ptr_ptr.\\*int_ptr_ptr.\\*\\*int_ptr_ptr\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars int_ptr_ptr and children changed" - -# Step over "weird->long_array[0] = 1234;" -set line 198 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" - -# Test: c_variable-5.5 -# Desc: check that long_array[0] changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"struct_declarations.long_array.0\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars struct_declarations.long_array.0 changed" - -# Step over "struct_declarations.long_array[1] = 2345;" -set line 199 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" - -# Test: c_variable-5.6 -# Desc: check that long_array[1] changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"struct_declarations.long_array.1\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars struct_declarations.long_array.1 changed" - -# Step over "weird->long_array[2] = 3456;" -set line 200 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" - -# Test: c_variable-5.7 -# Desc: check that long_array[2] changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"struct_declarations.long_array.2\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars struct_declarations.long_array.2 changed" - -# Step over: -# struct_declarations.long_array[3] = 4567; -# weird->long_array[4] = 5678; -# struct_declarations.long_array[5] = 6789; -# weird->long_array[6] = 7890; -# struct_declarations.long_array[7] = 8901; -# weird->long_array[8] = 9012; -# struct_declarations.long_array[9] = 1234; -set line 208 -mi_execute_to "exec-step 7" "end-stepping-range" do_children_tests {} {.*var-cmd.c} $line {} "step $line" - -# Test: c_variable-5.8 -# Desc: check that long_array[3-9] changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"struct_declarations.long_array.3\",in_scope=\"true\",type_changed=\"false\",name=\"struct_declarations.long_array.4\",in_scope=\"true\",type_changed=\"false\",name=\"struct_declarations.long_array.5\",in_scope=\"true\",type_changed=\"false\",name=\"struct_declarations.long_array.6\",in_scope=\"true\",type_changed=\"false\",name=\"struct_declarations.long_array.7\",in_scope=\"true\",type_changed=\"false\",name=\"struct_declarations.long_array.8\",in_scope=\"true\",type_changed=\"false\",name=\"struct_declarations.long_array.9\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars struct_declarations.long_array.3-9 changed" - - -# Step over "weird->func_ptr = nothing;" -set line 211 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" - -# Test: c_variable-5.9 -# Desc: check that func_ptr changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"struct_declarations.func_ptr\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars struct_declarations.func_ptr changed" - -# Delete all variables -mi_gdb_test "-var-delete struct_declarations" \ - "\\^done,ndeleted=\"65\"" \ - "delete var struct_declarations" - -mi_gdb_test "-var-delete weird->int_ptr_ptr" \ - "\\^done,ndeleted=\"3\"" \ - "delete var weird->int_ptr_ptr" - -# Step over all lines: -# ... -# psnp = &snp0; -set line 254 -mi_execute_to "exec-step 43" "end-stepping-range" do_children_tests {} {.*var-cmd.c} $line {} "step $line" - -# Test: c_variable-5.10 -# Desc: create psnp->char_ptr -mi_gdb_test "-var-create psnp->char_ptr * psnp->char_ptr" \ - "\\^done,name=\"psnp->char_ptr\",numchild=\"1\",type=\"char \\*\\*\\*\\*\"" \ - "create local variable psnp->char_ptr" - -# Test: c_variable-5.11 -# Desc: children of psnp->char_ptr -mi_gdb_test "-var-list-children psnp->char_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"psnp->char_ptr.\\*psnp->char_ptr\",exp=\"\\*psnp->char_ptr\",numchild=\"1\",type=\"char \\*\\*\\*\"\}\}" \ - "get children of psnp->char_ptr" - -# Test: c_variable-5.12 -# Desc: number of children of psnp->char_ptr -mi_gdb_test "-var-info-num-children psnp->char_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of psnp->char_ptr" - -# Test: c_variable-5.13 -# Desc: children of *(psnp->char_ptr) -mi_gdb_test "-var-list-children psnp->char_ptr.*psnp->char_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"psnp->char_ptr.\\*psnp->char_ptr.\\*\\*psnp->char_ptr\",exp=\"\\*\\*psnp->char_ptr\",numchild=\"1\",type=\"char \\*\\*\"\}\}" \ - "get children of psnp->char_ptr.*psnp->char_ptr" - -# Test: c_variable-5.14 -# Desc: number of children of *(psnp->char_ptr) -mi_gdb_test "-var-info-num-children psnp->char_ptr.*psnp->char_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of psnp->char_ptr.*psnp->char_ptr" - -# Test: c_variable-5.15 -# Desc: children of *(*(psnp->char_ptr)) -mi_gdb_test "-var-list-children psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"psnp->char_ptr.\\*psnp->char_ptr.\\*\\*psnp->char_ptr.\\*\\*\\*psnp->char_ptr\",exp=\"\\*\\*\\*psnp->char_ptr\",numchild=\"1\",type=\"char \\*\"\}\}" \ - "get children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr" - -# Test: c_variable-5.15B -# Desc: children of *(*(*(psnp->char_ptr))) -mi_gdb_test "-var-list-children psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"psnp->char_ptr.\\*psnp->char_ptr.\\*\\*psnp->char_ptr.\\*\\*\\*psnp->char_ptr.\\*\\*\\*\\*psnp->char_ptr\",exp=\"\\*\\*\\*\\*psnp->char_ptr\",numchild=\"0\",type=\"char\"\}\}" \ - "get children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr" - -# Test: c_variable-5.16 -# Desc: number of children of *(*(psnp->char_ptr)) -mi_gdb_test "-var-info-num-children psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr" - -# Test: c_variable-5.17 -# Desc: children of *(*(*(psnp->char_ptr))) -mi_gdb_test "-var-list-children psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"psnp->char_ptr.\\*psnp->char_ptr.\\*\\*psnp->char_ptr.\\*\\*\\*psnp->char_ptr.\\*\\*\\*\\*psnp->char_ptr\",exp=\"\\*\\*\\*\\*psnp->char_ptr\",numchild=\"0\",type=\"char\"\}\}" \ - "get children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr" - -# Test: c_variable-5.18 -# Desc: number of children of *(*(*(psnp->char_ptr))) -mi_gdb_test "-var-info-num-children psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr" - -# Test: c_variable-5.17B -# Desc: children of *(*(*(*(psnp->char_ptr)))) -mi_gdb_test "-var-list-children psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr.****psnp->char_ptr" \ - "\\^done,numchild=\"0\"" \ - "get children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr.****psnp->char_ptr" - -# Test: c_variable-5.18B -# Desc: number of children of *(*(*(*(psnp->char_ptr)))) -mi_gdb_test "-var-info-num-children psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr.****psnp->char_ptr" \ - "\\^done,numchild=\"0\"" \ - "get number of children of psnp->char_ptr.*psnp->char_ptr.**psnp->char_ptr.***psnp->char_ptr.****psnp->char_ptr" - - -# Test: c_variable-5.19 -# Desc: create psnp->long_ptr -mi_gdb_test "-var-create psnp->long_ptr * psnp->long_ptr" \ - "\\^done,name=\"psnp->long_ptr\",numchild=\"1\",type=\"long int \\*\\*\\*\\*\"" \ - "create local variable psnp->long_ptr" - -# Test: c_variable-5.20 -# Desc: children of psnp->long_ptr -mi_gdb_test "-var-list-children psnp->long_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"psnp->long_ptr.\\*psnp->long_ptr\",exp=\"\\*psnp->long_ptr\",numchild=\"1\",type=\"long int \\*\\*\\*\"\}\}" \ - "get children of psnp->long_ptr" - -# Test: c_variable-5.21 -# Desc: number of children of psnp->long_ptr -mi_gdb_test "-var-info-num-children psnp->long_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of psnp->long_ptr" - -# Test: c_variable-5.22 -# Desc: children of *(psnp->long_ptr) -mi_gdb_test "-var-list-children psnp->long_ptr.*psnp->long_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"psnp->long_ptr.\\*psnp->long_ptr.\\*\\*psnp->long_ptr\",exp=\"\\*\\*psnp->long_ptr\",numchild=\"1\",type=\"long int \\*\\*\"\}\}" \ - "get children of psnp->long_ptr.*psnp->long_ptr" - - -# Test: c_variable-5.23 -# Desc: number of children of *(psnp->long_ptr) -mi_gdb_test "-var-info-num-children psnp->long_ptr.*psnp->long_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of psnp->long_ptr.*psnp->long_ptr" - -# Test: c_variable-5.24 -# Desc: children of *(*(psnp->long_ptr)) -mi_gdb_test "-var-list-children psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"psnp->long_ptr.\\*psnp->long_ptr.\\*\\*psnp->long_ptr.\\*\\*\\*psnp->long_ptr\",exp=\"\\*\\*\\*psnp->long_ptr\",numchild=\"1\",type=\"long int \\*\"\}\}" \ - "get children of psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr" - -# Test: c_variable-5.25 -# Desc: number of children of *(*(psnp->long_ptr)) -mi_gdb_test "-var-info-num-children psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr" - -# Test: c_variable-5.26 -# Desc: children of *(*(*(psnp->long_ptr))) -mi_gdb_test "-var-list-children psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"psnp->long_ptr.\\*psnp->long_ptr.\\*\\*psnp->long_ptr.\\*\\*\\*psnp->long_ptr.\\*\\*\\*\\*psnp->long_ptr\",exp=\"\\*\\*\\*\\*psnp->long_ptr\",numchild=\"0\",type=\"long int\"\}\}" \ - "get children of psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr" - -# Test: c_variable-5.27 -# Desc: number of children of *(*(*(psnp->long_ptr))) -mi_gdb_test "-var-info-num-children psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr" - -# Test: c_variable-5.28 -# Desc: children of *(*(*(*(psnp->long_ptr)))) -mi_gdb_test "-var-list-children psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr.****psnp->long_ptr" \ - "\\^done,numchild=\"0\"" \ - "get children of psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr.****psnp->long_ptr" - -# Test: c_variable-5.29 -# Desc: number of children of *(*(*(*(psnp->long_ptr)))) -mi_gdb_test "-var-info-num-children psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr.****psnp->long_ptr" \ - "\\^done,numchild=\"0\"" \ - "get number of children of psnp->long_ptr.*psnp->long_ptr.**psnp->long_ptr.***psnp->long_ptr.****psnp->long_ptr" - -# Test: c_variable-5.30 -# Desc: create psnp->ptrs -mi_gdb_test "-var-create psnp->ptrs * psnp->ptrs" \ - "\\^done,name=\"psnp->ptrs\",numchild=\"3\",type=\"struct _struct_n_pointer \\*\\\[3\\\]\"" \ - "create local variable psnp->ptrs" - -# Test: c_variable-5.31 -# Desc: children of psnp->ptrs -mi_gdb_test "-var-list-children psnp->ptrs" \ - "\\^done,numchild=\"3\",children=\{child=\{name=\"psnp->ptrs.0\",exp=\"0\",numchild=\"4\",type=\"struct _struct_n_pointer \\*\"\},child=\{name=\"psnp->ptrs.1\",exp=\"1\",numchild=\"4\",type=\"struct _struct_n_pointer \\*\"\},child=\{name=\"psnp->ptrs.2\",exp=\"2\",numchild=\"4\",type=\"struct _struct_n_pointer \\*\"\}\}" \ - "get children of psnp->ptrs" - -# Test: c_variable-5.32 -# Desc: number of children of psnp->ptrs -mi_gdb_test "-var-info-num-children psnp->ptrs" \ - "\\^done,numchild=\"3\"" \ - "get number of children of psnp->ptrs" - -# Test: c_variable-5.33 -# Desc: children of psnp->ptrs[0] -mi_gdb_test "-var-list-children psnp->ptrs.0" \ - "\\^done,numchild=\"4\",children=\{child=\{name=\"psnp->ptrs.0.char_ptr\",exp=\"char_ptr\",numchild=\"1\",type=\"char \\*\\*\\*\\*\"\},child=\{name=\"psnp->ptrs.0.long_ptr\",exp=\"long_ptr\",numchild=\"1\",type=\"long int \\*\\*\\*\\*\"\},child=\{name=\"psnp->ptrs.0.ptrs\",exp=\"ptrs\",numchild=\"3\",type=\"struct _struct_n_pointer \\*\\\[3\\\]\"\},child=\{name=\"psnp->ptrs.0.next\",exp=\"next\",numchild=\"4\",type=\"struct _struct_n_pointer \\*\"\}\}" \ - "get children of psnp->ptrs.0" - -# Test: c_variable-5.34 -# Desc: number of children of psnp->ptrs[0] -mi_gdb_test "-var-info-num-children psnp->ptrs.0" \ - "\\^done,numchild=\"4\"" \ - "get number of children of psnp->ptrs.0" - -# Test: c_variable-5.35 -# Desc: children of psnp->ptrs[0]->next -mi_gdb_test "-var-list-children psnp->ptrs.0.next" \ - "\\^done,numchild=\"4\",children=\{child=\{name=\"psnp->ptrs.0.next.char_ptr\",exp=\"char_ptr\",numchild=\"1\",type=\"char \\*\\*\\*\\*\"\},child=\{name=\"psnp->ptrs.0.next.long_ptr\",exp=\"long_ptr\",numchild=\"1\",type=\"long int \\*\\*\\*\\*\"\},child=\{name=\"psnp->ptrs.0.next.ptrs\",exp=\"ptrs\",numchild=\"3\",type=\"struct _struct_n_pointer \\*\\\[3\\\]\"\},child=\{name=\"psnp->ptrs.0.next.next\",exp=\"next\",numchild=\"4\",type=\"struct _struct_n_pointer \\*\"\}\}" \ - "get children of psnp->ptrs.0.next" - -#} {char_ptr long_ptr ptrs next} - -# Test: c_variable-5.36 -# Desc: number of children of psnp->ptrs[0]->next -mi_gdb_test "-var-info-num-children psnp->ptrs.0.next" \ - "\\^done,numchild=\"4\"" \ - "get number of children of psnp->ptrs.0.next" - - -# Test: c_variable-5.37 -# Desc: children of psnp->ptrs[0]->next->char_ptr -mi_gdb_test "-var-list-children psnp->ptrs.0.next.char_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"psnp->ptrs.0.next.char_ptr.\\*char_ptr\",exp=\"\\*char_ptr\",numchild=\"1\",type=\"char \\*\\*\\*\"\}\}" \ - "get children of psnp->ptrs.0.next.char_ptr" - -#gdbtk_test c_variable-5.37 {children of psnp->ptrs[0]->next->char_ptr} { -# get_children psnp->ptrs.0.next.char_ptr -#} {*char_ptr} - -# Test: c_variable-5.38 -# Desc: number of children of psnp->ptrs[0]->next->char_ptr -mi_gdb_test "-var-info-num-children psnp->ptrs.0.next.char_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of psnp->ptrs.0.next.char_ptr" - -# Test: c_variable-5.39 -# Desc: children of *psnp->ptrs[0]->next->char_ptr -mi_gdb_test "-var-list-children psnp->ptrs.0.next.char_ptr.*char_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"psnp->ptrs.0.next.char_ptr.\\*char_ptr.\\*\\*char_ptr\",exp=\"\\*\\*char_ptr\",numchild=\"1\",type=\"char \\*\\*\"\}\}" \ - "get children of psnp->ptrs.0.next.char_ptr.*char_ptr" - -# Test: c_variable-5.40 -# Desc: number of children of *psnp->ptrs[0]->next->char_ptr -mi_gdb_test "-var-info-num-children psnp->ptrs.0.next.char_ptr.*char_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of psnp->ptrs.0.next.char_ptr.*char_ptr" - -# Test: c_variable-5.41 -# Desc: children of **psnp->ptrs[0]->next->char_ptr -mi_gdb_test "-var-list-children psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"psnp->ptrs.0.next.char_ptr.\\*char_ptr.\\*\\*char_ptr.\\*\\*\\*char_ptr\",exp=\"\\*\\*\\*char_ptr\",numchild=\"1\",type=\"char \\*\"\}\}" \ - "get children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr" - -# Test: c_variable-5.41B -# Desc: children of ***psnp->ptrs[0]->next->char_ptr -mi_gdb_test "-var-list-children psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"psnp->ptrs.0.next.char_ptr.\\*char_ptr.\\*\\*char_ptr.\\*\\*\\*char_ptr.\\*\\*\\*\\*char_ptr\",exp=\"\\*\\*\\*\\*char_ptr\",numchild=\"0\",type=\"char\"\}\}" \ - "get children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr" - -# Test: c_variable-5.42 -# Desc: number of children of **psnp->ptrs[0]->next->char_ptr -mi_gdb_test "-var-info-num-children psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr" - -# Test: c_variable-5.43 -# Desc: children of ***psnp->ptrs[0]->next->char_ptr -mi_gdb_test "-var-list-children psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr" \ - "\\^done,numchild=\"1\",children=\{child=\{name=\"psnp->ptrs.0.next.char_ptr.\\*char_ptr.\\*\\*char_ptr.\\*\\*\\*char_ptr.\\*\\*\\*\\*char_ptr\",exp=\"\\*\\*\\*\\*char_ptr\",numchild=\"0\",type=\"char\"\}\}" \ - "get children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr" - -# Test: c_variable-5.44 -# Desc: number of children of ***psnp->ptrs[0]->next->char_ptr -mi_gdb_test "-var-info-num-children psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr" \ - "\\^done,numchild=\"1\"" \ - "get number of children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr" - -# Test: c_variable-5.43B -# Desc: children of ****psnp->ptrs[0]->next->char_ptr -mi_gdb_test "-var-list-children psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr.****char_ptr" \ - "\\^done,numchild=\"0\"" \ - "get children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr" - -# Test: c_variable-5.44B -# Desc: number of children of ****psnp->ptrs[0]->next->char_ptr -mi_gdb_test "-var-info-num-children psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr.****char_ptr" \ - "\\^done,numchild=\"0\"" \ - "get number of children of psnp->ptrs.0.next.char_ptr.*char_ptr.**char_ptr.***char_ptr" - -# Test: c_variable-5.45 -# Desc: children of psnp->ptrs[0]->next->next -mi_gdb_test "-var-list-children psnp->ptrs.0.next.next" \ - "\\^done,numchild=\"4\",children=\{child=\{name=\"psnp->ptrs.0.next.next.char_ptr\",exp=\"char_ptr\",numchild=\"1\",type=\"char \\*\\*\\*\\*\"\},child=\{name=\"psnp->ptrs.0.next.next.long_ptr\",exp=\"long_ptr\",numchild=\"1\",type=\"long int \\*\\*\\*\\*\"\},child=\{name=\"psnp->ptrs.0.next.next.ptrs\",exp=\"ptrs\",numchild=\"3\",type=\"struct _struct_n_pointer \\*\\\[3\\\]\"\},child=\{name=\"psnp->ptrs.0.next.next.next\",exp=\"next\",numchild=\"4\",type=\"struct _struct_n_pointer \\*\"\}\}" \ - "get children of psnp->ptrs.0.next.next" - -# Test: c_variable-5.46 -# Desc: children of psnp->ptrs[0]->next->next->ptrs -mi_gdb_test "-var-list-children psnp->ptrs.0.next.next.ptrs" \ - "\\^done,numchild=\"3\",children=\{child=\{name=\"psnp->ptrs.0.next.next.ptrs.0\",exp=\"0\",numchild=\"4\",type=\"struct _struct_n_pointer \\*\"\},child=\{name=\"psnp->ptrs.0.next.next.ptrs.1\",exp=\"1\",numchild=\"4\",type=\"struct _struct_n_pointer \\*\"\},child=\{name=\"psnp->ptrs.0.next.next.ptrs.2\",exp=\"2\",numchild=\"4\",type=\"struct _struct_n_pointer \\*\"\}\}" \ - "get children of psnp->ptrs.0.next.next.ptrs" - -# Step over "snp0.char_ptr = &b3;" -set line 255 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" - -# Test: c_variable-5.47 -# Desc: check that psnp->char_ptr (and [0].char_ptr) changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"psnp->ptrs.0.char_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"psnp->char_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"psnp->char_ptr.\\*psnp->char_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"psnp->char_ptr.\\*psnp->char_ptr.\\*\\*psnp->char_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"psnp->char_ptr.\\*psnp->char_ptr.\\*\\*psnp->char_ptr.\\*\\*\\*psnp->char_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"psnp->char_ptr.\\*psnp->char_ptr.\\*\\*psnp->char_ptr.\\*\\*\\*psnp->char_ptr.\\*\\*\\*\\*psnp->char_ptr\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars psnp->char_ptr (and 0.char_ptr) changed" - -# Step over "snp1.char_ptr = &c3;" -set line 256 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" - -# Test: c_variable-5.48 -# Desc: check that psnp->next->char_ptr (and [1].char_ptr) changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"psnp->ptrs.0.next.char_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"psnp->ptrs.0.next.char_ptr.\\*char_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"psnp->ptrs.0.next.char_ptr.\\*char_ptr.\\*\\*char_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"psnp->ptrs.0.next.char_ptr.\\*char_ptr.\\*\\*char_ptr.\\*\\*\\*char_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"psnp->ptrs.0.next.char_ptr.\\*char_ptr.\\*\\*char_ptr.\\*\\*\\*char_ptr.\\*\\*\\*\\*char_ptr\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars psnp->next->char_ptr (and 1.char_ptr) changed" - - -# Step over "snp2.char_ptr = &a3;" -set line 257 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" - -# Test: c_variable-5.49 -# Desc: check that psnp->next->next->char_ptr (and [2].char_ptr) changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"psnp->ptrs.0.next.next.char_ptr\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars psnp->next->next->char_ptr (and 2.char_ptr) changed" - - -# Step over "snp0.long_ptr = &y3;" -set line 258 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" - -# Test: c_variable-5.50 -# Desc: check that psnp->long_ptr (and [0].long_ptr) changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"psnp->ptrs.0.long_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"psnp->long_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"psnp->long_ptr.\\*psnp->long_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"psnp->long_ptr.\\*psnp->long_ptr.\\*\\*psnp->long_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"psnp->long_ptr.\\*psnp->long_ptr.\\*\\*psnp->long_ptr.\\*\\*\\*psnp->long_ptr\",in_scope=\"true\",type_changed=\"false\",name=\"psnp->long_ptr.\\*psnp->long_ptr.\\*\\*psnp->long_ptr.\\*\\*\\*psnp->long_ptr.\\*\\*\\*\\*psnp->long_ptr\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars psnp->long_ptr (and 0.long_ptr) changed" - - -# Step over "snp1.long_ptr = &x3;" -set line 259 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" - -# Test: c_variable-5.51 -# Desc: check that psnp->next->long_ptr (and [1].long_ptr) changed -# Why does this have a FIXME? -setup_xfail *-*-* -mi_gdb_test "-var-update *" \ - "FIXME\\^done,changelist=\{name=\"psnp->ptrs.0.next.long_ptr\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars psnp->next->long_ptr (and 1.long_ptr) changed" -clear_xfail *-*-* - -# This command produces this error message: -# &"warning: varobj_list: assertion failed - mycount <> 0\n" -# - -# Step over "snp2.long_ptr = &z3;" -set line 260 -mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line" - -# Test: c_variable-5.52 -# Desc: check that psnp->next->next->long_ptr (and [2].long_ptr) changed -mi_gdb_test "-var-update *" \ - "\\^done,changelist=\{name=\"psnp->ptrs.0.next.next.long_ptr\",in_scope=\"true\",type_changed=\"false\"\}" \ - "update all vars psnp->next->next->long_ptr (and 2.long_ptr) changed" - - - - -mi_gdb_exit -return 0 diff --git a/gdb/testsuite/gdb.mi/mi1-var-cmd.exp b/gdb/testsuite/gdb.mi/mi1-var-cmd.exp deleted file mode 100644 index c6a88b6..0000000 --- a/gdb/testsuite/gdb.mi/mi1-var-cmd.exp +++ /dev/null @@ -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 diff --git a/gdb/testsuite/gdb.mi/mi1-var-display.exp b/gdb/testsuite/gdb.mi/mi1-var-display.exp deleted file mode 100644 index 593a1c0..0000000 --- a/gdb/testsuite/gdb.mi/mi1-var-display.exp +++ /dev/null @@ -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 diff --git a/gdb/testsuite/gdb.mi/mi1-watch.exp b/gdb/testsuite/gdb.mi/mi1-watch.exp deleted file mode 100644 index dfb97ae..0000000 --- a/gdb/testsuite/gdb.mi/mi1-watch.exp +++ /dev/null @@ -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 diff --git a/gdb/testsuite/gdb.objc/basicclass.exp b/gdb/testsuite/gdb.objc/basicclass.exp index 39cf296..41ab284 100644 --- a/gdb/testsuite/gdb.objc/basicclass.exp +++ b/gdb/testsuite/gdb.objc/basicclass.exp @@ -1,4 +1,4 @@ -# Copyright 2003 Free Software Foundation, Inc. +# Copyright 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 @@ -125,13 +125,9 @@ gdb_test continue \ # # Test resetting breakpoints when re-running program # -send_gdb "run\n" +gdb_run_cmd gdb_expect { - -re "The program .* has been started already.*y or n. $" { - send_gdb "y\n" - exp_continue - } - -re "Starting program.*Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:.*$gdb_prompt $"\ + -re "Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:.*$gdb_prompt $"\ { pass "resetting breakpoints when rerunning" } -re ".*$gdb_prompt $" { fail "resetting breakpoints when rerunning" } timeout { fail "resetting breakpoints when rerunning" } diff --git a/gdb/testsuite/gdb.threads/gcore-thread.exp b/gdb/testsuite/gdb.threads/gcore-thread.exp index 43d253e..d7f8971 100644 --- a/gdb/testsuite/gdb.threads/gcore-thread.exp +++ b/gdb/testsuite/gdb.threads/gcore-thread.exp @@ -78,7 +78,7 @@ gdb_expect { } } -if { ! [ runto main ] } then { +if { ! [ runto_main ] } then { gdb_suppress_entire_file "Run to main failed, so all tests in this file will automatically fail." } diff --git a/gdb/testsuite/gdb.threads/thread-specific.c b/gdb/testsuite/gdb.threads/thread-specific.c new file mode 100644 index 0000000..88a462d --- /dev/null +++ b/gdb/testsuite/gdb.threads/thread-specific.c @@ -0,0 +1,66 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 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. */ + +#include <stdio.h> +#include <unistd.h> +#include <stdlib.h> +#include <pthread.h> + +void *thread_function(void *arg); + +unsigned int args[1]; + +int main() { + int res; + pthread_t threads[2]; + void *thread_result; + long i = 1; + + args[0] = 1; + res = pthread_create(&threads[0], + NULL, + thread_function, + (void *) 0); + + /* thread-specific.exp: last thread start. */ + args[1] = 1; + + /* Don't run forever. Run just short of it :) */ + while (i > 0) + { + /* thread-specific.exp: main loop. */ + (i) ++; + } + + exit(EXIT_SUCCESS); +} + +void *thread_function(void *arg) { + int my_number = (long) arg; + int *myp = &args[my_number]; + + /* Don't run forever. Run just short of it :) */ + while (*myp > 0) + { + /* thread-specific.exp: thread loop. */ + (*myp) ++; + } + + pthread_exit(NULL); +} diff --git a/gdb/testsuite/gdb.threads/thread-specific.exp b/gdb/testsuite/gdb.threads/thread-specific.exp new file mode 100644 index 0000000..66f0bd2 --- /dev/null +++ b/gdb/testsuite/gdb.threads/thread-specific.exp @@ -0,0 +1,115 @@ +# Copyright 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 was written by Daniel Jacobowitz <drow@mvista.com>. +# It tests that the correct breakpoint is reported when we hit a +# thread-specific breakpoint inserted for several threads. + +if $tracelevel then { + strace $tracelevel +} + +set prms_id 0 +set bug_id 0 + +set testfile "thread-specific" +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} + +if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}"]] != "" } { + return -1 +} + +# Return a list of the valid thread IDs, with the initial thread first. +proc get_thread_list { } { + global gdb_prompt + global expect_out + + set thr_list "" + + gdb_test_multiple "info threads" "get threads list" { + -re "info threads\r\n" { + exp_continue + } + -re "^\\* *(\[0-9\]*) Thread \[^\n\]*main\[^\n\]*\n" { + set thr_list "$expect_out(1,string) $thr_list" + exp_continue + } + -re "^ *(\[0-9\]*) Thread \[^\n\]*\n" { + lappend thr_list $expect_out(1,string) + exp_continue + } + -re ".*$gdb_prompt $" { + if { [llength $thr_list] != 0 } { + pass "get threads list" + } else { + fail "get threads list (no threads)" + } + } + } + + return $thr_list +} + +# Start with a fresh gdb. + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir + +gdb_load ${binfile} + +gdb_test "set print sevenbit-strings" "" +gdb_test "set width 0" "" + +runto_main + +gdb_breakpoint [gdb_get_line_number "thread-specific.exp: last thread start"] +gdb_continue_to_breakpoint "all threads started" + +set line [gdb_get_line_number "thread-specific.exp: thread loop"] +set threads [get_thread_list] + +if {[llength $threads] == 0} { + # We have already issued a FAIL above. + return 1 +} + +gdb_test_multiple "break $line thread [lindex $threads 0]" \ + "breakpoint $line main thread" { + -re "Breakpoint (\[0-9\]*) at.* file .*$srcfile, line.*$gdb_prompt $" { + set main_breakpoint $expect_out(1,string) + pass "breakpoint $line main thread" + } +} + +foreach thread [lrange $threads 1 end] { + gdb_breakpoint "$line thread $thread" +} + +gdb_test_multiple "continue" "continue to thread-specific breakpoint" { + -re "Breakpoint $main_breakpoint, .* at .*\r\n$gdb_prompt $" { + fail "continue to thread-specific breakpoint (wrong breakpoint)" + } + -re "Breakpoint .* at .*\r\n$gdb_prompt $" { + pass "continue to thread-specific breakpoint" + } +} + +return 0 diff --git a/gdb/testsuite/lib/compiler.c b/gdb/testsuite/lib/compiler.c index b0f557c..b1f1f5d 100644 --- a/gdb/testsuite/lib/compiler.c +++ b/gdb/testsuite/lib/compiler.c @@ -1,6 +1,6 @@ /* This test file is part of GDB, the GNU debugger. - Copyright 1995, 1997, 1999, 2003 Free Software Foundation, Inc. + Copyright 1995, 1997, 1999, 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 @@ -19,36 +19,47 @@ Please email any bugs, comments, and/or additions to this file to: bug-gdb@prep.ai.mit.edu */ -/* Often the behavior of any particular test depends upon what compiler was - used to compile the test. As each test is compiled, this file is - preprocessed by the same compiler used to compile that specific test - (different tests might be compiled by different compilers, particularly - if compiled at different times), and used to generate a *.ci (compiler - info) file for that test. +/* Sometimes the behavior of a test depends upon the compiler used to + compile the test program. A test script can call get_compiler_info + to figure out the compiler version and test_compiler_info to test it. - I.E., when callfuncs is compiled, a callfuncs.ci file will be generated, - which can then be sourced by callfuncs.exp to give callfuncs.exp access - to information about the compilation environment. + get_compiler_info runs the preprocessor on this file and then eval's + the result. This sets various symbols for use by test_compiler_info. - TODO: It might be a good idea to add expect code that tests each - definition made with 'set" to see if one already exists, and if so - warn about conflicts if it is being set to something else. */ + TODO: make compiler_info a local variable for get_compiler_info and + test_compiler_info. -/* This needs to be kept in sync with whatis.c and gdb.exp(get_compiler_info). - If this ends up being hairy, we could use a common header file. */ + TODO: all clients should use test_compiler_info and should not + use gcc_compiled, hp_cc_compiler, or hp_aCC_compiler. -#if defined (__STDC__) || defined (_AIX) -set signed_keyword_not_used 0 -#else -set signed_keyword_not_used 1 -#endif + TODO: purge signed_keyword_not_used. */ + +set compiler_info "" #if defined (__GNUC__) -set gcc_compiled __GNUC__ set compiler_info [join {gcc __GNUC__ __GNUC_MINOR__ } -] +set gcc_compiled __GNUC__ #else set gcc_compiled 0 -set compiler_info "" #endif -return 0 +#if defined (__HP_cc) +set compiler_info [join {hpcc __HP_cc} -] +set hp_cc_compiler __HP_cc +#else +set hp_cc_compiler 0 +#endif + +#if defined (__HP_aCC) +set compiler_info [join {hpacc __HP_aCC} -] +set hp_aCC_compiler __HP_aCC +#else +set hp_aCC_compiler 0 +#endif + +/* gdb.base/whatis.exp still uses this */ +#if defined (__STDC__) || defined (_AIX) +set signed_keyword_not_used 0 +#else +set signed_keyword_not_used 1 +#endif diff --git a/gdb/testsuite/lib/compiler.cc b/gdb/testsuite/lib/compiler.cc index bbefeaa..0c5eb66 100644 --- a/gdb/testsuite/lib/compiler.cc +++ b/gdb/testsuite/lib/compiler.cc @@ -19,27 +19,35 @@ Please email any bugs, comments, and/or additions to this file to: bug-gdb@prep.ai.mit.edu */ -/* Often the behavior of any particular test depends upon what compiler was - used to compile the test. As each test is compiled, this file is - preprocessed by the same compiler used to compile that specific test - (different tests might be compiled by different compilers, particularly - if compiled at different times), and used to generate a *.ci (compiler - info) file for that test. +/* This file is exactly like compiler.c. I could just use compiler.c if + I could be sure that every C++ compiler accepted extensions of ".c". */ - I.E., when callfuncs is compiled, a callfuncs.ci file will be generated, - which can then be sourced by callfuncs.exp to give callfuncs.exp access - to information about the compilation environment. - - TODO: It might be a good idea to add expect code that tests each - definition made with 'set" to see if one already exists, and if so - warn about conflicts if it is being set to something else. */ +set compiler_info "" #if defined (__GNUC__) -set gcc_compiled __GNUC__ set compiler_info [join {gcc __GNUC__ __GNUC_MINOR__ } -] +set gcc_compiled __GNUC__ #else set gcc_compiled 0 -set compiler_info "" #endif -return 0 +#if defined (__HP_cc) +set compiler_info [join {hpcc __HP_cc} -] +set hp_cc_compiler __HP_cc +#else +set hp_cc_compiler 0 +#endif + +#if defined (__HP_aCC) +set compiler_info [join {hpacc __HP_aCC} -] +set hp_aCC_compiler __HP_aCC +#else +set hp_aCC_compiler 0 +#endif + +/* gdb.base/whatis.exp still uses this */ +#if defined (__STDC__) || defined (_AIX) +set signed_keyword_not_used 0 +#else +set signed_keyword_not_used 1 +#endif diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 3f2938e..5cd54ab 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -1,5 +1,5 @@ # Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, -# 2002, 2003 +# 2002, 2003, 2004 # Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify @@ -248,6 +248,12 @@ proc gdb_run_cmd {args} { } return } + + if [target_info exists gdb,do_reload_on_run] { + if { [gdb_load ""] < 0 } { + return; + } + } send_gdb "run $args\n" # This doesn't work quite right yet. gdb_expect 60 { @@ -269,6 +275,10 @@ proc gdb_breakpoint { function } { -re "Breakpoint \[0-9\]* at .*: file .*, line $decimal.\r\n$gdb_prompt $" {} -re "Breakpoint \[0-9\]*: file .*, line $decimal.\r\n$gdb_prompt $" {} -re "Breakpoint \[0-9\]* at .*$gdb_prompt $" {} + -re "Make breakpoint pending.*y or n. $" { + send_gdb "n\n" + exp_continue + } -re "$gdb_prompt $" { fail "setting breakpoint at $function" ; return 0 } timeout { fail "setting breakpoint at $function (timeout)" ; return 0 } } @@ -449,6 +459,7 @@ proc gdb_test_multiple { command message user_code } { global gdb_prompt global GDB upvar timeout timeout + upvar expect_out expect_out if { $message == "" } { set message $command @@ -1094,86 +1105,114 @@ proc skip_hp_tests {} { return $skip_hp } -global compiler_info -set compiler_info unknown +set compiler_info "unknown" +set gcc_compiled 0 +set hp_cc_compiler 0 +set hp_aCC_compiler 0 +set signed_keyword_not_used 0 + +# Figure out what compiler I am using. +# +# BINFILE is a "compiler information" output file. This implementation +# does not use BINFILE. +# +# ARGS can be empty or "C++". If empty, "C" is assumed. +# +# There are several ways to do this, with various problems. +# +# [ gdb_compile -E $ifile -o $binfile.ci ] +# source $binfile.ci +# +# Single Unix Spec v3 says that "-E -o ..." together are not +# specified. And in fact, the native compiler on hp-ux 11 (among +# others) does not work with "-E -o ...". Most targets used to do +# this, and it mostly worked, because it works with gcc. +# +# [ catch "exec $compiler -E $ifile > $binfile.ci" exec_output ] +# source $binfile.ci +# +# This avoids the problem with -E and -o together. This almost works +# if the build machine is the same as the host machine, which is +# usually true of the targets which are not gcc. But this code does +# not figure which compiler to call, and it always ends up using the C +# compiler. Not good for setting hp_aCC_compiler. Targets +# hppa*-*-hpux* and mips*-*-irix* used to do this. +# +# [ gdb_compile -E $ifile > $binfile.ci ] +# source $binfile.ci +# +# dejagnu target_compile says that it supports output redirection, +# but the code is completely different from the normal path and I +# don't want to sweep the mines from that path. So I didn't even try +# this. +# +# set cppout [ gdb_compile $ifile "" preprocess $args quiet ] +# eval $cppout +# +# I actually do this for all targets now. gdb_compile runs the right +# compiler, and TCL captures the output, and I eval the output. +# +# Unfortunately, expect logs the output of the command as it goes by, +# and dejagnu helpfully prints a second copy of it right afterwards. +# So I turn off expect logging for a moment. +# +# [ gdb_compile $ifile $ciexe_file executable $args ] +# [ remote_exec $ciexe_file ] +# [ source $ci_file.out ] +# +# I could give up on -E and just do this. +# I didn't get desperate enough to try this. +# +# -- chastain 2004-01-06 proc get_compiler_info {binfile args} { - # Create and source the file that provides information about the compiler - # used to compile the test case. - # Compiler_type can be null or c++. If null we assume c. + # For compiler.c and compiler.cc global srcdir - global subdir - # These two come from compiler.c. - global signed_keyword_not_used - global gcc_compiled + + # I am going to play with the log to keep noise out. + global outdir + global tool + + # These come from compiler.c or compiler.cc global compiler_info + global gcc_compiled + global hp_cc_compiler + global hp_aCC_compiler + global signed_keyword_not_used - if {![istarget "hppa*-*-hpux*"] && ![istarget "mips*-*-irix*"]} { - if { [llength $args] > 0 } { - if {$args == "c++"} { - if { [gdb_compile "${srcdir}/lib/compiler.cc" "${binfile}.ci" preprocess {}] != "" } { - perror "Couldn't make ${binfile}.ci file" - return 1; - } - } - } else { - if { [gdb_compile "${srcdir}/lib/compiler.c" "${binfile}.ci" preprocess {}] != "" } { - perror "Couldn't make ${binfile}.ci file" - return 1; - } - } - } else { - if { [llength $args] > 0 } { - if {$args == "c++"} { - if { [eval gdb_preprocess \ - [list "${srcdir}/lib/compiler.cc" "${binfile}.ci"] \ - $args] != "" } { - perror "Couldn't make ${binfile}.ci file" - return 1; - } - } - } elseif { $args != "f77" } { - if { [eval gdb_preprocess \ - [list "${srcdir}/lib/compiler.c" "${binfile}.ci"] \ - $args] != "" } { - perror "Couldn't make ${binfile}.ci file" - return 1; - } - } + # Choose which file to preprocess. + set ifile "${srcdir}/lib/compiler.c" + if { [llength $args] > 0 && [lindex $args 0] == "c++" } { + set ifile "${srcdir}/lib/compiler.cc" } - - uplevel \#0 { set gcc_compiled 0 } - if { [llength $args] == 0 || $args != "f77" } { - source ${binfile}.ci + # Run $ifile through the right preprocessor. + # Toggle gdb.log to keep the compiler output out of the log. + log_file + set cppout [ gdb_compile "${ifile}" "" preprocess [list "$args" quiet] ] + log_file -a "$outdir/$tool.log" + + # Source the output. + foreach cppline [ split "$cppout" "\n" ] { + if { ! [ regexp "^#" "$cppline" ] } { + if { ! [ regexp "^\[\n\r\t \]*$" "$cppline" ] } { + verbose "get_compiler_info: $cppline" 2 + eval "$cppline" + } + } } + verbose -log "get_compiler_info: $compiler_info" # Most compilers will evaluate comparisons and other boolean # operations to 0 or 1. uplevel \#0 { set true 1 } uplevel \#0 { set false 0 } - uplevel \#0 { set hp_cc_compiler 0 } - uplevel \#0 { set hp_aCC_compiler 0 } - uplevel \#0 { set hp_f77_compiler 0 } - uplevel \#0 { set hp_f90_compiler 0 } - if { !$gcc_compiled && [istarget "hppa*-*-hpux*"] } { - # Check for the HP compilers - set compiler [lindex [split [get_compiler $args] " "] 0] - catch "exec what $compiler" output - if [regexp ".*HP aC\\+\\+.*" $output] { - uplevel \#0 { set hp_aCC_compiler 1 } - # Use of aCC results in boolean results being displayed as - # "true" or "false" - uplevel \#0 { set true true } - uplevel \#0 { set false false } - } elseif [regexp ".*HP C Compiler.*" $output] { - uplevel \#0 { set hp_cc_compiler 1 } - } elseif [regexp ".*HP-UX f77.*" $output] { - uplevel \#0 { set hp_f77_compiler 1 } - } elseif [regexp ".*HP-UX f90.*" $output] { - uplevel \#0 { set hp_f90_compiler 1 } - } + # Use of aCC results in boolean results being displayed as + # "true" or "false" + if { $hp_aCC_compiler } { + uplevel \#0 { set true true } + uplevel \#0 { set false false } } return 0; @@ -1184,85 +1223,6 @@ proc test_compiler_info { compiler } { return [string match $compiler $compiler_info] } -proc get_compiler {args} { - global CC CC_FOR_TARGET CXX CXX_FOR_TARGET F77_FOR_TARGET - - if { [llength $args] == 0 - || ([llength $args] == 1 && [lindex $args 0] == "") } { - set which_compiler "c" - } else { - if { $args =="c++" } { - set which_compiler "c++" - } elseif { $args =="f77" } { - set which_compiler "f77" - } else { - perror "Unknown compiler type supplied to gdb_preprocess" - return "" - } - } - - if [info exists CC_FOR_TARGET] { - if {$which_compiler == "c"} { - set compiler $CC_FOR_TARGET - } - } - - if [info exists CXX_FOR_TARGET] { - if {$which_compiler == "c++"} { - set compiler $CXX_FOR_TARGET - } - } - - if [info exists F77_FOR_TARGET] { - if {$which_compiler == "f77"} { - set compiler $F77_FOR_TARGET - } - } - - if { ![info exists compiler] } { - if { $which_compiler == "c" } { - if {[info exists CC]} { - set compiler $CC - } - } - if { $which_compiler == "c++" } { - if {[info exists CXX]} { - set compiler $CXX - } - } - if {![info exists compiler]} { - set compiler [board_info [target_info name] compiler]; - if { $compiler == "" } { - perror "get_compiler: No compiler found" - return "" - } - } - } - - return $compiler -} - -proc gdb_preprocess {source dest args} { - set compiler [get_compiler "$args"] - if { $compiler == "" } { - return 1 - } - - set cmdline "$compiler -E $source > $dest" - - verbose "Invoking $compiler -E $source > $dest" - verbose -log "Executing on local host: $cmdline" 2 - set status [catch "exec ${cmdline}" exec_output] - - set result [prune_warnings $exec_output] - regsub "\[\r\n\]*$" "$result" "" result; - regsub "^\[\r\n\]*" "$result" "" result; - if { $result != "" } { - clone_output "gdb compile failed, $result" - } - return $result; -} - set gdb_wrapper_initialized 0 proc gdb_wrapper_init { args } { @@ -1510,6 +1470,11 @@ proc gdb_expect_list {test sentinel list} { fail "${test} (pattern ${index} + sentinel)" set ok 0 } + -re ".*A problem internal to GDB has been detected" { + fail "${test} (GDB internal error)" + set ok 0 + gdb_internal_error_resync + } timeout { fail "${test} (pattern ${index} + sentinel) (timeout)" set ok 0 @@ -1528,6 +1493,11 @@ proc gdb_expect_list {test sentinel list} { fail "${test} (pattern ${index})" set ok 0 } + -re ".*A problem internal to GDB has been detected" { + fail "${test} (GDB internal error)" + set ok 0 + gdb_internal_error_resync + } timeout { fail "${test} (pattern ${index}) (timeout)" set ok 0 |