summaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog1043
-rw-r--r--gdb/testsuite/Makefile.in5
-rw-r--r--gdb/testsuite/config/hppro.exp24
-rw-r--r--gdb/testsuite/config/sparclet.exp388
-rw-r--r--gdb/testsuite/config/udi.exp110
-rwxr-xr-xgdb/testsuite/configure12
-rw-r--r--gdb/testsuite/configure.in14
-rw-r--r--gdb/testsuite/gdb.ada/gnat_ada.gin (renamed from gdb/testsuite/gdb.ada/gnat_ada.gpr.in)0
-rw-r--r--gdb/testsuite/gdb.ada/null_record.exp4
-rw-r--r--gdb/testsuite/gdb.arch/e500-prologue.c54
-rw-r--r--gdb/testsuite/gdb.arch/e500-prologue.exp82
-rw-r--r--gdb/testsuite/gdb.arch/e500-regs.exp4
-rw-r--r--gdb/testsuite/gdb.arch/i386-cpuid.h77
-rw-r--r--gdb/testsuite/gdb.arch/i386-prologue.c79
-rw-r--r--gdb/testsuite/gdb.arch/i386-prologue.exp76
-rw-r--r--gdb/testsuite/gdb.arch/i386-sse.c90
-rw-r--r--gdb/testsuite/gdb.arch/i386-sse.exp92
-rw-r--r--gdb/testsuite/gdb.arch/i386-unwind.c14
-rw-r--r--gdb/testsuite/gdb.arch/i386-unwind.exp12
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-aix-prologue.c55
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-aix-prologue.exp82
-rw-r--r--gdb/testsuite/gdb.asm/asm-source.exp60
-rw-r--r--gdb/testsuite/gdb.asm/pa.inc44
-rw-r--r--gdb/testsuite/gdb.base/annota1.exp101
-rw-r--r--gdb/testsuite/gdb.base/annota3.exp111
-rw-r--r--gdb/testsuite/gdb.base/attach.exp644
-rw-r--r--gdb/testsuite/gdb.base/auxv.c21
-rw-r--r--gdb/testsuite/gdb.base/auxv.exp10
-rw-r--r--gdb/testsuite/gdb.base/bigcore.c16
-rw-r--r--gdb/testsuite/gdb.base/bigcore.exp33
-rw-r--r--gdb/testsuite/gdb.base/call-rt-st.exp8
-rw-r--r--gdb/testsuite/gdb.base/call-sc.c83
-rw-r--r--gdb/testsuite/gdb.base/call-sc.exp500
-rw-r--r--gdb/testsuite/gdb.base/charset.c1
-rw-r--r--gdb/testsuite/gdb.base/charset.exp3
-rw-r--r--gdb/testsuite/gdb.base/complex.c22
-rw-r--r--gdb/testsuite/gdb.base/coremaker.c20
-rw-r--r--gdb/testsuite/gdb.base/coremaker2.c20
-rw-r--r--gdb/testsuite/gdb.base/define.exp36
-rw-r--r--gdb/testsuite/gdb.base/dump.exp69
-rw-r--r--gdb/testsuite/gdb.base/ena-dis-br.exp496
-rw-r--r--gdb/testsuite/gdb.base/ending-run.exp12
-rw-r--r--gdb/testsuite/gdb.base/float.exp6
-rw-r--r--gdb/testsuite/gdb.base/foll-fork.exp3
-rw-r--r--gdb/testsuite/gdb.base/freebpcmd.c4
-rw-r--r--gdb/testsuite/gdb.base/gcore.c20
-rw-r--r--gdb/testsuite/gdb.base/gcore.exp5
-rw-r--r--gdb/testsuite/gdb.base/gdb1476.c12
-rw-r--r--gdb/testsuite/gdb.base/gdb1476.exp72
-rw-r--r--gdb/testsuite/gdb.base/lineinc.c30
-rw-r--r--gdb/testsuite/gdb.base/lineinc.exp126
-rw-r--r--gdb/testsuite/gdb.base/lineinc1.h1
-rw-r--r--gdb/testsuite/gdb.base/lineinc2.h2
-rw-r--r--gdb/testsuite/gdb.base/lineinc3.h2
-rw-r--r--gdb/testsuite/gdb.base/logical.exp589
-rw-r--r--gdb/testsuite/gdb.base/long_long.c109
-rw-r--r--gdb/testsuite/gdb.base/long_long.exp424
-rw-r--r--gdb/testsuite/gdb.base/pending.exp39
-rw-r--r--gdb/testsuite/gdb.base/radix.exp276
-rw-r--r--gdb/testsuite/gdb.base/remote.exp7
-rw-r--r--gdb/testsuite/gdb.base/restore.c41
-rw-r--r--gdb/testsuite/gdb.base/restore.exp39
-rw-r--r--gdb/testsuite/gdb.base/sep-proc.c26
-rw-r--r--gdb/testsuite/gdb.base/sep.c35
-rw-r--r--gdb/testsuite/gdb.base/sep.exp68
-rw-r--r--gdb/testsuite/gdb.base/shlib-call.exp6
-rw-r--r--gdb/testsuite/gdb.base/sigaltstack.c97
-rw-r--r--gdb/testsuite/gdb.base/sigaltstack.exp105
-rw-r--r--gdb/testsuite/gdb.base/sigbpt.c53
-rw-r--r--gdb/testsuite/gdb.base/sigbpt.exp266
-rw-r--r--gdb/testsuite/gdb.base/siginfo.c69
-rw-r--r--gdb/testsuite/gdb.base/siginfo.exp98
-rw-r--r--gdb/testsuite/gdb.base/signals.exp678
-rw-r--r--gdb/testsuite/gdb.base/signull.c88
-rw-r--r--gdb/testsuite/gdb.base/signull.exp122
-rw-r--r--gdb/testsuite/gdb.base/sigstep.c68
-rw-r--r--gdb/testsuite/gdb.base/sigstep.exp423
-rw-r--r--gdb/testsuite/gdb.base/sizeof.exp56
-rw-r--r--gdb/testsuite/gdb.base/step-test.exp134
-rw-r--r--gdb/testsuite/gdb.base/store.exp87
-rw-r--r--gdb/testsuite/gdb.base/structs.exp100
-rw-r--r--gdb/testsuite/gdb.base/structs2.exp12
-rw-r--r--gdb/testsuite/gdb.base/unload.c58
-rw-r--r--gdb/testsuite/gdb.base/unload.exp144
-rw-r--r--gdb/testsuite/gdb.base/unloadshr.c24
-rw-r--r--gdb/testsuite/gdb.base/whatis.c24
-rw-r--r--gdb/testsuite/gdb.base/whatis.exp19
-rw-r--r--gdb/testsuite/gdb.cp/classes.exp740
-rw-r--r--gdb/testsuite/gdb.cp/ctti.exp26
-rw-r--r--gdb/testsuite/gdb.cp/derivation.exp133
-rw-r--r--gdb/testsuite/gdb.cp/inherit.exp703
-rw-r--r--gdb/testsuite/gdb.cp/m-static.exp14
-rw-r--r--gdb/testsuite/gdb.cp/namespace.exp6
-rw-r--r--gdb/testsuite/gdb.cp/pr-1553.cc53
-rw-r--r--gdb/testsuite/gdb.cp/pr-574.cc20
-rw-r--r--gdb/testsuite/gdb.cp/printmethod.cc20
-rw-r--r--gdb/testsuite/gdb.cp/psmang1.cc20
-rw-r--r--gdb/testsuite/gdb.cp/psmang2.cc20
-rw-r--r--gdb/testsuite/gdb.cp/ref-types.cc20
-rw-r--r--gdb/testsuite/gdb.cp/rtti.exp26
-rw-r--r--gdb/testsuite/gdb.cp/templates.exp10
-rw-r--r--gdb/testsuite/gdb.cp/try_catch.cc20
-rw-r--r--gdb/testsuite/gdb.cp/userdef.cc20
-rw-r--r--gdb/testsuite/gdb.cp/virtfunc.cc20
-rw-r--r--gdb/testsuite/gdb.cp/virtfunc.exp504
-rw-r--r--gdb/testsuite/gdb.fortran/Makefile.in34
-rw-r--r--gdb/testsuite/gdb.gdb/complaints.exp26
-rw-r--r--gdb/testsuite/gdb.gdb/observer.exp144
-rw-r--r--gdb/testsuite/gdb.gdb/selftest.exp (renamed from gdb/testsuite/gdb.base/selftest.exp)27
-rw-r--r--gdb/testsuite/gdb.gdb/xfullpath.exp26
-rw-r--r--gdb/testsuite/gdb.hp/gdb.base-hp/reg.exp154
-rw-r--r--gdb/testsuite/gdb.java/jmain.exp67
-rw-r--r--gdb/testsuite/gdb.java/jmain.java7
-rw-r--r--gdb/testsuite/gdb.java/jmisc.exp4
-rw-r--r--gdb/testsuite/gdb.java/jmisc1.exp4
-rw-r--r--gdb/testsuite/gdb.java/jmisc2.exp91
-rw-r--r--gdb/testsuite/gdb.mi/basics.c22
-rw-r--r--gdb/testsuite/gdb.mi/gdb792.exp2
-rw-r--r--gdb/testsuite/gdb.mi/mi-basics.exp2
-rw-r--r--gdb/testsuite/gdb.mi/mi-break.exp61
-rw-r--r--gdb/testsuite/gdb.mi/mi-cli.exp45
-rw-r--r--gdb/testsuite/gdb.mi/mi-console.exp2
-rw-r--r--gdb/testsuite/gdb.mi/mi-disassemble.exp59
-rw-r--r--gdb/testsuite/gdb.mi/mi-eval.exp10
-rw-r--r--gdb/testsuite/gdb.mi/mi-file.exp32
-rw-r--r--gdb/testsuite/gdb.mi/mi-hack-cli.exp2
-rw-r--r--gdb/testsuite/gdb.mi/mi-read-memory.exp2
-rw-r--r--gdb/testsuite/gdb.mi/mi-regs.exp2
-rw-r--r--gdb/testsuite/gdb.mi/mi-return.exp10
-rw-r--r--gdb/testsuite/gdb.mi/mi-simplerun.exp52
-rw-r--r--gdb/testsuite/gdb.mi/mi-stack.exp14
-rw-r--r--gdb/testsuite/gdb.mi/mi-stepi.exp36
-rw-r--r--gdb/testsuite/gdb.mi/mi-until.exp2
-rw-r--r--gdb/testsuite/gdb.mi/mi-var-block.exp29
-rw-r--r--gdb/testsuite/gdb.mi/mi-var-child.exp75
-rw-r--r--gdb/testsuite/gdb.mi/mi-var-cmd.exp38
-rw-r--r--gdb/testsuite/gdb.mi/mi-var-display.exp28
-rw-r--r--gdb/testsuite/gdb.mi/mi-watch.exp32
-rw-r--r--gdb/testsuite/gdb.mi/mi2-basics.exp3
-rw-r--r--gdb/testsuite/gdb.mi/mi2-break.exp61
-rw-r--r--gdb/testsuite/gdb.mi/mi2-cli.exp45
-rw-r--r--gdb/testsuite/gdb.mi/mi2-console.exp2
-rw-r--r--gdb/testsuite/gdb.mi/mi2-disassemble.exp59
-rw-r--r--gdb/testsuite/gdb.mi/mi2-eval.exp10
-rw-r--r--gdb/testsuite/gdb.mi/mi2-file.exp22
-rw-r--r--gdb/testsuite/gdb.mi/mi2-hack-cli.exp2
-rw-r--r--gdb/testsuite/gdb.mi/mi2-read-memory.exp2
-rw-r--r--gdb/testsuite/gdb.mi/mi2-regs.exp2
-rw-r--r--gdb/testsuite/gdb.mi/mi2-return.exp10
-rw-r--r--gdb/testsuite/gdb.mi/mi2-simplerun.exp52
-rw-r--r--gdb/testsuite/gdb.mi/mi2-stack.exp14
-rw-r--r--gdb/testsuite/gdb.mi/mi2-stepi.exp36
-rw-r--r--gdb/testsuite/gdb.mi/mi2-until.exp2
-rw-r--r--gdb/testsuite/gdb.mi/mi2-var-block.exp29
-rw-r--r--gdb/testsuite/gdb.mi/mi2-var-child.exp75
-rw-r--r--gdb/testsuite/gdb.mi/mi2-var-cmd.exp38
-rw-r--r--gdb/testsuite/gdb.mi/mi2-var-display.exp28
-rw-r--r--gdb/testsuite/gdb.mi/mi2-watch.exp32
-rw-r--r--gdb/testsuite/gdb.mi/pthreads.c1
-rw-r--r--gdb/testsuite/gdb.mi/var-cmd.c21
-rw-r--r--gdb/testsuite/gdb.stabs/exclfwd.exp72
-rw-r--r--gdb/testsuite/gdb.stabs/exclfwd.h22
-rw-r--r--gdb/testsuite/gdb.stabs/exclfwd1.c34
-rw-r--r--gdb/testsuite/gdb.stabs/exclfwd2.c30
-rw-r--r--gdb/testsuite/gdb.stabs/weird.exp2
-rw-r--r--gdb/testsuite/gdb.threads/bp_in_thread.exp (renamed from gdb/testsuite/gdb.cp/pr-1553.exp)45
-rw-r--r--gdb/testsuite/gdb.threads/killed.c20
-rw-r--r--gdb/testsuite/gdb.threads/manythreads.c68
-rw-r--r--gdb/testsuite/gdb.threads/manythreads.exp127
-rw-r--r--gdb/testsuite/gdb.threads/pthread_cond_wait.c76
-rw-r--r--gdb/testsuite/gdb.threads/pthread_cond_wait.exp73
-rw-r--r--gdb/testsuite/gdb.threads/pthreads.c3
-rw-r--r--gdb/testsuite/gdb.threads/pthreads.exp7
-rw-r--r--gdb/testsuite/gdb.threads/schedlock.c21
-rw-r--r--gdb/testsuite/gdb.threads/staticthreads.c73
-rw-r--r--gdb/testsuite/gdb.threads/staticthreads.exp95
-rw-r--r--gdb/testsuite/gdb.threads/thread-specific.c2
-rw-r--r--gdb/testsuite/gdb.threads/thread_check.c75
-rw-r--r--gdb/testsuite/gdb.threads/thread_check.exp96
-rw-r--r--gdb/testsuite/gdb.threads/watchthreads.exp125
-rw-r--r--gdb/testsuite/lib/compiler.c41
-rw-r--r--gdb/testsuite/lib/compiler.cc39
-rw-r--r--gdb/testsuite/lib/cp-support.exp469
-rw-r--r--gdb/testsuite/lib/gdb.exp289
-rw-r--r--gdb/testsuite/lib/insight-support.exp318
-rw-r--r--gdb/testsuite/lib/java.exp19
186 files changed, 9631 insertions, 5966 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index a89c60beaf2..aa6abb45d22 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,1027 @@
+2004-09-14 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.threads/killed.c: Include <stdlib.h>.
+ * gdb.threads/pthreads.c: Likewise.
+
+2004-09-14 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.threads/killed.c: Add copyright notice.
+
+2004-09-10 Jason Molenda (jmolenda@apple.com)
+
+ * gdb.base/define.exp: Two new tests to verify zero space chars
+ after 'if' and 'while' commands in a user-defined command is correctly
+ parsed.
+
+2004-09-08 Andrew Cagney <cagney@gnu.org>
+
+ * gdb.base/signals.exp (signal_tests_1): Delete. Merge signal
+ delivery test with duplicate at end of file.
+
+2004-09-06 Mark Kettenis <kettenis@jive.nl>
+
+ * gdb.base/unload.exp: Link with -dl on *-*-solaris*.
+
+2004-09-05 Michael Chastain <mec.gnu@mindspring.com>
+
+ * config/hppro.exp: Removed.
+
+2004-09-05 Michael Chastain <mec.gnu@mindspring.com>
+
+ * config/sparclet.exp: Removed.
+
+2004-09-05 Michael Chastain <mec.gnu@mindspring.com>
+
+ * config/udi.exp: Removed.
+
+2004-09-02 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.base/sigstep.exp (advance): Use "-continue_timer" option
+ of "exp_continue".
+ (advancei): Likewise.
+
+2004-09-01 Jeff Johnston <jjohnstn@redhat.com>
+
+ * gdb.base/unload.exp: Fix so messages aren't duplicated.
+
+2004-09-01 Manoj Iyer <manjo@austin.ibm.com>
+
+ * gdb.gdb/complaints.exp (setup_test): Use new gdb.exp functionality
+ to check for nodebug in executable.
+ * gdb.gdb/observer.exp (setup_test): Likewise.
+ * gdb.gdb/selftest.exp (test_with_self): Likewise.
+ * gdb.gdb/xfullpath.exp (setup_test): Likewise.
+
+2004-09-01 Andrew Cagney <cagney@gnu.org>
+
+ * gdb.threads/staticthreads.c, gdb.threads/staticthreads.exp: New
+ files.
+
+2004-09-01 Jeff Johnston <jjohnstn@redhat.com>
+
+ * gdb.base/unload.exp: Fix expected warning message to match
+ latest format.
+
+2004-09-01 Corinna Vinschen <vinschen@redhat.com>
+
+ * gdb.base/call-rt-st.exp: Fix typos.
+
+2004-08-31 Manoj Iyer <manjo@austin.ibm.com>
+
+ * gdb.threads/thread_check.exp: New testcase.
+ * gdb.threads/thread_check.c: New testcase.
+
+2004-08-31 Andrew Cagney <cagney@gnu.org>
+
+ * gdb.base/sigstep.exp (breakpoint_to_handler_entry)
+ (skip_to_handler_entry): New procedures. Test stepping into a
+ handler when the breakpoint is at the handler's entry point.
+
+2004-08-30 Andrew Cagney <cagney@gnu.org>
+
+ * gdb.base/sigstep.exp (breakpoint_over_handler): Remove kfail
+ gdb/1757.
+
+2004-08-27 Michael Chastain <mec.gnu@mindspring.com>
+
+ With code from Manoj Iyer <manjo@austin.ibm.com>:
+ * lib/gdb.exp (gdb_file_cmd): Return more information in the
+ return value. Add an arm for "no debugging symbols found".
+ Change a stray "error" to "perror".
+ (gdb_run_cmd): Adapt to new return value.
+ * gdb.base/remote.exp: Adapt to new return value.
+ * gdb.gdb/complaints.exp: Likewise.
+ * gdb.gdb/observer.exp: Likewise.
+ * gdb.gdb/selftest.exp: Likewise.
+ * gdb.gdb/xfullpath.exp: Likewise.
+
+2004-08-27 Joel Brobecker <brobecker@gnat.com>
+
+ * gdb.threads/bp_in_thread.exp: New testcase.
+
+2004-08-27 Michael Chastain <mec.gnu@mindspring.com>
+
+ Fix PR testsuite/1735.
+ * gdb.threads/schedlock.c (thread_function): Add a cast
+ to suppress a gcc warning.
+ * gdb.threads/thread-specific.c (thread_function): Likewise.
+
+2004-08-26 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.base/unload.c: Include <stdlib.h>.
+
+2004-08-26 Michael Chastain <mec.gnu@mindspring.com>
+
+ From Paul Gilliam <pgilliam@us.ibm.com>:
+ * gdb.base/call-sc.exp (test_scalar_returns): Make sure PC is
+ synchronized after the "return".
+
+2004-08-26 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.mi/basics.c: Include <stdio.h>.
+ * gdb.mi/pthreads.c: Include <stdlib.h>.
+ * gdb.mi/var-cmd.c: Include <stdlib.h>.
+
+2004-08-26 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.threads/schedlock.c: Add copyright notice.
+
+2004-08-25 Andrew Cagney <cagney@gnu.org>
+
+ * gdb.base/sigstep.exp (breakpoint_to_handler, skip_to_handler)
+ (skip_over_handler, breakpoint_over_hander): New test procedures.
+ (advance, advancei): Add a proper prefix, do not use
+ rerun_to_main.
+ * gdb.base/sigstep.c (main): Change to use an infinite loop.
+
+2004-08-24 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.mi/basics.c: Add copyright notice.
+ * gdb.mi/var-cmd.c: Add copyright notice.
+
+2004-08-23 Michael Chastain <mec.gnu@mindspring.com>
+
+ * lib/gdb.exp: Remove signed_keyword_not_used.
+ * lib/compiler.c: Likewise.
+ * lib/compiler.cc: Likewise.
+
+2004-08-23 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.base/whatis.c: Remove conditional disabling of "signed".
+ * gdb.base/whatis.exp: Remove signed_keyword_not_used.
+
+2004-08-23 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.base/whatis.c: Add copyright notice.
+
+2004-08-20 Mark Kettenis <kettenis@gnu.org>
+
+ * gdb.arch/i386-prologue.exp (skip_breakpoint): New function. Use
+ it to skip the breakpoints encoded in the inline assembly.
+
+2004-08-20 Michael Chastain <mec.gnu@mindspring.com>
+
+ * Makefile.in: Add gdb.fortran.
+
+2004-08-20 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.base/call-sc.exp (test_scalar_returns):
+ Fix cut-and-paste glitch in "Make fun return now".
+
+2004-08-17 Michael Chastain <mec.gnu@mindspring.com>
+
+ * configure.in: Add gdb.fortran.
+ * configure: Regenerate.
+ * gdb.fortran/Makefile.in: New file.
+ * lib/gdb.exp (skip_fortran_tests): New procedure.
+
+2004-08-17 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.mi/mi-var-block.exp: Use gdb_get_line_number. Remove
+ reference to bug-gnu@prep.ai.mit.edu.
+ * gdb.mi/mi-var-child.exp: Likewise.
+ * gdb.mi/mi-var-cmd.exp: Likewise.
+ * gdb.mi/mi-var-display.exp: Likewise.
+ * gdb.mi/mi2-var-block.exp: Likewise.
+ * gdb.mi/mi2-var-child.exp: Likewise.
+ * gdb.mi/mi2-var-cmd.exp: Likewise.
+ * gdb.mi/mi2-var-display.exp: Likewise.
+
+2004-08-15 Mark Kettenis <kettenis@gnu.org>
+
+ * gdb.base/unload.c (main): Make local variable msg const.
+
+2004-08-15 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.mi/mi-cli.exp: Use gdb_get_line_number. Remove reference
+ to bug-gnu@prep.ai.mit.edu.
+ * gdb.mi/mi-disassemble.exp: Likewise.
+ * gdb.mi/mi-eval.exp: Likewise.
+ * gdb.mi/mi-file.exp: Likewise. Also, add comment about the
+ default line number.
+ * gdb.mi/mi-return.exp: Likewise.
+ * gdb.mi/mi-simplerun.exp: Likewise.
+ * gdb.mi/mi-stack.exp: Likewise.
+ * gdb.mi/mi-stepi.exp: Likewise. Also, replace wildcarded line
+ number with explicit range test.
+ * gdb.mi/mi-watch.exp: Likewise.
+ * gdb.mi/mi2-break.exp: Likewise.
+ * gdb.mi/mi2-cli.exp: Likewise.
+ * gdb.mi/mi2-disassemble.exp: Likewise.
+ * gdb.mi/mi2-eval.exp: Likewise.
+ * gdb.mi/mi2-file.exp: Likewise. Also, add comment about the
+ default line number.
+ * gdb.mi/mi2-return.exp: Likewise.
+ * gdb.mi/mi2-simplerun.exp: Likewise.
+ * gdb.mi/mi2-stack.exp: Likewise.
+ * gdb.mi/mi2-stepi.exp: Likewise. Also, replace wildcarded line
+ number with explicit range test.
+ * gdb.mi/mi2-watch.exp: Likewise.
+
+2004-08-15 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.cp/ctti.exp: Tweak srcfile and objfile to have no slashes.
+ * gdb.cp/m-static.exp: Likewise.
+ * gdb.cp/rtti.exp: Likewise.
+
+2004-08-14 Mark Kettenis <kettenis@gnu.org>
+
+ * gdb.base/bigcore.c: Include <sys/types.h> and <sys/time.h>.
+
+2004-08-14 Eli Zaretskii <eliz@gnu.org>
+
+ * ChangeLog: Prefix Local Variables with semi-colons and indent
+ the reference to older ChangeLog files, to fix fontification in
+ Emacs.
+
+2004-08-13 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.mi/mi-break.exp: Use gdb_get_line_number.
+ * gdb.mi/mi2-break.exp: Likewise.
+
+2004-08-13 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.gdb/selftest.exp: Revert removal of call to init_malloc.
+
+2004-08-13 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.cp/inherit.exp: Use cp_test_ptype_class.
+
+2004-08-13 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.cp/classes.exp: Remove unused declarations. Just let
+ test names default instead of providing special names. Remove
+ extraneous demangler test.
+
+2004-08-12 Jeff Johnston <jjohnstn@redhat.com>
+
+ * gdb.base/unload.exp: New test for breakpoints in dynamically
+ loaded libraries.
+ * gdb.base/unload.c: Ditto.
+ * gdb.base/unloadshr.c: Ditto.
+
+2004-08-12 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.cp/classes.exp (test_ptype_class_objects): Call
+ cp_test_ptype_class.
+ (test_enums): Likewise.
+
+2004-08-10 Andrew Cagney <cagney@gnu.org>
+
+ * gdb.threads/staticthreads.c, gdb.threads/staticthreads.exp: New
+ files.
+
+2004-08-10 Andrew Cagney <cagney@gnu.org>
+
+ * gdb.gdb/selftest.exp (do_steps_and_nexts): Remove code to skip
+ init_malloc call.
+
+2004-08-10 Michael Chastain <mec.gnu@mindspring.com>
+
+ * ChangeLog: Add copyright notice. The notice is copied
+ from emacs 21.3 top level ChangeLog.
+
+2004-08-09 Michael Chastain <mec.gnu@mindspring.com>
+
+ * lib/cp-support.exp: New file.
+ * lib/cp-support.exp (cp_test_type_class): New function.
+ * gdb.cp/derivation.exp: Use cp_test_ptype_class.
+ * gdb.cp/virtfunc.exp (test_one_ptype): Removed.
+ * gdb.cp/virtfunc.exp (test_ptype_of_classes): Use
+ cp_test_ptype_class.
+
+2004-08-09 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.mi/mi2-basics.exp, gdb.mi/mi2-break.exp,
+ gdb.mi/mi2-console.exp, gdb.mi/mi2-disassemble.exp,
+ gdb.mi/mi2-eval.exp, gdb.mi/mi2-file.exp, gdb.mi/mi2-hack-cli.exp,
+ gdb.mi/mi2-read-memory.exp, gdb.mi/mi2-regs.exp,
+ gdb.mi/mi2-return.exp, gdb.mi/mi2-simplerun.exp,
+ gdb.mi/mi2-stack.exp, gdb.mi/mi2-stepi.exp, gdb.mi/mi2-until.exp,
+ gdb.mi/mi2-var-block.exp, gdb.mi/mi2-var-child.exp,
+ gdb.mi/mi2-var-cmd.exp, gdb.mi/mi2-var-display.exp,
+ gdb.mi/mi2-watch.exp: Update copyright years.
+
+2004-08-09 Mark Kettenis <kettenis@gnu.org>
+
+ * gdb.base/sigaltstack.exp: Provide proper anchoring.
+
+2004-08-09 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.mi/gdb792.exp, gdb.mi/mi-basics.exp, gdb.mi/mi-break.exp,
+ gdb.mi/mi-console.exp, gdb.mi/mi-disassemble.exp,
+ gdb.mi/mi-eval.exp, gdb.mi/mi-file.exp, gdb.mi/mi-hack-cli.exp,
+ gdb.mi/mi-read-memory.exp, gdb.mi/mi-regs.exp,
+ gdb.mi/mi-return.exp, gdb.mi/mi-simplerun.exp,
+ gdb.mi/mi-stack.exp, gdb.mi/mi-stepi.exp, gdb.mi/mi-until.exp,
+ gdb.mi/mi-var-block.exp, gdb.mi/mi-var-child.exp,
+ gdb.mi/mi-var-cmd.exp, gdb.mi/mi-var-display.exp,
+ gdb.mi/mi-watch.exp: Update copyright years.
+
+2004-08-08 Daniel Jacobowitz <dan@debian.org>
+
+ PR gdb/1738
+ * gdb.base/signals.exp (signal_tests_1): KFAIL bug in continuing
+ from a breakpoint with a pending signal.
+
+2004-08-08 Daniel Jacobowitz <dan@debian.org>
+
+ PR gdb/1736
+ * lib/gdb.exp (gdb_test_multiple): Handle return -code return.
+ * gdb.base/sigaltstack.exp (finish_test): Consume output until
+ the prompt.
+ * gdb.base/sigstep.exp: Add KFAIL for gdb/1736.
+
+2004-08-08 Daniel Jacobowitz <dan@debian.org>
+
+ * gdb.cp/templates.exp: Handle (char)115 for template argument 's'.
+
+2004-08-08 Daniel Jacobowitz <dan@debian.org>
+
+ PR gdb/1736
+ * gdb.base/sigaltstack.exp (finish_test): New procedure. KFAIL
+ for i?86-*-linux*.
+
+2004-08-08 Daniel Jacobowitz <dan@debian.org>
+
+ * gdb.arch/i386-prologue.exp: Compile without debug information.
+
+2004-08-08 Michael Chastain <mec.gnu@mindspring.com>
+
+ * lib/gdb.exp (gdb_get_line_number): Rewrite with native tcl
+ rather than asking gdb to search.
+
+2004-08-05 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.base/gcore.c: Include <string.h>.
+
+2004-08-05 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.base/gcore.c: Add copyright notice.
+
+2004-08-05 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.base/freebpcmd.c: Include <stdio.h>.
+ * gdb.base/long_long.c: Include <string.h>.
+ * gdb.base/sigaltstack.c: Include <stdlib.h> <string.h>.
+ * gdb.base/siginfo.c: Include <string.h>.
+ * gdb.base/sigstep.c: Include <string.h>.
+
+2004-08-04 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.base/complex.c: Include <stdlib.h>.
+
+2004-08-04 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.base/complex.c: Add copyright notice.
+
+2004-08-04 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.base/charset.c: Include <stdlib.h>.
+
+2004-08-04 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.base/auxv.c: Include <stdlib.h>.
+
+2004-08-04 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.base/auxv.c: Add copyright notice.
+
+2004-08-04 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.base/coremaker.c: Add copyright notice.
+ * gdb.base/coremaker2.c: Add copyright notice.
+
+2004-08-04 Andrew Cagney <cagney@gnu.org>
+
+ * gdb.base/store.exp: Update copyright.
+ (check_set, up_set, check_struct, up_struct): Add a prefix to test
+ names, do not import gdb_prompt.
+
+2004-08-01 Andrew Cagney <cagney@gnu.org>
+
+ Fix PR testsuite/1729.
+ * gdb.base/dump.exp: Add test name to callers of capture_value, do
+ not use capture_value with value 4.
+ (capture_value): Add optional test name parameter.
+ (test_reload_saved_value, test_restore_saved_value): Use $msg as
+ the prefix, pass to capture_value.
+
+2004-08-01 Mark Kettenis <kettenis@gnu.org>
+
+ * gdb.arch/i386-prologue.exp: Add testcase for standard prolgue.
+ * gdb.arch/i386-prologue.c (standard): New prototype and function.
+ (main): Call new function.
+
+2004-07-31 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.cp/namespace.exp: Accept more varieties of ptype output.
+
+2004-07-31 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.cp/virtfunc.exp: Accept more varieties of ptype output.
+
+2004-07-31 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.cp/inherit.exp: Accept more varieties of ptype output.
+ Accept more values of vtbl pointer. Remove some messages
+ about "obsolete gcc or gdb".
+
+2004-07-30 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.cp/classes.exp: Accept more varieties of ptype output.
+
+2004-07-30 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.base/asm-source.exp: Properly convert target board
+ debug flags from gcc format to binutils format.
+
+2004-07-28 Mark Kettenis <kettenis@gnu.org>
+
+ * gdb.arch/i386-prologue.exp: Remove KFAIL of "backtrace in
+ gdb1718". PR backtrace/1718 partially fixed.
+
+2004-07-27 Jeff Johnston <jjohnstn@redhat.com>
+
+ * gdb.threads/watchthreads.exp: New test for threaded watchpoints.
+
+2004-07-26 Nick Clifton <nickc@redhat.com>
+
+ * gdb.asm/asm-source.exp (debug-flags): New variable. If a known
+ good default value for a specific architecture is available then
+ set it to that value. Otherwise default to the -gstabs switch.
+ Remove the -g... switches from the asm-flags variable. Allow the
+ target board info to override the value if it wants to. Pass the
+ switch on the assembler command line.
+
+2004-07-23 Mark Kettenis <kettenis@gnu.org>
+
+ * gdb.arch/i386-prologue.exp: Add testcase for PR backtrace/1718.
+ * gdb.arch/i386-prologue.c (gdb1718): New prototype and function.
+ (main): Call new function.
+
+2004-07-22 Michael Chastain <mec.gnu@mindspring.com>
+
+ Test for PR exp/1715.
+ * gdb.base/radix.exp: Refactor common procedures. Make all
+ test names unique. Change XFAIL to KFAIL.
+
+2004-07-20 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.ada/gnat_ada.gpr.in: Rename from here ...
+ * gdb.ada/gnat_ada.gin: ... to here.
+ * configure.in: Use gnat_ada.gin.
+ * configure: Regenerate.
+
+2004-07-20 Andrew Cagney <cagney@gnu.org>
+
+ * gdb.base/signals.exp: Replace send_gdb and gdb_expect with
+ gdb_test and gdb_test_multiple. Delete bash_bug. Delete suspect
+ XFAILs. Clean up test messages and comments. Check backtraces.
+ Delete re-sync code.
+
+2004-07-19 Michael Chastain <mec.gnu@mindspring.com>
+
+ Fix PR cli/740.
+ * gdb.base/annota1.exp: Honor gdb,nosignals.
+ * gdb.base/annota3.exp: Likewise.
+
+2004-07-19 Michael Chastain <mec.gnu@mindspring.com>
+
+ * lib/java.exp: Update copyright notice.
+
+2004-07-19 Andrew Cagney <cagney@gnu.org>
+
+ * gdb.base/selftest.exp: Copy file from here ...
+ * gdb.gdb/selftest.exp: ... to here.
+
+2004-07-16 Andrew Cagney <cagney@redhat.com>
+
+ * lib/insight-support.exp: Delete file.
+ * lib/java.exp (java_init): Fix copyright.
+
+2004-07-16 Andrew Cagney <cagney@gnu.org>
+
+ * gdb.base/restore.c: Append "prologue" to comments marking the a
+ function's prologue.
+ * gdb.base/restore.exp: Update copyright, re-indent.
+ (restore_tests): Use gdb_test_multiple. Add "calleeN calls
+ callerN" prefix where needed. Update patterns that match a
+ function's prologue.
+
+2004-07-16 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.base/restore.c: Add copyright notice.
+
+2004-07-16 Andrew Cagney <cagney@gnu.org>
+
+ * gdb.base/logical.exp: Update copyright.
+ (evaluate): New procedure. Use to re-implement tests using
+ several tables.
+
+2004-07-14 Martin Hunt <hunt@redhat.com>
+
+ * lib/insight-support.exp (gdbtk_start): Unset TCL_LIBRARY
+ which fixes some problems where init.tcl was not found.
+
+2004-07-13 Andrew Cagney <cagney@gnu.org>
+
+ * gdb.base/sizeof.exp: Skip test when no inferior I/O.
+ (check_sizeof, check_valueof): Do not include the output in the
+ test name. Use gdb_test.
+ (get_valueof): Use gdb_test_multiple.
+
+ * gdb.base/step-test.exp: Update copyright. Use
+ gdb_test_multiple. Ensure that test names do not include
+ architecture dependent output.
+
+ * gdb.gdb/observer.exp: Update copyright.
+ (setup_test): Use gdb_test_multiple.
+ (attach_first_observer, attach_second_observer)
+ (attach_third_observer, detach_first_observer)
+ (detach_second_observer, detach_third_observer)
+ (reset_counters, check_counters): Make $message a prefix.
+ (test_normal_stop_notifications): Add "args" parameter - a list of
+ init functions to be called. Make $message a prefix,
+ (test_observer_normal_stop): Change the message prefixes so that
+ they are unique, pass the attach / detach procedures to
+ test_normal_stop_notifications.
+
+ * gdb.base/signull.exp (test_segv): Prefix all tests with
+ "${name}". Clean up test messages.
+
+ * gdb.base/annota3.exp, gdb.base/annota1.exp: Update copyright.
+
+ * gdb.base/ena-dis-br.exp: Update copyright.
+ (break_at): New function. Replace send_gdb with gdb_test,
+ break_at, and gdb_test_multiple. Replace XFAIL of "continue with
+ ignore count, not stopped at bpt", with KFAIL.
+
+2004-07-13 Corinna Vinschen <vinschen@redhat.com>
+
+ * gdb.base/attach.exp: Remove cleanupfile handling.
+
+2004-07-12 Andrew Cagney <cagney@gnu.org>
+
+ * gdb.base/annota1.exp: Cleanup corefile test name.
+ * gdb.base/annota3.exp: Ditto.
+
+2004-07-12 Andrew Cagney <cagney@gnu.org>
+
+ * gdb.base/signals.exp: Clean up copyright, re-indent.
+
+ * gdb.base/attach.exp: Replace send_gdb and gdb_expect with
+ gdb_test and gdb_test_multiple.
+
+2004-07-08 Jeff Johnston <jjohnstn@redhat.com>
+
+ * gdb.java/jmain.exp: Fix expected line number for main to
+ break at. Set XFAIL for break at main test since gcj does not
+ provide line number info for first statement in main.
+
+2004-07-08 Andrew Cagney <cagney@gnu.org>
+
+ * gdb.base/attach.exp: Cleanup copyright. Re-indent.
+
+ * gdb.base/sigbpt.exp: Make the common part of each test name a
+ prefix instead of suffix.
+
+2004-07-07 Bob Rossi <bob_rossi@cox.net>
+
+ * gdb.mi/mi2-file.exp: Revert to version 1.1, except changed name of
+ test from test_tbreak_creation_and_listing to
+ test_file_list_exec_source_file
+ * gdb.mi/mi-file.exp: Add test for -file-list-exec-source-files
+ Changed name of test from test_tbreak_creation_and_listing to
+ test_file_list_exec_source_file
+
+2004-07-07 Jeff Johnston <jjohnstn@redhat.com>
+
+ * gdb.java/jmisc.exp: Fix expected output of ptype to look for
+ the jmisc() constructor instead of <init>.
+ * gdb.java/jmisc1.exp: Ditto.
+
+2004-07-07 Andrew Cagney <cagney@gnu.org>
+
+ * gdb.base/sigbpt.exp (stepi_out): Check for a single step
+ corrupting the PC.
+
+2004-07-06 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.cp/templates.exp: Accept whitespace change in demangler
+ output.
+
+2004-07-06 Andrew Cagney <cagney@gnu.org>
+
+ * gdb.base/sigbpt.exp, gdb.base/sigbpt.c: New test.
+
+2004-07-02 Michael Chastain <mec.gnu@mindspring.com>
+
+ * lib/compiler.c: Accept __HP_CXD_SPP for old hp ansi c compiler.
+ * lib/compiler.cc: Likewise.
+
+2004-06-30 Michael Chastain <mec.gnu@mindspring.com>
+
+ * lib/compiler.cc: Work around string preprocessing problem
+ with old hp c++ compiler.
+ * lib/compiler.c: Likewise.
+
+2004-06-29 Corinna Vinschen <vinschen@redhat.com>
+
+ * gdb.arch/i386-prologue.c: Add copyright header. Use preprocessor
+ directives to conditionalize symbol prefixing.
+ * gdb.arch/i386-prologue.exp: Allow symbol prefixing by adding
+ additional_flags handling. Add underscore prefix for Cygwin.
+ * gdb.arch/i386-unwind.c: Use preprocessor directives to
+ conditionalize symbol prefixing.
+ * gdb.arch/i386-unwind.exp: Allow symbol prefixing by adding
+ additional_flags handling. Add underscore prefix for Cygwin.
+
+2004-06-29 Corinna Vinschen <vinschen@redhat.com>
+
+ * gdb.base/bigcore.exp: Skip test on Cygwin.
+
+2004-06-28 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.hp/gdb.base-hp/reg.exp: Accept both old and new gdb output
+ formats for "info register". Use gdb_test_multiple. Fix
+ the "invalid register" test.
+
+2004-06-28 Corinna Vinschen <vinschen@redhat.com>
+
+ * gdb.base/attach.exp: Fix copyright date. Set testpid to Windows
+ PID for Cygwin. Add Cygwin specific strings to check for in some
+ tests.
+ (do_attach_tests): Add a test for user interaction when attaching
+ to a process with no matching symbol table already loaded.
+
+2004-06-26 Andrew Cagney <cagney@gnu.org>
+
+ Test PR java/1567 and PR java/1565.
+ * gdb.java/jmain.exp, gdb.java/jmain.java: New files.
+ * gdb.java/jmisc2.exp: Delete file.
+
+2004-06-26 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.hp/gdb.base-hp/reg.exp: Update copyright notice.
+
+2004-06-25 Corinna Vinschen <vinschen@redhat.com>
+
+ * gdb.base/attach.exp (do_attach_tests): Don't forget to kill second
+ attach process.
+
+2004-06-23 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.cp/pr-1553.exp: Remove.
+
+2004-06-22 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.cp/pr-1553.cc: Remove.
+ * gdb.cp/pr-1553.exp: Disable this test.
+
+2004-06-20 Jim Blandy <jimb@redhat.com>
+
+ Fix PR testsuite/1680.
+ * gdb.arch/i386-sse.exp: Properly quote curly braces in
+ regular expressions.
+
+2004-06-19 Michael Chastain <mec.gnu@mindspring.com>
+
+ Fix PR testsuite/1679.
+ * gdb.arch/i386-sse.exp: Do not call gdb_suppress_entire_file.
+ Issue an UNSUPPORTED result instead.
+
+2004-06-18 Jim Blandy <jimb@redhat.com>
+
+ * gdb.base/charset.exp: Only send a control-C if we see a new
+ prompt and incomplete command.
+
+2004-06-18 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.cp/pr-574.cc: Add copyright notice.
+
+2004-06-17 Jim Blandy <jimb@redhat.com>
+
+ * gdb.base/charset.exp: Don't refer to $expect_out(1,string) in
+ cases where the regexp has no groups; this grabs random text from
+ the previous test suite, whatever that was.
+
+2004-06-17 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.cp/printmethod.cc: Add copyright notice.
+
+2004-06-16 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.cp/psmang1.cc, gdb.cp/psmang2.cc: Add copyright notice.
+
+2004-06-16 Andrew Cagney <cagney@gnu.org>
+
+ * gdb.base/signull.c: Update copyright. Include <string.h>.
+ (bowler): Replace data_pointer with data_read
+ and data_write cases. Add code_descriptor case.
+ (zero, desc): New array and pointer.
+ (data, code): Change to simple pointers.
+ * gdb.base/signull.exp: Fix probe pattern matching a function
+ descriptor SIGSEGV. Replace data_pointer with data_read and
+ data_write tests.
+
+2004-06-16 Andrew Cagney <cagney@gnu.org>
+
+ * gdb.base/long_long.exp, gdb.base/long_long.c: Rewrite.
+
+2004-06-15 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.base/long_long.c: Add copyright notice.
+
+2004-06-15 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.base/long_long.exp: Remove reference to
+ bug-gdb@prep.ai.mit.edu. Change line-number-specific breakpoint
+ to gdb_breakpoint and gdb_continue_to_breakpoint.
+
+2004-06-14 Jim Blandy <jimb@redhat.com>
+
+ * gdb.arch/e500-regs.exp: Fix up 'print' pattern for the little-
+ endian case.
+
+2004-06-14 Andrew Cagney <cagney@gnu.org>
+
+ * gdb.base/gcore.exp (capture_command_output): Delete the always
+ passing tests containing inferior values.
+ * gdb.base/ending-run.exp: Do not include the breakpoint address
+ in the test message. Update copyright.
+ * gdb.base/sizeof.exp (check_sizeof): Do not include the type's
+ size in the test name, use gdb_test_multiple. Update copyright.
+
+2004-06-14 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.cp/ref-types.cc: Add copyright notice.
+
+2004-06-14 Michael Chastain <mec.gnu@mindspring.com>
+
+ * lib/compiler.c: Remove gcc_compiled, hp_cc_compiler,
+ hp_aCC_compiler.
+ * lib/compiler.cc: Likewise.
+ * lib/gdb.exp (get_compiler_info): Eval lines only if they are
+ 'set' commands. Log diagnostics for other lines. Set
+ gcc_compiled, hp_cc_compiler, and hp_aCC_compiler.
+
+2004-06-13 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.cp/try_catch.cc: Add copyright notice.
+
+2004-06-12 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.cp/userdef.cc: Add copyright notice.
+
+2004-06-11 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.cp/virtfunc.cc: Add copyright notice.
+
+2004-06-11 Randolph Chung <tausq@debian.org>
+
+ * gdb.base/structs2.exp: Mark two tests as xfail because of a compiler
+ problem.
+
+2004-06-10 Andrew Cagney <cagney@gnu.org>
+
+ * lib/compiler.cc, lib/compiler.c: Append either
+ __GNUC_PATCHLEVEL__, or "unknown" to the compiler_info.
+ * gdb.base/structs.exp (test_struct_calls): Check for gcc-3-3-*
+ instead of gcc-3-3.
+
+2004-06-09 Andrew Cagney <cagney@gnu.org>
+
+ * gdb.base/structs.exp (test_struct_calls): Fix KFAIL for
+ gdb/1455, bug is specific to "long long" and "double".
+
+ * gdb.base/structs.exp (test_struct_returns, test_struct_returns)
+ (test_struct_calls): Remove KFAIL of "long double" on i*86-*-*,
+ x86_64-*-*, sparc64-*-*, and sparc*-*-solaris2*. PR tdep/1447
+ fixed.
+
+2004-06-09 Andrew Cagney <cagney@gnu.org>
+
+ * gdb.base/structs.exp (test_struct_returns): Replace
+ "return_value_unknown" and "finish_value_unknown" by
+ "return_value_known" and "finish_value_known". Instead of
+ "return_value_unknown" iff "finish_value_unknown", check
+ "return_value_known" implies "finish_value_known".
+
+2004-06-08 Martin Hunt <hunt@redhat.com>
+
+ * gdb.base/float.exp: Add pattern for mips targets.
+
+2004-06-08 Randolph Chung <tausq@debian.org>
+
+ * gdb.base/float.exp: Add pattern for hppa*-* target; make the failure
+ message for unknown architectures more clear.
+
+2004-06-08 Joel Brobecker <brobecker@gnat.com>
+
+ * gdb.ada/null_record.exp: Use "start" instead of "begin" to
+ start the execution of the program.
+
+2004-06-07 Jim Blandy <jimb@redhat.com>
+
+ * gdb.arch/i386-sse.exp, gdb.arch/i386-sse.c: New tests.
+ * gdb.arch/i386-cpuid.h: New helper file.
+
+2004-06-07 Randolph Chung <tausq@debian.org>
+
+ * gdb.base/shlib-call.exp: Allow breakpoint to be added after inferior
+ has started.
+
+2004-06-04 Roland McGrath <roland@redhat.com>
+
+ Fix PR gdb/1647.
+ * gdb.base/auxv.exp (fetch_auxv): Revert last change and fix it
+ differently to be robust to output buffering differences.
+
+2004-06-04 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.threads/pthreads.exp: Update copyright years.
+ (check_control_c): Change asynchronous 'after' to synchronous.
+
+2004-06-04 Roland McGrath <roland@redhat.com>
+
+ * gdb.base/auxv.exp (fetch_auxv): Consume output fully through
+ next gdb prompt.
+
+2004-06-02 Michael Chastain <mec.gnu@mindspring.com>
+
+ Fix PR gdb/1636.
+ * gdb.threads/manythreads.exp: Change asynchronous 'after'
+ calls to synchronous.
+
+2004-05-26 Jim Blandy <jimb@redhat.com>
+
+ * gdb.arch/e500-prologue.exp, gdb.arch/e500-prologue.c: New tests.
+
+2004-05-24 Randolph Chung <tausq@debian.org>
+
+ * gdb.asm/asm-source.exp: Enable test for hppa-linux target.
+ * gdb.asm/pa.inc: New file.
+
+2004-05-22 Mark Kettenis <kettenis@gnu.org>
+
+ * gdb.base/signull.c: Use sigjmp_buf instead of jmp_buf.
+
+2004-05-21 Joel Brobecker <brobecker@gnat.com>
+ Daniel Jacobowitz <drow@mvista.com>
+
+ * lib/gdb.exp (gdb_test_multiple): Improve regexp matching the
+ GDB prompt.
+
+2004-05-20 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
+
+ * gdb.base/signull.c: Use sigsetjmp/siglongjmp instead of
+ setjmp/longjmp. Use sigaction instead of signal.
+
+2004-05-19 J. Brobecker <brobecker@gnat.com>
+ Michael Snyder <msnyder@redhat.com>
+
+ * gdb.threads/pthread_cond_wait.c: New file.
+ * gdb.threads/pthread_cond_wait.exp: New testcase.
+
+2004-05-13 Andrew Cagney <cagney@redhat.com>
+
+ * gdb.base/signull.exp, gdb.base/signull.c: New files.
+ * gdb.base/gdb1476.c, gdb.base/gdb1476.exp: Delete files.
+
+2004-05-11 Andrew Cagney <cagney@redhat.com>
+
+ * gdb.base/sigstep.exp (advancei): Update KFAILs. gdb/1613 is
+ fixed but revealed gdb/1639.
+
+2004-05-10 Andrew Cagney <cagney@redhat.com>
+
+ * gdb.base/signals.exp (signal_tests_1): Simplify "continue to
+ func1" and "next to 2nd alarm", kernel bug avoided.
+
+2004-05-10 Daniel Jacobowitz <dan@debian.org>
+
+ PR external/1568
+ * gdb.base/bigcore.exp: Check the size of the dumped core file.
+ XFAIL if it is smaller than bytes_allocated.
+ * gdb.base/bigcore.c (bytes_allocated): Make static and unsigned.
+ (main): Make chunks_allocated unsigned. Correct comment.
+
+2004-05-07 Joel Brobecker <brobecker@gnat.com>
+
+ * gdb.arch/powerpc-aix-prologue.c: New file.
+ * gdb.arch/powerpc-aix-prologue.exp: New file.
+
+2004-05-07 Jim Blandy <jimb@redhat.com>
+
+ * gdb.base/lineinc.exp, gdb.base/lineinc1.h, gdb.base/lineinc2.h,
+ gdb.base/lineinc3.h, gdb.base/lineinc.c: New tests.
+
+2004-05-06 Joel Brobecker <brobecker@gnat.com>
+
+ * gdb.base/sep.exp: No longer setup_kfail when the program was
+ built with dwarf2.
+
+2004-05-05 Jim Ingham <jingham@apple.com>
+
+ * gdb.base/pending.exp: Make sure pending breakpoints
+ preserve the ignore count.
+
+2004-04-27 Jerome Guitton <guitton@gnat.com>
+
+ * i386-prologue.exp: Add testcase for jump instruction as first
+ instruction of the real code.
+ * i386-prologue.c (jump_at_beginning): New function.
+
+2004-04-28 Mark Kettenis <kettenis@gnu.org>
+
+ * gdb.base/call-sc.exp: Remove patterns to KFAIL PR gdb/1624 on
+ x86_64-*-*.
+
+2004-04-28 Mark Kettenis <kettenis@gnu.org>
+
+ * gdb.base/call-sc.exp: Remove patterns to KFAIL PR gdb/1623 on
+ i*86-*-*.
+
+2004-04-25 Mark Kettenis <kettenis@gnu.org>
+
+ * gdb.base/call-sc.exp (start_scalars_test): Fix regular
+ expression that checks the return type.
+
+2004-04-23 Andrew Cagney <cagney@redhat.com>
+
+ * gdb.base/call-sc.exp: New test of scalar call/return values.
+ * gdb.base/call-sc.c: Ditto.
+
+2004-04-23 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
+
+ * gdb.threads/manythreads.c: Reduce thread stack size.
+
+2004-04-23 Jeff Johnston <jjohnstn@redhat.com>
+
+ * gdb.threads/manythreads.c: Add copyright notice.
+
+2004-04-23 Andrew Cagney <cagney@redhat.com>
+
+ * gdb.base/siginfo.exp: Better handle step out of signal.
+ * gdb.base/sigstep.exp: Ditto.
+
+2004-04-22 Jeff Johnston <jjohnstn@redhat.com>
+ Daniel Jacobowitz <drow@mvista.com>
+
+ * gdb.threads/manythreads.c: New testcase.
+ * gdb.threads/manythreads.exp: Ditto.
+
+2004-04-22 Jim Blandy <jimb@redhat.com>
+
+ * gdb.stabs/exclfwd.exp, gdb.stabs/exclfwd1.c,
+ gdb.stabs/exclfwd2.c, gdb.stabs/exclfwd.h: New test.
+
+2004-04-21 Michael Chastain <mec.gnu@mindspring.com>
+
+ * gdb.stabs/weird.exp: Accept full pathname for $binfile.
+
+2004-04-21 Andrew Cagney <cagney@redhat.com>
+
+ * gdb.base/sigstep.c: New file.
+ * gdb.base/sigstep.exp: New file.
+
+2004-04-16 Joel Brobecker <brobecker@gnat.com>
+
+ * gdb.gdb/observer.exp (test_normal_stop_notifications): Update
+ call to observer_notify_normal_stop.
+
+2004-04-15 Andrew Cagney <cagney@redhat.com>
+
+ * gdb.base/siginfo.c: New file.
+ * gdb.base/siginfo.exp: New file.
+
+2004-04-12 J. Brobecker <brobecker@gnat.com>
+
+ * gdb.base/sep.exp: Fix typo in comment.
+
+2004-04-12 J. Brobecker <brobecker@gnat.com>
+
+ * gdb.base/sep.c: New file.
+ * gdb.base/sep-proc.c: New file.
+ * gdb.base/sep.exp: New testcase.
+
+2004-04-09 Mark Kettenis <kettenis@gnu.org>
+
+ * gdb.base/bigcore.exp: Disable on Solaris; no sparse core file
+ support.
+
+2004-04-05 Andrew Cagney <cagney@redhat.com>
+
+ * gdb.base/sigaltstack.c: New file.
+ * gdb.base/sigaltstack.exp: New file.
+
+2004-04-04 Joel Brobecker <brobecker@gnat.com>
+
+ * gdb.base/foll-fork.exp: Update the expected output for
+ "help set follow-fork-mode", to match a change that was made
+ to the help of this variable on 2004-01-13.
+
2004-04-01 Joel Brobecker <brobecker@gnat.com>
* lib/ada.exp: Add copyright notice.
@@ -11873,11 +12897,16 @@ Sun Feb 21 10:55:55 1993 Mike Werner (mtw@poseidon.cygnus.com)
will allow them to work with the new version of dejagnu will be
made in a future update.
-For additional changes see gdb.mi/ChangeLog-1999-2003.
+ For additional changes see gdb.mi/ChangeLog-1999-2003.
-Local Variables:
-mode: change-log
-left-margin: 8
-fill-column: 74
-version-control: never
-End:
+;; Local Variables:
+;; mode: change-log
+;; left-margin: 8
+;; fill-column: 74
+;; version-control: never
+;; End:
+
+ Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+ 2003, 2004 Free Software Foundation, Inc.
+ Copying and distribution of this file, with or without modification,
+ are permitted provided the copyright notice and this notice are preserved.
diff --git a/gdb/testsuite/Makefile.in b/gdb/testsuite/Makefile.in
index 99c0a8f32b6..d9be89c5e7b 100644
--- a/gdb/testsuite/Makefile.in
+++ b/gdb/testsuite/Makefile.in
@@ -1,5 +1,5 @@
# Makefile for regression testing the GNU debugger.
-# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2002, 2003
+# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2002, 2003, 2004
# Free Software Foundation, Inc.
# This file is part of GDB.
@@ -36,7 +36,8 @@ EXEEXT = @EXEEXT@
SUBDIRS = @subdirs@
RPATH_ENVVAR = @RPATH_ENVVAR@
ALL_SUBDIRS = gdb.ada gdb.arch gdb.asm gdb.base gdb.cp gdb.disasm \
- gdb.java gdb.mi gdb.objc gdb.threads gdb.trace $(SUBDIRS)
+ gdb.fortran gdb.java gdb.mi gdb.objc gdb.threads gdb.trace \
+ $(SUBDIRS)
EXPECT = `if [ -f $${rootme}/../../expect/expect ] ; then \
echo $${rootme}/../../expect/expect ; \
diff --git a/gdb/testsuite/config/hppro.exp b/gdb/testsuite/config/hppro.exp
deleted file mode 100644
index e341ae6e9e5..00000000000
--- a/gdb/testsuite/config/hppro.exp
+++ /dev/null
@@ -1,24 +0,0 @@
-# Copyright 1997 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
-
-load_lib ../config/monitor.exp
-
-# Hppro monitor is very slow...
-set timeout 540
-verbose "Timeout is now $timeout seconds" 2
diff --git a/gdb/testsuite/config/sparclet.exp b/gdb/testsuite/config/sparclet.exp
deleted file mode 100644
index 4e2e96b60d9..00000000000
--- a/gdb/testsuite/config/sparclet.exp
+++ /dev/null
@@ -1,388 +0,0 @@
-# Copyright 1996, 1997 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.
-
-# This file was written by Michael Snyder <msnyder@cygnus.com>.
-
-# GDB support routines for a board using the sparclet remote debugging
-# protocol.
-
-load_lib remote.exp
-load_lib gdb.exp
-
-#
-# Sparclet remote run command.
-#
-
-proc gdb_start { } {
- global gdb_prompt
-
- if ![file exists loader] {
- global libdir
- set loader loader;
-
- if [target_info exists gdb_stub_offset] {
- set result [target_compile "${libdir}/stub-loader.c" $loader executable "libs=-Wl,-Ttext,[target_info gdb_stub_offset]"];
- } else {
- set result [target_compile "${libdir}/stub-loader.c" $loader executable "ldscript=[target_info gdb_stub_ldscript]"];
- }
- }
-
- verbose -log "$gdb_prompt is gdb prompt"
-
- set result 0;
- for { set y 0; } { $y < 4 } { incr y } {
- if { [default_gdb_start] != 0 } {
- return -1;
- }
-
- if [target_info exists baud] {
- send_gdb "set remotebaud [target_info baud]\n"
- gdb_expect {
- -re "$gdb_prompt" { }
- default {
- perror "Error setting baud rate."
- return -1;
- }
- }
- }
-
- for {set x 1;} { $x < 4 } {incr x} {
- set result [gdb_sparclet_startup $result];
- if { $result > 0 } {
- return 1;
- }
- # mmmmm, magic numbers.
- if { $result == -42 || $result == -43 } {
- break;
- } else {
- reboot_target;
- }
- }
- if { $x == 4 } {
- return -1;
- }
- gdb_exit;
- sleep 5;
- }
- return -1;
-}
-
-proc gdb_sparclet_startup { arg } {
- global gdb_prompt
- global GDB
- global verbose
-
- set is_running_stub 0;
-
- if [target_info exists serial] {
- set serial [target_info serial];
- } else {
- set serial [target_info netport];
- }
- set protocol [target_info gdb_protocol];
- set check_stub 1;
- if { $arg != -42 } {
- send_gdb "target $protocol $serial\n";
- # 10 seconds may be a bit short.
- gdb_expect 10 {
- -re "already.*y or n." {
- gdb_send "y\n";
- exp_continue;
- }
- -re "Remote target.*connected to.*$gdb_prompt" { set check_stub 0; }
- -re "$gdb_prompt" { }
- timeout { }
- }
- if { $check_stub } {
- verbose "timed out, checking if stub is already running"
- send_gdb "\003";
- sleep 1;
- send_gdb "\003";
- gdb_expect 10 {
- -re "$gdb_prompt" { }
- default {
- remote_close host;
- return -42;
- }
- }
- }
- }
- if [target_info exists gdb_serial] {
- set gdb_serial [target_info gdb_serial];
- } else {
- set gdb_serial $serial;
- }
- if { $check_stub } {
- send_gdb "target remote $gdb_serial\n";
- gdb_expect 15 {
- -re "Remote debugging.*$gdb_prompt" {
- verbose "stub is already running"
- set is_running_stub 1;
- }
- default {
- warning "board isn't responding";
- remote_close host;
- remote_reboot target;
- return -43;
- }
- }
- }
-
- if { $is_running_stub == 0 } {
- global srcdir
-
- if [is_remote host] {
- set loader [remote_download host "loader"];
- } else {
- set loader "loader";
- }
- send_gdb "file $loader\n";
- gdb_expect {
- -re "A program is being debug.*Kill it.*y or n. $" {
- send_gdb "y\n"
- exp_continue
- }
- -re "Load new symbol table.*y or n. $" {
- send_gdb "y\n"
- exp_continue
- }
- -re "Reading symbols from.*done..*$gdb_prompt $" {}
- -re "$gdb_prompt $" { perror "GDB couldn't find loader" }
- timeout {
- perror "(timeout) read symbol file" ;
- return -1
- }
- }
-
- send_gdb "target $protocol $serial\n";
- gdb_expect {
- -re "Remote target.*connected to.*$gdb_prompt" { }
- default {
- perror "Error reconnecting to board.";
- return -1;
- }
- }
-
- send_gdb "load $loader [target_info gdb_stub_offset]\n"
- verbose "Loading $loader into $GDB" 2
- set no_run_command 0;
- gdb_expect 1200 {
- -re "Loading.*$gdb_prompt $" {
- verbose "Loaded $loader into $GDB" 1
- }
- -re "Transfer rate:.*Switching to remote protocol.*Remote debugging" {
- set no_run_command 1;
- }
- -re "$gdb_prompt $" {
- if $verbose>1 then {
- perror "GDB couldn't load."
- }
- }
- timeout {
- if $verbose>1 then {
- perror "Timed out trying to load $arg."
- }
- }
- }
-
- if !$no_run_command {
- send_gdb "run\n";
- gdb_expect 60 {
- -re "A program is being debug.*Kill it.*y or n. $" {
- send_gdb "y\n"
- exp_continue
- }
- -re "The program being debugged .*y or n. $" {
- send_gdb "y\n"
- exp_continue
- }
- -re "Starting program:.*loader.*$" {
- verbose "Starting loader succeeded"
- }
- timeout {
- perror "(timeout) starting the loader" ;
- return -1
- }
- default {
- perror "error starting the loader";
- }
- }
- }
- sleep 2;
- send_gdb ""
- sleep 1;
- send_gdb ""
- verbose "Sent ^C^C"
- gdb_expect 10 {
- -re "Give up .and stop debugging it.*$" {
- send_gdb "y\n"
- exp_continue
- }
- -re "$gdb_prompt $" {
- verbose "Running loader succeeded"
- }
- timeout {
- warning "(timeout) interrupting the loader" ;
- remote_close host;
- }
- default {
- warning "error interrupting the loader";
- }
- }
-
- gdb_exit;
- return [gdb_start];
- }
- return 1;
-}
-
-proc gdb_run_cmd { args } {
- global gdb_prompt
-
- gdb_breakpoint exit;
- send_gdb "set \$fp=0\n";
- gdb_expect {
- -re "$gdb_prompt" { }
- }
- # This is needed for the SparcLite. Whee.
- if [target_info exists gdb,start_symbol] {
- set start_comm "jump *[target_info gdb,start_symbol]\n";
- } else {
- set start_comm "jump *start\n";
- }
- send_gdb "break copyloop\n";
- gdb_expect 10 {
- -re "Breakpoint.*$gdb_prompt $" {
- set start_comm "continue\n";
- }
- -re "$gdb_prompt $" { }
- timeout { warning "break copyloop failed badly"; }
- }
- send_gdb $start_comm;
- gdb_expect 10 {
- -re "y or n. $" {
- remote_send host "y\n"
- exp_continue;
- }
- -re "Breakpoint.*in copyloop.*$gdb_prompt $" {
- remote_send host "jump relocd\n";
- exp_continue;
- }
- -re "Continuing at.*\[\r\n\]" { }
- default {
- return -1;
- }
- }
-
- return "";
-}
-
-
-#
-# gdb_load -- load a file into the GDB.
-# Returns a 0 if there was an error,
-# 1 if it load successfully.
-#
-proc gdb_load { arg } {
- global verbose
- global loadpath
- global loadfile
- global gdb_prompt
- global GDB
- global expect_out
-
- set loadfile [file tail $arg]
- set loadpath [file dirname $arg]
-
- set protocol [target_info gdb_protocol];
-
- if [is_remote host] {
- set arg [remote_download host $arg];
- }
- send_gdb "file $arg\n"
- gdb_expect 30 {
- -re "A program is being debug.*Kill it.*y or n. $" {
- send_gdb "y\n"
- exp_continue
- }
- -re "Load new symbol table.*y or n. $" {
- send_gdb "y\n"
- exp_continue
- }
- -re "Reading symbols from.*done..*$gdb_prompt $" {}
- -re "$gdb_prompt $" { perror "GDB couldn't read file" }
- timeout {
- perror "(timeout) read symbol file" ;
- return -1
- }
- }
-
- if [target_info exists gdb_serial] {
- set gdb_serial [target_info gdb_serial];
- } else {
- if [target_info exists serial] {
- set gdb_serial [target_info serial];
- } else {
- set gdb_serial [target_info netport];
- }
- }
- send_gdb "target remote $gdb_serial\n"
- gdb_expect 30 {
- -re "Kill it?.*y or n.*" {
- send_gdb "y\n";
- exp_continue
- }
- -re "$gdb_prompt $" {
- verbose "Set remote target to $gdb_serial" 2
- }
- timeout {
- perror "Couldn't set remote target."
- return -1
- }
- }
- if [target_info exists gdb_load_offset] {
- set offset "[target_info gdb_load_offset]";
- } else {
- set offset "";
- }
- send_gdb "load $arg $offset\n"
- verbose "Loading $arg into $GDB" 2
- gdb_expect 1200 {
- -re "Loading.*$gdb_prompt $" {
- verbose "Loaded $arg into $GDB" 1
- }
- -re "$gdb_prompt $" {
- if $verbose>1 then {
- perror "GDB couldn't load."
- }
- }
- timeout {
- if $verbose>1 then {
- perror "Timed out trying to load $arg."
- }
- }
- }
- send_gdb "list main\n";
- gdb_expect 60 {
- -re "$gdb_prompt" { }
- default {
- perror "command for list main never completed";
- return -1;
- }
- }
-
- return 0
-}
diff --git a/gdb/testsuite/config/udi.exp b/gdb/testsuite/config/udi.exp
deleted file mode 100644
index 4a35232729c..00000000000
--- a/gdb/testsuite/config/udi.exp
+++ /dev/null
@@ -1,110 +0,0 @@
-# Test Framework Driver for GDB driving Universal Debug Interface on 29K
-# Copyright 1988, 1990, 1991, 1992, 1993, 1994, 1997
-# 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.
-
-# This file was written by Rob Savoye. (rob@cygnus.com)
-
-load_lib gdb.exp
-
-#
-# gdb_target_udi
-# Set gdb to the desired UDI target
-#
-proc gdb_target_udi { } {
- global gdb_prompt
- global verbose
- global exit_status
-
- set targetname [target_info mondfe,name];
- # set targets hostname
- send_gdb "target udi $targetname\n"
- set timeout 60
- verbose "Timeout is now $timeout seconds" 2
- gdb_expect {
- -re "target udi $targetname\[\r\n\]+" {
- exp_continue
- }
- -re "TIP UDI 1.2 Conformant.*$gdb_prompt $" {
- verbose "Set target to $targetname"
- }
- -re "TIP-ipc WARNING,.*failed:" {
- warning "$expect_out(buffer)"
- }
- -re "TIP-ipc ERROR,.*failed:" {
- perror "$expect_out(buffer)"
- }
- -re "A program is being debugged already. Kill it\? \(y or n\)" {
- send "y\n"
- exp_continue
- }
- timeout {
- perror "Couldn't set target for UDI."
- cleanup
- exit $exit_status
- }
- }
- set timeout 10
- verbose "Timeout is now $timeout seconds" 2
-}
-
-#
-# gdb_load -- load a file into the debugger.
-# return a -1 if anything goes wrong.
-#
-
-proc gdb_load { arg } {
- global verbose
- global loadpath
- global loadfile
- global GDB
- global gdb_prompt
-
- if [gdb_file_cmd $arg] {
- return -1
- }
-
- gdb_target_udi
-}
-
-#
-# gdb_start -- start GDB running. This assumes that there the
-# UDICONF enviroment variable is set.
-#
-proc gdb_start { } {
- global env;
-
- set env(UDICONF) [target_info mondfe,udi_soc];
- default_gdb_start
- verbose "Setting up target, Please wait..."
- gdb_target_udi
-}
-
-#
-# gdb_exit -- exit gdb
-#
-proc gdb_exit { } {
- catch default_gdb_exit
- set in [open [concat "|ls -F"] r]
- while {[gets $in line]>-1} {
- if [regexp "=$" $line] then {
- set line [string trimright $line "="]
- verbose "Removing the $line named socket"
- exec rm -f $line
- }
- }
- close $in
-}
diff --git a/gdb/testsuite/configure b/gdb/testsuite/configure
index cbf36522f33..271e11d1281 100755
--- a/gdb/testsuite/configure
+++ b/gdb/testsuite/configure
@@ -1049,9 +1049,11 @@ done
ac_given_srcdir=$srcdir
-trap 'rm -fr `echo "Makefile gdb.ada/Makefile gdb.ada/gnat_ada.gpr \
+trap 'rm -fr `echo "Makefile \
+ gdb.ada/Makefile gdb.ada/gnat_ada.gpr:gdb.ada/gnat_ada.gin \
gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile \
- gdb.cp/Makefile gdb.disasm/Makefile gdb.java/Makefile gdb.mi/Makefile \
+ gdb.cp/Makefile gdb.disasm/Makefile gdb.fortran/Makefile \
+ gdb.java/Makefile gdb.mi/Makefile \
gdb.objc/Makefile gdb.threads/Makefile gdb.trace/Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
EOF
cat >> $CONFIG_STATUS <<EOF
@@ -1144,9 +1146,11 @@ EOF
cat >> $CONFIG_STATUS <<EOF
-CONFIG_FILES=\${CONFIG_FILES-"Makefile gdb.ada/Makefile gdb.ada/gnat_ada.gpr \
+CONFIG_FILES=\${CONFIG_FILES-"Makefile \
+ gdb.ada/Makefile gdb.ada/gnat_ada.gpr:gdb.ada/gnat_ada.gin \
gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile \
- gdb.cp/Makefile gdb.disasm/Makefile gdb.java/Makefile gdb.mi/Makefile \
+ gdb.cp/Makefile gdb.disasm/Makefile gdb.fortran/Makefile \
+ gdb.java/Makefile gdb.mi/Makefile \
gdb.objc/Makefile gdb.threads/Makefile gdb.trace/Makefile"}
EOF
cat >> $CONFIG_STATUS <<\EOF
diff --git a/gdb/testsuite/configure.in b/gdb/testsuite/configure.in
index 4b95363488c..8b90e04484c 100644
--- a/gdb/testsuite/configure.in
+++ b/gdb/testsuite/configure.in
@@ -1,7 +1,7 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
-# Copyright 2002, 2003
+# Copyright 2002, 2003, 2004
# Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
@@ -19,6 +19,12 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
+# NOTE ON AUTOCONF VERSION:
+# AC_PREREQ says 2.13.
+# The output file says "Generated automatically using autoconf version 2.13".
+# But that is wrong. This file must be processed with autoconf 000227,
+# a special version which identifies itself as autoconf 2.13.
+
AC_PREREQ(2.13)
AC_INIT(gdb.base)
@@ -112,7 +118,9 @@ AC_CHECK_HEADERS(pthread.h)
AC_EXEEXT
AC_CONFIG_SUBDIRS($configdirs)
-AC_OUTPUT([Makefile gdb.ada/Makefile gdb.ada/gnat_ada.gpr \
+AC_OUTPUT([Makefile \
+ gdb.ada/Makefile gdb.ada/gnat_ada.gpr:gdb.ada/gnat_ada.gin \
gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile \
- gdb.cp/Makefile gdb.disasm/Makefile gdb.java/Makefile gdb.mi/Makefile \
+ gdb.cp/Makefile gdb.disasm/Makefile gdb.fortran/Makefile \
+ gdb.java/Makefile gdb.mi/Makefile \
gdb.objc/Makefile gdb.threads/Makefile gdb.trace/Makefile])
diff --git a/gdb/testsuite/gdb.ada/gnat_ada.gpr.in b/gdb/testsuite/gdb.ada/gnat_ada.gin
index 23cd5586dab..23cd5586dab 100644
--- a/gdb/testsuite/gdb.ada/gnat_ada.gpr.in
+++ b/gdb/testsuite/gdb.ada/gnat_ada.gin
diff --git a/gdb/testsuite/gdb.ada/null_record.exp b/gdb/testsuite/gdb.ada/null_record.exp
index 8e024d6ca24..d98867c0f8e 100644
--- a/gdb/testsuite/gdb.ada/null_record.exp
+++ b/gdb/testsuite/gdb.ada/null_record.exp
@@ -34,9 +34,9 @@ gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
-gdb_test "begin" \
+gdb_test "start" \
"Breakpoint \[0-9\]+ at .*null_record.adb.*" \
- "begin"
+ "start"
gdb_test "ptype empty" \
"type = record null; end record" \
diff --git a/gdb/testsuite/gdb.arch/e500-prologue.c b/gdb/testsuite/gdb.arch/e500-prologue.c
new file mode 100644
index 00000000000..f9e83dabf8a
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/e500-prologue.c
@@ -0,0 +1,54 @@
+/* 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. */
+
+void arg_passing_test2 (void);
+
+int
+main (void)
+{
+ arg_passing_test2 ();
+ return 0;
+}
+
+
+/* Asm for procedure arg_passing_test2.
+
+ The challenge here is getting past the 'mr 0,3' and 'stb'
+ instructions. */
+
+asm (" .section \".text\"\n"
+ " .align 2\n"
+ " .globl arg_passing_test2\n"
+ " .type arg_passing_test2, @function\n"
+ "arg_passing_test2:\n"
+ " stwu 1,-64(1)\n"
+ " stw 31,60(1)\n"
+ " mr 31,1\n"
+ " mr 0,3\n"
+ " evstdd 4,16(31)\n"
+ " stw 5,24(31)\n"
+ " stw 7,32(31)\n"
+ " stw 8,36(31)\n"
+ " stw 9,40(31)\n"
+ " stb 0,8(31)\n"
+ " lwz 11,0(1)\n"
+ " lwz 31,-4(11)\n"
+ " mr 1,11\n"
+ " blr\n"
+ " .size arg_passing_test2, .-arg_passing_test2\n");
diff --git a/gdb/testsuite/gdb.arch/e500-prologue.exp b/gdb/testsuite/gdb.arch/e500-prologue.exp
new file mode 100644
index 00000000000..06dec9fb28d
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/e500-prologue.exp
@@ -0,0 +1,82 @@
+# 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.
+#
+# This file is part of the gdb testsuite.
+
+if $tracelevel {
+ strace $tracelevel
+}
+
+# Test PowerPC E500 prologue analyzer.
+
+set prms_id 0
+set bug_id 0
+
+if ![istarget "powerpc-*"] then {
+ verbose "Skipping powerpc E500 prologue tests."
+ return
+}
+
+set testfile "e500-prologue"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {}] != "" } {
+ unsupported "Testcase compile failed."
+ return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+# Insert a breakpoint in FUNCTION and verifies that the breakpoint was
+# inserted at the expected location. EXPECTED_LOCATION should be an
+# offset relative to the function start address.
+proc insert_breakpoint {function expected_location} {
+ global gdb_prompt
+ global expect_out
+ global hex
+
+ set address ""
+
+ # Insert a breakpoint using the given function name, and extract
+ # the breakpoint address for the output.
+ gdb_test_multiple "break $function" "set breakpoint in $function" {
+ -re "Breakpoint 1 at ($hex).*$gdb_prompt $" {
+ set address $expect_out(1,string)
+ }
+ default {
+ fail "set breakpoint in $function"
+ }
+ }
+
+ # If we managed to get the breakpoing address, then check that
+ # we inserted it at the expected location by examining the
+ # instruction at that address (we're not interested in the insn
+ # itself, but rather at the address printed at the begining of
+ # the instruction).
+ if { $address != "" } then {
+ gdb_test "x /i $address" \
+ ".*<$function\\+$expected_location>.*" \
+ "check $function breakpoint address"
+ } else {
+ fail "unable to compute breakpoint address"
+ }
+
+}
+
+insert_breakpoint "arg_passing_test2" 40
diff --git a/gdb/testsuite/gdb.arch/e500-regs.exp b/gdb/testsuite/gdb.arch/e500-regs.exp
index 9224704b219..30dae0a15f7 100644
--- a/gdb/testsuite/gdb.arch/e500-regs.exp
+++ b/gdb/testsuite/gdb.arch/e500-regs.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
@@ -112,7 +112,7 @@ for {set i 0} {$i < 32} {incr i 1} {
if {$endianness == "big"} {
set decimal_vector ".uint64 = 4294967297, v2_float = .1.*e-45, 1.*e-45., v2_int32 = .1, 1., v4_int16 = .0, 1, 0, 1., v8_int8 = ..000.000.000.001.000.000.000.001.."
} else {
- set decimal_vector ".uint64 = 0x0000000100000001, v2_float = .1.*e-45, 1.*e-45., v2_int32 = .1, 1., v4_int16 = .1, 0, 1, 0., v8_int8 = ..001.000.000.000.001.000.000.000.001.000.000.000.001.000.000.."
+ set decimal_vector ".uint64 = 4294967297, v2_float = .1.*e-45, 1.*e-45., v2_int32 = .1, 1., v4_int16 = .1, 0, 1, 0., v8_int8 = ..001.000.000.000.001.000.000.."
}
for {set i 0} {$i < 32} {incr i 1} {
diff --git a/gdb/testsuite/gdb.arch/i386-cpuid.h b/gdb/testsuite/gdb.arch/i386-cpuid.h
new file mode 100644
index 00000000000..067b22fa712
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/i386-cpuid.h
@@ -0,0 +1,77 @@
+/* Helper file for i386 platform. Runtime check for MMX/SSE/SSE2 support.
+
+ 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. */
+
+/* Used by 20020523-2.c and i386-sse-6.c, and possibly others. */
+/* Plagarized from 20020523-2.c. */
+/* Plagarized from gcc. */
+
+#define bit_CMOV (1 << 15)
+#define bit_MMX (1 << 23)
+#define bit_SSE (1 << 25)
+#define bit_SSE2 (1 << 26)
+
+#ifndef NOINLINE
+#define NOINLINE __attribute__ ((noinline))
+#endif
+
+unsigned int i386_cpuid (void) NOINLINE;
+
+unsigned int NOINLINE
+i386_cpuid (void)
+{
+ int fl1, fl2;
+
+#ifndef __x86_64__
+ /* See if we can use cpuid. On AMD64 we always can. */
+ __asm__ ("pushfl; pushfl; popl %0; movl %0,%1; xorl %2,%0;"
+ "pushl %0; popfl; pushfl; popl %0; popfl"
+ : "=&r" (fl1), "=&r" (fl2)
+ : "i" (0x00200000));
+ if (((fl1 ^ fl2) & 0x00200000) == 0)
+ return (0);
+#endif
+
+ /* Host supports cpuid. See if cpuid gives capabilities, try
+ CPUID(0). Preserve %ebx and %ecx; cpuid insn clobbers these, we
+ don't need their CPUID values here, and %ebx may be the PIC
+ register. */
+#ifdef __x86_64__
+ __asm__ ("pushq %%rcx; pushq %%rbx; cpuid; popq %%rbx; popq %%rcx"
+ : "=a" (fl1) : "0" (0) : "rdx", "cc");
+#else
+ __asm__ ("pushl %%ecx; pushl %%ebx; cpuid; popl %%ebx; popl %%ecx"
+ : "=a" (fl1) : "0" (0) : "edx", "cc");
+#endif
+ if (fl1 == 0)
+ return (0);
+
+ /* Invoke CPUID(1), return %edx; caller can examine bits to
+ determine what's supported. */
+#ifdef __x86_64__
+ __asm__ ("pushq %%rcx; pushq %%rbx; cpuid; popq %%rbx; popq %%rcx"
+ : "=d" (fl2), "=a" (fl1) : "1" (1) : "cc");
+#else
+ __asm__ ("pushl %%ecx; pushl %%ebx; cpuid; popl %%ebx; popl %%ecx"
+ : "=d" (fl2), "=a" (fl1) : "1" (1) : "cc");
+#endif
+
+ return fl2;
+}
diff --git a/gdb/testsuite/gdb.arch/i386-prologue.c b/gdb/testsuite/gdb.arch/i386-prologue.c
index 4c92a9c83e5..e6846576fde 100644
--- a/gdb/testsuite/gdb.arch/i386-prologue.c
+++ b/gdb/testsuite/gdb.arch/i386-prologue.c
@@ -1,19 +1,63 @@
+/* Unwinder test program.
+
+ Copyright 2003, 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. */
+
+#ifdef SYMBOL_PREFIX
+#define SYMBOL(str) SYMBOL_PREFIX #str
+#else
+#define SYMBOL(str) #str
+#endif
+
void gdb1253 (void);
+void gdb1718 (void);
void gdb1338 (void);
+void jump_at_beginning (void);
int
main (void)
{
+ standard ();
gdb1253 ();
+ gdb1718 ();
gdb1338 ();
+ jump_at_beginning ();
return 0;
}
+/* A normal prologue. */
+
+asm(".text\n"
+ " .align 8\n"
+ SYMBOL (standard) ":\n"
+ " pushl %ebp\n"
+ " movl %esp, %ebp\n"
+ " pushl %edi\n"
+ " int $0x03\n"
+ " leave\n"
+ " ret\n");
+
/* Relevant part of the prologue from symtab/1253. */
asm(".text\n"
" .align 8\n"
- "gdb1253:\n"
+ SYMBOL (gdb1253) ":\n"
" pushl %ebp\n"
" xorl %ecx, %ecx\n"
" movl %esp, %ebp\n"
@@ -22,11 +66,26 @@ asm(".text\n"
" leave\n"
" ret\n");
+/* Relevant part of the prologue from backtrace/1718. */
+
+asm(".text\n"
+ " .align 8\n"
+ SYMBOL (gdb1718) ":\n"
+ " pushl %ebp\n"
+ " movl $0x11111111, %eax\n"
+ " movl %esp, %ebp\n"
+ " pushl %esi\n"
+ " movl $0x22222222, %esi\n"
+ " pushl %ebx\n"
+ " int $0x03\n"
+ " leave\n"
+ " ret\n");
+
/* Relevant part of the prologue from backtrace/1338. */
asm(".text\n"
" .align 8\n"
- "gdb1338:\n"
+ SYMBOL (gdb1338) ":\n"
" pushl %edi\n"
" pushl %esi\n"
" pushl %ebx\n"
@@ -35,3 +94,19 @@ asm(".text\n"
" popl %esi\n"
" popl %edi\n"
" ret\n");
+
+/* The purpose of this function is to verify that, during prologue
+ skip, GDB does not follow a jump at the beginnning of the "real"
+ code. */
+
+asm(".text\n"
+ " .align 8\n"
+ SYMBOL (jump_at_beginning) ":\n"
+ " pushl %ebp\n"
+ " movl %esp,%ebp\n"
+ " jmp .gdbjump\n"
+ " nop\n"
+ ".gdbjump:\n"
+ " movl %ebp,%esp\n"
+ " popl %ebp\n"
+ " ret\n");
diff --git a/gdb/testsuite/gdb.arch/i386-prologue.exp b/gdb/testsuite/gdb.arch/i386-prologue.exp
index f1c1e72425a..48aad1c13ae 100644
--- a/gdb/testsuite/gdb.arch/i386-prologue.exp
+++ b/gdb/testsuite/gdb.arch/i386-prologue.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
@@ -36,10 +36,36 @@ if ![istarget "i?86-*-*"] then {
set testfile "i386-prologue"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+
+# some targets have leading underscores on assembly symbols.
+# TODO: detect this automatically
+set additional_flags ""
+if [istarget "i?86-*-cygwin*"] then {
+ set additional_flags "additional_flags=-DSYMBOL_PREFIX=\"_\""
+}
+
+# Don't use "debug", so that we don't have line information for the assembly
+# fragments.
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list $additional_flags]] != "" } {
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
+
+# The code used by the tests here encodes some breakpoints by using
+# inline assembler. This will generate a SIGTRAP which will be caught
+# by GDB. At that point the instruction pointer will point at the
+# next instruction, and execution can continue without any problems.
+# Some systems however (QNX Neutrino, Solaris) will adjust the
+# instruction pointer to point at the breakpoint instruction instead.
+# On these systems we cannot continue unless we skip it. This
+# procedure takes care of that.
+
+proc skip_breakpoint { msg } {
+ gdb_test "if (*(unsigned char *)\$pc == 0xcc)\nset \$pc = \$pc + 1\nend" \
+ "" "skip breakpoint in ${msg}"
+}
+
+
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
@@ -53,10 +79,26 @@ if ![runto_main] then {
gdb_suppress_tests
}
+# Testcase for standard prologue.
+
+gdb_test "continue" "Program received signal SIGTRAP.*" "continue to standard"
+
+skip_breakpoint standard
+
+gdb_test "backtrace 10" \
+ "#0\[ \t\]*$hex in standard.*\r\n#1\[ \t\]*$hex in main.*" \
+ "backtrace in standard"
+
+gdb_test "info frame" \
+ ".*Saved registers:.*ebp at.*edi at.*eip at.*" \
+ "saved registers in standard"
+
# Testcase from symtab/1253.
gdb_test "continue" "Program received signal SIGTRAP.*" "continue to gdb1253"
+skip_breakpoint gdb1253
+
gdb_test "backtrace 10" \
"#0\[ \t\]*$hex in gdb1253.*\r\n#1\[ \t\]*$hex in main.*" \
"backtrace in gdb1253"
@@ -65,10 +107,27 @@ gdb_test "info frame" \
".*Saved registers:.*ebp at.*edi at.*eip at.*" \
"saved registers in gdb1253"
+# Testcase from backtrace/1718.
+
+gdb_test "continue" "Program received signal SIGTRAP.*" "continue to gdb1718"
+
+skip_breakpoint gdb1718
+
+gdb_test "backtrace 10" \
+ "#0\[ \t\]*$hex in gdb1718.*\r\n#1\[ \t\]*$hex in main.*" \
+ "backtrace in gdb1718"
+
+setup_kfail *-*-* gdb/1718
+gdb_test "info frame" \
+ ".*Saved registers:.*esi at.*ebx at.*eip at.*" \
+ "saved registers in gdb1718"
+
# Testcase from backtrace/1338.
gdb_test "continue" "Program received signal SIGTRAP.*" "continue to gdb1338"
+skip_breakpoint gdb1338
+
gdb_test "backtrace 10" \
"#0\[ \t\]*$hex in gdb1338.*\r\n#1\[ \t\]*$hex in main.*" \
"backtrace in gdb1338"
@@ -76,3 +135,16 @@ gdb_test "backtrace 10" \
gdb_test "info frame" \
".*Saved registers:.*ebx at.*esi at.*edi at.*eip at.*" \
"saved registers in gdb1338"
+
+# Testcase jump_at_beginning.
+gdb_test_multiple "break jump_at_beginning" \
+ "set breakpoint in jump_at_beginning" {
+ -re "Breakpoint \[0-9\]* at ($hex).*$gdb_prompt $" {
+ gdb_test "x/i $expect_out(1,string)" \
+ ".*<jump_at_beginning.*>:.*jmp.*" \
+ "check jump_at_beginning prologue end"
+ }
+ default {
+ fail "set breakpoint in jump_at_beginning"
+ }
+}
diff --git a/gdb/testsuite/gdb.arch/i386-sse.c b/gdb/testsuite/gdb.arch/i386-sse.c
new file mode 100644
index 00000000000..496721c5e82
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/i386-sse.c
@@ -0,0 +1,90 @@
+/* Test program for SSE registers.
+
+ 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. */
+
+#include <stdio.h>
+#include "i386-cpuid.h"
+
+typedef struct {
+ float f[4];
+} v4sf_t;
+
+
+v4sf_t data[8] =
+ {
+ { { 0.0, 0.25, 0.50, 0.75 } },
+ { { 1.0, 1.25, 1.50, 1.75 } },
+ { { 2.0, 2.25, 2.50, 2.75 } },
+ { { 3.0, 3.25, 3.50, 3.75 } },
+ { { 4.0, 4.25, 4.50, 4.75 } },
+ { { 5.0, 5.25, 5.50, 5.75 } },
+ { { 6.0, 6.25, 6.50, 6.75 } },
+ { { 7.0, 7.25, 7.50, 7.75 } },
+ };
+
+
+int
+have_sse (void)
+{
+ int edx = i386_cpuid ();
+
+ if (edx & bit_SSE)
+ return 1;
+ else
+ return 0;
+}
+
+int
+main (int argc, char **argv)
+{
+ if (have_sse ())
+ {
+ asm ("movaps 0(%0), %%xmm0\n\t"
+ "movaps 16(%0), %%xmm1\n\t"
+ "movaps 32(%0), %%xmm2\n\t"
+ "movaps 48(%0), %%xmm3\n\t"
+ "movaps 64(%0), %%xmm4\n\t"
+ "movaps 80(%0), %%xmm5\n\t"
+ "movaps 96(%0), %%xmm6\n\t"
+ "movaps 112(%0), %%xmm7\n\t"
+ : /* no output operands */
+ : "r" (data)
+ : "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7");
+
+ puts ("Hi!"); /* first breakpoint here */
+
+ asm (
+ "movaps %%xmm0, 0(%0)\n\t"
+ "movaps %%xmm1, 16(%0)\n\t"
+ "movaps %%xmm2, 32(%0)\n\t"
+ "movaps %%xmm3, 48(%0)\n\t"
+ "movaps %%xmm4, 64(%0)\n\t"
+ "movaps %%xmm5, 80(%0)\n\t"
+ "movaps %%xmm6, 96(%0)\n\t"
+ "movaps %%xmm7, 112(%0)\n\t"
+ : /* no output operands */
+ : "r" (data)
+ : "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7");
+
+ puts ("Bye!"); /* second breakpoint here */
+ }
+
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.arch/i386-sse.exp b/gdb/testsuite/gdb.arch/i386-sse.exp
new file mode 100644
index 00000000000..702ee7127a5
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/i386-sse.exp
@@ -0,0 +1,92 @@
+# 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@gnu.org
+
+# This file is part of the gdb testsuite.
+
+if $tracelevel {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+if ![istarget "i?86-*-*"] then {
+ verbose "Skipping i386 SSE tests."
+ return
+}
+
+set testfile "i386-sse"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+ unsupported "compiler does not support SSE"
+ return
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+if ![runto_main] then {
+ gdb_suppress_tests
+}
+
+send_gdb "print have_sse ()\r"
+gdb_expect {
+ -re ".. = 1\r\n$gdb_prompt " {
+ pass "check whether processor supports SSE"
+ }
+ -re ".. = 0\r\n$gdb_prompt " {
+ verbose "processor does not support SSE; skipping SSE tests"
+ return
+ }
+ -re ".*$gdb_prompt $" {
+ fail "check whether processor supports SSE"
+ }
+ timeout {
+ fail "check whether processor supports SSE (timeout)"
+ }
+}
+
+gdb_test "break [gdb_get_line_number "first breakpoint here"]" \
+ "Breakpoint .* at .*i386-sse.c.*" \
+ "set breakpoint in main"
+gdb_continue_to_breakpoint "continue to first breakpoint in main"
+
+foreach r {0 1 2 3 4 5 6 7} {
+ gdb_test "print \$xmm$r.v4_float" \
+ ".. = \\{$r, $r.25, $r.5, $r.75\\}.*" \
+ "check contents of %xmm$r"
+}
+
+foreach r {0 1 2 3 4 5 6 7} {
+ gdb_test "set var \$xmm$r.v4_float\[0\] = $r + 10" "" "set %xmm$r"
+}
+
+gdb_test "break [gdb_get_line_number "second breakpoint here"]" \
+ "Breakpoint .* at .*i386-sse.c.*" \
+ "set breakpoint in main"
+gdb_continue_to_breakpoint "continue to second breakpoint in main"
+
+foreach r {0 1 2 3 4 5 6 7} {
+ gdb_test "print data\[$r\]" \
+ ".. = \\{f = \\{[expr $r + 10], $r.25, $r.5, $r.75\\}\\}.*" \
+ "check contents of data\[$r\]"
+}
diff --git a/gdb/testsuite/gdb.arch/i386-unwind.c b/gdb/testsuite/gdb.arch/i386-unwind.c
index 6d10ecb84b2..b1fa1df06ee 100644
--- a/gdb/testsuite/gdb.arch/i386-unwind.c
+++ b/gdb/testsuite/gdb.arch/i386-unwind.c
@@ -1,6 +1,6 @@
/* Unwinder test program.
- Copyright 2003 Free Software Foundation, Inc.
+ Copyright 2003, 2004 Free Software Foundation, Inc.
This file is part of GDB.
@@ -19,6 +19,12 @@
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+#ifdef SYMBOL_PREFIX
+#define SYMBOL(str) SYMBOL_PREFIX #str
+#else
+#define SYMBOL(str) #str
+#endif
+
void
trap (void)
{
@@ -34,9 +40,9 @@ asm(".text\n"
"gdb1435:\n"
" pushl %ebp\n"
" mov %esp, %ebp\n"
- " call trap\n"
- " .globl main\n"
- "main:\n"
+ " call " SYMBOL (trap) "\n"
+ " .globl " SYMBOL (main) "\n"
+ SYMBOL (main) ":\n"
" pushl %ebp\n"
" mov %esp, %ebp\n"
" call gdb1435\n");
diff --git a/gdb/testsuite/gdb.arch/i386-unwind.exp b/gdb/testsuite/gdb.arch/i386-unwind.exp
index 9c3130fc8c3..85fb9da62bc 100644
--- a/gdb/testsuite/gdb.arch/i386-unwind.exp
+++ b/gdb/testsuite/gdb.arch/i386-unwind.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
@@ -36,7 +36,15 @@ if ![istarget "i?86-*-*"] then {
set testfile "i386-unwind"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+
+# some targets have leading underscores on assembly symbols.
+# TODO: detect this automatically
+set additional_flags ""
+if [istarget "i?86-*-cygwin*"] then {
+ set additional_flags "additional_flags=-DSYMBOL_PREFIX=\"_\""
+}
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug $additional_flags]] != "" } {
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
diff --git a/gdb/testsuite/gdb.arch/powerpc-aix-prologue.c b/gdb/testsuite/gdb.arch/powerpc-aix-prologue.c
new file mode 100644
index 00000000000..ee31b496d3e
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/powerpc-aix-prologue.c
@@ -0,0 +1,55 @@
+/* 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. */
+
+void li_stw (void);
+
+int
+main (void)
+{
+ li_stw ();
+ return 0;
+}
+
+/* Asm for procedure li_stw().
+
+ The purpose of this function is to verify that GDB does not
+ include the li insn as part of the function prologue (only part
+ of the prologue if part of a pair of insns saving vector registers).
+ Similarly, GDB should not include the stw insn following the li insn,
+ because the source register is not used for parameter passing. */
+
+
+asm (" .csect .text[PR]\n"
+ " .align 2\n"
+ " .lglobl .li_stw\n"
+ " .csect li_stw[DS]\n"
+ "li_stw:\n"
+ " .long .li_stw, TOC[tc0], 0\n"
+ " .csect .text[PR]\n"
+ ".li_stw:\n"
+ " stw 31,-4(1)\n"
+ " stwu 1,-48(1)\n"
+ " mr 31,1\n"
+ " stw 11,24(31)\n"
+ " li 0,8765\n"
+ " stw 0,28(31)\n"
+ " lwz 1,0(1)\n"
+ " lwz 31,-4(1)\n"
+ " blr\n");
+
diff --git a/gdb/testsuite/gdb.arch/powerpc-aix-prologue.exp b/gdb/testsuite/gdb.arch/powerpc-aix-prologue.exp
new file mode 100644
index 00000000000..76e3c27cf2e
--- /dev/null
+++ b/gdb/testsuite/gdb.arch/powerpc-aix-prologue.exp
@@ -0,0 +1,82 @@
+# 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.
+#
+# This file is part of the gdb testsuite.
+
+if $tracelevel {
+ strace $tracelevel
+}
+
+# Test rs6000 prologue analyzer.
+
+set prms_id 0
+set bug_id 0
+
+if ![istarget "powerpc-*-aix*"] then {
+ verbose "Skipping powerpc-aix prologue tests."
+ return
+}
+
+set testfile "powerpc-aix-prologue"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {}] != "" } {
+ unsupported "Testcase compile failed."
+ return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+# Insert a breakpoint in FUNCTION and verifies that the breakpoint was
+# inserted at the expected location. EXPECTED_LOCATION should be an
+# offset relative to the function start address.
+proc insert_breakpoint {function expected_location} {
+ global gdb_prompt
+ global expect_out
+ global hex
+
+ set address ""
+
+ # Insert a breakpoint using the given function name, and extract
+ # the breakpoint address for the output.
+ gdb_test_multiple "break $function" "set breakpoint in $function" {
+ -re "Breakpoint 1 at ($hex).*$gdb_prompt $" {
+ set address $expect_out(1,string)
+ }
+ default {
+ fail "set breakpoint in $function"
+ }
+ }
+
+ # If we managed to get the breakpoing address, then check that
+ # we inserted it at the expected location by examining the
+ # instruction at that address (we're not interested in the insn
+ # itself, but rather at the address printed at the begining of
+ # the instruction).
+ if { $address != "" } then {
+ gdb_test "x /i $address" \
+ ".*<$function\\+$expected_location>.*" \
+ "check $function breakpoint address"
+ } else {
+ fail "unable to compute breakpoint address"
+ }
+
+}
+
+insert_breakpoint "li_stw" 12
diff --git a/gdb/testsuite/gdb.asm/asm-source.exp b/gdb/testsuite/gdb.asm/asm-source.exp
index 75e64b484ea..e2c9e8a0c88 100644
--- a/gdb/testsuite/gdb.asm/asm-source.exp
+++ b/gdb/testsuite/gdb.asm/asm-source.exp
@@ -35,13 +35,15 @@ set asm-arch ""
set asm-note "empty"
set asm-flags ""
set link-flags "--entry _start"
+set debug-flags ""
switch -glob -- [istarget] {
"alpha*-*-*" {
set asm-arch alpha
# ??? Won't work with ecoff systems like Tru64, but then we also
# don't have any other -g flag that creates mdebug output.
- set asm-flags "-gdwarf2 -no-mdebug -I${srcdir}/${subdir} -I${objdir}/${subdir}"
+ set asm-flags "-no-mdebug -I${srcdir}/${subdir} -I${objdir}/${subdir}"
+ set debug-flags "-gdwarf-2"
}
"*arm-*-*" {
set asm-arch arm
@@ -63,7 +65,8 @@ switch -glob -- [istarget] {
}
"x86_64-*-*" {
set asm-arch x86_64
- set asm-flags "-gdwarf2 -I${srcdir}/${subdir} -I${objdir}/${subdir}"
+ set asm-flags "-I${srcdir}/${subdir} -I${objdir}/${subdir}"
+ set debug-flags "-gdwarf-2"
}
"i\[3456\]86-*-*" {
set asm-arch i386
@@ -74,11 +77,11 @@ switch -glob -- [istarget] {
}
"m6811-*-*" {
set asm-arch m68hc11
- set asm-flags "-mshort-double -m68hc11 -gdwarf2 --no-warn -I${srcdir}/${subdir} -I${objdir}/${subdir}"
+ set asm-flags "-mshort-double -m68hc11 -gdwarf-2 --no-warn -I${srcdir}/${subdir} -I${objdir}/${subdir}"
}
"m6812-*-*" {
set asm-arch m68hc11
- set asm-flags "-mshort-double -m68hc12 -gdwarf2 --no-warn -I${srcdir}/${subdir} -I${objdir}/${subdir}"
+ set asm-flags "-mshort-double -m68hc12 -gdwarf-2 --no-warn -I${srcdir}/${subdir} -I${objdir}/${subdir}"
}
"mips*-*" {
set asm-arch mips
@@ -88,18 +91,21 @@ switch -glob -- [istarget] {
}
"sh*-*-*" {
set asm-arch sh
- set asm-flags "-gdwarf2 -I${srcdir}/${subdir} -I${objdir}/${subdir}"
+ set asm-flags "-I${srcdir}/${subdir} -I${objdir}/${subdir}"
+ set debug-flags "-gdwarf-2"
}
"sparc-*-*" {
set asm-arch sparc
}
"sparc64-*-*" {
set asm-arch sparc64
- set asm-flags "-xarch=v9 -gstabs -I${srcdir}/${subdir} -I${objdir}/${subdir}"
+ set asm-flags "-xarch=v9 -I${srcdir}/${subdir} -I${objdir}/${subdir}"
+ set debug-flags "-gdwarf-2"
}
"xstormy16-*-*" {
set asm-arch xstormy16
- set asm-flags "-gdwarf2 -I${srcdir}/${subdir} -I${objdir}/${subdir}"
+ set asm-flags "-I${srcdir}/${subdir} -I${objdir}/${subdir}"
+ set debug-flags "-gdwarf-2"
}
"v850-*-*" {
set asm-arch v850
@@ -110,7 +116,13 @@ switch -glob -- [istarget] {
}
"ia64-*-*" {
set asm-arch ia64
- set asm-flags "-gdwarf2 -I${srcdir}/${subdir} -I${objdir}/${subdir}"
+ set asm-flags "-I${srcdir}/${subdir} -I${objdir}/${subdir}"
+ set debug-flags "-gdwarf-2"
+ }
+ "hppa*-linux-*" {
+ set asm-arch pa
+ set asm-flags "-I${srcdir}/${subdir} -I${objdir}/${subdir}"
+ set debug-flags "-gdwarf-2"
}
}
@@ -157,13 +169,39 @@ 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 "-gstabs -I${srcdir}/${subdir} -I${objdir}/${subdir}"
+ set asm-flags "-I${srcdir}/${subdir} -I${objdir}/${subdir}"
+ set debug-flags "-gstabs"
+}
+
+# Allow the target board to override the debug flags.
+if { [board_info $dest exists debug_flags] } then {
+ set debug-flags "[board_info $dest debug_flags]"
}
-if {[target_assemble ${srcdir}/${subdir}/${srcfile1} asmsrc1.o "${asm-flags}"] != ""} then {
+# The debug flags are in the format that gcc expects:
+# "-gdwarf-2", "-gstabs+", or "-gstabs". To be compatible with the
+# other languages in the test suite, we accept this input format.
+# So the user can run the test suite with:
+#
+# runtest --target_board unix/gdb:debug_flags=-gdwarf-2
+# make check RUNTESTFLAGS="--target_board unix/gdb:debug_flags=-gdwarf-2"
+#
+# However, the GNU assembler has different spellings than gcc.
+# So I adjust the debug flags here.
+
+# The GNU assembler spells "dwarf-2" as "dwarf2".
+regsub "--" "-gdwarf-2" "${debug-flags}" "-gdwarf2" debug-flags
+
+# The GNU assembler before 2.15 did not support "stabs+".
+regsub "--" "-gstabs\[+\]" "${debug-flags}" "-gstabs" debug-flags
+
+# The GNU assembler does not support level options like "-g2" or "-g3".
+regsub "--" "-g\[0-9\]" "${debug-flags}" "" debug-flags
+
+if {[target_assemble ${srcdir}/${subdir}/${srcfile1} asmsrc1.o "${asm-flags} ${debug-flags}"] != ""} then {
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
-if {[target_assemble ${srcdir}/${subdir}/${srcfile2} asmsrc2.o "${asm-flags}"] != ""} then {
+if {[target_assemble ${srcdir}/${subdir}/${srcfile2} asmsrc2.o "${asm-flags} ${debug-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/pa.inc b/gdb/testsuite/gdb.asm/pa.inc
new file mode 100644
index 00000000000..d53336e3167
--- /dev/null
+++ b/gdb/testsuite/gdb.asm/pa.inc
@@ -0,0 +1,44 @@
+ comment "subroutine prologue"
+ .macro gdbasm_enter
+ stw %rp, -20(%sp)
+ copy %r3, %r1
+ copy %sp, %r3
+ stwm %r1, 64(%sp)
+ .endm
+
+ comment "subroutine epilogue"
+ .macro gdbasm_leave
+ ldw -20(%r3), %rp
+ bv %r0(%rp)
+ ldwm -64(%sp), %r3
+ .endm
+
+ .macro gdbasm_call subr
+ bl \subr , %rp
+ nop
+ .endm
+
+ .macro gdbasm_several_nops
+ nop
+ nop
+ nop
+ nop
+ .endm
+
+ comment "exit (0)"
+ .macro gdbasm_exit0
+ comment "Don't know how to exit, but this will certainly halt..."
+ ldw 0(%r0), %r1
+ .endm
+
+ comment "crt0 startup"
+ .macro gdbasm_startup
+ .align 4
+ .endm
+
+ comment "Declare a data variable"
+ .macro gdbasm_datavar name value
+ .data
+\name:
+ .long \value
+ .endm
diff --git a/gdb/testsuite/gdb.base/annota1.exp b/gdb/testsuite/gdb.base/annota1.exp
index dc8ba29ca4d..a521aea1092 100644
--- a/gdb/testsuite/gdb.base/annota1.exp
+++ b/gdb/testsuite/gdb.base/annota1.exp
@@ -1,5 +1,5 @@
-# Copyright 1999, 2000, 2001, 2002, 2003
-# Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2001, 2002, 2003, 2004 Free Software
+# Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -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 {
@@ -272,35 +269,40 @@ gdb_expect {
# annotate-arg-value
# annotate-arg-end
#
-send_gdb "signal SIGUSR1\n"
-gdb_expect {
- -re "\r\n\032\032post-prompt\r\nContinuing with signal SIGUSR1.\r\n\r\n\032\032starting\r\n\r\n\032\032frames-invalid\r\n\r\n\032\032breakpoint 2\r\n\r\nBreakpoint 2, \r\n\032\032frame-begin 0 $hex\r\n\r\n\032\032frame-function-name\r\nhandle_USR1\r\n\032\032frame-args\r\n \\(\r\n\032\032arg-begin\r\nsig\r\n\032\032arg-name-end\r\n=\r\n\032\032arg-value -\r\n$decimal\r\n\032\032arg-end\r\n\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n${escapedsrcfile}\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n.*\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source.*annota1.c:.*:.*:beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped\r\n$gdb_prompt$" \
- { pass "send SIGUSR1" }
- -re "\r\n\032\032post-prompt\r\nContinuing with signal SIGUSR1.\r\n\r\n\032\032starting\r\n\r\n\032\032frames-invalid\r\n\r\n\032\032breakpoint 2\r\n\r\nBreakpoint 2, \r\n\032\032frame-begin 0 $hex\r\n\r\n\032\032frame-function-name\r\nhandle_USR1\r\n\032\032frame-args\r\n \\(\r\n\032\032arg-begin\r\nsig\r\n\032\032arg-name-end\r\n=\r\n\032\032arg-value -\r\n$decimal\r\n\032\032arg-end\r\n\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n.*${srcfile}\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n.*\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source.*annota1.c:.*:.*:beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped\r\n$gdb_prompt$" \
- { setup_xfail "*-*-*" 1270
- fail "send SIGUSR1" }
- -re ".*$gdb_prompt$" { fail "send SIGUSR1" }
- timeout { fail "send SIGUSR1 (timeout)" }
-}
+if [target_info exists gdb,nosignals] {
+ unsupported "send SIGUSR1"
+ unsupported "backtrace @ signal handler"
+} else {
+ send_gdb "signal SIGUSR1\n"
+ gdb_expect {
+ -re "\r\n\032\032post-prompt\r\nContinuing with signal SIGUSR1.\r\n\r\n\032\032starting\r\n\r\n\032\032frames-invalid\r\n\r\n\032\032breakpoint 2\r\n\r\nBreakpoint 2, \r\n\032\032frame-begin 0 $hex\r\n\r\n\032\032frame-function-name\r\nhandle_USR1\r\n\032\032frame-args\r\n \\(\r\n\032\032arg-begin\r\nsig\r\n\032\032arg-name-end\r\n=\r\n\032\032arg-value -\r\n$decimal\r\n\032\032arg-end\r\n\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n${escapedsrcfile}\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n.*\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source.*annota1.c:.*:.*:beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped\r\n$gdb_prompt$" \
+ { pass "send SIGUSR1" }
+ -re "\r\n\032\032post-prompt\r\nContinuing with signal SIGUSR1.\r\n\r\n\032\032starting\r\n\r\n\032\032frames-invalid\r\n\r\n\032\032breakpoint 2\r\n\r\nBreakpoint 2, \r\n\032\032frame-begin 0 $hex\r\n\r\n\032\032frame-function-name\r\nhandle_USR1\r\n\032\032frame-args\r\n \\(\r\n\032\032arg-begin\r\nsig\r\n\032\032arg-name-end\r\n=\r\n\032\032arg-value -\r\n$decimal\r\n\032\032arg-end\r\n\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n.*${srcfile}\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n.*\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source.*annota1.c:.*:.*:beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped\r\n$gdb_prompt$" \
+ { setup_xfail "*-*-*" 1270
+ fail "send SIGUSR1" }
+ -re ".*$gdb_prompt$" { fail "send SIGUSR1" }
+ timeout { fail "send SIGUSR1 (timeout)" }
+ }
-#
-# test:
-# annotate-signal-handler-caller
-#
-verbose "match_max local is: [match_max]"
-verbose "match_max default is: [match_max -d]"
-# This is necessary because a 2000 buffer is not enought to get everything
-# up to the prompt ad the test gets a timeout.
-match_max 3000
-verbose "match_max now is: [match_max]"
-send_gdb "backtrace\n"
-gdb_expect {
- -re "frame-begin 0 $hex\r\n#0.*frame-end.*frame-begin 1 $hex\r\n#1.*(\032\032signal-handler-caller\r\n.signal handler called.\r\n\r\n)+\032\032frame-end\r\n\r\n\032\032frame-begin 2 $hex\r\n#2.*(frame-begin 3 $hex\r\n#3.*)*frame-end.*$gdb_prompt$" {
- pass "backtrace @ signal handler"
+ #
+ # test:
+ # annotate-signal-handler-caller
+ #
+ verbose "match_max local is: [match_max]"
+ verbose "match_max default is: [match_max -d]"
+ # This is necessary because a 2000 buffer is not enought to get everything
+ # up to the prompt ad the test gets a timeout.
+ match_max 3000
+ verbose "match_max now is: [match_max]"
+ send_gdb "backtrace\n"
+ gdb_expect {
+ -re "frame-begin 0 $hex\r\n#0.*frame-end.*frame-begin 1 $hex\r\n#1.*(\032\032signal-handler-caller\r\n.signal handler called.\r\n\r\n)+\032\032frame-end\r\n\r\n\032\032frame-begin 2 $hex\r\n#2.*(frame-begin 3 $hex\r\n#3.*)*frame-end.*$gdb_prompt$" {
+ pass "backtrace @ signal handler"
+ }
+ -re ".*$gdb_prompt$" { fail "backtrace @ signal handler" }
+ timeout { fail "backtrace @ signal handler (timeout)" }
}
- -re ".*$gdb_prompt$" { fail "backtrace @ signal handler" }
- timeout { fail "backtrace @ signal handler (timeout)" }
}
#
@@ -449,30 +451,35 @@ gdb_expect {
# It has been verified that other signals will be delivered. However,
# rather than twiddle the test, I choose to leave it as-is as it
# exposes an interesting failure on hpux11.
-setup_xfail hppa*-*-hpux11*
-send_gdb "signal SIGTRAP\n"
-gdb_expect {
- -re ".*\032\032post-prompt\r\nContinuing with signal SIGTRAP.\r\n\r\n\032\032starting\r\n\r\n\032\032frames-invalid\r\n\r\n\032\032frames-invalid\r\n\r\n\032\032signalled\r\n\r\nProgram terminated with signal \r\n\032\032signal-name\r\nSIGTRAP\r\n\032\032signal-name-end\r\n, \r\n\032\032signal-string\r\nTrace.breakpoint trap\r\n\032\032signal-string-end\r\n.\r\nThe program no longer exists.\r\n\r\n\032\032stopped\r\n$gdb_prompt$" \
- { pass "signal sent" }
- -re ".*$gdb_prompt$" { fail "signal sent" }
- timeout { fail "signal sent (timeout)" }
+
+if [target_info exists gdb,nosignals] {
+ unsupported "signal sent"
+} else {
+ setup_xfail hppa*-*-hpux11*
+ send_gdb "signal SIGTRAP\n"
+ gdb_expect {
+ -re ".*\032\032post-prompt\r\nContinuing with signal SIGTRAP.\r\n\r\n\032\032starting\r\n\r\n\032\032frames-invalid\r\n\r\n\032\032frames-invalid\r\n\r\n\032\032signalled\r\n\r\nProgram terminated with signal \r\n\032\032signal-name\r\nSIGTRAP\r\n\032\032signal-name-end\r\n, \r\n\032\032signal-string\r\nTrace.breakpoint trap\r\n\032\032signal-string-end\r\n.\r\nThe program no longer exists.\r\n\r\n\032\032stopped\r\n$gdb_prompt$" \
+ { pass "signal sent" }
+ -re ".*$gdb_prompt$" { fail "signal sent" }
+ timeout { fail "signal sent (timeout)" }
+ }
}
-# Check for production of a core file
-# and remove it!
+# Check for production of a core file and remove it!
set exec_output [remote_exec build "ls core"]
+set test "cleanup core file"
if [ regexp "core not found" $exec_output] {
- pass "No core dumped"
+ pass "$test (not dumped)"
} else {
- if [ regexp "No such file or directory" $exec_output] {
- pass "No core dumped"
- } else {
- remote_exec build "rm -f core"
- pass "Core dumped and removed"
- }
+ if [ regexp "No such file or directory" $exec_output] {
+ pass "$test (not dumped)"
+ } else {
+ remote_exec build "rm -f core"
+ pass "$test (removed)"
+ }
}
# restore the original prompt for the rest of the testsuite
diff --git a/gdb/testsuite/gdb.base/annota3.exp b/gdb/testsuite/gdb.base/annota3.exp
index 93086ef609f..ccc16e2bcaf 100644
--- a/gdb/testsuite/gdb.base/annota3.exp
+++ b/gdb/testsuite/gdb.base/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 {
@@ -220,34 +217,39 @@ gdb_expect_list "backtrace from shlibrary" "$gdb_prompt$" {
#
# test printing a frame with some arguments:
#
-send_gdb "signal SIGUSR1\n"
-gdb_expect_list "send SIGUSR1" "$gdb_prompt$" {
- "\r\n\032\032post-prompt\r\n"
- "Continuing with signal SIGUSR1.\r\n"
- "\r\n\032\032starting\r\n"
- "\r\n\032\032frames-invalid\r\n"
- "\r\n\032\032breakpoint 2\r\n"
- "Breakpoint 2, handle_USR1 \\(sig=\[0-9\]+\\) at .*annota3.c:\[0-9\]+\r\n"
- "\r\n\032\032source .*annota3.c:\[0-9\]+:\[0-9\]+:beg:0x\[0-9a-z\]+\r\n"
- "\r\n\032\032stopped\r\n"
-}
-
-#
-# test:
-#
-verbose "match_max local is: [match_max]"
-verbose "match_max default is: [match_max -d]"
-# This is necessary because a 2000 buffer is not enought to get everything
-# up to the prompt ad the test gets a timeout.
-match_max 3000
-verbose "match_max now is: [match_max]"
-send_gdb "backtrace\n"
-gdb_expect_list "backtrace @ signal handler" "$gdb_prompt$" {
- "#0 +handle_USR1 \[^\r\n\]+\r\n"
- "#1 +.signal handler called.\r\n"
- "#2 .* printf \[^\r\n\]+\r\n"
- "#3 .* main \[^\r\n\]+\r\n"
+if [target_info exists gdb,nosignals] {
+ unsupported "send SIGUSR1"
+ unsupported "backtrace @ signal handler"
+} else {
+ send_gdb "signal SIGUSR1\n"
+ gdb_expect_list "send SIGUSR1" "$gdb_prompt$" {
+ "\r\n\032\032post-prompt\r\n"
+ "Continuing with signal SIGUSR1.\r\n"
+ "\r\n\032\032starting\r\n"
+ "\r\n\032\032frames-invalid\r\n"
+ "\r\n\032\032breakpoint 2\r\n"
+ "Breakpoint 2, handle_USR1 \\(sig=\[0-9\]+\\) at .*annota3.c:\[0-9\]+\r\n"
+ "\r\n\032\032source .*annota3.c:\[0-9\]+:\[0-9\]+:beg:0x\[0-9a-z\]+\r\n"
+ "\r\n\032\032stopped\r\n"
+ }
+
+ #
+ # test:
+ #
+ verbose "match_max local is: [match_max]"
+ verbose "match_max default is: [match_max -d]"
+ # This is necessary because a 2000 buffer is not enought to get everything
+ # up to the prompt ad the test gets a timeout.
+ match_max 3000
+ verbose "match_max now is: [match_max]"
+ send_gdb "backtrace\n"
+ gdb_expect_list "backtrace @ signal handler" "$gdb_prompt$" {
+ "#0 +handle_USR1 \[^\r\n\]+\r\n"
+ "#1 +.signal handler called.\r\n"
+ "#2 .* printf \[^\r\n\]+\r\n"
+ "#3 .* main \[^\r\n\]+\r\n"
+ }
}
#
@@ -372,35 +374,40 @@ gdb_expect_list "breakpoint ignore count" "$gdb_prompt$" {
# It has been verified that other signals will be delivered. However,
# rather than twiddle the test, I choose to leave it as-is as it
# exposes an interesting failure on hpux11.
-setup_xfail hppa*-*-hpux11*
-send_gdb "signal SIGTRAP\n"
-gdb_expect_list "signal sent" "$gdb_prompt$" {
- "\r\n\032\032post-prompt\r\n"
- "Continuing with signal SIGTRAP.\r\n"
- "\r\n\032\032starting\r\n"
- "\r\n\032\032frames-invalid\r\n"
- "\r\n\032\032frames-invalid\r\n"
- "\r\n\032\032signalled\r\n"
- "\r\nProgram terminated with signal SIGTRAP, Trace.breakpoint trap.\r\n"
- "The program no longer exists.\r\n"
- "\r\n\032\032stopped\r\n"
+
+if [target_info exists gdb,nosignals] {
+ unsupported "signal sent"
+} else {
+ setup_xfail hppa*-*-hpux11*
+ send_gdb "signal SIGTRAP\n"
+ gdb_expect_list "signal sent" "$gdb_prompt$" {
+ "\r\n\032\032post-prompt\r\n"
+ "Continuing with signal SIGTRAP.\r\n"
+ "\r\n\032\032starting\r\n"
+ "\r\n\032\032frames-invalid\r\n"
+ "\r\n\032\032frames-invalid\r\n"
+ "\r\n\032\032signalled\r\n"
+ "\r\nProgram terminated with signal SIGTRAP, Trace.breakpoint trap.\r\n"
+ "The program no longer exists.\r\n"
+ "\r\n\032\032stopped\r\n"
+ }
}
-# Check for production of a core file
-# and remove it!
+# Check for production of a core file and remove it!
set exec_output [remote_exec build "ls core"]
+set test "cleanup core file"
if [ regexp "core not found" $exec_output] {
- pass "No core dumped"
+ pass "$test (not dumped)"
} else {
- if [ regexp "No such file or directory" $exec_output] {
- pass "No core dumped"
- } else {
- remote_exec build "rm -f core"
- pass "Core dumped and removed"
- }
+ if [ regexp "No such file or directory" $exec_output] {
+ pass "$test (not dumped)"
+ } else {
+ remote_exec build "rm -f core"
+ pass "$test (removed)"
+ }
}
# restore the original prompt for the rest of the testsuite
diff --git a/gdb/testsuite/gdb.base/attach.exp b/gdb/testsuite/gdb.base/attach.exp
index ea11087f8af..b4aaf9bb1ba 100644
--- a/gdb/testsuite/gdb.base/attach.exp
+++ b/gdb/testsuite/gdb.base/attach.exp
@@ -1,4 +1,4 @@
-# Copyright 1997, 1999, 2002 Free Software Foundation, Inc.
+# Copyright 1997, 1999, 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,12 +14,9 @@
# 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
- }
+ strace $tracelevel
+}
set prms_id 0
set bug_id 0
@@ -46,7 +43,6 @@ set srcfile2 ${testfile}2.c
set binfile ${objdir}/${subdir}/${testfile}
set binfile2 ${objdir}/${subdir}/${testfile}2
set escapedbinfile [string_to_regexp ${objdir}/${subdir}/${testfile}]
-set cleanupfile ${objdir}/${subdir}/${testfile}.awk
#execute_anywhere "rm -f ${binfile} ${binfile2}"
remote_exec build "rm -f ${binfile} ${binfile2}"
@@ -54,20 +50,16 @@ remote_exec build "rm -f ${binfile} ${binfile2}"
#
#log_user 1
-# Clean out any old files from past runs.
-#
-remote_exec build "${cleanupfile}"
-
# build the first test case
#
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
- gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
# Build the in-system-call test
if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" executable {debug}] != "" } {
- gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
if [get_compiler_info ${binfile}] {
@@ -75,351 +67,323 @@ if [get_compiler_info ${binfile}] {
}
proc do_attach_tests {} {
- global gdb_prompt
- global binfile
- global escapedbinfile
- global srcfile
- global testfile
- global objdir
- global subdir
- global timeout
-
- # Start the program running and then wait for a bit, to be sure
- # that it can be attached to.
- #
- set testpid [eval exec $binfile &]
- exec sleep 2
-
- # Verify that we cannot attach to nonsense.
- #
- send_gdb "attach abc\n"
- gdb_expect {
- -re ".*Illegal process-id: abc.*$gdb_prompt $"\
- {pass "attach to nonsense is prohibited"}
- -re "Attaching to.*, process .*couldn't open /proc file.*$gdb_prompt $"\
- {
- # Response expected from /proc-based systems.
- pass "attach to nonsense is prohibited"
- }
- -re "Attaching to.*$gdb_prompt $"\
- {fail "attach to nonsense is prohibited (bogus pid allowed)"}
- -re "$gdb_prompt $" {fail "attach to nonsense is prohibited"}
- timeout {fail "(timeout) attach to nonsense is prohibited"}
- }
-
- # Verify that we cannot attach to what appears to be a valid
- # process ID, but is a process that doesn't exist. Traditionally,
- # most systems didn't have a process with ID 0, so we take that as
- # the default. However, there are a few exceptions.
- #
- set boguspid 0
- if { [istarget "*-*-*bsd*"] } {
- # In FreeBSD 5.0, PID 0 is used for "swapper". Use -1 instead
- # (which should have the desired effect on any version of
- # FreeBSD, and probably other *BSD's too).
- set boguspid -1
- }
- send_gdb "attach $boguspid\n"
- gdb_expect {
- -re "Attaching to.*, process $boguspid.*No such process.*$gdb_prompt $"\
- {
- # Response expected on ptrace-based systems (i.e. HP-UX 10.20).
- pass "attach to nonexistent process is prohibited"
- }
- -re "Attaching to.*, process $boguspid failed.*Hint.*$gdb_prompt $"\
- {
- # Response expected on ttrace-based systems (i.e. HP-UX 11.0).
- pass "attach to nonexistent process is prohibited"
- }
- -re "Attaching to.*, process $boguspid.*denied.*$gdb_prompt $"\
- {pass "attach to nonexistent process is prohibited"}
- -re "Attaching to.*, process $boguspid.*not permitted.*$gdb_prompt $"\
- {pass "attach to nonexistent process is prohibited"}
- -re "Attaching to.*, process .*couldn't open /proc file.*$gdb_prompt $"\
- {
- # Response expected from /proc-based systems.
- pass "attach to nonexistent process is prohibited"
- }
- -re "$gdb_prompt $" {fail "attach to nonexistent process is prohibited"}
- timeout {
- fail "(timeout) attach to nonexistent process is prohibited"
- }
- }
-
- # Verify that we can attach to the process by first giving its
- # executable name via the file command, and using attach with
- # the process ID.
- #
- # (Actually, the test system appears to do this automatically
- # for us. So, we must also be prepared to be asked if we want
- # to discard an existing set of symbols.)
- #
- send_gdb "file $binfile\n"
- gdb_expect {
- -re "Load new symbol table from.*y or n.*$" {
- send_gdb "y\n"
- gdb_expect {
- -re "Reading symbols from $escapedbinfile\.\.\.*done.*$gdb_prompt $"\
- {pass "(re)set file, before attach1"}
- -re "$gdb_prompt $" {fail "(re)set file, before attach1"}
- timeout {fail "(timeout) (re)set file, before attach1"}
- }
- }
- -re "Reading symbols from $escapedbinfile\.\.\.*done.*$gdb_prompt $"\
- {pass "set file, before attach1"}
- -re "$gdb_prompt $" {fail "set file, before attach1"}
- timeout {fail "(timeout) set file, before attach1"}
- }
-
- send_gdb "attach $testpid\n"
- gdb_expect {
- -re "Attaching to program.*`?$escapedbinfile'?, process $testpid.*main.*at .*$srcfile:.*$gdb_prompt $"\
- {pass "attach1, after setting file"}
- -re "$gdb_prompt $" {fail "attach1, after setting file"}
- timeout {fail "(timeout) attach1, after setting file"}
- }
-
- # Verify that we can "see" the variable "should_exit" in the
- # program, and that it is zero.
- #
- send_gdb "print should_exit\n"
- gdb_expect {
- -re ".* = 0.*$gdb_prompt $"\
- {pass "after attach1, print should_exit"}
- -re "$gdb_prompt $" {fail "after attach1, print should_exit"}
- timeout {fail "(timeout) after attach1, print should_exit"}
- }
-
- # Detach the process.
- #
- send_gdb "detach\n"
- gdb_expect {
- -re "Detaching from program: .*$escapedbinfile.*$gdb_prompt $"\
- {pass "attach1 detach"}
- -re "$gdb_prompt $" {fail "attach1 detach"}
- timeout {fail "(timeout) attach1 detach"}
- }
-
- # Wait a bit for gdb to finish detaching
- #
- exec sleep 5
-
- # Purge the symbols from gdb's brain. (We want to be certain
- # the next attach, which won't be preceded by a "file" command,
- # is really getting the executable file without our help.)
- #
- set old_timeout $timeout
- set timeout 15
- send_gdb "file\n"
- gdb_expect {
- -re ".*gdb internal error.*$" {
- fail "Internal error, prob. Memory corruption"
- }
- -re "No executable file now.*Discard symbol table.*y or n.*$" {
- send_gdb "y\n"
- gdb_expect {
- -re "No symbol file now.*$gdb_prompt $"\
- {pass "attach1, purging symbols after detach"}
- -re "$gdb_prompt $" {fail "attach1, purging symbols after detach"}
- timeout {fail "(timeout) attach1, purging symbols after detach"}
- }
- }
- -re "$gdb_prompt $" {fail "attach1, purging file after detach"}
- timeout {
- fail "(timeout) attach1, purging file after detach"
- }
- }
- set timeout $old_timeout
-
- # Verify that we can attach to the process just by giving the
- # process ID.
- #
- send_gdb "attach $testpid\n"
- gdb_expect {
- -re "Attaching to process $testpid.*Reading symbols from $escapedbinfile.*main.*at .*$gdb_prompt $"\
- {pass "attach2"}
- -re "$gdb_prompt $" {fail "attach2"}
- timeout {fail "(timeout) attach2"}
- }
-
- # Verify that we can modify the variable "should_exit" in the
- # program.
- #
- send_gdb "set should_exit=1\n"
- gdb_expect {
- -re "$gdb_prompt $" {pass "after attach2, set should_exit"}
- timeout {fail "(timeout) after attach2, set should_exit"}
- }
-
- # Verify that the modification really happened.
- #
- send_gdb "tbreak 19\n"
- gdb_expect {
- -re "Breakpoint .*at.*$srcfile, line 19.*$gdb_prompt $"\
- {pass "after attach2, set tbreak postloop"}
- -re "$gdb_prompt $" {fail "after attach2, set tbreak postloop"}
- timeout {fail "(timeout) after attach2, set tbreak postloop"}
- }
- send_gdb "continue\n"
- gdb_expect {
- -re "main.*at.*$srcfile:19.*$gdb_prompt $"\
- {pass "after attach2, reach tbreak postloop"}
- -re "$gdb_prompt $" {fail "after attach2, reach tbreak postloop"}
- timeout {fail "(timeout) after attach2, reach tbreak postloop"}
- }
-
- # Allow the test process to exit, to cleanup after ourselves.
- #
- send_gdb "continue\n"
- gdb_expect {
- -re "Program exited normally.*$gdb_prompt $"\
- {pass "after attach2, exit"}
- -re "$gdb_prompt $" {fail "after attach2, exit"}
- timeout {fail "(timeout) after attach2, exit"}
- }
-
- # Make sure we don't leave a process around to confuse
- # the next test run (and prevent the compile by keeping
- # the text file busy), in case the "set should_exit" didn't
- # work.
- #
- remote_exec build "kill -9 ${testpid}"
- # Start the program running and then wait for a bit, to be sure
- # that it can be attached to.
- #
- set testpid [eval exec $binfile &]
- exec sleep 2
-
- # Verify that we can attach to the process, and find its a.out
- # when we're cd'd to some directory that doesn't contain the
- # a.out. (We use the source path set by the "dir" command.)
- #
- send_gdb "dir ${objdir}/${subdir}\n"
- gdb_expect {
- -re ".*Source directories searched: .*$gdb_prompt $"\
- {pass "set source path"}
- -re "$gdb_prompt $" {fail "set source path"}
- timeout {fail "(timeout) set source path"}
- }
-
- send_gdb "cd /tmp\n"
- gdb_expect {
- -re ".*Working directory /tmp.*$gdb_prompt $"\
- {pass "cd away from process' a.out"}
- -re "$gdb_prompt $" {fail "cd away from process' a.out"}
- timeout {fail "(timeout) cd away from process' a.out"}
- }
-
- # Explicitly flush out any knowledge of the previous attachment.
- send_gdb "symbol\n"
- gdb_expect {
- -re ".*Discard symbol table from.*y or n. $"\
- {send_gdb "y\n"
- gdb_expect {
- -re ".*No symbol file now.*$gdb_prompt $"\
- {pass "before attach3, flush symbols"}
- -re "$gdb_prompt $" {fail "before attach3, flush symbols"}
- timeout {fail "(timeout) before attach3, flush symbols"}
- }
- }
- -re ".*No symbol file now.*$gdb_prompt $"\
- {pass "before attach3, flush symbols"}
- -re "$gdb_prompt $" {fail "before attach3, flush symbols"}
- timeout {fail "(timeout) before attach3, flush symbols"}
- }
- send_gdb "exec\n"
- gdb_expect {
- -re ".*No executable file now.*$gdb_prompt $"\
- {pass "before attach3, flush exec"}
- -re "$gdb_prompt $" {fail "before attach3, flush exec"}
- timeout {fail "(timeout) before attach3, flush exec"}
- }
-
- send_gdb "attach $testpid\n"
- gdb_expect {
- -re "Attaching to process $testpid.*Reading symbols from $escapedbinfile.*main.*at .*$gdb_prompt $"\
- {pass "attach when process' a.out not in cwd"}
- -re "$gdb_prompt $" {fail "attach when process' a.out not in cwd"}
- timeout {fail "(timeout) attach when process' a.out not in cwd"}
- }
-
- send_gdb "kill\n"
- gdb_expect {
- -re ".*Kill the program being debugged.*y or n. $"\
- {send_gdb "y\n"
- gdb_expect {
- -re "$gdb_prompt $" {pass "after attach3, exit"}
- timeout {fail "(timeout) after attach3, exit"}
- }
- }
- -re "$gdb_prompt $" {fail "after attach3, exit"}
- timeout {fail "(timeout) after attach3, exit"}
- }
+ global gdb_prompt
+ global binfile
+ global escapedbinfile
+ global srcfile
+ global testfile
+ global objdir
+ global subdir
+ global timeout
+
+ # Start the program running and then wait for a bit, to be sure
+ # that it can be attached to.
+
+ set testpid [eval exec $binfile &]
+ exec sleep 2
+ if { [istarget "*-*-cygwin*"] } {
+ # testpid is the Cygwin PID, GDB uses the Windows PID, which might be
+ # different due to the way fork/exec works.
+ set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ]
+ }
+
+ # Verify that we cannot attach to nonsense.
+
+ set test "attach to nonsense is prohibited"
+ gdb_test_multiple "attach abc" "$test" {
+ -re "Illegal process-id: abc.*$gdb_prompt $" {
+ pass "$test"
+ }
+ -re "Attaching to.*, process .*couldn't open /proc file.*$gdb_prompt $" {
+ # Response expected from /proc-based systems.
+ pass "$test"
+ }
+ -re "Can't attach to process..*$gdb_prompt $" {
+ # Response expected on Cygwin
+ pass "$test"
+ }
+ -re "Attaching to.*$gdb_prompt $" {
+ fail "$test (bogus pid allowed)"
+ }
+ }
+
+ # Verify that we cannot attach to what appears to be a valid
+ # process ID, but is a process that doesn't exist. Traditionally,
+ # most systems didn't have a process with ID 0, so we take that as
+ # the default. However, there are a few exceptions.
+
+ set boguspid 0
+ if { [istarget "*-*-*bsd*"] } {
+ # In FreeBSD 5.0, PID 0 is used for "swapper". Use -1 instead
+ # (which should have the desired effect on any version of
+ # FreeBSD, and probably other *BSD's too).
+ set boguspid -1
+ }
+ set test "attach to nonexistent process is prohibited"
+ gdb_test_multiple "attach $boguspid" "$test" {
+ -re "Attaching to.*, process $boguspid.*No such process.*$gdb_prompt $" {
+ # Response expected on ptrace-based systems (i.e. HP-UX 10.20).
+ pass "$test"
+ }
+ -re "Attaching to.*, process $boguspid failed.*Hint.*$gdb_prompt $" {
+ # Response expected on ttrace-based systems (i.e. HP-UX 11.0).
+ pass "$test"
+ }
+ -re "Attaching to.*, process $boguspid.*denied.*$gdb_prompt $" {
+ pass "$test"
+ }
+ -re "Attaching to.*, process $boguspid.*not permitted.*$gdb_prompt $" {
+ pass "$test"
+ }
+ -re "Attaching to.*, process .*couldn't open /proc file.*$gdb_prompt $" {
+ # Response expected from /proc-based systems.
+ pass "$test"
+ }
+ -re "Can't attach to process..*$gdb_prompt $" {
+ # Response expected on Cygwin
+ pass "$test"
+ }
+ }
+
+ # Verify that we can attach to the process by first giving its
+ # executable name via the file command, and using attach with the
+ # process ID.
+
+ # (Actually, the test system appears to do this automatically for
+ # us. So, we must also be prepared to be asked if we want to
+ # discard an existing set of symbols.)
+
+ set test "set file, before attach1"
+ gdb_test_multiple "file $binfile" "$test" {
+ -re "Load new symbol table from.*y or n. $" {
+ gdb_test "y" "Reading symbols from $escapedbinfile\.\.\.*done." \
+ "$test (re-read)"
+ }
+ -re "Reading symbols from $escapedbinfile\.\.\.*done.*$gdb_prompt $" {
+ pass "$test"
+ }
+ }
+
+ set test "attach1, after setting file"
+ gdb_test_multiple "attach $testpid" "$test" {
+ -re "Attaching to program.*`?$escapedbinfile'?, process $testpid.*main.*at .*$srcfile:.*$gdb_prompt $" {
+ pass "$test"
+ }
+ -re "Attaching to program.*`?$escapedbinfile\.exe'?, process $testpid.*\[Switching to thread $testpid\..*\].*$gdb_prompt $" {
+ # Response expected on Cygwin
+ pass "$test"
+ }
+ }
+
+ # Verify that we can "see" the variable "should_exit" in the
+ # program, and that it is zero.
+
+ gdb_test "print should_exit" " = 0" "after attach1, print should_exit"
+
+ # Detach the process.
+
+ gdb_test "detach" \
+ "Detaching from program: .*$escapedbinfile, process $testpid" \
+ "attach1 detach"
+
+ # Wait a bit for gdb to finish detaching
+
+ exec sleep 5
+
+ # Purge the symbols from gdb's brain. (We want to be certain the
+ # next attach, which won't be preceded by a "file" command, is
+ # really getting the executable file without our help.)
+
+ set old_timeout $timeout
+ set timeout 15
+ set test "attach1, purging symbols after detach"
+ gdb_test_multiple "file" "$test" {
+ -re "No executable file now.*Discard symbol table.*y or n. $" {
+ gdb_test "y" "No symbol file now." "$test"
+ }
+ }
+ set timeout $old_timeout
+
+ # Verify that we can attach to the process just by giving the
+ # process ID.
+
+ set test "set file, before attach2"
+ gdb_test_multiple "attach $testpid" "$test" {
+ -re "Attaching to process $testpid.*Load new symbol table from \"$escapedbinfile\.exe\".*y or n. $" {
+ # On Cygwin, the DLL's symbol tables are loaded prior to the
+ # executable's symbol table. This in turn always results in
+ # asking the user for actually loading the symbol table of the
+ # executable.
+ gdb_test "y" "Reading symbols from $escapedbinfile\.\.\.*done." \
+ "$test (reset file)"
+ }
+ -re "Attaching to process $testpid.*Reading symbols from $escapedbinfile.*main.*at .*$gdb_prompt $" {
+ pass "$test"
+ }
+ }
+
+ # Verify that we can modify the variable "should_exit" in the
+ # program.
+
+ gdb_test "set should_exit=1" "" "after attach2, set should_exit"
+
+ # Verify that the modification really happened.
+
+ send_gdb "tbreak 19\n"
+ gdb_expect {
+ -re "Breakpoint .*at.*$srcfile, line 19.*$gdb_prompt $" {
+ pass "after attach2, set tbreak postloop"
+ }
+ -re "$gdb_prompt $" {
+ fail "after attach2, set tbreak postloop"
+ }
+ timeout {
+ fail "(timeout) after attach2, set tbreak postloop"
+ }
+ }
+ send_gdb "continue\n"
+ gdb_expect {
+ -re "main.*at.*$srcfile:19.*$gdb_prompt $" {
+ pass "after attach2, reach tbreak postloop"
+ }
+ -re "$gdb_prompt $" {
+ fail "after attach2, reach tbreak postloop"
+ }
+ timeout {
+ fail "(timeout) after attach2, reach tbreak postloop"
+ }
+ }
+
+ # Allow the test process to exit, to cleanup after ourselves.
+
+ gdb_test "continue" "Program exited normally." "after attach2, exit"
+
+ # Make sure we don't leave a process around to confuse
+ # the next test run (and prevent the compile by keeping
+ # the text file busy), in case the "set should_exit" didn't
+ # work.
+
+ remote_exec build "kill -9 ${testpid}"
+
+ # Start the program running and then wait for a bit, to be sure
+ # that it can be attached to.
+
+ set testpid [eval exec $binfile &]
+ exec sleep 2
+ if { [istarget "*-*-cygwin*"] } {
+ # testpid is the Cygwin PID, GDB uses the Windows PID, which might be
+ # different due to the way fork/exec works.
+ set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ]
+ }
+
+ # Verify that we can attach to the process, and find its a.out
+ # when we're cd'd to some directory that doesn't contain the
+ # a.out. (We use the source path set by the "dir" command.)
+
+ gdb_test "dir ${objdir}/${subdir}" "Source directories searched: .*" \
+ "set source path"
+
+ gdb_test "cd /tmp" "Working directory /tmp." \
+ "cd away from process working directory"
+
+ # Explicitly flush out any knowledge of the previous attachment.
+
+ set test "before attach3, flush symbols"
+ gdb_test_multiple "symbol" "$test" {
+ -re "Discard symbol table from.*y or n. $" {
+ gdb_test "y" "No symbol file now." \
+ "$test"
+ }
+ -re "No symbol file now.*$gdb_prompt $" {
+ pass "$test"
+ }
+ }
+
+ gdb_test "exec" "No executable file now." \
+ "before attach3, flush exec"
+
+ gdb_test "attach $testpid" \
+ "Attaching to process $testpid.*Reading symbols from $escapedbinfile.*main.*at .*" \
+ "attach when process' a.out not in cwd"
+
+ set test "after attach3, exit"
+ gdb_test_multiple "kill" "$test" {
+ -re "Kill the program being debugged.*y or n. $" {
+ gdb_test "y" "" "$test"
+ }
+ }
+
+ # Another "don't leave a process around"
+ remote_exec build "kill -9 ${testpid}"
}
proc do_call_attach_tests {} {
- global gdb_prompt
- global binfile2
-
- # Start the program running and then wait for a bit, to be sure
- # that it can be attached to.
- #
- set testpid [eval exec $binfile2 &]
- exec sleep 2
-
- # Attach
- #
- gdb_test "file $binfile2" ".*" "force switch to gdb64, if necessary"
- send_gdb "attach $testpid\n"
- gdb_expect {
- -re ".*warning: reading register.*I.*O error.*$gdb_prompt $" {
- fail "attach call, read register 3 error"
- }
- -re "Attaching to.*process $testpid.*libc.*$gdb_prompt $" {
- pass "attach call"
- }
- -re "$gdb_prompt $" {fail "attach call"}
- timeout {fail "(timeout) attach call"}
- }
-
- # See if other registers are problems
- #
- send_gdb "i r r3\n"
- gdb_expect {
- -re ".*warning: reading register.*$gdb_prompt $" {
- pass "CHFts23490: known bug"
- }
- -re ".*r3.*$gdb_prompt $" {
- pass "Bug fixed, Yayyy!"
- }
- timeout { fail "timeout on info reg" }
- }
-
- # Get rid of the process
- #
- gdb_test "p should_exit = 1" ".*"
- gdb_test "c" ".*Program exited normally.*"
+ global gdb_prompt
+ global binfile2
+
+ # Start the program running and then wait for a bit, to be sure
+ # that it can be attached to.
- # Be paranoid
- #
- remote_exec build "kill -9 ${testpid}"
+ set testpid [eval exec $binfile2 &]
+ exec sleep 2
+ if { [istarget "*-*-cygwin*"] } {
+ # testpid is the Cygwin PID, GDB uses the Windows PID, which might be
+ # different due to the way fork/exec works.
+ set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ]
+ }
+
+ # Attach
+
+ gdb_test "file $binfile2" "" "force switch to gdb64, if necessary"
+ set test "attach call"
+ gdb_test_multiple "attach $testpid" "$test" {
+ -re "warning: reading register.*I.*O error.*$gdb_prompt $" {
+ fail "$test (read register error)"
+ }
+ -re "Attaching to.*process $testpid.*libc.*$gdb_prompt $" {
+ pass "$test"
+ }
+ -re "Attaching to.*process $testpid.*\[Switching to thread $testpid\..*\].*$gdb_prompt $" {
+ pass "$test"
+ }
+ }
+
+ # See if other registers are problems
+
+ set test "info other register"
+ gdb_test_multiple "i r r3" "$test" {
+ -re "warning: reading register.*$gdb_prompt $" {
+ fail "$test"
+ }
+ -re "r3.*$gdb_prompt $" {
+ pass "$test"
+ }
+ }
+ # Get rid of the process
+
+ gdb_test "p should_exit = 1"
+ gdb_test "c" "Program exited normally."
+
+ # Be paranoid
+
+ remote_exec build "kill -9 ${testpid}"
}
# Start with a fresh gdb
-#
+
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
# This is a test of gdb's ability to attach to a running process.
-#
+
do_attach_tests
# Test attaching when the target is inside a system call
-#
+
gdb_exit
gdb_start
diff --git a/gdb/testsuite/gdb.base/auxv.c b/gdb/testsuite/gdb.base/auxv.c
index 94f9d000f48..7eba5f97cfa 100644
--- a/gdb/testsuite/gdb.base/auxv.c
+++ b/gdb/testsuite/gdb.base/auxv.c
@@ -1,3 +1,23 @@
+/* Copyright 1992, 1993, 1994, 1995, 1996, 1999, 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. */
+
/* Simple little program that just generates a core dump from inside some
nested function calls. Keep this as self contained as possible, I.E.
use no environment resources other than possibly abort(). */
@@ -11,6 +31,7 @@
#endif
#if HAVE_ABORT
+#include <stdlib.h>
#define ABORT abort()
#else
#define ABORT {char *invalid = 0; *invalid = 0xFF;}
diff --git a/gdb/testsuite/gdb.base/auxv.exp b/gdb/testsuite/gdb.base/auxv.exp
index 3a509b98242..cb064f560a5 100644
--- a/gdb/testsuite/gdb.base/auxv.exp
+++ b/gdb/testsuite/gdb.base/auxv.exp
@@ -82,12 +82,15 @@ proc fetch_auxv {test} {
}
-ex "The program has no auxiliary information now" {
set bad 1
+ exp_continue
}
-ex "Auxiliary vector is empty" {
set bad 1
+ exp_continue
}
-ex "No auxiliary vector found" {
set bad 1
+ exp_continue
}
-re "^\[0-9\]+\[ \t\]+(AT_\[^ \t\]+)\[^\r\n\]+\[\r\n\]+" {
lappend auxv_lines $expect_out(0,string)
@@ -103,8 +106,11 @@ proc fetch_auxv {test} {
incr bad
}
-re "^\[^\r\n\]+\[\r\n\]+" {
- warning "Unrecognized output: $expect_out(0,string)"
- set bad 1
+ if {!$bad} {
+ warning "Unrecognized output: $expect_out(0,string)"
+ set bad 1
+ }
+ exp_continue
}
}] != 0} {
return {}
diff --git a/gdb/testsuite/gdb.base/bigcore.c b/gdb/testsuite/gdb.base/bigcore.c
index 8cd1b5f98d2..2a8bb077bb8 100644
--- a/gdb/testsuite/gdb.base/bigcore.c
+++ b/gdb/testsuite/gdb.base/bigcore.c
@@ -19,10 +19,13 @@
Please email any bugs, comments, and/or additions to this file to:
bug-gdb@prep.ai.mit.edu */
-#include <unistd.h>
-#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/time.h>
#include <sys/resource.h>
+#include <stdlib.h>
+#include <unistd.h>
+
/* Print routines:
The following are so that printf et.al. can be avoided. Those
@@ -117,6 +120,8 @@ struct list
static struct list dummy;
static struct list heap = { &dummy, &dummy };
+static unsigned long bytes_allocated;
+
int
main ()
{
@@ -151,14 +156,13 @@ main ()
each section. The linking ensures that some, but not all, the
memory is allocated. NB: Some kernels handle this efficiently -
only allocating and writing out referenced pages leaving holes in
- the file for unreferend pages - while others handle this poorly -
- writing out all pages including those that wern't referenced. */
+ the file for unmodified pages - while others handle this poorly -
+ writing out all pages including those that weren't modified. */
print_string ("Alocating the entire heap ...\n");
{
size_t chunk_size;
- long bytes_allocated = 0;
- long chunks_allocated = 0;
+ unsigned long chunks_allocated = 0;
/* Create a linked list of memory chunks. Start with
MAX_CHUNK_SIZE blocks of memory and then try allocating smaller
and smaller amounts until all (well at least most) memory has
diff --git a/gdb/testsuite/gdb.base/bigcore.exp b/gdb/testsuite/gdb.base/bigcore.exp
index 58cbfa1cc66..b7201365361 100644
--- a/gdb/testsuite/gdb.base/bigcore.exp
+++ b/gdb/testsuite/gdb.base/bigcore.exp
@@ -41,7 +41,10 @@ if ![isnative] then {
# consumes too many resources - gigabytes worth of disk space and and
# I/O bandwith.
-if { [istarget "*-*-*bsd*"] || [istarget "*-*-hpux*"] } {
+if { [istarget "*-*-*bsd*"]
+ || [istarget "*-*-hpux*"]
+ || [istarget "*-*-solaris*"]
+ || [istarget "*-*-cygwin*"] } {
untested "Kernel lacks sparse corefile support (PR gdb/1551)"
return
}
@@ -103,9 +106,30 @@ gdb_test "tbreak $print_core_line"
gdb_test continue ".*print_string.*"
gdb_test next ".*0 = 0.*"
+# Check that the corefile is plausibly large enough. We're trying to
+# detect the case where the operating system has truncated the file
+# just before signed wraparound. TCL, unfortunately, has a similar
+# problem - so use catch. It can handle the "bad" size but not necessarily
+# the "good" one. And we must use GDB for the comparison, similarly.
+
+if {[catch {file size $corefile} core_size] == 0} {
+ set core_ok 0
+ gdb_test_multiple "print bytes_allocated < $core_size" "check core size" {
+ -re " = 1\r\n$gdb_prompt $" {
+ pass "check core size"
+ set core_ok 1
+ }
+ -re " = 0\r\n$gdb_prompt $" {
+ xfail "check core size (system does not support large corefiles)"
+ }
+ }
+ if {$core_ok == 0} {
+ return 0
+ }
+}
+
# Traverse part of bigcore's linked list of memory chunks (forward or
-# backward), saving each chunk's address. I don't know why but
-# expect_out didn't work with gdb_test_multiple.
+# backward), saving each chunk's address.
proc extract_heap { dir } {
global gdb_prompt
@@ -113,8 +137,7 @@ proc extract_heap { dir } {
set heap ""
set test "extract ${dir} heap"
set lim 0
- send_gdb "print heap.${dir}\n"
- gdb_expect {
+ gdb_test_multiple "print heap.${dir}" "$test" {
-re " = \\(struct list \\*\\) 0x0.*$gdb_prompt $" {
pass "$test"
}
diff --git a/gdb/testsuite/gdb.base/call-rt-st.exp b/gdb/testsuite/gdb.base/call-rt-st.exp
index 4a912fcdc29..7152a4a1d7f 100644
--- a/gdb/testsuite/gdb.base/call-rt-st.exp
+++ b/gdb/testsuite/gdb.base/call-rt-st.exp
@@ -187,13 +187,13 @@ if {![gdb_skip_float_test "print print_two_floats(*f3)"] && \
".*Contents of two_floats_t:\[ \r\n\]+-2\\.345000\[ \t]+1\\.000000\[ \r\n\]+.\[0-9\]+ = \\{float1 = -2\\.34500003, float2 = 1\\}"
}
-if ![gdb_skip_stdio_test "print print_bit_flags_char(*flags)"] {
- print_struct_call "print_bit_flags_char(*flags)" \
+if ![gdb_skip_stdio_test "print print_bit_flags_char(*cflags)"] {
+ print_struct_call "print_bit_flags_char(*cflags)" \
".*alpha\[ \r\n\]+gamma\[ \r\n\]+epsilon\[ \r\n\]+.\[0-9\]+ = \\{alpha = 1 '\\\\001', beta = 0 '\\\\0', gamma = 1 '\\\\001', delta = 0 '\\\\0', epsilon = 1 '\\\\001', omega = 0 '\\\\0'\\}"
}
-if ![gdb_skip_stdio_test "print print_bit_flags_short(*flags)"] {
- print_struct_call "print_bit_flags_short(*flags)" \
+if ![gdb_skip_stdio_test "print print_bit_flags_short(*sflags)"] {
+ print_struct_call "print_bit_flags_short(*sflags)" \
".*alpha\[ \r\n\]+gamma\[ \r\n\]+epsilon\[ \r\n\]+.\[0-9\]+ = \\{alpha = 1, beta = 0, gamma = 1, delta = 0, epsilon = 1, omega = 0\\}"
}
diff --git a/gdb/testsuite/gdb.base/call-sc.c b/gdb/testsuite/gdb.base/call-sc.c
new file mode 100644
index 00000000000..70ae87f7991
--- /dev/null
+++ b/gdb/testsuite/gdb.base/call-sc.c
@@ -0,0 +1,83 @@
+/* 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.
+
+*/
+
+/* Useful abreviations. */
+typedef void t;
+typedef char tc;
+typedef short ts;
+typedef int ti;
+typedef long tl;
+typedef long long tll;
+typedef float tf;
+typedef double td;
+typedef long double tld;
+typedef enum { e = '1' } te;
+
+/* Force the type of each field. */
+#ifndef T
+typedef t T;
+#endif
+
+T foo = '1', L;
+
+T fun()
+{
+ return foo;
+}
+
+#ifdef PROTOTYPES
+void Fun(T foo)
+#else
+void Fun(foo)
+ T foo;
+#endif
+{
+ L = foo;
+}
+
+zed ()
+{
+ L = 'Z';
+}
+
+int main()
+{
+#ifdef usestubs
+ set_debug_traps();
+ breakpoint();
+#endif
+ int i;
+
+ Fun(foo);
+
+ /* An infinite loop that first clears all the variables and then
+ calls the function. This "hack" is to make re-testing easier -
+ "advance fun" is guaranteed to have always been preceeded by a
+ global variable clearing zed call. */
+
+ zed ();
+ while (1)
+ {
+ L = fun ();
+ zed ();
+ }
+
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.base/call-sc.exp b/gdb/testsuite/gdb.base/call-sc.exp
new file mode 100644
index 00000000000..01a9f152097
--- /dev/null
+++ b/gdb/testsuite/gdb.base/call-sc.exp
@@ -0,0 +1,500 @@
+# 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.
+
+# Test "return", "finish", and "call" of functions that a scalar (int,
+# float, enum) and/or take a single scalar parameter.
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+# Some targets can't call functions, so don't even bother with this
+# test.
+
+if [target_info exists gdb,cannot_call_functions] {
+ setup_xfail "*-*-*"
+ fail "This target can not call functions"
+ continue
+}
+
+set testfile "call-sc"
+set srcfile ${testfile}.c
+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}] {
+ return -1;
+}
+
+# Use the file name, compiler and tuples to set up any needed KFAILs.
+
+proc setup_kfails { file tuples bug } {
+ global testfile
+ if [string match $file $testfile] {
+ foreach f $tuples { setup_kfail $f $bug }
+ }
+}
+
+proc setup_compiler_kfails { file compiler format tuples bug } {
+ global testfile
+ if {[string match $file $testfile] && [test_compiler_info $compiler] && [test_debug_format $format]} {
+ foreach f $tuples { setup_kfail $f $bug }
+ }
+}
+
+# Compile a variant of scalars.c using TYPE to specify the type of the
+# parameter and return-type. Run the compiled program up to "main".
+# Also updates the global "testfile" to reflect the most recent build.
+
+proc start_scalars_test { type } {
+ global testfile
+ global srcfile
+ global binfile
+ global objdir
+ global subdir
+ global srcdir
+ global gdb_prompt
+ global expect_out
+
+ # Create the additional flags
+ set flags "debug additional_flags=-DT=${type}"
+ set testfile "call-sc-${type}"
+
+ set binfile ${objdir}/${subdir}/${testfile}
+ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "${flags}"] != "" } {
+ # built the second test case since we can't use prototypes
+ warning "Prototypes not supported, rebuilding with -DNO_PROTOTYPES"
+ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "${flags} additional_flags=-DNO_PROTOTYPES"] != "" } {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+ }
+ }
+
+ # Start with a fresh gdb.
+ gdb_exit
+ gdb_start
+ gdb_reinitialize_dir $srcdir/$subdir
+ gdb_load ${binfile}
+
+ # Make certain that the output is consistent
+ gdb_test "set print sevenbit-strings" "" \
+ "set print sevenbit-strings; ${testfile}"
+ gdb_test "set print address off" "" \
+ "set print address off; ${testfile}"
+ gdb_test "set width 0" "" \
+ "set width 0; ${testfile}"
+
+ # Advance to main
+ if { ![runto_main] } then {
+ gdb_suppress_tests;
+ }
+
+ # Get the debug format
+ get_debug_format
+
+ # check that type matches what was passed in
+ set test "ptype; ${testfile}"
+ set foo_t "xxx"
+ gdb_test_multiple "ptype ${type}" "${test}" {
+ -re "type = (\[^\r\n\]*)\r\n$gdb_prompt $" {
+ set foo_t "$expect_out(1,string)"
+ pass "$test (${foo_t})"
+ }
+ }
+ gdb_test "ptype foo" "type = ${foo_t}" "ptype foo; ${testfile} $expect_out(1,string)"
+}
+
+
+# Given N (0..25), return the corresponding alphabetic letter in lower
+# or upper case. This is ment to be i18n proof.
+
+proc i2a { n } {
+ return [string range "abcdefghijklmnopqrstuvwxyz" $n $n]
+}
+
+proc I2A { n } {
+ return [string toupper [i2a $n]]
+}
+
+
+# Use the file name, compiler and tuples to set up any needed KFAILs.
+
+proc setup_kfails { file tuples bug } {
+ global testfile
+ if [string match $file $testfile] {
+ foreach f $tuples { setup_kfail $f $bug }
+ }
+}
+
+proc setup_compiler_kfails { file compiler format tuples bug } {
+ global testfile
+ if {[string match $file $testfile] && [test_compiler_info $compiler] && [test_debug_format $format]} {
+ foreach f $tuples { setup_kfail $f $bug }
+ }
+}
+
+# Test GDB's ability to make inferior function calls to functions
+# returning (or passing) in a single scalar.
+
+# start_scalars_test() will have previously built a program with a
+# specified scalar type. To ensure robustness of the output, "p/c" is
+# used.
+
+# This tests the code paths "which return-value convention?" and
+# "extract return-value from registers" called by "infcall.c".
+
+proc test_scalar_calls { } {
+ global testfile
+ global gdb_prompt
+
+ # Check that GDB can always extract a scalar-return value from an
+ # inferior function call. Since GDB always knows the location of
+ # an inferior function call's return value these should never fail
+
+ # Implemented by calling the parameterless function "fun" and then
+ # examining the return value printed by GDB.
+
+ set tests "call ${testfile}"
+
+ # Call fun, checking the printed return-value.
+ gdb_test "p/c fun()" "= 49 '1'" "p/c fun(); ${tests}"
+
+ # Check that GDB can always pass a structure to an inferior function.
+ # This test can never fail.
+
+ # Implemented by calling the one parameter function "Fun" which
+ # stores its parameter in the global variable "L". GDB then
+ # examining that global to confirm that the value is as expected.
+
+ gdb_test "call Fun(foo)" "" "call Fun(foo); ${tests}"
+ gdb_test "p/c L" " = 49 '1'" "p/c L; ${tests}"
+}
+
+# Test GDB's ability to both return a function (with "return" or
+# "finish") and correctly extract/store any corresponding
+# return-value.
+
+# Check that GDB can consistently extract/store structure return
+# values. There are two cases - returned in registers and returned in
+# memory. For the latter case, the return value can't be found and a
+# failure is "expected". However GDB must still both return the
+# function and display the final source and line information.
+
+# N identifies the number of elements in the struct that will be used
+# for the test case. FAILS is a list of target tuples that will fail
+# this test.
+
+# This tests the code paths "which return-value convention?", "extract
+# return-value from registers", and "store return-value in registers".
+# Unlike "test struct calls", this test is expected to "fail" when the
+# return-value is in memory (GDB can't find the location). The test
+# is in three parts: test "return"; test "finish"; check that the two
+# are consistent. GDB can sometimes work for one command and not the
+# other.
+
+proc test_scalar_returns { } {
+ global gdb_prompt
+ global testfile
+
+ set tests "return ${testfile}"
+
+
+ # Check that "return" works.
+
+ # GDB must always force the return of a function that has
+ # a struct result. Dependant on the ABI, it may, or may not be
+ # possible to store the return value in a register.
+
+ # The relevant code looks like "L{n} = fun{n}()". The test forces
+ # "fun{n}" to "return" with an explicit value. Since that code
+ # snippet will store the the returned value in "L{n}" the return
+ # is tested by examining "L{n}". This assumes that the
+ # compiler implemented this as fun{n}(&L{n}) and hence that when
+ # the value isn't stored "L{n}" remains unchanged. Also check for
+ # consistency between this and the "finish" case.
+
+ # Get into a call of fun
+ gdb_test "advance fun" \
+ "fun .*\[\r\n\]+\[0-9\].*return foo.*" \
+ "advance to fun for return; ${tests}"
+
+ # Check that the program invalidated the relevant global.
+ gdb_test "p/c L" " = 90 'Z'" "zed L for return; ${tests}"
+
+ # Force the "return". This checks that the return is always
+ # performed, and that GDB correctly reported this to the user.
+ # GDB 6.0 and earlier, when the return-value's location wasn't
+ # known, both failed to print a final "source and line" and misplaced
+ # the frame ("No frame").
+
+ # The test is writen so that it only reports one FAIL/PASS for the
+ # entire operation. The value returned is checked further down.
+ # "return_value_unknown", if non-empty, records why GDB realised
+ # that it didn't know where the return value was.
+
+ set test "return foo; ${tests}"
+ set return_value_unknown 0
+ set return_value_unimplemented 0
+ gdb_test_multiple "return foo" "${test}" {
+ -re "The location" {
+ # Ulgh, a struct return, remember this (still need prompt).
+ set return_value_unknown 1
+ exp_continue
+ }
+ -re "A structure or union" {
+ # Ulgh, a struct return, remember this (still need prompt).
+ set return_value_unknown 1
+ # Double ulgh. Architecture doesn't use return_value and
+ # hence hasn't implemented small structure return.
+ set return_value_unimplemented 1
+ exp_continue
+ }
+ -re "Make fun return now.*y or n. $" {
+ gdb_test_multiple "y" "${test}" {
+ -re "L *= fun.*${gdb_prompt} $" {
+ # Need to step off the function call
+ gdb_test "next" "zed.*" "${test}"
+ }
+ -re "zed \\(\\);.*$gdb_prompt $" {
+ pass "${test}"
+ }
+ }
+ }
+ }
+
+ # If the previous test did not work, the program counter might
+ # still be inside foo() rather than main(). Make sure the program
+ # counter is is main().
+ #
+ # This happens on ppc64 GNU/Linux with gcc 3.4.1 and a buggy GDB
+
+ set test "return foo; synchronize pc to main()"
+ for {set loop_count 0} {$loop_count < 2} {incr loop_count} {
+ gdb_test_multiple "backtrace 1" $test {
+ -re "#0.*main \\(\\).*${gdb_prompt} $" {
+ pass $test
+ set loop_count 2
+ }
+ -re "#0.*fun \\(\\).*${gdb_prompt} $" {
+ if {$loop_count < 1} {
+ gdb_test "finish" ".*" ""
+ } else {
+ fail $test
+ set loop_count 2
+ }
+ }
+ }
+ }
+
+ # Check that the return-value is as expected. At this stage we're
+ # just checking that GDB has returned a value consistent with
+ # "return_value_unknown" set above.
+
+ set test "value foo returned; ${tests}"
+ gdb_test_multiple "p/c L" "${test}" {
+ -re " = 49 '1'.*${gdb_prompt} $" {
+ if $return_value_unknown {
+ # This contradicts the above claim that GDB didn't
+ # know the location of the return-value.
+ fail "${test}"
+ } else {
+ pass "${test}"
+ }
+ }
+ -re " = 90 .*${gdb_prompt} $" {
+ if $return_value_unknown {
+ # The struct return case. Since any modification
+ # would be by reference, and that can't happen, the
+ # value should be unmodified and hence Z is expected.
+ # Is this a reasonable assumption?
+ pass "${test}"
+ } else {
+ # This contradicts the above claim that GDB knew
+ # the location of the return-value.
+ fail "${test}"
+ }
+ }
+ -re ".*${gdb_prompt} $" {
+ if $return_value_unimplemented {
+ # What a suprize. The architecture hasn't implemented
+ # return_value, and hence has to fail.
+ kfail "$test" gdb/1444
+ } else {
+ fail "$test"
+ }
+ }
+ }
+
+ # Check that a "finish" works.
+
+ # This is almost but not quite the same as "call struct funcs".
+ # Architectures can have subtle differences in the two code paths.
+
+ # The relevant code snippet is "L{n} = fun{n}()". The program is
+ # advanced into a call to "fun{n}" and then that function is
+ # finished. The returned value that GDB prints, reformatted using
+ # "p/c", is checked.
+
+ # Get into "fun()".
+ gdb_test "advance fun" \
+ "fun .*\[\r\n\]+\[0-9\].*return foo.*" \
+ "advance to fun for finish; ${tests}"
+
+ # Check that the program invalidated the relevant global.
+ gdb_test "p/c L" " = 90 'Z'" "zed L for finish; ${tests}"
+
+ # Finish the function, set 'finish_value_unknown" to non-empty if the
+ # return-value was not found.
+ set test "finish foo; ${tests}"
+ set finish_value_unknown 0
+ gdb_test_multiple "finish" "${test}" {
+ -re "Value returned is .*${gdb_prompt} $" {
+ pass "${test}"
+ }
+ -re "Cannot determine contents.*${gdb_prompt} $" {
+ # Expected bad value. For the moment this is ok.
+ set finish_value_unknown 1
+ pass "${test}"
+ }
+ }
+
+ # Re-print the last (return-value) using the more robust
+ # "p/c". If no return value was found, the 'Z' from the previous
+ # check that the variable was cleared, is printed.
+ set test "value foo finished; ${tests}"
+ gdb_test_multiple "p/c" "${test}" {
+ -re " = 49 '1'\[\r\n\]+${gdb_prompt} $" {
+ if $finish_value_unknown {
+ # This contradicts the above claim that GDB didn't
+ # know the location of the return-value.
+ fail "${test}"
+ } else {
+ pass "${test}"
+ }
+ }
+ -re " = 90 'Z'\[\r\n\]+${gdb_prompt} $" {
+ # The value didn't get found. This is "expected".
+ if $finish_value_unknown {
+ pass "${test}"
+ } else {
+ # This contradicts the above claim that GDB did
+ # know the location of the return-value.
+ fail "${test}"
+ }
+ }
+ }
+
+ # Finally, check that "return" and finish" have consistent
+ # behavior.
+
+ # Since both "return" and "finish" use equivalent "which
+ # return-value convention" logic, both commands should have
+ # identical can/can-not find return-value messages.
+
+ # Note that since "call" and "finish" use common code paths, a
+ # failure here is a strong indicator of problems with "store
+ # return-value" code paths. Suggest looking at "return_value"
+ # when investigating a fix.
+
+ set test "return and finish use same convention; ${tests}"
+ if {$finish_value_unknown == $return_value_unknown} {
+ pass "${test}"
+ } else {
+ kfail gdb/1444 "${test}"
+ }
+}
+
+# ABIs pass anything >8 or >16 bytes in memory but below that things
+# randomly use register and/and structure conventions. Check all
+# possible sized char scalars in that range. But only a restricted
+# range of the other types.
+
+# NetBSD/PPC returns "unnatural" (3, 5, 6, 7) sized scalars in memory.
+
+# d10v is weird. 5/6 byte scalars go in memory. 2 or more char
+# scalars go in memory. Everything else is in a register!
+
+# Test every single char struct from 1..17 in size. This is what the
+# original "scalars" test was doing.
+
+start_scalars_test tc
+test_scalar_calls
+test_scalar_returns
+
+
+# Let the fun begin.
+
+# Assuming that any integer struct larger than 8 bytes goes in memory,
+# come up with many and varied combinations of a return struct. For
+# "struct calls" test just beyond that 8 byte boundary, for "struct
+# returns" test up to that boundary.
+
+# For floats, assumed that up to two struct elements can be stored in
+# floating point registers, regardless of their size.
+
+# The approx size of each structure it is computed assumed that tc=1,
+# ts=2, ti=4, tl=4, tll=8, tf=4, td=8, tld=16, and that all fields are
+# naturally aligned. Padding being added where needed. Note that
+# these numbers are just approx, the d10v has ti=2, a 64-bit has has
+# tl=8.
+
+# Approx size: 2, 4, ...
+start_scalars_test ts
+test_scalar_calls
+test_scalar_returns
+
+# Approx size: 4, 8, ...
+start_scalars_test ti
+test_scalar_calls
+test_scalar_returns
+
+# Approx size: 4, 8, ...
+start_scalars_test tl
+test_scalar_calls
+test_scalar_returns
+
+# Approx size: 8, 16, ...
+start_scalars_test tll
+test_scalar_calls
+test_scalar_returns
+
+# Approx size: 4, 8, ...
+start_scalars_test tf
+test_scalar_calls
+test_scalar_returns
+
+# Approx size: 8, 16, ...
+start_scalars_test td
+test_scalar_calls
+test_scalar_returns
+
+# Approx size: 16, 32, ...
+start_scalars_test tld
+test_scalar_calls
+test_scalar_returns
+
+# Approx size: 4, 8, ...
+start_scalars_test te
+test_scalar_calls
+test_scalar_returns
+
+return 0
diff --git a/gdb/testsuite/gdb.base/charset.c b/gdb/testsuite/gdb.base/charset.c
index 4361ffc7bc2..d35c1baa7d4 100644
--- a/gdb/testsuite/gdb.base/charset.c
+++ b/gdb/testsuite/gdb.base/charset.c
@@ -22,6 +22,7 @@
bug-gdb@gnu.org */
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
diff --git a/gdb/testsuite/gdb.base/charset.exp b/gdb/testsuite/gdb.base/charset.exp
index 780e909dbca..588bf059c77 100644
--- a/gdb/testsuite/gdb.base/charset.exp
+++ b/gdb/testsuite/gdb.base/charset.exp
@@ -140,7 +140,7 @@ gdb_expect {
# We got some output that ended with a regular prompt
fail "get valid character sets"
}
- -re "^set charset.*$" {
+ -re ".*$gdb_prompt set charset.*$" {
# We got some other output, send a cntrl-c to gdb to get us back
# to the prompt.
send_gdb "\003"
@@ -200,7 +200,6 @@ gdb_expect {
-re "\\.\r\n$gdb_prompt $" {
#set host_charset_list $expect_out(1,string)
- set charsets($expect_out(1,string)) 1
pass "capture valid host charsets"
}
diff --git a/gdb/testsuite/gdb.base/complex.c b/gdb/testsuite/gdb.base/complex.c
index 98cdd29d0ea..dabbdd60595 100644
--- a/gdb/testsuite/gdb.base/complex.c
+++ b/gdb/testsuite/gdb.base/complex.c
@@ -1,6 +1,28 @@
+/* Copyright 2002, 2003, 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. */
+
/* Test taken from GCC. Verify that we can print a structure containing
a complex number. */
+#include <stdlib.h>
+
typedef __complex__ float cf;
struct x { char c; cf f; } __attribute__ ((__packed__));
struct unpacked_x { char c; cf f; };
diff --git a/gdb/testsuite/gdb.base/coremaker.c b/gdb/testsuite/gdb.base/coremaker.c
index 4bb16d46aa4..a7fbd94141a 100644
--- a/gdb/testsuite/gdb.base/coremaker.c
+++ b/gdb/testsuite/gdb.base/coremaker.c
@@ -1,3 +1,23 @@
+/* Copyright 1992, 1993, 1994, 1995, 1996, 1999
+ 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. */
+
/* Simple little program that just generates a core dump from inside some
nested function calls. */
diff --git a/gdb/testsuite/gdb.base/coremaker2.c b/gdb/testsuite/gdb.base/coremaker2.c
index 94f9d000f48..470c6d491f1 100644
--- a/gdb/testsuite/gdb.base/coremaker2.c
+++ b/gdb/testsuite/gdb.base/coremaker2.c
@@ -1,3 +1,23 @@
+/* Copyright 1992, 1993, 1994, 1995, 1996, 1999
+ 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. */
+
/* Simple little program that just generates a core dump from inside some
nested function calls. Keep this as self contained as possible, I.E.
use no environment resources other than possibly abort(). */
diff --git a/gdb/testsuite/gdb.base/define.exp b/gdb/testsuite/gdb.base/define.exp
index 7e948f18e01..74682feee3b 100644
--- a/gdb/testsuite/gdb.base/define.exp
+++ b/gdb/testsuite/gdb.base/define.exp
@@ -1,4 +1,4 @@
-# Copyright 1998, 1999, 2001, 2003 Free Software Foundation, Inc.
+# Copyright 1998, 1999, 2001, 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
@@ -200,6 +200,40 @@ gdb_expect {
timeout {fail "(timeout) help user command: nextwhere"}
}
+# Verify that the command parser doesn't require a space after an 'if'
+# command in a user defined function.
+#
+gdb_test_multiple "define ifnospace" "define user command: ifnospace" \
+{
+ -re "Type commands for definition of \"ifnospace\".\r\nEnd with a line saying just \"end\".\r\n>$" \
+ {
+ gdb_test_multiple "if(3<4)\nprint \"hi there\\n\"\nend\nend" "send body of ifnospace" \
+ {
+ -re "$gdb_prompt $"\
+ {pass "define user command: ifnospace"}
+ }
+ }
+}
+
+gdb_test "ifnospace" ".*hi there.*" "test ifnospace is parsed correctly"
+
+# Verify that the command parser doesn't require a space after an 'while'
+# command in a user defined function.
+#
+gdb_test_multiple "define whilenospace" "define user command: whilenospace" \
+{
+ -re "Type commands for definition of \"whilenospace\".\r\nEnd with a line saying just \"end\".\r\n>$" \
+ {
+ gdb_test_multiple "set \$i=1\nwhile(\$i<2)\nset \$i=2\nprint \"hi there\\n\"\nend\nend" "send body of whilenospace" \
+ {
+ -re "$gdb_prompt $" \
+ {pass "define user command: whilenospace"}
+ }
+ }
+}
+
+gdb_test "whilenospace" ".*hi there.*" "test whilenospace is parsed correctly"
+
# Verify that the user can "hook" a builtin command. We choose to
# hook the "stop" pseudo command, and we'll define it to use a user-
# define command.
diff --git a/gdb/testsuite/gdb.base/dump.exp b/gdb/testsuite/gdb.base/dump.exp
index 5e88693889b..a55dc50932b 100644
--- a/gdb/testsuite/gdb.base/dump.exp
+++ b/gdb/testsuite/gdb.base/dump.exp
@@ -113,18 +113,26 @@ make_dump_file "dump tekhex val intarr1.tekhex intarray" \
make_dump_file "dump tekhex val intstr1.tekhex intstruct" \
"dump struct as value, tekhex"
-proc capture_value { expression } {
+proc capture_value { expression args } {
global gdb_prompt
global expect_out
set output_string ""
- send_gdb "print ${expression}\n"
- gdb_expect {
- -re ".*\[\r\n\]+.\[0123456789\]+ = (\[^\r\n\]+).*$gdb_prompt $" {
- set output_string $expect_out(1,string)
+ if {[llength $args] > 0} {
+ # Convert $args into a simple string.
+ set test "[join $args]; capture $expression"
+ } {
+ set test "capture $expression"
+ }
+ gdb_test_multiple "print ${expression}" "$test" {
+ -re "\\$\[0-9\]+ = (\[^\r\n\]+).*$gdb_prompt $" {
+ set output_string "$expect_out(1,string)"
+ pass "$test"
}
- default {
- fail "capture_value failed on $expression."
+ -re "(Cannot access memory at address \[^\r\n\]+).*$gdb_prompt $" {
+ # Even a failed value is valid
+ set output_string "$expect_out(1,string)"
+ pass "$test"
}
}
return $output_string
@@ -182,13 +190,15 @@ gdb_file_cmd ${binfile}
# Reload saved values one by one, and compare.
-if { ![string compare $array_val [capture_value "intarray"]] } then {
+if { ![string compare $array_val \
+ [capture_value "intarray" "file binfile"]] } then {
fail "start with intarray un-initialized"
} else {
pass "start with intarray un-initialized"
}
-if { ![string compare $struct_val [capture_value "intstruct"]] } then {
+if { ![string compare $struct_val \
+ [capture_value "intstruct" "file binfile"]] } then {
fail "start with intstruct un-initialized"
} else {
pass "start with intstruct un-initialized"
@@ -198,10 +208,11 @@ proc test_reload_saved_value { filename msg oldval newval } {
global gdb_prompt
gdb_file_cmd $filename
- if { ![string compare $oldval [capture_value $newval]] } then {
- pass $msg
+ if { ![string compare $oldval \
+ [capture_value $newval "$msg"]] } then {
+ pass "$msg; value restored ok"
} else {
- fail $msg
+ fail "$msg; value restored ok"
}
}
@@ -209,13 +220,13 @@ proc test_restore_saved_value { restore_args msg oldval newval } {
global gdb_prompt
gdb_test "restore $restore_args" \
- "Restoring .*" \
- "Restore command, $msg"
-
- if { ![string compare $oldval [capture_value $newval]] } then {
- pass "Restored value, $msg"
+ "Restoring .*" \
+ "$msg; file restored ok"
+ if { ![string compare $oldval \
+ [capture_value $newval "$msg"]] } then {
+ pass "$msg; value restored ok"
} else {
- fail "Restored value, $msg"
+ fail "$msg; value restored ok"
}
}
@@ -268,13 +279,15 @@ if { ! [ runto_main ] } then {
gdb_suppress_entire_file "Program failed to run, so remaining tests in this file will automatically fail."
}
-if { ![string compare $array_val [capture_value "intarray"]] } then {
+if { ![string compare $array_val \
+ [capture_value "intarray" "load binfile"]] } then {
fail "start with intarray un-initialized, runto main"
} else {
pass "start with intarray un-initialized, runto main"
}
-if { ![string compare $struct_val [capture_value "intstruct"]] } then {
+if { ![string compare $struct_val \
+ [capture_value "intstruct" "load binfile"]] } then {
fail "start with intstruct un-initialized, runto main"
} else {
pass "start with intstruct un-initialized, runto main"
@@ -420,8 +433,7 @@ if ![string compare $is64bitonly "no"] then {
gdb_test "print zero_all ()" ""
test_restore_saved_value "intarr1.srec 0 $element3_start $element4_start" \
- "array partial, srec" \
- [capture_value "4"] "intarray\[3\]"
+ "array partial, srec" 4 "intarray\[3\]"
gdb_test "print intarray\[2\] == 0" " = 1" "element 2 not changed - 1"
gdb_test "print intarray\[4\] == 0" " = 1" "element 4 not changed - 1"
@@ -429,8 +441,7 @@ if ![string compare $is64bitonly "no"] then {
gdb_test "print zero_all ()" ""
test_restore_saved_value "intarr1.ihex 0 $element3_start $element4_start" \
- "array partial, ihex" \
- [capture_value "4"] "intarray\[3\]"
+ "array partial, ihex" 4 "intarray\[3\]"
gdb_test "print intarray\[2\] == 0" " = 1" "element 2 not changed - 2"
gdb_test "print intarray\[4\] == 0" " = 1" "element 4 not changed - 2"
@@ -438,8 +449,7 @@ if ![string compare $is64bitonly "no"] then {
gdb_test "print zero_all ()" ""
test_restore_saved_value "intarr1.tekhex 0 $element3_start $element4_start" \
- "array partial, tekhex" \
- [capture_value "4"] "intarray\[3\]"
+ "array partial, tekhex" 4 "intarray\[3\]"
gdb_test "print intarray\[2\] == 0" " = 1" "element 2 not changed - 3"
gdb_test "print intarray\[4\] == 0" " = 1" "element 4 not changed - 3"
@@ -449,8 +459,7 @@ gdb_test "print zero_all ()" ""
test_restore_saved_value \
"intarr1.bin binary $array_start $element3_offset $element4_offset" \
- "array partial, binary" \
- [capture_value "4"] "intarray\[3\]"
+ "array partial, binary" 4 "intarray\[3\]"
gdb_test "print intarray\[2\] == 0" " = 1" "element 2 not changed - 4"
gdb_test "print intarray\[4\] == 0" " = 1" "element 4 not changed - 4"
@@ -461,8 +470,7 @@ if ![string compare $is64bitonly "no"] then {
# restore with expressions
test_restore_saved_value \
"intarr3.srec ${array2_start}-${array_start} &intarray\[3\] &intarray\[4\]" \
- "array partial with expressions" \
- [capture_value "4"] "intarray2\[3\]"
+ "array partial with expressions" 4 "intarray2\[3\]"
gdb_test "print intarray2\[2\] == 0" " = 1" "element 2 not changed, == 4"
gdb_test "print intarray2\[4\] == 0" " = 1" "element 4 not changed, == 4"
@@ -471,4 +479,3 @@ if ![string compare $is64bitonly "no"] then {
# clean up files
remote_exec build "rm -f intarr1.bin intarr1b.bin intarr1.ihex intarr1.srec intarr1.tekhex intarr2.bin intarr2b.bin intarr2.ihex intarr2.srec intarr2.tekhex intstr1.bin intstr1b.bin intstr1.ihex intstr1.srec intstr1.tekhex intstr2.bin intstr2b.bin intstr2.ihex intstr2.srec intstr2.tekhex intarr3.srec"
-
diff --git a/gdb/testsuite/gdb.base/ena-dis-br.exp b/gdb/testsuite/gdb.base/ena-dis-br.exp
index b0e3c1de623..8d9ef60e752 100644
--- a/gdb/testsuite/gdb.base/ena-dis-br.exp
+++ b/gdb/testsuite/gdb.base/ena-dis-br.exp
@@ -1,4 +1,7 @@
-# Copyright 1997, 1998, 1999, 2003 Free Software Foundation, Inc.
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 1997, 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,12 +17,9 @@
# 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
- }
+ strace $tracelevel
+}
global usestubs
@@ -66,374 +66,211 @@ if ![runto_main] then { fail "enable/disable break tests suppressed" }
# Verify that we can set a breakpoint (the location is irrelevant),
# then enable it (yes, it's already enabled by default), then hit it.
-#
-send_gdb "break marker1\n"
-gdb_expect {
- -re "Breakpoint (\[0-9\]*) at .*, line ($bp_location15|$bp_location16).*$gdb_prompt $"\
- {pass "break marker1"}
- -re "$gdb_prompt $"\
- {fail "break marker1"}
- timeout {fail "(timeout) break marker1"}
-}
-send_gdb "enable $expect_out(1,string)\n"
-gdb_expect {
- -re "$gdb_prompt $"\
- {pass "enable break marker1"}
- timeout {fail "(timeout) enable break marker1"}
-}
+proc break_at { breakpoint where } {
+ global gdb_prompt
+ global expect_out
-send_gdb "info break $expect_out(1,string)\n"
-gdb_expect {
- -re "\[0-9\]*\[ \t\]+breakpoint\[ \t\]+keep\[ \t\]+y.*$gdb_prompt $"\
- {pass "info break marker1"}
- -re "$gdb_prompt $"\
- {fail "info break marker1"}
- timeout {fail "(timeout) info break marker1"}
+ set test "break $breakpoint"
+ set bp 0
+ gdb_test_multiple "$test" "$test" {
+ -re "Breakpoint (\[0-9\]*) at .*$where.*$gdb_prompt $" {
+ set bp $expect_out(1,string)
+ pass "$test"
+ }
+ }
+ return $bp
}
-# See the comments in condbreak.exp for "run until breakpoint at marker1"
-# for an explanation of the xfail below.
-send_gdb "continue\n"
-gdb_expect {
- -re "Breakpoint \[0-9\]*, marker1.*$gdb_prompt $"\
- {pass "continue to break marker1"}
- -re "Breakpoint \[0-9\]*, $hex in marker1.*$gdb_prompt $"\
- {xfail "continue to break marker1"}
- -re "$gdb_prompt $"\
- {fail "continue to break marker1"}
- timeout {fail "(timeout) continue to break marker1"}
-}
+set bp [break_at "marker1" " line ($bp_location15|$bp_location16)"]
-send_gdb "delete $expect_out(1,string)\n"
-gdb_expect {
- -re "$gdb_prompt $"\
- {pass "delete break marker1"}
- timeout {fail "(timeout) delete break marker1"}
-}
+gdb_test "enable $bp" "" "enable break marker1"
-# Verify that we can set a breakpoint to be self-disabling after
-# the first time it triggers.
-#
-send_gdb "break marker2\n"
-gdb_expect {
- -re "Breakpoint (\[0-9\]*) at .*, line ($bp_location8|$bp_location9).*$gdb_prompt $"\
- {pass "break marker2"}
- -re "$gdb_prompt $"\
- {fail "break marker2"}
- timeout {fail "(timeout) break marker2"}
-}
+gdb_test "info break $bp" \
+ "\[0-9\]*\[ \t\]+breakpoint\[ \t\]+keep\[ \t\]+y.*" \
+ "info break marker1"
-send_gdb "enable once $expect_out(1,string)\n"
-gdb_expect {
- -re "$gdb_prompt $"\
- {pass "enable once break marker2"}
- timeout {fail "(timeout) enable once break marker2"}
+# See the comments in condbreak.exp for "run until breakpoint at
+# marker1" for an explanation of the xfail below.
+set test "continue to break marker1"
+gdb_test_multiple "continue" "$test" {
+ -re "Breakpoint \[0-9\]*, marker1.*$gdb_prompt $" {
+ pass "$test"
+ }
+ -re "Breakpoint \[0-9\]*, $hex in marker1.*$gdb_prompt $" {
+ xfail "$test"
+ }
}
-send_gdb "info break $expect_out(1,string)\n"
-gdb_expect {
- -re "\[0-9\]*\[ \t\]+breakpoint\[ \t\]+dis\[ \t\]+y.*$gdb_prompt $"\
- {pass "info auto-disabled break marker2"}
- -re "$gdb_prompt $"\
- {fail "info auto-disabled break marker2"}
- timeout {fail "(timeout) info auto-disabled break marker2"}
-}
+gdb_test "delete $bp" "" "delete break marker1"
-# See the comments in condbreak.exp for "run until breakpoint at marker1"
-# for an explanation of the xfail below.
-send_gdb "continue\n"
-gdb_expect {
- -re "Breakpoint \[0-9\]*, marker2.*$gdb_prompt $"\
- {pass "continue to auto-disabled break marker2"}
- -re "Breakpoint \[0-9\]*, $hex in marker2.*$gdb_prompt $"\
- {xfail "continue to auto-disabled break marker2"}
- -re "$gdb_prompt $"\
- {fail "continue to auto-disabled break marker2"}
- timeout {fail "(timeout) continue to auto-disabled break marker2"}
-}
+# Verify that we can set a breakpoint to be self-disabling after the
+# first time it triggers.
+set bp [break_at "marker2" " line ($bp_location8|$bp_location9)"]
-send_gdb "info break $expect_out(1,string)\n"
-gdb_expect {
- -re "\[0-9\]*\[ \t\]+breakpoint\[ \t\]+dis\[ \t\]+n.*$gdb_prompt $"\
- {pass "info auto-disabled break marker2"}
- -re "$gdb_prompt $"\
- {fail "info auto-disabled break marker2"}
- timeout {fail "(timeout) info auto-disabled break marker2"}
+gdb_test "enable once $bp" "" "enable once break marker2"
+
+gdb_test "info break $bp" \
+ "\[0-9\]*\[ \t\]+breakpoint\[ \t\]+dis\[ \t\]+y.*" \
+ "info auto-disabled break marker2"
+
+# See the comments in condbreak.exp for "run until breakpoint at
+# marker1" for an explanation of the xfail below.
+set test "continue to auto-disabled break marker2"
+gdb_test_multiple "continue" "$test" {
+ -re "Breakpoint \[0-9\]*, marker2.*$gdb_prompt $" {
+ pass "$test"
+ }
+ -re "Breakpoint \[0-9\]*, $hex in marker2.*$gdb_prompt $" {
+ xfail "$test"
+ }
}
+gdb_test "info break $bp" \
+ "\[0-9\]*\[ \t\]+breakpoint\[ \t\]+dis\[ \t\]+n.*" \
+ "info auto-disabled break marker2"
+
# Verify that we don't stop at a disabled breakpoint.
-#
gdb_continue_to_end "no stop"
rerun_to_main
gdb_continue_to_end "no stop at auto-disabled break marker2"
-# Verify that we can set a breakpoint to be self-deleting after
-# the first time it triggers.
-#
-if ![runto_main] then { fail "enable/disable break tests suppressed" }
-
-send_gdb "break marker3\n"
-gdb_expect {
- -re "Breakpoint (\[0-9\]*) at .*, line ($bp_location17|$bp_location18).*$gdb_prompt $"\
- {pass "break marker3"}
- -re "$gdb_prompt $"\
- {fail "break marker3"}
- timeout {fail "(timeout) break marker3"}
+# Verify that we can set a breakpoint to be self-deleting after the
+# first time it triggers.
+if ![runto_main] then {
+ fail "enable/disable break tests suppressed"
}
-send_gdb "enable del $expect_out(1,string)\n"
-gdb_expect {
- -re "$gdb_prompt $"\
- {pass "enable del break marker3"}
- timeout {fail "(timeout) enable del break marker3"}
-}
+set bp [break_at "marker3" " line ($bp_location17|$bp_location18)"]
-send_gdb "info break $expect_out(1,string)\n"
-gdb_expect {
- -re "\[0-9\]*\[ \t\]+breakpoint\[ \t\]+del\[ \t\]+y.*$gdb_prompt $"\
- {pass "info auto-deleted break marker2"}
- -re "$gdb_prompt $"\
- {fail "info auto-deleted break marker2"}
- timeout {fail "(timeout) info auto-deleted break marker2"}
-}
+gdb_test "enable del $bp" "" "enable del break marker3"
-send_gdb "continue\n"
-gdb_expect {
- -re ".*marker3 .*:($bp_location17|$bp_location18).*$gdb_prompt $"\
- {pass "continue to auto-deleted break marker3"}
- -re "Breakpoint \[0-9\]*, marker3.*$gdb_prompt $"\
- {fail "continue to auto-deleted break marker3"}
- -re "$gdb_prompt $"\
- {fail "continue to auto-deleted break marker3"}
- timeout {fail "(timeout) continue to break marker3"}
-}
+gdb_test "info break $bp" \
+ "\[0-9\]*\[ \t\]+breakpoint\[ \t\]+del\[ \t\]+y.*" \
+ "info auto-deleted break marker2"
-send_gdb "info break $expect_out(1,string)\n"
-gdb_expect {
- -re ".*No breakpoint or watchpoint number.*$gdb_prompt $"\
- {pass "info auto-deleted break marker3"}
- -re "\[0-9\]*\[ \t\]+breakpoint\[ \t\].*$gdb_prompt $"\
- {fail "info auto-deleted break marker3"}
- -re "$gdb_prompt $"\
- {fail "info auto-deleted break marker3"}
- timeout {fail "(timeout) info auto-deleted break marker3"}
-}
+gdb_test "continue" \
+ ".*marker3 .*:($bp_location17|$bp_location18).*" \
+ "continue to auto-deleted break marker3"
+
+gdb_test "info break $bp" \
+ ".*No breakpoint or watchpoint number.*" \
+ "info auto-deleted break marker3"
# Verify that we can set a breakpoint and manually disable it (we've
# already proven that disabled bp's don't trigger).
-#
-send_gdb "break marker4\n"
-gdb_expect {
- -re "Breakpoint (\[0-9\]*) at .*, line ($bp_location14|$bp_location13).*$gdb_prompt $"\
- {pass "break marker4"}
- -re "$gdb_prompt $"\
- {fail "break marker4"}
- timeout {fail "(timeout) break marker4"}
-}
-send_gdb "disable $expect_out(1,string)\n"
-gdb_expect {
- -re "$gdb_prompt $"\
- {pass "disable break marker4"}
- timeout {fail "(timeout) disable break marker4"}
-}
+set bp [break_at "marker4" " line ($bp_location14|$bp_location13).*"]
-send_gdb "info break $expect_out(1,string)\n"
-gdb_expect {
- -re "\[0-9\]*\[ \t\]+breakpoint\[ \t\]+keep\[ \t\]+n.*$gdb_prompt $"\
- {pass "info break marker4"}
- -re "$gdb_prompt $"\
- {fail "info break marker4"}
- timeout {fail "(timeout) info break marker4"}
-}
+gdb_test "disable $bp" "" "disable break marker4"
+
+gdb_test "info break $bp" \
+ "\[0-9\]*\[ \t\]+breakpoint\[ \t\]+keep\[ \t\]+n.*" \
+ "info break marker4"
# Verify that we can set a breakpoint with an ignore count N, which
# should cause the next N triggers of the bp to be ignored. (This is
# a flavor of enablement/disablement, after all.)
-#
-if ![runto_main] then { fail "enable/disable break tests suppressed" }
-send_gdb "break marker1\n"
-gdb_expect {
- -re "Breakpoint (\[0-9\]*) at .*, line ($bp_location15|$bp_location16).*$gdb_prompt $"\
- {pass "break marker1"}
- -re "$gdb_prompt $"\
- {fail "break marker1"}
- timeout {fail "(timeout) break marker1"}
+if ![runto_main] then {
+ fail "enable/disable break tests suppressed"
}
+set bp [break_at "marker1" " line ($bp_location15|$bp_location16).*"]
+
# Verify that an ignore of a non-existent breakpoint is gracefully
# handled.
-#
-send_gdb "ignore 999 2\n"
-gdb_expect {
- -re "No breakpoint number 999..*$gdb_prompt $"\
- {pass "ignore non-existent break"}
- -re "$gdb_prompt $"\
- {fail "ignore non-existent break"}
- timeout {fail "(timeout) ignore non-existent break"}
-}
+
+gdb_test "ignore 999 2" \
+ "No breakpoint number 999..*" \
+ "ignore non-existent break"
# Verify that a missing ignore count is gracefully handled.
-#
-send_gdb "ignore $expect_out(1,string) \n"
-gdb_expect {
- -re "Second argument .specified ignore-count. is missing..*$gdb_prompt $"\
- {pass "ignore break with missing ignore count"}
- -re "$gdb_prompt $"\
- {fail "ignore break with missing ignore count"}
- timeout {fail "(timeout) ignore break with missing ignore count"}
-}
+
+gdb_test "ignore $bp" \
+ "Second argument .specified ignore-count. is missing..*" \
+ "ignore break with missing ignore count"
# Verify that a negative or zero ignore count is handled gracefully
# (they both are treated the same).
-#
-send_gdb "ignore $expect_out(1,string) -1\n"
-gdb_expect {
- -re "Will stop next time breakpoint \[0-9\]* is reached..*$gdb_prompt $"\
- {pass "ignore break marker1 -1"}
- -re "$gdb_prompt $"\
- {fail "ignore break marker1 -1"}
- timeout {fail "(timeout) ignore break marker1 -1"}
-}
-send_gdb "ignore $expect_out(1,string) 0\n"
-gdb_expect {
- -re "Will stop next time breakpoint \[0-9\]* is reached..*$gdb_prompt $"\
- {pass "ignore break marker1 0"}
- -re "$gdb_prompt $"\
- {fail "ignore break marker1 0"}
- timeout {fail "(timeout) ignore break marker1 0"}
-}
+gdb_test "ignore $bp -1" \
+ "Will stop next time breakpoint \[0-9\]* is reached..*" \
+ "ignore break marker1 -1"
-send_gdb "ignore $expect_out(1,string) 1\n"
-gdb_expect {
- -re "Will ignore next crossing of breakpoint \[0-9\]*.*$gdb_prompt $"\
- {pass "ignore break marker1"}
- -re "$gdb_prompt $"\
- {fail "ignore break marker1"}
- timeout {fail "(timeout) ignore break marker1"}
-}
+gdb_test "ignore $bp 0" \
+ "Will stop next time breakpoint \[0-9\]* is reached..*" \
+ "ignore break marker1 0"
-send_gdb "info break $expect_out(1,string)\n"
-gdb_expect {
- -re "\[0-9\]*\[ \t\]+breakpoint\[ \t\]+keep\[ \t\]+y.*ignore next 1 hits.*$gdb_prompt $"\
- {pass "info ignored break marker1"}
- -re "$gdb_prompt $"\
- {fail "info ignored break marker1"}
- timeout {fail "(timeout) info ignored break marker1"}
-}
+gdb_test "ignore $bp 1" \
+ "Will ignore next crossing of breakpoint \[0-9\]*.*" \
+ "ignore break marker1"
+
+gdb_test "info break $bp" \
+ "\[0-9\]*\[ \t\]+breakpoint\[ \t\]+keep\[ \t\]+y.*ignore next 1 hits.*" \
+ "info ignored break marker1"
gdb_continue_to_end "no stop at ignored break marker1"
rerun_to_main
# See the comments in condbreak.exp for "run until breakpoint at marker1"
# for an explanation of the xfail below.
-send_gdb "continue\n"
-gdb_expect {
- -re "Breakpoint \[0-9\]*, marker1.*$gdb_prompt $"\
- {pass "continue to break marker1, 2nd time"}
- -re "Breakpoint \[0-9\]*, $hex in marker1.*$gdb_prompt $"\
- {xfail "continue to break marker1, 2nd time"}
- -re "$gdb_prompt $"\
- {fail "continue to break marker1, 2nd time"}
- timeout {fail "(timeout) continue to break marker1, 2nd time"}
+set test "continue to break marker1, 2nd time"
+gdb_test_multiple "continue" "$test" {
+ -re "Breakpoint \[0-9\]*, marker1.*$gdb_prompt $" {
+ pass "continue to break marker1, 2nd time"
+ }
+ -re "Breakpoint \[0-9\]*, $hex in marker1.*$gdb_prompt $" {
+ xfail "continue to break marker1, 2nd time"
+ }
}
# Verify that we can specify both an ignore count and an auto-delete.
-#
-if ![runto_main] then { fail "enable/disable break tests suppressed" }
-send_gdb "break marker1\n"
-gdb_expect {
- -re "Breakpoint (\[0-9\]*) at .*, line ($bp_location15|$bp_location16).*$gdb_prompt $"\
- {pass "break marker1"}
- -re "$gdb_prompt $"\
- {fail "break marker1"}
- timeout {fail "(timeout) break marker1"}
+if ![runto_main] then {
+ fail "enable/disable break tests suppressed"
}
-send_gdb "ignore $expect_out(1,string) 1\n"
-gdb_expect {
- -re "Will ignore next crossing of breakpoint \[0-9\]*.*$gdb_prompt $"\
- {pass "ignore break marker1"}
- -re "$gdb_prompt $"\
- {fail "ignore break marker1"}
- timeout {fail "(timeout) ignore break marker1"}
-}
+set bp [break_at marker1 " line ($bp_location15|$bp_location16).*"]
-send_gdb "enable del $expect_out(1,string)\n"
-gdb_expect {
- -re "$gdb_prompt $"\
- {pass "enable del break marker1"}
- timeout {fail "(timeout) enable del break marker1"}
-}
+gdb_test "ignore $bp 1" \
+ "Will ignore next crossing of breakpoint \[0-9\]*.*" \
+ "ignore break marker1"
-send_gdb "info break $expect_out(1,string)\n"
-gdb_expect {
- -re "\[0-9\]*\[ \t\]+breakpoint\[ \t\]+del\[ \t\]+y.*ignore next 1 hits.*$gdb_prompt $"\
- {pass "info break marker1"}
- -re "$gdb_prompt $"\
- {fail "info break marker1"}
- timeout {fail "(timeout) info break marker2"}
-}
+gdb_test "enable del $bp" "" "enable del break marker1"
+
+gdb_test "info break $bp" \
+ "\[0-9\]*\[ \t\]+breakpoint\[ \t\]+del\[ \t\]+y.*ignore next 1 hits.*" \
+ "info break marker1"
gdb_continue_to_end "no stop at ignored & auto-deleted break marker1"
rerun_to_main
-send_gdb "continue\n"
-gdb_expect {
- -re ".*marker1 .*:($bp_location15|$bp_location16).*$gdb_prompt $"\
- {pass "continue to ignored & auto-deleted break marker1"}
- -re "Breakpoint \[0-9\]*, marker1.*$gdb_prompt $"\
- {fail "continue to ignored & auto-deleted break marker1"}
- -re "$gdb_prompt $"\
- {fail "continue to ignored & auto-deleted break marker1"}
- timeout {fail "(timeout) continue to ignored & auto-deleted break marker1"}
-}
+gdb_test "continue" \
+ ".*marker1 .*:($bp_location15|$bp_location16).*" \
+ "continue to ignored & auto-deleted break marker1"
# Verify that a disabled breakpoint's ignore count isn't updated when
# the bp is encountered.
-#
-if ![runto_main] then { fail "enable/disable break tests suppressed" }
-send_gdb "break marker1\n"
-gdb_expect {
- -re "Breakpoint (\[0-9\]*) at .*, line ($bp_location15|$bp_location16).*$gdb_prompt $"\
- {pass "break marker1"}
- -re "$gdb_prompt $"\
- {fail "break marker1"}
- timeout {fail "(timeout) break marker1"}
+if ![runto_main] then {
+ fail "enable/disable break tests suppressed"
}
-send_gdb "ignore $expect_out(1,string) 10\n"
-gdb_expect {
- -re "Will ignore next 10 crossings of breakpoint \[0-9\]*.*$gdb_prompt $"\
- {pass "ignore break marker1"}
- -re "$gdb_prompt $"\
- {fail "ignore break marker1"}
- timeout {fail "(timeout) ignore break marker1"}
-}
+set bp [break_at marker1 " line ($bp_location15|$bp_location16)"]
-send_gdb "disable $expect_out(1,string)\n"
-gdb_expect {
- -re "$gdb_prompt $"\
- {pass "disable break marker1"}
- timeout {fail "(timeout) disable break marker1"}
-}
+gdb_test "ignore $bp 10" \
+ "Will ignore next 10 crossings of breakpoint \[0-9\]*.*" \
+ "ignore break marker1"
+
+gdb_test "disable $bp" "" "disable break marker1"
gdb_continue_to_end "no stop at ignored & disabled break marker1"
rerun_to_main
-send_gdb "info break $expect_out(1,string)\n"
-gdb_expect {
- -re "\[0-9\]*\[ \t\]+breakpoint\[ \t\]+keep\[ \t\]+n.*ignore next 10 hits.*$gdb_prompt $"\
- {pass "info ignored & disabled break marker1"}
- -re "$gdb_prompt $"\
- {fail "info ignored & disabled break marker1"}
- timeout {fail "(timeout) info ignored & disabled break marker1"}
-}
+gdb_test "info break $bp" \
+ "\[0-9\]*\[ \t\]+breakpoint\[ \t\]+keep\[ \t\]+n.*ignore next 10 hits.*" \
+ "info ignored & disabled break marker1"
# Verify that GDB correctly handles the "continue" command with an argument,
# which is an ignore count to set on the currently stopped-at breakpoint.
@@ -442,46 +279,25 @@ gdb_expect {
#
if ![runto_main] then { fail "enable/disable break tests suppressed" }
-send_gdb "break $bp_location1\n"
-gdb_expect {
- -re "Breakpoint \[0-9\]*.*, line $bp_location1.*$gdb_prompt $"\
- {pass "prepare to continue with ignore count"}
- -re "$gdb_prompt $"\
- {fail "prepare to continue with ignore count"}
- timeout {fail "(timeout) prepare to continue with ignore count"}
-}
-send_gdb "continue 2\n"
-gdb_expect {
- -re "Will ignore next crossing of breakpoint \[0-9\]*. Continuing..*$gdb_prompt $"\
- {pass "continue with ignore count"}
- -re "$gdb_prompt $"\
- {fail "continue with ignore count"}
- timeout {fail "(timeout) continue with ignore count"}
-}
-
-send_gdb "next\n"
-gdb_expect {
- -re ".*$bp_location11\[ \t\]*marker1.*$gdb_prompt $"\
- {pass "step after continue with ignore count"}
- -re "$gdb_prompt $"\
- {fail "step after continue with ignore count"}
- timeout {fail "(timeout) step after continue with ignore count"}
-}
-
-# ??rehrauer: Huh. This appears to be an actual bug. (No big
-# surprise, since this feature hasn't been tested...) Looks like
-# GDB is currently trying to set the ignore count of bp # -1!
-#
-setup_xfail hppa_*_*
-send_gdb "continue 2\n"
-gdb_expect {
- -re "Not stopped at any breakpoint; argument ignored..*$gdb_prompt $"\
- {pass "continue with ignore count, not stopped at bpt"}
- -re "No breakpoint number -1.*$gdb_prompt $"\
- {xfail "(DTS'd) continue with ignore count, not stopped at bpt"}
- -re "$gdb_prompt $"\
- {fail "continue with ignore count, not stopped at bpt"}
- timeout {fail "(timeout) step after continue with ignore count, not stopped at bpt"}
+gdb_test "break $bp_location1" \
+ "Breakpoint \[0-9\]*.*, line $bp_location1.*" \
+ "prepare to continue with ignore count"
+
+gdb_test "continue 2" \
+ "Will ignore next crossing of breakpoint \[0-9\]*. Continuing..*" \
+ "continue with ignore count"
+
+gdb_test "next" ".*$bp_location11\[ \t\]*marker1.*" \
+ step after continue with ignore count"
+
+set test "continue with ignore count, not stopped at bpt"
+gdb_test_multiple "continue 2" "$test" {
+ -re "Not stopped at any breakpoint; argument ignored.*$gdb_prompt $" {
+ pass "$test"
+ }
+ -re "No breakpoint number -1.*$gdb_prompt $" {
+ kfail gdb/1689 "$test"
+ }
}
gdb_exit
diff --git a/gdb/testsuite/gdb.base/ending-run.exp b/gdb/testsuite/gdb.base/ending-run.exp
index af32acd0673..1363a000ca4 100644
--- a/gdb/testsuite/gdb.base/ending-run.exp
+++ b/gdb/testsuite/gdb.base/ending-run.exp
@@ -1,4 +1,7 @@
-# Copyright 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free
+# Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -12,10 +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
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# use this to debug:
#
@@ -109,7 +109,7 @@ gdb_expect {
-re ".*address (0x\[0-9a-fA-F]*).*$gdb_prompt $" {
set line_nine $expect_out(1,string)
gdb_test "b ending-run.c:14" ".*Breakpoint 7.*ending-run.c, line 14.*"
- gdb_test "b *$line_nine" ".*Note.*also.*Breakpoint 8.*"
+ gdb_test "b *$line_nine" ".*Note.*also.*Breakpoint 8.*" "Breakpoint 7 at *ending-run.c:14"
gdb_test "c" ".*Breakpoint.*7.*callee.*14.*"
gdb_test "cle" ".*Deleted breakpoints 8 7.*" "Clear 2 by default"
}
diff --git a/gdb/testsuite/gdb.base/float.exp b/gdb/testsuite/gdb.base/float.exp
index 01b0a998132..c09c37bb0aa 100644
--- a/gdb/testsuite/gdb.base/float.exp
+++ b/gdb/testsuite/gdb.base/float.exp
@@ -63,6 +63,8 @@ if { [istarget "alpha*-*-*"] } then {
gdb_test "info float" "f0.*f1.*f127.*" "info float"
} elseif [istarget "m68k-*-*"] then {
gdb_test "info float" "fp0.*fp1.*fp7.*" "info float"
+} elseif [istarget "mips*-*-*"] then {
+ gdb_test "info float" "f0:.*flt:.*dbl:.*" "info float"
} elseif [istarget "s390*-*-*"] then {
gdb_test "info float" "fpc.*f0.*f1.*f15.*" "info float"
} elseif [istarget "sh*-*"] then {
@@ -75,6 +77,8 @@ if { [istarget "alpha*-*-*"] } then {
pass "info float (without FPU)"
}
}
+} elseif [istarget "hppa*-*"] then {
+ gdb_test "info float" "fr4.*fr4R.*fr31R.*" "info float"
} else {
- gdb_test "info float" "No floating.point info available for this processor." "info float"
+ gdb_test "info float" "No floating.point info available for this processor." "info float (unknown target)"
}
diff --git a/gdb/testsuite/gdb.base/foll-fork.exp b/gdb/testsuite/gdb.base/foll-fork.exp
index d3fb1676878..2ef3a4a0ad7 100644
--- a/gdb/testsuite/gdb.base/foll-fork.exp
+++ b/gdb/testsuite/gdb.base/foll-fork.exp
@@ -280,8 +280,7 @@ proc do_fork_tests {} {
A fork or vfork creates a new process. follow-fork-mode can be:.*
.*parent - the original process is debugged after a fork.*
.*child - the new process is debugged after a fork.*
-.*ask - the debugger will ask for one of the above choices.*
-For \"parent\" or \"child\", the unfollowed process will run free..*
+The unfollowed process will continue to run..*
By default, the debugger will follow the parent process..*$gdb_prompt $"\
{ pass "help set follow" }
-re "$gdb_prompt $" { fail "help set follow" }
diff --git a/gdb/testsuite/gdb.base/freebpcmd.c b/gdb/testsuite/gdb.base/freebpcmd.c
index 765e12d2ca8..36cbcbea29d 100644
--- a/gdb/testsuite/gdb.base/freebpcmd.c
+++ b/gdb/testsuite/gdb.base/freebpcmd.c
@@ -1,5 +1,5 @@
/* Test program for GDB crashes while doing bp commands that continue inferior.
- Copyright 2003 Free Software Foundation, Inc.
+ Copyright 2003, 2004 Free Software Foundation, Inc.
This file is part of the gdb testsuite.
@@ -18,6 +18,8 @@
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
+#include <stdio.h>
+
int
main (int argc, char **argv)
{
diff --git a/gdb/testsuite/gdb.base/gcore.c b/gdb/testsuite/gdb.base/gcore.c
index af09dced7e1..24de8c7eb2f 100644
--- a/gdb/testsuite/gdb.base/gcore.c
+++ b/gdb/testsuite/gdb.base/gcore.c
@@ -1,8 +1,28 @@
+/* Copyright 2002, 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. */
+
/*
* Test GDB's ability to save and reload a corefile.
*/
#include <stdlib.h>
+#include <string.h>
int extern_array[4] = {1, 2, 3, 4};
static int static_array[4] = {5, 6, 7, 8};
diff --git a/gdb/testsuite/gdb.base/gcore.exp b/gdb/testsuite/gdb.base/gcore.exp
index 33fcba4810e..29239ef87fd 100644
--- a/gdb/testsuite/gdb.base/gcore.exp
+++ b/gdb/testsuite/gdb.base/gcore.exp
@@ -187,7 +187,6 @@ if ![string compare $pre_corefile_allregs $post_corefile_allregs] then {
set post_corefile_extern_array \
[capture_command_output "print extern_array" "$print_prefix"]
-pass "extern_array = $post_corefile_extern_array"
if ![string compare $pre_corefile_extern_array $post_corefile_extern_array] {
pass "corefile restored extern array"
} else {
@@ -196,7 +195,6 @@ if ![string compare $pre_corefile_extern_array $post_corefile_extern_array] {
set post_corefile_static_array \
[capture_command_output "print static_array" "$print_prefix"]
-pass "static_array = $post_corefile_static_array"
if ![string compare $pre_corefile_static_array $post_corefile_static_array] {
pass "corefile restored static array"
} else {
@@ -205,7 +203,6 @@ if ![string compare $pre_corefile_static_array $post_corefile_static_array] {
set post_corefile_uninit_array \
[capture_command_output "print un_initialized_array" "$print_prefix"]
-pass "uninit_array = $post_corefile_uninit_array"
if ![string compare $pre_corefile_uninit_array $post_corefile_uninit_array] {
pass "corefile restored un-initialized array"
} else {
@@ -214,7 +211,6 @@ if ![string compare $pre_corefile_uninit_array $post_corefile_uninit_array] {
set post_corefile_heap_string \
[capture_command_output "print heap_string" "$print_prefix"]
-pass "heap_string = $post_corefile_heap_string"
if ![string compare $pre_corefile_heap_string $post_corefile_heap_string] {
pass "corefile restored heap array"
} else {
@@ -223,7 +219,6 @@ if ![string compare $pre_corefile_heap_string $post_corefile_heap_string] {
set post_corefile_local_array \
[capture_command_output "print array_func::local_array" "$print_prefix"]
-pass "local_array = $post_corefile_local_array"
if ![string compare $pre_corefile_local_array $post_corefile_local_array] {
pass "corefile restored stack array"
} else {
diff --git a/gdb/testsuite/gdb.base/gdb1476.c b/gdb/testsuite/gdb.base/gdb1476.c
deleted file mode 100644
index c3f43760bf3..00000000000
--- a/gdb/testsuite/gdb.base/gdb1476.c
+++ /dev/null
@@ -1,12 +0,0 @@
-void x()
-{
- void (*fp)() = 0;
- fp();
-}
-
-int
-main()
-{
- x();
- return 0;
-}
diff --git a/gdb/testsuite/gdb.base/gdb1476.exp b/gdb/testsuite/gdb.base/gdb1476.exp
deleted file mode 100644
index b88b2de0652..00000000000
--- a/gdb/testsuite/gdb.base/gdb1476.exp
+++ /dev/null
@@ -1,72 +0,0 @@
-# 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@gnu.org
-
-# This file is part of the gdb testsuite.
-
-if $tracelevel {
- strace $tracelevel
-}
-
-# Testcase for backtrace/gdb1476.
-
-set prms_id 0
-set bug_id 0
-
-set testfile "gdb1476"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
- 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}
-
-#
-# Run to `main' where we begin our tests.
-#
-
-if ![runto_main] then {
- gdb_suppress_tests
-}
-
-# If we can examine what's at memory address 0, it is possible that we
-# could also execute it. This could probably make us run away,
-# executing random code, which could have all sorts of ill effects,
-# especially on targets without an MMU. Don't run the tests in that
-# case.
-
-send_gdb "x 0\n"
-gdb_expect {
- -re "0x0:.*Cannot access memory at address 0x0.*$gdb_prompt $" { }
- -re "0x0:.*Error accessing memory address 0x0.*$gdb_prompt $" { }
- -re ".*$gdb_prompt $" {
- untested "Memory at address 0 is possibly executable"
- return
- }
-}
-
-gdb_test "continue" "Program received signal SIGSEGV.*" \
- "continue to null pointer call"
-
-gdb_test "backtrace 10" \
- "#0\[ \t\]*0x0* in .*\r\n#1\[ \t\]*$hex in x.*\r\n#2\[ \t\]*$hex in main.*" \
- "backtrace from null pointer call"
diff --git a/gdb/testsuite/gdb.base/lineinc.c b/gdb/testsuite/gdb.base/lineinc.c
new file mode 100644
index 00000000000..91784e7d2b3
--- /dev/null
+++ b/gdb/testsuite/gdb.base/lineinc.c
@@ -0,0 +1,30 @@
+/* The following is written to tickle a specific bug in the macro
+ table code (now hopefully fixed), which doesn't insert new included
+ files in the #including file's list in the proper place. They
+ should be sorted by the number of the line which #included them, in
+ increasing order, but the sense of the comparison was reversed, so
+ the list ends up being built backwards. This isn't a problem by
+ itself, but the code to pick new, non-conflicting line numbers for
+ headers alleged to be #included at the same line as some other
+ header assumes that the list's line numbers are in ascending order.
+
+ So, given the following input, lineinc1.h gets added to lineinc.c's
+ #inclusion list first, at line 10. When the debug info reader
+ tries to add lineinc2.h at line 10 as well, the code will notice the
+ duplication --- since there's only one extant element in the list,
+ it'll find it --- and insert it after lineinc1.h, with line 11.
+ Since the code is putting the list in order of descending
+ #inclusion line number, the list is now out of order. When we try
+ to #include lineinc3.h at line 11, we won't notice the duplication. */
+
+#line 10
+#include "lineinc1.h"
+#line 10
+#include "lineinc2.h"
+#line 11
+#include "lineinc3.h"
+
+int
+main (int argc, char **argv)
+{
+}
diff --git a/gdb/testsuite/gdb.base/lineinc.exp b/gdb/testsuite/gdb.base/lineinc.exp
new file mode 100644
index 00000000000..4707ce516e1
--- /dev/null
+++ b/gdb/testsuite/gdb.base/lineinc.exp
@@ -0,0 +1,126 @@
+# Test macro handling of #included files.
+# Copyright 2003 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# Please email any bugs, comments, and/or additions to this file to:
+# bug-gdb@prep.ai.mit.edu
+
+# The test program lineinc.c contains a mix of #line directives and
+# #include directives that will cause the compiler to attribute more
+# than one #inclusion to the same source line. You can get similar
+# effects using things like GCC's '-imacros' flag.
+#
+# Compiling lineinc.c with Dwarf 2 macro information will produce
+# something like this:
+#
+# $ gcc -g3 lineinc.c -o lineinc
+# $ readelf -wml lineinc
+# ...
+# The File Name Table:
+# Entry Dir Time Size Name
+# 1 0 0 0 lineinc.c
+# 2 0 0 0 lineinc1.h
+# 3 0 0 0 lineinc2.h
+# 4 0 0 0 lineinc3.h
+# ...
+# Contents of the .debug_macinfo section:
+#
+# DW_MACINFO_start_file - lineno: 0 filenum: 1
+# DW_MACINFO_define - lineno : 1 macro : __VERSION__ "3.2 20020903 (Red Hat Linux 8.0 3.2-7)"
+# DW_MACINFO_define - lineno : 2 macro : __USER_LABEL_PREFIX__
+# ...
+# DW_MACINFO_define - lineno : 1 macro : __i386__ 1
+# DW_MACINFO_define - lineno : 1 macro : __tune_i386__ 1
+# DW_MACINFO_start_file - lineno: 10 filenum: 2
+# DW_MACINFO_define - lineno : 1 macro : FOO 1
+# DW_MACINFO_end_file
+# DW_MACINFO_start_file - lineno: 10 filenum: 3
+# DW_MACINFO_undef - lineno : 1 macro : FOO
+# DW_MACINFO_define - lineno : 2 macro : FOO 2
+# DW_MACINFO_end_file
+# DW_MACINFO_start_file - lineno: 11 filenum: 4
+# DW_MACINFO_undef - lineno : 1 macro : FOO
+# DW_MACINFO_define - lineno : 2 macro : FOO 3
+# DW_MACINFO_end_file
+# DW_MACINFO_end_file
+# $
+#
+# Note how the inclusions of lineinc1.h and lineinc2.h are both
+# attributed to line 10 of lineinc.c, and the #inclusion of lineinc3.h
+# is attributed to line 11. This is all correct, given the #line
+# directives in lineinc.c.
+#
+# Dwarf 2 macro information doesn't contain enough information to
+# allow GDB to figure out what's really going on here --- it makes no
+# mention of the #line directives --- so we just try to cope as best
+# we can. If the macro table were to attribute more than one
+# #inclusion to the same source line, then GDB wouldn't be able to
+# tell which #included file's #definitions and #undefinitions come
+# first, so it can't tell which #definitions are in scope following
+# all the #inclusions. To cope with this, GDB puts all the files
+# #included by a given source file in a list sorted by the line at
+# which they were #included; this gives GDB the chance to detect
+# multiple #inclusions at the same line, complain, and assign
+# distinct, albiet incorrect, line numbers to each #inclusion.
+#
+# However, at one point GDB was sorting the list in reverse order,
+# while the code to assign new, distinct line numbers assumed it was
+# sorted in ascending order; GDB would get an internal error trying to
+# read the above debugging info.
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+set testfile "lineinc"
+set binfile ${objdir}/${subdir}/${testfile}
+
+
+if {[gdb_compile "${srcdir}/${subdir}/${testfile}.c" ${binfile} executable {debug}] != ""} {
+ 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}
+
+# Any command that causes GDB to read the debugging info for the
+# lineinc.c compilation unit will do here.
+set test_name "tolerate macro info with multiple #inclusions per line"
+gdb_test_multiple "break main" $test_name {
+ -re "Breakpoint 1 at 0x.*: file .*lineinc.c.*\\.\r\n${gdb_prompt}" {
+ pass $test_name
+ }
+ -re ".*internal-error:.*.y or n. " {
+ fail $test_name
+ send_gdb "y\n"
+ gdb_expect {
+ -re ".*.y or n. " {
+ send_gdb "n\n"
+ exp_continue
+ }
+ -re "$gdb_prompt" {
+ }
+ timeout {
+ fail "$test_name (timeout)"
+ }
+ }
+ }
+}
diff --git a/gdb/testsuite/gdb.base/lineinc1.h b/gdb/testsuite/gdb.base/lineinc1.h
new file mode 100644
index 00000000000..8523d58b330
--- /dev/null
+++ b/gdb/testsuite/gdb.base/lineinc1.h
@@ -0,0 +1 @@
+#define FOO 1
diff --git a/gdb/testsuite/gdb.base/lineinc2.h b/gdb/testsuite/gdb.base/lineinc2.h
new file mode 100644
index 00000000000..ee800ba72e8
--- /dev/null
+++ b/gdb/testsuite/gdb.base/lineinc2.h
@@ -0,0 +1,2 @@
+#undef FOO
+#define FOO 2
diff --git a/gdb/testsuite/gdb.base/lineinc3.h b/gdb/testsuite/gdb.base/lineinc3.h
new file mode 100644
index 00000000000..be3bb54506a
--- /dev/null
+++ b/gdb/testsuite/gdb.base/lineinc3.h
@@ -0,0 +1,2 @@
+#undef FOO
+#define FOO 3
diff --git a/gdb/testsuite/gdb.base/logical.exp b/gdb/testsuite/gdb.base/logical.exp
index 304f45c66ec..231f8ae01cf 100644
--- a/gdb/testsuite/gdb.base/logical.exp
+++ b/gdb/testsuite/gdb.base/logical.exp
@@ -1,4 +1,6 @@
-# Copyright 1998, 1999 Free Software Foundation, Inc.
+# This testcase is part of GDB, the GNU debugger.
+
+# 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
@@ -14,21 +16,15 @@
# 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)
-# This file is part of the gdb testsuite
+# Tests for correctenss of logical operators, associativity and
+# precedence with integer type variables
-#
-# tests for correctenss of logical operators, associativity and precedence
-# with integer type variables
-#
if $tracelevel then {
- strace $tracelevel
- }
+ strace $tracelevel
+}
#
# test running programs
@@ -41,8 +37,8 @@ set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" } {
- gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
- }
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
if [get_compiler_info ${binfile}] {
return -1;
@@ -63,515 +59,74 @@ if ![runto_main] then {
continue
}
-#
-# test expressions with "int" types
-#
-
-gdb_test "set variable x=0" "" "set variable x=0"
-gdb_test "set variable y=0" "" "set variable y=0"
-gdb_test "set variable z=0" "" "set variable z=0"
-
-send_gdb "print x\n"
-gdb_expect {
- -re ".*0.*$gdb_prompt $" {
- pass "print value of x"
- }
- -re ".*$gdb_prompt $" { fail "print value of x" }
- timeout { fail "(timeout) print value of x" }
- }
-
-
-send_gdb "print y\n"
-gdb_expect {
- -re ".*0.*$gdb_prompt $" {
- pass "print value of y"
- }
- -re ".*$gdb_prompt $" { fail "print value of y" }
- timeout { fail "(timeout) print value of y" }
- }
-
-send_gdb "print z\n"
-gdb_expect {
- -re ".*0.*$gdb_prompt $" {
- pass "print value of z"
- }
- -re ".*$gdb_prompt $" { fail "print value of z" }
- timeout { fail "(timeout) print value of z" }
- }
-
-
-# truth tables for && , || , !
-
-send_gdb "print x && y\n"
-gdb_expect {
- -re ".*$false.*$gdb_prompt $" {
- pass "print value of x<y"
- }
- -re ".*$gdb_prompt $" { fail "print value of x<y" }
- timeout { fail "(timeout) print value of x<y" }
- }
-
-
-
-send_gdb "print x || y\n"
-gdb_expect {
- -re ".*$false.*$gdb_prompt $" {
- pass "print value of x<=y"
- }
- -re ".*$gdb_prompt $" { fail "print value of x<=y" }
- timeout { fail "(timeout) print value of x<=y" }
- }
-
-send_gdb "print !x\n"
-gdb_expect {
- -re ".*$true.*$gdb_prompt $" {
- pass "print value of x>y"
- }
- -re ".*$gdb_prompt $" { fail "print value of x>y" }
- timeout { fail "(timeout) print value of x>y" }
- }
-
-gdb_test "set variable y=1" "" "set variable y=1"
-
-send_gdb "print x && y\n"
-gdb_expect {
- -re ".*$false.*$gdb_prompt $" {
- pass "print value of x<y"
- }
- -re ".*$gdb_prompt $" { fail "print value of x<y" }
- timeout { fail "(timeout) print value of x<y" }
- }
-
-
-
-send_gdb "print x || y\n"
-gdb_expect {
- -re ".*$true.*$gdb_prompt $" {
- pass "print value of x<=y"
- }
- -re ".*$gdb_prompt $" { fail "print value of x<=y" }
- timeout { fail "(timeout) print value of x<=y" }
- }
-
-gdb_test "set variable x=1" "" "set variable x=1"
-
-send_gdb "print x && y\n"
-gdb_expect {
- -re ".*$true.*$gdb_prompt $" {
- pass "print value of x<y"
- }
- -re ".*$gdb_prompt $" { fail "print value of x<y" }
- timeout { fail "(timeout) print value of x<y" }
- }
-
-
-
-send_gdb "print x || y\n"
-gdb_expect {
- -re ".*$true.*$gdb_prompt $" {
- pass "print value of x<=y"
- }
- -re ".*$gdb_prompt $" { fail "print value of x<=y" }
- timeout { fail "(timeout) print value of x<=y" }
- }
-
-send_gdb "print !x\n"
-gdb_expect {
- -re ".*$false.*$gdb_prompt $" {
- pass "print value of x>y"
- }
- -re ".*$gdb_prompt $" { fail "print value of x>y" }
- timeout { fail "(timeout) print value of x>y" }
- }
-
-gdb_test "set variable y=0" "" "set variable y=0"
-
-send_gdb "print x && y\n"
-gdb_expect {
- -re ".*$false.*$gdb_prompt $" {
- pass "print value of x<y"
- }
- -re ".*$gdb_prompt $" { fail "print value of x<y" }
- timeout { fail "(timeout) print value of x<y" }
- }
-
-
-
-send_gdb "print x || y\n"
-gdb_expect {
- -re ".*$true.*$gdb_prompt $" {
- pass "print value of x<=y"
- }
- -re ".*$gdb_prompt $" { fail "print value of x<=y" }
- timeout { fail "(timeout) print value of x<=y" }
- }
-
-
-# end truth tables for &&, ||, !
-
-
-# test associativity of && , || , !
-
-gdb_test "set variable x=0" "" "set variable x=0"
-gdb_test "set variable y=0" "" "set variable y=0"
-gdb_test "set variable z=0" "" "set variable z=0"
-
-send_gdb "print x && y && z\n"
-gdb_expect {
- -re ".*$false.*$gdb_prompt $" {
- pass "print value of x && y && z (000)"
- }
- -re ".*$gdb_prompt $" { fail "print value of x && y && z (000) " }
- timeout { fail "(timeout) print value of x && y && z (000) " }
- }
-
-send_gdb "print x || y || z\n"
-gdb_expect {
- -re ".*$false.*$gdb_prompt $" {
- pass "print value of x || y || z (000)"
- }
- -re ".*$gdb_prompt $" { fail "print value of x || y || z (000)" }
- timeout { fail "(timeout) print value of x || y || z (000) " }
- }
-
-send_gdb "print !!x\n"
-gdb_expect {
- -re ".*$false.*$gdb_prompt $" {
- pass "print value of !!x (0)"
- }
- -re ".*$gdb_prompt $" { fail "print value of !!x (0)" }
- timeout { fail "(timeout) print value of !!x (0) " }
- }
-
-
-gdb_test "set variable y=1" "" "set variable y=1"
-
-send_gdb "print x && y && z\n"
-gdb_expect {
- -re ".*$false.*$gdb_prompt $" {
- pass "print value of x && y && z (010)"
- }
- -re ".*$gdb_prompt $" { fail "print value of x && y && z (010) " }
- timeout { fail "(timeout) print value of x && y && z (010) " }
- }
-
-send_gdb "print x || y || z\n"
-gdb_expect {
- -re ".*$true.*$gdb_prompt $" {
- pass "print value of x || y || z (010)"
- }
- -re ".*$gdb_prompt $" { fail "print value of x || y || z (010)" }
- timeout { fail "(timeout) print value of x || y || z (010) " }
- }
-
-
-gdb_test "set variable z=1" "" "set variable z=1"
-
-send_gdb "print x && y && z\n"
-gdb_expect {
- -re ".*$false.*$gdb_prompt $" {
- pass "print value of x && y && z (011)"
- }
- -re ".*$gdb_prompt $" { fail "print value of x && y && z (011) " }
- timeout { fail "(timeout) print value of x && y && z (011) " }
- }
-
-send_gdb "print x || y || z\n"
-gdb_expect {
- -re ".*$true.*$gdb_prompt $" {
- pass "print value of x || y || z (011)"
- }
- -re ".*$gdb_prompt $" { fail "print value of x || y || z (011)" }
- timeout { fail "(timeout) print value of x || y || z (011) " }
- }
-
-
-gdb_test "set variable x=1" "" "set variable x=1"
-
-send_gdb "print x && y && z\n"
-gdb_expect {
- -re ".*$true.*$gdb_prompt $" {
- pass "print value of x && y && z (111)"
- }
- -re ".*$gdb_prompt $" { fail "print value of x && y && z (111) " }
- timeout { fail "(timeout) print value of x && y && z (111) " }
- }
-
-send_gdb "print x || y || z\n"
-gdb_expect {
- -re ".*$true.*$gdb_prompt $" {
- pass "print value of x || y || z (111)"
- }
- -re ".*$gdb_prompt $" { fail "print value of x || y || z (111)" }
- timeout { fail "(timeout) print value of x || y || z (111) " }
- }
-
-send_gdb "print !!x\n"
-gdb_expect {
- -re ".*$true.*$gdb_prompt $" {
- pass "print value of !!x (1)"
- }
- -re ".*$gdb_prompt $" { fail "print value of !!x (1)" }
- timeout { fail "(timeout) print value of !!x (1) " }
- }
-
-
-gdb_test "set variable z=0" "" "set variable z=0"
-
-send_gdb "print x && y && z\n"
-gdb_expect {
- -re ".*$false.*$gdb_prompt $" {
- pass "print value of x && y && z (110)"
- }
- -re ".*$gdb_prompt $" { fail "print value of x && y && z (110) " }
- timeout { fail "(timeout) print value of x && y && z (110) " }
- }
-
-send_gdb "print x || y || z\n"
-gdb_expect {
- -re ".*$true.*$gdb_prompt $" {
- pass "print value of x || y || z (110)"
- }
- -re ".*$gdb_prompt $" { fail "print value of x || y || z (110)" }
- timeout { fail "(timeout) print value of x || y || z (110) " }
- }
-
-
-
-
-gdb_test "set variable y=0" "" "set variable y=0"
-
-send_gdb "print x && y && z\n"
-gdb_expect {
- -re ".*$false.*$gdb_prompt $" {
- pass "print value of x && y && z (100)"
- }
- -re ".*$gdb_prompt $" { fail "print value of x && y && z (100) " }
- timeout { fail "(timeout) print value of x && y && z (100) " }
- }
-
-send_gdb "print x || y || z\n"
-gdb_expect {
- -re ".*$true.*$gdb_prompt $" {
- pass "print value of x || y || z (100)"
- }
- -re ".*$gdb_prompt $" { fail "print value of x || y || z (100)" }
- timeout { fail "(timeout) print value of x || y || z (100) " }
- }
-
-
-
-
-gdb_test "set variable z=1" "" "set variable z=1"
-
-send_gdb "print x && y && z\n"
-gdb_expect {
- -re ".*$false.*$gdb_prompt $" {
- pass "print value of x && y && z (101)"
- }
- -re ".*$gdb_prompt $" { fail "print value of x && y && z (101) " }
- timeout { fail "(timeout) print value of x && y && z (101) " }
- }
-
-send_gdb "print x || y || z\n"
-gdb_expect {
- -re ".*$true.*$gdb_prompt $" {
- pass "print value of x || y || z (101)"
- }
- -re ".*$gdb_prompt $" { fail "print value of x || y || z (101)" }
- timeout { fail "(timeout) print value of x || y || z (101) " }
- }
-
-
-gdb_test "set variable x=0" "" "set variable x=0"
-
-send_gdb "print x && y && z\n"
-gdb_expect {
- -re ".*$false.*$gdb_prompt $" {
- pass "print value of x && y && z (001)"
- }
- -re ".*$gdb_prompt $" { fail "print value of x && y && z (001) " }
- timeout { fail "(timeout) print value of x && y && z (001) " }
- }
-
-send_gdb "print x || y || z\n"
-gdb_expect {
- -re ".*$true.*$gdb_prompt $" {
- pass "print value of x || y || z (001)"
- }
- -re ".*$gdb_prompt $" { fail "print value of x || y || z (001)" }
- timeout { fail "(timeout) print value of x || y || z (001) " }
- }
-
-
-
-
-# test precedence of &&, || ,!
-
-
-send_gdb "print !x && y\n"
-gdb_expect {
- -re ".*$false.*$gdb_prompt $" {
- pass "print value of !x && y (00)"
- }
- -re ".*$gdb_prompt $" { fail "print value of !x && y (00)" }
- timeout { fail "(timeout) print value of !x && y (00) " }
- }
-
-
-gdb_test "set variable x=1" "" "set variable x=1"
-
-
-send_gdb "print !x && y\n"
-gdb_expect {
- -re ".*$false.*$gdb_prompt $" {
- pass "print value of !x && y (10)"
- }
- -re ".*$gdb_prompt $" { fail "print value of !x && y (10)" }
- timeout { fail "(timeout) print value of !x && y (10) " }
- }
-
-
-
-
-gdb_test "set variable y=1" "" "set variable y=1"
-
-send_gdb "print !x || y\n"
-gdb_expect {
- -re ".*$true.*$gdb_prompt $" {
- pass "print value of !x || y (11)"
- }
- -re ".*$gdb_prompt $" { fail "print value of !x || y (11)" }
- timeout { fail "(timeout) print value of !x || y (11) " }
- }
-
-
-gdb_test "set variable x=0" "" "set variable x=0"
-
-
-send_gdb "print !x || y\n"
-gdb_expect {
- -re ".*$true.*$gdb_prompt $" {
- pass "print value of !x || y (01)"
- }
- -re ".*$gdb_prompt $" { fail "print value of !x || y (01)" }
- timeout { fail "(timeout) print value of !x || y (01) " }
- }
-
-
-
-gdb_test "set variable x=1" "" "set variable x=1"
-gdb_test "set variable z=0" "" "set variable z=0"
-
-send_gdb "print x || y && z\n"
-gdb_expect {
- -re ".*$true.*$gdb_prompt $" {
- pass "print value of x || y && z (110)"
- }
- -re ".*$gdb_prompt $" { fail "print value of x || y && z (110)" }
- timeout { fail "(timeout) print value of x || y && z (110) " }
- }
-
-
-gdb_test "set variable y=0" "" "set variable y=0"
-
-
-send_gdb "print x || y && z\n"
-gdb_expect {
- -re ".*$true.*$gdb_prompt $" {
- pass "print value of x || y && z (100)"
- }
- -re ".*$gdb_prompt $" { fail "print value of x || y && z (100)" }
- timeout { fail "(timeout) print value of x || y && z (100) " }
- }
-
-
-
-gdb_test "set variable x=0" "" "set variable x=0"
-
-send_gdb "print x || !y && z\n"
-gdb_expect {
- -re ".*$false.*$gdb_prompt $" {
-
- gdb_test "set variable x=1" "" "set variable x=1"
- send_gdb "print x || !y && z\n"
- gdb_expect {
- -re ".*$true.*$gdb_prompt $" {
- pass "print value of x || !y && z "
- }
- -re ".*$gdb_prompt $" { fail "print value of x || !y && z" }
- timeout { fail "(timeout) print value of x || !y && z " }
- }
- }
- -re ".*$gdb_prompt $" { fail "print value of x || y && z " }
- timeout { fail "(timeout) print value of x || y && z " }
- }
-
-
-
-
-
-gdb_test "set variable x=1" "" "set variable x=1"
-gdb_test "set variable y=2" "" "set variable y=2"
-gdb_test "set variable w=3" "" "set variable w=3"
-gdb_test "set variable z=3" "" "set variable z=3"
-
-
-send_gdb "print x > y || w == z\n"
-gdb_expect {
- -re ".*$true.*$gdb_prompt $" {
- pass "print value of x > y || w == z"
- }
- -re ".*$gdb_prompt $" { fail "print value of x > y || w == z" }
- timeout { fail "(timeout) print value of x > y || w == z " }
- }
-
-
-gdb_test "set variable x=1" "" "set variable x=1"
-gdb_test "set variable y=2" "" "set variable y=2"
-gdb_test "set variable w=1" "" "set variable w=1"
-gdb_test "set variable z=3" "" "set variable z=3"
-
-
-send_gdb "print x >= y && w != z\n"
-gdb_expect {
- -re ".*$false.*$gdb_prompt $" {
- pass "print value of x >= y || w != z"
- }
- -re ".*$gdb_prompt $" { fail "print value of x >= y || w != z" }
- timeout { fail "(timeout) print value of x >= y || w != z " }
- }
-
-
-
-gdb_test "set variable x=2" "" "set variable x=2"
-gdb_test "set variable y=2" "" "set variable y=2"
-gdb_test "set variable w=2" "" "set variable w=2"
-gdb_test "set variable z=3" "" "set variable z=3"
-
-
-send_gdb "print ! x > y || w + z\n"
-gdb_expect {
- -re ".*$true.*$gdb_prompt $" {
- pass "print value of x > y || w != z"
- }
- -re ".*$gdb_prompt $" { fail "print value of x > y || w != z" }
- timeout { fail "(timeout) print value of x > y || w != z " }
- }
-
-
-
-
-
-
-
-
-
+proc evaluate { vars ops } {
+ for {set vari 0} {$vari < [llength $vars]} {incr vari} {
+ set var [lindex $vars $vari]
+ for {set opi 0} {$opi < [llength $ops]} {incr opi} {
+ set op [lindex [lindex $ops $opi] 0]
+ set val [lindex [lindex $ops $opi] [expr $vari + 1]]
+ gdb_test "print $var, $op" " = $val" "evaluate $op; variables $var; expecting $val"
+ }
+ }
+}
+# Unary
+evaluate {
+ {x = 0} {x = 1}
+} {
+ { {x} 0 1 }
+ { {!x} 1 0 }
+ { {!!x} 0 1 }
+}
+# Binary (with unary)
+
+evaluate {
+ {x = 0, y = 0} {x = 0, y = 1} {x = 1, y = 0} {x = 1, y = 1}
+} {
+ { {x && y} 0 0 0 1 }
+ { {!x && y} 0 1 0 0 }
+ { {x && !y} 0 0 1 0 }
+ { {!x && !y} 1 0 0 0 }
+
+ { {x || y} 0 1 1 1 }
+ { {!x || y} 1 1 0 1 }
+ { {x || !y} 1 0 1 1 }
+ { {!x || !y} 1 1 1 0 }
+
+ { {x < y} 0 1 0 0 }
+ { {x <= y} 1 1 0 1 }
+ { {x == y} 1 0 0 1 }
+ { {x != y} 0 1 1 0 }
+ { {x >= y} 1 0 1 1 }
+ { {x > y} 0 0 1 0 }
+}
+# Full table of &&, || combinations, followed by random mix of unary ops
+evaluate {
+ {x = 0, y = 0, z = 0} {x = 0, y = 0, z = 1} {x = 0, y = 1, z = 0} {x = 0, y = 1, z = 1}
+ {x = 1, y = 0, z = 0} {x = 1, y = 0, z = 1} {x = 1, y = 1, z = 0} {x = 1, y = 1, z = 1}
+} {
+ { {x && y && z} 0 0 0 0 0 0 0 1 }
+ { {x || y && z} 0 0 0 1 1 1 1 1 }
+ { {x && y || z} 0 1 0 1 0 1 1 1 }
+ { {x || y || z} 0 1 1 1 1 1 1 1 }
+ { {x || !y && z} 0 1 0 0 1 1 1 1 }
+ { {!x || y && z} 1 1 1 1 0 0 0 1 }
+ { {!x || y && !z} 1 1 1 1 0 0 1 0 }
+}
+# More complex operations
+evaluate {
+ {x = 1, y = 2, w = 3, z = 3}
+ {x = 1, y = 2, w = 1, z = 3}
+ {x = 2, y = 2, w = 2, z = 3}
+} {
+ { {x > y || w == z} 1 0 0 }
+ { {x >= y && w != z} 0 0 1 }
+ { {! x > y || w + z} 1 1 1 }
+}
diff --git a/gdb/testsuite/gdb.base/long_long.c b/gdb/testsuite/gdb.base/long_long.c
index 04fba92897e..a55cb248227 100644
--- a/gdb/testsuite/gdb.base/long_long.c
+++ b/gdb/testsuite/gdb.base/long_long.c
@@ -1,3 +1,23 @@
+/* This test script is part of GDB, the GNU debugger.
+
+ Copyright 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
+ 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.
+ */
+
/* Test long long expression; test printing in general.
*
* /CLO/BUILD_ENV/Exports/cc -g +e -o long_long long_long.c
@@ -7,55 +27,76 @@
* cc +e +DA2.0 -g -o long_long long_long.c
*/
-#ifdef PROTOTYPES
-long long callee(long long i)
-#else
-long long callee( i )
-long long i;
-#endif
-{
- register long long result;
+#include <string.h>
- result = 0x12345678;
- result = result << i;
- result += 0x9abcdef0;
+enum { MAX_BYTES = 16 };
- return result;
+void
+pack (unsigned char b[MAX_BYTES], int size, int nr)
+{
+ static long long val[] = { 0x123456789abcdefLL, 01234567123456701234567LL, 12345678901234567890ULL};
+ volatile static int e = 1;
+ int i;
+ for (i = 0; i < nr; i++)
+ {
+ int offset;
+ if (*(char *)&e)
+ /* Little endian. */
+ offset = sizeof (long long) - size;
+ else
+ /* Big endian endian. */
+ offset = 0;
+ memcpy (b + size * i, (char *) val + sizeof (long long) * i + offset, size);
+ }
}
+unsigned char b[MAX_BYTES];
+unsigned char h[MAX_BYTES];
+unsigned char w[MAX_BYTES];
+unsigned char g[MAX_BYTES];
+
+unsigned char c[MAX_BYTES];
+unsigned char s[MAX_BYTES];
+unsigned char i[MAX_BYTES];
+unsigned char l[MAX_BYTES];
+unsigned char ll[MAX_BYTES];
+
int known_types()
{
- long long bin = 0, oct = 0, dec = 0, hex = 0;
+ /* A union is used here as, hopefully it has well defined packing
+ rules. */
+ struct {
+ long long bin, oct, dec, hex;
+ } val;
+ memset (&val, 0, sizeof val);
- /* Known values, filling the full 64 bits.
- */
- bin = 0x123456789abcdefLL; /* 64 bits = 16 hex digits */
- oct = 01234567123456701234567LL; /* = 21+ octal digits */
- dec = 12345678901234567890ULL; /* = 19+ decimal digits */
+ /* Known values, filling the full 64 bits. */
+ val.bin = 0x123456789abcdefLL; /* 64 bits = 16 hex digits */
+ val.oct = 01234567123456701234567LL; /* = 21+ octal digits */
+ val.dec = 12345678901234567890ULL; /* = 19+ decimal digits */
- /* Stop here and look!
- */
- hex = bin - dec | oct;
+ /* Stop here and look! */
+ val.hex = val.bin - val.dec | val.oct;
- return 0;
+ return 0;
}
int main() {
- register long long x, y;
- register long long i;
-
- x = (long long) 0xfedcba9876543210LL;
- y = x++;
- x +=y;
- i = 11;
- x = callee( i );
- y += x;
+ /* Pack Byte, Half, Word and Giant arrays with byte-orderd values.
+ That way "(gdb) x" gives the same output on different
+ architectures. */
+ pack (b, 1, 2);
+ pack (h, 2, 2);
+ pack (w, 4, 2);
+ pack (g, 8, 2);
+ pack (c, sizeof (char), 2);
+ pack (s, sizeof (short), 2);
+ pack (i, sizeof (int), 2);
+ pack (l, sizeof (long), 2);
+ pack (ll, sizeof (long long), 2);
known_types();
return 0;
}
-
-
-
diff --git a/gdb/testsuite/gdb.base/long_long.exp b/gdb/testsuite/gdb.base/long_long.exp
index 11308dbac61..b36b30b32b2 100644
--- a/gdb/testsuite/gdb.base/long_long.exp
+++ b/gdb/testsuite/gdb.base/long_long.exp
@@ -1,5 +1,7 @@
-# Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003
-# Free Software Foundation, Inc.
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free
+# Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -15,10 +17,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
-
-
# long_long.exp Test printing of 64-bit things in 32-bit gdb.
# Also test differnet kinds of formats.
#
@@ -66,94 +64,141 @@ if { ![runto known_types] } then {
set target_bigendian_p 1
send_gdb "show endian\n"
gdb_expect {
- -re ".*little endian.*$gdb_prompt $" { set target_bigendian_p 0 }
- -re ".*big endian.*$gdb_prompt $" { }
- -re ".*$gdb_prompt $" {
+ -re "little endian.*$gdb_prompt $" { set target_bigendian_p 0 }
+ -re "big endian.*$gdb_prompt $" { }
+ -re "$gdb_prompt $" {
fail "getting target endian"
}
default { fail "(timeout) getting target endian" }
}
-# Detect targets with 2-byte integers. Yes, it's not general to assume
-# that all others have 4-byte ints, but don't worry about it until one
-# actually exists.
+# Detect the size of the target's basic types.
-set sizeof_int 4
-send_gdb "print sizeof(int)\n"
-gdb_expect {
- -re ".* = 2.*$gdb_prompt $" { set sizeof_int 2 }
- -re ".*$gdb_prompt $" { }
- default { }
+proc get_valueof { fmt exp default } {
+ global gdb_prompt
+ send_gdb "print${fmt} ${exp}\n"
+ gdb_expect {
+ -re "\\$\[0-9\]* = (\[-\]*\[0-9\]*).*$gdb_prompt $" {
+ set val $expect_out(1,string)
+ pass "get value of ${exp} ($val)"
+ }
+ timeout {
+ set size ${default}
+ fail "get value of ${exp} (timeout)"
+ }
+ }
+ return ${val}
}
-# Detect targets with 2-byte pointers. Assume all others use 4-bytes.
-set sizeof_ptr 4
-send_gdb "print sizeof(void*)\n"
-gdb_expect {
- -re ".* = 2.*$gdb_prompt $" { set sizeof_ptr 2 }
- -re ".*$gdb_prompt $" { }
- default { }
+proc get_sizeof { type default } {
+ return [get_valueof "/d" "sizeof (${type})" $default]
}
-# Detect targets with 4-byte shorts. Assume all others use 2-bytes.
+set sizeof_char [get_sizeof "char" 1]
+set sizeof_short [get_sizeof "short" 2]
+set sizeof_int [get_sizeof "int" 4]
+set sizeof_long [get_sizeof "long" 4]
+set sizeof_long_long [get_sizeof "long long" 8]
+set sizeof_data_ptr [get_sizeof "void *" 4]
+set sizeof_double [get_sizeof "double" 8]
+set sizeof_long_double [get_sizeof "long double" 8]
+
+# Tests to handle ISA/ABI variants
+
+proc pat2 { n pats } {
+ set i 0
+ while { $n > 1 } {
+ set n [expr $n / 2]
+ incr i
+ }
+ return [lindex $pats $i]
+}
-set sizeof_short 2
-send_gdb "print sizeof(short)\n"
-gdb_expect {
- -re ".* = 4.*$gdb_prompt $" { set sizeof_short 4 }
- -re ".*$gdb_prompt $" { }
- default { }
+proc gdb_test_xxx { test pat name } {
+ if { $pat == "" } {
+ setup_kfail *-*-* gdb/1672
+ gdb_test $test "xxx" $name
+ } else {
+ gdb_test $test $pat $name
+ }
}
-# Detect targets with 4-byte doubles.
+proc gdb_test_bi { test be le } {
+ global target_bigendian_p
-set sizeof_double 8
-send_gdb "print sizeof(double)\n"
-gdb_expect {
- -re ".* = 4.*$gdb_prompt $" { set sizeof_double 4 }
- -re ".*$gdb_prompt $" { }
- default { }
+ if { $target_bigendian_p } {
+ gdb_test_xxx $test $be $test
+ } else {
+ gdb_test_xxx $test $le $test
+ }
}
-set sizeof_long_double 8
-send_gdb "print sizeof(long double)\n"
-gdb_expect {
- -re ".* = 4.*$gdb_prompt $" { set sizeof_long_double 4 }
- -re ".*$gdb_prompt $" { }
- default { }
+proc gdb_test_ptr { test args } {
+ global sizeof_data_ptr
+
+ gdb_test_xxx $test [pat2 $sizeof_data_ptr $args] $test
+}
+
+proc gdb_test_xptr { examine args } {
+ global sizeof_data_ptr
+ set x [pat2 $sizeof_data_ptr $args]
+ # X is of the form { VARIABLE PATTERN }
+ gdb_test_xxx "$examine [lindex $x 0]" [lindex $x 1] "$examine"
+}
+
+proc gdb_test_char { test args } {
+ global sizeof_char
+ gdb_test_xxx $test [pat2 $sizeof_char $args] $test
+}
+
+proc gdb_test_short { test args } {
+ global sizeof_short
+ gdb_test_xxx $test [pat2 $sizeof_short $args] $test
}
-gdb_test "n 4" ".*38.*" "get to known place"
+proc gdb_test_int { test args } {
+ global sizeof_int
+ gdb_test_xxx $test [pat2 $sizeof_int $args] $test
+}
+
+proc gdb_test_long { test args } {
+ global sizeof_long
+ gdb_test_xxx $test [pat2 $sizeof_long $args] $test
+}
+
+proc gdb_test_long_long { test args } {
+ global sizeof_long_long
+ gdb_test_xxx $test [pat2 $sizeof_long_long $args] $test
+}
+
+gdb_breakpoint [gdb_get_line_number "Stop here and look"]
+gdb_continue_to_breakpoint "Stop here and look"
# Check the hack for long long prints.
#
-gdb_test "p/x hex" ".*0x0*0.*" "hex print p/x"
-gdb_test "p/x dec" ".*0xab54a98ceb1f0ad2.*" "decimal print p/x"
+gdb_test "p/x val.hex" "0x0*0" "hex print p/x"
+gdb_test "p/x val.dec" "0xab54a98ceb1f0ad2" "decimal print p/x"
# see if 'p/<code>' is handled same as 'p /<code>'
#
-gdb_test "p /x dec" ".*0xab54a98ceb1f0ad2.*" "default print dec"
-gdb_test "p /x bin" ".*0x0*123456789abcdef.*" "default print bin"
-gdb_test "p /x oct" ".*0xa72ee53977053977.*" "default print oct"
-gdb_test "p hex" ".*= 0*x*0*0.*" "default print hex"
+gdb_test "p /x val.dec" "0xab54a98ceb1f0ad2" "default print val.dec"
+gdb_test "p /x val.bin" "0x123456789abcdef" "default print val.bin"
+gdb_test "p /x val.oct" "0xa72ee53977053977" "default print val.oct"
+gdb_test "p val.hex" "= 0" "default print hex"
-gdb_test "p/u dec" ".*12345678901234567890.*" "decimal print p/u"
-gdb_test "p/t bin" ".*0*100100011010001010110011110001001101010111100110111101111.*" "binary print"
-gdb_test "p/o oct" ".*01234567123456701234567.*" "octal print"
-gdb_test "p /d bin" ".*81985529216486895.*" "print +ve long long"
-gdb_test "p/d dec" ".*-6101065172474983726.*" "decimal print p/d"
+gdb_test "p/u val.dec" "12345678901234567890" "decimal print p/u"
+gdb_test "p/t val.bin" "100100011010001010110011110001001101010111100110111101111" "binary print"
+gdb_test "p/o val.oct" "01234567123456701234567" "octal print"
+gdb_test "p /d val.bin" "81985529216486895" "print +ve long long"
+gdb_test "p/d val.dec" "-6101065172474983726" "decimal print p/d"
# Try all the combinations to bump up coverage.
#
-gdb_test "p/d oct" ".*-6399925985474168457.*"
-gdb_test "p/u oct" ".*12046818088235383159.*"
-gdb_test "p/o oct" ".*.*"
-gdb_test "p/t oct" ".*1010011100101110111001010011100101110111000001010011100101110111.*"
-if { $sizeof_ptr == 2 } {
- gdb_test "p/a oct" ".*0x.*3977.*"
-} else {
- gdb_test "p/a oct" ".*0x.*77053977.*"
-}
-gdb_test "p/c oct" ".*'w'.*"
+gdb_test "p/d val.oct" "-6399925985474168457"
+gdb_test "p/u val.oct" "12046818088235383159"
+gdb_test "p/o val.oct" ""
+gdb_test "p/t val.oct" "1010011100101110111001010011100101110111000001010011100101110111"
+gdb_test_ptr "p/a val.oct" "" "" "0x77053977" "0xa72ee53977053977"
+gdb_test "p/c val.oct" "'w'"
if { $sizeof_double == 8 || $sizeof_long_double == 8 } {
# ARM floating point numbers are not strictly little endian or big endian,
@@ -164,149 +209,130 @@ if { $sizeof_double == 8 || $sizeof_long_double == 8 } {
[istarget "xscale*-*-*"] || \
[istarget "strongarm*-*-*"] } then {
# assume the long long represents a floating point double in ARM format
- gdb_test "p/f oct" ".*2.1386676354387559e\\+265.*"
+ gdb_test "p/f val.oct" "2.1386676354387559e\\+265"
} else {
# assume the long long represents a floating point double in little
# endian format
- gdb_test "p/f oct" ".*-5.9822653797615723e-120.*"
+ gdb_test "p/f val.oct" "-5.9822653797615723e-120"
}
-
} else {
-
- gdb_test "p/f oct" ".*-2.42716126e-15.*"
-
+ gdb_test "p/f val.oct" "-2.42716126e-15"
}
-if { $target_bigendian_p } {
-
- if { $sizeof_int == 4 } {
-
- gdb_test "p/d *(int *)&oct" ".*-1490098887.*"
- gdb_test "p/u *(int *)&oct" ".*2804868409.*"
- gdb_test "p/o *(int *)&oct" ".*024713562471.*"
- gdb_test "p/t *(int *)&oct" ".*10100111001011101110010100111001.*"
-
- if { $sizeof_ptr == 2 } {
- gdb_test "p/a *(int *)&oct" ".*0xe539.*"
- } else {
- gdb_test "p/a *(int *)&oct" ".*0xf*a72ee539.*"
- }
-
- gdb_test "p/c *(int *)&oct" ".*57 '9'.*"
- gdb_test "p/f *(int *)&oct" ".*-2.42716126e-15.*"
-
- } else {
-
- gdb_test "p/d *(int *)&oct" ".*-22738.*"
- gdb_test "p/u *(int *)&oct" ".*42798.*"
- gdb_test "p/o *(int *)&oct" ".*0123456.*"
- gdb_test "p/t *(int *)&oct" ".*1010011100101110.*"
-
- if { $sizeof_ptr == 2 } {
- gdb_test "p/a *(int *)&oct" ".*0xa72e.*"
- } else {
- gdb_test "p/a *(int *)&oct" ".*0xffffa72e.*"
- }
- gdb_test "p/c *(int *)&oct" ".*46 '.'.*"
- gdb_test "p/f *(int *)&oct" ".*-22738.*"
-
- }
-
- if { $sizeof_short == 2 } {
- gdb_test "p/d *(short *)&oct" ".*-22738.*"
- gdb_test "p/u *(short *)&oct" ".*42798.*"
- gdb_test "p/o *(short *)&oct" ".*0123456.*"
- gdb_test "p/t *(short *)&oct" ".*1010011100101110.*"
- if { $sizeof_ptr == 2 } {
- gdb_test "p/a *(short *)&oct" ".*0xa72e.*"
- } else {
- gdb_test "p/a *(short *)&oct" ".*0xf*ffffa72e.*"
- }
- gdb_test "p/c *(short *)&oct" ".* 46 '.'.*"
- gdb_test "p/f *(short *)&oct" ".*-22738.*"
- } else {
- gdb_test "p/d *(short *)&oct" ".*-1490098887.*"
- gdb_test "p/u *(short *)&oct" ".*2804868409.*"
- gdb_test "p/o *(short *)&oct" ".*024713562471.*"
- gdb_test "p/t *(short *)&oct" ".*10100111001011101110010100111001.*"
- gdb_test "p/a *(short *)&oct" ".*0xf*a72ee539.*"
- gdb_test "p/c *(short *)&oct" ".* 57 '9'.*"
- gdb_test "p/f *(short *)&oct" ".*-2.42716126e-15.*"
- }
-
- gdb_test "x/x &oct" ".*0xa72ee539.*"
- gdb_test "x/d &oct" ".*.-1490098887*"
- gdb_test "x/u &oct" ".*2804868409.*"
- gdb_test "x/o &oct" ".*024713562471.*"
- gdb_test "x/t &oct" ".*10100111001011101110010100111001.*"
- if { $sizeof_ptr == 2 } {
- gdb_test "x/a &oct" ".*0xa72e.*"
- } else {
- gdb_test "x/a &oct" ".*0xa72ee539.*"
- }
- gdb_test "x/c &oct" ".*-89 .*"
- # FIXME GDB's output is correct, but this longer match fails.
- # gdb_test "x/c &oct" ".*-89 '\\\\247'.*"
- if { $sizeof_double == 8 || $sizeof_long_double == 8 } {
- gdb_test "x/f &oct" ".*-5.9822653797615723e-120.*"
- } else {
- gdb_test "x/f &oct" ".*-2.42716126e-15.*"
- }
-
- # FIXME Fill in the results for all the following tests. (But be careful
- # about looking at locations with unspecified contents!)
-
- gdb_test "x/2x &oct" ".*0xa72ee53977053977.*"
- gdb_test "x/2d &oct" ".*-6399925985474168457.*"
- gdb_test "x/2u &oct" ".*.*"
- gdb_test "x/2o &oct" ".*.*"
- gdb_test "x/2t &oct" ".*.*"
- gdb_test "x/2a &oct" ".*.*"
- gdb_test "x/2c &oct" ".*.*"
- gdb_test "x/2f &oct" ".*.*"
-
- gdb_test "x/2bx &oct" ".*.*"
- gdb_test "x/2bd &oct" ".*.*"
- gdb_test "x/2bu &oct" ".*.*"
- gdb_test "x/2bo &oct" ".*.*"
- gdb_test "x/2bt &oct" ".*.*"
- gdb_test "x/2ba &oct" ".*.*"
- gdb_test "x/2bc &oct" ".*.*"
- gdb_test "x/2bf &oct" ".*.*"
-
- gdb_test "x/2hx &oct" ".*.*"
- gdb_test "x/2hd &oct" ".*.*"
- gdb_test "x/2hu &oct" ".*.*"
- gdb_test "x/2ho &oct" ".*.*"
- gdb_test "x/2ht &oct" ".*.*"
- gdb_test "x/2ha &oct" ".*.*"
- gdb_test "x/2hc &oct" ".*.*"
- gdb_test "x/2hf &oct" ".*.*"
-
- gdb_test "x/2wx &oct" ".*.*"
- gdb_test "x/2wd &oct" ".*.*"
- gdb_test "x/2wu &oct" ".*.*"
- gdb_test "x/2wo &oct" ".*.*"
- gdb_test "x/2wt &oct" ".*.*"
- gdb_test "x/2wa &oct" ".*.*"
- gdb_test "x/2wc &oct" ".*.*"
- gdb_test "x/2wf &oct" ".*.*"
-
- gdb_test "x/2gx &oct" ".*.*"
- gdb_test "x/2gd &oct" ".*.*"
- gdb_test "x/2gu &oct" ".*.*"
- gdb_test "x/2go &oct" ".*.*"
- gdb_test "x/2gt &oct" ".*.*"
- gdb_test "x/2ga &oct" ".*.*"
- gdb_test "x/2gc &oct" ".*.*"
- gdb_test "x/2gf &oct" ".*.*"
-
+gdb_test_char "p/x *(char *)c" "0x1"
+gdb_test_char "p/d *(char *)c" "1"
+gdb_test_char "p/u *(char *)c" "1"
+gdb_test_char "p/o *(char *)c" "01"
+gdb_test_char "p/t *(char *)c" "1"
+gdb_test_char "p/a *(char *)c" "0x1"
+gdb_test_char "p/f *(char *)c" "1"
+gdb_test_char "p/c *(char *)c" "1 '.001'"
+
+gdb_test_short "p/x *(short *)s" "" "0x123" ""
+gdb_test_short "p/d *(short *)s" "" "291" ""
+gdb_test_short "p/u *(short *)s" "" "291" ""
+gdb_test_short "p/o *(short *)s" "" "0443" ""
+gdb_test_short "p/t *(short *)s" "" "100100011" ""
+gdb_test_short "p/a *(short *)s" "" "0x123" ""
+gdb_test_short "p/f *(short *)s" "" "291" ""
+gdb_test_short "p/c *(short *)s" "" "35 '.'" ""
+
+gdb_test_int "p/x *(int *)i" "" "0x123" "0x1234567" ""
+gdb_test_int "p/d *(int *)i" "" "291" "19088743" ""
+gdb_test_int "p/u *(int *)i" "" "291" "19088743" ""
+gdb_test_int "p/o *(int *)i" "" "0443" "0110642547" ""
+gdb_test_int "p/t *(int *)i" "" "100100011" "1001000110100010101100111" ""
+gdb_test_int "p/a *(int *)i" "" "" "0x1234567" ""
+gdb_test_int "p/f *(int *)i" "" "291" "2.99881655e-38" ""
+gdb_test_int "p/c *(int *)i" "" "35 '.'" "103 'g'" ""
+
+gdb_test_long "p/x *(long *)l" "" "0x123" "0x1234567" "0x123456789abcdef"
+gdb_test_long "p/d *(long *)l" "" "291" "19088743" "81985529216486895"
+gdb_test_long "p/u *(long *)l" "" "291" "19088743" "81985529216486895"
+gdb_test_long "p/o *(long *)l" "" "0443" "0110642547" "04432126361152746757"
+gdb_test_long "p/t *(long *)l" "" "100100011" "1001000110100010101100111" "100100011010001010110011110001001101010111100110111101111"
+gdb_test_ptr "p/a *(long *)l" "" "" "0x1234567" "0x123456789abcdef"
+gdb_test_long "p/f *(long *)l" "" "291" "2.99881655e-38" "3.5127005640885037e-303"
+gdb_test_long "p/c *(long *)l" "" "35 '.'" "103 'g'" "-17 '.*'"
+
+gdb_test_long_long "p/x *(long long *)ll" "" "" "" "0x123456789abcdef"
+gdb_test_long_long "p/d *(long long *)ll" "" "" "" "81985529216486895"
+gdb_test_long_long "p/u *(long long *)ll" "" "" "" "81985529216486895"
+gdb_test_long_long "p/o *(long long *)ll" "" "" "" "04432126361152746757"
+gdb_test_long_long "p/t *(long long *)ll" "" "" "" "100100011010001010110011110001001101010111100110111101111"
+gdb_test_ptr "p/a *(long long *)ll" "" "" "0x89abcdef" "0x123456789abcdef"
+gdb_test_long_long "p/f *(long long *)ll" "" "" "" "3.5127005640885037e-303"
+gdb_test_long_long "p/c *(long long *)ll" "" "" "" "-17 '.*'"
+
+# Implict Word size (except for a, c, and f)
+
+gdb_test "x/w w" "" "set examine size to w"
+gdb_test "x/x w" "0x01234567"
+gdb_test "x/d w" "19088743"
+gdb_test "x/u w" "19088743"
+gdb_test "x/o w" "0110642547"
+gdb_test "x/t w" "00000001001000110100010101100111"
+gdb_test_xptr "x/a" { b "" } { h "" } { w "0x1234567" } { g "0x123456789abcdef" }
+gdb_test "x/c b" "1 '.001'"
+if { $sizeof_double == 8 || $sizeof_long_double == 8 } {
+ gdb_test "x/f &val.oct" "-5.9822653797615723e-120"
} else {
+ gdb_test "x/f &val.oct" "-2.42716126e-15"
+}
- # FIXME Add little-endian versions of these tests, or define a
- # gdb_test_bi with two strings to match on.
+# Implict Giant size (except for a, c, and f)
+gdb_test "x/g g" "" "set examine size to g"
+gdb_test "x/2x g" "0x0123456789abcdef.*0xa72ee53977053977"
+gdb_test "x/2d g" "81985529216486895.*-6399925985474168457"
+gdb_test "x/2u g" "81985529216486895.*12046818088235383159"
+gdb_test "x/2o g" "04432126361152746757.*01234567123456701234567"
+gdb_test "x/2t g" "0000000100100011010001010110011110001001101010111100110111101111.*1010011100101110111001010011100101110111000001010011100101110111"
+gdb_test_xptr "x/2a" { b "" } { h "" } { w "0x1234567.*0xa72ee539" } { g "0x123456789abcdef.*0xa72ee53977053977" }
+gdb_test "x/2c b" "1 '.001'.*-89 '.'"
+if { $sizeof_double == 8 || $sizeof_long_double == 8 } {
+ gdb_test "x/2f &val.oct" "-5.9822653797615723e-120.*-5.9041889495880968e-100"
+} else {
+ gdb_test "x/2f &val.oct" "-2.42716126e-15"
}
+# Explicit sizes, and two memory locations ...
+
+gdb_test "x/2bx b" "0x01.*0xa7"
+gdb_test "x/2bd b" "1.*-89"
+gdb_test "x/2bu b" "1.*167"
+gdb_test "x/2bo b" "01.*0247"
+gdb_test "x/2bt b" "00000001.*10100111"
+gdb_test_ptr "x/2ba b" "" "" "0x1.*0xffffffa7" "0x1.*0xffffffffffffffa7"
+gdb_test "x/2bc b" "1 '.001'.*-89 '.'"
+gdb_test "x/2bf b" "1.*-89"
+
+gdb_test "x/2hx h" "0x0123.*0xa72e"
+gdb_test "x/2hd h" "291.*-22738"
+gdb_test "x/2hu h" "291.*42798"
+gdb_test "x/2ho h" "0443.*0123456"
+gdb_test "x/2ht h" "0000000100100011.*1010011100101110"
+gdb_test_ptr "x/2ha h" "" "" "0x123.*0xffffa72e" "0x123.*0xffffffffffffa72e"
+gdb_test "x/2hc h" "35 '.'.*46 '.'"
+gdb_test "x/2hf h" "291.*-22738"
+
+gdb_test "x/2wx w" "0x01234567.*0xa72ee539"
+gdb_test "x/2wd w" "19088743.*-1490098887"
+gdb_test "x/2wu w" "19088743.*2804868409"
+gdb_test "x/2wo w" "0110642547.*024713562471"
+gdb_test "x/2wt w" "00000001001000110100010101100111.*10100111001011101110010100111001"
+gdb_test_ptr "x/2wa w" "" "" "0x1234567.*0xa72ee539" "0x1234567.*0xffffffffa72ee539"
+gdb_test "x/2wc w" "103 'g'.*57 '9'"
+gdb_test "x/2wf w" "2.99881655e-38.*-2.42716126e-15"
+
+gdb_test "x/2gx g" "0x0123456789abcdef.*0xa72ee53977053977"
+gdb_test "x/2gd g" "81985529216486895.*-6399925985474168457"
+gdb_test "x/2gu g" "81985529216486895.*12046818088235383159"
+gdb_test "x/2go g" "04432126361152746757.*01234567123456701234567"
+gdb_test "x/2gt g" "0000000100100011010001010110011110001001101010111100110111101111.*1010011100101110111001010011100101110111000001010011100101110111"
+gdb_test_ptr "x/2ga g" "" "" "0x89abcdef.*0x77053977" "0x123456789abcdef.*0xa72ee53977053977"
+gdb_test "x/2gc g" "-17 '.'.*119 'w'"
+gdb_test "x/2gf g" "3.5127005640885037e-303.*-5.9822653797615723e-120"
+
gdb_exit
return 0
diff --git a/gdb/testsuite/gdb.base/pending.exp b/gdb/testsuite/gdb.base/pending.exp
index 315e544ee74..9bc08020e89 100644
--- a/gdb/testsuite/gdb.base/pending.exp
+++ b/gdb/testsuite/gdb.base/pending.exp
@@ -207,6 +207,31 @@ gdb_test "info break" \
\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*pendshr.c:26 if x > 3.*" \
"multiple pending breakpoints"
+
+#
+# Try a pending break for a line in a source file with ignore count:
+#
+
+gdb_test_multiple "break pendshr.c:27" "Set pending breakpoint 3" {
+ -re ".*Make breakpoint pending.*y or \\\[n\\\]. $" {
+ gdb_test "y" "Breakpoint.*pendshr.c:27.*pending." \
+ "Set pending breakpoint 3"
+ }
+}
+
+gdb_test {ignore $bpnum 2} "Will ignore next 2 crossings of breakpoint .*" \
+ "set ignore count on pending breakpoint 3"
+
+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.*
+\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*pendshr.c:27.*ignore next 2 hits.*" \
+"multiple pending breakpoints 2"
+
#
# Run to main which should resolve a pending breakpoint
#
@@ -239,6 +264,19 @@ gdb_test "continue" \
\[$\]1 = 1." \
"continue to resolved breakpoint 1"
+#
+# Disable the other two breakpoints, and continue to the one with
+# the ignore count. Make sure you hit it the third time, x should
+# be 3 then.
+#
+
+gdb_test "disable 7" "" "Disable other breakpoints"
+gdb_test "disable 5" "" "Disable other breakpoints"
+
+gdb_test "continue" \
+ {.*Breakpoint.*pendfunc1.*\(x=3\) at.*pendshr.c:27.*printf.*;} \
+"continue to resolved breakpoint 3"
+
delete_breakpoints
gdb_breakpoint "main"
@@ -259,6 +297,7 @@ gdb_test_multiple "break imaginary" "set imaginary pending breakpoint" {
#
rerun_to_main
+
gdb_test "info break" \
"Num Type\[ \]+Disp Enb Address\[ \]+What.*
\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$mainline.*
diff --git a/gdb/testsuite/gdb.base/radix.exp b/gdb/testsuite/gdb.base/radix.exp
index 057751f9aab..7ca03c8a1ea 100644
--- a/gdb/testsuite/gdb.base/radix.exp
+++ b/gdb/testsuite/gdb.base/radix.exp
@@ -1,4 +1,5 @@
-# Copyright 1993, 1997 Free Software Foundation, Inc.
+# This testcase is part of GDB, the GNU debugger.
+# Copyright 1993, 1997, 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,10 +15,8 @@
# 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)
if $tracelevel then {
strace $tracelevel
@@ -26,176 +25,133 @@ if $tracelevel then {
set prms_id 0
set bug_id 0
-proc test_input_radix_2 {} {
- gdb_test "set radix" \
- "Input and output radices now set to decimal 10, hex a, octal 12." \
- "set radix #1"
- gdb_test "set input-radix 2" \
- "Input radix now set to decimal 2, hex 2, octal 2."
- gdb_test "show radix" \
- "Input radix set to decimal 2, hex 2, octal 2.\r\nOutput radix set to decimal 10, hex a, octal 12." \
- "show radix #1"
- gdb_test "p 010" "8"
- gdb_test "p 20." "20"
- gdb_test "p (int) 20." "20"
- gdb_test "p 0xf" "15"
- gdb_test "p 10" "2"
- gdb_test "p -101" "-5"
- gdb_test "p 101" "5"
- gdb_test "p 10101" "21"
- gdb_test "p 4" "Invalid number \"4\"\\."
- gdb_test "p -2" "Invalid number \"2\"\\."
-}
+# Start with a fresh gdb.
-# Test input radix 3 (an non-typical radix)
+gdb_exit
+gdb_start
-proc test_input_radix_3 {} {
- gdb_test "set radix" \
- "Input and output radices now set to decimal 10, hex a, octal 12." \
- "set radix #2"
- gdb_test "set input-radix 3" \
- "Input radix now set to decimal 3, hex 3, octal 3."
- gdb_test "show radix" \
- "Input radix set to decimal 3, hex 3, octal 3.\r\nOutput radix set to decimal 10, hex a, octal 12." \
- "show radix #2"
- gdb_test "p 010" "8"
- gdb_test "p 20." "20"
- gdb_test "p (int) 20." "20"
- gdb_test "p 0xf" "15"
- gdb_test "p 10" "3"
- gdb_test "p 0" "0"
- gdb_test "p 1" "1"
- gdb_test "p 2" "2"
- gdb_test "p 10" "3"
- gdb_test "p 20" "6"
- gdb_test "p 100" "9"
- gdb_test "p -100" "-9"
- gdb_test "p 3" "Invalid number \"3\"."
- gdb_test "p 30" "Invalid number \"30\"."
-}
+# Test input radices.
-proc test_input_radix_8 {} {
- gdb_test "set radix" \
- "Input and output radices now set to decimal 10, hex a, octal 12." \
- "set radix #3"
- gdb_test "set input-radix 8" \
- "Input radix now set to decimal 8, hex 8, octal 10."
- gdb_test "show radix" \
- "Input radix set to decimal 8, hex 8, octal 10.\r\nOutput radix set to decimal 10, hex a, octal 12." \
- "set radix #3"
- gdb_test "p 010" "8"
- gdb_test "p 20." "20"
- gdb_test "p (int) 20." "20"
- gdb_test "p 0xf" "15"
- gdb_test "p 10" "8"
- gdb_test "p 20" "16"
- gdb_test "p -20" "-16"
- gdb_test "p 100" "64"
- gdb_test "p 8" "Invalid number \"8\"."
- gdb_test "p -9" "Invalid number \"9\"."
+proc test_one_input { iradix input output } {
+ gdb_test "print $input" "$output" \
+ "print $input; expect $output; input radix $iradix"
}
-proc test_input_radix_10 {} {
+proc test_input_radix { iradix iradixhex iradixoctal } {
+ # set input-radix = $iradix, output-radix = ten
gdb_test "set radix" \
"Input and output radices now set to decimal 10, hex a, octal 12." \
- "set radix #4"
- gdb_test "set input-radix 10" \
- "Input radix now set to decimal 10, hex a, octal 12."
- gdb_test "show radix" \
- "Input and output radices set to decimal 10, hex a, octal 12." \
- "show radix #4"
- gdb_test "p 010" "8"
- gdb_test "p 20." "20"
- gdb_test "p (int) 20." "20"
- gdb_test "p 0xf" "15"
- gdb_test "p 10" "10"
- gdb_test "p -12" "-12"
+ "initialize radix, input radix $iradix"
+ gdb_test "set input-radix $iradix" \
+ "Input radix now set to decimal $iradix, hex $iradixhex, octal $iradixoctal."
+ if { $iradix == 10 } then {
+ gdb_test "show radix" \
+ "Input and output radices set to decimal 10, hex a, octal 12." \
+ "show radix, input radix $iradix"
+ } else {
+ gdb_test "show radix" \
+ "Input radix set to decimal $iradix, hex $iradixhex, octal $iradixoctal.\r\nOutput radix set to decimal 10, hex a, octal 12." \
+ "show radix, input radix $iradix"
+ }
+
+ # test constants with specific bases that do not use $iradix
+ test_one_input $iradix "010" "8"
+ test_one_input $iradix "20." "20"
+ test_one_input $iradix "(int) 20." "20"
+ test_one_input $iradix "0xf" "15"
+
+ # test simple one-digit constants
+ test_one_input $iradix "0" "0"
+ test_one_input $iradix "1" "1"
+ test_one_input $iradix "-1" "-1"
+
+ # test simple two-digit constants
+ test_one_input $iradix "10" [expr $iradix]
+ test_one_input $iradix "11" [expr $iradix + 1]
+ test_one_input $iradix "-10" [expr 0 - $iradix]
+ test_one_input $iradix "-11" [expr 0 - $iradix - 1]
+
+ # test simple three-digit constants
+ test_one_input $iradix "100" [expr $iradix * $iradix]
+ test_one_input $iradix "101" [expr $iradix * $iradix + 1]
+ test_one_input $iradix "-100" [expr 0 - $iradix * $iradix]
+ test_one_input $iradix "-101" [expr 0 - $iradix * $iradix - 1]
+
+ # test a five-digit constant
+ test_one_input $iradix "10101" \
+ [expr $iradix * $iradix * $iradix * $iradix + $iradix * $iradix + 1]
}
-proc test_input_radix_16 {} {
- gdb_test "set radix" \
- "Input and output radices now set to decimal 10, hex a, octal 12." \
- "set radix #5"
- gdb_test "set input-radix 16" \
- "Input radix now set to decimal 16, hex 10, octal 20."
- gdb_test "show radix" \
- "Input radix set to decimal 16, hex 10, octal 20.\r\nOutput radix set to decimal 10, hex a, octal 12." \
- "show radix #5"
- gdb_test "p 010" "8"
- gdb_test "p 20." "20"
- gdb_test "p (int) 20." "20"
- gdb_test "p 0xf" "15"
- gdb_test "p 10" "16"
- gdb_test "p 100" "256"
-}
+test_input_radix 2 "2" "2"
+ test_one_input 2 "4" "Invalid number \"4\"\\."
+ test_one_input 2 "-2" "Invalid number \"2\"\\."
-proc test_output_radix_8 {} {
- gdb_test "set radix" \
- "Input and output radices now set to decimal 10, hex a, octal 12." \
- "set radix #6"
- gdb_test "set output-radix 8" \
- "Output radix now set to decimal 8, hex 8, octal 10."
- gdb_test "show radix" \
- "Input radix set to decimal 10, hex a, octal 12.\r\nOutput radix set to decimal 8, hex 8, octal 10." \
- "show radix #6"
- gdb_test "p 010" "010"
- # FIXME: If gdb can't handle float printing in different radices, it
- # should at least warn once the first time that is attempted.
- setup_xfail "*-*-*"
- gdb_test "p 20." "24" "Float printing when output radix is 8"
- gdb_test "p (int) 20." "24"
- gdb_test "p 0xf" "17"
- gdb_test "p 10" "12"
- gdb_test "p 100" "144"
-}
+test_input_radix 3 "3" "3"
+ test_one_input 3 "2" "2"
+ test_one_input 3 "20" "6"
+ test_one_input 3 "3" "Invalid number \"3\"\\."
+ test_one_input 2 "30" "Invalid number \"30\"\\."
-proc test_output_radix_10 {} {
- gdb_test "set radix" \
- "Input and output radices now set to decimal 10, hex a, octal 12." \
- "set radix #7"
- gdb_test "set output-radix 10" \
- "Output radix now set to decimal 10, hex a, octal 12."
- gdb_test "show radix" \
- "Input and output radices set to decimal 10, hex a, octal 12." \
- "show radix #7"
- gdb_test "p 010" "8"
- gdb_test "p 20." "20"
- gdb_test "p (int) 20." "20"
- gdb_test "p 0xf" "15"
- gdb_test "p 10" "10"
- gdb_test "p 100" "100"
+test_input_radix 8 "8" "10"
+ test_one_input 8 "20" "16"
+ test_one_input 8 "-20" "-16"
+ test_one_input 8 "8" "Invalid number \"8\"."
+ test_one_input 8 "-9" "Invalid number \"9\"."
+
+test_input_radix 10 "a" "12"
+ test_one_input 10 "-12" "-12"
+
+test_input_radix 16 "10" "20"
+
+# Test output radices.
+
+proc test_one_output { oradix input output } {
+ gdb_test "print $input" "$output" \
+ "print $input; expect $output; output radix $oradix"
}
-proc test_output_radix_16 {} {
+proc test_output_radix { oradix oradixhex oradixoctal } {
+ # set input-radix = ten, output-radix = $oradix
gdb_test "set radix" \
"Input and output radices now set to decimal 10, hex a, octal 12." \
- "set radix #8"
- gdb_test "set output-radix 16" \
- "Output radix now set to decimal 16, hex 10, octal 20."
- gdb_test "show radix" \
- "Input radix set to decimal 10, hex a, octal 12.\r\nOutput radix set to decimal 16, hex 10, octal 20." \
- "show radix #8"
- gdb_test "p 010" "8"
- # FIXME: If gdb can't handle float printing in different radices, it
- # should at least warn once the first time that is attempted.
- setup_xfail "*-*-*"
- gdb_test "p 20." "14" "Float printing when output radix is 16"
- gdb_test "p (int) 20." "14"
- gdb_test "p 0xf" "f"
- gdb_test "p 10" "a"
- gdb_test "p 100" "64"
+ "initialize radix, output radix $oradix"
+ gdb_test "set output-radix $oradix" \
+ "Output radix now set to decimal $oradix, hex $oradixhex, octal $oradixoctal."
+ if { $oradix == 10 } then {
+ gdb_test "show radix" \
+ "Input and output radices set to decimal 10, hex a, octal 12." \
+ "show radix, output radix $oradix"
+ } else {
+ gdb_test "show radix" \
+ "Input radix set to decimal 10, hex a, octal 12.\r\nOutput radix set to decimal $oradix, hex $oradixhex, octal $oradixoctal." \
+ "show radix, output radix $oradix"
+ }
+
+ # no standard tests for output radix
}
-# Start with a fresh gdb.
-
-gdb_exit
-gdb_start
-
-test_input_radix_2
-test_input_radix_3
-test_input_radix_8
-test_input_radix_10
-test_input_radix_16
-test_output_radix_8
-test_output_radix_10
-test_output_radix_16
+test_output_radix 8 "8" "10"
+ test_one_output 8 "010" "010"
+ test_one_output 8 "0xf" "17"
+ test_one_output 8 "10" "12"
+ test_one_output 8 "100" "144"
+ setup_kfail *-*-* "gdb/1715"
+ test_one_output 8 "20." "24"
+ test_one_output 8 "(int) 20." "24"
+
+test_output_radix 10 "a" "12"
+ test_one_output 10 "010" "8"
+ test_one_output 10 "0xf" "15"
+ test_one_output 10 "10" "10"
+ test_one_output 10 "100" "100"
+ test_one_output 10 "20." "20"
+ test_one_output 10 "(int) 20." "20"
+
+test_output_radix 16 "10" "20"
+ test_one_output 16 "010" "8"
+ test_one_output 16 "0xf" "f"
+ test_one_output 16 "10" "a"
+ test_one_output 16 "100" "64"
+ setup_kfail *-*-* "gdb/1715"
+ test_one_output 16 "20." "14"
+ test_one_output 16 "(int) 20." "14"
diff --git a/gdb/testsuite/gdb.base/remote.exp b/gdb/testsuite/gdb.base/remote.exp
index e2967c60b58..b286e3a6539 100644
--- a/gdb/testsuite/gdb.base/remote.exp
+++ b/gdb/testsuite/gdb.base/remote.exp
@@ -1,4 +1,4 @@
-# Copyright 1999, 2001 Free Software Foundation, Inc.
+# Copyright 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
@@ -119,7 +119,10 @@ proc gdb_load_timed {executable downloadsize class writesize} {
set load_begin_time [clock clicks]
set result [gdb_load $executable]
set load_end_time [clock clicks]
- if {$result < 0} then { fail "$test - loading executable"; return }
+ if { $result != 0 } then {
+ fail "$test - loading executable"
+ return
+ }
verbose "$test - time [expr ($load_end_time - $load_begin_time) / 1000] ms"
pass $test
}
diff --git a/gdb/testsuite/gdb.base/restore.c b/gdb/testsuite/gdb.base/restore.c
index a8282eee2c0..6aeac25341b 100644
--- a/gdb/testsuite/gdb.base/restore.c
+++ b/gdb/testsuite/gdb.base/restore.c
@@ -1,3 +1,22 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 1998, 1999, 2001, 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.
+ */
+
/* Test GDB's ability to restore saved registers from stack frames
when using the `return' command.
Jim Blandy <jimb@cygnus.com> --- December 1998 */
@@ -27,7 +46,7 @@
" = increment (" previous ");")
(if first-end
(progn
- (insert " /" "* " first-end " *" "/")
+ (insert " /" "* " first-end " prologue *" "/")
(setq first-end nil)))
(insert "\n")
(setq previous (local j))
@@ -110,7 +129,7 @@ callee0 (int n)
int
callee1 (int n)
{
- register int l1 = increment (n); /* callee1 */
+ register int l1 = increment (n); /* callee1 prologue */
return l1;
}
@@ -118,7 +137,7 @@ callee1 (int n)
int
callee2 (int n)
{
- register int l1 = increment (n); /* callee2 */
+ register int l1 = increment (n); /* callee2 prologue */
register int l2 = increment (l1);
return l1+l2;
}
@@ -127,7 +146,7 @@ callee2 (int n)
int
callee3 (int n)
{
- register int l1 = increment (n); /* callee3 */
+ register int l1 = increment (n); /* callee3 prologue */
register int l2 = increment (l1);
register int l3 = increment (l2);
return l1+l2+l3;
@@ -137,7 +156,7 @@ callee3 (int n)
int
callee4 (int n)
{
- register int l1 = increment (n); /* callee4 */
+ register int l1 = increment (n); /* callee4 prologue */
register int l2 = increment (l1);
register int l3 = increment (l2);
register int l4 = increment (l3);
@@ -148,7 +167,7 @@ callee4 (int n)
int
callee5 (int n)
{
- register int l1 = increment (n); /* callee5 */
+ register int l1 = increment (n); /* callee5 prologue */
register int l2 = increment (l1);
register int l3 = increment (l2);
register int l4 = increment (l3);
@@ -159,7 +178,7 @@ callee5 (int n)
int
caller1 (void)
{
- register int l1 = increment (0x7eeb); /* caller1 */
+ register int l1 = increment (0x7eeb); /* caller1 prologue */
register int n;
n = callee0 (l1);
n = callee1 (n + l1);
@@ -173,7 +192,7 @@ caller1 (void)
int
caller2 (void)
{
- register int l1 = increment (0x7eeb); /* caller2 */
+ register int l1 = increment (0x7eeb); /* caller2 prologue */
register int l2 = increment (l1);
register int n;
n = callee0 (l2);
@@ -188,7 +207,7 @@ caller2 (void)
int
caller3 (void)
{
- register int l1 = increment (0x7eeb); /* caller3 */
+ register int l1 = increment (0x7eeb); /* caller3 prologue */
register int l2 = increment (l1);
register int l3 = increment (l2);
register int n;
@@ -204,7 +223,7 @@ caller3 (void)
int
caller4 (void)
{
- register int l1 = increment (0x7eeb); /* caller4 */
+ register int l1 = increment (0x7eeb); /* caller4 prologue */
register int l2 = increment (l1);
register int l3 = increment (l2);
register int l4 = increment (l3);
@@ -221,7 +240,7 @@ caller4 (void)
int
caller5 (void)
{
- register int l1 = increment (0x7eeb); /* caller5 */
+ register int l1 = increment (0x7eeb); /* caller5 prologue */
register int l2 = increment (l1);
register int l3 = increment (l2);
register int l4 = increment (l3);
diff --git a/gdb/testsuite/gdb.base/restore.exp b/gdb/testsuite/gdb.base/restore.exp
index 4c7a33a37c9..1ee71d631d2 100644
--- a/gdb/testsuite/gdb.base/restore.exp
+++ b/gdb/testsuite/gdb.base/restore.exp
@@ -1,4 +1,7 @@
-# Copyright 1998, 1999, 2000 Free Software Foundation, Inc.
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 1998, 1999, 2000, 2001, 2002, 2004 Free Software
+# Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -14,9 +17,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-# Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@prep.ai.mit.edu
-
# Test GDB's ability to restore saved registers from stack frames
# when using the `return' command.
#
@@ -24,7 +24,7 @@
# fragments borrowed from return.exp.
if $tracelevel then {
- strace $tracelevel
+ strace $tracelevel
}
set prms_id 0
@@ -34,13 +34,15 @@ set testfile "restore"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
- gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
proc restore_tests { } {
global gdb_prompt
- if { ! [ runto driver ] } then { return 0 }
+ if { ! [ runto driver ] } {
+ return 0
+ }
set limit 5
@@ -48,30 +50,35 @@ proc restore_tests { } {
# call each of the callee functions,
# force a return from the callee, and
# make sure that the local variables still have the right values.
+
for {set c 1} {$c <= $limit} {incr c} {
# Set a breakpoint at the next caller function.
- gdb_test "tbreak caller$c" "Breakpoint.*\[0-9\]*\\." "tbreak caller$c"
+ gdb_test "tbreak caller$c" "Breakpoint.*\[0-9\]*\\." \
+ "tbreak caller$c"
# Continue to the next caller function.
- gdb_test "continue" ".*/\\* caller$c \\*/" "run to caller$c"
+ gdb_test "continue" " caller$c prologue .*" "run to caller$c"
# Do each callee function.
for {set e 1} {$e <= $limit} {incr e} {
gdb_test "tbreak callee$e" "Breakpoint.*\[0-9\]*\\." \
- "tbreak callee$e"
+ "caller$c calls callee$e; tbreak callee"
- gdb_test "continue" ".*/\\* callee$e \\*/" "run to callee$e"
-
+ gdb_test "continue" " callee$e prologue .*/" \
+ "caller$c calls callee$e; continue to callee"
+
# Do a forced return from the callee.
- send_gdb "return 0\n"
- gdb_expect {
+ set test "caller$c calls callee$e; return callee now"
+ gdb_test_multiple "return 0" "$test" {
-re "Make .* return now.*y or n. $" {
send_gdb "y\n"
exp_continue
}
- -re "$gdb_prompt $" { }
+ -re " caller$c .*$gdb_prompt $" {
+ pass "$test"
+ }
}
# Check that the values of the local variables are what
@@ -79,7 +86,7 @@ proc restore_tests { } {
for {set var 1} {$var <= $c} {incr var} {
set expected [expr 0x7eeb + $var]
gdb_test "print l$var" " = $expected" \
- "caller$c called callee$e; variable l$var restored to $expected"
+ "caller$c calls callee$e; return restored l$var to $expected"
}
}
}
diff --git a/gdb/testsuite/gdb.base/sep-proc.c b/gdb/testsuite/gdb.base/sep-proc.c
new file mode 100644
index 00000000000..0fbb17a82c2
--- /dev/null
+++ b/gdb/testsuite/gdb.base/sep-proc.c
@@ -0,0 +1,26 @@
+/* This file 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 */
+
+void
+say_hello (void)
+{
+ printf ("Hello world.\n");
+}
diff --git a/gdb/testsuite/gdb.base/sep.c b/gdb/testsuite/gdb.base/sep.c
new file mode 100644
index 00000000000..4402bd84251
--- /dev/null
+++ b/gdb/testsuite/gdb.base/sep.c
@@ -0,0 +1,35 @@
+/* This file 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>
+
+/* Include a .c file. This is usually considered bad practice in C,
+ but this emulate a practice which is common in other languages.
+ One such language is Ada and its concept of "separates", for instance. */
+#include "sep-proc.c"
+
+int
+main (void)
+{
+ say_hello ();
+ return 0;
+}
+
diff --git a/gdb/testsuite/gdb.base/sep.exp b/gdb/testsuite/gdb.base/sep.exp
new file mode 100644
index 00000000000..7a7c22ae1b6
--- /dev/null
+++ b/gdb/testsuite/gdb.base/sep.exp
@@ -0,0 +1,68 @@
+# 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
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+set testfile "sep"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" } {
+ 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}
+
+# Try to display the source code inside a file which is included by
+# another source file. The purpose of this test is to verify that
+# this operation works, even before we have loaded full symbols for
+# that file (by doing a "break say_hello" for instance).
+#
+# We just check that the command succeeds, so no need to match the
+# complete exact output. Simply verifying that we get procedure
+# say_hello is good enough, and avoid unnecessary failures is someone
+# decides later to reformat sep-proc.c.
+
+gdb_test "list sep-proc.c:23" \
+ "void.*say_hello.*" \
+ "list using location inside included file"
+
+# Try the same, but this time with a breakpoint. We need to exit
+# GDB to make sure that we havn't loaded the full symbols yet when
+# we test the breakpoint insertion.
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+set test "breakpoint inside included file"
+gdb_test_multiple "break sep-proc.c:25" "$test" {
+ -re "Breakpoint.*at.* file .*sep-proc.c, line .*" {
+ pass "$test"
+ }
+ -re "No source file named sep-proc.c.*" {
+ fail "$test"
+ }
+}
+
diff --git a/gdb/testsuite/gdb.base/shlib-call.exp b/gdb/testsuite/gdb.base/shlib-call.exp
index 4205253e2f5..26a6556464d 100644
--- a/gdb/testsuite/gdb.base/shlib-call.exp
+++ b/gdb/testsuite/gdb.base/shlib-call.exp
@@ -291,17 +291,17 @@ 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_breakpoint "shr1"
+gdb_breakpoint "shr1" "allow-pending"
# FIXME: should not send "run" explicitly. Non-portable.
if ![is_remote target] {
- gdb_test "run" "Starting program:.*Breakpoint 1,.*" \
+ gdb_test "run" "Starting program:.*Breakpoint .,.*" \
"run to bp in shared library"
gdb_test "cont" ".*Program exited normally..*"
- gdb_test "run" "Starting program:.*Breakpoint 1,.*" \
+ gdb_test "run" "Starting program:.*Breakpoint .,.*" \
"re-run to bp in shared library (PR's 16495, 18213)"
gdb_test "cont" ".*Program exited normally..*"
diff --git a/gdb/testsuite/gdb.base/sigaltstack.c b/gdb/testsuite/gdb.base/sigaltstack.c
new file mode 100644
index 00000000000..b7abc9b5241
--- /dev/null
+++ b/gdb/testsuite/gdb.base/sigaltstack.c
@@ -0,0 +1,97 @@
+/* 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 <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+
+enum level { MAIN, OUTER, INNER, LEAF, NR_LEVELS };
+
+/* Levels completed flag. */
+volatile enum level level = NR_LEVELS;
+
+void catcher (int signal);
+
+void
+thrower (enum level next_level, int sig, int itimer, int on_stack)
+{
+ level = next_level;
+ /* Set up the signal handler. */
+ {
+ struct sigaction act;
+ memset (&act, 0, sizeof (act));
+ act.sa_handler = catcher;
+ act.sa_flags |= on_stack;
+ sigaction (sig, &act, NULL);
+ }
+ /* Set up a one-off timer. A timer, rather than SIGSEGV, is used as
+ after a timer handler finishes the interrupted code can safely
+ resume. */
+ {
+ struct itimerval itime;
+ memset (&itime, 0, sizeof (itime));
+ itime.it_value.tv_usec = 250 * 1000;
+ setitimer (itimer, &itime, NULL);
+ }
+ /* Wait. */
+ while (level != LEAF);
+}
+
+void
+catcher (int signal)
+{
+ /* Find the next level. */
+ switch (level)
+ {
+ case MAIN:
+ thrower (OUTER, SIGALRM, ITIMER_REAL, SA_ONSTACK);
+ break;
+ case OUTER:
+ thrower (INNER, SIGVTALRM, ITIMER_VIRTUAL, SA_ONSTACK);
+ break;
+ case INNER:
+ level = LEAF;
+ return;
+ }
+}
+
+
+main ()
+{
+ /* Set up the altstack. */
+ {
+ static char stack[SIGSTKSZ * NR_LEVELS];
+ struct sigaltstack alt;
+ memset (&alt, 0, sizeof (alt));
+ alt.ss_sp = stack;
+ alt.ss_size = SIGSTKSZ;
+ alt.ss_flags = 0;
+ if (sigaltstack (&alt, NULL) < 0)
+ {
+ perror ("sigaltstack");
+ exit (0);
+ }
+ }
+ level = MAIN;
+ catcher (0);
+}
diff --git a/gdb/testsuite/gdb.base/sigaltstack.exp b/gdb/testsuite/gdb.base/sigaltstack.exp
new file mode 100644
index 00000000000..d1e37d8aa98
--- /dev/null
+++ b/gdb/testsuite/gdb.base/sigaltstack.exp
@@ -0,0 +1,105 @@
+# 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.
+
+
+# The program sigaltstack.c creates a backtrace containing nested
+# signal handlers on an alternative stack. This in turn leads to a
+# non-contiguous (and possibly non-monotonic) backtrace - stack
+# address jump at the normal-alt stack boundary.
+
+# This test confirms that GDB can both backtrace through and finish
+# such a stack.
+
+if [target_info exists gdb,nosignals] {
+ verbose "Skipping signals.exp because of nosignals."
+ continue
+}
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+set testfile sigaltstack
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+ untested "Couldn't compile ${module}.c"
+ return -1
+}
+
+# get things started
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+# Pass all the alarms straight through (but verbosely)
+gdb_test "handle SIGALRM print pass nostop"
+gdb_test "handle SIGVTALRM print pass nostop"
+gdb_test "handle SIGPROF print pass nostop"
+
+# Advance to main
+if { ![runto_main] } then {
+ gdb_suppress_tests;
+}
+
+# Stop in handle, when at the inner most level
+gdb_test "break catcher if level == INNER"
+gdb_test "continue" ".* catcher .*" "continue to catch"
+# step off the assignment
+gdb_test "next"
+
+# Full backtrace?
+send_gdb "bt\n"
+gdb_expect_list "backtrace" ".*$gdb_prompt $" {
+ "\[\r\n\]+.0 \[^\r\n\]* catcher "
+ "\[\r\n\]+.1 .signal handler called."
+ "\[\r\n\]+.2 \[^\r\n\]* thrower .next_level=INNER"
+ "\[\r\n\]+.3 \[^\r\n\]* catcher "
+ "\[\r\n\]+.4 .signal handler called."
+ "\[\r\n\]+.5 \[^\r\n\]* thrower .next_level=OUTER"
+ "\[\r\n\]+.6 \[^\r\n\]* catcher "
+ "\[\r\n\]+.7 \[^\r\n\]* main .*"
+}
+
+proc finish_test { pattern msg } {
+ global gdb_prompt
+
+ gdb_test_multiple "finish" $msg {
+ -re "Cannot insert breakpoint 0.*${gdb_prompt} $" {
+ # Some platforms use a special read-only page for signal
+ # trampolines. We can't set a breakpoint there, and we
+ # don't gracefully fall back to single-stepping.
+ setup_kfail "i?86-*-linux*" gdb/1736
+ fail "$msg (could not set breakpoint)"
+ }
+ -re "$pattern.*${gdb_prompt} $" {
+ pass $msg
+ }
+ }
+}
+
+# Finish?
+finish_test "signal handler called." "finish from catch LEAF"
+finish_test "thrower .next_level=INNER, .*" "finish to throw INNER"
+finish_test "catcher .*" "finish to catch INNER"
+finish_test "signal handler called.*" "finish from catch INNER"
+finish_test "thrower .next_level=OUTER, .*" "finish to OUTER"
+finish_test "catcher .*" "finish to catch MAIN"
+finish_test "main .*" "finish to MAIN"
diff --git a/gdb/testsuite/gdb.base/sigbpt.c b/gdb/testsuite/gdb.base/sigbpt.c
new file mode 100644
index 00000000000..b189f6da7da
--- /dev/null
+++ b/gdb/testsuite/gdb.base/sigbpt.c
@@ -0,0 +1,53 @@
+/* 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 <signal.h>
+#include <stdlib.h>
+#include <string.h>
+
+extern void
+keeper (int sig)
+{
+}
+
+volatile long v1 = 0;
+volatile long v2 = 0;
+volatile long v3 = 0;
+
+extern long
+bowler (void)
+{
+ /* Try to read address zero. Do it in a slightly convoluted way so
+ that more than one instruction is used. */
+ return *(char *) (v1 + v2 + v3);
+}
+
+int
+main ()
+{
+ static volatile int i;
+
+ struct sigaction act;
+ memset (&act, 0, sizeof act);
+ act.sa_handler = keeper;
+ sigaction (SIGSEGV, &act, NULL);
+
+ bowler ();
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.base/sigbpt.exp b/gdb/testsuite/gdb.base/sigbpt.exp
new file mode 100644
index 00000000000..61625b52373
--- /dev/null
+++ b/gdb/testsuite/gdb.base/sigbpt.exp
@@ -0,0 +1,266 @@
+# 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.
+
+# Check that GDB can and only executes single instructions when
+# stepping through a sequence of breakpoints interleaved by a signal
+# handler.
+
+# This test is known to tickle the following problems: kernel letting
+# the inferior execute both the system call, and the instruction
+# following, when single-stepping a system call; kernel failing to
+# propogate the single-step state when single-stepping the sigreturn
+# system call, instead resuming the inferior at full speed; GDB
+# doesn't know how to software single-step across a sigreturn
+# instruction. Since the kernel problems can be "fixed" using
+# software single-step this is KFAILed rather than XFAILed.
+
+if $tracelevel {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+set testfile "sigbpt"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+ 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}
+
+#
+# Run to `main' where we begin our tests.
+#
+
+if ![runto_main] then {
+ gdb_suppress_tests
+}
+
+# If we can examine what's at memory address 0, it is possible that we
+# could also execute it. This could probably make us run away,
+# executing random code, which could have all sorts of ill effects,
+# especially on targets without an MMU. Don't run the tests in that
+# case.
+
+send_gdb "x 0\n"
+gdb_expect {
+ -re "0x0:.*Cannot access memory at address 0x0.*$gdb_prompt $" { }
+ -re "0x0:.*Error accessing memory address 0x0.*$gdb_prompt $" { }
+ -re ".*$gdb_prompt $" {
+ untested "Memory at address 0 is possibly executable"
+ return
+ }
+}
+
+gdb_test "break keeper"
+
+# Run to bowler, and then single step until there's a SIGSEGV. Record
+# the address of each single-step instruction (up to and including the
+# instruction that causes the SIGSEGV) in bowler_addrs, and the address
+# of the actual SIGSEGV in segv_addr.
+
+set bowler_addrs bowler
+gdb_test {display/i $pc}
+gdb_test "advance *bowler" "bowler.*" "advance to the bowler"
+set test "stepping to SIGSEGV"
+gdb_test_multiple "stepi" "$test" {
+ -re "Program received signal SIGSEGV.*pc *(0x\[0-9a-f\]*).*$gdb_prompt $" {
+ set segv_addr $expect_out(1,string)
+ pass "$test"
+ }
+ -re " .*pc *(0x\[0-9a-f\]*).*bowler.*$gdb_prompt $" {
+ set bowler_addrs [concat $expect_out(1,string) $bowler_addrs]
+ send_gdb "stepi\n"
+ exp_continue
+ }
+}
+
+# Now record the address of the instruction following the faulting
+# instruction in bowler_addrs.
+
+set test "get insn after fault"
+gdb_test_multiple {x/2i $pc} "$test" {
+ -re "(0x\[0-9a-f\]*).*bowler.*(0x\[0-9a-f\]*).*bowler.*$gdb_prompt $" {
+ set bowler_addrs [concat $expect_out(2,string) $bowler_addrs]
+ pass "$test"
+ }
+}
+
+# Procedures for returning the address of the instruction before, at
+# and after, the faulting instruction.
+
+proc before_segv { } {
+ global bowler_addrs
+ return [lindex $bowler_addrs 2]
+}
+
+proc at_segv { } {
+ global bowler_addrs
+ return [lindex $bowler_addrs 1]
+}
+
+proc after_segv { } {
+ global bowler_addrs
+ return [lindex $bowler_addrs 0]
+}
+
+# Check that the address table and SIGSEGV correspond.
+
+set test "Verify that SIGSEGV occurs at the last STEPI insn"
+if {[string compare $segv_addr [at_segv]] == 0} {
+ pass "$test"
+} else {
+ fail "$test ($segv_addr [at_segv])"
+}
+
+# Check that the inferior is correctly single stepped all the way back
+# to a faulting instruction.
+
+proc stepi_out { name args } {
+ global gdb_prompt
+
+ # Set SIGSEGV to pass+nostop and then run the inferior all the way
+ # through to the signal handler. With the handler is reached,
+ # disable SIGSEGV, ensuring that further signals stop the
+ # inferior. Stops a SIGSEGV infinite loop when a broke system
+ # keeps re-executing the faulting instruction.
+ rerun_to_main
+ gdb_test "handle SIGSEGV nostop print pass" "" "${name}; pass SIGSEGV"
+ gdb_test "continue" "keeper.*" "${name}; continue to keeper"
+ gdb_test "handle SIGSEGV stop print nopass" "" "${name}; nopass SIGSEGV"
+
+ # Insert all the breakpoints. To avoid the need to step over
+ # these instructions, this is delayed until after the keeper has
+ # been reached.
+ for {set i 0} {$i < [llength $args]} {incr i} {
+ gdb_test "break [lindex $args $i]" "Breakpoint.*" \
+ "${name}; set breakpoint $i of [llength $args]"
+ }
+
+ # Single step our way out of the keeper, through the signal
+ # trampoline, and back to the instruction that faulted.
+ set test "${name}; stepi out of handler"
+ gdb_test_multiple "stepi" "$test" {
+ -re "keeper.*$gdb_prompt $" {
+ send_gdb "stepi\n"
+ exp_continue
+ }
+ -re "signal handler.*$gdb_prompt $" {
+ send_gdb "stepi\n"
+ exp_continue
+ }
+ -re "Program received signal SIGSEGV.*$gdb_prompt $" {
+ kfail gdb/1702 "$test (executed fault insn)"
+ }
+ -re "Breakpoint.*pc *[at_segv] .*bowler.*$gdb_prompt $" {
+ pass "$test (at breakpoint)"
+ }
+ -re "Breakpoint.*pc *[after_segv] .*bowler.*$gdb_prompt $" {
+ kfail gdb/1702 "$test (executed breakpoint)"
+ }
+ -re "pc *[at_segv] .*bowler.*$gdb_prompt $" {
+ pass "$test"
+ }
+ -re "pc *[after_segv] .*bowler.*$gdb_prompt $" {
+ kfail gdb/1702 "$test (skipped fault insn)"
+ }
+ -re "pc *0x\[a-z0-9\]* .*bowler.*$gdb_prompt $" {
+ kfail gdb/1702 "$test (corrupt pc)"
+ }
+ }
+
+ # Clear any breakpoints
+ for {set i 0} {$i < [llength $args]} {incr i} {
+ gdb_test "clear [lindex $args $i]" "Deleted .*" \
+ "${name}; clear breakpoint $i of [llength $args]"
+ }
+}
+
+# Let a signal handler exit, returning to a breakpoint instruction
+# inserted at the original fault instruction. Check that the
+# breakpoint is hit, and that single stepping off that breakpoint
+# executes the underlying fault instruction causing a SIGSEGV.
+
+proc cont_out { name args } {
+ global gdb_prompt
+
+ # Set SIGSEGV to pass+nostop and then run the inferior all the way
+ # through to the signal handler. With the handler is reached,
+ # disable SIGSEGV, ensuring that further signals stop the
+ # inferior. Stops a SIGSEGV infinite loop when a broke system
+ # keeps re-executing the faulting instruction.
+ rerun_to_main
+ gdb_test "handle SIGSEGV nostop print pass" "" "${name}; pass SIGSEGV"
+ gdb_test "continue" "keeper.*" "${name}; continue to keeper"
+ gdb_test "handle SIGSEGV stop print nopass" "" "${name}; nopass SIGSEGV"
+
+ # Insert all the breakpoints. To avoid the need to step over
+ # these instructions, this is delayed until after the keeper has
+ # been reached. Always set a breakpoint at the signal trampoline
+ # instruction.
+ set args [concat $args "*[at_segv]"]
+ for {set i 0} {$i < [llength $args]} {incr i} {
+ gdb_test "break [lindex $args $i]" "Breakpoint.*" \
+ "${name}; set breakpoint $i of [llength $args]"
+ }
+
+ # Let the handler return, it should "appear to hit" the breakpoint
+ # inserted at the faulting instruction. Note that the breakpoint
+ # instruction wasn't executed, rather the inferior was SIGTRAPed
+ # with the PC at the breakpoint.
+ gdb_test "continue" "Breakpoint.*pc *[at_segv] .*" \
+ "${name}; continue to breakpoint at fault"
+
+ # Now single step the faulted instrction at that breakpoint.
+ gdb_test "stepi" \
+ "Program received signal SIGSEGV.*pc *[at_segv] .*" \
+ "${name}; stepi fault"
+
+ # Clear any breakpoints
+ for {set i 0} {$i < [llength $args]} {incr i} {
+ gdb_test "clear [lindex $args $i]" "Deleted .*" \
+ "${name}; clear breakpoint $i of [llength $args]"
+ }
+
+}
+
+
+
+# Try to confuse DECR_PC_AFTER_BREAK architectures by scattering
+# breakpoints around the faulting address. In all cases the inferior
+# should single-step out of the signal trampoline halting (but not
+# executing) the fault instruction.
+
+stepi_out "stepi"
+stepi_out "stepi bp before segv" "*[before_segv]"
+stepi_out "stepi bp at segv" "*[at_segv]"
+stepi_out "stepi bp before and at segv" "*[at_segv]" "*[before_segv]"
+
+
+# Try to confuse DECR_PC_AFTER_BREAK architectures by scattering
+# breakpoints around the faulting address. In all cases the inferior
+# should exit the signal trampoline halting at the breakpoint that
+# replaced the fault instruction.
+cont_out "cont"
+cont_out "cont bp after segv" "*[before_segv]"
+cont_out "cont bp before and after segv" "*[before_segv]" "*[after_segv]"
diff --git a/gdb/testsuite/gdb.base/siginfo.c b/gdb/testsuite/gdb.base/siginfo.c
new file mode 100644
index 00000000000..6303f07194f
--- /dev/null
+++ b/gdb/testsuite/gdb.base/siginfo.c
@@ -0,0 +1,69 @@
+/* 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 <string.h>
+#include <signal.h>
+#include <sys/time.h>
+
+static volatile int done;
+
+#ifdef SA_SIGINFO
+static void /* HANDLER */
+handler (int sig, siginfo_t *info, void *context)
+{
+ done = 1;
+} /* handler */
+#else
+static void
+handler (int sig)
+{
+ done = 1;
+} /* handler */
+#endif
+
+main ()
+{
+ /* Set up the signal handler. */
+ {
+ struct sigaction action;
+ memset (&action, 0, sizeof (action));
+#ifdef SA_SIGINFO
+ action.sa_sigaction = handler;
+ action.sa_flags |= SA_SIGINFO;
+#else
+ action.sa_handler = handler;
+#endif
+ sigaction (SIGVTALRM, &action, NULL);
+ }
+
+ /* Set up a one-off timer. A timer, rather than SIGSEGV, is used as
+ after a timer handler finishes the interrupted code can safely
+ resume. */
+ {
+ struct itimerval itime;
+ memset (&itime, 0, sizeof (itime));
+ itime.it_value.tv_usec = 250 * 1000;
+ setitimer (ITIMER_VIRTUAL, &itime, NULL);
+ }
+ /* Wait. */
+ while (!done);
+ return 0;
+} /* main */
diff --git a/gdb/testsuite/gdb.base/siginfo.exp b/gdb/testsuite/gdb.base/siginfo.exp
new file mode 100644
index 00000000000..a081ab8e887
--- /dev/null
+++ b/gdb/testsuite/gdb.base/siginfo.exp
@@ -0,0 +1,98 @@
+# 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.
+
+
+# The program siginfo.c creates a backtrace containing a signal
+# handler registered using sigaction's sa_sigaction / SA_SIGINFO.
+# Some OS's (e.g., GNU/Linux) use different signal trampolines for
+# sa_sigaction and sa_handler.
+
+# This test first confirms that GDB can backtrace through the
+# alternative sa_sigaction signal handler, and second that GDB can
+# nexti/stepi out of such a handler.
+
+if [target_info exists gdb,nosignals] {
+ verbose "Skipping signals.exp because of nosignals."
+ continue
+}
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+set testfile siginfo
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+ untested "Couldn't compile ${module}.c"
+ return -1
+}
+
+# get things started
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+gdb_test "display/i \$pc"
+
+# Advance to main
+if { ![runto_main] } then {
+ gdb_suppress_tests;
+}
+
+# Pass all the alarms straight through (but verbosely)
+# gdb_test "handle SIGALRM print pass nostop"
+# gdb_test "handle SIGVTALRM print pass nostop"
+# gdb_test "handle SIGPROF print pass nostop"
+
+# Run to the signal handler, validate the backtrace.
+gdb_test "break handler"
+gdb_test "continue" ".* handler .*" "continue to stepi handler"
+send_gdb "bt\n"
+gdb_expect_list "backtrace for nexti" ".*$gdb_prompt $" {
+ "\[\r\n\]+.0 \[^\r\n\]* handler "
+ "\[\r\n\]+.1 .signal handler called."
+ "\[\r\n\]+.2 \[^\r\n\]* main .*"
+}
+
+# Check that GDB can step the inferior back to main
+set test "step out of handler"
+gdb_test_multiple "step" "${test}" {
+ -re "done = 1;.*${gdb_prompt} $" {
+ send_gdb "$i\n"
+ exp_continue
+ }
+ -re "\} .. handler .*${gdb_prompt} $" {
+ send_gdb "step\n"
+ exp_continue
+ }
+ -re "Program exited normally.*${gdb_prompt} $" {
+ kfail gdb/1613 "$test (program exited)"
+ }
+ -re "(while ..done|return 0).*${gdb_prompt} $" {
+ # After stepping out of a function /r signal-handler, GDB will
+ # advance the inferior until it is at the first instruction of
+ # a code-line. While typically things return to the middle of
+ # the "while..." (and hence GDB advances the inferior to the
+ # "return..." line) it is also possible for the return to land
+ # on the first instruction of "while...". Accept both cases.
+ pass "$test"
+ }
+}
diff --git a/gdb/testsuite/gdb.base/signals.exp b/gdb/testsuite/gdb.base/signals.exp
index a07e3a8500a..cbe00bf3b12 100644
--- a/gdb/testsuite/gdb.base/signals.exp
+++ b/gdb/testsuite/gdb.base/signals.exp
@@ -1,4 +1,4 @@
-# Copyright 1997, 1998, 1999, 2003 Free Software Foundation, Inc.
+# Copyright 1997, 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
-
if [target_info exists gdb,nosignals] {
verbose "Skipping signals.exp because of nosignals."
continue
@@ -33,7 +30,7 @@ set testfile signals
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
- gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
# Create and source the file that provides information about the compiler
@@ -48,294 +45,13 @@ if {$hp_cc_compiler} {
set void void
}
-proc signal_tests_1 {} {
- global gdb_prompt
- if [runto_main] then {
- gdb_test "next" "signal \\(SIGUSR1.*" \
- "next over signal (SIGALRM, handler)"
- gdb_test "next" "alarm \\(.*" \
- "next over signal (SIGUSR1, handler)"
- gdb_test "next" "\\+\\+count; /\\* first \\*/" \
- "next over alarm (1)"
- # An alarm has been signaled, give the signal time to get delivered.
- sleep 2
-
- # i386 BSD currently fails the next test with a SIGTRAP.
- setup_xfail "i*86-*-bsd*"
- # But Dynix has a DECR_PC_AFTER_BREAK of zero, so the failure
- # is shadowed by hitting the through_sigtramp_breakpoint.
- clear_xfail "i*86-sequent-bsd*"
- # Univel SVR4 i386 continues instead of stepping.
- setup_xfail "i*86-univel-sysv4*"
- # lynx fails with "next" acting like "continue"
- setup_xfail "*-*-*lynx*"
- # linux (aout versions) also fails with "next" acting like "continue"
- # this is probably more dependant on the kernel version than on the
- # object file format or utils. (sigh)
- setup_xfail "i*86-pc-linuxaout-gnu" "i*86-pc-linuxoldld-gnu"
- send_gdb "next\n"
- gdb_expect {
- -re "alarm .*$gdb_prompt $" { pass "next to 2nd alarm (1)" }
- -re "Program received signal SIGTRAP.*first.*$gdb_prompt $" {
-
- # This can happen on machines that have a trace flag
- # in their PS register.
- # The trace flag in the PS register will be set due to
- # the `next' command.
- # Before calling the signal handler, the PS register
- # is pushed along with the context on the user stack.
- # When the signal handler has finished, it reenters the
- # the kernel via a sigreturn syscall, which restores the
- # PS register along with the context.
- # If the kernel erroneously does not clear the trace flag
- # in the pushed context, gdb will receive a SIGTRAP from
- # the set trace flag in the restored context after the
- # signal handler has finished.
-
- # I do not yet understand why the SIGTRAP does not occur
- # after stepping the instruction at the restored PC on
- # i386 BSDI 1.0 systems.
-
- # Note that the vax under Ultrix also exhibits
- # this behaviour (it is uncovered by the `continue from
- # a break in a signal handler' test below).
- # With this test the failure is shadowed by hitting the
- # through_sigtramp_breakpoint upon return from the signal
- # handler.
-
- # SVR4 and Linux based i*86 systems exhibit this behaviour
- # as well (it is uncovered by the `continue from a break
- # in a signal handler' test below).
- # As these systems use procfs, where we tell the kernel not
- # to tell gdb about `pass' signals, and the trace flag is
- # cleared by the kernel before entering the sigtramp
- # routine, GDB will not notice the execution of the signal
- # handler.
- # Upon return from the signal handler, GDB will receive
- # a SIGTRAP from the set trace flag in the restored context.
- # The SIGTRAP marks the end of a (albeit long winded)
- # single step for GDB, causing this test to pass.
-
- fail "next to 2nd alarm (1) (probably kernel bug)"
- gdb_test "next" "alarm.*" "next to 2nd alarm (1)"
- }
- -re "Program exited with code.*$gdb_prompt $" {
-
- # This is apparently a bug in the UnixWare kernel (but
- # has not been investigated beyond the
- # resume/target_wait level, and has not been reported
- # to Univel). If it steps when a signal is pending,
- # it does a continue instead. I don't know whether
- # there is a workaround.
-
- # Perhaps this problem exists on other SVR4 systems;
- # but (a) we have no reason to think so, and (b) if we
- # put a wrong xfail here, we never get an XPASS to let
- # us know that it was incorrect (and then if such a
- # configuration regresses we have no way of knowing).
- # Solaris is not a relevant data point either way
- # because it lacks single stepping.
-
- # fnf: I don't agree with the above philosophy. We
- # can never be sure that any particular XFAIL is
- # specified 100% correctly in that no systems with
- # the bug are missed and all systems without the bug
- # are excluded. If we include an XFAIL that isn't
- # appropriate for a particular system, then when that
- # system gets tested it will XPASS, and someone should
- # investigate and fix the setup_xfail as appropriate,
- # or more preferably, the actual bug. Each such case
- # adds more data to narrowing down the scope of the
- # problem and ultimately fixing it.
-
- setup_xfail "i*86-*-sysv4*"
- fail "'next' behaved as 'continue (known SVR4 bug)'"
- return 0
- }
- -re ".*$gdb_prompt $" { fail "next to 2nd alarm (1)" }
- timeout { fail "next to 2nd alarm (1); (timeout)" }
- eof { fail "next to 2nd alarm (1); (eof)" }
- }
-
- gdb_test "break handler" "Breakpoint \[0-9\]+ .*"
- gdb_test "next" "\\+\\+count; /\\* second \\*/" \
- "next to 2nd ++count in signals_tests_1"
- # An alarm has been signaled, give the signal time to get delivered.
- sleep 2
-
- set bash_bug 0
- send_gdb "next\n"
- gdb_expect {
- -re "Breakpoint.*handler.*$gdb_prompt $" {
- pass "next to handler in signals_tests_1"
- }
- -re "Program received signal SIGEMT.*$gdb_prompt $" {
- # Bash versions before 1.13.5 cause this behaviour
- # by blocking SIGTRAP.
- fail "next to handler in signals_tests_1 (known problem with bash versions before 1.13.5)"
- set bash_bug 1
- gdb_test "signal 0" "Breakpoint.*handler.*"
- }
- -re ".*$gdb_prompt $" { fail "next to handler in signals_tests_1" }
- timeout { fail "next to handler in signals_tests_1 (timeout)" }
- eof { fail "next to handler in signals_tests_1 (eof)" }
- }
-
- # This doesn't test that main is frame #2, just that main is frame
- # #2, #3, or higher. At some point this should be fixed (but
- # it quite possibly would introduce new FAILs on some systems).
- setup_xfail "i*86-*-bsdi2.0"
- gdb_test "backtrace 10" "#0.*handler.*#1.*signal handler.*#2.* main .*" \
- "backtrace in signals_tests_1"
-
- gdb_test "break func1" "Breakpoint \[0-9\]+ .*"
- gdb_test "break func2" "Breakpoint \[0-9\]+ .*"
-
- # Vax Ultrix and i386 BSD currently fail the next test with
- # a SIGTRAP, but with different symptoms.
- setup_xfail "vax-*-ultrix*"
- setup_xfail "i*86-*-bsd*"
- setup_xfail "i*86-*-freebsd*"
- setup_xfail "i*86-pc-linux-gnu*"
- setup_xfail "i*86-*-solaris2*"
- send_gdb "continue\n"
- gdb_expect {
- -re "Breakpoint.*func1.*$gdb_prompt $" { pass "continue to func1" }
- -re "Program received signal SIGTRAP.*second.*$gdb_prompt $" {
-
- # See explanation for `next to 2nd alarm (1)' fail above.
- # We did step into the signal handler, hit a breakpoint
- # in the handler and continued from the breakpoint.
- # The set trace flag in the restored context is causing
- # the SIGTRAP, without stepping an instruction.
-
- fail "continue to func1 (probably kernel bug)"
- gdb_test "continue" "Breakpoint.*func1.*" \
- "extra continue to func1"
- }
- -re "Program received signal SIGTRAP.*func1 ..;.*$gdb_prompt $" {
-
- # On the vax under Ultrix the set trace flag in the restored
- # context is causing the SIGTRAP, but after stepping one
- # instruction, as expected.
-
- fail "continue to func1 (probably kernel bug)"
- gdb_test "continue" "Breakpoint.*func1.*" \
- "extra continue to func1"
- }
- -re ".*$gdb_prompt $" { fail "continue to func1" }
- default { fail "continue to func1" }
- }
-
- setup_xfail "*-*-irix*"
- send_gdb "signal SIGUSR1\n"
- gdb_expect {
- -re "Breakpoint.*handler.*$gdb_prompt $" { pass "signal SIGUSR1" }
- -re "Program received signal SIGUSR1.*$gdb_prompt $" {
- # This is what irix4 and irix5 do.
- # It would appear to be a kernel bug.
- fail "signal SIGUSR1"
- gdb_test "continue" "Breakpoint.*handler.*" "pass it SIGUSR1"
- }
- -re ".*$gdb_prompt $" { fail "signal SIGUSR1" }
- default { fail "signal SIGUSR1" }
- }
-
- # Will tend to wrongly require an extra continue.
-
- # The problem here is that the breakpoint at func1 will be
- # inserted, and when the system finishes with the signal
- # handler it will try to execute there. For GDB to try to
- # remember that it was going to step over a breakpoint when a
- # signal happened, distinguish this case from the case where
- # func1 is called from the signal handler, etc., seems
- # exceedingly difficult. So don't expect this to get fixed
- # anytime soon.
-
- setup_xfail "*-*-*"
- send_gdb "continue\n"
- gdb_expect {
- -re "Breakpoint.*func2.*$gdb_prompt $" { pass "continue to func2" }
- -re "Breakpoint.*func1.*$gdb_prompt $" {
- fail "continue to func2"
- gdb_test "continue" "Breakpoint.*func2.*" \
- "extra continue to func2"
- }
- -re ".*$gdb_prompt $" { fail "continue to func2" }
- default { fail "continue to func2" }
- }
-
- sleep 2
-
- # GDB yanks out the breakpoints to step over the breakpoint it
- # stopped at, which means the breakpoint at handler is yanked.
- # But if SOFTWARE_SINGLE_STEP_P, we won't get another chance to
- # reinsert them (at least not with procfs, where we tell the kernel
- # not to tell gdb about `pass' signals). So the fix would appear to
- # be to just yank that one breakpoint when we step over it.
-
- setup_xfail "sparc*-*-*"
- setup_xfail "rs6000-*-*"
- setup_xfail "powerpc-*-*"
-
- # A faulty bash will not step the inferior into sigtramp on sun3.
- if {$bash_bug} then {
- setup_xfail "m68*-*-sunos4*"
- }
-
- setup_xfail "i*86-pc-linux-gnu*"
- setup_xfail "i*86-*-solaris2*"
- gdb_test "continue" "Breakpoint.*handler.*" "continue to handler"
-
- # If the SOFTWARE_SINGLE_STEP_P failure happened, we have already
- # exited.
- # If we succeeded a continue will return from the handler to func2.
- # GDB now has `forgotten' that it intended to step over the
- # breakpoint at func2 and will stop at func2.
- setup_xfail "*-*-*"
- # The sun3 with a faulty bash will also be `forgetful' but it
- # already got the spurious stop at func2 and this continue will work.
- if {$bash_bug} then {
- clear_xfail "m68*-*-sunos4*"
- }
- gdb_test "continue" "Program exited with code 010\\." \
- "continue to exit in signals_tests_1 "
- }
-}
-
-# On a few losing systems, ptrace (PT_CONTINUE) or ptrace (PT_STEP)
-# causes pending signals to be cleared, which causes these tests to
-# get nowhere fast. This is totally losing behavior (perhaps there
-# are cases in which is it useful but the user needs more control,
-# which they mostly have in GDB), but some people apparently think it
-# is a feature. It is documented in the ptrace manpage on Motorola
-# Delta Series sysV68 R3V7.1 and on HPUX 9.0. Even the non-HPUX PA
-# OSes (BSD and OSF/1) seem to have figured they had to copy this
-# braindamage.
-
-if {[ istarget "m68*-motorola-*" ] || [ istarget "hppa*-*-bsd*" ] ||
- [ istarget "hppa*-*-osf*" ]} then {
- setup_xfail "*-*-*"
- fail "ptrace loses on signals on this target"
- return 0
-}
-
-# lynx2.2.2 doesn't lose signals, instead it screws up the stack pointer
-# in some of these tests leading to massive problems. I've
-# reported this to lynx, hopefully it'll be fixed in lynx2.3.
-# Severe braindamage.
-if [ istarget "*-*-*lynx*" ] then {
- setup_xfail "*-*-*"
- fail "kernel scroggs stack pointer in signal tests on this target"
- return 0
-}
-
gdb_exit
gdb_start
# This will need to be updated as the exact list of signals changes,
# but I want to test that TARGET_SIGNAL_0, TARGET_SIGNAL_DEFAULT, and
# TARGET_SIGNAL_UNKNOWN are skipped.
+
proc test_handle_all_print {} {
global timeout
# Increase timeout and expect input buffer for large output from gdb.
@@ -359,282 +75,202 @@ gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load $binfile
-signal_tests_1
-
-# Force a resync, so we're looking at the right prompt. On SCO we
-# were getting out of sync (I don't understand why).
-send_gdb "p 1+1\n"
-gdb_expect {
- -re "= 2.*$gdb_prompt $" {}
- -re ".*$gdb_prompt $" { perror "sync trouble in signals.exp" }
- default { perror "sync trouble in signals.exp" }
-}
if [runto_main] then {
- # Since count is a static variable outside main, runto_main
- # is no guarantee that count will be 0 at this point.
+
+ # Since count is a static variable outside main, runto_main is no
+ # guarantee that count will be 0 at this point.
+
gdb_test "set variable count = 0" ""
+
+ # Test an inferior function call that takes a signal that hits a
+ # breakpoint (with a false condition). When GDB tries to run the
+ # stack dummy, it will hit the breakpoint at handler. Provided it
+ # doesn't lose its cool, this is not a problem, it just has to
+ # note that the breakpoint condition is false and keep going.
+
+ # ...setup an always false conditional breakpoint
+
gdb_test "break handler if 0" "Breakpoint \[0-9\]+ .*"
gdb_test "set \$handler_breakpoint_number = \$bpnum" ""
- # Get to the point where a signal is waiting to be delivered
- gdb_test "next" "signal \\(SIGUSR1.*" "next to signal in signals.exp"
- gdb_test "next" "alarm \\(.*" "next to alarm #1 in signals.exp"
+ # ...setup the signal
+
+ gdb_test "next" "signal \\(SIGUSR1.*" "next to signal"
+ gdb_test "next" "alarm \\(.*" "next to alarm #1"
gdb_test "next" "\\+\\+count; /\\* first \\*/" \
- "next to ++count #1 in signals.exp"
- # Give the signal time to get delivered
+ "next to ++count #1"
sleep 2
- # Now call a function. When GDB tries to run the stack dummy,
- # it will hit the breakpoint at handler. Provided it doesn't
- # lose its cool, this is not a problem, it just has to note
- # that the breakpoint condition is false and keep going.
+ # ...call the function
gdb_test "p func1 ()" "^p func1 \\(\\)\r\n.\[0-9\]* = $void" \
- "p func1 () #1 in signals.exp"
+ "p func1 () #1"
+
+ # ...veryfiy that the cout was updated
- # Make sure the count got incremented.
+ gdb_test "p count" "= 2" "p count #1"
- # Haven't investigated this xfail
- setup_xfail "rs6000-*-*"
- setup_xfail "powerpc-*-*"
- gdb_test "p count" "= 2" "p count #1 in signals.exp"
- if { [istarget "rs6000-*-*"] || [istarget "powerpc-*-*"] } { return 0 }
+ # Now run the same test but with a breakpoint that does stop.
+
+ # ...set up the breakpoint and signal
gdb_test "condition \$handler_breakpoint_number" "now unconditional\\."
- gdb_test "next" "alarm \\(.*" "next to alarm #2 in signals.exp"
+ gdb_test "next" "alarm \\(.*" "next to alarm #2"
gdb_test "next" "\\+\\+count; /\\* second \\*/" \
- "next to ++count #2 in signals.exp"
+ "next to ++count #2"
sleep 2
- # This time we stop when GDB tries to run the stack dummy.
- # So it is OK that we do not print the return value from the function.
+ # ...call the function, which is immediatly interrupted
+
gdb_test "p func1 ()" \
"Breakpoint \[0-9\]*, handler.*
The program being debugged stopped while in a function called from GDB.*" \
- "p func1 () #2 in signals.exp"
- # But we should be able to backtrace...
- # On alpha-*-osf2.0 this test works when run manually but sometime fails when
- # run under dejagnu, making it very hard to debug the problem. Weird...
- gdb_test "bt 10" "#0.*handler.*#1.*signal handler.*#2.* main .*" "bt in signals.exp"
- # ...and continue...
- gdb_test "continue" "Continuing\\." "continue in signals.exp"
+ "p func1 () #2"
+
+ # ...verify the backtrace
+
+ gdb_test "backtrace" \
+ "#0 handler.*#1 .signal handler called.*#2 func1.*#3 .function called from gdb.*#4.*main.*" \
+ "backtrace from handler when calling func1"
+
+ # ...and continue (silently returning)
+
+ gdb_test "continue" "Continuing\\."
+
# ...and then count should have been incremented
- gdb_test "p count" "= 5" "p count #2 in signals.exp"
-
-
-# Verify that "info signals" produces reasonable output.
-#
- send_gdb "info signals\n"
- gdb_expect {
- -re "SIGHUP.*SIGINT.*SIGQUIT.*SIGILL.*SIGTRAP.*SIGABRT.*SIGEMT.*SIGFPE.*SIGKILL.*SIGBUS.*SIGSEGV.*SIGSYS.*SIGPIPE.*SIGALRM.*SIGTERM.*SIGURG.*SIGSTOP.*SIGTSTP.*SIGCONT.*SIGCHLD.*SIGTTIN.*SIGTTOU.*SIGIO.*SIGXCPU.*SIGXFSZ.*SIGVTALRM.*SIGPROF.*SIGWINCH.*SIGLOST.*SIGUSR1.*SIGUSR2.*SIGPWR.*SIGPOLL.*SIGWIND.*SIGPHONE.*SIGWAITING.*SIGLWP.*SIGDANGER.*SIGGRANT.*SIGRETRACT.*SIGMSG.*SIGSOUND.*SIGSAK.*SIGPRIO.*SIG33.*SIG34.*SIG35.*SIG36.*SIG37.*SIG38.*SIG39.*SIG40.*SIG41.*SIG42.*SIG43.*SIG44.*SIG45.*SIG46.*SIG47.*SIG48.*SIG49.*SIG50.*SIG51.*SIG52.*SIG53.*SIG54.*SIG55.*SIG56.*SIG57.*SIG58.*SIG59.*SIG60.*SIG61.*SIG62.*SIG63.*Use the \"handle\" command to change these tables.*$gdb_prompt $"\
- {pass "info signals"}
- -re "$gdb_prompt $"\
- {fail "info signals"}
- timeout {fail "(timeout) info signals"}
- }
-# Verify that "info signal" correctly handles an argument, be it a
-# symbolic signal name, or an integer ID.
-#
- send_gdb "info signal SIGTRAP\n"
- gdb_expect {
- -re ".*SIGTRAP\[ \t\]*Yes\[ \t\]*Yes\[ \t\]*No\[ \t\]*Trace/breakpoint trap.*$gdb_prompt $"\
- {pass "info signal SIGTRAP"}
- -re "$gdb_prompt $"\
- {fail "info signal SIGTRAP"}
- timeout {fail "(timeout) info signal SIGTRAP"}
- }
+ gdb_test "p count" "= 5" "p count #2"
- send_gdb "info signal 5\n"
- gdb_expect {
- -re ".*SIGTRAP\[ \t\]*Yes\[ \t\]*Yes\[ \t\]*No\[ \t\]*Trace/breakpoint trap.*$gdb_prompt $"\
- {pass "info signal 5"}
- -re "$gdb_prompt $"\
- {fail "info signal 5"}
- timeout {fail "(timeout) info signal 5"}
- }
-# Verify that "handle" with illegal arguments is gracefully, um, handled.
-#
- send_gdb "handle\n"
- gdb_expect {
- -re "Argument required .signal to handle.*$gdb_prompt $"\
- {pass "handle without arguments"}
- -re "$gdb_prompt $"\
- {fail "handle without arguments"}
- timeout {fail "(timeout) handle without arguments"}
- }
+ # Verify that "info signals" produces reasonable output.
- send_gdb "handle SIGFOO\n"
- gdb_expect {
- -re "Unrecognized or ambiguous flag word: \"SIGFOO\".*$gdb_prompt $"\
- {pass "handle with bogus SIG"}
- -re "$gdb_prompt $"\
- {fail "handle with bogus SIG"}
- timeout {fail "(timeout) handle with bogus SIG"}
- }
+ gdb_test "info signals" "SIGHUP.*SIGINT.*SIGQUIT.*SIGILL.*SIGTRAP.*SIGABRT.*SIGEMT.*SIGFPE.*SIGKILL.*SIGBUS.*SIGSEGV.*SIGSYS.*SIGPIPE.*SIGALRM.*SIGTERM.*SIGURG.*SIGSTOP.*SIGTSTP.*SIGCONT.*SIGCHLD.*SIGTTIN.*SIGTTOU.*SIGIO.*SIGXCPU.*SIGXFSZ.*SIGVTALRM.*SIGPROF.*SIGWINCH.*SIGLOST.*SIGUSR1.*SIGUSR2.*SIGPWR.*SIGPOLL.*SIGWIND.*SIGPHONE.*SIGWAITING.*SIGLWP.*SIGDANGER.*SIGGRANT.*SIGRETRACT.*SIGMSG.*SIGSOUND.*SIGSAK.*SIGPRIO.*SIG33.*SIG34.*SIG35.*SIG36.*SIG37.*SIG38.*SIG39.*SIG40.*SIG41.*SIG42.*SIG43.*SIG44.*SIG45.*SIG46.*SIG47.*SIG48.*SIG49.*SIG50.*SIG51.*SIG52.*SIG53.*SIG54.*SIG55.*SIG56.*SIG57.*SIG58.*SIG59.*SIG60.*SIG61.*SIG62.*SIG63.*Use the \"handle\" command to change these tables.*" \
+ "info signals"
- send_gdb "handle SIGHUP frump\n"
- gdb_expect {
- -re "Unrecognized or ambiguous flag word: \"frump\".*$gdb_prompt $"\
- {pass "handle SIG with bogus action"}
- -re "$gdb_prompt $"\
- {fail "handle SIG with bogus action"}
- timeout {fail "(timeout) handle SIG with bogus action"}
- }
+ # Verify that "info signal" correctly handles an argument, be it a
+ # symbolic signal name, or an integer ID.
-# Verify that "handle" can take multiple actions per SIG, and that in
-# the case of conflicting actions, that the rightmost action "wins".
-#
- send_gdb "handle SIGHUP print noprint\n"
- gdb_expect {
- -re ".*SIGHUP\[ \t\]*No\[ \t\]*No\[ \t\]*Yes\[ \t\]*Hangup.*$gdb_prompt $"\
- {pass "handle SIG with multiple conflicting actions"}
- -re "$gdb_prompt $"\
- {fail "handle SIG with multiple conflicting actions"}
- timeout {fail "(timeout) handle SIG with multiple conflicting actions"}
- }
+ gdb_test "info signal SIGTRAP" \
+ "SIGTRAP\[ \t\]*Yes\[ \t\]*Yes\[ \t\]*No\[ \t\]*Trace/breakpoint trap.*" \
+ "info signal SIGTRAP"
-# Exercise all the various actions. (We don't care what the outcome
-# is, this is just to ensure that they all can be parsed.)
-#
- send_gdb "handle SIGHUP print noprint stop nostop ignore noignore pass nopass\n"
- gdb_expect {
- -re ".*Signal.*$gdb_prompt $"\
- {pass "handle SIG parses all legal actions"}
- -re "$gdb_prompt $"\
- {fail "handle SIG parses all legal actions"}
- timeout {fail "(timeout) handle SIG parses all legal actions"}
- }
+ gdb_test "info signal 5" \
+ "SIGTRAP\[ \t\]*Yes\[ \t\]*Yes\[ \t\]*No\[ \t\]*Trace/breakpoint trap.*" \
+ "info signal 5"
-# Verify that we can "handle" multiple signals at once, interspersed
-# with actions.
-#
- send_gdb "handle SIG63 print SIGILL\n"
- gdb_expect {
- -re ".*SIGILL\[ \t\]*Yes\[ \t\]*Yes\[ \t\]*Yes\[ \t\]*Illegal instruction.*SIG63\[ \t\]*Yes\[ \t\]*Yes\[ \t\]*Yes\[ \t\]*Real-time event 63.*$gdb_prompt $"\
- {pass "handle multiple SIGs"}
- -re "$gdb_prompt $"\
- {fail "handle multiple SIGs"}
- timeout {fail "(timeout) handle multiple SIGs"}
- }
+ # Verify that "handle" with illegal arguments is gracefully, um,
+ # handled.
-# Verify that "handle" can take a numeric argument for the signal ID,
-# rather than a symbolic name. (This may not be portable; works for
-# HP-UX.)
-#
-# Also note that this testpoint overrides SIGTRAP, which on HP-UX at
-# least, is used to implement single-steps and breakpoints. Don't
-# expect to run the inferior after this!
-#
- send_gdb "handle 5 nopass\n"
- gdb_expect {
- -re ".*SIGTRAP is used by the debugger.*Are you sure you want to change it.*y or n.*"\
- {send_gdb "y\n"
- gdb_expect {
- -re ".*SIGTRAP\[ \t\]*Yes\[ \t\]*Yes\[ \t\]*No\[ \t\]*Trace/breakpoint trap.*$gdb_prompt $"\
- {pass "override SIGTRAP (#5)"}
- -re "$gdb_prompt $"\
- {fail "override SIGTRAP (#5)"}
- timeout {fail "(timeout) override SIGTRAP (#5)"}
- }
- }
- -re "$gdb_prompt $"\
- {fail "override SIGTRAP (#5)"}
- timeout {fail "(timeout) override SIGTRAP (#5)"}
- }
+ gdb_test "handle" \
+ "Argument required .signal to handle.*" \
+ "handle without arguments"
-# GDB doesn't seem to allow numeric signal IDs larger than 15. Verify
-# that restriction. ??rehrauer: Not sure if this is a feature or a
-# bug, actually. Why is the range 1-15?
-#
- send_gdb "handle 58\n"
- gdb_expect {
- -re "Only signals 1-15 are valid as numeric signals.*Use \"info signals\" for a list of symbolic signals.*$gdb_prompt $"\
- {pass "invalid signal number rejected"}
- -re "$gdb_prompt $"\
- {fail "invalid signal number rejected"}
- timeout {fail "(timeout) invalid signal number rejected"}
- }
+ gdb_test "handle SIGFOO" \
+ "Unrecognized or ambiguous flag word: \"SIGFOO\".*" \
+ "handle with bogus SIG"
-# Verify that we can accept a signal ID range (number-number).
-# ??rehrauer: This feature isn't documented on the quick-reference
-# card.
-#
- send_gdb "handle 13-15\n"
- gdb_expect {
- -re ".*SIGPIPE.*SIGALRM.*SIGTERM.*$gdb_prompt $"\
- {pass "handle multiple SIGs via integer range"}
- -re "$gdb_prompt $"\
- {fail "handle multiple SIGs via integer range"}
- timeout {fail "(timeout) handle multiple SIGs via integer range"}
+ gdb_test "handle SIGHUP frump" \
+ "Unrecognized or ambiguous flag word: \"frump\".*" \
+ "handle SIG with bogus action"
- }
+ # Verify that "handle" can take multiple actions per SIG, and that
+ # in the case of conflicting actions, that the rightmost action
+ # "wins".
-# Bizarrely enough, GDB also allows you to reverse the range
-# stat, stop IDs. E.g., "3-1" and "1-3" mean the same thing.
-# Probably this isn't documented, but the code anticipates it,
-# so we'd best test it...
-#
- send_gdb "handle 15-13\n"
- gdb_expect {
- -re ".*SIGPIPE.*SIGALRM.*SIGTERM.*$gdb_prompt $"\
- {pass "handle multiple SIGs via integer range"}
- -re "$gdb_prompt $"\
- {fail "handle multiple SIGs via integer range"}
- timeout {fail "(timeout) handle multiple SIGs via integer range"}
+ gdb_test "handle SIGHUP print noprint" \
+ "SIGHUP\[ \t\]*No\[ \t\]*No\[ \t\]*Yes\[ \t\]*Hangup.*" \
+ "handle SIG with multiple conflicting actions"
- }
+ # Exercise all the various actions. (We don't care what the
+ # outcome is, this is just to ensure that they all can be parsed.)
-# SIGINT is used by the debugger as well. Verify that we can change
-# our minds about changing it.
-#
- send_gdb "handle SIGINT nopass\n"
- gdb_expect {
- -re ".*SIGINT is used by the debugger.*Are you sure you want to change it.*y or n.*"\
- {send_gdb "n\n"
-# ??rehrauer: When you answer "n", the header for the signal info is
-# printed, but not the actual handler settings. Probably a bug.
-#
- gdb_expect {
- -re "Not confirmed, unchanged.*Signal.*$gdb_prompt $"\
- {pass "override SIGINT"}
- -re "$gdb_prompt $"\
- {fail "override SIGINT"}
- timeout {fail "(timeout) override SIGINT"}
- }
- }
- -re "$gdb_prompt $"\
- {fail "override SIGINT"}
- timeout {fail "(timeout) override SIGINT"}
- }
+ gdb_test "handle SIGHUP print noprint stop nostop ignore noignore pass nopass" \
+ "Signal.*" \
+ "handle SIG parses all legal actions"
+
+ # Verify that we can "handle" multiple signals at once,
+ # interspersed with actions.
+
+ gdb_test "handle SIG63 print SIGILL" \
+ "SIGILL\[ \t\]*Yes\[ \t\]*Yes\[ \t\]*Yes\[ \t\]*Illegal instruction.*SIG63\[ \t\]*Yes\[ \t\]*Yes\[ \t\]*Yes\[ \t\]*Real-time event 63.*" \
+ "handle multiple SIGs"
+
+ # Verify that "handle" can take a numeric argument for the signal
+ # ID, rather than a symbolic name. (This may not be portable;
+ # works for HP-UX.)
-# Verify that GDB responds gracefully to the "signal" command with
-# a missing argument.
-#
- send_gdb "signal\n"
- gdb_expect {
- -re "Argument required .signal number..*$gdb_prompt $"\
- {pass "signal without arguments disallowed"}
- -re "$gdb_prompt $"\
- {fail "signal without arguments disallowed"}
- timeout {fail "(timeout) signal without arguments disallowed"}
+ # Also note that this testpoint overrides SIGTRAP, which on HP-UX
+ # at least, is used to implement single-steps and breakpoints.
+ # Don't expect to run the inferior after this!
+
+ set test "override SIGTRAP"
+ gdb_test_multiple "handle 5 nopass" "$test" {
+ -re "SIGTRAP is used by the debugger.*Are you sure you want to change it.*y or n.*" {
+ gdb_test "y" \
+ "SIGTRAP\[ \t\]*Yes\[ \t\]*Yes\[ \t\]*No\[ \t\]*Trace/breakpoint trap.*" \
+ "$test"
+ }
}
-# Verify that we can successfully send a signal other than 0 to
-# the inferior. (This probably causes the inferior to run away.
-# Be prepared to rerun to main for further testing.)
-#
- send_gdb "signal 5\n"
- gdb_expect {
- -re "Continuing with signal SIGTRAP.*$gdb_prompt $"\
- {pass "sent signal 5"}
- -re "$gdb_prompt $"\
- {fail "sent signal 5"}
- timeout {fail "(timeout) sent signal 5"}
+ # GDB doesn't seem to allow numeric signal IDs larger than 15. Verify
+ # that restriction. ??rehrauer: Not sure if this is a feature or a
+ # bug, actually. Why is the range 1-15?
+
+ gdb_test "handle 58" \
+ "Only signals 1-15 are valid as numeric signals.*Use \"info signals\" for a list of symbolic signals.*" \
+ "invalid signal number rejected"
+
+ # Verify that we can accept a signal ID range (number-number).
+ # ??rehrauer: This feature isn't documented on the quick-reference
+ # card.
+
+ gdb_test "handle 13-15" \
+ "SIGPIPE.*SIGALRM.*SIGTERM.*" \
+ "handle multiple SIGs via integer range"
+
+ # Bizarrely enough, GDB also allows you to reverse the range stat,
+ # stop IDs. E.g., "3-1" and "1-3" mean the same thing. Probably
+ # this isn't documented, but the code anticipates it, so we'd best
+ # test it...
+
+ gdb_test "handle 15-13" \
+ "SIGPIPE.*SIGALRM.*SIGTERM.*" \
+ "handle multiple SIGs via reverse integer range"
+
+ # SIGINT is used by the debugger as well. Verify that we can
+ # change our minds about changing it.
+
+ set test "override SIGINT"
+ gdb_test_multiple "handle SIGINT nopass" "$test" {
+ -re "SIGINT is used by the debugger.*Are you sure you want to change it.*y or n.*" {
+ gdb_test_multiple "n" "$test" {
+ -re "Not confirmed, unchanged.*Signal.*$gdb_prompt $" {
+ # "Signal ..." should not be in the output.
+ kfail gdb/1707 "$test"
+ }
+ -re "Not confirmed, unchanged.*$gdb_prompt $" {
+ pass "$test"
+ }
+ }
+ }
}
+ # Verify that GDB responds gracefully to the "signal" command with
+ # a missing argument.
+
+ gdb_test "signal" \
+ "Argument required .signal number..*" \
+ "signal without arguments disallowed"
+
+ # Verify that we can successfully send a signal other than 0 to
+ # the inferior. (This probably causes the inferior to run away.
+ # Be prepared to rerun to main for further testing.)
+
+ gdb_test "signal SIGUSR1" "Breakpoint.*handler.*"
+ gdb_test "bt" \
+ "#0 handler .*#1 .signal handler called.*\#2 .*main.*" \
+ "backtrace for SIGUSR1"
}
return 0
diff --git a/gdb/testsuite/gdb.base/signull.c b/gdb/testsuite/gdb.base/signull.c
new file mode 100644
index 00000000000..4139d14640e
--- /dev/null
+++ b/gdb/testsuite/gdb.base/signull.c
@@ -0,0 +1,88 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 1996, 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
+ 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 <signal.h>
+#include <setjmp.h>
+#include <stdlib.h>
+#include <string.h>
+
+enum tests {
+ code_entry_point, code_descriptor, data_read, data_write
+};
+
+static volatile enum tests test;
+
+/* Some basic types and zero buffers. */
+
+typedef long data_t;
+typedef long code_t (void);
+data_t *volatile data;
+code_t *volatile code;
+/* "desc" is intentionally initialized to a data object. This is
+ needed to test function descriptors on arches like ia64. */
+data_t zero[10];
+code_t *volatile desc = (code_t *) (void *) zero;
+
+sigjmp_buf env;
+
+extern void
+keeper (int sig)
+{
+ siglongjmp (env, 0);
+}
+
+extern long
+bowler (void)
+{
+ switch (test)
+ {
+ case data_read:
+ /* Try to read address zero. */
+ return (*data);
+ case data_write:
+ /* Try to write (the assignment) to address zero. */
+ return (*data) = 1;
+ case code_entry_point:
+ /* For typical architectures, call a function at address
+ zero. */
+ return (*code) ();
+ case code_descriptor:
+ /* For atypical architectures that use function descriptors,
+ call a function descriptor, the code field of which is zero
+ (which has the effect of jumping to address zero). */
+ return (*desc) ();
+ }
+}
+
+int
+main ()
+{
+ static volatile int i;
+
+ struct sigaction act;
+ memset (&act, 0, sizeof act);
+ act.sa_handler = keeper;
+ sigaction (SIGSEGV, &act, NULL);
+
+ for (i = 0; i < 10; i++)
+ {
+ sigsetjmp (env, 1);
+ bowler ();
+ }
+}
diff --git a/gdb/testsuite/gdb.base/signull.exp b/gdb/testsuite/gdb.base/signull.exp
new file mode 100644
index 00000000000..59b1a5647e6
--- /dev/null
+++ b/gdb/testsuite/gdb.base/signull.exp
@@ -0,0 +1,122 @@
+# 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.
+
+# Check that GDB can trigger and backtrace SIGSEGV signal stacks
+# caused by both accessing (data) and executing (code) at address
+# zero.
+
+# On function descriptor architectures, a zero descriptor, instead of
+# a NULL pointer, is used. That way the NULL code test always
+# contains a zero code reference.
+
+# For recovery, sigjmp/longjmp are used.
+
+# This also tests backtrace/gdb1476.
+
+if $tracelevel {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+set testfile "signull"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+ 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}
+
+#
+# Run to `main' where we begin our tests.
+#
+
+if ![runto_main] then {
+ gdb_suppress_tests
+}
+
+# If we can examine what's at memory address 0, it is possible that we
+# could also execute it. This could probably make us run away,
+# executing random code, which could have all sorts of ill effects,
+# especially on targets without an MMU. Don't run the tests in that
+# case.
+
+send_gdb "x 0\n"
+gdb_expect {
+ -re "0x0:.*Cannot access memory at address 0x0.*$gdb_prompt $" { }
+ -re "0x0:.*Error accessing memory address 0x0.*$gdb_prompt $" { }
+ -re ".*$gdb_prompt $" {
+ untested "Memory at address 0 is possibly executable"
+ return
+ }
+}
+
+# If an attempt to call a NULL pointer leaves the inferior in main,
+# then function pointers are descriptors, probe this and remember the
+# result.
+
+gdb_test "set test = code_entry_point" "" "set for function pointer probe"
+set test "probe function pointer"
+set function_pointer code_entry_point
+gdb_test_multiple "continue" "$test" {
+ -re "Program received signal SIGSEGV.*bowler .*$gdb_prompt $" {
+ set function_pointer code_descriptor
+ pass "$test (function descriptor)"
+ }
+ -re "Program received signal SIGSEGV.*0.*$gdb_prompt $" {
+ pass "$test (function entry-point)"
+ }
+}
+
+# Re-start from scratch, breakpoint the bowler so that control is
+# regained after each test, and run up to that.
+rerun_to_main
+gdb_test "break bowler"
+gdb_test "break keeper"
+# By default Stop:Yes Print:Yes Pass:Yes
+gdb_test "handle SIGSEGV" "SIGSEGV.*Yes.*Yes.*Yes.*Segmentation fault"
+
+# For the given signal type, check that: the SIGSEGV occures; a
+# backtrace from the SEGV works; the sigsegv is delivered; a backtrace
+# through the SEGV works.
+
+proc test_segv { name tag bt_from_segv bt_from_keeper } {
+ gdb_test continue "Breakpoint.* bowler.*" "${name}; start with the bowler"
+ # NB: Don't use $tag in the testname - changes across systems.
+ gdb_test "set test = $tag" "" "${name}; select the pointer type"
+ gdb_test continue "Program received signal SIGSEGV.*" \
+ "${name}; take the SIGSEGV"
+ gdb_test backtrace $bt_from_segv "${name}; backtrace from SIGSEGV"
+ gdb_test continue "Breakpoint.* keeper.*" "${name}; continue to the keeper"
+ gdb_test backtrace $bt_from_keeper "${name}; backtrace from keeper through SIGSEGV"
+}
+
+test_segv "data read" data_read \
+ {#0 .* bowler .*#1 .* main .*} \
+ {#0 .* keeper .*#1 .* handler .*#2 .* bowler .*#3 .* main .*}
+test_segv "data write" data_write \
+ {#0 .* bowler .*#1 .* main .*} \
+ {#0 .* keeper .*#1 .* handler .*#2 .* bowler .*#3 .* main .*}
+test_segv code $function_pointer \
+ {#0 .* 0x0+ .*#1 .* bowler .*#2 .* main .*} \
+ {#0 .* keeper .*#1 .* handler .*#2 .* 0x0+ .*#3 .* bowler .*#4 .* main .*}
diff --git a/gdb/testsuite/gdb.base/sigstep.c b/gdb/testsuite/gdb.base/sigstep.c
new file mode 100644
index 00000000000..0f0d8b7a4f0
--- /dev/null
+++ b/gdb/testsuite/gdb.base/sigstep.c
@@ -0,0 +1,68 @@
+/* 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 <string.h>
+#include <signal.h>
+#include <sys/time.h>
+
+static volatile int done;
+
+static void
+handler (int sig)
+{
+ done = 1;
+} /* handler */
+
+struct itimerval itime;
+struct sigaction action;
+
+/* The enum is so that GDB can easily see these macro values. */
+enum {
+ itimer_real = ITIMER_REAL,
+ itimer_virtual = ITIMER_VIRTUAL
+} itimer = ITIMER_VIRTUAL;
+
+main ()
+{
+
+ /* Set up the signal handler. */
+ memset (&action, 0, sizeof (action));
+ action.sa_handler = handler;
+ sigaction (SIGVTALRM, &action, NULL);
+ sigaction (SIGALRM, &action, NULL);
+
+ /* The values needed for the itimer. This needs to be at least long
+ enough for the setitimer() call to return. */
+ memset (&itime, 0, sizeof (itime));
+ itime.it_value.tv_usec = 250 * 1000;
+
+ /* Loop for ever, constantly taking an interrupt. */
+ while (1)
+ {
+ /* Set up a one-off timer. A timer, rather than SIGSEGV, is
+ used as after a timer handler finishes the interrupted code
+ can safely resume. */
+ setitimer (itimer, &itime, NULL);
+ /* Wait. */
+ while (!done);
+ done = 0;
+ }
+}
diff --git a/gdb/testsuite/gdb.base/sigstep.exp b/gdb/testsuite/gdb.base/sigstep.exp
new file mode 100644
index 00000000000..55de44520f8
--- /dev/null
+++ b/gdb/testsuite/gdb.base/sigstep.exp
@@ -0,0 +1,423 @@
+# 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.
+
+
+# The program sigstep.c creates a very simple backtrace containing one
+# signal handler and signal trampoline. A flag is set and then the
+# handler returns. This is repeated at infinitum.
+
+# This test runs the program up to the signal handler, and then
+# attempts to step/next out of the handler and back into main.
+
+if [target_info exists gdb,nosignals] {
+ verbose "Skipping sigstep.exp because of nosignals."
+ continue
+}
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+set testfile sigstep
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+ untested "Couldn't compile ${module}.c"
+ return -1
+}
+
+# get things started
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+gdb_test "display/i \$pc"
+
+# Advance to main
+if { ![runto_main] } then {
+ gdb_suppress_tests;
+}
+
+# Pass all the alarms straight through (but verbosely)
+# gdb_test "handle SIGALRM print pass nostop"
+# gdb_test "handle SIGVTALRM print pass nostop"
+# gdb_test "handle SIGPROF print pass nostop"
+
+# Run to the signal handler, validate the backtrace.
+gdb_test "break handler"
+gdb_test "continue" ".* handler .*" "continue to stepi handler"
+send_gdb "bt\n"
+gdb_expect_list "backtrace for nexti" ".*$gdb_prompt $" {
+ "\[\r\n\]+.0 \[^\r\n\]* handler "
+ "\[\r\n\]+.1 .signal handler called."
+ "\[\r\n\]+.2 \[^\r\n\]* main .*"
+}
+
+proc advance { i } {
+ global gdb_prompt
+ set prefix "$i from handler"
+
+ # Get us back into the handler
+ gdb_test "continue" ".* handler .*" "$prefix; continue to handler"
+
+ set test "$prefix; leave handler"
+ gdb_test_multiple "$i" "${test}" {
+ -re "done = 1;.*${gdb_prompt} $" {
+ send_gdb "$i\n"
+ exp_continue -continue_timer
+ }
+ -re "\} .. handler .*${gdb_prompt} $" {
+ send_gdb "$i\n"
+ exp_continue -continue_timer
+ }
+ -re "Program exited normally.*${gdb_prompt} $" {
+ setup_kfail powerpc-*-*bsd* gdb/1639
+ fail "$test (program exited)"
+ }
+ -re "(while ..done|done = 0).*${gdb_prompt} $" {
+ # After stepping out of a function /r signal-handler, GDB will
+ # advance the inferior until it is at the first instruction of
+ # a code-line. While typically things return to the middle of
+ # the "while..." (and hence GDB advances the inferior to the
+ # "return..." line) it is also possible for the return to land
+ # on the first instruction of "while...". Accept both cases.
+ pass "$test"
+ }
+ }
+}
+
+proc advancei { i } {
+ global gdb_prompt
+ set prefix "$i from handleri"
+ set program_exited 0
+
+ # Get us back into the handler
+ gdb_test "continue" ".* handler .*" "$prefix; continue to handler"
+
+ set test "$prefix; leave handler"
+ gdb_test_multiple "$i" "${test}" {
+ -re "Cannot insert breakpoint 0.*${gdb_prompt} $" {
+ # Some platforms use a special read-only page for signal
+ # trampolines. We can't set a breakpoint there, and we
+ # don't gracefully fall back to single-stepping.
+ setup_kfail "i?86-*-linux*" gdb/1736
+ fail "$test (could not set breakpoint)"
+ return
+ }
+ -re "done = 1;.*${gdb_prompt} $" {
+ send_gdb "$i\n"
+ exp_continue -continue_timer
+ }
+ -re "\} .. handler .*${gdb_prompt} $" {
+ send_gdb "$i\n"
+ exp_continue -continue_timer
+ }
+ -re "signal handler called.*${gdb_prompt} $" {
+ pass "$test"
+ }
+ -re "main .*${gdb_prompt} $" {
+ fail "$test (in main)"
+ }
+ -re "Program exited normally.*${gdb_prompt} $" {
+ fail "$test (program exited)"
+ set program_exited 1
+ }
+ -re "Make handler return now.*y or n. $" {
+ send_gdb "y\n"
+ exp_continue -continue_timer
+ }
+ }
+
+ set test "$prefix; leave signal trampoline"
+ gdb_test_multiple "$i" "${test}" {
+ -re "while .*${gdb_prompt} $" {
+ pass "$test (in main)"
+ }
+ -re "signal handler called.*${gdb_prompt} $" {
+ send_gdb "$i\n"
+ exp_continue -continue_timer
+ }
+ -re "return .*${gdb_prompt} $" {
+ fail "$test (stepped)"
+ }
+ -re "Make .*frame return now.*y or n. $" {
+ send_gdb "y\n"
+ exp_continue -continue_timer
+ }
+ -re "Program exited normally.*${gdb_prompt} $" {
+ kfail gdb/1639 "$test (program exited)"
+ set program_exited 1
+ }
+ -re "The program is not being run.*${gdb_prompt} $" {
+ if { $program_exited } {
+ # Previously kfailed with an exit
+ pass "$test (the program is not being run)"
+ } else {
+ fail "$test (the program is not being run)"
+ }
+ }
+ }
+}
+
+# Check that we can step/next our way out of a signal handler.
+
+advance step
+advancei stepi
+
+advance next
+advancei nexti
+
+advancei finish
+advancei return
+gdb_test "set done = 1" "" "Set done as return will have skipped it"
+
+
+# Check that we can step/next our way into / over a signal handler.
+
+# There are at least the following cases: breakpoint @pc VS breakpoint
+# in handler VS step / next / continue.
+
+# Use the real-time itimer, as otherwize the process never gets enough
+# time to expire the timer.
+
+delete_breakpoints
+set infinite_loop [gdb_get_line_number {while (!done)}]
+gdb_test "set itimer = itimer_real"
+gdb_test "break [gdb_get_line_number {done = 0}]"
+
+# Try stepping when there's a signal pending, and a breakpoint at the
+# handler. Should step into the signal handler.
+
+proc skip_to_handler { i } {
+ global gdb_prompt
+ global infinite_loop
+ set prefix "$i to handler"
+
+ # Run around to the done
+ set test "$prefix; resync"
+ gdb_test_multiple "continue" "$test" {
+ -re "done = 0.*$gdb_prompt " {
+ pass "$test"
+ }
+ # other patterns can go here
+ }
+
+ # Advance to the infinite loop
+ gdb_test "advance $infinite_loop" "" "$prefix; advance to infinite loop"
+
+ # Make the signal pending
+ sleep 1
+
+ # Insert / remove the handler breakpoint.
+ gdb_test "break handler" "" "$prefix; break handler"
+ gdb_test "$i" " handler .*" "$prefix; performing $i"
+ gdb_test "clear handler" "" "$prefix; clear handler"
+}
+
+skip_to_handler step
+skip_to_handler next
+skip_to_handler continue
+
+# Try stepping when there's a signal pending, and a breakpoint at the
+# handler's entry-point. Should step into the signal handler stopping
+# at the entry-point.
+
+# Some systems (e.x., GNU/Linux as of 2004-08-30), when delivering a
+# signal, resume the process at the first instruction of the signal
+# handler and not the first instruction of the signal trampoline. The
+# stack is constructed such that the signal handler still appears to
+# have been called by the trampoline code. This test checks that it
+# is possible to stop the inferior, even at that first instruction.
+
+proc skip_to_handler_entry { i } {
+ global gdb_prompt
+ global infinite_loop
+ set prefix "$i to handler entry"
+
+ # Run around to the done
+ set test "$prefix; resync"
+ gdb_test_multiple "continue" "$test" {
+ -re "done = 0.*$gdb_prompt " {
+ pass "$test"
+ }
+ # other patterns can go here
+ }
+
+ # Advance to the infinite loop
+ gdb_test "advance $infinite_loop" "" "$prefix; advance to infinite loop"
+
+ # Make the signal pending
+ sleep 1
+
+ # Insert / remove the handler breakpoint.
+ gdb_test "break *handler" "" "$prefix; break handler"
+ gdb_test "$i" " handler .*" "$prefix; performing $i"
+ gdb_test "clear *handler" "" "$prefix; clear handler"
+}
+
+skip_to_handler_entry step
+skip_to_handler_entry next
+skip_to_handler_entry continue
+
+# Try stepping when there's a signal pending but no breakpoints.
+# Should skip the handler advancing to the next line.
+
+proc skip_over_handler { i } {
+ global gdb_prompt
+ global infinite_loop
+ set prefix "$i over handler"
+
+ # Run around to the done
+ set test "$prefix; resync"
+ gdb_test_multiple "continue" "$test" {
+ -re "done = 0.*$gdb_prompt " {
+ pass "$test"
+ }
+ # other patterns can go here
+ }
+
+ # Advance to the infinite loop
+ gdb_test "advance $infinite_loop" "" "$prefix; advance to infinite loop"
+
+ # Make the signal pending
+ sleep 1
+
+ gdb_test "$i" "done = 0.*" "$prefix; performing $i"
+}
+
+skip_over_handler step
+skip_over_handler next
+skip_over_handler continue
+
+# Try stepping when there's a signal pending, a pre-existing
+# breakpoint at the current instruction, and a breakpoint in the
+# handler. Should advance to the signal handler.
+
+proc breakpoint_to_handler { i } {
+ global gdb_prompt
+ global infinite_loop
+ set prefix "$i on breakpoint, to handler"
+
+ # Run around to the done
+ set test "$prefix; resync"
+ gdb_test_multiple "continue" "$test" {
+ -re "done = 0.*$gdb_prompt " {
+ pass "$test"
+ }
+ # other patterns can go here
+ }
+
+ gdb_test "break $infinite_loop" "" "$prefix; break infinite loop"
+ gdb_test "break handler" "" "$prefix; break handler"
+
+ # Continue to the infinite loop
+ gdb_test "continue" "while ..done.*" "$prefix; continue to infinite loop"
+
+ # Make the signal pending
+ sleep 1
+
+ setup_kfail "i*86-*-*" gdb/1738
+ gdb_test "$i" " handler .*" "$prefix; performing $i"
+ gdb_test "clear $infinite_loop" "" "$prefix; clear infinite loop"
+ gdb_test "clear handler" "" "$prefix; clear handler"
+}
+
+breakpoint_to_handler step
+breakpoint_to_handler next
+breakpoint_to_handler continue
+
+# Try stepping when there's a signal pending, and a breakpoint at the
+# handler's entry instruction and a breakpoint at the current
+# instruction. Should step into the signal handler and breakpoint at
+# that entry instruction.
+
+# Some systems (e.x., GNU/Linux as of 2004-08-30), when delivering a
+# signal, resume the process at the first instruction of the signal
+# handler and not the first instruction of the signal trampoline. The
+# stack is constructed such that the signal handler still appears to
+# have been called by the trampoline code. This test checks that it
+# is possible to stop the inferior, even at that first instruction.
+
+proc breakpoint_to_handler_entry { i } {
+ global gdb_prompt
+ global infinite_loop
+ set prefix "$i on breakpoint, to handler entry"
+
+ # Run around to the done
+ set test "$prefix; resync"
+ gdb_test_multiple "continue" "$test" {
+ -re "done = 0.*$gdb_prompt " {
+ pass "$test"
+ }
+ # other patterns can go here
+ }
+
+ gdb_test "break $infinite_loop" "" "$prefix; break infinite loop"
+ gdb_test "break *handler" "" "$prefix; break handler"
+
+ # Continue to the infinite loop
+ gdb_test "continue" "while ..done.*" "$prefix; continue to infinite loop"
+
+ # Make the signal pending
+ sleep 1
+
+ setup_kfail "i*86-*-*" gdb/1738
+ gdb_test "$i" " handler .*" "$prefix; performing $i"
+ gdb_test "clear $infinite_loop" "" "$prefix; clear infinite loop"
+ gdb_test "clear *handler" "" "$prefix; clear handler"
+}
+
+breakpoint_to_handler_entry step
+breakpoint_to_handler_entry next
+breakpoint_to_handler_entry continue
+
+# Try stepping when there's a signal pending, and a pre-existing
+# breakpoint at the current instruction, and no breakpoint in the
+# handler. Should advance to the next line.
+
+proc breakpoint_over_handler { i } {
+ global gdb_prompt
+ global infinite_loop
+ set prefix "$i on breakpoint, skip handler"
+
+ # Run around to the done
+ set test "$prefix; resync"
+ gdb_test_multiple "continue" "$test" {
+ -re "done = 0.*$gdb_prompt " {
+ pass "$test"
+ }
+ # other patterns can go here
+ }
+
+ gdb_test "break $infinite_loop" "" "$prefix; break infinite loop"
+
+ # Continue to the infinite loop
+ gdb_test "continue" "while ..done.*" "$prefix; continue to infinite loop"
+
+ # Make the signal pending
+ sleep 1
+
+ gdb_test "$i" "done = 0.*" "$prefix; performing $i"
+ gdb_test "clear $infinite_loop" "" "$prefix; clear infinite loop"
+}
+
+breakpoint_over_handler step
+breakpoint_over_handler next
+breakpoint_over_handler continue
diff --git a/gdb/testsuite/gdb.base/sizeof.exp b/gdb/testsuite/gdb.base/sizeof.exp
index 7fcbe0e37e7..b10ffbc13e8 100644
--- a/gdb/testsuite/gdb.base/sizeof.exp
+++ b/gdb/testsuite/gdb.base/sizeof.exp
@@ -1,4 +1,6 @@
-# Copyright 2000, 2002 Free Software Foundation, Inc.
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 2000, 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,8 +16,10 @@
# 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 [target_info exists gdb,noinferiorio] {
+ verbose "Skipping fileio.exp because of no fileio capabilities."
+ continue
+}
if $tracelevel {
strace $tracelevel
@@ -58,15 +62,13 @@ if ![runto_main] then {
proc get_valueof { fmt exp default } {
global gdb_prompt
- send_gdb "print${fmt} ${exp}\n"
- gdb_expect {
+
+ set test "get valueof \"${exp}\""
+ set val ${default}
+ gdb_test_multiple "print${fmt} ${exp}" "$test" {
-re "\\$\[0-9\]* = (\[-\]*\[0-9\]*).*$gdb_prompt $" {
set val $expect_out(1,string)
- pass "get value of ${exp} ($val)"
- }
- timeout {
- set size ${default}
- fail "get value of ${exp} (timeout)"
+ pass "$test ($val)"
}
}
return ${val}
@@ -98,23 +100,8 @@ set sizeof_long_double [get_sizeof "long double" 8]
proc check_sizeof { type size } {
global gdb_prompt
- if [gdb_skip_stdio_test "check sizeof $type == $size"] {
- return;
- }
-
set pat [string_to_regexp "sizeof (${type}) == ${size}"]
- send_gdb "next\n"
- gdb_expect {
- -re "${pat}\[\r\n\].*$gdb_prompt $" {
- pass "check sizeof ${type} == ${size}"
- }
- -re ".*$gdb_prompt $" {
- fail "check sizeof ${type} == ${size}"
- }
- timeout {
- fail "check sizeof ${type} == ${size} (timeout)"
- }
- }
+ gdb_test "next" "${pat}\[\r\n\]+\[0-9\].*" "check sizeof \"$type\""
}
check_sizeof "char" ${sizeof_char}
@@ -133,23 +120,8 @@ check_sizeof "long double" ${sizeof_long_double}
proc check_valueof { exp val } {
global gdb_prompt
- if [gdb_skip_stdio_test "check valueof $exp == $val"] {
- return;
- }
-
set pat [string_to_regexp "valueof (${exp}) == ${val}"]
- send_gdb "next\n"
- gdb_expect {
- -re "${pat}\[\r\n\].*$gdb_prompt $" {
- pass "check valueof ${exp} == ${val}"
- }
- -re ".*$gdb_prompt $" {
- fail "check valueof ${exp} == ${val}"
- }
- timeout {
- fail "check valueof ${exp} == ${val} (timeout)"
- }
- }
+ gdb_test "next" "${pat}\[\r\n\]+\[0-9\].*" "check valueof \"$exp\""
}
# Check that GDB and the target agree over the sign of a character.
diff --git a/gdb/testsuite/gdb.base/step-test.exp b/gdb/testsuite/gdb.base/step-test.exp
index 7a6bd19ff29..1878298a6d3 100644
--- a/gdb/testsuite/gdb.base/step-test.exp
+++ b/gdb/testsuite/gdb.base/step-test.exp
@@ -1,5 +1,7 @@
-# Copyright 1997, 1998, 1999, 2000, 2002, 2001, 2003
-# Free Software Foundation, Inc.
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 1997, 1998, 1999, 2000, 2002, 2001, 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,14 +16,6 @@
# 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
-
-# use this to debug:
-#
-#log_user 1
-
# step-test.exp -- Expect script to test stepping in gdb
if $tracelevel then {
@@ -80,12 +74,15 @@ gdb_test "step" ".*${decimal}.*myglob.*" "step into"
# On IA-64, we also end up on callee instead of on the next line due
# to the restoration of the global pointer (which is a caller-save).
# Similarly on MIPS PIC targets.
+set test "step out"
if { [istarget "hppa2.0w-hp-hpux*"] || [istarget "ia64-*-*"] || [istarget "mips*-*-*"]} {
- send_gdb "finish\n"
- gdb_expect {
- -re ".*${decimal}.*a.*5.*= a.*3.*$gdb_prompt $" { pass "step out 1" }
- -re ".*${decimal}.*callee.*INTO.*$gdb_prompt $" { pass "step out 2" }
- timeout { fail "step out" }
+ gdb_test_multiple "finish" "$test" {
+ -re ".*${decimal}.*a.*5.*= a.*3.*$gdb_prompt $" {
+ pass "$test"
+ }
+ -re ".*${decimal}.*callee.*INTO.*$gdb_prompt $" {
+ pass "$test"
+ }
}
} else {
gdb_test "finish" ".*${decimal}.*a.*5.*= a.*3.*" "step out"
@@ -110,31 +107,19 @@ proc test_i {name command here there} {
global gdb_prompt
set i 0
- while 1 {
- send_gdb "${command}\n"
- gdb_expect {
- -re "$here.*$gdb_prompt $" {
- # Okay, we're still on the same line. Just step again.
- }
- -re "$there.*$gdb_prompt $" {
- # We've reached the next line. Rah.
- pass "$name"
- return
- }
- -re "$gdb_prompt $" {
- # We got something else. Fail.
- fail "$name"
- return
- }
- timeout {
- fail "$name (timeout)"
+ gdb_test_multiple "$command" "$name" {
+ -re "$here.*$gdb_prompt $" {
+ # Have we gone for too many steps without seeing any progress?
+ if {[incr i] >= 100} {
+ fail "$name (no progress after 100 steps)"
return
}
+ send_gdb "$command\n"
+ exp_continue
}
-
- # Have we gone for too many steps without seeing any progress?
- if {[incr i] >= 100} {
- fail "$name (no progress after 100 steps)"
+ -re "$there.*$gdb_prompt $" {
+ # We've reached the next line. Rah.
+ pass "$name"
return
}
}
@@ -157,46 +142,35 @@ test_i "stepi into function's first source line" "stepi" \
# Have to be careful here, if the finish does not work,
# then we may run to the end of the program, which
# will cause erroneous failures in the rest of the tests
-send_gdb "finish\n"
-gdb_expect {
- -re ".*(Program received|Program exited).*$gdb_prompt $" {
- # Oops... We ran to the end of the program... Better reset
- if {![runto_main]} then {
- fail "Can't run to main"
- return 0
+set test "stepi: finish call"
+gdb_test_multiple "finish" "$test" {
+ -re ".*${decimal}.*callee.*NEXTI.*$gdb_prompt $" {
+ pass "$test"
}
- if {![runto step-test.c:45]} {
- fail "Can't run to line 45"
- return 0
+ -re ".*(Program received|Program exited).*$gdb_prompt $" {
+ # Oops... We ran to the end of the program... Better reset
+ if {![runto_main]} then {
+ fail "$test (Can't run to main)"
+ return 0
+ }
+ if {![runto step-test.c:45]} {
+ fail "$test (Can't run to line 45)"
+ return 0
+ }
+ fail "$test"
}
- fail "stepi: finish call"
- }
- -re ".*${decimal}.*callee.*NEXTI.*$gdb_prompt $" {
- pass "stepi: finish call"
- }
- -re ".*${decimal}.*callee.*STEPI.*$gdb_prompt $" {
- # On PA64, we end up at a different instruction than PA32.
- # On IA-64, we end up on callee instead of on the following line due
- # to the restoration of the global pointer.
- # Similarly on MIPS PIC targets.
- if { [istarget "hppa2.0w-hp-hpux*"] || [istarget "ia64-*-*"] || [istarget "mips*-*-*"] } {
- pass "stepi: finish call 2"
- test_i "stepi: past call" "stepi" \
- ".*${decimal}.*callee.*STEPI" ".*${decimal}.*callee.*NEXTI"
- } else {
- fail "stepi: finish call 2"
- return
+ -re ".*${decimal}.*callee.*STEPI.*$gdb_prompt $" {
+ # On PA64, we end up at a different instruction than PA32.
+ # On IA-64, we end up on callee instead of on the following line due
+ # to the restoration of the global pointer.
+ # Similarly on MIPS PIC targets.
+ if { [istarget "hppa2.0w-hp-hpux*"] || [istarget "ia64-*-*"] || [istarget "mips*-*-*"] } {
+ test_i "$test" "stepi" \
+ ".*${decimal}.*callee.*STEPI" ".*${decimal}.*callee.*NEXTI"
+ } else {
+ fail "$test"
+ }
}
- }
- -re "$gdb_prompt $" {
- # We got something else. Fail.
- fail "stepi: finish call"
- return
- }
- timeout {
- fail "stepi: finish call (timeout)"
- return
- }
}
test_i "nexti over function" "nexti" \
@@ -223,22 +197,16 @@ gdb_test \
gdb_test "continue" \
".*Breakpoint ${decimal},.*large_struct_by_value.*" \
"run to pass large struct"
-send_gdb "step\n"
-gdb_expect {
+set test "large struct by value"
+gdb_test_multiple "step" "$test" {
-re ".*step-test.exp: arrive here 1.*$gdb_prompt $" {
- pass "large struct by value"
+ pass "$test"
}
-re ".*(memcpy|bcopy).*$gdb_prompt $" {
send_gdb "finish\n" ; gdb_expect -re "$gdb_prompt $"
send_gdb "step\n"
exp_continue
}
- -re ".*$gdb_prompt $" {
- fail "large struct by value"
- }
- timeout {
- fail "large struct by value (timeout)"
- }
}
gdb_continue_to_end "step-test.exp"
diff --git a/gdb/testsuite/gdb.base/store.exp b/gdb/testsuite/gdb.base/store.exp
index 49e05ef814d..7b92eca3bf7 100644
--- a/gdb/testsuite/gdb.base/store.exp
+++ b/gdb/testsuite/gdb.base/store.exp
@@ -1,4 +1,6 @@
-# Copyright 2002, 2003 Free Software Foundation, Inc.
+# This testcase is part of GDB, the GNU debugger.
+
+# 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 +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@gnu.org
-
if $tracelevel {
strace $tracelevel
}
@@ -31,7 +30,7 @@ set testfile "store"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
- gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
if [get_compiler_info ${binfile}] {
@@ -55,16 +54,24 @@ if ![runto_main] then {
#
proc check_set { t l r new add } {
- global gdb_prompt
+ set prefix "var ${t} l"
gdb_test "tbreak wack_${t}"
- gdb_test "continue" "register ${t} l = u, r = v;" "continue to wack_${t}"
- gdb_test "next" "l = add_${t} .l, r.;" "next ${t}"
- gdb_test "print l" " = ${l}" "print old l - ${t}"
- gdb_test "print r" " = ${r}" "print old r - ${t}"
- gdb_test "set variable l = 4"
- gdb_test "print l" " = ${new}" "print new l - ${t}"
- gdb_test "next" "return l \\+ r;"
- gdb_test "print l" " = ${add}" "print add - ${t}"
+ gdb_test "continue" "register ${t} l = u, r = v;" \
+ "continue to wack_${t}"
+ gdb_test "next" "l = add_${t} .l, r.;" \
+ "${prefix}; next ${t}"
+ gdb_test "print l" " = ${l}" \
+ "${prefix}; print old l, expecting ${l}"
+ gdb_test "print r" " = ${r}" \
+ "${prefix}; print old r, expecting ${r}"
+ gdb_test "set variable l = 4" "" \
+ "${prefix}; setting l to 4"
+ gdb_test "print l" " = ${new}" \
+ "${prefix}; print new l, expecting ${l}"
+ gdb_test "next" "return l \\+ r;" \
+ "${prefix}; next over add call"
+ gdb_test "print l" " = ${add}" \
+ "${prefix}; print incremented l, expecting ${add}"
}
check_set "charest" "-1 .*" "-2 .*" "4 ..004." "2 ..002."
@@ -79,14 +86,20 @@ check_set "doublest" "-1" "-2" "4" "2"
#
proc up_set { t l r new } {
- global gdb_prompt
+ set prefix "upvar ${t} l"
gdb_test "tbreak add_${t}"
- gdb_test "continue" "return u . v;" "continue to add_${t}"
- gdb_test "up" "l = add_${t} .l, r.;" "up ${t}"
- gdb_test "print l" " = ${l}" "up print old l - ${t}"
- gdb_test "print r" " = ${r}" "up print old r - ${t}"
- gdb_test "set variable l = 4"
- gdb_test "print l" " = ${new}" "up print new l - ${t}"
+ gdb_test "continue" "return u . v;" \
+ "continue to add_${t}"
+ gdb_test "up" "l = add_${t} .l, r.;" \
+ "${prefix}; up"
+ gdb_test "print l" " = ${l}" \
+ "${prefix}; print old l, expecting ${l}"
+ gdb_test "print r" " = ${r}" \
+ "${prefix}; print old r, expecting ${r}"
+ gdb_test "set variable l = 4" "" \
+ "${prefix}; set l to 4"
+ gdb_test "print l" " = ${new}" \
+ "${prefix}; print new l, expecting ${new}"
}
up_set "charest" "-1 .*" "-2 .*" "4 ..004."
@@ -101,14 +114,18 @@ up_set "doublest" "-1" "-2" "4"
#
proc check_struct { t old new } {
- global gdb_prompt
+ set prefix "var struct ${t} u"
gdb_test "tbreak wack_struct_${t}"
gdb_test "continue" "int i; register struct s_${t} u = z_${t};" \
- "continue set struct ${t}"
- gdb_test "next 2" "add_struct_${t} .u.;"
- gdb_test "print u" " = ${old}" "old check struct ${t}"
- gdb_test "set variable u = s_${t}"
- gdb_test "print u" " = ${new}" "new check struct ${t}"
+ "continue to wack_struct_${t}"
+ gdb_test "next 2" "add_struct_${t} .u.;" \
+ "${prefix}; next to add_struct_${t} call"
+ gdb_test "print u" " = ${old}" \
+ "${prefix}; print old u, expecting ${old}"
+ gdb_test "set variable u = s_${t}" "" \
+ "${prefix}; set u to s_${t}"
+ gdb_test "print u" " = ${new}" \
+ "${prefix}; print new u, expecting ${new}"
}
check_struct "1" "{s = \\{0}}" "{s = \\{1}}"
@@ -117,14 +134,18 @@ check_struct "3" "{s = \\{0, 0, 0}}" "{s = \\{1, 2, 3}}"
check_struct "4" "{s = \\{0, 0, 0, 0}}" "{s = \\{1, 2, 3, 4}}"
proc up_struct { t old new } {
- global gdb_prompt
+ set prefix "up struct ${t} u"
gdb_test "tbreak add_struct_${t}"
gdb_test "continue" "for .i = 0; i < sizeof .s. / sizeof .s.s.0..; i..." \
- "continue up struct ${t}"
- gdb_test "up" "u = add_struct_${t} .u.;" "up struct ${t}"
- gdb_test "print u" " = ${old}" "old up struct ${t}"
- gdb_test "set variable u = s_${t}"
- gdb_test "print u" " = ${new}" "new up struct ${t}"
+ "continue to add_struct_${t}"
+ gdb_test "up" "u = add_struct_${t} .u.;" \
+ "${prefix}; up"
+ gdb_test "print u" " = ${old}" \
+ "${prefix}; print old u, expecting ${old}"
+ gdb_test "set variable u = s_${t}" "" \
+ "${prefix}; set u to s_${t}"
+ gdb_test "print u" " = ${new}" \
+ "${prefix}; print new u, expecting ${new}"
}
up_struct "1" "{s = \\{0}}" "{s = \\{1}}"
diff --git a/gdb/testsuite/gdb.base/structs.exp b/gdb/testsuite/gdb.base/structs.exp
index 4d282d2e58d..84435df84f1 100644
--- a/gdb/testsuite/gdb.base/structs.exp
+++ b/gdb/testsuite/gdb.base/structs.exp
@@ -218,11 +218,8 @@ proc test_struct_calls { n } {
set tests "call $n ${testfile}"
# Call fun${n}, checking the printed return-value.
- setup_kfails structs-*tld* i*86-*-* gdb/1447
- setup_kfails structs-*tld* sparc64-*-* gdb/1447
- setup_kfails structs-*tld* sparc*-*-solaris2* gdb/1447
- setup_kfails structs-*tld* x86_64-*-* gdb/1447
- setup_compiler_kfails structs-tc-* gcc-3-3 "DWARF 2" i*86-*-* gdb/1455
+ setup_compiler_kfails structs-tc-tll gcc-3-3-* "DWARF 2" i*86-*-* gdb/1455
+ setup_compiler_kfails structs-tc-td gcc-3-3-* "DWARF 2" i*86-*-* gdb/1455
gdb_test "p/c fun${n}()" "[foo ${n}]" "p/c fun<n>(); ${tests}"
# Check that GDB can always pass a structure to an inferior function.
@@ -233,11 +230,8 @@ proc test_struct_calls { n } {
# examining that global to confirm that the value is as expected.
gdb_test "call Fun${n}(foo${n})" "" "call Fun<n>(foo<n>); ${tests}"
- setup_kfails structs-*tld* i*86-*-* gdb/1447
- setup_kfails structs-*tld* sparc64-*-* gdb/1447
- setup_kfails structs-*tld* sparc*-*-solaris2* gdb/1447
- setup_kfails structs-*tld* x86_64-*-* gdb/1447
- setup_compiler_kfails structs-tc-* gcc-3-3 "DWARF 2" i*86-*-* gdb/1455
+ setup_compiler_kfails structs-tc-tll gcc-3-3-* "DWARF 2" i*86-*-* gdb/1455
+ setup_compiler_kfails structs-tc-td gcc-3-3-* "DWARF 2" i*86-*-* gdb/1455
gdb_test "p/c L${n}" [foo ${n}] "p/c L<n>; ${tests}"
}
@@ -290,10 +284,6 @@ proc test_struct_returns { n } {
"advance to fun<n> for return; ${tests}"
# Check that the program invalidated the relevant global.
- setup_kfails structs-tld i*86-*-* gdb/1447
- setup_kfails structs-tld sparc64-*-* gdb/1447
- setup_kfails structs-tld sparc*-*-solaris2* gdb/1447
- setup_kfails structs-tld x86_64-*-* gdb/1447
gdb_test "p/c L${n}" " = [zed $n]" "zed L<n> for return; ${tests}"
# Force the "return". This checks that the return is always
@@ -304,21 +294,21 @@ proc test_struct_returns { n } {
# The test is writen so that it only reports one FAIL/PASS for the
# entire operation. The value returned is checked further down.
- # "return_value_unknown", if non-empty, records why GDB realised
- # that it didn't know where the return value was.
+ # "return_value_known", if non-zero, indicates that GDB knew where
+ # the return value was located.
set test "return foo<n>; ${tests}"
- set return_value_unknown 0
+ set return_value_known 1
set return_value_unimplemented 0
gdb_test_multiple "return foo${n}" "${test}" {
-re "The location" {
# Ulgh, a struct return, remember this (still need prompt).
- set return_value_unknown 1
+ set return_value_known 0
exp_continue
}
-re "A structure or union" {
# Ulgh, a struct return, remember this (still need prompt).
- set return_value_unknown 1
+ set return_value_known 0
# Double ulgh. Architecture doesn't use return_value and
# hence hasn't implemented small structure return.
set return_value_unimplemented 1
@@ -339,34 +329,30 @@ proc test_struct_returns { n } {
# Check that the return-value is as expected. At this stage we're
# just checking that GDB has returned a value consistent with
- # "return_value_unknown" set above.
+ # "return_value_known" set above.
set test "value foo<n> returned; ${tests}"
- setup_kfails structs-*tld* i*86-*-* gdb/1447
- setup_kfails structs-*tld* sparc64-*-* gdb/1447
- setup_kfails structs-*tld* sparc*-*-solaris2* gdb/1447
- setup_kfails structs-*tld* x86_64-*-* gdb/1447
gdb_test_multiple "p/c L${n}" "${test}" {
-re " = [foo ${n}].*${gdb_prompt} $" {
- if $return_value_unknown {
+ if $return_value_known {
+ pass "${test}"
# This contradicts the above claim that GDB didn't
# know the location of the return-value.
- fail "${test}"
} else {
- pass "${test}"
+ fail "${test}"
}
}
-re " = [zed ${n}].*${gdb_prompt} $" {
- if $return_value_unknown {
+ if $return_value_known {
+ # This contradicts the above claim that GDB knew
+ # the location of the return-value.
+ fail "${test}"
+ } else {
# The struct return case. Since any modification
# would be by reference, and that can't happen, the
# value should be unmodified and hence Z is expected.
# Is this a reasonable assumption?
pass "${test}"
- } else {
- # This contradicts the above claim that GDB knew
- # the location of the return-value.
- fail "${test}"
}
}
-re ".*${gdb_prompt} $" {
@@ -396,23 +382,20 @@ proc test_struct_returns { n } {
"advance to fun<n> for finish; ${tests}"
# Check that the program invalidated the relevant global.
- setup_kfails structs-tld i*86-*-* gdb/1447
- setup_kfails structs-tld sparc64-*-* gdb/1447
- setup_kfails structs-tld sparc*-*-solaris2* gdb/1447
- setup_kfails structs-tld x86_64-*-* gdb/1447
gdb_test "p/c L${n}" " = [zed $n]" "zed L<n> for finish; ${tests}"
- # Finish the function, set 'finish_value_unknown" to non-empty if the
- # return-value was not found.
+ # Finish the function, set 'finish_value_known" to non-empty if
+ # the return-value was found.
+
set test "finish foo<n>; ${tests}"
- set finish_value_unknown 0
+ set finish_value_known 1
gdb_test_multiple "finish" "${test}" {
-re "Value returned is .*${gdb_prompt} $" {
pass "${test}"
}
-re "Cannot determine contents.*${gdb_prompt} $" {
# Expected bad value. For the moment this is ok.
- set finish_value_unknown 1
+ set finish_value_known 0
pass "${test}"
}
}
@@ -421,28 +404,24 @@ proc test_struct_returns { n } {
# "p/c". If no return value was found, the 'Z' from the previous
# check that the variable was cleared, is printed.
set test "value foo<n> finished; ${tests}"
- setup_kfails structs-*tld* i*86-*-* gdb/1447
- setup_kfails structs-*tld* sparc64-*-* gdb/1447
- setup_kfails structs-*tld* sparc*-*-solaris2* gdb/1447
- setup_kfails structs-*tld* x86_64-*-* gdb/1447
gdb_test_multiple "p/c" "${test}" {
-re "[foo ${n}]\[\r\n\]+${gdb_prompt} $" {
- if $finish_value_unknown {
+ if $finish_value_known {
+ pass "${test}"
+ } else {
# This contradicts the above claim that GDB didn't
# know the location of the return-value.
fail "${test}"
- } else {
- pass "${test}"
}
}
-re "[zed ${n}]\[\r\n\]+${gdb_prompt} $" {
# The value didn't get found. This is "expected".
- if $finish_value_unknown {
- pass "${test}"
- } else {
+ if $finish_value_known {
# This contradicts the above claim that GDB did
# know the location of the return-value.
fail "${test}"
+ } else {
+ pass "${test}"
}
}
}
@@ -450,20 +429,17 @@ proc test_struct_returns { n } {
# Finally, check that "return" and finish" have consistent
# behavior.
- # Since both "return" and "finish" use equivalent "which
- # return-value convention" logic, both commands should have
- # identical can/can-not find return-value messages.
-
- # Note that since "call" and "finish" use common code paths, a
- # failure here is a strong indicator of problems with "store
- # return-value" code paths. Suggest looking at "return_value"
- # when investigating a fix.
+ # Since "finish" works in more cases than "return" (see
+ # RETURN_VALUE_ABI_RETURNS_ADDRESS and
+ # RETURN_VALUE_ABI_PRESERVES_ADDRESS), the "return" value being
+ # known implies that the "finish" value is known (but not the
+ # reverse).
- set test "return and finish use same convention; ${tests}"
- if {$finish_value_unknown == $return_value_unknown} {
- pass "${test}"
- } else {
+ set test "return value known implies finish value known; ${tests}"
+ if {$return_value_known && ! $finish_value_known} {
kfail gdb/1444 "${test}"
+ } else {
+ pass "${test}"
}
}
diff --git a/gdb/testsuite/gdb.base/structs2.exp b/gdb/testsuite/gdb.base/structs2.exp
index c3c4e671c5e..e7f6553c650 100644
--- a/gdb/testsuite/gdb.base/structs2.exp
+++ b/gdb/testsuite/gdb.base/structs2.exp
@@ -29,6 +29,12 @@ set testfile "structs2"
set srcfile ${testfile}.c
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}] {
+ return -1;
+}
+
# build the first test case
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
# built the second test case since we can't use prototypes
@@ -64,10 +70,16 @@ gdb_test "break param_reg" \
"Breakpoint .* at .*" \
"structs2 breakpoint set"
+if [test_compiler_info gcc-*-*] {
+ setup_xfail hppa*-* gcc/15860
+}
gdb_test "continue" \
".*pr_char=120.*pr_uchar=130.*pr_short=32000.*pr_ushort=33000.*bkpt = 1.*" \
"structs2 continue1"
+if [test_compiler_info gcc-*-*] {
+ setup_xfail hppa*-* gcc/15860
+}
gdb_test "continue" \
".*pr_char=-126.*pr_uchar=120.*pr_short=-32536.*pr_ushort=32000.*bkpt = 1.*" \
"structs2 continue2"
diff --git a/gdb/testsuite/gdb.base/unload.c b/gdb/testsuite/gdb.base/unload.c
new file mode 100644
index 00000000000..5c5e3d3c1d8
--- /dev/null
+++ b/gdb/testsuite/gdb.base/unload.c
@@ -0,0 +1,58 @@
+/* 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 <stdlib.h>
+#include <dlfcn.h>
+
+int k = 0;
+
+#define SHLIB_NAME SHLIB_DIR "/unloadshr.sl"
+
+int main()
+{
+ void *handle;
+ int (*unloadshr) (int);
+ int y;
+ const char *msg;
+
+ handle = dlopen (SHLIB_NAME, RTLD_LAZY);
+ msg = dlerror ();
+
+ if (!handle)
+ {
+ fprintf (stderr, msg);
+ exit (1);
+ }
+
+ unloadshr = (int (*)(int))dlsym (handle, "shrfunc1");
+
+ if (!unloadshr)
+ {
+ fprintf (stderr, dlerror ());
+ exit (1);
+ }
+
+ y = (*unloadshr)(3);
+
+ printf ("y is %d\n", y);
+
+ dlclose (handle);
+
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.base/unload.exp b/gdb/testsuite/gdb.base/unload.exp
new file mode 100644
index 00000000000..242dcf5d08d
--- /dev/null
+++ b/gdb/testsuite/gdb.base/unload.exp
@@ -0,0 +1,144 @@
+# 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.
+
+# 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 "unload"
+set libfile "unloadshr"
+set libsrcfile ${libfile}.c
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+set shlibdir ${objdir}/${subdir}
+
+if [get_compiler_info ${binfile}] {
+ return -1
+}
+
+set dl_lib_flag ""
+switch -glob [istarget] {
+ "hppa*-hp-hpux*" { }
+ "*-*-linux*" { set dl_lib_flag "libs=-ldl" }
+ "*-*-solaris*" { set dl_lib_flag "libs=-ldl" }
+ default { }
+}
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "additional_flags=-DSHLIB_DIR\=\"${shlibdir}\"" $dl_lib_flag]] != "" } {
+ 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}/${libsrcfile}" "${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."
+ }
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+if [target_info exists gdb_stub] {
+ gdb_step_for_stub;
+}
+
+#
+# Test setting a breakpoint in a dynamically loaded library which is
+# manually loaded and unloaded
+#
+
+gdb_test_multiple "break shrfunc1" "set pending breakpoint" {
+ -re ".*Make breakpoint pending.*y or \\\[n\\\]. $" {
+ gdb_test "y" "Breakpoint.*shrfunc1.*pending." "set pending breakpoint"
+ }
+}
+
+gdb_test "info break" \
+ "Num Type\[ \]+Disp Enb Address\[ \]+What.*
+\[0-9\]+\[\t \]+breakpoint keep y.*PENDING.*shrfunc1.*" \
+"single pending breakpoint info"
+
+set unloadshr_line [gdb_get_line_number "unloadshr break" ${srcdir}/${subdir}/${libsrcfile}]
+
+gdb_test "run" \
+"Starting program.*unload.*
+Breakpoint.*at.*
+Pending breakpoint \"shrfunc1\" resolved.*
+Breakpoint.*, shrfunc1 \\\(x=3\\\).*unloadshr.c:$unloadshr_line.*" \
+"running program"
+
+gdb_test "continue" \
+"Continuing.*y is 7.*warning: Temporarily disabling breakpoints for.*unloadshr.sl.*Program exited normally." \
+"continuing to end of program"
+
+#
+# Try to rerun program and verify that shared breakpoint is reset properly
+#
+
+gdb_test "run" \
+".*Breakpoint.*shrfunc1.*at.*unloadshr.c:$unloadshr_line.*" \
+"rerun to shared library breakpoint"
+
+gdb_test "continue" \
+"Continuing.*y is 7.*warning: Temporarily disabling breakpoints for.*unloadshr.sl.*Program exited normally." \
+"continuing to end of program second time"
+
diff --git a/gdb/testsuite/gdb.base/unloadshr.c b/gdb/testsuite/gdb.base/unloadshr.c
new file mode 100644
index 00000000000..3896e67ffc1
--- /dev/null
+++ b/gdb/testsuite/gdb.base/unloadshr.c
@@ -0,0 +1,24 @@
+/* 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>
+
+int shrfunc1 (int x)
+{
+ return x + 4; /* unloadshr break */
+}
diff --git a/gdb/testsuite/gdb.base/whatis.c b/gdb/testsuite/gdb.base/whatis.c
index 63d5d3dae09..7d4a647781f 100644
--- a/gdb/testsuite/gdb.base/whatis.c
+++ b/gdb/testsuite/gdb.base/whatis.c
@@ -1,3 +1,23 @@
+/* This test program is part of GDB, the GNU debugger.
+
+ Copyright 1992, 1993, 1994, 1997, 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
+ 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.
+ */
+
/*
* Test file with lots of different types, for testing the
* "whatis" command.
@@ -7,10 +27,6 @@
* First the basic C types.
*/
-#if !(defined (__STDC__) || defined (_AIX))
-#define signed /**/
-#endif
-
char v_char;
signed char v_signed_char;
unsigned char v_unsigned_char;
diff --git a/gdb/testsuite/gdb.base/whatis.exp b/gdb/testsuite/gdb.base/whatis.exp
index 98af77a3417..9b41d6a2ff4 100644
--- a/gdb/testsuite/gdb.base/whatis.exp
+++ b/gdb/testsuite/gdb.base/whatis.exp
@@ -1,5 +1,5 @@
-# Copyright 1988, 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1999, 2002, 2003
-# Free Software Foundation, Inc.
+# Copyright 1988, 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1999, 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,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 Rob Savoye. (rob@cygnus.com)
if $tracelevel {
@@ -75,19 +72,9 @@ gdb_test "whatis v_char" \
"type = (unsigned char|char)" \
"whatis char"
-# If we did not use the signed keyword when compiling the file, don't
-# expect GDB to know that char is signed.
-if { $hp_cc_compiler || $hp_aCC_compiler } {
- set signed_keyword_not_used 1
-}
-if $signed_keyword_not_used then {
- set signed_char "char"
-} else {
- set signed_char "signed char"
-}
if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix*" }
gdb_test "whatis v_signed_char" \
- "type = $signed_char" \
+ "type = (signed char|char)" \
"whatis signed char"
gdb_test "whatis v_unsigned_char" \
diff --git a/gdb/testsuite/gdb.cp/classes.exp b/gdb/testsuite/gdb.cp/classes.exp
index d4e78c11927..397a14920f2 100644
--- a/gdb/testsuite/gdb.cp/classes.exp
+++ b/gdb/testsuite/gdb.cp/classes.exp
@@ -18,7 +18,6 @@
# 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\]+"
if $tracelevel then {
@@ -27,6 +26,8 @@ if $tracelevel then {
if { [skip_cplus_tests] } { continue }
+load_lib "cp-support.exp"
+
set testfile "classes"
set srcfile ${testfile}.cc
set binfile ${objdir}/${subdir}/${testfile}
@@ -36,580 +37,349 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
}
# Test ptype of class objects.
-#
-# This code accepts the output of gcc v2 and v3, dwarf-2 and stabs+.
-# It could use some expansion with other compilers such as hp-ux ac++.
-#
-# There are lots of variations in the output:
-#
-# . gcc -stabs+ emits debug info for implicit member functions:
-# operator=, copy ctor, ctor. gcc -gdwarf-2 does not.
-#
-# . gcc with abi version 1 puts the implicit member functions
-# at the beginning of the member function list; with abi version 2,
-# the implicit member functions are at the end of the member function
-# list. This appears as an output difference with -gstabs+.
-# gcc 3.3.X defaults to abi version 1, and gcc 3.4 will default
-# to abi version 2.
-#
-# . gcc v2 shows data members for virtual base pointers.
-# gcc v3 does not.
-#
-# . gdb always prints "class" for both "class" and "struct".
-# In the future, I should accept "struct" in case gdb improves.
proc test_ptype_class_objects {} {
- global gdb_prompt
- global ws
- global nl
# Simple type.
- gdb_test_multiple "ptype struct default_public_struct" "ptype struct default_public_struct" {
- -re "type = class default_public_struct \{${ws}public:${ws}int a;${ws}int b;$nl\}$nl$gdb_prompt $" {
- # gcc 2.95.3 -gdwarf-2
- # gcc 3.3.2 -gdwarf-2
- # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2
- pass "ptype struct default_public_struct"
+ cp_test_ptype_class \
+ "ptype struct default_public_struct" "" "struct" "default_public_struct" \
+ {
+ { field public "int a;" }
+ { field public "int b;" }
}
- -re "type = class default_public_struct \{${ws}public:${ws}int a;${ws}int b;${ws}default_public_struct ?& ?operator ?=\\(default_public_struct const ?&\\);${ws}default_public_struct\\(default_public_struct const ?&\\);${ws}default_public_struct\\((void|)\\);$nl\}$nl$gdb_prompt $" {
- # gcc 2.95.3 -gstabs+
- # gcc 3.3.2 -gstabs+
- # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
- pass "ptype struct default_public_struct"
- }
- }
- # Same test, slightly different type.
+ # Another simple type.
- gdb_test_multiple "ptype struct explicit_public_struct" "ptype struct explicit_public_struct" {
- -re "type = class explicit_public_struct \{${ws}public:${ws}int a;${ws}int b;$nl\}$nl$gdb_prompt $" {
- # gcc 2.95.3 -gdwarf-2
- # gcc 3.3.2 -gdwarf-2
- # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2
- pass "ptype struct explicit_public_struct"
- }
- -re "type = class explicit_public_struct \{${ws}public:${ws}int a;${ws}int b;${ws}explicit_public_struct ?& ?operator ?=\\(explicit_public_struct const ?&\\);${ws}explicit_public_struct\\(explicit_public_struct const ?&\\);${ws}explicit_public_struct\\((void|)\\);$nl\}$nl$gdb_prompt $" {
- # gcc 2.95.3 -gstabs+
- # gcc 3.3.2 -gstabs+
- # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
- pass "ptype struct explicit_public_struct"
+ cp_test_ptype_class \
+ "ptype struct explicit_public_struct" "" "struct" "explicit_public_struct" \
+ {
+ { field public "int a;" }
+ { field public "int b;" }
}
- }
- # Same test, slightly different type.
+ # Another simple type.
- gdb_test_multiple "ptype struct protected_struct" "ptype struct protected_struct" {
- -re "type = class protected_struct \{${ws}protected:${ws}int a;${ws}int b;$nl\}$nl$gdb_prompt $" {
- # gcc 2.95.3 -gdwarf-2
- # gcc 3.3.2 -gdwarf-2
- # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2
- pass "ptype struct protected_struct"
+ cp_test_ptype_class \
+ "ptype struct protected_struct" "" "struct" "protected_struct" \
+ {
+ { field protected "int a;" }
+ { field protected "int b;" }
}
- -re "type = class protected_struct \{${ws}protected:${ws}int a;${ws}int b;${ws}public:${ws}protected_struct ?& ?operator ?=\\(protected_struct const ?&\\);${ws}protected_struct\\(protected_struct const ?&\\);${ws}protected_struct\\((void|)\\);$nl\}$nl$gdb_prompt $" {
- # gcc 2.95.3 -gstabs+
- # gcc 3.3.2 -gstabs+
- # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
- pass "ptype struct protected_struct"
- }
- }
- # Same test, slightly different type.
+ # Another simple type.
- gdb_test_multiple "ptype struct private_struct" "ptype struct private_struct" {
- -re "type = class private_struct \{${ws}private:${ws}int a;${ws}int b;$nl\}$nl$gdb_prompt $" {
- # gcc 2.95.3 -gdwarf-2
- # gcc 3.3.2 -gdwarf-2
- # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2
- pass "ptype struct private_struct"
+ cp_test_ptype_class \
+ "ptype struct private_struct" "" "struct" "private_struct" \
+ {
+ { field private "int a;" }
+ { field private "int b;" }
}
- -re "type = class private_struct \{${ws}private:${ws}int a;${ws}int b;${ws}public:${ws}private_struct ?& ?operator ?=\\(private_struct const ?&\\);${ws}private_struct\\(private_struct const ?&\\);${ws}private_struct\\((void|)\\);$nl\}$nl$gdb_prompt $" {
- # gcc 2.95.3 -gstabs+
- # gcc 3.3.2 -gstabs+
- # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
- pass "ptype struct private_struct"
- }
- }
- # Similar test, bigger type.
+ # A bigger type.
- gdb_test_multiple "ptype struct mixed_protection_struct" "ptype struct mixed_protection_struct" {
- -re "type = class mixed_protection_struct \{${ws}public:${ws}int a;${ws}int b;${ws}private:${ws}int c;${ws}int d;${ws}protected:${ws}int e;${ws}int f;${ws}public:${ws}int g;${ws}private:${ws}int h;${ws}protected:${ws}int i;$nl\}$nl$gdb_prompt $" {
- # gcc 2.95.3 -gdwarf-2
- # gcc 3.3.2 -gdwarf-2
- # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2
- pass "ptype struct mixed_protection_struct"
+ cp_test_ptype_class \
+ "ptype struct mixed_protection_struct" "" "struct" "mixed_protection_struct" \
+ {
+ { field public "int a;" }
+ { field public "int b;" }
+ { field private "int c;" }
+ { field private "int d;" }
+ { field protected "int e;" }
+ { field protected "int f;" }
+ { field public "int g;" }
+ { field private "int h;" }
+ { field protected "int i;" }
}
- -re "type = class mixed_protection_struct \{${ws}public:${ws}int a;${ws}int b;${ws}private:${ws}int c;${ws}int d;${ws}protected:${ws}int e;${ws}int f;${ws}public:${ws}int g;${ws}private:${ws}int h;${ws}protected:${ws}int i;${ws}public:${ws}mixed_protection_struct ?& ?operator ?=\\(mixed_protection_struct const ?&\\);${ws}mixed_protection_struct\\(mixed_protection_struct const ?&\\);${ws}mixed_protection_struct\\((void|)\\);$nl\}$nl$gdb_prompt $" {
- # gcc 2.95.3 -gstabs+
- # gcc 3.3.2 -gstabs+
- # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
- pass "ptype struct mixed_protection_struct"
- }
- }
# All that again with "class" instead of "struct".
# gdb does not care about the difference anyways.
- gdb_test_multiple "ptype class public_class" "ptype class public_class" {
- -re "type = class public_class \{${ws}public:${ws}int a;${ws}int b;$nl\}$nl$gdb_prompt $" {
- # gcc 2.95.3 -gdwarf-2
- # gcc 3.3.2 -gdwarf-2
- # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2
- pass "ptype class public_class"
+ cp_test_ptype_class \
+ "ptype class public_class" "" "class" "public_class" \
+ {
+ { field public "int a;" }
+ { field public "int b;" }
}
- -re "type = class public_class \{${ws}public:${ws}int a;${ws}int b;${ws}public_class ?& ?operator ?=\\(public_class const ?&\\);${ws}public_class\\(public_class const ?&\\);${ws}public_class\\((void|)\\);$nl\}$nl$gdb_prompt $" {
- # gcc 2.95.3 -gstabs+
- # gcc 3.3.2 -gstabs+
- # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
- pass "ptype class public_class"
- }
- }
- # Same test, slightly different type.
+ # Another simple type.
- gdb_test_multiple "ptype class protected_class" "ptype class protected_class" {
- -re "type = class protected_class \{${ws}protected:${ws}int a;${ws}int b;$nl\}$nl$gdb_prompt $" {
- # gcc 2.95.3 -gdwarf-2
- # gcc 3.3.2 -gdwarf-2
- # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2
- pass "ptype class protected_class"
+ cp_test_ptype_class \
+ "ptype class protected_class" "" "class" "protected_class" \
+ {
+ { field protected "int a;" }
+ { field protected "int b;" }
}
- -re "type = class protected_class \{${ws}protected:${ws}int a;${ws}int b;${ws}public:${ws}protected_class ?& ?operator ?=\\(protected_class const ?&\\);${ws}protected_class\\(protected_class const ?&\\);${ws}protected_class\\((void|)\\);$nl\}$nl$gdb_prompt $" {
- # gcc 2.95.3 -gstabs+
- # gcc 3.3.2 -gstabs+
- # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
- pass "ptype class protected_class"
- }
- }
- # Same test, slightly different type.
- # The 'private' is optional but gdb always prints it.
+ # Another simple type.
- gdb_test_multiple "ptype class default_private_class" "ptype class default_private_class" {
- -re "type = class default_private_class \{${ws}(private:${ws}|)int a;${ws}int b;$nl\}$nl$gdb_prompt $" {
- # gcc 2.95.3 -gdwarf-2
- # gcc 3.3.2 -gdwarf-2
- # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2
- pass "ptype class default_private_class"
- }
- -re "type = class default_private_class \{${ws}(private:${ws}|)int a;${ws}int b;${ws}public:${ws}default_private_class ?& ?operator ?=\\(default_private_class const ?&\\);${ws}default_private_class\\(default_private_class const ?&\\);${ws}default_private_class\\((void|)\\);$nl\}$nl$gdb_prompt $" {
- # gcc 2.95.3 -gstabs+
- # gcc 3.3.2 -gstabs+
- # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
- pass "ptype class default_private_class"
+ cp_test_ptype_class \
+ "ptype class default_private_class" "" "class" "default_private_class" \
+ {
+ { field private "int a;" }
+ { field private "int b;" }
}
- }
- # Same test, slightly different type.
+ # Another simple type.
- gdb_test_multiple "ptype class explicit_private_class" "ptype class explicit_private_class" {
- -re "type = class explicit_private_class \{${ws}(private:${ws}|)int a;${ws}int b;$nl\}$nl$gdb_prompt $" {
- # gcc 2.95.3 -gdwarf-2
- # gcc 3.3.2 -gdwarf-2
- # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2
- pass "ptype class explicit_private_class"
- }
- -re "type = class explicit_private_class \{${ws}(private:${ws}|)int a;${ws}int b;${ws}public:${ws}explicit_private_class ?& ?operator ?=\\(explicit_private_class const ?&\\);${ws}explicit_private_class\\(explicit_private_class const ?&\\);${ws}explicit_private_class\\((void|)\\);$nl\}$nl$gdb_prompt $" {
- # gcc 2.95.3 -gstabs+
- # gcc 3.3.2 -gstabs+
- # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
- pass "ptype class explicit_private_class"
+ cp_test_ptype_class \
+ "ptype class explicit_private_class" "" "class" "explicit_private_class" \
+ {
+ { field private "int a;" }
+ { field private "int b;" }
}
- }
- # Similar test, bigger type.
+ # A bigger type.
- gdb_test_multiple "ptype class mixed_protection_class" "ptype struct mixed_protection_class" {
- -re "type = class mixed_protection_class \{${ws}public:${ws}int a;${ws}int b;${ws}private:${ws}int c;${ws}int d;${ws}protected:${ws}int e;${ws}int f;${ws}public:${ws}int g;${ws}private:${ws}int h;${ws}protected:${ws}int i;$nl\}$nl$gdb_prompt $" {
- # gcc 2.95.3 -gdwarf-2
- # gcc 3.3.2 -gdwarf-2
- # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2
- pass "ptype class mixed_protection_class"
- }
- -re "type = class mixed_protection_class \{${ws}public:${ws}int a;${ws}int b;${ws}private:${ws}int c;${ws}int d;${ws}protected:${ws}int e;${ws}int f;${ws}public:${ws}int g;${ws}private:${ws}int h;${ws}protected:${ws}int i;${ws}public:${ws}mixed_protection_class ?& ?operator ?=\\(mixed_protection_class const ?&\\);${ws}mixed_protection_class\\(mixed_protection_class const ?&\\);${ws}mixed_protection_class\\((void|)\\);$nl\}$nl$gdb_prompt $" {
- # gcc 2.95.3 -gstabs+
- # gcc 3.3.2 -gstabs+
- # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
- pass "ptype class mixed_protection_class"
+ cp_test_ptype_class \
+ "ptype class mixed_protection_class" "" "class" "mixed_protection_class" \
+ {
+
+ { field public "int a;" }
+ { field public "int b;" }
+ { field private "int c;" }
+ { field private "int d;" }
+ { field protected "int e;" }
+ { field protected "int f;" }
+ { field public "int g;" }
+ { field private "int h;" }
+ { field protected "int i;" }
}
- }
# Here are some classes with inheritance.
# Base class.
- gdb_test_multiple "ptype class A" "ptype class A" {
- -re "type = class A \{${ws}public:${ws}int a;${ws}int x;$nl\}$nl$gdb_prompt $" {
- # gcc 2.95.3 -gdwarf-2
- # gcc 3.3.2 -gdwarf-2
- # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2
- pass "ptype class A"
+ cp_test_ptype_class \
+ "ptype class A" "" "class" "A" \
+ {
+ { field public "int a;" }
+ { field public "int x;" }
}
- -re "type = class A \{${ws}public:${ws}int a;${ws}int x;${ws}A ?& ?operator ?=\\(A const ?&\\);${ws}A\\(A const ?&\\);${ws}A\\((void|)\\);$nl\}$nl$gdb_prompt $" {
- # gcc 2.95.3 -gstabs+
- # gcc 3.3.2 -gstabs+
- # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
- pass "ptype class A"
- }
- }
# Derived class.
- gdb_test_multiple "ptype class B" "ptype class B" {
- -re "type = class B : public A \{${ws}public:${ws}int b;${ws}int x;$nl\}$nl$gdb_prompt $" {
- # gcc 2.95.3 -gdwarf-2
- # gcc 3.3.2 -gdwarf-2
- # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2
- pass "ptype class B"
+ cp_test_ptype_class \
+ "ptype class B" "" "class" "B" \
+ {
+ { base "public A" }
+ { field public "int b;" }
+ { field public "int x;" }
}
- -re "type = class B : public A \{${ws}public:${ws}int b;${ws}int x;${ws}B ?& ?operator ?=\\(B const ?&\\);${ws}B\\(B const ?&\\);${ws}B\\((void|)\\);$nl\}$nl$gdb_prompt $" {
- # gcc 2.95.3 -gstabs+
- # gcc 3.3.2 -gstabs+
- # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
- pass "ptype class B"
- }
- }
# Derived class.
- gdb_test_multiple "ptype class C" "ptype class C" {
- -re "type = class C : public A \{${ws}public:${ws}int c;${ws}int x;$nl\}$nl$gdb_prompt $" {
- # gcc 2.95.3 -gdwarf-2
- # gcc 3.3.2 -gdwarf-2
- # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2
- pass "ptype class C"
+ cp_test_ptype_class \
+ "ptype class C" "" "class" "C" \
+ {
+ { base "public A" }
+ { field public "int c;" }
+ { field public "int x;" }
}
- -re "type = class C : public A \{${ws}public:${ws}int c;${ws}int x;${ws}C ?& ?operator ?=\\(C const ?&\\);${ws}C\\(C const ?&\\);${ws}C\\((void|)\\);$nl\}$nl$gdb_prompt $" {
- # gcc 2.95.3 -gstabs+
- # gcc 3.3.2 -gstabs+
- # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
- pass "ptype class C"
- }
- }
# Derived class, multiple inheritance.
- gdb_test_multiple "ptype class D" "ptype class D" {
- -re "type = class D : public B, public C \{${ws}public:${ws}int d;${ws}int x;$nl\}$nl$gdb_prompt $" {
- # gcc 2.95.3 -gdwarf-2
- # gcc 3.3.2 -gdwarf-2
- # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2
- pass "ptype class D"
+ cp_test_ptype_class \
+ "ptype class D" "" "class" "D" \
+ {
+ { base "public B" }
+ { base "public C" }
+ { field public "int d;" }
+ { field public "int x;" }
}
- -re "type = class D : public B, public C \{${ws}public:${ws}int d;${ws}int x;${ws}D ?& ?operator ?=\\(D const ?&\\);${ws}D\\(D const ?&\\);${ws}D\\((void|)\\);$nl\}$nl$gdb_prompt $" {
- # gcc 2.95.3 -gstabs+
- # gcc 3.3.2 -gstabs+
- # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
- pass "ptype class D"
- }
- }
# Derived class.
- gdb_test_multiple "ptype class E" "ptype class E" {
- -re "type = class E : public D \{${ws}public:${ws}int e;${ws}int x;$nl\}$nl$gdb_prompt $" {
- # gcc 2.95.3 -gdwarf-2
- # gcc 3.3.2 -gdwarf-2
- # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2
- pass "ptype class E"
- }
- -re "type = class E : public D \{${ws}public:${ws}int e;${ws}int x;${ws}E ?& ?operator ?=\\(E const ?&\\);${ws}E\\(E const ?&\\);${ws}E\\((void|)\\);$nl\}$nl$gdb_prompt $" {
- # gcc 2.95.3 -gstabs+
- # gcc 3.3.2 -gstabs+
- # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
- pass "ptype class E"
+ cp_test_ptype_class \
+ "ptype class E" "" "class" "E" \
+ {
+ { base "public D" }
+ { field public "int e;" }
+ { field public "int x;" }
}
- }
# This is a break from inheritance tests.
#
# gcc 2.X with stabs (stabs or stabs+?) used to have a problem with
# static methods whose name is the same as their argument mangling.
- gdb_test_multiple "ptype class Static" "ptype class Static" {
- -re "type = class Static \{${ws}public:${ws}static void ii\\(int, int\\);$nl\}$nl$gdb_prompt $" {
- # gcc 2.95.3 -gdwarf-2
- # gcc 3.3.2 -gdwarf-2
- # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2
- pass "ptype class Static"
- }
- -re "type = class Static \{${ws}public:${ws}Static ?& ?operator ?=\\(Static const ?&\\);${ws}Static\\(Static const ?&\\);${ws}Static\\((void|)\\);${ws}static void ii\\(int, int\\);$nl\}$nl$gdb_prompt $" {
- # gcc 2.95.3 -gstabs+
- # gcc 3.3.2 -gstabs+
- pass "ptype class Static"
+ cp_test_ptype_class \
+ "ptype class Static" "" "class" "Static" \
+ {
+ { method public "static void ii(int, int);" }
}
- -re "type = class Static \{${ws}public:${ws}static void ii\\(int, int\\);${ws}Static ?& ?operator ?=\\(Static const ?&\\);${ws}Static\\(Static const ?&\\);${ws}Static\\((void|)\\);$nl\}$nl$gdb_prompt $" {
- # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
- pass "ptype class Static"
- }
- }
# Here are some virtual inheritance tests.
- gdb_test_multiple "ptype class vA" "ptype class vA" {
- -re "type = class vA \{${ws}public:${ws}int va;${ws}int vx;$nl\}$nl$gdb_prompt $" {
- # gcc 2.95.3 -gdwarf-2
- # gcc 3.3.2 -gdwarf-2
- # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2
- pass "ptype class vA"
- }
- -re "type = class vA \{${ws}public:${ws}int va;${ws}int vx;${ws}vA ?& ?operator ?=\\(vA const ?&\\);${ws}vA\\(vA const ?&\\);${ws}vA\\((void|)\\);$nl\}$nl$gdb_prompt $" {
- # gcc 2.95.3 -gstabs+
- # gcc 3.3.2 -gstabs+
- # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
- pass "ptype class vA"
- }
- }
-
- # With gcc 2, gdb prints the virtual base pointer.
- # With gcc 3, gdb does not print the virtual base pointer.
- # drow considers it a gdb bug if gdb prints the vbptr.
+ # A virtual base class.
- gdb_test_multiple "ptype class vB" "ptype class vB" {
- -re "type = class vB : public virtual vA \{${ws}private:${ws}vA ?\\* ?_vb.2vA;${ws}public:${ws}int vb;${ws}int vx;$nl\}$nl$gdb_prompt $" {
- # gcc 2.95.3 -gdwarf-2
- # TODO: kfail this
- fail "ptype class vB"
+ cp_test_ptype_class \
+ "ptype class vA" "" "class" "vA" \
+ {
+ { field public "int va;" }
+ { field public "int vx;" }
}
- -re "type = class vB : public virtual vA \{${ws}public:${ws}int vb;${ws}int vx;$nl\}$nl$gdb_prompt $" {
- # gcc 3.3.2 -gdwarf-2
- # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2
- pass "ptype class vB"
- }
- -re "type = class vB : public virtual vA \{${ws}private:${ws}vA ?\\* ?_vb.vA;${ws}public:${ws}int vb;${ws}int vx;${ws}vB ?& ?operator ?=\\(vB const ?&\\);${ws}vB\\(int, ?vB const ?&\\);${ws}vB\\(int\\);$nl\}$nl$gdb_prompt $" {
- # gcc 2.95.3 -gstabs+
- # See the hidden "in-charge" ctor parameter!
- # TODO: kfail this
- setup_xfail "*-*-*"
- fail "ptype class vB (FIXME: non-portable virtual table constructs)"
- }
- -re "type = class vB : public virtual vA \{${ws}public:${ws}int vb;${ws}int vx;${ws}vB ?& ?operator ?=\\(vB const ?&\\);${ws}vB\\(vB const ?&\\);${ws}vB\\((void|)\\);$nl\}$nl$gdb_prompt $" {
- # gcc 3.3.2 -gstabs+
- # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
- pass "ptype class vB"
- }
- }
- # Another class with a virtual base.
+ # A derived class with a virtual base.
- gdb_test_multiple "ptype class vC" "ptype class vC" {
- -re "type = class vC : public virtual vA \{${ws}private:${ws}vA ?\\* ?_vb.2vA;${ws}public:${ws}int vc;${ws}int vx;$nl\}$nl$gdb_prompt $" {
- # gcc 2.95.3 -gdwarf-2
- # TODO: kfail
- fail "ptype class vC"
+ cp_test_ptype_class \
+ "ptype class vB" "" "class" "vB" \
+ {
+ { base "public virtual vA" }
+ { vbase "vA" }
+ { field public "int vb;" }
+ { field public "int vx;" }
}
- -re "type = class vC : public virtual vA \{${ws}public:${ws}int vc;${ws}int vx;$nl\}$nl$gdb_prompt $" {
- # gcc 3.3.2 -gdwarf-2
- # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2
- pass "ptype class vC"
- }
- -re "type = class vC : public virtual vA \{${ws}private:${ws}vA ?\\* ?_vb.vA;${ws}public:${ws}int vc;${ws}int vx;${ws}vC ?& ?operator ?=\\(vC const ?&\\);${ws}vC\\(int, ?vC const ?&\\);${ws}vC\\(int\\);$nl\}$nl$gdb_prompt $" {
- # gcc 2.95.3 -gstabs+
- # See the hidden "in-charge" ctor parameter!
- # TODO: kfail
- setup_xfail "*-*-*"
- fail "ptype class vC (FIXME: non-portable virtual table constructs)"
- }
- -re "type = class vC : public virtual vA \{${ws}public:${ws}int vc;${ws}int vx;${ws}vC ?& ?operator ?=\\(vC const ?&\\);${ws}vC\\(vC const ?&\\);${ws}vC\\((void|)\\);$nl\}$nl$gdb_prompt $" {
- # gcc 3.3.2 -gstabs+
- # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
- pass "ptype class vC"
- }
- }
- # The classic diamond inheritance.
+ # Another derived class with a virtual base.
- gdb_test_multiple "ptype class vD" "ptype class vD" {
- -re "type = class vD : public virtual vB, public virtual vC \{${ws}private:${ws}vC ?\\* ?_vb.2vC;${ws}vB ?\\* ?_vb.2vB;${ws}public:${ws}int vd;${ws}int vx;$nl\}$nl$gdb_prompt $" {
- # gcc 2.95.3 -gdwarf-2
- # TODO: kfail
- fail "ptype class vD"
- }
- -re "type = class vD : public virtual vB, public virtual vC \{${ws}public:${ws}int vd;${ws}int vx;$nl\}$nl$gdb_prompt $" {
- # gcc 3.3.2 -gdwarf-2
- # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2
- pass "ptype class vD"
- }
- -re "type = class vD : public virtual vB, public virtual vC \{${ws}private:${ws}vC ?\\* ?_vb.vC;${ws}vB ?\\* ?_vb.vB;${ws}public:${ws}int vd;${ws}int vx;${ws}vD ?& ?operator ?=\\(vD const ?&\\);${ws}vD\\(int, ?vD const ?&\\);${ws}vD\\(int\\);$nl\}$nl$gdb_prompt $" {
- # gcc 2.95.3 -gstabs+
- # See the hidden "in-charge" ctor parameter!
- # TODO: kfail
- setup_xfail "*-*-*"
- fail "ptype class vD (FIXME: non-portable virtual table constructs)"
- }
- -re "type = class vD : public virtual vB, public virtual vC \{${ws}public:${ws}int vd;${ws}int vx;${ws}vD ?& ?operator ?=\\(vD const ?&\\);${ws}vD\\(vD const ?&\\);${ws}vD\\((void|)\\);$nl\}$nl$gdb_prompt $" {
- # gcc 3.3.2 -gstabs+
- # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
- pass "ptype class vD"
+ cp_test_ptype_class \
+ "ptype class vC" "" "class" "vC" \
+ {
+ { base "public virtual vA" }
+ { vbase "vA" }
+ { field public "int vc;" }
+ { field public "int vx;" }
}
- }
- # One more case of virtual derivation.
+ # A classic diamond class.
- gdb_test_multiple "ptype class vE" "ptype class vE" {
- -re "type = class vE : public virtual vD \{${ws}private:${ws}vD ?\\* ?_vb.2vD;${ws}public:${ws}int ve;${ws}int vx;$nl\}$nl$gdb_prompt $" {
- # gcc 2.95.3 -gdwarf-2
- # TODO: kfail
- fail "ptype class vE"
- }
- -re "type = class vE : public virtual vD \{${ws}public:${ws}int ve;${ws}int vx;$nl\}$nl$gdb_prompt $" {
- # gcc 3.3.2 -gdwarf-2
- # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2
- pass "ptype class vE"
+ cp_test_ptype_class \
+ "ptype class vD" "" "class" "vD" \
+ {
+ { base "public virtual vB" }
+ { base "public virtual vC" }
+ { vbase "vC" }
+ { vbase "vB" }
+ { field public "int vd;" }
+ { field public "int vx;" }
}
- -re "type = class vE : public virtual vD \{${ws}private:${ws}vD ?\\* ?_vb.vD;${ws}public:${ws}int ve;${ws}int vx;${ws}vE ?& ?operator ?=\\(vE const ?&\\);${ws}vE\\(int, ?vE const ?&\\);${ws}vE\\(int\\);$nl\}$nl$gdb_prompt $" {
- # gcc 2.95.3 -gstabs+
- # See the hidden "in-charge" ctor parameter!
- # TODO: kfail
- setup_xfail "*-*-*"
- fail "ptype class vE (FIXME: non-portable virtual table constructs)"
- }
- -re "type = class vE : public virtual vD \{${ws}public:${ws}int ve;${ws}int vx;${ws}vE ?& ?operator ?=\\(vE const ?&\\);${ws}vE\\(vE const ?&\\);${ws}vE\\((void|)\\);$nl\}$nl$gdb_prompt $" {
- # gcc 3.3.2 -gstabs+
- # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
- pass "ptype class vE"
- }
- }
- # Another inheritance series.
+ # A class derived from a diamond class.
- gdb_test_multiple "ptype class Base1" "ptype class Base1" {
- -re "type = class Base1 \{${ws}public:${ws}int x;${ws}Base1\\(int\\);$nl\}$nl$gdb_prompt $" {
- # gcc 2.95.3 -gdwarf-2
- # gcc 3.3.2 -gdwarf-2
- # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2
- pass "ptype class Base1"
- }
- -re "type = class Base1 \{${ws}public:${ws}int x;${ws}Base1 ?& ?operator ?=\\(Base1 const ?&\\);${ws}Base1\\(Base1 const ?&\\);${ws}Base1\\(int\\);$nl\}$nl$gdb_prompt $" {
- # gcc 2.95.3 -gstabs+
- # gcc 3.3.2 -gstabs+
- pass "ptype class Base1"
- }
- -re "type = class Base1 \{${ws}public:${ws}int x;${ws}Base1\\(int\\);${ws}Base1 ?& ?operator ?=\\(Base1 const ?&\\);${ws}Base1\\(Base1 const ?&\\);$nl\}$nl$gdb_prompt $" {
- # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
- pass "ptype class Base1"
+ cp_test_ptype_class \
+ "ptype class vE" "" "class" "vE" \
+ {
+ { base "public virtual vD" }
+ { vbase "vD" }
+ { field public "int ve;" }
+ { field public "int vx;" }
}
- }
- # The second base class.
+ # Another inheritance series.
- gdb_test_multiple "ptype class Foo" "ptype class Foo" {
- -re "type = class Foo \{${ws}public:${ws}int x;${ws}int y;${ws}static int st;${ws}Foo\\(int, int\\);${ws}int operator ?!\\((void|)\\);${ws}operator int\\((void|)\\);${ws}int times\\(int\\);$nl\}$nl$gdb_prompt $" {
- # gcc 2.95.3 -gdwarf-2
- # gcc 3.3.2 -gdwarf-2
- # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2
- pass "ptype class Foo"
- }
- -re "type = class Foo \{${ws}public:${ws}int x;${ws}int y;${ws}static int st;${ws}Foo ?& ?operator ?=\\(Foo const ?&\\);${ws}Foo\\(Foo const ?&\\);${ws}Foo\\(int, int\\);${ws}int operator ?!\\((void|)\\);${ws}int operator int\\((void|)\\);${ws}int times\\(int\\);$nl\}$nl$gdb_prompt $" {
- # gcc 2.95.3 -gstabs+
- # TODO: "int operator int()" is a bug
- # kfail "gdb/1497" "ptype class Foo"
- pass "ptype class Foo"
+ # A base class.
+
+ cp_test_ptype_class \
+ "ptype class Base1" "" "class" "Base1" \
+ {
+ { field public "int x;" }
+ { method public "Base1(int);" }
+ }
+
+ # Another base class.
+
+ cp_test_ptype_class \
+ "ptype class Foo" "" "class" "Foo" \
+ {
+ { field public "int x;" }
+ { field public "int y;" }
+ { field public "static int st;" }
+ { method public "Foo(int, int);" }
+ { method public "int operator!();" }
+ { method public "operator int();" }
+ { method public "int times(int);" }
+ } \
+ "" \
+ {
+ {
+ "operator int();"
+ "int operator int();"
+ { setup_kfail "gdb/1497" "*-*-*" }
+ }
+ {
+ "operator int();"
+ "int operator int(void);"
+ { setup_kfail "gdb/1497" "*-*-*" }
+ }
}
- -re "type = class Foo \{${ws}public:${ws}int x;${ws}int y;${ws}static int st;${ws}Foo ?& ?operator ?=\\(Foo const ?&\\);${ws}Foo\\(Foo const ?&\\);${ws}Foo\\(int, int\\);${ws}int operator ?!\\((void|)\\);${ws}operator int\\((void|)\\);${ws}int times\\(int\\);$nl\}$nl$gdb_prompt $" {
- # gcc 3.3.2 -gstabs+
- pass "ptype class Foo"
- }
- -re "type = class Foo \{${ws}public:${ws}int x;${ws}int y;${ws}static int st;${ws}Foo\\(int, int\\);${ws}int operator ?!\\((void|)\\);${ws}operator int\\((void|)\\);${ws}int times\\(int\\);${ws}Foo ?& ?operator ?=\\(Foo const ?&\\);${ws}Foo\\(Foo const ?&\\);$nl\}$nl$gdb_prompt $" {
- # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
- pass "ptype class Foo"
- }
- }
# A multiple inheritance derived class.
- gdb_test_multiple "ptype class Bar" "ptype class Bar" {
- -re "type = class Bar : public Base1, public Foo \{${ws}public:${ws}int z;${ws}Bar\\(int, int, int\\);$nl\}$nl$gdb_prompt $" {
- # gcc 2.95.3 -gdwarf-2
- # gcc 3.3.2 -gdwarf-2
- # gcc HEAD 2003-12-28 21:08:30 UTC -gdwarf-2
- pass "ptype class Bar"
- }
- -re "type = class Bar : public Base1, public Foo \{${ws}public:${ws}int z;${ws}Bar ?& ?operator ?=\\(Bar const ?&\\);${ws}Bar\\(Bar const ?&\\);${ws}Bar\\(int, int, int\\);$nl\}$nl$gdb_prompt $" {
- # gcc 2.95.3 -gstabs+
- # gcc 3.3.2 -gstabs+
- pass "ptype class Bar"
+ cp_test_ptype_class \
+ "ptype class Bar" "" "class" "Bar" \
+ {
+ { base "public Base1" }
+ { base "public Foo" }
+ { field public "int z;" }
+ { method public "Bar(int, int, int);" }
}
- -re "type = class Bar : public Base1, public Foo \{${ws}public:${ws}int z;${ws}Bar\\(int, int, int\\);${ws}Bar ?& ?operator ?=\\(Bar const ?&\\);${ws}Bar\\(Bar const ?&\\);$nl\}$nl$gdb_prompt $" {
- # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
- pass "ptype class Bar"
- }
- }
+
}
# Test simple access to class members.
-# TODO: these test names are gross!
-# Just let the test name default.
proc test_non_inherited_member_access {} {
- global gdb_prompt
# Print non-inherited members of g_A.
- gdb_test "print g_A.a" ".* = 1" "g_A.a incorrect"
- gdb_test "print g_A.x" ".* = 2" "g_A.x incorrect"
+ gdb_test "print g_A.a" ".* = 1"
+ gdb_test "print g_A.x" ".* = 2"
# Print non-inherited members of g_B.
- gdb_test "print g_B.b" ".* = 5" "g_B.b incorrect"
- gdb_test "print g_B.x" ".* = 6" "g_B.x incorrect"
+ gdb_test "print g_B.b" ".* = 5"
+ gdb_test "print g_B.x" ".* = 6"
# Print non-inherited members of g_C.
- gdb_test "print g_C.c" ".* = 9" "g_C.c incorrect"
- gdb_test "print g_C.x" ".* = 10" "g_C.x incorrect"
+ gdb_test "print g_C.c" ".* = 9"
+ gdb_test "print g_C.x" ".* = 10"
# Print non-inherited members of g_D.
- gdb_test "print g_D.d" ".* = 19" "g_D.d incorrect"
- gdb_test "print g_D.x" ".* = 20" "g_D.x incorrect"
+ gdb_test "print g_D.d" ".* = 19"
+ gdb_test "print g_D.x" ".* = 20"
# Print non-inherited members of g_E.
- gdb_test "print g_E.e" ".* = 31" "g_E.e incorrect"
- gdb_test "print g_E.x" ".* = 32" "g_E.x incorrect"
+ gdb_test "print g_E.e" ".* = 31"
+ gdb_test "print g_E.x" ".* = 32"
}
# Test access to members of other classes.
# gdb should refuse to print them.
# (I feel old -- I remember when this was legal in C -- chastain).
-# TODO: Again, change the silly test names.
proc test_wrong_class_members {} {
- global gdb_prompt
-
- gdb_test "print g_A.b" "There is no member( or method|) named b." "print g_A.b should be error"
- gdb_test "print g_B.c" "There is no member( or method|) named c." "print g_B.c should be error"
- gdb_test "print g_B.d" "There is no member( or method|) named d." "print g_B.d should be error"
- gdb_test "print g_C.b" "There is no member( or method|) named b." "print g_C.b should be error"
- gdb_test "print g_C.d" "There is no member( or method|) named d." "print g_C.d should be error"
- gdb_test "print g_D.e" "There is no member( or method|) named e." "print g_D.e should be error"
+ gdb_test "print g_A.b" "There is no member( or method|) named b."
+ gdb_test "print g_B.c" "There is no member( or method|) named c."
+ gdb_test "print g_B.d" "There is no member( or method|) named d."
+ gdb_test "print g_C.b" "There is no member( or method|) named b."
+ gdb_test "print g_C.d" "There is no member( or method|) named d."
+ gdb_test "print g_D.e" "There is no member( or method|) named e."
}
# Test access to names that are not members of any class.
-# TODO: test names again.
proc test_nonexistent_members {} {
- global gdb_prompt
-
- gdb_test "print g_A.y" "There is no member( or method|) named y." "print g_A.y should be error"
- gdb_test "print g_B.z" "There is no member( or method|) named z." "print g_B.z should be error"
- gdb_test "print g_C.q" "There is no member( or method|) named q." "print g_C.q should be error"
- gdb_test "print g_D.p" "There is no member( or method|) named p." "print g_D.p should be error"
+ gdb_test "print g_A.y" "There is no member( or method|) named y."
+ gdb_test "print g_B.z" "There is no member( or method|) named z."
+ gdb_test "print g_C.q" "There is no member( or method|) named q."
+ gdb_test "print g_D.p" "There is no member( or method|) named p."
}
# Call a method that expects a base class parameter with base, inherited,
# and unrelated class arguments.
proc test_method_param_class {} {
- gdb_test "call class_param.Aptr_a (&g_A)" ".* = 1" "base class param->a"
- gdb_test "call class_param.Aptr_x (&g_A)" ".* = 2" "base class param->x"
- gdb_test "call class_param.Aptr_a (&g_B)" ".* = 3" "inherited class param->a"
- gdb_test "call class_param.Aptr_x (&g_B)" ".* = 4" "inherited class param->x"
- gdb_test "call class_param.Aref_a (g_A)" ".* = 1" "base class (&param)->a"
- gdb_test "call class_param.Aref_x (g_A)" ".* = 2" "base class (&param)->x"
- gdb_test "call class_param.Aref_a (g_B)" ".* = 3" "inherited class (&param)->a"
- gdb_test "call class_param.Aref_x (g_B)" ".* = 4" "inherited class (&param)->x"
- gdb_test "call class_param.Aval_a (g_A)" ".* = 1" "base class param.a"
- gdb_test "call class_param.Aval_x (g_A)" ".* = 2" "base class param.x"
- gdb_test "call class_param.Aval_a (g_B)" ".* = 3" "inherited class param.a"
- gdb_test "call class_param.Aval_x (g_B)" ".* = 4" "inherited class param.x"
+ gdb_test "call class_param.Aptr_a (&g_A)" ".* = 1"
+ gdb_test "call class_param.Aptr_x (&g_A)" ".* = 2"
+ gdb_test "call class_param.Aptr_a (&g_B)" ".* = 3"
+ gdb_test "call class_param.Aptr_x (&g_B)" ".* = 4"
+ gdb_test "call class_param.Aref_a (g_A)" ".* = 1"
+ gdb_test "call class_param.Aref_x (g_A)" ".* = 2"
+ gdb_test "call class_param.Aref_a (g_B)" ".* = 3"
+ gdb_test "call class_param.Aref_x (g_B)" ".* = 4"
+ gdb_test "call class_param.Aval_a (g_A)" ".* = 1"
+ gdb_test "call class_param.Aval_x (g_A)" ".* = 2"
+ gdb_test "call class_param.Aval_a (g_B)" ".* = 3"
+ gdb_test "call class_param.Aval_x (g_B)" ".* = 4"
gdb_test "call class_param.Aptr_a (&foo)" "Cannot resolve .*" "unrelated class *param"
gdb_test "call class_param.Aref_a (foo)" "Cannot resolve .*" "unrelated class &param"
@@ -621,7 +391,6 @@ proc test_method_param_class {} {
proc test_enums {} {
global gdb_prompt
global nl
- global ws
# print the object
@@ -670,37 +439,30 @@ proc test_enums {} {
}
# ptype on the object
- gdb_test_multiple "ptype obj_with_enum" "ptype obj_with_enum" {
- -re "type = class ClassWithEnum \{${ws}public:${ws}(enum |)ClassWithEnum::PrivEnum priv_enum;${ws}int x;$nl\}$nl$gdb_prompt $" {
- pass "ptype obj_with_enum"
- }
- -re "type = class ClassWithEnum \{${ws}public:${ws}(enum |)PrivEnum priv_enum;${ws}int x;$nl\}$nl$gdb_prompt $" {
- # NOTE: carlton/2003-02-28: One could certainly argue that
- # this output is acceptable: PrivEnum is a member of
- # ClassWithEnum, so there's no need to explicitly qualify
- # its name with "ClassWithEnum::". The truth, though, is
- # that GDB is simply forgetting that PrivEnum is a member
- # of ClassWithEnum, so we do that output for a bad reason
- # instead of a good reason. Under stabs, we probably
- # can't get this right; under DWARF-2, we can.
- #
- # gcc 2.95.3 -gdwarf-2
- # gcc 3.3.2 -gdwarf-2
- kfail "gdb/57" "ptype obj_with_enum"
- }
- -re "type = class ClassWithEnum \{${ws}public:${ws}(enum |)PrivEnum priv_enum;${ws}int x;${ws}ClassWithEnum ?& ?operator ?=\\(ClassWithEnum const ?&\\);${ws}ClassWithEnum\\(ClassWithEnum const ?&\\);${ws}ClassWithEnum\\((void|)\\);$nl\}$nl$gdb_prompt $" {
- # gcc 2.95.3 -gstabs+
- kfail "gdb/57" "ptype obj_with_enum"
- }
- -re "type = class ClassWithEnum \{${ws}public:${ws}(enum |)ClassWithEnum::PrivEnum priv_enum;${ws}int x;${ws}ClassWithEnum ?& ?operator ?=\\(ClassWithEnum const ?&\\);${ws}ClassWithEnum\\(ClassWithEnum const ?&\\);${ws}ClassWithEnum\\((void|)\\);$nl\}$nl$gdb_prompt $" {
- # I think this is a PASS, but only carlton knows for sure.
- # -- chastain 2003-12-30
- #
- # gcc 3.3.2 -gstabs+
- # gcc HEAD 2003-12-28 21:08:30 UTC -gstabs+
- fail "ptype obj_with_enum"
+
+ # NOTE: carlton/2003-02-28: One could certainly argue that plain
+ # "PrivEnum"
+ # is acceptable: PrivEnum is a member of ClassWithEnum, so
+ # there's no need to explicitly qualify its name with
+ # "ClassWithEnum::". The truth, though, is that GDB is simply
+ # forgetting that PrivEnum is a member of ClassWithEnum, so we do
+ # that output for a bad reason instead of a good reason. Under
+ # stabs, we probably can't get this right; under DWARF-2, we can.
+
+ cp_test_ptype_class \
+ "ptype obj_with_enum" "" "class" "ClassWithEnum" \
+ {
+ { field public "ClassWithEnum::PrivEnum priv_enum;" }
+ { field public "int x;" }
+ } \
+ "" \
+ {
+ {
+ "ClassWithEnum::PrivEnum priv_enum;"
+ "PrivEnum priv_enum;"
+ { setup_kfail "gdb/57" "*-*-*" }
+ }
}
- }
# I'll do this test two different ways, because of a parser bug.
# See PR gdb/1588.
@@ -735,8 +497,6 @@ proc test_enums {} {
# Pointers to class members
proc test_pointers_to_class_members {} {
- global gdb_prompt
-
gdb_test "print Bar::z" "\\$\[0-9\]+ = \\(int ?\\( ?Bar::& ?\\) ?\\) ?Bar::z"
gdb_test "print &Foo::x" "\\$\[0-9\]+ = \\(int ?\\( ?Foo::\\* ?\\) ?\\) ?&Foo::x"
gdb_test "print (int)&Foo::x" "\\$\[0-9\]+ = 0"
@@ -753,7 +513,6 @@ proc test_pointers_to_class_members {} {
# Test static members.
proc test_static_members {} {
- global gdb_prompt
global hex
gdb_test "print Foo::st" "\\$\[0-9\]+ = 100"
@@ -860,11 +619,6 @@ proc do_tests {} {
fail "calling method for small class"
}
}
-
- # This is a random v2 demangling test.
- # This is redundant with existing tests in demangle.exp.
- # TODO: Just remove this.
- gdb_test "maint demangle inheritance1__Fv" "inheritance1\\(void\\)" "demangle"
}
do_tests
diff --git a/gdb/testsuite/gdb.cp/ctti.exp b/gdb/testsuite/gdb.cp/ctti.exp
index a2a2e0a3245..de1ee3496d9 100644
--- a/gdb/testsuite/gdb.cp/ctti.exp
+++ b/gdb/testsuite/gdb.cp/ctti.exp
@@ -29,33 +29,33 @@ if $tracelevel then {
if { [skip_cplus_tests] } { continue }
set testfile "cttiadd"
-set srcfile "${srcdir}/${subdir}/${testfile}.cc"
-set srcfile1 "${srcdir}/${subdir}/${testfile}1.cc"
-set srcfile2 "${srcdir}/${subdir}/${testfile}2.cc"
-set srcfile3 "${srcdir}/${subdir}/${testfile}3.cc"
-set objfile "${objdir}/${subdir}/${testfile}.o"
-set objfile1 "${objdir}/${subdir}/${testfile}1.o"
-set objfile2 "${objdir}/${subdir}/${testfile}2.o"
-set objfile3 "${objdir}/${subdir}/${testfile}3.o"
+set srcfile "${testfile}.cc"
+set srcfile1 "${testfile}1.cc"
+set srcfile2 "${testfile}2.cc"
+set srcfile3 "${testfile}3.cc"
+set objfile "${testfile}.o"
+set objfile1 "${testfile}1.o"
+set objfile2 "${testfile}2.o"
+set objfile3 "${testfile}3.o"
set binfile "${objdir}/${subdir}/${testfile}"
-if { [gdb_compile "${srcfile}" "${objfile}" object {debug c++}] != "" } {
+if { [gdb_compile "$srcdir/$subdir/$srcfile" "$objdir/$subdir/$objfile" object {debug c++}] != "" } {
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
-if { [gdb_compile "${srcfile1}" "${objfile1}" object {debug c++}] != "" } {
+if { [gdb_compile "$srcdir/$subdir/$srcfile1" "$objdir/$subdir/$objfile1" object {debug c++}] != "" } {
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
-if { [gdb_compile "${srcfile2}" "${objfile2}" object {debug c++}] != "" } {
+if { [gdb_compile "$srcdir/$subdir/$srcfile2" "$objdir/$subdir/$objfile2" object {debug c++}] != "" } {
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
-if { [gdb_compile "${srcfile3}" "${objfile3}" object {debug c++}] != "" } {
+if { [gdb_compile "$srcdir/$subdir/$srcfile3" "$objdir/$subdir/$objfile3" object {debug c++}] != "" } {
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
-if { [gdb_compile "${objfile} ${objfile1} ${objfile2} ${objfile3}" "${binfile}" executable {debug c++}] != "" } {
+if { [gdb_compile "$objdir/$subdir/$objfile $objdir/$subdir/$objfile1 $objdir/$subdir/$objfile2 $objdir/$subdir/$objfile3" "${binfile}" executable {debug c++}] != "" } {
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
diff --git a/gdb/testsuite/gdb.cp/derivation.exp b/gdb/testsuite/gdb.cp/derivation.exp
index d82ab1f6cf9..6c98d3ce5a4 100644
--- a/gdb/testsuite/gdb.cp/derivation.exp
+++ b/gdb/testsuite/gdb.cp/derivation.exp
@@ -38,6 +38,8 @@ set bug_id 0
if { [skip_cplus_tests] } { continue }
+load_lib "cp-support.exp"
+
set testfile "derivation"
set srcfile ${testfile}.cc
set binfile ${objdir}/${subdir}/${testfile}
@@ -61,124 +63,91 @@ if ![runto 'marker1'] then {
gdb_test "up" ".*main.*" "up from marker1"
# Print class types and values.
-# See virtfunc.exp for a discussion of ptype.
# class A
-set re_class "((struct|class) A \{${ws}public:|struct A \{)"
-set re_fields "int a;${ws}int aa;"
-set re_methods "A\\((void|)\\);${ws}int afoo\\((void|)\\);${ws}int foo\\((void|)\\);"
-set re_synth_gcc_23 "A & operator=\\(A const ?&\\);${ws}A\\(A const ?&\\);"
-set re_all_methods "($re_methods|$re_methods${ws}$re_synth_gcc_23|$re_synth_gcc_23${ws}$re_methods)"
-
gdb_test "print a_instance" "\\$\[0-9\]+ = \{a = 1, aa = 2\}" "print value of a_instance"
-gdb_test_multiple "ptype a_instance" "ptype a_instance" {
- -re "type = $re_class${ws}$re_fields${ws}$re_methods$nl\}$nl$gdb_prompt $" {
- pass "ptype a_instance (no synth ops)"
- }
- -re "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23${ws}$re_methods${ws}$nl\}$nl$gdb_prompt $" {
- pass "ptype a_instance (with synth ops)"
+cp_test_ptype_class \
+ "ptype a_instance" "" "class" "A" \
+ {
+ { field public "int a;" }
+ { field public "int aa;" }
+ { method public "A();" }
+ { method public "int afoo();" }
+ { method public "int foo();" }
}
- -re "type = $re_class${ws}$re_fields${ws}$re_methods${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" {
- pass "ptype a_instance (with synth ops)"
- }
-}
# class D
-set re_class "class D : private A, public B, protected C \{${ws}public:"
-set XX_class "class D : private A, public B, private C \{${ws}public:"
-set re_fields "int d;${ws}int dd;"
-set re_methods "D\\((void|)\\);${ws}int dfoo\\((void|)\\);${ws}int foo\\((void|)\\);"
-set re_synth_gcc_23 "D & operator=\\(D const ?&\\);${ws}D\\(D const ?&\\);"
-set re_all_methods "($re_methods|$re_methods${ws}$re_synth_gcc_23|$re_synth_gcc_23${ws}$re_methods)"
-
gdb_test_multiple "print d_instance" "print value of d_instance" {
-re "\\$\[0-9\]+ = \{<(class A|A)> = \{a = 1, aa = 2\}, <(class B|B)> = \{b = 3, bb = 4\}, <(class C|C)> = \{c = 5, cc = 6\}, d = 7, dd = 8\}$nl$gdb_prompt $" {
pass "print value of d_instance"
}
}
-gdb_test_multiple "ptype d_instance" "ptype d_instance" {
- -re "type = $re_class${ws}$re_fields${ws}$re_methods${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" {
- pass "ptype d_instance"
- }
- -re "type = $re_class${ws}$re_fields${ws}$re_all_methods$nl\}$nl$gdb_prompt $" {
- pass "ptype d_instance"
- }
- -re "type = $XX_class${ws}$re_fields${ws}$re_methods${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" {
- # This is a gcc bug, gcc/13539, gdb/1498.
- # Fixed in gcc HEAD 2004-01-13
- setup_xfail "*-*-*" "gcc/13539"
- fail "ptype d_instance"
- }
- -re "type = $XX_class${ws}$re_fields${ws}$re_all_methods$nl\}$nl$gdb_prompt $" {
- # This is a gcc bug, gcc/13539, gdb/1498.
- # Fixed in gcc HEAD 2004-01-13
- setup_xfail "*-*-*" "gcc/13539"
- fail "ptype d_instance"
+cp_test_ptype_class \
+ "ptype d_instance" "" "class" "D" \
+ {
+ { base "private A" }
+ { base "public B" }
+ { base "protected C" }
+ { field public "int d;" }
+ { field public "int dd;" }
+ { method public "D();" }
+ { method public "int dfoo();" }
+ { method public "int foo();" }
+ } \
+ "" \
+ {
+ { "protected C" "private C" { setup_xfail "*-*-*" "gcc/13539" } }
}
-}
# class E
-set re_class "class E : public A, private B, protected C \{${ws}public:"
-set XX_class "class E : public A, private B, private C \{${ws}public:"
-set re_fields "int e;${ws}int ee;"
-set re_methods "E\\((void|)\\);${ws}int efoo\\((void|)\\);${ws}int foo\\((void|)\\);"
-set re_synth_gcc_23 "E & operator=\\(E const ?&\\);${ws}E\\(E const ?&\\);"
-set re_all_methods "($re_methods|$re_methods${ws}$re_synth_gcc_23|$re_synth_gcc_23${ws}$re_methods)"
-
gdb_test_multiple "print e_instance" "print value of e_instance" {
-re "\\$\[0-9\]+ = \{<(class A|A)> = \{a = 1, aa = 2\}, <(class B|B)> = \{b = 3, bb = 4\}, <(class C|C)> = \{c = 5, cc = 6\}, e = 9, ee = 10\}$nl$gdb_prompt $" {
pass "print value of e_instance"
}
}
-gdb_test_multiple "ptype e_instance" "ptype e_instance" {
- -re "type = $re_class${ws}$re_fields${ws}$re_methods${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" {
- pass "ptype e_instance"
- }
- -re "type = $re_class${ws}$re_fields${ws}$re_all_methods$nl\}$nl$gdb_prompt $" {
- pass "ptype e_instance"
- }
- -re "type = $XX_class${ws}$re_fields${ws}$re_methods${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" {
- # This is a gcc bug, gcc/13539, gdb/1498.
- # Fixed in gcc HEAD 2004-01-13
- setup_xfail "*-*-*" "gcc/13539"
- fail "ptype e_instance"
- }
- -re "type = $XX_class${ws}$re_fields${ws}$re_all_methods$nl\}$nl$gdb_prompt $" {
- # This is a gcc bug, gcc/13539, gdb/1498.
- # Fixed in gcc HEAD 2004-01-13
- setup_xfail "*-*-*" "gcc/13539"
- fail "ptype e_instance"
+cp_test_ptype_class \
+ "ptype e_instance" "" "class" "E" \
+ {
+ { base "public A" }
+ { base "private B" }
+ { base "protected C" }
+ { field public "int e;" }
+ { field public "int ee;" }
+ { method public "E();" }
+ { method public "int efoo();" }
+ { method public "int foo();" }
+ } \
+ "" \
+ {
+ { "protected C" "private C" { setup_xfail "*-*-*" "gcc/13539" } }
}
-}
# class F
-set re_class "class F : private A, public B, private C \{${ws}public:"
-set re_fields "int f;${ws}int ff;"
-set re_methods "F\\((void|)\\);${ws}int ffoo\\((void|)\\);${ws}int foo\\((void|)\\);"
-set re_synth_gcc_23 "F & operator=\\(F const ?&\\);${ws}F\\(F const ?&\\);"
-set re_all_methods "($re_methods|$re_methods${ws}$re_synth_gcc_23|$re_synth_gcc_23${ws}$re_methods)"
-
gdb_test_multiple "print f_instance" "print value of f_instance" {
-re "\\$\[0-9\]+ = \{<(class A|A)> = \{a = 1, aa = 2\}, <(class B|B)> = \{b = 3, bb = 4\}, <(class C|C)> = \{c = 5, cc = 6\}, f = 11, ff = 12\}$nl$gdb_prompt $" {
pass "print value of f_instance"
}
}
-gdb_test_multiple "ptype f_instance" "ptype f_instance" {
- -re "type = $re_class${ws}$re_fields${ws}$re_methods${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" {
- pass "ptype f_instance"
+cp_test_ptype_class \
+ "ptype f_instance" "" "class" "F" \
+ {
+ { base "private A" }
+ { base "public B" }
+ { base "private C" }
+ { field public "int f;" }
+ { field public "int ff;" }
+ { method public "F();" }
+ { method public "int ffoo();" }
+ { method public "int foo();" }
}
- -re "type = $re_class${ws}$re_fields${ws}$re_all_methods$nl\}$nl$gdb_prompt $" {
- pass "ptype f_instance"
- }
-}
# Print individual fields.
diff --git a/gdb/testsuite/gdb.cp/inherit.exp b/gdb/testsuite/gdb.cp/inherit.exp
index 72de1ac33a7..9ae1c1e2f3a 100644
--- a/gdb/testsuite/gdb.cp/inherit.exp
+++ b/gdb/testsuite/gdb.cp/inherit.exp
@@ -28,6 +28,8 @@ if $tracelevel then {
if { [skip_cplus_tests] } { continue }
+load_lib "cp-support.exp"
+
set testfile "inherit"
set srcfile misc.cc
set binfile ${objdir}/${subdir}/${testfile}
@@ -43,127 +45,44 @@ proc test_ptype_si { } {
global ws
global nl
- # Print class A as a type.
-
- 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 = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" {
- pass $name
- }
- }
-
- # Print class A as an explicit class.
-
- 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 = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" {
- pass $name
- }
- }
-
- # Print type of an object of type A.
-
- 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 = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" {
- pass $name
- }
- }
-
- # Print class B as a type.
-
- 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.
-
- 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.
+ # A simple class.
- 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
+ cp_test_ptype_class \
+ "ptype A" "ptype A (FIXME)" "class" "A" \
+ {
+ { field public "int a;" }
+ { field public "int x;" }
}
- }
-
- # Print class C as a type.
+ cp_test_ptype_class "ptype class A" "ptype class A (FIXME)" "class" "A" ibid
+ cp_test_ptype_class "ptype g_A" "ptype g_A (FIXME)" "class" "A" ibid
- 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|)\\);"
+ # A derived class.
- 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.
-
- 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
+ cp_test_ptype_class \
+ "ptype B" "" "class" "B" \
+ {
+ { base "public A" }
+ { field public "int b;" }
+ { field public "int x;" }
}
- }
+ cp_test_ptype_class "ptype class B" "" "class" "B" ibid
+ cp_test_ptype_class "ptype g_B" "" "class" "B" ibid
- # Print type of an object of type g_C.
+ # Another derived class.
- 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
+ cp_test_ptype_class \
+ "ptype C" "" "class" "C" \
+ {
+ { base "public A" }
+ { field public "int c;" }
+ { field public "int x;" }
}
- }
+ cp_test_ptype_class "ptype class C" "" "class" "C" ibid
+ cp_test_ptype_class "ptype g_C" "" "class" "C" ibid
- # Print a structure with no tag.
+ # A structure with no tag.
+ # TODO: move this mess into a separate file, and re-specify
+ # which results are PASS, KFAIL, XFAIL, and FAIL.
set re_tag "tagless_struct"
set XX_tag "\\._1"
@@ -177,20 +96,22 @@ proc test_ptype_si { } {
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)"
+ pass "$name"
}
-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)"
+ pass "$name"
}
-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)"
+ # gcc 3.3.4 -gdwarf-2
+ # gcc 3.4.1 -gdwarf-2
+ # gcc HEAD 2004-07-31 -gdwarf-2
+ # gcc HEAD 2004-07-31 -gstabs+
+ pass "$name"
}
-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+
+ # gcc 3.3.4 -gstabs+
+ # gcc 3.4.1 -gstabs+
pass "$name"
}
}
@@ -199,20 +120,22 @@ proc test_ptype_si { } {
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)"
+ pass "$name"
}
-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)"
+ pass "$name"
}
-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)"
+ # gcc 3.3.4 -gdwarf-2
+ # gcc 3.4.1 -gdwarf-2
+ # gcc HEAD 2004-07-31 -gdwarf-2
+ # gcc HEAD 2004-07-31 -gstabs+
+ pass "$name"
}
-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+
+ # gcc 3.3.4 -gstabs+
+ # gcc 3.4.1 -gstabs+
pass "$name"
}
}
@@ -221,433 +144,108 @@ proc test_ptype_si { } {
# Multiple inheritance, print type definitions.
proc test_ptype_mi { } {
- global gdb_prompt
- global ws
- global nl
-
- 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 "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" {
- pass $name
- }
- }
-
- 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
- }
- -re "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" {
- pass $name
- }
- }
-
- 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.
+ # A class with two bases.
- 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 = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" {
- pass $name
+ cp_test_ptype_class \
+ "ptype D" "" "class" "D" \
+ {
+ { base "public B" }
+ { base "public C" }
+ { field public "int d;" }
+ { field public "int x;" }
}
- }
+ cp_test_ptype_class "ptype class D" "" "class" "D" ibid
+ cp_test_ptype_class "ptype g_D" "" "class" "D" ibid
- 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 = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" {
- pass $name
- }
- }
+ # A class derived from the previous class.
- 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
- }
- -re "type = $re_class${ws}$re_fields${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" {
- pass $name
+ cp_test_ptype_class \
+ "ptype E" "" "class" "E" \
+ {
+ { base "public D" }
+ { field public "int e;" }
+ { field public "int x;" }
}
- }
+ cp_test_ptype_class "ptype class E" "" "class" "E" ibid
+ cp_test_ptype_class "ptype g_E" "" "class" "E" ibid
}
# Single virtual inheritance, print type definitions.
proc test_ptype_vi { } {
- global gdb_prompt
- global ws
- global nl
-
- # ptype vA: type, class, object.
- 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|)\\);"
+ # class vA
- 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
+ cp_test_ptype_class \
+ "ptype vA" "" "class" "vA" \
+ {
+ { field public "int va;" }
+ { field public "int vx;" }
}
- }
+ cp_test_ptype_class "ptype class vA" "" "class" "vA" ibid
+ cp_test_ptype_class "ptype g_vA" "" "class" "vA" ibid
- 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
- }
- }
+ # class vB
- 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
+ cp_test_ptype_class \
+ "ptype vB" "" "class" "vB" \
+ {
+ { base "public virtual vA" }
+ { vbase "vA" }
+ { field public "int vb;" }
+ { field public "int vx;" }
}
- }
-
- # ptype vB: type, class, object.
+ cp_test_ptype_class "ptype class vB" "" "class" "vB" ibid
+ cp_test_ptype_class "ptype g_vB" "" "class" "vB" ibid
- 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|)\\);"
+ # class vC
- 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)"
+ cp_test_ptype_class \
+ "ptype vC" "" "class" "vC" \
+ {
+ { base "public virtual vA" }
+ { vbase "vA" }
+ { field public "int vc;" }
+ { field public "int vx;" }
}
- -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)"
- }
- }
+ cp_test_ptype_class "ptype class vC" "" "class" "vC" ibid
+ cp_test_ptype_class "ptype g_vC" "" "class" "vC" ibid
- 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)"
- }
- }
-
- 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)"
- }
- }
-
- # ptype vC: type, class, object.
-
- 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|)\\);"
-
- 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 "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)"
- }
- }
-
- 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 "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)"
- }
- }
-
- 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)"
- }
- }
}
# Multiple virtual inheritance, print type definitions.
proc test_ptype_mvi { } {
- global gdb_prompt
- global ws
- global nl
-
- # ptype vD: type, class, object.
- 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|)\\);"
+ # class vD
- 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 "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"
+ cp_test_ptype_class \
+ "ptype vD" "" "class" "vD" \
+ {
+ { base "public virtual vB" }
+ { base "public virtual vC" }
+ { vbase "vC" }
+ { vbase "vB" }
+ { field public "int vd;" }
+ { field public "int vx;" }
}
- -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"
- }
- }
+ cp_test_ptype_class "ptype class vD" "" "class" "vD" ibid
+ cp_test_ptype_class "ptype g_vD" "" "class" "vD" ibid
- 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 "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"
- }
- }
+ # class vE
- 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"
- }
- }
-
- # ptype vE: type, class, object.
-
- 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|)\\);"
-
- 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
+ cp_test_ptype_class \
+ "ptype vE" "" "class" "vE" \
+ {
+ { base "public virtual vD" }
+ { vbase "vD" }
+ { field public "int ve;" }
+ { field public "int vx;" }
}
- -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"
- }
- }
+ cp_test_ptype_class "ptype class vE" "" "class" "vE" ibid
+ cp_test_ptype_class "ptype g_vE" "" "class" "vE" ibid
- 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"
- }
- }
-
- 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"
- }
- }
}
# Single inheritance, print individual members.
@@ -812,20 +410,20 @@ proc test_print_anon_union {} {
}
}
- 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|)\\);"
+ # The nested union prints as a multi-line field, but the class body
+ # scanner is inherently line-oriented. This is ugly but it works.
- 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 "type = $re_class${ws}$re_fields${ws}$re_anon_union${ws}$re_synth_gcc_23$nl\}$nl$gdb_prompt $" {
- pass $name
+ cp_test_ptype_class \
+ "ptype g_anon_union" "print type of anonymous union" \
+ "class" "class_with_anon_union" \
+ {
+ { field public "int one;" }
+ { field public "union \{" }
+ { field public "int a;" }
+ { field public "long int b;" }
+ { field public "\};" }
}
- }
+
}
@@ -888,13 +486,18 @@ proc test_print_svi_classes { } {
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+
+ # gcc 3.3.4 -gdwarf-2
+ # gcc 3.4.1 -gdwarf-2
+ # gcc 3.4.1 -gstabs+
+ # gcc HEAD 2004-07-31 -gdwarf-2
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+
+ # gcc 3.3.4 -gstabs+
+ pass $name
+ }
+ -re "$vhn = \{<vA> = \{va = 3, vx = 4\}, $re_vbptr_3 = $hex <typeinfo for vB>, vb = 5, vx = 6\}$nl$gdb_prompt $" {
+ # gcc HEAD 2004-07-31 -gstabs+
pass $name
}
}
@@ -911,13 +514,18 @@ proc test_print_svi_classes { } {
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+
+ # gcc 3.3.4 -gdwarf-2
+ # gcc 3.4.1 -gdwarf-2
+ # gcc 3.4.1 -gstabs+
+ # gcc HEAD 2004-07-31 -gdwarf-2
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+
+ # gcc 3.3.4 -gstabs+
+ pass $name
+ }
+ -re "$vhn = \{<vA> = \{va = 7, vx = 8\}, $re_vbptr_3 = $hex <typeinfo for vC>, vc = 9, vx = 10\}$nl$gdb_prompt $" {
+ # gcc HEAD 2004-07-31 -gstabs+
pass $name
}
}
@@ -1003,15 +611,20 @@ proc test_print_mvi_classes { } {
pass $name
}
-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+
+ # gcc 3.3.4 -gdwarf-2
+ # gcc 3.3.4 -gstabs+
+ # gcc 3.4.1 -gdwarf-2
+ # gcc 3.4.1 -gstabs+
+ # gcc HEAD 2004-07-31 -gdwarf-2
pass "$name (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)"
+ pass $name
+ }
+ -re "$vhn = \{<vD> = \{<vB> = \{<vA> = \{va = 0, vx = 0\}, $re_vbptr_3_vB = $hex, vb = 0, vx = 0\}, <vC> = \{$re_vbptr_3_vC = $hex <typeinfo for vE>, 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 HEAD 2004-07-31 -gstabs+
+ pass $name
}
}
}
diff --git a/gdb/testsuite/gdb.cp/m-static.exp b/gdb/testsuite/gdb.cp/m-static.exp
index 56cd7bc3bfc..7963a101686 100644
--- a/gdb/testsuite/gdb.cp/m-static.exp
+++ b/gdb/testsuite/gdb.cp/m-static.exp
@@ -33,21 +33,21 @@ set prms_id 0
set bug_id 0
set testfile "m-static"
-set srcfile "${srcdir}/${subdir}/${testfile}.cc"
-set srcfile1 "${srcdir}/${subdir}/${testfile}1.cc"
-set objfile "${objdir}/${subdir}/${testfile}.o"
-set objfile1 "${objdir}/${subdir}/${testfile}1.o"
+set srcfile "${testfile}.cc"
+set srcfile1 "${testfile}1.cc"
+set objfile "${testfile}.o"
+set objfile1 "${testfile}1.o"
set binfile "${objdir}/${subdir}/${testfile}"
-if { [gdb_compile "${srcfile}" "${objfile}" object {debug c++}] != "" } {
+if { [gdb_compile "$srcdir/$subdir/$srcfile" "$objdir/$subdir/$objfile" object {debug c++}] != "" } {
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
-if { [gdb_compile "${srcfile1}" "${objfile1}" object {debug c++}] != "" } {
+if { [gdb_compile "$srcdir/$subdir/$srcfile1" "$objdir/$subdir/$objfile1" object {debug c++}] != "" } {
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
-if { [gdb_compile "${objfile} ${objfile1}" "${binfile}" executable {debug c++}] != "" } {
+if { [gdb_compile "$objdir/$subdir/$objfile $objdir/$subdir/$objfile1" "${binfile}" executable {debug c++}] != "" } {
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
diff --git a/gdb/testsuite/gdb.cp/namespace.exp b/gdb/testsuite/gdb.cp/namespace.exp
index 4b3f1e255c7..4d295894986 100644
--- a/gdb/testsuite/gdb.cp/namespace.exp
+++ b/gdb/testsuite/gdb.cp/namespace.exp
@@ -254,8 +254,8 @@ gdb_test "print E::ce" "No symbol \"ce\" in namespace \"C::D::E\"."
gdb_test "ptype C" "type = namespace C::C"
gdb_test "ptype E" "type = namespace C::D::E"
-gdb_test "ptype CClass" "type = class C::CClass \{\r\n public:\r\n int x;\r\n\}"
-gdb_test "ptype CClass::NestedClass" "type = class C::CClass::NestedClass \{\r\n public:\r\n int y;\r\n\}"
+gdb_test "ptype CClass" "type = (class C::CClass \{\r\n public:|struct C::CClass \{)\r\n int x;\r\n\}"
+gdb_test "ptype CClass::NestedClass" "type = (class C::CClass::NestedClass \{\r\n public:|struct C::CClass::NestedClass \{)\r\n int y;\r\n\}"
gdb_test "ptype NestedClass" "No symbol \"NestedClass\" in current context."
setup_kfail "gdb/1448" "*-*-*"
gdb_test "ptype ::C::CClass" "type = class C::CClass \{\r\n public:\r\n int x;\r\n\}"
@@ -270,7 +270,7 @@ gdb_test "ptype C::NestedClass" "No symbol \"NestedClass\" in namespace \"C::C\"
# Tests involving multiple files
gdb_test "print cOtherFile" "\\$\[0-9\].* = 316"
-gdb_test "ptype OtherFileClass" "type = class C::OtherFileClass \{\r\n public:\r\n int z;\r\n\}"
+gdb_test "ptype OtherFileClass" "type = (class C::OtherFileClass \{\r\n public:|struct C::OtherFileClass \{)\r\n int z;\r\n\}"
setup_kfail "gdb/1448" "*-*-*"
gdb_test "ptype ::C::OtherFileClass" "type = class C::OtherFileClass \{\r\n public:\r\n int z;\r\n\}"
gdb_test "ptype C::OtherFileClass" "No symbol \"OtherFileClass\" in namespace \"C::C\"."
diff --git a/gdb/testsuite/gdb.cp/pr-1553.cc b/gdb/testsuite/gdb.cp/pr-1553.cc
deleted file mode 100644
index 58441fdb80f..00000000000
--- a/gdb/testsuite/gdb.cp/pr-1553.cc
+++ /dev/null
@@ -1,53 +0,0 @@
-class A {
-public:
- class B;
- class C;
-};
-
-class A::B {
- int a_b;
-
-public:
- C* get_c(int i);
-};
-
-class A::C
-{
- int a_c;
-};
-
-class E {
-public:
- class F;
-};
-
-class E::F {
-public:
- int e_f;
-
- F& operator=(const F &other);
-};
-
-void refer_to (E::F *f) {
- // Do nothing.
-}
-
-void refer_to (A::C **ref) {
- // Do nothing. But, while we're at it, force out debug info for
- // A::B and E::F.
-
- A::B b;
- E::F f;
-
- refer_to (&f);
-}
-
-int main () {
- A::C* c_var;
- A::B* b_var;
- E *e_var;
-
- // Keep around a reference so that GCC 3.4 doesn't optimize the variable
- // away.
- refer_to (&c_var);
-}
diff --git a/gdb/testsuite/gdb.cp/pr-574.cc b/gdb/testsuite/gdb.cp/pr-574.cc
index eb06b61b7ae..ff9df6c2361 100644
--- a/gdb/testsuite/gdb.cp/pr-574.cc
+++ b/gdb/testsuite/gdb.cp/pr-574.cc
@@ -1,3 +1,23 @@
+/* This test script is part of GDB, the GNU debugger.
+
+ 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
+ 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.
+ */
+
/*
An attempt to replicate PR gdb/574 with a shorter program.
diff --git a/gdb/testsuite/gdb.cp/printmethod.cc b/gdb/testsuite/gdb.cp/printmethod.cc
index d32e1b1d1c4..6afb491ddc5 100644
--- a/gdb/testsuite/gdb.cp/printmethod.cc
+++ b/gdb/testsuite/gdb.cp/printmethod.cc
@@ -1,3 +1,23 @@
+/* This test script is part of GDB, the GNU debugger.
+
+ 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
+ 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.
+ */
+
/* Create some objects, and try to print out their methods. */
class A {
diff --git a/gdb/testsuite/gdb.cp/psmang1.cc b/gdb/testsuite/gdb.cp/psmang1.cc
index 19a9283bbb4..9f19bed2e32 100644
--- a/gdb/testsuite/gdb.cp/psmang1.cc
+++ b/gdb/testsuite/gdb.cp/psmang1.cc
@@ -1,3 +1,23 @@
+/* This test script is part of GDB, the GNU debugger.
+
+ 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
+ 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.
+ */
+
/* Do not move this definition into a header file! See the comments
in psmang.exp. */
struct s
diff --git a/gdb/testsuite/gdb.cp/psmang2.cc b/gdb/testsuite/gdb.cp/psmang2.cc
index b9b1bb55b15..88e04ba4cf2 100644
--- a/gdb/testsuite/gdb.cp/psmang2.cc
+++ b/gdb/testsuite/gdb.cp/psmang2.cc
@@ -1,3 +1,23 @@
+/* This test script is part of GDB, the GNU debugger.
+
+ 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
+ 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>
/* Do not move this definition into a header file! See the comments
diff --git a/gdb/testsuite/gdb.cp/ref-types.cc b/gdb/testsuite/gdb.cp/ref-types.cc
index 23cc51095e3..1c2f4f46cce 100644
--- a/gdb/testsuite/gdb.cp/ref-types.cc
+++ b/gdb/testsuite/gdb.cp/ref-types.cc
@@ -1,3 +1,23 @@
+/* This test script is part of GDB, the GNU debugger.
+
+ Copyright 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
+ 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.
+ */
+
int main2(void);
void marker1 (void)
diff --git a/gdb/testsuite/gdb.cp/rtti.exp b/gdb/testsuite/gdb.cp/rtti.exp
index 18f3cc295da..991836d3073 100644
--- a/gdb/testsuite/gdb.cp/rtti.exp
+++ b/gdb/testsuite/gdb.cp/rtti.exp
@@ -40,25 +40,21 @@ set prms_id 0
set bug_id 0
set testfile "rtti"
-set srcfile1 "${srcdir}/${subdir}/${testfile}1.cc"
-set objfile1 "${objdir}/${subdir}/${testfile}1.o"
-set srcfile2 "${srcdir}/${subdir}/${testfile}2.cc"
-set objfile2 "${objdir}/${subdir}/${testfile}2.o"
-set binfile ${objdir}/${subdir}/${testfile}
+set srcfile1 "${testfile}1.cc"
+set objfile1 "${testfile}1.o"
+set srcfile2 "${testfile}2.cc"
+set objfile2 "${testfile}2.o"
+set binfile "${objdir}/${subdir}/${testfile}"
-# 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++}] != "" } {
+if { [gdb_compile "$srcdir/$subdir/$srcfile1" "$objdir/$subdir/$objfile1" object {debug c++}] != "" } {
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
-if { [gdb_compile "${srcfile2}" "${objfile2}" object {debug c++}] != "" } {
+if { [gdb_compile "$srcdir/$subdir/$srcfile2" "$objdir/$subdir/$objfile2" object {debug c++}] != "" } {
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
-if { [gdb_compile "${objfile1} ${objfile2}" "${binfile}" executable {debug c++}] != "" } {
+if { [gdb_compile "$objdir/$subdir/$objfile1 $objdir/$subdir/$objfile2" "${binfile}" executable {debug c++}] != "" } {
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
@@ -79,7 +75,7 @@ if ![runto_main] then {
# First, run to after we've constructed the object:
-gdb_breakpoint [gdb_get_line_number "main-constructs-done"]
+gdb_breakpoint [gdb_get_line_number "main-constructs-done" "$srcfile1"]
gdb_continue_to_breakpoint "end of constructors in main"
gdb_test_multiple "print *e1" "print *e1" {
@@ -135,12 +131,12 @@ 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_breakpoint [gdb_get_line_number "func-constructs-done" "$srcfile1"]
gdb_continue_to_breakpoint "end of constructors in func"
gdb_test "print *obj" "\\$\[0-9\]* = {<n2::Base2> = .*}"
-gdb_breakpoint [gdb_get_line_number "func3-constructs-done"]
+gdb_breakpoint [gdb_get_line_number "func3-constructs-done" "$srcfile1"]
gdb_continue_to_breakpoint "end of constructors in func3"
gdb_test "print *obj3" "\\$\[0-9\]* = {<n2::C2> = .*}"
diff --git a/gdb/testsuite/gdb.cp/templates.exp b/gdb/testsuite/gdb.cp/templates.exp
index 00a5598629c..15e9a58f94c 100644
--- a/gdb/testsuite/gdb.cp/templates.exp
+++ b/gdb/testsuite/gdb.cp/templates.exp
@@ -399,7 +399,7 @@ gdb_expect {
-re "type = class Baz<int, ?'s'> {\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int baz\\(int, int\\);\r\n}\r\n$gdb_prompt $"
{ # GCC 3.1, DWARF-2 output.
kfail "gdb/57" "ptype Baz" }
- -re "type = class Baz<int, ?115> {\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int baz\\(int, int\\);\r\n}\r\n$gdb_prompt $"
+ -re "type = class Baz<int, ?(\\(char\\))?115> {\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int baz\\(int, int\\);\r\n}\r\n$gdb_prompt $"
{ # GCC 3.x, DWARF-2 output, running into gdb/57 and gdb/1512.
kfail "gdb/57" "ptype Baz" }
-re "No symbol \"Baz\" in current context.\r\n$gdb_prompt $"
@@ -453,10 +453,10 @@ gdb_expect {
send_gdb "ptype quxint\n"
gdb_expect {
- -re "type = class Qux<int, ?&string> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*.*int qux\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype quxint" }
- -re "type = class Qux<int, ?&string> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int qux\\(int, int\\);.*\r\n\\}\r\n$gdb_prompt $" { pass "ptype quxint" }
- -re "type = class Qux<int, ?\\(char ?\\*\\)\\(&string\\)> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int qux\\(int, int\\);.*\r\n\\}\r\n$gdb_prompt $" { pass "ptype quxint" }
- -re "type = class Qux<int, ?&\\(string\\)> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int qux\\(int, int\\);.*\r\n\\}\r\n$gdb_prompt $" {
+ -re "type = class Qux<int, ?& ?string> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*.*int qux\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype quxint" }
+ -re "type = class Qux<int, ?& ?string> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int qux\\(int, int\\);.*\r\n\\}\r\n$gdb_prompt $" { pass "ptype quxint" }
+ -re "type = class Qux<int, ?\\(char ?\\*\\)\\(& ?string\\)> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int qux\\(int, int\\);.*\r\n\\}\r\n$gdb_prompt $" { pass "ptype quxint" }
+ -re "type = class Qux<int, ?& ?\\(string\\)> \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int qux\\(int, int\\);.*\r\n\\}\r\n$gdb_prompt $" {
kfail "gdb/1512" "ptype quxint"
}
-re "$gdb_prompt $" { fail "ptype quxint" }
diff --git a/gdb/testsuite/gdb.cp/try_catch.cc b/gdb/testsuite/gdb.cp/try_catch.cc
index e13dd641b49..764a6121066 100644
--- a/gdb/testsuite/gdb.cp/try_catch.cc
+++ b/gdb/testsuite/gdb.cp/try_catch.cc
@@ -1,4 +1,22 @@
-// 2002-05-27
+/* This test script is part of GDB, the GNU debugger.
+
+ 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
+ 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 <exception>
#include <stdexcept>
diff --git a/gdb/testsuite/gdb.cp/userdef.cc b/gdb/testsuite/gdb.cp/userdef.cc
index 0bb88a2d166..a40995a8650 100644
--- a/gdb/testsuite/gdb.cp/userdef.cc
+++ b/gdb/testsuite/gdb.cp/userdef.cc
@@ -1,3 +1,23 @@
+/* This test script is part of GDB, the GNU debugger.
+
+ Copyright 1999, 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.
+ */
+
#include <iostream>
using namespace std;
diff --git a/gdb/testsuite/gdb.cp/virtfunc.cc b/gdb/testsuite/gdb.cp/virtfunc.cc
index 005de9d0ea6..0757ae78ecd 100644
--- a/gdb/testsuite/gdb.cp/virtfunc.cc
+++ b/gdb/testsuite/gdb.cp/virtfunc.cc
@@ -1,3 +1,23 @@
+/* This test script is part of GDB, the GNU debugger.
+
+ Copyright 1993, 1994, 1997, 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
+ 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.
+ */
+
// Pls try the following program on virtual functions and try to do print on
// most of the code in main(). Almost none of them works !
diff --git a/gdb/testsuite/gdb.cp/virtfunc.exp b/gdb/testsuite/gdb.cp/virtfunc.exp
index bd931a629e3..0a0291d2493 100644
--- a/gdb/testsuite/gdb.cp/virtfunc.exp
+++ b/gdb/testsuite/gdb.cp/virtfunc.exp
@@ -18,8 +18,6 @@
# This file was written by Fred Fish. (fnf@cygnus.com)
# And rewritten by Michael Chastain <mec.gnu@mindspring.com>.
-set wsopt "\[\r\n\t \]*"
-set ws "\[\r\n\t \]+"
set nl "\[\r\n\]+"
if $tracelevel then {
@@ -28,6 +26,8 @@ if $tracelevel then {
if { [skip_cplus_tests] } { continue }
+load_lib "cp-support.exp"
+
set testfile "virtfunc"
set srcfile ${testfile}.cc
set binfile ${objdir}/${subdir}/${testfile}
@@ -36,444 +36,146 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {c++
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
}
-# Test ptype of a class.
-#
-# Different C++ compilers produce different output. I build up regular
-# expressions piece by piece to accommodate all the compilers that I
-# have seen: gcc 2.95.3, gcc 3.3.2 (ABI 1), gcc 3.4 prerelease (ABI 2);
-# and all the debug formats I have seen: dwarf-2 and stabs+.
-#
-# A complicated class declaration looks like this:
-#
-# class A : public virtual V { // re_class
-# private:
-# V * _vb$V; // re_vbptr
-# int a; // re_fields
-#
-# public: // re_access_methods
-# A & operator=(A const &); // re_synth_gcc_2
-# A(int, A const &); // ...
-# A(int); // ...
-# virtual int f(void); // re_methods
-# }
-#
-# RE_CLASS matches the class declaration. C++ allows multiple ways of
-# expressing this.
-#
-# struct ... { private: ... };
-# class ... { private: ... };
-# class ... { ... };
-#
-# RE_VBPTR matches the virtual base declarations. gcc 2.95.3 sometimes
-# emits these, but gcc 3.X.Y never emits these. The name depends on the
-# debug format.
-#
-# RE_FIELDS matches the data fields of the class.
-# RE_METHODS matches the methods explicitly declared for the class.
-#
-# RE_SYNTH_GCC_2 and RE_SYNTH_GCC_3 match the optional synthetic methods
-# of the class. gcc -gstabs+ emits these methods, and gcc -gdwarf-2
-# does not.
-#
-# RE_ACCESS_METHODS is an access specifier after RE_FIELDS and before
-# the methods (explicit methods and/or synthetic methods).
-# There is also an RE_ACCESS_FIELDS.
-#
-# When I get HP-UX aCC, I hope that I can just add RE_SYNTH_ACC_NNN.
-#
-# Yet another twist: with gcc v2, ctor and dtor methods have a hidden
-# argument in front, the "in-charge" flag. With gcc v3, there is no
-# hidden argument; instead, there are multiple object functions for
-# each ctor and dtor.
-#
-# -- chastain 2004-01-01
-
-proc test_one_ptype { command testname re_class re_vbptr re_access_fields re_fields re_access_methods re_methods re_synth_gcc_2 re_synth_gcc_3 re_star } {
- global gdb_prompt
- global wsopt
- global ws
- global nl
-
- gdb_test_multiple "$command" "$testname" {
- -re "type = $re_class${wsopt}$re_access_fields${wsopt}$re_fields${wsopt}$re_access_methods${wsopt}$re_methods$nl\}$re_star$nl$gdb_prompt $" {
- # gcc 2.95.3, dwarf-2, no vbptr
- # gcc 3.X, abi 1, dwarf-2
- # gcc 3.X, abi 2, dwarf-2
- pass "$testname"
- }
- -re "type = $re_class${wsopt}$re_vbptr${wsopt}$re_access_fields${wsopt}$re_fields${wsopt}$re_access_methods${wsopt}$re_methods$nl\}$re_star$nl$gdb_prompt $" {
- # gcc 2.95.3, dwarf-2, vbptr
- # TODO: drow says the vbptr is a bug
- pass "$testname"
- }
- -re "type = $re_class${wsopt}$re_access_fields${wsopt}$re_fields${wsopt}$re_access_methods${wsopt}$re_synth_gcc_2${wsopt}$re_methods$nl\}$re_star$nl$gdb_prompt $" {
- # gcc 2.95.3, stabs+, no vbptr
- pass "$testname"
- }
- -re "type = $re_class${wsopt}$re_vbptr${wsopt}$re_access_fields${wsopt}$re_fields${wsopt}$re_access_methods${wsopt}$re_synth_gcc_2${wsopt}$re_methods$nl\}$re_star$nl$gdb_prompt $" {
- # gcc 2.95.3, stabs+, vbptr
- # TODO: drow says the vbptr is a bug
- pass "$testname"
- }
- -re "type = $re_class${wsopt}$re_access_fields${wsopt}$re_fields${wsopt}$re_access_methods${wsopt}$re_synth_gcc_3${wsopt}$re_methods$nl\}$re_star$nl$gdb_prompt $" {
- # gcc 3.X, abi 1, stabs+
- pass "$testname"
- }
- -re "type = $re_class${wsopt}$re_access_fields${wsopt}$re_fields${wsopt}$re_access_methods${wsopt}$re_methods${wsopt}$re_synth_gcc_3$nl\}$re_star$nl$gdb_prompt $" {
- # gcc 3.X, abi 2, stabs+
- pass "$testname"
- }
- }
-
-}
-
proc test_ptype_of_classes {} {
- global gdb_prompt
- global ws
- global nl
# class VA
- test_one_ptype "ptype VA" "ptype VA" \
- "((struct|class) VA \{${ws}public:|struct VA \{)" \
- "" \
- "" "int va;" \
- "" "" \
- "VA & operator=\\(VA const ?&\\);${ws}VA\\(VA const ?&\\);${ws}VA\\((void|)\\);" \
- "VA & operator=\\(VA const ?&\\);${ws}VA\\(VA const ?&\\);${ws}VA\\((void|)\\);" \
- ""
+ cp_test_ptype_class \
+ "ptype VA" "" "class" "VA" \
+ {
+ { field public "int va;" }
+ }
# class VB
- test_one_ptype "ptype VB" "ptype VB" \
- "((struct|class) VB \{${ws}public:|struct VB \{)" \
- "" \
- "" "int vb;" \
- "" "int fvb\\((void|)\\);${ws}virtual int vvb\\((void|)\\);" \
- "VB & operator=\\(VB const ?&\\);${ws}VB\\(VB const ?&\\);${ws}VB\\((void|)\\);" \
- "VB & operator=\\(VB const ?&\\);${ws}VB\\(VB const ?&\\);${ws}VB\\((void|)\\);" \
- ""
+ cp_test_ptype_class \
+ "ptype VB" "" "class" "VB" \
+ {
+ { field public "int vb;" }
+ { method public "int fvb();" }
+ { method public "virtual int vvb();" }
+ }
# class V
- test_one_ptype "ptype V" "ptype V" \
- "class V : public VA, public VB \{${ws}public:" \
- "" \
- "" "int w;" \
- "" "int f\\((void|)\\);${ws}virtual int vv\\((void|)\\);" \
- "V & operator=\\(V const ?&\\);${ws}V\\(V const ?&\\);${ws}V\\((void|)\\);" \
- "V & operator=\\(V const ?&\\);${ws}V\\(V const ?&\\);${ws}V\\((void|)\\);" \
- ""
+ cp_test_ptype_class \
+ "ptype V" "" "class" "V" \
+ {
+ { base "public VA" }
+ { base "public VB" }
+ { field public "int w;" }
+ { method public "int f();" }
+ { method public "virtual int vv();" }
+ }
# class A
- test_one_ptype "ptype A" "ptype A" \
- "class A : public virtual V \{(${ws}private:|)" \
- "V \\*(_vb.1V|_vb.V);" \
- "" "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\\((void|)\\);" \
- ""
+ cp_test_ptype_class \
+ "ptype A" "" "class" "A" \
+ {
+ { base "public virtual V" }
+ { vbase "V" }
+ { field private "int a;" }
+ { method public "virtual int f();" }
+ }
# class B
- test_one_ptype "ptype B" "ptype B" \
- "class B : public A \{(${ws}private:|)" \
- "V \\*(_vb.1V|_vb.V);" \
- "" "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\\((void|)\\);" \
- ""
+ cp_test_ptype_class \
+ "ptype B" "" "class" "B" \
+ {
+ { base "public A" }
+ { field private "int b;" }
+ { method public "virtual int f();" }
+ }
# class C
- test_one_ptype "ptype C" "ptype C" \
- "class C : public virtual V \{(${ws}private:|)" \
- "V \\*(_vb.1V|_vb.V);" \
- "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\\((void|)\\);" \
- ""
+ cp_test_ptype_class \
+ "ptype C" "" "class" "C" \
+ {
+ { base "public virtual V" }
+ { vbase "V" }
+ { field public "int c;" }
+ }
# class AD
- test_one_ptype "ptype AD" "ptype AD" \
- "((struct|class) AD \{${ws}public:|struct AD \{)" \
- "" \
- "" "" \
- "" "virtual int vg\\((void|)\\);" \
- "AD & operator=\\(AD const ?&\\);${ws}AD\\(AD const ?&\\);${ws}AD\\((void|)\\);" \
- "AD & operator=\\(AD const ?&\\);${ws}AD\\(AD const ?&\\);${ws}AD\\((void|)\\);" \
- ""
+ cp_test_ptype_class \
+ "ptype AD" "" "class" "AD" \
+ {
+ { method public "virtual int vg();" }
+ }
# class D
- test_one_ptype "ptype D" "ptype D" \
- "class D : public AD, public virtual V \{(${ws}private:|)" \
- "V \\*(_vb.1V|_vb.V);" \
- "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\\((void|)\\);" \
- ""
+ cp_test_ptype_class \
+ "ptype D" "" "class" "D" \
+ {
+ { base "public AD" }
+ { base "public virtual V" }
+ { vbase "V" }
+ { method public "static void s();" }
+ { method public "virtual int vg();" }
+ { method public "virtual int vd();" }
+ { method public "int fd();" }
+ { field public "int d;" }
+ }
# class E
- # TODO: E does not show a vbptr for V. That seems strange.
- test_one_ptype "ptype E" "ptype E" \
- "class E : public B, public virtual V, public D, public C \{(${ws}private:|)" \
- "" \
- "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\\((void|)\\);" \
- ""
+ cp_test_ptype_class \
+ "ptype E" "" "class" "E" \
+ {
+ { base "public B" }
+ { base "public virtual V" }
+ { base "public D" }
+ { base "public C" }
+ { vbase "V" }
+ { method public "virtual int f();" }
+ { method public "virtual int vg();" }
+ { method public "virtual int vv();" }
+ { field public "int e;" }
+ }
# An instance of D
- test_one_ptype "ptype dd" "ptype dd" \
- "class D : public AD, public virtual V \{(${ws}private:|)" \
- "V \\*(_vb.1V|_vb.V);" \
- "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\\((void|)\\);" \
- ""
+ cp_test_ptype_class "ptype dd" "" "class" "D" ibid
# An instance of D *
- test_one_ptype "ptype ppd" "ptype ppd" \
- "class D : public AD, public virtual V \{(${ws}private:|)" \
- "V \\*(_vb.1V|_vb.V);" \
- "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\\((void|)\\);" \
- " ?\\*"
+ cp_test_ptype_class "ptype ppd" "" "class" "D" ibid "*"
# An instance of AD *
# TODO: this should be named pADd, not pAd.
- test_one_ptype "ptype pAd" "ptype pAd" \
- "((struct|class) AD \{${ws}public:|struct AD \{)" \
- "" \
- "" "" \
- "" "virtual int vg\\((void|)\\);" \
- "AD & operator=\\(AD const ?&\\);${ws}AD\\(AD const ?&\\);${ws}AD\\((void|)\\);" \
- "AD & operator=\\(AD const ?&\\);${ws}AD\\(AD const ?&\\);${ws}AD\\((void|)\\);" \
- " ?\\*"
-
- # An instance of A
-
- test_one_ptype "ptype a" "ptype a" \
- "class A : public virtual V \{(${ws}private:|)" \
- "V \\*(_vb.1V|_vb.V);" \
- "" "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\\((void|)\\);" \
- ""
-
- # An instance of B
-
- test_one_ptype "ptype b" "ptype b" \
- "class B : public A \{(${ws}private:|)" \
- "V \\*(_vb.1V|_vb.V);" \
- "" "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\\((void|)\\);" \
- ""
-
- # An instance of C
-
- test_one_ptype "ptype c" "ptype c" \
- "class C : public virtual V \{(${ws}private:|)" \
- "V \\*(_vb.1V|_vb.V);" \
- "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\\((void|)\\);" \
- ""
-
- # An instance of D
-
- test_one_ptype "ptype d" "ptype d" \
- "class D : public AD, public virtual V \{(${ws}private:|)" \
- "V \\*(_vb.1V|_vb.V);" \
- "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\\((void|)\\);" \
- ""
-
- # An instance of E
-
- test_one_ptype "ptype e" "ptype e" \
- "class E : public B, public virtual V, public D, public C \{(${ws}private:|)" \
- "" \
- "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\\((void|)\\);" \
- ""
-
- # An instance of V
-
- test_one_ptype "ptype v" "ptype v" \
- "class V : public VA, public VB \{${ws}public:" \
- "" \
- "" "int w;" \
- "" "int f\\((void|)\\);${ws}virtual int vv\\((void|)\\);" \
- "V & operator=\\(V const ?&\\);${ws}V\\(V const ?&\\);${ws}V\\((void|)\\);" \
- "V & operator=\\(V const ?&\\);${ws}V\\(V const ?&\\);${ws}V\\((void|)\\);" \
- ""
-
- # An instance of VB
-
- test_one_ptype "ptype vb" "ptype vb" \
- "((struct|class) VB \{${ws}public:|struct VB \{)" \
- "" \
- "" "int vb;" \
- "" "int fvb\\((void|)\\);${ws}virtual int vvb\\((void|)\\);" \
- "VB & operator=\\(VB const ?&\\);${ws}VB\\(VB const ?&\\);${ws}VB\\((void|)\\);" \
- "VB & operator=\\(VB const ?&\\);${ws}VB\\(VB const ?&\\);${ws}VB\\((void|)\\);" \
- ""
-
- # An instance of A *
-
- test_one_ptype "ptype pAa" "ptype pAa" \
- "class A : public virtual V \{(${ws}private:|)" \
- "V \\*(_vb.1V|_vb.V);" \
- "" "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\\((void|)\\);" \
- " ?\\*"
-
- # An instance of A *
-
- test_one_ptype "ptype pAe" "ptype pAe" \
- "class A : public virtual V \{(${ws}private:|)" \
- "V \\*(_vb.1V|_vb.V);" \
- "" "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\\((void|)\\);" \
- " ?\\*"
-
- # An instance of B *
-
- test_one_ptype "ptype pBe" "ptype pBe" \
- "class B : public A \{(${ws}private:|)" \
- "V \\*(_vb.1V|_vb.V);" \
- "" "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\\((void|)\\);" \
- " ?\\*"
-
- # An instance of D *
-
- test_one_ptype "ptype pDd" "ptype pDd" \
- "class D : public AD, public virtual V \{(${ws}private:|)" \
- "V \\*(_vb.1V|_vb.V);" \
- "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\\((void|)\\);" \
- " ?\\*"
-
- # An instance of D *
-
- test_one_ptype "ptype pDe" "ptype pDe" \
- "class D : public AD, public virtual V \{(${ws}private:|)" \
- "V \\*(_vb.1V|_vb.V);" \
- "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\\((void|)\\);" \
- " ?\\*"
-
- # An instance of V *
-
- test_one_ptype "ptype pVa" "ptype pVa" \
- "class V : public VA, public VB \{${ws}public:" \
- "" \
- "" "int w;" \
- "" "int f\\((void|)\\);${ws}virtual int vv\\((void|)\\);" \
- "V & operator=\\(V const ?&\\);${ws}V\\(V const ?&\\);${ws}V\\((void|)\\);" \
- "V & operator=\\(V const ?&\\);${ws}V\\(V const ?&\\);${ws}V\\((void|)\\);" \
- " ?\\*"
-
- # An instance of V *
-
- test_one_ptype "ptype pVv" "ptype pVv" \
- "class V : public VA, public VB \{${ws}public:" \
- "" \
- "" "int w;" \
- "" "int f\\((void|)\\);${ws}virtual int vv\\((void|)\\);" \
- "V & operator=\\(V const ?&\\);${ws}V\\(V const ?&\\);${ws}V\\((void|)\\);" \
- "V & operator=\\(V const ?&\\);${ws}V\\(V const ?&\\);${ws}V\\((void|)\\);" \
- " ?\\*"
-
- # An instance of V *
-
- test_one_ptype "ptype pVe" "ptype pVe" \
- "class V : public VA, public VB \{${ws}public:" \
- "" \
- "" "int w;" \
- "" "int f\\((void|)\\);${ws}virtual int vv\\((void|)\\);" \
- "V & operator=\\(V const ?&\\);${ws}V\\(V const ?&\\);${ws}V\\((void|)\\);" \
- "V & operator=\\(V const ?&\\);${ws}V\\(V const ?&\\);${ws}V\\((void|)\\);" \
- " ?\\*"
-
- # An instance of V *
-
- test_one_ptype "ptype pVd" "ptype pVd" \
- "class V : public VA, public VB \{${ws}public:" \
- "" \
- "" "int w;" \
- "" "int f\\((void|)\\);${ws}virtual int vv\\((void|)\\);" \
- "V & operator=\\(V const ?&\\);${ws}V\\(V const ?&\\);${ws}V\\((void|)\\);" \
- "V & operator=\\(V const ?&\\);${ws}V\\(V const ?&\\);${ws}V\\((void|)\\);" \
- " ?\\*"
-
- # An instance of AD *
+ cp_test_ptype_class "ptype pAd" "" "class" "AD" ibid "*"
+
+ # Instances of these classes.
+
+ cp_test_ptype_class "ptype a" "" "class" "A" ibid
+ cp_test_ptype_class "ptype b" "" "class" "B" ibid
+ cp_test_ptype_class "ptype c" "" "class" "C" ibid
+ cp_test_ptype_class "ptype d" "" "class" "D" ibid
+ cp_test_ptype_class "ptype e" "" "class" "E" ibid
+ cp_test_ptype_class "ptype v" "" "class" "V" ibid
+ cp_test_ptype_class "ptype vb" "" "class" "VB" ibid
+
+ # Instances of pointers to these classes.
+
+ cp_test_ptype_class "ptype pAa" "" "class" "A" ibid "*"
+ cp_test_ptype_class "ptype pAe" "" "class" "A" ibid "*"
+ cp_test_ptype_class "ptype pBe" "" "class" "B" ibid "*"
+ cp_test_ptype_class "ptype pDd" "" "class" "D" ibid "*"
+ cp_test_ptype_class "ptype pDe" "" "class" "D" ibid "*"
+ cp_test_ptype_class "ptype pVa" "" "class" "V" ibid "*"
+ cp_test_ptype_class "ptype pVv" "" "class" "V" ibid "*"
+ cp_test_ptype_class "ptype pVe" "" "class" "V" ibid "*"
+ cp_test_ptype_class "ptype pVd" "" "class" "V" ibid "*"
+ cp_test_ptype_class "ptype pADe" "" "class" "AD" ibid "*"
+ cp_test_ptype_class "ptype pEe" "" "class" "E" ibid "*"
+ cp_test_ptype_class "ptype pVB" "" "class" "VB" ibid "*"
- test_one_ptype "ptype pADe" "ptype pADe" \
- "((struct|class) AD \{${ws}public:|struct AD \{)" \
- "" \
- "" "" \
- "" "virtual int vg\\((void|)\\);" \
- "AD & operator=\\(AD const ?&\\);${ws}AD\\(AD const ?&\\);${ws}AD\\((void|)\\);" \
- "AD & operator=\\(AD const ?&\\);${ws}AD\\(AD const ?&\\);${ws}AD\\((void|)\\);" \
- " ?\\*"
-
- # An instance of E *
-
- test_one_ptype "ptype pEe" "ptype pEe" \
- "class E : public B, public virtual V, public D, public C \{(${ws}private:|)" \
- "" \
- "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\\((void|)\\);" \
- " ?\\*"
-
- # An instance of VB *
-
- test_one_ptype "ptype pVB" "ptype pVB" \
- "((struct|class) VB \{${ws}public:|struct VB \{)" \
- "" \
- "" "int vb;" \
- "" "int fvb\\((void|)\\);${ws}virtual int vvb\\((void|)\\);" \
- "VB & operator=\\(VB const ?&\\);${ws}VB\\(VB const ?&\\);${ws}VB\\((void|)\\);" \
- "VB & operator=\\(VB const ?&\\);${ws}VB\\(VB const ?&\\);${ws}VB\\((void|)\\);" \
- " ?\\*"
}
# Call virtual functions.
diff --git a/gdb/testsuite/gdb.fortran/Makefile.in b/gdb/testsuite/gdb.fortran/Makefile.in
new file mode 100644
index 00000000000..a1c3b074a07
--- /dev/null
+++ b/gdb/testsuite/gdb.fortran/Makefile.in
@@ -0,0 +1,34 @@
+# Makefile for regression testing the GNU debugger.
+# Copyright 1992, 1993, 1994, 1995, 1996, 1999, 2001, 2003, 2004
+# Free Software Foundation, Inc.
+
+# This file is part of GDB.
+
+# GDB 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, or (at your option)
+# any later version.
+
+# GDB 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.
+
+VPATH = @srcdir@
+srcdir = @srcdir@
+
+EXECUTABLES =
+
+all info install-info dvi install uninstall installcheck check:
+ @echo "Nothing to be done for $@..."
+
+clean mostlyclean:
+ -rm -f *~ *.o *.ci
+ -rm -f core ${EXECUTABLES}
+
+distclean maintainer-clean realclean: clean
+ -rm -f Makefile config.status config.log
diff --git a/gdb/testsuite/gdb.gdb/complaints.exp b/gdb/testsuite/gdb.gdb/complaints.exp
index 3d3426f2474..2dd1508fed6 100644
--- a/gdb/testsuite/gdb.gdb/complaints.exp
+++ b/gdb/testsuite/gdb.gdb/complaints.exp
@@ -1,5 +1,5 @@
-# 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
@@ -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 Andrew Cagney (cagney at redhat dot com),
# derived from xfullpath.exp (written by Joel Brobecker), derived from
# selftest.exp (written by Rob Savoye).
@@ -51,14 +48,23 @@ proc setup_test { executable } {
set oldtimeout $timeout
set timeout 600
verbose "Timeout is now $timeout seconds" 2
- if {[gdb_load $executable] <0} then {
- set timeout $oldtimeout
- verbose "Timeout is now $timeout seconds" 2
- return -1
- }
+
+ global gdb_file_cmd_debug_info
+ set gdb_file_cmd_debug_info "unset"
+
+ set result [gdb_load $executable]
set timeout $oldtimeout
verbose "Timeout is now $timeout seconds" 2
+ if { $result != 0 } then {
+ return -1
+ }
+
+ if { $gdb_file_cmd_debug_info != "debug" } then {
+ untested "No debug information, skipping testcase."
+ return -1
+ }
+
# Set a breakpoint at main
gdb_test "break captured_command_loop" \
"Breakpoint.*at.* file.*, line.*" \
diff --git a/gdb/testsuite/gdb.gdb/observer.exp b/gdb/testsuite/gdb.gdb/observer.exp
index 80ab29a05b5..b6d43b57599 100644
--- a/gdb/testsuite/gdb.gdb/observer.exp
+++ b/gdb/testsuite/gdb.gdb/observer.exp
@@ -1,5 +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
@@ -15,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 Joel Brobecker (brobecker@gnat.com), derived
# from xfullpath.exp.
@@ -50,14 +46,23 @@ proc setup_test { executable } {
set oldtimeout $timeout
set timeout 600
verbose "Timeout is now $timeout seconds" 2
- if {[gdb_load $executable] <0} then {
- set timeout $oldtimeout
- verbose "Timeout is now $timeout seconds" 2
- return -1
- }
+
+ global gdb_file_cmd_debug_info
+ set gdb_file_cmd_debug_info "unset"
+
+ set result [gdb_load $executable]
set timeout $oldtimeout
verbose "Timeout is now $timeout seconds" 2
+ if { $result != 0 } then {
+ return -1
+ }
+
+ if { $gdb_file_cmd_debug_info != "debug" } then {
+ untested "No debug information, skipping testcase."
+ return -1
+ }
+
# Set a breakpoint at main
gdb_test "break captured_main" \
"Breakpoint.*at.* file.*, line.*" \
@@ -69,8 +74,7 @@ proc setup_test { executable } {
set timeout 600
set description "run until breakpoint at captured_main"
- send_gdb "run -nw\n"
- gdb_expect {
+ gdb_test_multiple "run -nw" "$description" {
-re "Starting program.*Breakpoint \[0-9\]+,.*captured_main .data.* at .*main.c:.*$gdb_prompt $" {
pass "$description"
}
@@ -89,9 +93,6 @@ proc setup_test { executable } {
verbose "Timeout is now $timeout seconds" 2
return -1
}
- timeout {
- fail "$description (timeout)"
- }
}
set timeout $oldtimeout
@@ -100,61 +101,68 @@ proc setup_test { executable } {
return 0
}
-proc attach_first_observer { } {
+proc attach_first_observer { message } {
gdb_test "set \$first_obs = observer_attach_normal_stop (&observer_test_first_notification_function)" \
- "" "attach first observer"
+ "" "$message; attach first observer"
}
-proc attach_second_observer { } {
+proc attach_second_observer { message } {
gdb_test "set \$second_obs = observer_attach_normal_stop (&observer_test_second_notification_function)" \
- "" "attach second observer"
+ "" "$message; attach second observer"
}
-proc attach_third_observer { } {
+proc attach_third_observer { message } {
gdb_test "set \$third_obs = observer_attach_normal_stop (&observer_test_third_notification_function)" \
- "" "attach third observer"
+ "" "$message; attach third observer"
}
-proc detach_first_observer { } {
+proc detach_first_observer { message } {
gdb_test "call observer_detach_normal_stop (\$first_obs)" \
- "" "detach first observer"
+ "" "$message; detach first observer"
}
-proc detach_second_observer { } {
+proc detach_second_observer { message } {
gdb_test "call observer_detach_normal_stop (\$second_obs)" \
- "" "detach second observer"
+ "" "$message; detach second observer"
}
-proc detach_third_observer { } {
+proc detach_third_observer { message } {
gdb_test "call observer_detach_normal_stop (\$third_obs)" \
- "" "detach third observer"
+ "" "$message; detach third observer"
}
proc check_counters { first second third message } {
gdb_test "print observer_test_first_observer" \
- ".\[0-9\]+ =.*$first" \
- "check first observer counter value ($message)"
+ ".\[0-9\]+ =.*$first" \
+ "$message; check first observer counter value"
gdb_test "print observer_test_second_observer" \
- ".\[0-9\]+ =.*$second" \
- "check second observer counter value ($message)"
+ ".\[0-9\]+ =.*$second" \
+ "$message; check second observer counter value"
gdb_test "print observer_test_third_observer" \
- ".\[0-9\]+ =.*$third" \
- "check third observer counter value ($message)"
+ ".\[0-9\]+ =.*$third" \
+ "$message; check third observer counter value"
}
-proc reset_counters { } {
+proc reset_counters { message } {
gdb_test "set variable observer_test_first_observer = 0" "" \
- "reset first observer counter"
+ "$message; reset first observer counter"
gdb_test "set variable observer_test_second_observer = 0" "" \
- "reset second observer counter"
+ "$message; reset second observer counter"
gdb_test "set variable observer_test_third_observer = 0" "" \
- "reset third observer counter"
+ "$message; reset third observer counter"
}
-proc test_normal_stop_notifications { first second third message } {
- reset_counters
- gdb_test "call observer_notify_normal_stop ()" "" \
- "sending notification ($message)"
+proc test_normal_stop_notifications { first second third message args } {
+ # Do any initialization
+ for {set i 0} {$i < [llength $args]} {incr i} {
+ [lindex $args $i] $message
+ }
+ reset_counters $message
+ # Call observer_notify_normal_stop. Note that this procedure
+ # takes one argument, but this argument is ignored by the observer
+ # callbacks we have installed. So we just pass an arbitrary value.
+ gdb_test "call observer_notify_normal_stop (0)" "" \
+ "$message; sending notification"
check_counters $first $second $third $message
}
@@ -166,57 +174,57 @@ proc test_observer_normal_stop { executable } {
}
# First, try sending a notification without any observer attached.
- test_normal_stop_notifications 0 0 0 "no observer"
+ test_normal_stop_notifications 0 0 0 "no observer attached"
# Now, attach one observer, and send a notification.
- attach_second_observer
- test_normal_stop_notifications 0 1 0 "one observer"
+ test_normal_stop_notifications 0 1 0 "second observer attached" \
+ attach_second_observer
# Remove the observer, and send a notification.
- detach_second_observer
- test_normal_stop_notifications 0 0 0 "no observer"
+ test_normal_stop_notifications 0 0 0 "second observer detached" \
+ detach_second_observer
# With a new observer.
- attach_first_observer
- test_normal_stop_notifications 1 0 0 "a new observer"
+ test_normal_stop_notifications 1 0 0 "1st observer added" \
+ attach_first_observer
# With 2 observers.
- attach_second_observer
- test_normal_stop_notifications 1 1 0 "2 observers"
+ test_normal_stop_notifications 1 1 0 "2nd observer added" \
+ attach_second_observer
# With 3 observers.
- attach_third_observer
- test_normal_stop_notifications 1 1 1 "3 observers"
+ test_normal_stop_notifications 1 1 1 "3rd observer added" \
+ attach_third_observer
# Remove middle observer.
- detach_second_observer
- test_normal_stop_notifications 1 0 1 "middle observer removed"
+ test_normal_stop_notifications 1 0 1 "2nd observer removed" \
+ detach_second_observer
# Remove first observer.
- detach_first_observer
- test_normal_stop_notifications 0 0 1 "first observer removed"
+ test_normal_stop_notifications 0 0 1 "1st observer removed" \
+ detach_first_observer
# Remove last observer.
- detach_third_observer
- test_normal_stop_notifications 0 0 0 "last observer removed"
+ test_normal_stop_notifications 0 0 0 "3rd observer removed" \
+ detach_third_observer
# Go back to 3 observers, and remove them in a different order...
- attach_first_observer
- attach_second_observer
- attach_third_observer
- test_normal_stop_notifications 1 1 1 "3 observers again"
+ test_normal_stop_notifications 1 1 1 "three observers added" \
+ attach_first_observer \
+ attach_second_observer \
+ attach_third_observer
# Remove the third observer.
- detach_third_observer
- test_normal_stop_notifications 1 1 0 "third observer removed"
+ test_normal_stop_notifications 1 1 0 "third observer removed" \
+ detach_third_observer
# Remove the second observer.
- detach_second_observer
- test_normal_stop_notifications 1 0 0 "second observer removed"
+ test_normal_stop_notifications 1 0 0 "second observer removed" \
+ detach_second_observer
# Remove the first observer, no more observers.
- detach_first_observer
- test_normal_stop_notifications 0 0 0 "last observer removed"
+ test_normal_stop_notifications 0 0 0 "first observer removed" \
+ detach_first_observer
return 0
}
diff --git a/gdb/testsuite/gdb.base/selftest.exp b/gdb/testsuite/gdb.gdb/selftest.exp
index 4196b74e786..e7d46bdc331 100644
--- a/gdb/testsuite/gdb.base/selftest.exp
+++ b/gdb/testsuite/gdb.gdb/selftest.exp
@@ -1,5 +1,5 @@
-# Copyright 1988, 1990, 1991, 1992, 1994, 1997, 1999, 2000, 2002, 2003
-# Free Software Foundation, Inc.
+# Copyright 1988, 1990, 1991, 1992, 1994, 1997, 1999, 2000, 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,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 Rob Savoye. (rob@cygnus.com)
if $tracelevel then {
@@ -106,6 +103,7 @@ proc do_steps_and_nexts {} {
set command "next"
}
-re ".*init_malloc.*$gdb_prompt $" {
+ # gdb 6.2.X is the last gdb which called init_malloc
set description "next over init_malloc and everything it calls"
set command "next"
}
@@ -242,14 +240,23 @@ proc test_with_self { executable } {
set oldtimeout $timeout
set timeout 600
verbose "Timeout is now $timeout seconds" 2
- if {[gdb_load $executable] <0} then {
- set timeout $oldtimeout
- verbose "Timeout is now $timeout seconds" 2
- return -1
- }
+
+ global gdb_file_cmd_debug_info
+ set gdb_file_cmd_debug_info "unset"
+
+ set result [gdb_load $executable]
set timeout $oldtimeout
verbose "Timeout is now $timeout seconds" 2
+ if { $result != 0 } then {
+ return -1
+ }
+
+ if { $gdb_file_cmd_debug_info != "debug" } then {
+ untested "No debug information, skipping testcase."
+ return -1
+ }
+
# disassemble yourself
gdb_test "x/10i main" \
"x/10i.*main.*main.$decimal.*main.$decimal.*" \
diff --git a/gdb/testsuite/gdb.gdb/xfullpath.exp b/gdb/testsuite/gdb.gdb/xfullpath.exp
index 60449a343c5..570b311295f 100644
--- a/gdb/testsuite/gdb.gdb/xfullpath.exp
+++ b/gdb/testsuite/gdb.gdb/xfullpath.exp
@@ -1,5 +1,5 @@
-# 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
@@ -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 Joel Brobecker. (brobecker@gnat.com), derived
# from selftest.exp, written by Rob Savoye.
@@ -50,14 +47,23 @@ proc setup_test { executable } {
set oldtimeout $timeout
set timeout 600
verbose "Timeout is now $timeout seconds" 2
- if {[gdb_load $executable] <0} then {
- set timeout $oldtimeout
- verbose "Timeout is now $timeout seconds" 2
- return -1
- }
+
+ global gdb_file_cmd_debug_info
+ set gdb_file_cmd_debug_info "unset"
+
+ set result [gdb_load $executable]
set timeout $oldtimeout
verbose "Timeout is now $timeout seconds" 2
+ if { $result != 0 } then {
+ return -1
+ }
+
+ if { $gdb_file_cmd_debug_info != "debug" } then {
+ untested "No debug information, skipping testcase."
+ return -1
+ }
+
# Set a breakpoint at main
gdb_test "break captured_main" \
"Breakpoint.*at.* file.*, line.*" \
diff --git a/gdb/testsuite/gdb.hp/gdb.base-hp/reg.exp b/gdb/testsuite/gdb.hp/gdb.base-hp/reg.exp
index 797dc854580..cc1028d5375 100644
--- a/gdb/testsuite/gdb.hp/gdb.base-hp/reg.exp
+++ b/gdb/testsuite/gdb.hp/gdb.base-hp/reg.exp
@@ -1,4 +1,7 @@
-# Copyright (C) 1998 Free Software Foundation, Inc.
+# This test script is part of GDB, the GNU debugger.
+
+# Copyright 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
@@ -104,44 +107,81 @@ runto mainend
# Look for known values
#
-gdb_test "info reg r1" "r1 1"
-gdb_test "info reg r4" "r4 2"
-gdb_test "info reg r5" "r5 4"
-gdb_test "info reg r6" "r6 8"
-gdb_test "info reg r7" "r7 10"
-gdb_test "info reg r8" "r8 20"
-gdb_test "info reg r9" "r9 40"
-gdb_test "info reg r10" "r10 80"
-gdb_test "info reg r11" "r11 100"
-gdb_test "info reg r12" "r12 200"
-gdb_test "info reg r13" "r13 400"
-gdb_test "info reg r14" "r14 800"
-gdb_test "info reg r15" "r15 1000"
-gdb_test "info reg r16" "r16 2000"
+# The output format changed between gdb 6.1.1 and gdb HEAD 2004-06-01.
+#
+# gdb 6.1.1:
+# (gdb) info reg r1
+# r1 1
+#
+# gdb HEAD 2004-06-01:
+# (gdb) info reg r1
+# r1 0x1 1
+#
+# For now, I accept both formats. In the future, you can remove
+# the old gdb 6.1.1 format.
+#
+# -- chastain 2004-06-26
+
+set ws "\[\r\n\t \]+"
+
+proc hp_integer_reg {regname vhex vdec} {
+ global ws
+ set value_611 "$regname${ws}$vhex"
+ set value_new "$regname${ws}0x$vhex${ws}$vdec"
+ gdb_test "info reg $regname" "$value_611|$value_new"
+}
+
+hp_integer_reg "r1" "1" "1"
+hp_integer_reg "r4" "2" "2"
+hp_integer_reg "r5" "4" "4"
+hp_integer_reg "r6" "8" "8"
+hp_integer_reg "r7" "10" "16"
+hp_integer_reg "r8" "20" "32"
+hp_integer_reg "r9" "40" "64"
+hp_integer_reg "r10" "80" "128"
+hp_integer_reg "r11" "100" "256"
+hp_integer_reg "r12" "200" "512"
+hp_integer_reg "r13" "400" "1024"
+hp_integer_reg "r14" "800" "2048"
+hp_integer_reg "r15" "1000" "4096"
+hp_integer_reg "r16" "2000" "8192"
# Two odd variants that GDB supports are:
# "1" means "r1", and
# "$1" means "r1"
-#
-gdb_test "info reg 1 4" "r1 1.*r4 2"
-gdb_test "info reg \$1" "r1 1"
+
+hp_integer_reg "1" "1" "1"
+hp_integer_reg "4" "2" "2"
+
+set name "info reg \$1"
+gdb_test_multiple "info reg \$1" "$name" {
+ -re "r1${ws}1\r\n$gdb_prompt $" {
+ pass "$name"
+ }
+ -re "r1${ws}0x1${ws}1\r\n$gdb_prompt $" {
+ pass "$name"
+ }
+}
# Verify that GDB responds gracefully to a register ID number that
# is out of range.
-#
-gdb_test "info reg 999" "999: invalid register"
+
+gdb_test "info reg 999" "Invalid register.*999.*"
# Make sure the floating point status and error registers
# don't show up as floating point numbers!
-#
-gdb_test "info reg fpsr" ".*fpsr 0.*" "fpsr"
-gdb_test "info reg fpe1" ".*fpe1 0.*" "fpe1"
-gdb_test "info reg fpe2" ".*fpe2 0.*" "fpe2"
-gdb_test "info reg fpe3" ".*fpe3 0.*" "fpe3"
-gdb_test "info reg fpe4" ".*fpe4 0.*" "fpe4"
-gdb_test "info reg fpe5" ".*fpe5 0.*" "fpe5"
-gdb_test "info reg fpe6" ".*fpe6 0.*" "fpe6"
-gdb_test "info reg fpe7" ".*fpe7 0.*" "fpe7"
+
+hp_integer_reg "fpsr" "0" "0"
+hp_integer_reg "fpe1" "0" "0"
+hp_integer_reg "fpe2" "0" "0"
+hp_integer_reg "fpe3" "0" "0"
+hp_integer_reg "fpe4" "0" "0"
+hp_integer_reg "fpe5" "0" "0"
+hp_integer_reg "fpe6" "0" "0"
+hp_integer_reg "fpe7" "0" "0"
+
+# Floating point registers.
+# TODO: these are old format only.
gdb_test "info reg fr4" ".*fr4.*(double precision).* 1"
gdb_test "info reg fr5" ".*fr5.*(double precision).* 2"
@@ -151,33 +191,39 @@ gdb_test "info reg fr8" ".*fr8.*(double precision).* 8"
gdb_test "info reg fr9" ".*fr9.*(double precision).* 32"
gdb_test "info reg fr10" ".*fr10.*(double precision).* 256"
-gdb_test "info reg r19" "r19 deadbeefbadcadee"
+# An integer register with a 64-bit value.
-# Need to add test of use of $<register-name>
-#
-# Q: How do you say a literal "$" in expect?
-# A: You say "\$". A literal "\" is "\\".
-#
-# Please note that this test will fail as long as we are running
-# in 32-bit mode: it will produce "$1 = 0xbadcadee". To fix it
-# would require building a real 64-bit gdb (expression evaluation,
-# in particular).
-#
-send_gdb "p/x \$r19\n"
- gdb_expect {
- -re ".*= 0xdeadbeefbadcadee.*$gdb_prompt $" {
- pass "64-bit works"
- }
- -re ".*= 0xbadcadee.*$gdb_prompt $" {
- pass "32-bit extract when using PRINT; expected but not good"
- }
- -re ".*$gdb_prompt $" {
- fail "didn't print any part of right value"
- }
- timeout {
- fail "timeout on print"
- }
+set name "info reg r19"
+gdb_test_multiple "info reg r19" "$name" {
+ -re "r19${ws}deadbeefbadcadee\r\n$gdb_prompt $" {
+ # old gdb 6.1.1 format, good result
+ pass "$name"
+ }
+ -re "r19${ws}badcadee\r\n$gdb_prompt $" {
+ # old gdb 6.1.1 format, bad result
+ fail "$name (32-bit truncation)"
+ }
+ -re "r19${ws}0xdeadbeefbadcadee${ws}16045690984232431086\r\n$gdb_prompt $" {
+ # new gdb HEAD 2004-06-01 format, good result
+ pass "$name"
}
+ -re "r19${ws}0xbadcadee${ws}3135024622\r\n$gdb_prompt $" {
+ # new gdb HEAD 2004-06-01 format, 32 bit truncation
+ fail "$name (32-bit truncation)"
+ }
+}
+
+set name "print /x \$r19"
+gdb_test_multiple "print /x \$r19" "$name" {
+ -re "= 0xdeadbeefbadcadee\r\n$gdb_prompt $" {
+ pass "$name"
+ }
+ -re "= 0xbadcadee\r\n$gdb_prompt $" {
+ # this was a PASS in the last version so keep it PASS for now
+ # -- chastain 2004-06-26
+ pass "$name (32-bit truncation)"
+ }
+}
# Need to add tests of setting wide regs too. E.g.
#
diff --git a/gdb/testsuite/gdb.java/jmain.exp b/gdb/testsuite/gdb.java/jmain.exp
new file mode 100644
index 00000000000..49e7ca3b511
--- /dev/null
+++ b/gdb/testsuite/gdb.java/jmain.exp
@@ -0,0 +1,67 @@
+# 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
+# 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.
+
+# This file was based on jmisc.exp which in turn was written by
+# Anthony Green. (green@redhat.com)
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+load_lib "java.exp"
+
+set testfile "jmain"
+set srcfile ${srcdir}/$subdir/${testfile}.java
+set binfile ${objdir}/${subdir}/${testfile}
+if { [compile_java_from_source ${srcfile} ${binfile} "-g"] != "" } {
+ untested "Couldn't compile ${srcfile}"
+ return -1
+}
+
+set prms_id 0
+set bug_id 0
+
+# Start with a fresh gdb.
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+
+gdb_test "set print sevenbit-strings" ".*"
+
+# Check that plain old "main" works. The load should both set the
+# language to java and (since --main=jmain), some how set the scope to
+# jmain's main.
+
+# Where the breakpoint should always land
+
+set bpmain "Breakpoint .* file .*jmain.java, line 5\."
+
+gdb_load "${binfile}"
+setup_kfail *-*-* java/1567
+gdb_test "break main" "${bpmain}"
+
+# Check that an unqualified "main" works.
+
+
+gdb_load "${binfile}"
+setup_kfail *-*-* java/1565
+gdb_test "break jmain.main" "${bpmain}"
+
+# Check that a fully qualified "main" works.
+gdb_load "${binfile}"
+setup_xfail *-*-* gcc/16439
+gdb_test "break \'${testfile}.main(java.lang.String\[\])\'" "${bpmain}"
diff --git a/gdb/testsuite/gdb.java/jmain.java b/gdb/testsuite/gdb.java/jmain.java
new file mode 100644
index 00000000000..ee5c8bb00ce
--- /dev/null
+++ b/gdb/testsuite/gdb.java/jmain.java
@@ -0,0 +1,7 @@
+public class jmain
+{
+ public static void main (String[] args)
+ {
+ return;
+ }
+}
diff --git a/gdb/testsuite/gdb.java/jmisc.exp b/gdb/testsuite/gdb.java/jmisc.exp
index 9fd220ff307..9e32011d62b 100644
--- a/gdb/testsuite/gdb.java/jmisc.exp
+++ b/gdb/testsuite/gdb.java/jmisc.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
@@ -72,7 +72,7 @@ if ![set_lang_java] then {
send_gdb "ptype jmisc\n"
gdb_expect {
- -re "type = class jmisc extends java.lang.Object \{\[\r\n\ \t]+void main\\(java\.lang\.String\\\[]\\);\[\r\n\ \t]+void <init>\\(void\\);\[\r\n\ \t]+\}\[\r\n\ \t]+$gdb_prompt $" { pass "ptype jmisc" }
+ -re "type = class jmisc extends java.lang.Object \{\[\r\n\ \t]+void main\\(java\.lang\.String\\\[]\\);\[\r\n\ \t]+jmisc\\(\\);\[\r\n\ \t]+\}\[\r\n\ \t]+$gdb_prompt $" { pass "ptype jmisc" }
-re ".*$gdb_prompt $" { fail "ptype jmisc" }
timeout { fail "ptype jmisc (timeout)" ; return }
}
diff --git a/gdb/testsuite/gdb.java/jmisc1.exp b/gdb/testsuite/gdb.java/jmisc1.exp
index dd5af98bbe2..dab85c8e7a8 100644
--- a/gdb/testsuite/gdb.java/jmisc1.exp
+++ b/gdb/testsuite/gdb.java/jmisc1.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
@@ -70,7 +70,7 @@ if ![set_lang_java] then {
send_gdb "ptype jmisc\n"
gdb_expect {
- -re "type = class jmisc extends java.lang.Object \{\[\r\n\ \t]+void main\\(java\.lang\.String\\\[]\\);\[\r\n\ \t]+void <init>\\(void\\);\[\r\n\ \t]+\}\[\r\n\ \t]+$gdb_prompt $" { pass "ptype jmisc" }
+ -re "type = class jmisc extends java.lang.Object \{\[\r\n\ \t]+void main\\(java\.lang\.String\\\[]\\);\[\r\n\ \t]+jmisc\\(\\);\[\r\n\ \t]+\}\[\r\n\ \t]+$gdb_prompt $" { pass "ptype jmisc" }
-re ".*$gdb_prompt $" { fail "ptype jmisc" }
timeout { fail "ptype jmisc (timeout)" ; return }
}
diff --git a/gdb/testsuite/gdb.java/jmisc2.exp b/gdb/testsuite/gdb.java/jmisc2.exp
deleted file mode 100644
index 2eeb99df7ad..00000000000
--- a/gdb/testsuite/gdb.java/jmisc2.exp
+++ /dev/null
@@ -1,91 +0,0 @@
-# Copyright 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
-
-# This file was written by Anthony Green. (green@redhat.com)
-#
-
-if $tracelevel then {
- strace $tracelevel
-}
-
-load_lib "java.exp"
-
-set testfile "jmisc"
-set srcfile ${srcdir}/$subdir/${testfile}.java
-set binfile ${objdir}/${subdir}/${testfile}
-if { [compile_java_from_source ${srcfile} ${binfile} "-g"] != "" } {
- untested "Couldn't compile ${srcfile}"
- return -1
-}
-
-# Set the current language to java. This counts as a test. If it
-# fails, then we skip the other tests.
-
-proc set_lang_java {} {
- global gdb_prompt
- global binfile objdir subdir
-
- verbose "loading file '$binfile'"
- gdb_load $binfile
-
- send_gdb "set language java\n"
- gdb_expect {
- -re ".*$gdb_prompt $" {}
- timeout { fail "set language java (timeout)" ; return 0 }
- }
-
- return [gdb_test "show language" ".* source language is \"java\".*" \
- "set language to \"java\""]
-}
-
-set prms_id 0
-set bug_id 0
-
-# Start with a fresh gdb.
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-
-gdb_test "set print sevenbit-strings" ".*"
-
-if ![set_lang_java] then {
- send_gdb "ptype jmisc\n"
- gdb_expect {
- -re "type = class jmisc extends java.lang.Object \{\[\r\n\ \t]+void main\\(java\.lang\.String\\\[]\\);\[\r\n\ \t]+void <init>\\(void\\);\[\r\n\ \t]+\}\[\r\n\ \t]+$gdb_prompt $" { pass "ptype jmisc" }
- -re ".*$gdb_prompt $" { fail "ptype jmisc" }
- timeout { fail "ptype jmisc (timeout)" ; return }
- }
-
- runto ${testfile}.main(java.lang.String\[\])
-
- send_gdb "p args\n"
- gdb_expect {
- -re "\\\$1 = java\.lang\.String\\\[]@\[a-f0-9]+\[\r\n\ \t]+$gdb_prompt $" { pass "p args" }
- -re ".*$gdb_prompt $" { fail "p args" }
- timeout { fail "p args (timeout)" ; return }
- }
-
- send_gdb "p *args\n"
- gdb_expect {
- -re "\\\$2 = \{length: 0\}\[\r\n\ \t]+$gdb_prompt $" { pass "p *args" }
- -re ".*$gdb_prompt $" { fail "p *args" }
- timeout { fail "p *args (timeout)" ; return }
- }
-}
diff --git a/gdb/testsuite/gdb.mi/basics.c b/gdb/testsuite/gdb.mi/basics.c
index 9a61aa2dc39..0e3c1d8abfc 100644
--- a/gdb/testsuite/gdb.mi/basics.c
+++ b/gdb/testsuite/gdb.mi/basics.c
@@ -1,8 +1,30 @@
+/* Copyright 1999, 2000, 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. */
+
/*
* This simple program that passes different types of arguments
* on function calls. Useful to test printing frames, stepping, etc.
*/
+#include <stdio.h>
+
int callee4 (void)
{
int A=1;
diff --git a/gdb/testsuite/gdb.mi/gdb792.exp b/gdb/testsuite/gdb.mi/gdb792.exp
index 8196464e647..37fc3ae8daf 100644
--- a/gdb/testsuite/gdb.mi/gdb792.exp
+++ b/gdb/testsuite/gdb.mi/gdb792.exp
@@ -1,4 +1,4 @@
-# Copyright 2002 Free Software Foundation, Inc.
+# Copyright 2002, 2003 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/mi-basics.exp b/gdb/testsuite/gdb.mi/mi-basics.exp
index 9377baf9e6c..39a08736910 100644
--- a/gdb/testsuite/gdb.mi/mi-basics.exp
+++ b/gdb/testsuite/gdb.mi/mi-basics.exp
@@ -1,4 +1,4 @@
-# Copyright 1999, 2000 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/mi-break.exp b/gdb/testsuite/gdb.mi/mi-break.exp
index 5cbe4e40d2e..941317b5f8c 100644
--- a/gdb/testsuite/gdb.mi/mi-break.exp
+++ b/gdb/testsuite/gdb.mi/mi-break.exp
@@ -1,4 +1,4 @@
-# Copyright 1999 Free Software Foundation, Inc.
+# Copyright 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
-
#
# Test essential Machine interface (MI) operations
#
@@ -47,39 +44,56 @@ mi_delete_breakpoints
mi_gdb_reinitialize_dir $srcdir/$subdir
mi_gdb_load ${binfile}
+# Locate line numbers in basics.c.
+set line_callee4_head [gdb_get_line_number "callee4 ("]
+set line_callee4_body [expr $line_callee4_head + 2]
+set line_callee3_head [gdb_get_line_number "callee3 ("]
+set line_callee3_body [expr $line_callee3_head + 2]
+set line_callee2_head [gdb_get_line_number "callee2 ("]
+set line_callee2_body [expr $line_callee2_head + 2]
+set line_callee1_head [gdb_get_line_number "callee1 ("]
+set line_callee1_body [expr $line_callee1_head + 2]
+set line_main_head [gdb_get_line_number "main ("]
+set line_main_body [expr $line_main_head + 2]
+
proc test_tbreak_creation_and_listing {} {
global mi_gdb_prompt
global srcfile
global hex
+ global line_callee4_head line_callee4_body
+ global line_callee3_head line_callee3_body
+ global line_callee2_head line_callee2_body
+ global line_callee1_head line_callee1_body
+ global line_main_head line_main_body
# 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-insert -t basics.c:$line_callee3_head
+ # -break-insert -t srcfile:$line_callee4_head
# -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\"\}" \
+ "222\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"$line_main_body\",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\"\}" \
+ "333\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"callee2\",file=\".*basics.c\",line=\"$line_callee2_body\",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)"
+ mi_gdb_test "444-break-insert -t basics.c:$line_callee3_head" \
+ "444\\^done,bkpt=\{number=\"3\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"callee3\",file=\".*basics.c\",line=\"$line_callee3_head\",times=\"0\"\}" \
+ "insert temp breakpoint at basics.c:\$line_callee3_body"
- # 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)"
+ # Getting the quoting right is tricky. That is "\"<file>\":$line_callee4_head"
+ mi_gdb_test "555-break-insert -t \"\\\"${srcfile}\\\":$line_callee4_head\"" \
+ "555\\^done,bkpt=\{number=\"4\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"$line_callee4_head\",times=\"0\"\}" \
+ "insert temp breakpoint at \"<fullfilename>\":\$line_callee4_head"
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\"\}.*\\\]\}" \
+ "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=\"$line_main_body\",times=\"0\"\}.*\\\]\}" \
"list of breakpoints"
mi_gdb_test "777-break-delete" \
@@ -91,6 +105,11 @@ proc test_rbreak_creation_and_listing {} {
global mi_gdb_prompt
global srcfile
global hex
+ global line_callee4_head line_callee4_body
+ global line_callee3_head line_callee3_body
+ global line_callee2_head line_callee2_body
+ global line_callee1_head line_callee1_body
+ global line_main_head line_main_body
# Insert some breakpoints and list them
# Also, disable some so they do not interfere with other tests
@@ -103,27 +122,27 @@ proc test_rbreak_creation_and_listing {} {
setup_xfail "*-*-*"
mi_gdb_test "122-break-insert -r main" \
- "122\\^done,bkpt=\{number=\"5\",addr=\"$hex\",file=\".*basics.c\",line=\"32\"\}" \
+ "122\\^done,bkpt=\{number=\"5\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_main_body\"\}" \
"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\"\}" \
+ "133\\^done,bkpt=\{number=\"6\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_callee2_body\"\}" \
"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\"\}" \
+ "144\\^done,bkpt=\{number=\"7\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_callee1_body\"\},bkpt=\{number=\"8\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_callee2_body\"\},bkpt=\{number=\"9\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_callee3_body\"\},bkpt=\{number=\"10\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_callee4_body\"\}" \
"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\"\}" \
+ "155\\^done,bkpt=\{number=\"11\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_callee1_body\"\},bkpt=\{number=\"12\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_callee2_body\"\},bkpt=\{number=\"13\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_callee3_body\"\},bkpt=\{number=\"14\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_callee4_body\"\}" \
"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\"\},.*\}\\\]\}" \
+ "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=\"$line_main_body\",times=\"0\"\},.*\}\\\]\}" \
"list of breakpoints"
mi_gdb_test "177-break-delete" \
diff --git a/gdb/testsuite/gdb.mi/mi-cli.exp b/gdb/testsuite/gdb.mi/mi-cli.exp
index 62501e03a19..4b493ab761a 100644
--- a/gdb/testsuite/gdb.mi/mi-cli.exp
+++ b/gdb/testsuite/gdb.mi/mi-cli.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 tests that GDB's console can be accessed via the MI.
# Specifically, we are testing the "interpreter-exec" command and that
# the commands that are executed via this command are properly executed.
@@ -67,6 +64,11 @@ mi_gdb_test "-interpreter-exec console \"file $binfile\"" \
mi_run_to_main
+set line_main_head [gdb_get_line_number "main ("]
+set line_main_body [expr $line_main_head + 2]
+set line_main_hello [gdb_get_line_number "Hello, World!"]
+set line_main_return [expr $line_main_hello + 2]
+
mi_gdb_test "-interpreter-exec console \"set args foobar\"" \
{\^done} \
"-interpreter-exec console \"set args foobar\""
@@ -91,8 +93,9 @@ mi_gdb_test "-interpreter-exec console \"set listsize 1\"" \
{\^done} \
"-interpreter-exec console \"set listsize 1\""
+# {.*\~"32[ \t(\\t)]*callee1.*\\n".*\^done }
mi_gdb_test "-interpreter-exec console \"list\"" \
- {.*\~"32[ \t(\\t)]*callee1.*\\n".*\^done} \
+ ".*\~\"$line_main_body\[\\\\t \]*callee1.*;\\\\n\".*\\^done" \
"-interpreter-exec console \"list\""
# # NOTE: cagney/2003-02-03: Not yet.
@@ -150,43 +153,43 @@ mi_gdb_test "500-stack-select-frame 0" \
"-stack-select-frame 0"
# NOTE: cagney/2003-02-03: Not yet.
-# mi_gdb_test "-break-insert -t basics.c:35" \
+# mi_gdb_test "-break-insert -t basics.c:$line_main_hello" \
# {.*=breakpoint-create,number="3".*\^done} \
-# "-break-insert -t basics.c:35"
-mi_gdb_test "600-break-insert -t basics.c:35" \
+# "-break-insert -t basics.c:\$line_main_hello"
+mi_gdb_test "600-break-insert -t basics.c:$line_main_hello" \
{600\^done,bkpt=.number="3",type="breakpoint".*\}} \
- "-break-insert -t basics.c:35"
+ "-break-insert -t basics.c:\$line_main_hello"
# mi_gdb_test "-exec-continue" \
-# {.*\*stopped.*,file=".*basics.c",line="35"\}} \
-# "-exec-continue to line 35"
+# {.*\*stopped.*,file=".*basics.c",line="$line_main_hello"\}} \
+# "-exec-continue to line \$line_main_hello"
send_gdb "700-exec-continue\n"
gdb_expect {
- -re "700\\^running\[\r\n\]+$mi_gdb_prompt.*\\*stopped.*,file=.*basics.c.,line=.35.*$mi_gdb_prompt$" {
- pass "-exec-continue to line 35"
+ -re "700\\^running\[\r\n\]+$mi_gdb_prompt.*\\*stopped.*,file=.*basics.c.,line=.$line_main_hello.*$mi_gdb_prompt$" {
+ pass "-exec-continue to line \$line_main_hello"
}
timeout {
- fail "-exec-continue to line 35"
+ fail "-exec-continue to line \$line_main_hello"
}
}
# NOTE: cagney/2003-02-03: Not yet.
# mi_gdb_test "-exec-next" \
-# {.*\*stopped,reason="end-stepping-range",.*,file=".*basics.c",line="37"\}} \
-# "-exec-next to line 37"
+# {.*\*stopped,reason="end-stepping-range",.*,file=".*basics.c",line="$line_main_return"\}} \
+# "-exec-next to line \$line_main_return"
send_gdb "800-exec-next\n"
gdb_expect {
- -re "800\\^running\[\r\n\]+$mi_gdb_prompt.*\\*stopped,reason=.end-stepping-range.*,file=.*basics.c.,line=.37.*$mi_gdb_prompt$" {
- pass "-exec-next to line 37"
+ -re "800\\^running\[\r\n\]+$mi_gdb_prompt.*\\*stopped,reason=.end-stepping-range.*,file=.*basics.c.,line=.$line_main_return.*$mi_gdb_prompt$" {
+ pass "-exec-next to line \$line_main_return"
}
timeout {
- fail "-exec-next to line 37"
+ fail "-exec-next to line \$line_main_return"
}
}
mi_gdb_test "-interpreter-exec console \"list\"" \
- {\~"37[ \t(\\t)]*return 0;\\n".*\^done} \
- "-interpreter-exec console \"list\" at basics.c:37"
+ "\~\"$line_main_return\[\\\\t ]*return 0;\\\\n\".*\\^done" \
+ "-interpreter-exec console \"list\" at basics.c:\$line_main_return"
mi_gdb_test "-interpreter-exec console \"help set args\"" \
{\~"Set argument list to give program being debugged when it is started\.\\nFollow this command with any number of args, to be passed to the program\.".*\^done} \
diff --git a/gdb/testsuite/gdb.mi/mi-console.exp b/gdb/testsuite/gdb.mi/mi-console.exp
index 0fb85e0dda1..9986b5eb425 100644
--- a/gdb/testsuite/gdb.mi/mi-console.exp
+++ b/gdb/testsuite/gdb.mi/mi-console.exp
@@ -1,4 +1,4 @@
-# Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/mi-disassemble.exp b/gdb/testsuite/gdb.mi/mi-disassemble.exp
index 46f00ddf51c..0b124976a7e 100644
--- a/gdb/testsuite/gdb.mi/mi-disassemble.exp
+++ b/gdb/testsuite/gdb.mi/mi-disassemble.exp
@@ -1,4 +1,4 @@
-# Copyright 1999, 2000, 2002 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -14,9 +14,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-# Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@prep.ai.mit.edu
-
#
# Test Machine interface (MI) operations for disassembly.
#
@@ -48,17 +45,20 @@ proc test_disassembly_only {} {
global hex
global decimal
+ set line_main_head [gdb_get_line_number "main ("]
+ set line_main_body [expr $line_main_head + 2]
+
# Test disassembly more only for the current function.
# Tests:
# -data-disassemble -s $pc -e "$pc+8" -- 0
- # -data-disassembly -f basics.c -l 32 -- 0
+ # -data-disassembly -f basics.c -l $line_main_body -- 0
mi_gdb_test "print/x \$pc" "" ""
mi_gdb_test "111-data-disassemble -s \$pc -e \"\$pc + 12\" -- 0" \
"111\\^done,asm_insns=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\},\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}.*\]" \
"data-disassemble from pc to pc+12 assembly only"
- mi_gdb_test "222-data-disassemble -f basics.c -l 32 -- 0" \
+ mi_gdb_test "222-data-disassemble -f basics.c -l $line_main_body -- 0" \
"222\\^done,asm_insns=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"0\",inst=\".*\"\},.*,\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}\\\]" \
"data-disassemble file & line, assembly only"
}
@@ -68,22 +68,25 @@ proc test_disassembly_lines_limit {} {
global hex
global decimal
+ set line_main_head [gdb_get_line_number "main ("]
+ set line_main_body [expr $line_main_head + 2]
+
# Test disassembly more only for the current function.
# Tests:
- # -data-disassembly -f basics.c -l 32 -n 20 -- 0
- # -data-disassembly -f basics.c -l 32 -n 0 -- 0
- # -data-disassembly -f basics.c -l 32 -n 50 -- 0
+ # -data-disassembly -f basics.c -l $line_main_body -n 20 -- 0
+ # -data-disassembly -f basics.c -l $line_main_body -n 0 -- 0
+ # -data-disassembly -f basics.c -l $line_main_body -n 50 -- 0
mi_gdb_test "print/x \$pc" "" ""
- mi_gdb_test "222-data-disassemble -f basics.c -l 32 -n 20 -- 0" \
+ mi_gdb_test "222-data-disassemble -f basics.c -l $line_main_body -n 20 -- 0" \
"222\\^done,asm_insns=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"0\",inst=\".*\"\},.*,\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}\\\]" \
"data-disassemble file, line, number assembly only"
- mi_gdb_test "222-data-disassemble -f basics.c -l 32 -n 0 -- 0" \
+ mi_gdb_test "222-data-disassemble -f basics.c -l $line_main_body -n 0 -- 0" \
"222\\^done,asm_insns=\\\[\\\]" \
"data-disassemble file, line, number (zero lines) assembly only"
- mi_gdb_test "222-data-disassemble -f basics.c -l 32 -n 50 -- 0" \
+ mi_gdb_test "222-data-disassemble -f basics.c -l $line_main_body -n 50 -- 0" \
"222\\^done,asm_insns=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"0\",inst=\".*\"\},.*,\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}\\\]" \
"data-disassemble file, line, number (more than main lines) assembly only"
}
@@ -94,13 +97,16 @@ proc test_disassembly_mixed {} {
global hex
global decimal
+ set line_callee2_head [gdb_get_line_number "callee2 ("]
+ set line_callee2_open_brace [expr $line_callee2_head + 1]
+
# Test disassembly more only for the current function.
# Tests:
- # -data-disassembly -f basics.c -l 21 -- 1
+ # -data-disassembly -f basics.c -l $line_callee2_open_brace -- 1
# -data-disassembly -s $pc -e "$pc+8" -- 1
- mi_gdb_test "002-data-disassemble -f basics.c -l 21 -- 1" \
- "002\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"21\",file=\".*basics.c\",line_asm_insn=\\\[\{address=\"$hex\",func-name=\"callee2\",offset=\"0\",inst=\".*\"\}.*\\\]\}.*,src_and_asm_line=\{line=\"$decimal\",file=\".*basics.c\",line_asm_insn=\\\[.*\{address=\"$hex\",func-name=\"callee2\",offset=\"$decimal\",inst=\".*\"\}\\\]\}\\\]" \
+ mi_gdb_test "002-data-disassemble -f basics.c -l $line_callee2_open_brace -- 1" \
+ "002\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"$line_callee2_open_brace\",file=\".*basics.c\",line_asm_insn=\\\[\{address=\"$hex\",func-name=\"callee2\",offset=\"0\",inst=\".*\"\}.*\\\]\}.*,src_and_asm_line=\{line=\"$decimal\",file=\".*basics.c\",line_asm_insn=\\\[.*\{address=\"$hex\",func-name=\"callee2\",offset=\"$decimal\",inst=\".*\"\}\\\]\}\\\]" \
"data-disassemble file, line assembly mixed"
#
@@ -118,22 +124,26 @@ proc test_disassembly_mixed_lines_limit {} {
global hex
global decimal
+ set line_main_head [gdb_get_line_number "main ("]
+ set line_main_open_brace [expr $line_main_head + 1]
+ set line_main_body [expr $line_main_head + 2]
+
# Test disassembly more only for the current function.
# Tests:
- # -data-disassembly -f basics.c -l 32 -n 20 -- 1
- # -data-disassembly -f basics.c -l 32 -n 0 -- 1
- # -data-disassembly -f basics.c -l 32 -n 50 -- 1
+ # -data-disassembly -f basics.c -l $line_main_body -n 20 -- 1
+ # -data-disassembly -f basics.c -l $line_main_body -n 0 -- 1
+ # -data-disassembly -f basics.c -l $line_main_body -n 50 -- 1
mi_gdb_test "print/x \$pc" "" ""
- mi_gdb_test "222-data-disassemble -f basics.c -l 32 -n 20 -- 1" \
+ mi_gdb_test "222-data-disassemble -f basics.c -l $line_main_body -n 20 -- 1" \
"222\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"$decimal\",file=\".*basics.c\",line_asm_insn=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"0\",inst=\".*\"\},.*,\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}\\\]\}\]" \
"data-disassemble file, line, number assembly mixed"
- mi_gdb_test "222-data-disassemble -f basics.c -l 32 -n 0 -- 1" \
- "222\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"31\",file=\".*basics.c\",line_asm_insn=\\\[\\\]\}\\\]" \
+ mi_gdb_test "222-data-disassemble -f basics.c -l $line_main_body -n 0 -- 1" \
+ "222\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"$line_main_open_brace\",file=\".*basics.c\",line_asm_insn=\\\[\\\]\}\\\]" \
"data-disassemble file, line, number (zero lines) assembly mixed"
- mi_gdb_test "222-data-disassemble -f basics.c -l 32 -n 50 -- 1" \
+ mi_gdb_test "222-data-disassemble -f basics.c -l $line_main_body -n 50 -- 1" \
"222\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"$decimal\",file=\".*basics.c\",line_asm_insn=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"0\",inst=\".*\"\}.*,\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}\\\]\}\]" \
"data-disassemble file, line, number (more than main lines) assembly mixed"
}
@@ -142,6 +152,9 @@ proc test_disassembly_bogus_args {} {
global mi_gdb_prompt
global hex
+ set line_main_head [gdb_get_line_number "main ("]
+ set line_main_body [expr $line_main_head + 2]
+
# Test that bogus input to disassembly command is rejected.
# Tests:
# -data-disassembly -f foo -l abc -n 0 -- 0
@@ -161,7 +174,7 @@ proc test_disassembly_bogus_args {} {
"456\\^error,msg=\"mi_cmd_disassemble: Usage: \\( .-f filename -l linenum .-n howmany.. | .-s startaddr -e endaddr.\\) .--. mixed_mode.\"" \
"data-disassemble mix different args"
- mi_gdb_test "789-data-disassemble -f basics.c -l 32 -- 9" \
+ mi_gdb_test "789-data-disassemble -f basics.c -l $line_main_body -- 9" \
"789\\^error,msg=\"mi_cmd_disassemble: Mixed_mode argument must be 0 or 1.\"" \
"data-disassemble wrong mode arg"
diff --git a/gdb/testsuite/gdb.mi/mi-eval.exp b/gdb/testsuite/gdb.mi/mi-eval.exp
index 536dd791530..a07f607e52c 100644
--- a/gdb/testsuite/gdb.mi/mi-eval.exp
+++ b/gdb/testsuite/gdb.mi/mi-eval.exp
@@ -1,4 +1,4 @@
-# Copyright 1999, 2000, 2002 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -14,9 +14,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-# Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@prep.ai.mit.edu
-
#
# Test essential Machine interface (MI) operations
#
@@ -46,8 +43,11 @@ mi_gdb_reinitialize_dir $srcdir/$subdir
mi_gdb_reinitialize_dir $srcdir/$subdir
mi_gdb_load ${binfile}
+set line_callee4_head [gdb_get_line_number "callee4 ("]
+set line_callee4_body [expr $line_callee4_head + 2]
+
mi_runto callee4
-mi_next_to "callee4" "" "basics.c" "9" "next at callee4"
+mi_next_to "callee4" "" "basics.c" [expr $line_callee4_body + 1] "next at callee4"
mi_gdb_test "211-data-evaluate-expression A" "211\\^done,value=\"1\"" "eval A"
diff --git a/gdb/testsuite/gdb.mi/mi-file.exp b/gdb/testsuite/gdb.mi/mi-file.exp
index 2ffdcbfc6a9..0ce4fd64948 100644
--- a/gdb/testsuite/gdb.mi/mi-file.exp
+++ b/gdb/testsuite/gdb.mi/mi-file.exp
@@ -1,4 +1,4 @@
-# Copyright 1999 Free Software Foundation, Inc.
+# Copyright 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
-
#
# Test essential Machine interface (MI) operations
#
@@ -47,19 +44,40 @@ mi_delete_breakpoints
mi_gdb_reinitialize_dir $srcdir/$subdir
mi_gdb_load ${binfile}
-proc test_tbreak_creation_and_listing {} {
+proc test_file_list_exec_source_file {} {
global srcfile
global srcdir
global subdir
set srcfilepath [string_to_regexp ${srcdir}/${subdir}/${srcfile}]
# get the path and absolute path to the current executable
+ #
+ # In gdb 6.2 (at least), the default line number is set by
+ # select_source_symtab to the first line of "main" minus
+ # the value of "lines_to_list" (which defaults to 10) plus one.
+ # --chastain 2004-08-13
+
+ set line_main_head [gdb_get_line_number "main ("]
+ set line_main_body [expr $line_main_head + 2]
+ set gdb_lines_to_list 10
+ set line_default [expr $line_main_body - $gdb_lines_to_list + 1]
+
mi_gdb_test "111-file-list-exec-source-file" \
- "111\\\^done,line=\"23\",file=\"${srcfilepath}\",fullname=\"/.*/${srcfile}\"" \
+ "111\\\^done,line=\"$line_default\",file=\"${srcfilepath}\",fullname=\"/.*/${srcfile}\"" \
"request path info of current source file (${srcfile})"
}
-test_tbreak_creation_and_listing
+proc test_file_list_exec_source_files {} {
+ global srcfile
+
+ # get the path and absolute path to the current executable
+ mi_gdb_test "222-file-list-exec-source-files" \
+ "222\\\^done,files=\\\[\{file=\".*/${srcfile}\",fullname=\"/.*/${srcfile}\"\},\{file=\".*\"\},\{file=\".*\"\},\{file=\".*\"\},\{file=\".*\"\}\\\]" \
+ "Getting a list of source files."
+}
+
+test_file_list_exec_source_file
+test_file_list_exec_source_files
mi_gdb_exit
return 0
diff --git a/gdb/testsuite/gdb.mi/mi-hack-cli.exp b/gdb/testsuite/gdb.mi/mi-hack-cli.exp
index a0489431a2e..185fe9b48fb 100644
--- a/gdb/testsuite/gdb.mi/mi-hack-cli.exp
+++ b/gdb/testsuite/gdb.mi/mi-hack-cli.exp
@@ -1,4 +1,4 @@
-# Copyright 1999 Free Software Foundation, Inc.
+# Copyright 1999, 2001 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-read-memory.exp b/gdb/testsuite/gdb.mi/mi-read-memory.exp
index 573c8964c22..2cc74dda6d4 100644
--- a/gdb/testsuite/gdb.mi/mi-read-memory.exp
+++ b/gdb/testsuite/gdb.mi/mi-read-memory.exp
@@ -1,4 +1,4 @@
-# Copyright 1999, 2000, 2002 Free Software Foundation, Inc.
+# 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
diff --git a/gdb/testsuite/gdb.mi/mi-regs.exp b/gdb/testsuite/gdb.mi/mi-regs.exp
index a6a6406a76d..5dbda48fa91 100644
--- a/gdb/testsuite/gdb.mi/mi-regs.exp
+++ b/gdb/testsuite/gdb.mi/mi-regs.exp
@@ -1,4 +1,4 @@
-# Copyright 1999, 2000, 2002 Free Software Foundation, Inc.
+# 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
diff --git a/gdb/testsuite/gdb.mi/mi-return.exp b/gdb/testsuite/gdb.mi/mi-return.exp
index ca37e9fc9fc..d599940599b 100644
--- a/gdb/testsuite/gdb.mi/mi-return.exp
+++ b/gdb/testsuite/gdb.mi/mi-return.exp
@@ -1,4 +1,4 @@
-# Copyright 1999, 2000, 2002 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -14,9 +14,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-# Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@prep.ai.mit.edu
-
# Test Machine interface (MI) operations
# Verify that, using the MI, we can run a simple program and perform
# exec-return.
@@ -51,9 +48,12 @@ proc test_return_simple {} {
global mi_gdb_prompt
global hex
+ set line_callee3_head [gdb_get_line_number "callee3 ("]
+ set line_callee3_close_brace [expr $line_callee3_head + 3]
+
send_gdb "111-exec-return\n"
gdb_expect {
- -re "111\\^done,frame=\{level=\"0\",addr=\"$hex\",func=\"callee3\",args=\\\[.*\\\],file=\".*basics.c\",line=\"18\"\}\r\n$mi_gdb_prompt$" {pass "return from callee4 now"}
+ -re "111\\^done,frame=\{level=\"0\",addr=\"$hex\",func=\"callee3\",args=\\\[.*\\\],file=\".*basics.c\",line=\"$line_callee3_close_brace\"\}\r\n$mi_gdb_prompt$" {pass "return from callee4 now"}
-re ".*\r\n$mi_gdb_prompt$" { fail "return from callee4 now" }
timeout { fail "return from callee4 now (timeout)"
}
diff --git a/gdb/testsuite/gdb.mi/mi-simplerun.exp b/gdb/testsuite/gdb.mi/mi-simplerun.exp
index a3ebd20910b..9e9385e9571 100644
--- a/gdb/testsuite/gdb.mi/mi-simplerun.exp
+++ b/gdb/testsuite/gdb.mi/mi-simplerun.exp
@@ -1,4 +1,4 @@
-# Copyright 1999, 2000 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -14,9 +14,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-# Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@prep.ai.mit.edu
-
#
# Test essential Machine interface (MI) operations
#
@@ -53,6 +50,13 @@ proc test_breakpoints_creation_and_listing {} {
global srcfile
global hex
+ set line_callee4_head [gdb_get_line_number "callee4 ("]
+ set line_callee3_head [gdb_get_line_number "callee3 ("]
+ set line_callee2_head [gdb_get_line_number "callee2 ("]
+ set line_callee2_body [expr $line_callee2_head + 2]
+ set line_main_head [gdb_get_line_number "main ("]
+ set line_main_body [expr $line_main_head + 2]
+
# Insert some breakpoints and list them
# Also, disable some so they do not interfere with other tests
# Tests:
@@ -62,23 +66,23 @@ proc test_breakpoints_creation_and_listing {} {
# -break-info
mi_gdb_test "200-break-insert main" \
- "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\}" \
+ "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\"\}" \
"break-insert operation"
mi_gdb_test "201-break-insert basics.c:callee2" \
- "201\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee2\",file=\".*basics.c\",line=\"22\",times=\"0\"\}" \
+ "201\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee2\",file=\".*basics.c\",line=\"$line_callee2_body\",times=\"0\"\}" \
"insert breakpoint at basics.c:callee2"
- mi_gdb_test "202-break-insert basics.c:15" \
- "202\\^done,bkpt=\{number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee3\",file=\".*basics.c\",line=\"15\",times=\"0\"\}" \
- "insert breakpoint at basics.c:15 (callee3)"
+ mi_gdb_test "202-break-insert basics.c:$line_callee3_head" \
+ "202\\^done,bkpt=\{number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee3\",file=\".*basics.c\",line=\"$line_callee3_head\",times=\"0\"\}" \
+ "insert breakpoint at basics.c:\$line_callee3_head"
- mi_gdb_test "203-break-insert \"\\\"${srcfile}\\\":6\"" \
- "203\\^done,bkpt=\{number=\"4\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"6\",times=\"0\"\}" \
- "insert breakpoint at \"<fullfilename>\":6 (callee4)"
+ mi_gdb_test "203-break-insert \"\\\"${srcfile}\\\":$line_callee4_head\"" \
+ "203\\^done,bkpt=\{number=\"4\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"$line_callee4_head\",times=\"0\"\}" \
+ "insert breakpoint at \"<fullfilename>\":\$line_callee4_head"
mi_gdb_test "204-break-list" \
- "204\\^done,BreakpointTable=\{.*,hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\},.*\}\\\]\}" \
+ "204\\^done,BreakpointTable=\{.*,hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\"\},.*\}\\\]\}" \
"list of breakpoints"
mi_gdb_test "205-break-disable 2 3 4" \
@@ -94,6 +98,9 @@ proc test_running_the_program {} {
global mi_gdb_prompt
global hex
+ set line_main_head [gdb_get_line_number "main ("]
+ set line_main_body [expr $line_main_head + 2]
+
# Run the program without args, then specify srgs and rerun the program
# Tests:
# -exec-run
@@ -104,7 +111,7 @@ proc test_running_the_program {} {
# The following is equivalent to a send_gdb "000-exec-run\n"
mi_run_cmd
gdb_expect {
- -re "000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"32\"\}\r\n$mi_gdb_prompt$" {
+ -re "000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"$line_main_body\"\}\r\n$mi_gdb_prompt$" {
pass "run to main"
}
-re ".*$mi_gdb_prompt$" {
@@ -120,6 +127,15 @@ proc test_controlled_execution {} {
global mi_gdb_prompt
global hex
+ set line_callee4_head [gdb_get_line_number "callee4 ("]
+ set line_callee4_body [expr $line_callee4_head + 2]
+ set line_callee3_head [gdb_get_line_number "callee3 ("]
+ set line_callee3_close_brace [expr $line_callee3_head + 3]
+ set line_callee1_head [gdb_get_line_number "callee1 ("]
+ set line_callee1_body [expr $line_callee1_head + 2]
+ set line_main_head [gdb_get_line_number "main ("]
+ set line_main_body [expr $line_main_head + 2]
+
# Continue execution until a breakpoint is reached, step into calls, verifying
# if the arguments are correctly shown, continue to the end of a called
# function, step over a call (next).
@@ -129,24 +145,24 @@ proc test_controlled_execution {} {
# -exec-step
# -exec-finish
- mi_next_to "main" "" "basics.c" "33" "next at main"
+ mi_next_to "main" "" "basics.c" [expr $line_main_body + 1] "next at main"
# FIXME: A string argument is not printed right; should be fixed and
# we should look for the right thing here.
# NOTE: The ``\\\\\"'' is for \".
mi_step_to "callee1" \
"\{name=\"intarg\",value=\"2\"\},\{name=\"strarg\",value=\"$hex \\\\\"A string argument\.\\\\\"\"\},\{name=\"fltarg\",value=\"3.5\"\}" \
- "basics.c" "27" "step at main"
+ "basics.c" "$line_callee1_body" "step at main"
# FIXME: A string argument is not printed right; should be fixed and
# we should look for the right thing here.
mi_execute_to "exec-step 3" "end-stepping-range" "callee4" "" \
- "basics.c" "8" "" "step to callee4"
+ "basics.c" $line_callee4_body "" "step to callee4"
# FIXME: A string argument is not printed right; should be fixed and
# we should look for the right thing here.
# NOTE: The ``.'' is part of ``gdb-result-var="$1"''
- mi_finish_to "callee3" ".*" "basics.c" "18" ".1" "0" "exec-finish"
+ mi_finish_to "callee3" ".*" "basics.c" $line_callee3_close_brace ".1" "0" "exec-finish"
}
proc test_controlling_breakpoints {} {
diff --git a/gdb/testsuite/gdb.mi/mi-stack.exp b/gdb/testsuite/gdb.mi/mi-stack.exp
index 966a86dc7ff..2bd12fabe38 100644
--- a/gdb/testsuite/gdb.mi/mi-stack.exp
+++ b/gdb/testsuite/gdb.mi/mi-stack.exp
@@ -1,4 +1,4 @@
-# Copyright 2000, 2002, 2004 Free Software Foundation, Inc.
+# Copyright 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -14,9 +14,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-# Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@prep.ai.mit.edu
-
#
# Test essential Machine interface (MI) operations
#
@@ -50,6 +47,9 @@ proc test_stack_frame_listing {} {
global mi_gdb_prompt
global hex
+ set line_callee4_head [gdb_get_line_number "callee4 ("]
+ set line_callee4_body [expr $line_callee4_head + 2]
+
# Obtain a stack trace
# Tests:
# -stack-list-frames
@@ -57,7 +57,7 @@ proc test_stack_frame_listing {} {
# -stack-list-frames 1 3
mi_gdb_test "231-stack-list-frames" \
- "231\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"8\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\},frame=\{level=\"2\",addr=\"$hex\",func=\"callee2\",.*\},frame=\{level=\"3\",addr=\"$hex\",func=\"callee1\",.*\},frame=\{level=\"4\",addr=\"$hex\",func=\"main\",.*\}\\\]" \
+ "231\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"$line_callee4_body\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\},frame=\{level=\"2\",addr=\"$hex\",func=\"callee2\",.*\},frame=\{level=\"3\",addr=\"$hex\",func=\"callee1\",.*\},frame=\{level=\"4\",addr=\"$hex\",func=\"main\",.*\}\\\]" \
"stack frame listing"
mi_gdb_test "232-stack-list-frames 1 1" \
"232\\^done,stack=\\\[frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\}\\\]" \
@@ -156,10 +156,12 @@ proc test_stack_locals_listing {} {
"232\\^done,locals=\\\[name=\"A\",name=\"B\",name=\"C\"\\\]" \
"stack locals listing 0"
+set line_callee4_return_0 [gdb_get_line_number "return 0;"]
+
# step until A, B, C, have some reasonable values.
send_gdb "-exec-next 3\n"
gdb_expect {
- -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\\\[\\\],file=\".*basics.c\",line=\"13\"\}\r\n$mi_gdb_prompt$" {
+ -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\\\[\\\],file=\".*basics.c\",line=\"$line_callee4_return_0\"\}\r\n$mi_gdb_prompt$" {
pass "next's in callee4"
}
timeout { fail "next in callee4 (timeout)" }
diff --git a/gdb/testsuite/gdb.mi/mi-stepi.exp b/gdb/testsuite/gdb.mi/mi-stepi.exp
index 44e6442150a..867fc39481d 100644
--- a/gdb/testsuite/gdb.mi/mi-stepi.exp
+++ b/gdb/testsuite/gdb.mi/mi-stepi.exp
@@ -1,4 +1,4 @@
-# Copyright 1999, 2000, 2002 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -14,9 +14,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-# Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@prep.ai.mit.edu
-
# Test Machine interface (MI) operations
# Verify that, using the MI, we can run a simple program and perform
# exec-step-instruction and exec-next-instruction.
@@ -50,10 +47,19 @@ proc test_stepi_nexti {} {
global mi_gdb_prompt
global hex
+ set line_main_head [gdb_get_line_number "main ("]
+ set line_main_body [expr $line_main_head + 2]
+ set line_main_hello [gdb_get_line_number "Hello, World!"]
+
send_gdb "111-exec-step-instruction\n"
gdb_expect {
- -re "111\\^running\r\n${mi_gdb_prompt}111\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"3.\"\}\r\n$mi_gdb_prompt$" {
- pass "step-instruction at main"
+ -re "111\\^running\r\n${mi_gdb_prompt}111\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"(\[0-9\]+)\"\}\r\n$mi_gdb_prompt$" {
+ set line $expect_out(1,string)
+ if { $line >= $line_main_body && $line <= $line_main_hello } {
+ pass "step-instruction at main"
+ } else {
+ fail "step-instruction at main"
+ }
}
timeout {
fail "step-instruction at main (timeout)"
@@ -61,8 +67,13 @@ proc test_stepi_nexti {} {
}
send_gdb "222-exec-next-instruction\n"
gdb_expect {
- -re "222\\^running\r\n${mi_gdb_prompt}222\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"3.\"\}\r\n$mi_gdb_prompt$" {
- pass "next-instruction at main"
+ -re "222\\^running\r\n${mi_gdb_prompt}222\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"(\[0-9\]+)\"\}\r\n$mi_gdb_prompt$" {
+ set line $expect_out(1,string)
+ if { $line >= $line_main_body && $line <= $line_main_hello } {
+ pass "next-instruction at main"
+ } else {
+ fail "next-instruction at main"
+ }
}
timeout {
fail "next-instruction at main (timeout)"
@@ -70,8 +81,13 @@ proc test_stepi_nexti {} {
}
send_gdb "333-exec-next-instruction\n"
gdb_expect {
- -re "333\\^running\r\n${mi_gdb_prompt}333\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"3.\"\}\r\n$mi_gdb_prompt$" {
- pass "next-instruction at main"
+ -re "333\\^running\r\n${mi_gdb_prompt}333\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"(\[0-9\]+)\"\}\r\n$mi_gdb_prompt$" {
+ set line $expect_out(1,string)
+ if { $line >= $line_main_body && $line <= $line_main_hello } {
+ pass "next-instruction at main"
+ } else {
+ fail "next-instruction at main"
+ }
}
timeout {
fail "next-instruction at main (timeout)"
diff --git a/gdb/testsuite/gdb.mi/mi-until.exp b/gdb/testsuite/gdb.mi/mi-until.exp
index ac276cc5229..b95cc7625b3 100644
--- a/gdb/testsuite/gdb.mi/mi-until.exp
+++ b/gdb/testsuite/gdb.mi/mi-until.exp
@@ -1,4 +1,4 @@
-# Copyright 1999, 2000 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2001 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-block.exp b/gdb/testsuite/gdb.mi/mi-var-block.exp
index a0b456a90f1..db49456a637 100644
--- a/gdb/testsuite/gdb.mi/mi-var-block.exp
+++ b/gdb/testsuite/gdb.mi/mi-var-block.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
#
# This Program Is Free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -14,9 +14,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-# Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@prep.ai.mit.edu
-
# Test essential Machine interface (MI) operations
#
# Verify that, using the MI, we can create, update, delete variables.
@@ -55,7 +52,9 @@ mi_gdb_test "-var-create foo * foo" \
"create local variable foo"
# step to "foo = 123;"
-mi_step_to "do_block_tests" "" "var-cmd.c" "158" "step at do_block_test"
+mi_step_to "do_block_tests" "" "var-cmd.c" \
+ [gdb_get_line_number "foo = 123;"] \
+ "step at do_block_test"
# Be paranoid and assume 3.2 created foo
@@ -71,7 +70,9 @@ mi_gdb_test "-var-create foo * foo" \
"create local variable foo"
# step to "foo2 = 123;"
-mi_step_to "do_block_tests" "" "var-cmd.c" "161" "step at do_block_test"
+mi_step_to "do_block_tests" "" "var-cmd.c" \
+ [gdb_get_line_number "foo2 = 123;"] \
+ "step at do_block_test"
# Test: c_variable-3.4
# Desc: check foo, cb changed
@@ -80,7 +81,9 @@ mi_gdb_test "-var-update *" \
"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"
+mi_step_to "do_block_tests" "" "var-cmd.c" \
+ [gdb_get_line_number "foo = 321;"] \
+ "step at do_block_test"
# Test: c_variable-3.5
# Desc: create inner block foo
@@ -89,7 +92,9 @@ mi_gdb_test "-var-create inner_foo * foo" \
"create local variable inner_foo"
# step to "foo2 = 0;"
-mi_step_to "do_block_tests" "" "var-cmd.c" "166" "step at do_block_test"
+mi_step_to "do_block_tests" "" "var-cmd.c" \
+ [gdb_get_line_number "foo2 = 0;"] \
+ "step at do_block_test"
# Test: c_variable-3.6
# Desc: create foo2
@@ -121,7 +126,9 @@ mi_gdb_test "-var-delete inner_foo" \
"delete var inner_foo"
# step to "foo = 0;"
-mi_step_to "do_block_tests" "" "var-cmd.c" "168" "step at do_block_test"
+mi_step_to "do_block_tests" "" "var-cmd.c" \
+ [gdb_get_line_number "foo = 0;"] \
+ "step at do_block_test"
# Test: c_variable-3.8
# Desc: check that foo2 out of scope (known gdb problem)
@@ -132,7 +139,9 @@ mi_gdb_test "-var-update foo2" \
clear_xfail *-*-*
# step to "cb = 21;"
-mi_step_to "do_block_tests" "" "var-cmd.c" "171" "step at do_block_test"
+mi_step_to "do_block_tests" "" "var-cmd.c" \
+ [gdb_get_line_number "cb = 21;"] \
+ "step at do_block_test"
# Test: c_variable-3.9
# Desc: check that only cb is in scope (known gdb problem)
diff --git a/gdb/testsuite/gdb.mi/mi-var-child.exp b/gdb/testsuite/gdb.mi/mi-var-child.exp
index 74a5894ce5d..d0fb3957658 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, 2004 Free Software Foundation
+# Copyright 1999, 2000, 2001, 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
@@ -14,9 +14,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-# Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@prep.ai.mit.edu
-
# Test essential Machine interface (MI) operations
#
# Verify that, using the MI, we can create, update, delete variables.
@@ -555,8 +552,9 @@ mi_gdb_test "-var-info-num-children 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"
+set line_dct_123 [gdb_get_line_number "struct_declarations.integer = 123;"]
+mi_step_to do_children_tests {} {.*var-cmd.c} \
+ $line_dct_123 "step to line \$line_dct_123"
# Test: c_variable-4.81
# Desc: create local variable "weird"
@@ -754,8 +752,8 @@ mi_gdb_test "-var-update *" \
"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"
+mi_step_to do_children_tests {} {.*var-cmd.c} \
+ [expr $line_dct_123 + 1] "step \$line_dct_123 + 1"
# Test: c_variable-5.2
# Desc: check that integer changed
@@ -767,8 +765,8 @@ mi_gdb_test "-var-update *" \
# 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"
+mi_execute_to "exec-step 3" "end-stepping-range" do_children_tests {} {.*var-cmd.c} \
+ [expr $line_dct_123 + 4] {} "step \$line_dct_123 + 4"
# Test: c_variable-5.3
# Desc: check that char_ptr changed
@@ -777,8 +775,8 @@ mi_gdb_test "-var-update *" \
"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"
+mi_step_to do_children_tests {} {.*var-cmd.c} \
+ [expr $line_dct_123 + 5] "step \$line_dct_123 + 5"
# Test: c_variable-5.4
# Desc: check that int_ptr_ptr and children changed
@@ -787,8 +785,8 @@ mi_gdb_test "-var-update *" \
"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"
+mi_step_to do_children_tests {} {.*var-cmd.c} \
+ [expr $line_dct_123 + 6] "step \$line_dct_123 + 6"
# Test: c_variable-5.5
# Desc: check that long_array[0] changed
@@ -797,8 +795,8 @@ mi_gdb_test "-var-update *" \
"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"
+mi_step_to do_children_tests {} {.*var-cmd.c} \
+ [expr $line_dct_123 + 7] "step \$line_dct_123 + 7"
# Test: c_variable-5.6
# Desc: check that long_array[1] changed
@@ -807,8 +805,8 @@ mi_gdb_test "-var-update *" \
"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"
+mi_step_to do_children_tests {} {.*var-cmd.c} \
+ [expr $line_dct_123 + 8] "step \$line_dct_123 + 8"
# Test: c_variable-5.7
# Desc: check that long_array[2] changed
@@ -824,8 +822,10 @@ mi_gdb_test "-var-update *" \
# 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"
+
+set line_dct_nothing [gdb_get_line_number "weird->func_ptr = nothing;"]
+mi_execute_to "exec-step 7" "end-stepping-range" do_children_tests {} {.*var-cmd.c} \
+ $line_dct_nothing {} "step \$line_dct_nothing"
# Test: c_variable-5.8
# Desc: check that long_array[3-9] changed
@@ -838,8 +838,9 @@ mi_gdb_test "-var-list-children --all-values struct_declarations.long_array" \
"listing of names and values of children"
# Step over "weird->func_ptr = nothing;"
-set line 211
-mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line"
+set line_dct_a0_0 [gdb_get_line_number "a0 = '0';"]
+mi_step_to do_children_tests {} {.*var-cmd.c} \
+ $line_dct_a0_0 "step \$line_dct_a0_0"
# Test: c_variable-5.9
# Desc: check that func_ptr changed
@@ -859,8 +860,10 @@ mi_gdb_test "-var-delete 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"
+
+set line_dct_snp0 [gdb_get_line_number "psnp = &snp0;"]
+mi_execute_to "exec-step 43" "end-stepping-range" do_children_tests {} {.*var-cmd.c} \
+ [expr $line_dct_snp0 + 1] {} "step \$line_dct_snp0 + 1"
# Test: c_variable-5.10
# Desc: create psnp->char_ptr
@@ -1130,8 +1133,8 @@ mi_gdb_test "-var-list-children psnp->ptrs.0.next.next.ptrs" \
"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"
+mi_step_to do_children_tests {} {.*var-cmd.c} \
+ [expr $line_dct_snp0 + 2] "step \$line_dct_snp0 + 2"
# Test: c_variable-5.47
# Desc: check that psnp->char_ptr (and [0].char_ptr) changed
@@ -1140,8 +1143,8 @@ mi_gdb_test "-var-update *" \
"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"
+mi_step_to do_children_tests {} {.*var-cmd.c} \
+ [expr $line_dct_snp0 + 3] "step \$line_dct_snp0 + 3"
# Test: c_variable-5.48
# Desc: check that psnp->next->char_ptr (and [1].char_ptr) changed
@@ -1151,8 +1154,8 @@ mi_gdb_test "-var-update *" \
# Step over "snp2.char_ptr = &a3;"
-set line 257
-mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line"
+mi_step_to do_children_tests {} {.*var-cmd.c} \
+ [expr $line_dct_snp0 + 4] "step \$line_dct_snp0 + 4"
# Test: c_variable-5.49
# Desc: check that psnp->next->next->char_ptr (and [2].char_ptr) changed
@@ -1162,8 +1165,8 @@ mi_gdb_test "-var-update *" \
# Step over "snp0.long_ptr = &y3;"
-set line 258
-mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line"
+mi_step_to do_children_tests {} {.*var-cmd.c} \
+ [expr $line_dct_snp0 + 5] "step \$line_dct_snp0 + 5"
# Test: c_variable-5.50
# Desc: check that psnp->long_ptr (and [0].long_ptr) changed
@@ -1173,8 +1176,8 @@ mi_gdb_test "-var-update *" \
# Step over "snp1.long_ptr = &x3;"
-set line 259
-mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line"
+mi_step_to do_children_tests {} {.*var-cmd.c} \
+ [expr $line_dct_snp0 + 6] "step \$line_dct_snp0 + 6"
# Test: c_variable-5.51
# Desc: check that psnp->next->long_ptr (and [1].long_ptr) changed
@@ -1190,8 +1193,8 @@ clear_xfail *-*-*
#
# Step over "snp2.long_ptr = &z3;"
-set line 260
-mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line"
+mi_step_to do_children_tests {} {.*var-cmd.c} \
+ [expr $line_dct_snp0 + 7] "step \$line_dct_snp0 + 7"
# Test: c_variable-5.52
# Desc: check that psnp->next->next->long_ptr (and [2].long_ptr) changed
diff --git a/gdb/testsuite/gdb.mi/mi-var-cmd.exp b/gdb/testsuite/gdb.mi/mi-var-cmd.exp
index 7d02b36943a..adc49951468 100644
--- a/gdb/testsuite/gdb.mi/mi-var-cmd.exp
+++ b/gdb/testsuite/gdb.mi/mi-var-cmd.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
#
# This Program Is Free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -14,9 +14,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-# Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@prep.ai.mit.edu
-
# Test essential Machine interface (MI) operations
#
# Verify that, using the MI, we can create, update, delete variables.
@@ -168,7 +165,8 @@ mi_gdb_test "-var-update *" \
"update all vars"
# Step over "linteger = 1234;"
-mi_step_to "do_locals_tests" "" "var-cmd.c" "107" "step at do_locals_test"
+set line_dlt_linteger [gdb_get_line_number "lpinteger = &linteger;"]
+mi_step_to "do_locals_tests" "" "var-cmd.c" $line_dlt_linteger "step at do_locals_test"
# Test: c_variable-2.2
# Desc: check whether only linteger changed values
@@ -177,7 +175,7 @@ mi_gdb_test "-var-update *" \
"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)"
+mi_step_to "do_locals_tests" "" "var-cmd.c" [expr $line_dlt_linteger + 1] "step at do_locals_tests (2)"
# Test: c_variable-2.3
# Desc: check whether only lpinteger changed
@@ -186,7 +184,7 @@ mi_gdb_test "-var-update *" \
"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)"
+mi_step_to "do_locals_tests" "" "var-cmd.c" [expr $line_dlt_linteger + 2] "step at do_locals_tests (3)"
# Test: c_variable-2.4
# Desc: check whether only lcharacter changed
@@ -195,7 +193,7 @@ mi_gdb_test "-var-update *" \
"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)"
+mi_step_to "do_locals_tests" "" "var-cmd.c" [expr $line_dlt_linteger + 3] "step at do_locals_tests (4)"
# Test: c_variable-2.5
# Desc: check whether only lpcharacter changed
@@ -216,7 +214,7 @@ mi_gdb_test "-var-update *" \
# 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)"
+ "var-cmd.c" [expr $line_dlt_linteger + 12] "" "step at do_locals_tests (5)"
# Test: c_variable-2.6
# Desc: check whether llong, lplong, lfloat, lpfloat, ldouble, lpdouble, lsimple.integer,
@@ -231,8 +229,10 @@ mi_gdb_test "-var-update *" \
# lpsimple = &lsimple;
# func = nothing;
+set line_dlt_4321 [gdb_get_line_number "linteger = 4321;"]
+
mi_execute_to "exec-step 4" "end-stepping-range" "do_locals_tests" "" \
- "var-cmd.c" "125" "" "step at do_locals_tests (6)"
+ "var-cmd.c" $line_dlt_4321 "" "step at do_locals_tests (6)"
# Test: c_variable-2.7
# Desc: check whether (lsimple.signed_character, lsimple.char_ptr) lpsimple, func changed
@@ -251,7 +251,7 @@ mi_gdb_test "-var-update *" \
# 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)"
+ "var-cmd.c" [expr $line_dlt_4321 + 8] "" "step at do_locals_tests (7)"
# Test: c_variable-2.8
# Desc: check whether linteger, lcharacter, llong, lfoat, ldouble, lsimple.integer,
@@ -384,12 +384,14 @@ mi_gdb_test "-var-assign lsimple.integer 333" \
# End of assign tests
#####
+set line_subroutine1_body [gdb_get_line_number "global_simple.integer = i + 3;"]
+
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\"\}" \
+ "\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"subroutine1\",file=\".*var-cmd.c\",line=\"$line_subroutine1_body\",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"
+ "var-cmd.c" $line_subroutine1_body "continue to subroutine1"
# Test: c_variable-2.10
# Desc: create variable for locals i,l in subroutine1
@@ -408,7 +410,7 @@ mi_gdb_test "-var-create linteger * linteger" \
"create linteger"
mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \
- "var-cmd.c" "147" "step at subroutine1"
+ "var-cmd.c" [expr $line_subroutine1_body + 1] "step at subroutine1"
# Test: c_variable-2.12
# Desc: change global_simple.integer
@@ -424,7 +426,7 @@ mi_gdb_test "-var-update *" \
clear_xfail *-*-*
mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \
- "var-cmd.c" "148" "step at subroutine1 (2)"
+ "var-cmd.c" [expr $line_subroutine1_body + 2] "step at subroutine1 (2)"
# Test: c_variable-2.13
# Desc: change subroutine1 local i
@@ -433,7 +435,7 @@ mi_gdb_test "-var-update *" \
"update all vars: i changed"
mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \
- "var-cmd.c" "149" "step at subroutine1 (3)"
+ "var-cmd.c" [expr $line_subroutine1_body + 3] "step at subroutine1 (3)"
# Test: c_variable-2.14
# Desc: change do_locals_tests local llong
@@ -441,7 +443,9 @@ 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"
+set line_dlt_call_subroutine1 [gdb_get_line_number "subroutine1 (linteger, &llong);"]
+mi_next_to "do_locals_tests" "" "var-cmd.c" \
+ [expr $line_dlt_call_subroutine1 + 1] "next out of subroutine1"
# Test: c_variable-2.15
# Desc: check for out of scope subroutine1 locals
diff --git a/gdb/testsuite/gdb.mi/mi-var-display.exp b/gdb/testsuite/gdb.mi/mi-var-display.exp
index ab5a17b4ada..a9576e1cb09 100644
--- a/gdb/testsuite/gdb.mi/mi-var-display.exp
+++ b/gdb/testsuite/gdb.mi/mi-var-display.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
#
# This Program Is Free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -14,9 +14,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-# Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@prep.ai.mit.edu
-
# Test essential Machine interface (MI) operations
#
# Verify that, using the MI, we can create, update, delete variables.
@@ -42,14 +39,16 @@ 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\"\}" \
+set line_dct_close_brace [expr [gdb_get_line_number "snp2.long_ptr = &z3;"] + 1]
+
+mi_gdb_test "200-break-insert $line_dct_close_brace" \
+ "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_children_tests\",file=\".*var-cmd.c\",line=\"$line_dct_close_brace\",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$" {
+ -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=\"$line_dct_close_brace\"\}\r\n$mi_gdb_prompt$" {
pass "run to do_children_tests"
}
-re ".*$mi_gdb_prompt$" {fail "run to do_children_tests (2)"}
@@ -324,13 +323,16 @@ mi_gdb_test "-var-delete weird" \
##### #####
# Stop in "do_special_tests"
+
+set line_dst_a_1 [gdb_get_line_number "a = 1;"]
+
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\"\}" \
+ "200\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_special_tests\",file=\".*var-cmd.c\",line=\"$line_dst_a_1\",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$" {
+ -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=\"$line_dst_a_1\"\}\r\n$mi_gdb_prompt$" {
pass "continue to do_special_tests"
}
timeout {
@@ -583,15 +585,17 @@ gdb_expect {
timeout { fail "print FP register (timeout)"}
}
+set line_incr_a_b_a [gdb_get_line_number "b = a;"]
+
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\"\}" \
+ "200\\^done,bkpt=\{number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"incr_a\",file=\".*var-cmd.c\",line=\"$line_incr_a_b_a\",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$" {
+ -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=\"$line_incr_a_b_a\"\}\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$" {
+ -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=\"([expr $line_incr_a_b_a - 2]|[expr $line_incr_a_b_a - 1]|$line_incr_a_b_a)\"\}\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$" {
diff --git a/gdb/testsuite/gdb.mi/mi-watch.exp b/gdb/testsuite/gdb.mi/mi-watch.exp
index ba243999d19..8fe9173f1bc 100644
--- a/gdb/testsuite/gdb.mi/mi-watch.exp
+++ b/gdb/testsuite/gdb.mi/mi-watch.exp
@@ -1,4 +1,4 @@
-# Copyright 1999, 2000, 2002 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -14,9 +14,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-# Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@prep.ai.mit.edu
-
#
# Test essential Machine interface (MI) operations
#
@@ -52,6 +49,9 @@ proc test_watchpoint_creation_and_listing {} {
global srcfile
global hex
+ set line_callee4_head [gdb_get_line_number "callee4 ("]
+ set line_callee4_body [expr $line_callee4_head + 2]
+
# Insert a watchpoint and list
# Tests:
# -break-watch C
@@ -62,7 +62,7 @@ proc test_watchpoint_creation_and_listing {} {
"break-watch operation"
mi_gdb_test "222-break-list" \
- "222\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"8\",times=\"1\"\},bkpt=\{number=\"2\",type=\".*watchpoint\",disp=\"keep\",enabled=\"y\",addr=\"\",what=\"C\",times=\"0\"\}\\\]\}" \
+ "222\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"$line_callee4_body\",times=\"1\"\},bkpt=\{number=\"2\",type=\".*watchpoint\",disp=\"keep\",enabled=\"y\",addr=\"\",what=\"C\",times=\"0\"\}\\\]\}" \
"list of watchpoints"
}
@@ -73,17 +73,20 @@ proc test_awatch_creation_and_listing {} {
global srcfile
global hex
+ set line_main_head [gdb_get_line_number "main ("]
+ set line_main_body [expr $line_main_head + 2]
+
# Insert an access watchpoint and list it
# Tests:
# -break-watch -a A
# -break-list
mi_gdb_test "333-break-watch -a A" \
- "333\\^done,bkpt=\{number=\"1\",addr=\"$hex\",file=\".*basics.c\",line=\"32\"\}" \
+ "333\\^done,bkpt=\{number=\"1\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_main_body\"\}" \
"break-watch -a operation"
mi_gdb_test "444-break-list" \
- "444\\^done,BreakpointTable=\{.*,hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"3\",type=\"watchpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\},.*\}\\\]\}" \
+ "444\\^done,BreakpointTable=\{.*,hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"3\",type=\"watchpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\"\},.*\}\\\]\}" \
"list of watchpoints awatch"
mi_gdb_test "777-break-delete 3" \
@@ -97,17 +100,20 @@ proc test_rwatch_creation_and_listing {} {
global srcfile
global hex
+ set line_main_head [gdb_get_line_number "main ("]
+ set line_main_body [expr $line_main_head + 2]
+
# Insert a read watchpoint and list it.
# Tests:
# -break-insert -r B
# -break-list
mi_gdb_test "200-break-watch -r C" \
- "200\\^done,bkpt=\{number=\"5\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"32\",times=\"0\"\}" \
+ "200\\^done,bkpt=\{number=\"5\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\"\}" \
"break-insert -r operation"
mi_gdb_test "300-break-list" \
- "300\\^done,BreakpointTable=\{.*,hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"5\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\},.*\}\\\}\}" \
+ "300\\^done,BreakpointTable=\{.*,hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"5\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\"\},.*\}\\\}\}" \
"list of breakpoints"
mi_gdb_test "177-break-delete 4" \
@@ -119,6 +125,10 @@ proc test_watchpoint_triggering {} {
global mi_gdb_prompt
global hex
+ set line_callee4_return_0 [gdb_get_line_number "return 0;"]
+ set line_callee3_head [gdb_get_line_number "callee3 ("]
+ set line_callee3_close_brace [expr $line_callee3_head + 3]
+
# Continue execution until the watchpoint is reached, continue again,
# to see the watchpoint go out of scope.
# Does:
@@ -129,7 +139,7 @@ proc test_watchpoint_triggering {} {
gdb_expect {
-re "222\\^running\r\n$mi_gdb_prompt" {
gdb_expect {
- -re "222\\*stopped,reason=\"watchpoint-trigger\",wpt=\{number=\"2\",exp=\"C\"\},value=\{old=\".*\",new=\"3\"\},thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\\\[\\\],file=\".*basics.c\",line=\"13\"\}\r\n$mi_gdb_prompt$" {
+ -re "222\\*stopped,reason=\"watchpoint-trigger\",wpt=\{number=\"2\",exp=\"C\"\},value=\{old=\".*\",new=\"3\"\},thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\\\[\\\],file=\".*basics.c\",line=\"$line_callee4_return_0\"\}\r\n$mi_gdb_prompt$" {
pass "watchpoint trigger"
}
-re ".*$mi_gdb_prompt$" {fail "watchpoint trigger (2)"}
@@ -144,7 +154,7 @@ proc test_watchpoint_triggering {} {
gdb_expect {
-re "223\\^running\r\n$mi_gdb_prompt" {
gdb_expect {
- -re "\[\r\n\]*223\\*stopped,reason=\"watchpoint-scope\",wpnum=\"2\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee3\",args=\\\[.*\\\],file=\".*basics.c\",line=\"18\"\}\r\n$mi_gdb_prompt$" {
+ -re "\[\r\n\]*223\\*stopped,reason=\"watchpoint-scope\",wpnum=\"2\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee3\",args=\\\[.*\\\],file=\".*basics.c\",line=\"$line_callee3_close_brace\"\}\r\n$mi_gdb_prompt$" {
pass "wp out of scope"
}
-re ".*$mi_gdb_prompt$" {fail "wp out of scope (2)"}
diff --git a/gdb/testsuite/gdb.mi/mi2-basics.exp b/gdb/testsuite/gdb.mi/mi2-basics.exp
index a86ba3765b5..0fd1c87e157 100644
--- a/gdb/testsuite/gdb.mi/mi2-basics.exp
+++ b/gdb/testsuite/gdb.mi/mi2-basics.exp
@@ -1,4 +1,5 @@
-# Copyright 1999, 2000, 2004 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2001, 2002, 2003, 2004
+# Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/mi2-break.exp b/gdb/testsuite/gdb.mi/mi2-break.exp
index 11cb0d98045..e22bf1686f7 100644
--- a/gdb/testsuite/gdb.mi/mi2-break.exp
+++ b/gdb/testsuite/gdb.mi/mi2-break.exp
@@ -1,4 +1,4 @@
-# Copyright 1999 Free Software Foundation, Inc.
+# Copyright 1999, 2001, 2003, 2004 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -14,9 +14,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-# Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@prep.ai.mit.edu
-
#
# Test essential Machine interface (MI) operations
#
@@ -47,39 +44,56 @@ mi_delete_breakpoints
mi_gdb_reinitialize_dir $srcdir/$subdir
mi_gdb_load ${binfile}
+# Locate line numbers in basics.c.
+set line_callee4_head [gdb_get_line_number "callee4 ("]
+set line_callee4_body [expr $line_callee4_head + 2]
+set line_callee3_head [gdb_get_line_number "callee3 ("]
+set line_callee3_body [expr $line_callee3_head + 2]
+set line_callee2_head [gdb_get_line_number "callee2 ("]
+set line_callee2_body [expr $line_callee2_head + 2]
+set line_callee1_head [gdb_get_line_number "callee1 ("]
+set line_callee1_body [expr $line_callee1_head + 2]
+set line_main_head [gdb_get_line_number "main ("]
+set line_main_body [expr $line_main_head + 2]
+
proc test_tbreak_creation_and_listing {} {
global mi_gdb_prompt
global srcfile
global hex
+ global line_callee4_head line_callee4_body
+ global line_callee3_head line_callee3_body
+ global line_callee2_head line_callee2_body
+ global line_callee1_head line_callee1_body
+ global line_main_head line_main_body
# 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-insert -t basics.c:$line_callee3_head
+ # -break-insert -t srcfile:$line_callee4_head
# -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\"\}" \
+ "222\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"$line_main_body\",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\"\}" \
+ "333\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"callee2\",file=\".*basics.c\",line=\"$line_callee2_body\",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)"
+ mi_gdb_test "444-break-insert -t basics.c:$line_callee3_head" \
+ "444\\^done,bkpt=\{number=\"3\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"callee3\",file=\".*basics.c\",line=\"$line_callee3_head\",times=\"0\"\}" \
+ "insert temp breakpoint at basics.c:\$line_callee3_body"
- # 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)"
+ # Getting the quoting right is tricky. That is "\"<file>\":$line_callee4_head"
+ mi_gdb_test "555-break-insert -t \"\\\"${srcfile}\\\":$line_callee4_head\"" \
+ "555\\^done,bkpt=\{number=\"4\",type=\"breakpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"$line_callee4_head\",times=\"0\"\}" \
+ "insert temp breakpoint at \"<fullfilename>\":\$line_callee4_head"
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\"\}.*\\\]\}" \
+ "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=\"$line_main_body\",times=\"0\"\}.*\\\]\}" \
"list of breakpoints"
mi_gdb_test "777-break-delete" \
@@ -91,6 +105,11 @@ proc test_rbreak_creation_and_listing {} {
global mi_gdb_prompt
global srcfile
global hex
+ global line_callee4_head line_callee4_body
+ global line_callee3_head line_callee3_body
+ global line_callee2_head line_callee2_body
+ global line_callee1_head line_callee1_body
+ global line_main_head line_main_body
# Insert some breakpoints and list them
# Also, disable some so they do not interfere with other tests
@@ -103,27 +122,27 @@ proc test_rbreak_creation_and_listing {} {
setup_xfail "*-*-*"
mi_gdb_test "122-break-insert -r main" \
- "122\\^done,bkpt=\{number=\"5\",addr=\"$hex\",file=\".*basics.c\",line=\"32\"\}" \
+ "122\\^done,bkpt=\{number=\"5\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_main_body\"\}" \
"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\"\}" \
+ "133\\^done,bkpt=\{number=\"6\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_callee2_body\"\}" \
"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\"\}" \
+ "144\\^done,bkpt=\{number=\"7\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_callee1_body\"\},bkpt=\{number=\"8\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_callee2_body\"\},bkpt=\{number=\"9\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_callee3_body\"\},bkpt=\{number=\"10\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_callee4_body\"\}" \
"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\"\}" \
+ "155\\^done,bkpt=\{number=\"11\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_callee1_body\"\},bkpt=\{number=\"12\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_callee2_body\"\},bkpt=\{number=\"13\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_callee3_body\"\},bkpt=\{number=\"14\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_callee4_body\"\}" \
"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\"\},.*\}\\\]\}" \
+ "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=\"$line_main_body\",times=\"0\"\},.*\}\\\]\}" \
"list of breakpoints"
mi_gdb_test "177-break-delete" \
diff --git a/gdb/testsuite/gdb.mi/mi2-cli.exp b/gdb/testsuite/gdb.mi/mi2-cli.exp
index 10295a90ce2..3a0793d420b 100644
--- a/gdb/testsuite/gdb.mi/mi2-cli.exp
+++ b/gdb/testsuite/gdb.mi/mi2-cli.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 tests that GDB's console can be accessed via the MI.
# Specifically, we are testing the "interpreter-exec" command and that
# the commands that are executed via this command are properly executed.
@@ -67,6 +64,11 @@ mi_gdb_test "-interpreter-exec console \"file $binfile\"" \
mi_run_to_main
+set line_main_head [gdb_get_line_number "main ("]
+set line_main_body [expr $line_main_head + 2]
+set line_main_hello [gdb_get_line_number "Hello, World!"]
+set line_main_return [expr $line_main_hello + 2]
+
mi_gdb_test "-interpreter-exec console \"set args foobar\"" \
{\^done} \
"-interpreter-exec console \"set args foobar\""
@@ -91,8 +93,9 @@ mi_gdb_test "-interpreter-exec console \"set listsize 1\"" \
{\^done} \
"-interpreter-exec console \"set listsize 1\""
+# {.*\~"32[ \t(\\t)]*callee1.*\\n".*\^done }
mi_gdb_test "-interpreter-exec console \"list\"" \
- {.*\~"32[ \t(\\t)]*callee1.*\\n".*\^done} \
+ ".*\~\"$line_main_body\[\\\\t \]*callee1.*;\\\\n\".*\\^done" \
"-interpreter-exec console \"list\""
# # NOTE: cagney/2003-02-03: Not yet.
@@ -150,43 +153,43 @@ mi_gdb_test "500-stack-select-frame 0" \
"-stack-select-frame 0"
# NOTE: cagney/2003-02-03: Not yet.
-# mi_gdb_test "-break-insert -t basics.c:35" \
+# mi_gdb_test "-break-insert -t basics.c:$line_main_hello" \
# {.*=breakpoint-create,number="3".*\^done} \
-# "-break-insert -t basics.c:35"
-mi_gdb_test "600-break-insert -t basics.c:35" \
+# "-break-insert -t basics.c:\$line_main_hello"
+mi_gdb_test "600-break-insert -t basics.c:$line_main_hello" \
{600\^done,bkpt=.number="3",type="breakpoint".*\}} \
- "-break-insert -t basics.c:35"
+ "-break-insert -t basics.c:\$line_main_hello"
# mi_gdb_test "-exec-continue" \
-# {.*\*stopped.*,file=".*basics.c",line="35"\}} \
-# "-exec-continue to line 35"
+# {.*\*stopped.*,file=".*basics.c",line="$line_main_hello"\}} \
+# "-exec-continue to line \$line_main_hello"
send_gdb "700-exec-continue\n"
gdb_expect {
- -re "700\\^running\[\r\n\]+$mi_gdb_prompt.*\\*stopped.*,file=.*basics.c.,line=.35.*$mi_gdb_prompt$" {
- pass "-exec-continue to line 35"
+ -re "700\\^running\[\r\n\]+$mi_gdb_prompt.*\\*stopped.*,file=.*basics.c.,line=.$line_main_hello.*$mi_gdb_prompt$" {
+ pass "-exec-continue to line \$line_main_hello"
}
timeout {
- fail "-exec-continue to line 35"
+ fail "-exec-continue to line \$line_main_hello"
}
}
# NOTE: cagney/2003-02-03: Not yet.
# mi_gdb_test "-exec-next" \
-# {.*\*stopped,reason="end-stepping-range",.*,file=".*basics.c",line="37"\}} \
-# "-exec-next to line 37"
+# {.*\*stopped,reason="end-stepping-range",.*,file=".*basics.c",line="$line_main_return"\}} \
+# "-exec-next to line \$line_main_return"
send_gdb "800-exec-next\n"
gdb_expect {
- -re "800\\^running\[\r\n\]+$mi_gdb_prompt.*\\*stopped,reason=.end-stepping-range.*,file=.*basics.c.,line=.37.*$mi_gdb_prompt$" {
- pass "-exec-next to line 37"
+ -re "800\\^running\[\r\n\]+$mi_gdb_prompt.*\\*stopped,reason=.end-stepping-range.*,file=.*basics.c.,line=.$line_main_return.*$mi_gdb_prompt$" {
+ pass "-exec-next to line \$line_main_return"
}
timeout {
- fail "-exec-next to line 37"
+ fail "-exec-next to line \$line_main_return"
}
}
mi_gdb_test "-interpreter-exec console \"list\"" \
- {\~"37[ \t(\\t)]*return 0;\\n".*\^done} \
- "-interpreter-exec console \"list\" at basics.c:37"
+ "\~\"$line_main_return\[\\\\t ]*return 0;\\\\n\".*\\^done" \
+ "-interpreter-exec console \"list\" at basics.c:\$line_main_return"
mi_gdb_test "-interpreter-exec console \"help set args\"" \
{\~"Set argument list to give program being debugged when it is started\.\\nFollow this command with any number of args, to be passed to the program\.".*\^done} \
diff --git a/gdb/testsuite/gdb.mi/mi2-console.exp b/gdb/testsuite/gdb.mi/mi2-console.exp
index 5e307b9e6f3..dba80c9f606 100644
--- a/gdb/testsuite/gdb.mi/mi2-console.exp
+++ b/gdb/testsuite/gdb.mi/mi2-console.exp
@@ -1,4 +1,4 @@
-# Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/mi2-disassemble.exp b/gdb/testsuite/gdb.mi/mi2-disassemble.exp
index 8cd76f968c4..a56b027ee21 100644
--- a/gdb/testsuite/gdb.mi/mi2-disassemble.exp
+++ b/gdb/testsuite/gdb.mi/mi2-disassemble.exp
@@ -1,4 +1,4 @@
-# Copyright 1999, 2000, 2002 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -14,9 +14,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-# Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@prep.ai.mit.edu
-
#
# Test Machine interface (MI) operations for disassembly.
#
@@ -48,17 +45,20 @@ proc test_disassembly_only {} {
global hex
global decimal
+ set line_main_head [gdb_get_line_number "main ("]
+ set line_main_body [expr $line_main_head + 2]
+
# Test disassembly more only for the current function.
# Tests:
# -data-disassemble -s $pc -e "$pc+8" -- 0
- # -data-disassembly -f basics.c -l 32 -- 0
+ # -data-disassembly -f basics.c -l $line_main_body -- 0
mi_gdb_test "print/x \$pc" "" ""
mi_gdb_test "111-data-disassemble -s \$pc -e \"\$pc + 12\" -- 0" \
"111\\^done,asm_insns=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\},\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}.*\]" \
"data-disassemble from pc to pc+12 assembly only"
- mi_gdb_test "222-data-disassemble -f basics.c -l 32 -- 0" \
+ mi_gdb_test "222-data-disassemble -f basics.c -l $line_main_body -- 0" \
"222\\^done,asm_insns=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"0\",inst=\".*\"\},.*,\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}\\\]" \
"data-disassemble file & line, assembly only"
}
@@ -68,22 +68,25 @@ proc test_disassembly_lines_limit {} {
global hex
global decimal
+ set line_main_head [gdb_get_line_number "main ("]
+ set line_main_body [expr $line_main_head + 2]
+
# Test disassembly more only for the current function.
# Tests:
- # -data-disassembly -f basics.c -l 32 -n 20 -- 0
- # -data-disassembly -f basics.c -l 32 -n 0 -- 0
- # -data-disassembly -f basics.c -l 32 -n 50 -- 0
+ # -data-disassembly -f basics.c -l $line_main_body -n 20 -- 0
+ # -data-disassembly -f basics.c -l $line_main_body -n 0 -- 0
+ # -data-disassembly -f basics.c -l $line_main_body -n 50 -- 0
mi_gdb_test "print/x \$pc" "" ""
- mi_gdb_test "222-data-disassemble -f basics.c -l 32 -n 20 -- 0" \
+ mi_gdb_test "222-data-disassemble -f basics.c -l $line_main_body -n 20 -- 0" \
"222\\^done,asm_insns=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"0\",inst=\".*\"\},.*,\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}\\\]" \
"data-disassemble file, line, number assembly only"
- mi_gdb_test "222-data-disassemble -f basics.c -l 32 -n 0 -- 0" \
+ mi_gdb_test "222-data-disassemble -f basics.c -l $line_main_body -n 0 -- 0" \
"222\\^done,asm_insns=\\\[\\\]" \
"data-disassemble file, line, number (zero lines) assembly only"
- mi_gdb_test "222-data-disassemble -f basics.c -l 32 -n 50 -- 0" \
+ mi_gdb_test "222-data-disassemble -f basics.c -l $line_main_body -n 50 -- 0" \
"222\\^done,asm_insns=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"0\",inst=\".*\"\},.*,\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}\\\]" \
"data-disassemble file, line, number (more than main lines) assembly only"
}
@@ -94,13 +97,16 @@ proc test_disassembly_mixed {} {
global hex
global decimal
+ set line_callee2_head [gdb_get_line_number "callee2 ("]
+ set line_callee2_open_brace [expr $line_callee2_head + 1]
+
# Test disassembly more only for the current function.
# Tests:
- # -data-disassembly -f basics.c -l 21 -- 1
+ # -data-disassembly -f basics.c -l $line_callee2_open_brace -- 1
# -data-disassembly -s $pc -e "$pc+8" -- 1
- mi_gdb_test "002-data-disassemble -f basics.c -l 21 -- 1" \
- "002\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"21\",file=\".*basics.c\",line_asm_insn=\\\[\{address=\"$hex\",func-name=\"callee2\",offset=\"0\",inst=\".*\"\}.*\\\]\}.*,src_and_asm_line=\{line=\"$decimal\",file=\".*basics.c\",line_asm_insn=\\\[.*\{address=\"$hex\",func-name=\"callee2\",offset=\"$decimal\",inst=\".*\"\}\\\]\}\\\]" \
+ mi_gdb_test "002-data-disassemble -f basics.c -l $line_callee2_open_brace -- 1" \
+ "002\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"$line_callee2_open_brace\",file=\".*basics.c\",line_asm_insn=\\\[\{address=\"$hex\",func-name=\"callee2\",offset=\"0\",inst=\".*\"\}.*\\\]\}.*,src_and_asm_line=\{line=\"$decimal\",file=\".*basics.c\",line_asm_insn=\\\[.*\{address=\"$hex\",func-name=\"callee2\",offset=\"$decimal\",inst=\".*\"\}\\\]\}\\\]" \
"data-disassemble file, line assembly mixed"
#
@@ -118,22 +124,26 @@ proc test_disassembly_mixed_lines_limit {} {
global hex
global decimal
+ set line_main_head [gdb_get_line_number "main ("]
+ set line_main_open_brace [expr $line_main_head + 1]
+ set line_main_body [expr $line_main_head + 2]
+
# Test disassembly more only for the current function.
# Tests:
- # -data-disassembly -f basics.c -l 32 -n 20 -- 1
- # -data-disassembly -f basics.c -l 32 -n 0 -- 1
- # -data-disassembly -f basics.c -l 32 -n 50 -- 1
+ # -data-disassembly -f basics.c -l $line_main_body -n 20 -- 1
+ # -data-disassembly -f basics.c -l $line_main_body -n 0 -- 1
+ # -data-disassembly -f basics.c -l $line_main_body -n 50 -- 1
mi_gdb_test "print/x \$pc" "" ""
- mi_gdb_test "222-data-disassemble -f basics.c -l 32 -n 20 -- 1" \
+ mi_gdb_test "222-data-disassemble -f basics.c -l $line_main_body -n 20 -- 1" \
"222\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"$decimal\",file=\".*basics.c\",line_asm_insn=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"0\",inst=\".*\"\},.*,\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}\\\]\}\]" \
"data-disassemble file, line, number assembly mixed"
- mi_gdb_test "222-data-disassemble -f basics.c -l 32 -n 0 -- 1" \
- "222\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"31\",file=\".*basics.c\",line_asm_insn=\\\[\\\]\}\\\]" \
+ mi_gdb_test "222-data-disassemble -f basics.c -l $line_main_body -n 0 -- 1" \
+ "222\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"$line_main_open_brace\",file=\".*basics.c\",line_asm_insn=\\\[\\\]\}\\\]" \
"data-disassemble file, line, number (zero lines) assembly mixed"
- mi_gdb_test "222-data-disassemble -f basics.c -l 32 -n 50 -- 1" \
+ mi_gdb_test "222-data-disassemble -f basics.c -l $line_main_body -n 50 -- 1" \
"222\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"$decimal\",file=\".*basics.c\",line_asm_insn=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"0\",inst=\".*\"\}.*,\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}\\\]\}\]" \
"data-disassemble file, line, number (more than main lines) assembly mixed"
}
@@ -142,6 +152,9 @@ proc test_disassembly_bogus_args {} {
global mi_gdb_prompt
global hex
+ set line_main_head [gdb_get_line_number "main ("]
+ set line_main_body [expr $line_main_head + 2]
+
# Test that bogus input to disassembly command is rejected.
# Tests:
# -data-disassembly -f foo -l abc -n 0 -- 0
@@ -161,7 +174,7 @@ proc test_disassembly_bogus_args {} {
"456\\^error,msg=\"mi_cmd_disassemble: Usage: \\( .-f filename -l linenum .-n howmany.. | .-s startaddr -e endaddr.\\) .--. mixed_mode.\"" \
"data-disassemble mix different args"
- mi_gdb_test "789-data-disassemble -f basics.c -l 32 -- 9" \
+ mi_gdb_test "789-data-disassemble -f basics.c -l $line_main_body -- 9" \
"789\\^error,msg=\"mi_cmd_disassemble: Mixed_mode argument must be 0 or 1.\"" \
"data-disassemble wrong mode arg"
diff --git a/gdb/testsuite/gdb.mi/mi2-eval.exp b/gdb/testsuite/gdb.mi/mi2-eval.exp
index 85fd991bbd3..1d181913aaa 100644
--- a/gdb/testsuite/gdb.mi/mi2-eval.exp
+++ b/gdb/testsuite/gdb.mi/mi2-eval.exp
@@ -1,4 +1,4 @@
-# Copyright 1999, 2000, 2002 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -14,9 +14,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-# Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@prep.ai.mit.edu
-
#
# Test essential Machine interface (MI) operations
#
@@ -46,8 +43,11 @@ mi_gdb_reinitialize_dir $srcdir/$subdir
mi_gdb_reinitialize_dir $srcdir/$subdir
mi_gdb_load ${binfile}
+set line_callee4_head [gdb_get_line_number "callee4 ("]
+set line_callee4_body [expr $line_callee4_head + 2]
+
mi_runto callee4
-mi_next_to "callee4" "" "basics.c" "9" "next at callee4"
+mi_next_to "callee4" "" "basics.c" [expr $line_callee4_body + 1] "next at callee4"
mi_gdb_test "211-data-evaluate-expression A" "211\\^done,value=\"1\"" "eval A"
diff --git a/gdb/testsuite/gdb.mi/mi2-file.exp b/gdb/testsuite/gdb.mi/mi2-file.exp
index fe75a934197..1e81df6d6a4 100644
--- a/gdb/testsuite/gdb.mi/mi2-file.exp
+++ b/gdb/testsuite/gdb.mi/mi2-file.exp
@@ -1,4 +1,4 @@
-# Copyright 1999 Free Software Foundation, Inc.
+# Copyright 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
-
#
# Test essential Machine interface (MI) operations
#
@@ -47,19 +44,30 @@ mi_delete_breakpoints
mi_gdb_reinitialize_dir $srcdir/$subdir
mi_gdb_load ${binfile}
-proc test_tbreak_creation_and_listing {} {
+proc test_file_list_exec_source_file {} {
global srcfile
global srcdir
global subdir
set srcfilepath [string_to_regexp ${srcdir}/${subdir}/${srcfile}]
# get the path and absolute path to the current executable
+ #
+ # In gdb 6.2 (at least), the default line number is set by
+ # select_source_symtab to the first line of "main" minus
+ # the value of "lines_to_list" (which defaults to 10) plus one.
+ # --chastain 2004-08-13
+
+ set line_main_head [gdb_get_line_number "main ("]
+ set line_main_body [expr $line_main_head + 2]
+ set gdb_lines_to_list 10
+ set line_default [expr $line_main_body - $gdb_lines_to_list + 1]
+
mi_gdb_test "111-file-list-exec-source-file" \
- "111\\\^done,line=\"23\",file=\"${srcfilepath}\",fullname=\"/.*/${srcfile}\"" \
+ "111\\\^done,line=\"$line_default\",file=\"${srcfilepath}\",fullname=\"/.*/${srcfile}\"" \
"request path info of current source file (${srcfile})"
}
-test_tbreak_creation_and_listing
+test_file_list_exec_source_file
mi_gdb_exit
return 0
diff --git a/gdb/testsuite/gdb.mi/mi2-hack-cli.exp b/gdb/testsuite/gdb.mi/mi2-hack-cli.exp
index 066eea2d425..2e02a71eb9c 100644
--- a/gdb/testsuite/gdb.mi/mi2-hack-cli.exp
+++ b/gdb/testsuite/gdb.mi/mi2-hack-cli.exp
@@ -1,4 +1,4 @@
-# Copyright 1999 Free Software Foundation, Inc.
+# Copyright 1999, 2001, 2003 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/mi2-read-memory.exp b/gdb/testsuite/gdb.mi/mi2-read-memory.exp
index eee36a75f16..c3f16774e4a 100644
--- a/gdb/testsuite/gdb.mi/mi2-read-memory.exp
+++ b/gdb/testsuite/gdb.mi/mi2-read-memory.exp
@@ -1,4 +1,4 @@
-# Copyright 1999, 2000, 2002 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/mi2-regs.exp b/gdb/testsuite/gdb.mi/mi2-regs.exp
index a14b2417767..546cc93bf47 100644
--- a/gdb/testsuite/gdb.mi/mi2-regs.exp
+++ b/gdb/testsuite/gdb.mi/mi2-regs.exp
@@ -1,4 +1,4 @@
-# Copyright 1999, 2000, 2002 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/mi2-return.exp b/gdb/testsuite/gdb.mi/mi2-return.exp
index b54f15a6d89..670329e79be 100644
--- a/gdb/testsuite/gdb.mi/mi2-return.exp
+++ b/gdb/testsuite/gdb.mi/mi2-return.exp
@@ -1,4 +1,4 @@
-# Copyright 1999, 2000, 2002 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -14,9 +14,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-# Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@prep.ai.mit.edu
-
# Test Machine interface (MI) operations
# Verify that, using the MI, we can run a simple program and perform
# exec-return.
@@ -51,9 +48,12 @@ proc test_return_simple {} {
global mi_gdb_prompt
global hex
+ set line_callee3_head [gdb_get_line_number "callee3 ("]
+ set line_callee3_close_brace [expr $line_callee3_head + 3]
+
send_gdb "111-exec-return\n"
gdb_expect {
- -re "111\\^done,frame=\{level=\"0\",addr=\"$hex\",func=\"callee3\",args=\\\[.*\\\],file=\".*basics.c\",line=\"18\"\}\r\n$mi_gdb_prompt$" {pass "return from callee4 now"}
+ -re "111\\^done,frame=\{level=\"0\",addr=\"$hex\",func=\"callee3\",args=\\\[.*\\\],file=\".*basics.c\",line=\"$line_callee3_close_brace\"\}\r\n$mi_gdb_prompt$" {pass "return from callee4 now"}
-re ".*\r\n$mi_gdb_prompt$" { fail "return from callee4 now" }
timeout { fail "return from callee4 now (timeout)"
}
diff --git a/gdb/testsuite/gdb.mi/mi2-simplerun.exp b/gdb/testsuite/gdb.mi/mi2-simplerun.exp
index 93d44265699..6fdaffde056 100644
--- a/gdb/testsuite/gdb.mi/mi2-simplerun.exp
+++ b/gdb/testsuite/gdb.mi/mi2-simplerun.exp
@@ -1,4 +1,4 @@
-# Copyright 1999, 2000 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -14,9 +14,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-# Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@prep.ai.mit.edu
-
#
# Test essential Machine interface (MI) operations
#
@@ -53,6 +50,13 @@ proc test_breakpoints_creation_and_listing {} {
global srcfile
global hex
+ set line_callee4_head [gdb_get_line_number "callee4 ("]
+ set line_callee3_head [gdb_get_line_number "callee3 ("]
+ set line_callee2_head [gdb_get_line_number "callee2 ("]
+ set line_callee2_body [expr $line_callee2_head + 2]
+ set line_main_head [gdb_get_line_number "main ("]
+ set line_main_body [expr $line_main_head + 2]
+
# Insert some breakpoints and list them
# Also, disable some so they do not interfere with other tests
# Tests:
@@ -62,23 +66,23 @@ proc test_breakpoints_creation_and_listing {} {
# -break-info
mi_gdb_test "200-break-insert main" \
- "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\}" \
+ "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\"\}" \
"break-insert operation"
mi_gdb_test "201-break-insert basics.c:callee2" \
- "201\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee2\",file=\".*basics.c\",line=\"22\",times=\"0\"\}" \
+ "201\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee2\",file=\".*basics.c\",line=\"$line_callee2_body\",times=\"0\"\}" \
"insert breakpoint at basics.c:callee2"
- mi_gdb_test "202-break-insert basics.c:15" \
- "202\\^done,bkpt=\{number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee3\",file=\".*basics.c\",line=\"15\",times=\"0\"\}" \
- "insert breakpoint at basics.c:15 (callee3)"
+ mi_gdb_test "202-break-insert basics.c:$line_callee3_head" \
+ "202\\^done,bkpt=\{number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee3\",file=\".*basics.c\",line=\"$line_callee3_head\",times=\"0\"\}" \
+ "insert breakpoint at basics.c:\$line_callee3_head"
- mi_gdb_test "203-break-insert \"\\\"${srcfile}\\\":6\"" \
- "203\\^done,bkpt=\{number=\"4\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"6\",times=\"0\"\}" \
- "insert breakpoint at \"<fullfilename>\":6 (callee4)"
+ mi_gdb_test "203-break-insert \"\\\"${srcfile}\\\":$line_callee4_head\"" \
+ "203\\^done,bkpt=\{number=\"4\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"$line_callee4_head\",times=\"0\"\}" \
+ "insert breakpoint at \"<fullfilename>\":\$line_callee4_head"
mi_gdb_test "204-break-list" \
- "204\\^done,BreakpointTable=\{.*,hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\},.*\}\\\]\}" \
+ "204\\^done,BreakpointTable=\{.*,hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\"\},.*\}\\\]\}" \
"list of breakpoints"
mi_gdb_test "205-break-disable 2 3 4" \
@@ -94,6 +98,9 @@ proc test_running_the_program {} {
global mi_gdb_prompt
global hex
+ set line_main_head [gdb_get_line_number "main ("]
+ set line_main_body [expr $line_main_head + 2]
+
# Run the program without args, then specify srgs and rerun the program
# Tests:
# -exec-run
@@ -104,7 +111,7 @@ proc test_running_the_program {} {
# The following is equivalent to a send_gdb "000-exec-run\n"
mi_run_cmd
gdb_expect {
- -re "000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"32\"\}\r\n$mi_gdb_prompt$" {
+ -re "000\\*stopped,reason=\"breakpoint-hit\",bkptno=\"1\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"$line_main_body\"\}\r\n$mi_gdb_prompt$" {
pass "run to main"
}
-re ".*$mi_gdb_prompt$" {
@@ -120,6 +127,15 @@ proc test_controlled_execution {} {
global mi_gdb_prompt
global hex
+ set line_callee4_head [gdb_get_line_number "callee4 ("]
+ set line_callee4_body [expr $line_callee4_head + 2]
+ set line_callee3_head [gdb_get_line_number "callee3 ("]
+ set line_callee3_close_brace [expr $line_callee3_head + 3]
+ set line_callee1_head [gdb_get_line_number "callee1 ("]
+ set line_callee1_body [expr $line_callee1_head + 2]
+ set line_main_head [gdb_get_line_number "main ("]
+ set line_main_body [expr $line_main_head + 2]
+
# Continue execution until a breakpoint is reached, step into calls, verifying
# if the arguments are correctly shown, continue to the end of a called
# function, step over a call (next).
@@ -129,24 +145,24 @@ proc test_controlled_execution {} {
# -exec-step
# -exec-finish
- mi_next_to "main" "" "basics.c" "33" "next at main"
+ mi_next_to "main" "" "basics.c" [expr $line_main_body + 1] "next at main"
# FIXME: A string argument is not printed right; should be fixed and
# we should look for the right thing here.
# NOTE: The ``\\\\\"'' is for \".
mi_step_to "callee1" \
"\{name=\"intarg\",value=\"2\"\},\{name=\"strarg\",value=\"$hex \\\\\"A string argument\.\\\\\"\"\},\{name=\"fltarg\",value=\"3.5\"\}" \
- "basics.c" "27" "step at main"
+ "basics.c" "$line_callee1_body" "step at main"
# FIXME: A string argument is not printed right; should be fixed and
# we should look for the right thing here.
mi_execute_to "exec-step 3" "end-stepping-range" "callee4" "" \
- "basics.c" "8" "" "step to callee4"
+ "basics.c" $line_callee4_body "" "step to callee4"
# FIXME: A string argument is not printed right; should be fixed and
# we should look for the right thing here.
# NOTE: The ``.'' is part of ``gdb-result-var="$1"''
- mi_finish_to "callee3" ".*" "basics.c" "18" ".1" "0" "exec-finish"
+ mi_finish_to "callee3" ".*" "basics.c" $line_callee3_close_brace ".1" "0" "exec-finish"
}
proc test_controlling_breakpoints {} {
diff --git a/gdb/testsuite/gdb.mi/mi2-stack.exp b/gdb/testsuite/gdb.mi/mi2-stack.exp
index f0a4a6124be..6f524f8f3ac 100644
--- a/gdb/testsuite/gdb.mi/mi2-stack.exp
+++ b/gdb/testsuite/gdb.mi/mi2-stack.exp
@@ -1,4 +1,4 @@
-# Copyright 2000, 2002 Free Software Foundation, Inc.
+# Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -14,9 +14,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-# Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@prep.ai.mit.edu
-
#
# Test essential Machine interface (MI) operations
#
@@ -50,6 +47,9 @@ proc test_stack_frame_listing {} {
global mi_gdb_prompt
global hex
+ set line_callee4_head [gdb_get_line_number "callee4 ("]
+ set line_callee4_body [expr $line_callee4_head + 2]
+
# Obtain a stack trace
# Tests:
# -stack-list-frames
@@ -57,7 +57,7 @@ proc test_stack_frame_listing {} {
# -stack-list-frames 1 3
mi_gdb_test "231-stack-list-frames" \
- "231\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"8\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\},frame=\{level=\"2\",addr=\"$hex\",func=\"callee2\",.*\},frame=\{level=\"3\",addr=\"$hex\",func=\"callee1\",.*\},frame=\{level=\"4\",addr=\"$hex\",func=\"main\",.*\}\\\]" \
+ "231\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"$line_callee4_body\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\},frame=\{level=\"2\",addr=\"$hex\",func=\"callee2\",.*\},frame=\{level=\"3\",addr=\"$hex\",func=\"callee1\",.*\},frame=\{level=\"4\",addr=\"$hex\",func=\"main\",.*\}\\\]" \
"stack frame listing"
mi_gdb_test "232-stack-list-frames 1 1" \
"232\\^done,stack=\\\[frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\}\\\]" \
@@ -155,10 +155,12 @@ proc test_stack_locals_listing {} {
"232\\^done,locals=\\\[name=\"A\",name=\"B\",name=\"C\"\\\]" \
"stack locals listing 0"
+set line_callee4_return_0 [gdb_get_line_number "return 0;"]
+
# step until A, B, C, have some reasonable values.
send_gdb "-exec-next 3\n"
gdb_expect {
- -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\\\[\\\],file=\".*basics.c\",line=\"13\"\}\r\n$mi_gdb_prompt$" {
+ -re "\\^running\r\n${mi_gdb_prompt}\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\\\[\\\],file=\".*basics.c\",line=\"$line_callee4_return_0\"\}\r\n$mi_gdb_prompt$" {
pass "next's in callee4"
}
timeout { fail "next in callee4 (timeout)" }
diff --git a/gdb/testsuite/gdb.mi/mi2-stepi.exp b/gdb/testsuite/gdb.mi/mi2-stepi.exp
index 208b9e2ba06..99276d7f2b9 100644
--- a/gdb/testsuite/gdb.mi/mi2-stepi.exp
+++ b/gdb/testsuite/gdb.mi/mi2-stepi.exp
@@ -1,4 +1,4 @@
-# Copyright 1999, 2000, 2002 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -14,9 +14,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-# Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@prep.ai.mit.edu
-
# Test Machine interface (MI) operations
# Verify that, using the MI, we can run a simple program and perform
# exec-step-instruction and exec-next-instruction.
@@ -50,10 +47,19 @@ proc test_stepi_nexti {} {
global mi_gdb_prompt
global hex
+ set line_main_head [gdb_get_line_number "main ("]
+ set line_main_body [expr $line_main_head + 2]
+ set line_main_hello [gdb_get_line_number "Hello, World!"]
+
send_gdb "111-exec-step-instruction\n"
gdb_expect {
- -re "111\\^running\r\n${mi_gdb_prompt}111\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"3.\"\}\r\n$mi_gdb_prompt$" {
- pass "step-instruction at main"
+ -re "111\\^running\r\n${mi_gdb_prompt}111\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"(\[0-9\]+)\"\}\r\n$mi_gdb_prompt$" {
+ set line $expect_out(1,string)
+ if { $line >= $line_main_body && $line <= $line_main_hello } {
+ pass "step-instruction at main"
+ } else {
+ fail "step-instruction at main"
+ }
}
timeout {
fail "step-instruction at main (timeout)"
@@ -61,8 +67,13 @@ proc test_stepi_nexti {} {
}
send_gdb "222-exec-next-instruction\n"
gdb_expect {
- -re "222\\^running\r\n${mi_gdb_prompt}222\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"3.\"\}\r\n$mi_gdb_prompt$" {
- pass "next-instruction at main"
+ -re "222\\^running\r\n${mi_gdb_prompt}222\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"(\[0-9\]+)\"\}\r\n$mi_gdb_prompt$" {
+ set line $expect_out(1,string)
+ if { $line >= $line_main_body && $line <= $line_main_hello } {
+ pass "next-instruction at main"
+ } else {
+ fail "next-instruction at main"
+ }
}
timeout {
fail "next-instruction at main (timeout)"
@@ -70,8 +81,13 @@ proc test_stepi_nexti {} {
}
send_gdb "333-exec-next-instruction\n"
gdb_expect {
- -re "333\\^running\r\n${mi_gdb_prompt}333\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"3.\"\}\r\n$mi_gdb_prompt$" {
- pass "next-instruction at main"
+ -re "333\\^running\r\n${mi_gdb_prompt}333\\*stopped,reason=\"end-stepping-range\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\".*basics.c\",line=\"(\[0-9\]+)\"\}\r\n$mi_gdb_prompt$" {
+ set line $expect_out(1,string)
+ if { $line >= $line_main_body && $line <= $line_main_hello } {
+ pass "next-instruction at main"
+ } else {
+ fail "next-instruction at main"
+ }
}
timeout {
fail "next-instruction at main (timeout)"
diff --git a/gdb/testsuite/gdb.mi/mi2-until.exp b/gdb/testsuite/gdb.mi/mi2-until.exp
index 4ef296c0121..7387da0a29e 100644
--- a/gdb/testsuite/gdb.mi/mi2-until.exp
+++ b/gdb/testsuite/gdb.mi/mi2-until.exp
@@ -1,4 +1,4 @@
-# Copyright 1999, 2000 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/gdb/testsuite/gdb.mi/mi2-var-block.exp b/gdb/testsuite/gdb.mi/mi2-var-block.exp
index 84bc1fffba4..474891030cc 100644
--- a/gdb/testsuite/gdb.mi/mi2-var-block.exp
+++ b/gdb/testsuite/gdb.mi/mi2-var-block.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
#
# This Program Is Free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -14,9 +14,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-# Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@prep.ai.mit.edu
-
# Test essential Machine interface (MI) operations
#
# Verify that, using the MI, we can create, update, delete variables.
@@ -55,7 +52,9 @@ mi_gdb_test "-var-create foo * foo" \
"create local variable foo"
# step to "foo = 123;"
-mi_step_to "do_block_tests" "" "var-cmd.c" "158" "step at do_block_test"
+mi_step_to "do_block_tests" "" "var-cmd.c" \
+ [gdb_get_line_number "foo = 123;"] \
+ "step at do_block_test"
# Be paranoid and assume 3.2 created foo
@@ -71,7 +70,9 @@ mi_gdb_test "-var-create foo * foo" \
"create local variable foo"
# step to "foo2 = 123;"
-mi_step_to "do_block_tests" "" "var-cmd.c" "161" "step at do_block_test"
+mi_step_to "do_block_tests" "" "var-cmd.c" \
+ [gdb_get_line_number "foo2 = 123;"] \
+ "step at do_block_test"
# Test: c_variable-3.4
# Desc: check foo, cb changed
@@ -80,7 +81,9 @@ mi_gdb_test "-var-update *" \
"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"
+mi_step_to "do_block_tests" "" "var-cmd.c" \
+ [gdb_get_line_number "foo = 321;"] \
+ "step at do_block_test"
# Test: c_variable-3.5
# Desc: create inner block foo
@@ -89,7 +92,9 @@ mi_gdb_test "-var-create inner_foo * foo" \
"create local variable inner_foo"
# step to "foo2 = 0;"
-mi_step_to "do_block_tests" "" "var-cmd.c" "166" "step at do_block_test"
+mi_step_to "do_block_tests" "" "var-cmd.c" \
+ [gdb_get_line_number "foo2 = 0;"] \
+ "step at do_block_test"
# Test: c_variable-3.6
# Desc: create foo2
@@ -121,7 +126,9 @@ mi_gdb_test "-var-delete inner_foo" \
"delete var inner_foo"
# step to "foo = 0;"
-mi_step_to "do_block_tests" "" "var-cmd.c" "168" "step at do_block_test"
+mi_step_to "do_block_tests" "" "var-cmd.c" \
+ [gdb_get_line_number "foo = 0;"] \
+ "step at do_block_test"
# Test: c_variable-3.8
# Desc: check that foo2 out of scope (known gdb problem)
@@ -132,7 +139,9 @@ mi_gdb_test "-var-update foo2" \
clear_xfail *-*-*
# step to "cb = 21;"
-mi_step_to "do_block_tests" "" "var-cmd.c" "171" "step at do_block_test"
+mi_step_to "do_block_tests" "" "var-cmd.c" \
+ [gdb_get_line_number "cb = 21;"] \
+ "step at do_block_test"
# Test: c_variable-3.9
# Desc: check that only cb is in scope (known gdb problem)
diff --git a/gdb/testsuite/gdb.mi/mi2-var-child.exp b/gdb/testsuite/gdb.mi/mi2-var-child.exp
index 3f6a3fddfc6..be2dc849214 100644
--- a/gdb/testsuite/gdb.mi/mi2-var-child.exp
+++ b/gdb/testsuite/gdb.mi/mi2-var-child.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 1999, 2000, 2002 Free Software Foundation
+# Copyright 1999, 2000, 2001, 2002, 2003, 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
@@ -14,9 +14,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-# Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@prep.ai.mit.edu
-
# Test essential Machine interface (MI) operations
#
# Verify that, using the MI, we can create, update, delete variables.
@@ -555,8 +552,9 @@ mi_gdb_test "-var-info-num-children 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"
+set line_dct_123 [gdb_get_line_number "struct_declarations.integer = 123;"]
+mi_step_to do_children_tests {} {.*var-cmd.c} \
+ $line_dct_123 "step to line \$line_dct_123"
# Test: c_variable-4.81
# Desc: create local variable "weird"
@@ -754,8 +752,8 @@ mi_gdb_test "-var-update *" \
"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"
+mi_step_to do_children_tests {} {.*var-cmd.c} \
+ [expr $line_dct_123 + 1] "step \$line_dct_123 + 1"
# Test: c_variable-5.2
# Desc: check that integer changed
@@ -767,8 +765,8 @@ mi_gdb_test "-var-update *" \
# 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"
+mi_execute_to "exec-step 3" "end-stepping-range" do_children_tests {} {.*var-cmd.c} \
+ [expr $line_dct_123 + 4] {} "step \$line_dct_123 + 4"
# Test: c_variable-5.3
# Desc: check that char_ptr changed
@@ -777,8 +775,8 @@ mi_gdb_test "-var-update *" \
"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"
+mi_step_to do_children_tests {} {.*var-cmd.c} \
+ [expr $line_dct_123 + 5] "step \$line_dct_123 + 5"
# Test: c_variable-5.4
# Desc: check that int_ptr_ptr and children changed
@@ -787,8 +785,8 @@ mi_gdb_test "-var-update *" \
"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"
+mi_step_to do_children_tests {} {.*var-cmd.c} \
+ [expr $line_dct_123 + 6] "step \$line_dct_123 + 6"
# Test: c_variable-5.5
# Desc: check that long_array[0] changed
@@ -797,8 +795,8 @@ mi_gdb_test "-var-update *" \
"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"
+mi_step_to do_children_tests {} {.*var-cmd.c} \
+ [expr $line_dct_123 + 7] "step \$line_dct_123 + 7"
# Test: c_variable-5.6
# Desc: check that long_array[1] changed
@@ -807,8 +805,8 @@ mi_gdb_test "-var-update *" \
"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"
+mi_step_to do_children_tests {} {.*var-cmd.c} \
+ [expr $line_dct_123 + 8] "step \$line_dct_123 + 8"
# Test: c_variable-5.7
# Desc: check that long_array[2] changed
@@ -824,8 +822,10 @@ mi_gdb_test "-var-update *" \
# 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"
+
+set line_dct_nothing [gdb_get_line_number "weird->func_ptr = nothing;"]
+mi_execute_to "exec-step 7" "end-stepping-range" do_children_tests {} {.*var-cmd.c} \
+ $line_dct_nothing {} "step \$line_dct_nothing"
# Test: c_variable-5.8
# Desc: check that long_array[3-9] changed
@@ -835,8 +835,9 @@ mi_gdb_test "-var-update *" \
# Step over "weird->func_ptr = nothing;"
-set line 211
-mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line"
+set line_dct_a0_0 [gdb_get_line_number "a0 = '0';"]
+mi_step_to do_children_tests {} {.*var-cmd.c} \
+ $line_dct_a0_0 "step \$line_dct_a0_0"
# Test: c_variable-5.9
# Desc: check that func_ptr changed
@@ -856,8 +857,10 @@ mi_gdb_test "-var-delete 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"
+
+set line_dct_snp0 [gdb_get_line_number "psnp = &snp0;"]
+mi_execute_to "exec-step 43" "end-stepping-range" do_children_tests {} {.*var-cmd.c} \
+ [expr $line_dct_snp0 + 1] {} "step \$line_dct_snp0 + 1"
# Test: c_variable-5.10
# Desc: create psnp->char_ptr
@@ -1127,8 +1130,8 @@ mi_gdb_test "-var-list-children psnp->ptrs.0.next.next.ptrs" \
"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"
+mi_step_to do_children_tests {} {.*var-cmd.c} \
+ [expr $line_dct_snp0 + 2] "step \$line_dct_snp0 + 2"
# Test: c_variable-5.47
# Desc: check that psnp->char_ptr (and [0].char_ptr) changed
@@ -1137,8 +1140,8 @@ mi_gdb_test "-var-update *" \
"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"
+mi_step_to do_children_tests {} {.*var-cmd.c} \
+ [expr $line_dct_snp0 + 3] "step \$line_dct_snp0 + 3"
# Test: c_variable-5.48
# Desc: check that psnp->next->char_ptr (and [1].char_ptr) changed
@@ -1148,8 +1151,8 @@ mi_gdb_test "-var-update *" \
# Step over "snp2.char_ptr = &a3;"
-set line 257
-mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line"
+mi_step_to do_children_tests {} {.*var-cmd.c} \
+ [expr $line_dct_snp0 + 4] "step \$line_dct_snp0 + 4"
# Test: c_variable-5.49
# Desc: check that psnp->next->next->char_ptr (and [2].char_ptr) changed
@@ -1159,8 +1162,8 @@ mi_gdb_test "-var-update *" \
# Step over "snp0.long_ptr = &y3;"
-set line 258
-mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line"
+mi_step_to do_children_tests {} {.*var-cmd.c} \
+ [expr $line_dct_snp0 + 5] "step \$line_dct_snp0 + 5"
# Test: c_variable-5.50
# Desc: check that psnp->long_ptr (and [0].long_ptr) changed
@@ -1170,8 +1173,8 @@ mi_gdb_test "-var-update *" \
# Step over "snp1.long_ptr = &x3;"
-set line 259
-mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line"
+mi_step_to do_children_tests {} {.*var-cmd.c} \
+ [expr $line_dct_snp0 + 6] "step \$line_dct_snp0 + 6"
# Test: c_variable-5.51
# Desc: check that psnp->next->long_ptr (and [1].long_ptr) changed
@@ -1187,8 +1190,8 @@ clear_xfail *-*-*
#
# Step over "snp2.long_ptr = &z3;"
-set line 260
-mi_step_to do_children_tests {} {.*var-cmd.c} $line "step $line"
+mi_step_to do_children_tests {} {.*var-cmd.c} \
+ [expr $line_dct_snp0 + 7] "step \$line_dct_snp0 + 7"
# Test: c_variable-5.52
# Desc: check that psnp->next->next->long_ptr (and [2].long_ptr) changed
diff --git a/gdb/testsuite/gdb.mi/mi2-var-cmd.exp b/gdb/testsuite/gdb.mi/mi2-var-cmd.exp
index 25326dfe886..bbecda8d3cd 100644
--- a/gdb/testsuite/gdb.mi/mi2-var-cmd.exp
+++ b/gdb/testsuite/gdb.mi/mi2-var-cmd.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
#
# This Program Is Free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -14,9 +14,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-# Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@prep.ai.mit.edu
-
# Test essential Machine interface (MI) operations
#
# Verify that, using the MI, we can create, update, delete variables.
@@ -168,7 +165,8 @@ mi_gdb_test "-var-update *" \
"update all vars"
# Step over "linteger = 1234;"
-mi_step_to "do_locals_tests" "" "var-cmd.c" "107" "step at do_locals_test"
+set line_dlt_linteger [gdb_get_line_number "lpinteger = &linteger;"]
+mi_step_to "do_locals_tests" "" "var-cmd.c" $line_dlt_linteger "step at do_locals_test"
# Test: c_variable-2.2
# Desc: check whether only linteger changed values
@@ -177,7 +175,7 @@ mi_gdb_test "-var-update *" \
"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)"
+mi_step_to "do_locals_tests" "" "var-cmd.c" [expr $line_dlt_linteger + 1] "step at do_locals_tests (2)"
# Test: c_variable-2.3
# Desc: check whether only lpinteger changed
@@ -186,7 +184,7 @@ mi_gdb_test "-var-update *" \
"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)"
+mi_step_to "do_locals_tests" "" "var-cmd.c" [expr $line_dlt_linteger + 2] "step at do_locals_tests (3)"
# Test: c_variable-2.4
# Desc: check whether only lcharacter changed
@@ -195,7 +193,7 @@ mi_gdb_test "-var-update *" \
"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)"
+mi_step_to "do_locals_tests" "" "var-cmd.c" [expr $line_dlt_linteger + 3] "step at do_locals_tests (4)"
# Test: c_variable-2.5
# Desc: check whether only lpcharacter changed
@@ -216,7 +214,7 @@ mi_gdb_test "-var-update *" \
# 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)"
+ "var-cmd.c" [expr $line_dlt_linteger + 12] "" "step at do_locals_tests (5)"
# Test: c_variable-2.6
# Desc: check whether llong, lplong, lfloat, lpfloat, ldouble, lpdouble, lsimple.integer,
@@ -231,8 +229,10 @@ mi_gdb_test "-var-update *" \
# lpsimple = &lsimple;
# func = nothing;
+set line_dlt_4321 [gdb_get_line_number "linteger = 4321;"]
+
mi_execute_to "exec-step 4" "end-stepping-range" "do_locals_tests" "" \
- "var-cmd.c" "125" "" "step at do_locals_tests (6)"
+ "var-cmd.c" $line_dlt_4321 "" "step at do_locals_tests (6)"
# Test: c_variable-2.7
# Desc: check whether (lsimple.signed_character, lsimple.char_ptr) lpsimple, func changed
@@ -251,7 +251,7 @@ mi_gdb_test "-var-update *" \
# 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)"
+ "var-cmd.c" [expr $line_dlt_4321 + 8] "" "step at do_locals_tests (7)"
# Test: c_variable-2.8
# Desc: check whether linteger, lcharacter, llong, lfoat, ldouble, lsimple.integer,
@@ -384,12 +384,14 @@ mi_gdb_test "-var-assign lsimple.integer 333" \
# End of assign tests
#####
+set line_subroutine1_body [gdb_get_line_number "global_simple.integer = i + 3;"]
+
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\"\}" \
+ "\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"subroutine1\",file=\".*var-cmd.c\",line=\"$line_subroutine1_body\",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"
+ "var-cmd.c" $line_subroutine1_body "continue to subroutine1"
# Test: c_variable-2.10
# Desc: create variable for locals i,l in subroutine1
@@ -408,7 +410,7 @@ mi_gdb_test "-var-create linteger * linteger" \
"create linteger"
mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \
- "var-cmd.c" "147" "step at subroutine1"
+ "var-cmd.c" [expr $line_subroutine1_body + 1] "step at subroutine1"
# Test: c_variable-2.12
# Desc: change global_simple.integer
@@ -424,7 +426,7 @@ mi_gdb_test "-var-update *" \
clear_xfail *-*-*
mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \
- "var-cmd.c" "148" "step at subroutine1 (2)"
+ "var-cmd.c" [expr $line_subroutine1_body + 2] "step at subroutine1 (2)"
# Test: c_variable-2.13
# Desc: change subroutine1 local i
@@ -433,7 +435,7 @@ mi_gdb_test "-var-update *" \
"update all vars: i changed"
mi_step_to "subroutine1" "\{name=\"i\",value=\".*\"\},\{name=\"l\",value=\".*\"\}" \
- "var-cmd.c" "149" "step at subroutine1 (3)"
+ "var-cmd.c" [expr $line_subroutine1_body + 3] "step at subroutine1 (3)"
# Test: c_variable-2.14
# Desc: change do_locals_tests local llong
@@ -441,7 +443,9 @@ 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"
+set line_dlt_call_subroutine1 [gdb_get_line_number "subroutine1 (linteger, &llong);"]
+mi_next_to "do_locals_tests" "" "var-cmd.c" \
+ [expr $line_dlt_call_subroutine1 + 1] "next out of subroutine1"
# Test: c_variable-2.15
# Desc: check for out of scope subroutine1 locals
diff --git a/gdb/testsuite/gdb.mi/mi2-var-display.exp b/gdb/testsuite/gdb.mi/mi2-var-display.exp
index 3b0990d7866..090614c2efd 100644
--- a/gdb/testsuite/gdb.mi/mi2-var-display.exp
+++ b/gdb/testsuite/gdb.mi/mi2-var-display.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
#
# This Program Is Free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -14,9 +14,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-# Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@prep.ai.mit.edu
-
# Test essential Machine interface (MI) operations
#
# Verify that, using the MI, we can create, update, delete variables.
@@ -42,14 +39,16 @@ 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\"\}" \
+set line_dct_close_brace [expr [gdb_get_line_number "snp2.long_ptr = &z3;"] + 1]
+
+mi_gdb_test "200-break-insert $line_dct_close_brace" \
+ "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_children_tests\",file=\".*var-cmd.c\",line=\"$line_dct_close_brace\",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$" {
+ -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=\"$line_dct_close_brace\"\}\r\n$mi_gdb_prompt$" {
pass "run to do_children_tests"
}
-re ".*$mi_gdb_prompt$" {fail "run to do_children_tests (2)"}
@@ -324,13 +323,16 @@ mi_gdb_test "-var-delete weird" \
##### #####
# Stop in "do_special_tests"
+
+set line_dst_a_1 [gdb_get_line_number "a = 1;"]
+
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\"\}" \
+ "200\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_special_tests\",file=\".*var-cmd.c\",line=\"$line_dst_a_1\",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$" {
+ -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=\"$line_dst_a_1\"\}\r\n$mi_gdb_prompt$" {
pass "continue to do_special_tests"
}
timeout {
@@ -583,15 +585,17 @@ gdb_expect {
timeout { fail "print FP register (timeout)"}
}
+set line_incr_a_b_a [gdb_get_line_number "b = a;"]
+
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\"\}" \
+ "200\\^done,bkpt=\{number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"incr_a\",file=\".*var-cmd.c\",line=\"$line_incr_a_b_a\",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$" {
+ -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=\"$line_incr_a_b_a\"\}\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$" {
+ -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=\"([expr $line_incr_a_b_a - 2]|[expr $line_incr_a_b_a - 1]|$line_incr_a_b_a)\"\}\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$" {
diff --git a/gdb/testsuite/gdb.mi/mi2-watch.exp b/gdb/testsuite/gdb.mi/mi2-watch.exp
index ba7df2b4648..301505e9683 100644
--- a/gdb/testsuite/gdb.mi/mi2-watch.exp
+++ b/gdb/testsuite/gdb.mi/mi2-watch.exp
@@ -1,4 +1,4 @@
-# Copyright 1999, 2000, 2002 Free Software Foundation, Inc.
+# Copyright 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -14,9 +14,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-# Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@prep.ai.mit.edu
-
#
# Test essential Machine interface (MI) operations
#
@@ -52,6 +49,9 @@ proc test_watchpoint_creation_and_listing {} {
global srcfile
global hex
+ set line_callee4_head [gdb_get_line_number "callee4 ("]
+ set line_callee4_body [expr $line_callee4_head + 2]
+
# Insert a watchpoint and list
# Tests:
# -break-watch C
@@ -62,7 +62,7 @@ proc test_watchpoint_creation_and_listing {} {
"break-watch operation"
mi_gdb_test "222-break-list" \
- "222\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"8\",times=\"1\"\},bkpt=\{number=\"2\",type=\".*watchpoint\",disp=\"keep\",enabled=\"y\",addr=\"\",what=\"C\",times=\"0\"\}\\\]\}" \
+ "222\\\^done,BreakpointTable=\{nr_rows=\".\",nr_cols=\".\",hdr=\\\[\{width=\".*\",alignment=\".*\",col_name=\"number\",colhdr=\"Num\"\}.*colhdr=\"Type\".*colhdr=\"Disp\".*colhdr=\"Enb\".*colhdr=\"Address\".*colhdr=\"What\".*\\\],body=\\\[bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"$line_callee4_body\",times=\"1\"\},bkpt=\{number=\"2\",type=\".*watchpoint\",disp=\"keep\",enabled=\"y\",addr=\"\",what=\"C\",times=\"0\"\}\\\]\}" \
"list of watchpoints"
}
@@ -73,17 +73,20 @@ proc test_awatch_creation_and_listing {} {
global srcfile
global hex
+ set line_main_head [gdb_get_line_number "main ("]
+ set line_main_body [expr $line_main_head + 2]
+
# Insert an access watchpoint and list it
# Tests:
# -break-watch -a A
# -break-list
mi_gdb_test "333-break-watch -a A" \
- "333\\^done,bkpt=\{number=\"1\",addr=\"$hex\",file=\".*basics.c\",line=\"32\"\}" \
+ "333\\^done,bkpt=\{number=\"1\",addr=\"$hex\",file=\".*basics.c\",line=\"$line_main_body\"\}" \
"break-watch -a operation"
mi_gdb_test "444-break-list" \
- "444\\^done,BreakpointTable=\{.*,hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"3\",type=\"watchpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\},.*\}\\\]\}" \
+ "444\\^done,BreakpointTable=\{.*,hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"3\",type=\"watchpoint\",disp=\"del\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\"\},.*\}\\\]\}" \
"list of watchpoints awatch"
mi_gdb_test "777-break-delete 3" \
@@ -97,17 +100,20 @@ proc test_rwatch_creation_and_listing {} {
global srcfile
global hex
+ set line_main_head [gdb_get_line_number "main ("]
+ set line_main_body [expr $line_main_head + 2]
+
# Insert a read watchpoint and list it.
# Tests:
# -break-insert -r B
# -break-list
mi_gdb_test "200-break-watch -r C" \
- "200\\^done,bkpt=\{number=\"5\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"32\",times=\"0\"\}" \
+ "200\\^done,bkpt=\{number=\"5\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"callee4\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\"\}" \
"break-insert -r operation"
mi_gdb_test "300-break-list" \
- "300\\^done,BreakpointTable=\{.*,hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"5\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"32\",times=\"0\"\},.*\}\\\}\}" \
+ "300\\^done,BreakpointTable=\{.*,hdr=\\\[.*\\\],body=\\\[bkpt=\{number=\"5\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"main\",file=\".*basics.c\",line=\"$line_main_body\",times=\"0\"\},.*\}\\\}\}" \
"list of breakpoints"
mi_gdb_test "177-break-delete 4" \
@@ -119,6 +125,10 @@ proc test_watchpoint_triggering {} {
global mi_gdb_prompt
global hex
+ set line_callee4_return_0 [gdb_get_line_number "return 0;"]
+ set line_callee3_head [gdb_get_line_number "callee3 ("]
+ set line_callee3_close_brace [expr $line_callee3_head + 3]
+
# Continue execution until the watchpoint is reached, continue again,
# to see the watchpoint go out of scope.
# Does:
@@ -129,7 +139,7 @@ proc test_watchpoint_triggering {} {
gdb_expect {
-re "222\\^running\r\n$mi_gdb_prompt" {
gdb_expect {
- -re "222\\*stopped,reason=\"watchpoint-trigger\",wpt=\{number=\"2\",exp=\"C\"\},value=\{old=\".*\",new=\"3\"\},thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\\\[\\\],file=\".*basics.c\",line=\"13\"\}\r\n$mi_gdb_prompt$" {
+ -re "222\\*stopped,reason=\"watchpoint-trigger\",wpt=\{number=\"2\",exp=\"C\"\},value=\{old=\".*\",new=\"3\"\},thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee4\",args=\\\[\\\],file=\".*basics.c\",line=\"$line_callee4_return_0\"\}\r\n$mi_gdb_prompt$" {
pass "watchpoint trigger"
}
-re ".*$mi_gdb_prompt$" {fail "watchpoint trigger (2)"}
@@ -144,7 +154,7 @@ proc test_watchpoint_triggering {} {
gdb_expect {
-re "223\\^running\r\n$mi_gdb_prompt" {
gdb_expect {
- -re "\[\r\n\]*223\\*stopped,reason=\"watchpoint-scope\",wpnum=\"2\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee3\",args=\\\[.*\\\],file=\".*basics.c\",line=\"18\"\}\r\n$mi_gdb_prompt$" {
+ -re "\[\r\n\]*223\\*stopped,reason=\"watchpoint-scope\",wpnum=\"2\",thread-id=\"\[01\]\",frame=\{addr=\"$hex\",func=\"callee3\",args=\\\[.*\\\],file=\".*basics.c\",line=\"$line_callee3_close_brace\"\}\r\n$mi_gdb_prompt$" {
pass "wp out of scope"
}
-re ".*$mi_gdb_prompt$" {fail "wp out of scope (2)"}
diff --git a/gdb/testsuite/gdb.mi/pthreads.c b/gdb/testsuite/gdb.mi/pthreads.c
index 0d8f1b616fc..701dfec8d49 100644
--- a/gdb/testsuite/gdb.mi/pthreads.c
+++ b/gdb/testsuite/gdb.mi/pthreads.c
@@ -24,6 +24,7 @@
Boston, MA 02111-1307, USA. */
#include <stdio.h>
+#include <stdlib.h>
#include <pthread.h>
/* Under OSF 2.0 & 3.0 and HPUX 10, the second arg of pthread_create
diff --git a/gdb/testsuite/gdb.mi/var-cmd.c b/gdb/testsuite/gdb.mi/var-cmd.c
index 42c2336fffc..2a297d2c02d 100644
--- a/gdb/testsuite/gdb.mi/var-cmd.c
+++ b/gdb/testsuite/gdb.mi/var-cmd.c
@@ -1,3 +1,24 @@
+/* Copyright 1999, 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. */
+
+#include <stdlib.h>
+
struct _simple_struct {
int integer;
unsigned int unsigned_integer;
diff --git a/gdb/testsuite/gdb.stabs/exclfwd.exp b/gdb/testsuite/gdb.stabs/exclfwd.exp
new file mode 100644
index 00000000000..05ab97c0fb0
--- /dev/null
+++ b/gdb/testsuite/gdb.stabs/exclfwd.exp
@@ -0,0 +1,72 @@
+# 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@gnu.org
+
+if $tracelevel {
+ strace $tracelevel
+}
+
+#
+# test running programs
+#
+set prms_id 0
+set bug_id 0
+
+set testfile exclfwd
+set binfile ${objdir}/${subdir}/${testfile}
+
+foreach file {exclfwd1 exclfwd2} {
+ if {[gdb_compile "${srcdir}/${subdir}/${file}.c" "${file}.o" object {debug}] != ""} {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+ }
+}
+
+if {[gdb_compile "exclfwd1.o exclfwd2.o" ${binfile} executable {debug}] != "" } {
+ 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 ![runto_main] then {
+ perror "couldn't run to breakpoint"
+ continue
+}
+
+get_debug_format
+
+set eol "\[ \t\]*\[\n\r\]+"
+
+gdb_test "ptype v1" "type = struct a {$eol
+ int x;$eol
+ int y;$eol
+}$eol"
+
+if { [test_debug_format "stabs"] } then {
+ setup_kfail "gdb/1602" *-*-*
+}
+gdb_test "ptype v2" "type = struct a {$eol
+ const char .c;$eol
+}$eol"
+
+if { [test_debug_format "stabs"] } then {
+ setup_kfail "gdb/1603" *-*-*
+}
+gdb_test "ptype v3" "type = const char ."
diff --git a/gdb/testsuite/gdb.stabs/exclfwd.h b/gdb/testsuite/gdb.stabs/exclfwd.h
new file mode 100644
index 00000000000..3f064b12857
--- /dev/null
+++ b/gdb/testsuite/gdb.stabs/exclfwd.h
@@ -0,0 +1,22 @@
+/* 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@gnu.org */
+
+typedef struct a a_t;
diff --git a/gdb/testsuite/gdb.stabs/exclfwd1.c b/gdb/testsuite/gdb.stabs/exclfwd1.c
new file mode 100644
index 00000000000..a7574e5098b
--- /dev/null
+++ b/gdb/testsuite/gdb.stabs/exclfwd1.c
@@ -0,0 +1,34 @@
+/* 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@gnu.org */
+
+#include "exclfwd.h"
+
+struct a
+{
+ int x, y;
+};
+
+a_t v1;
+
+int
+main ()
+{
+}
diff --git a/gdb/testsuite/gdb.stabs/exclfwd2.c b/gdb/testsuite/gdb.stabs/exclfwd2.c
new file mode 100644
index 00000000000..f7de01544be
--- /dev/null
+++ b/gdb/testsuite/gdb.stabs/exclfwd2.c
@@ -0,0 +1,30 @@
+/* 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@gnu.org */
+
+#include "exclfwd.h"
+
+struct a
+{
+ const char *c;
+};
+
+a_t v2;
+const char *v3;
diff --git a/gdb/testsuite/gdb.stabs/weird.exp b/gdb/testsuite/gdb.stabs/weird.exp
index 324f67b1f0b..7f67ccb132b 100644
--- a/gdb/testsuite/gdb.stabs/weird.exp
+++ b/gdb/testsuite/gdb.stabs/weird.exp
@@ -317,7 +317,7 @@ gdb_expect 60 {
send_gdb "y\n"
exp_continue
}
- -re "^Reading symbols from $binfile\\.\\.\\.done\.(|\r\nUsing host libthread_db library .*libthread_db.so.*\\.)\r\n$gdb_prompt $" {
+ -re "^Reading symbols from .*$binfile\\.\\.\\.done\.(|\r\nUsing host libthread_db library .*libthread_db.so.*\\.)\r\n$gdb_prompt $" {
pass "weirdx.o read without error"
}
-re ".*$gdb_prompt $" {
diff --git a/gdb/testsuite/gdb.cp/pr-1553.exp b/gdb/testsuite/gdb.threads/bp_in_thread.exp
index fe9e2a26171..e9dfadb9b1a 100644
--- a/gdb/testsuite/gdb.cp/pr-1553.exp
+++ b/gdb/testsuite/gdb.threads/bp_in_thread.exp
@@ -1,4 +1,4 @@
-# Copyright 2004 Free Software Foundation, Inc.
+# Copyright (C) 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,33 +14,20 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-# Test for PR gdb/1553.
-
-# This file is part of the gdb testsuite.
-
-set ws "\[\r\n\t \]+"
+# gdb 6.1.1 on AIX had a bug where the aix-threads code called
+# getthrds() incorrectly so that gdb lost track of breakpoints.
+# GDB reported a SIGTRAP signal in a random thread when hitting
+# a breakpoint.
if $tracelevel then {
strace $tracelevel
}
-if { [skip_cplus_tests] } { continue }
-
-#
-# test running programs
-#
-set prms_id 0
-set bug_id 0
-
-set testfile "pr-1553"
-set srcfile ${testfile}.cc
+set testfile "pthread_cond_wait"
+set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
-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."
-}
-
-if [get_compiler_info ${binfile} "c++"] {
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}"]] != "" } {
return -1
}
@@ -49,14 +36,14 @@ gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
-if ![runto_main] then {
- perror "couldn't run to breakpoint"
- continue
-}
+gdb_test "break noreturn" \
+ "Breakpoint 1 at .*: file .*${srcfile}, line .*" \
+ "breakpoint on noreturn"
-gdb_test "ptype c_var" "type = class A::C \{${ws}private:${ws}int a_c;${ws}\} \\*"
+# Run the program and make sure GDB reports that we stopped after
+# hitting breakpoint 1 in noreturn().
-gdb_test "ptype E::F" "type = class E::F \{${ws}public:${ws}int e_f;${ws}E::F & operator=\\(E::F const ?&\\);${ws}\}"
+gdb_test "run" \
+ ".*Breakpoint 1, noreturn ().*" \
+ "run to noreturn"
-gdb_exit
-return 0
diff --git a/gdb/testsuite/gdb.threads/killed.c b/gdb/testsuite/gdb.threads/killed.c
index 6cb3928a346..590bf206f9b 100644
--- a/gdb/testsuite/gdb.threads/killed.c
+++ b/gdb/testsuite/gdb.threads/killed.c
@@ -1,7 +1,27 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ 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
+ 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 <sys/types.h>
#include <signal.h>
#include <pthread.h>
#include <stdio.h>
+#include <stdlib.h>
int pid;
diff --git a/gdb/testsuite/gdb.threads/manythreads.c b/gdb/testsuite/gdb.threads/manythreads.c
new file mode 100644
index 00000000000..e39412cde8f
--- /dev/null
+++ b/gdb/testsuite/gdb.threads/manythreads.c
@@ -0,0 +1,68 @@
+/* Manythreads test program.
+ Copyright 2004
+ Free Software Foundation, Inc.
+
+ Written by Jeff Johnston <jjohnstn@redhat.com>
+ Contributed by Red Hat
+
+ 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. */
+
+#include <pthread.h>
+#include <stdio.h>
+#include <limits.h>
+
+void *
+thread_function (void *arg)
+{
+ int x = (int)arg;
+
+ printf ("Thread <%d> executing\n", x);
+
+ return NULL;
+}
+
+int
+main (int argc, char **argv)
+{
+ pthread_attr_t attr;
+ pthread_t threads[256];
+ int i, j;
+
+ pthread_attr_init (&attr);
+ pthread_attr_setstacksize (&attr, PTHREAD_STACK_MIN);
+
+ /* Create a ton of quick-executing threads, then wait for them to
+ complete. */
+ for (i = 0; i < 1000; ++i)
+ {
+ for (j = 0; j < 256; ++j)
+ {
+ pthread_create (&threads[j], &attr, thread_function,
+ (void *)(i * 1000 + j));
+ }
+
+ for (j = 0; j < 256; ++j)
+ {
+ pthread_join (threads[j], NULL);
+ }
+ }
+
+ pthread_attr_destroy (&attr);
+
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.threads/manythreads.exp b/gdb/testsuite/gdb.threads/manythreads.exp
new file mode 100644
index 00000000000..a2baf846aa9
--- /dev/null
+++ b/gdb/testsuite/gdb.threads/manythreads.exp
@@ -0,0 +1,127 @@
+# manythreads.exp -- Expect script to test stopping many threads
+# Copyright (C) 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 Jeff Johnston. (jjohnstn@redhat.com)
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+set testfile "manythreads"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}"]] != "" } {
+ return -1
+}
+
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+gdb_test "set print sevenbit-strings" ""
+runto_main
+
+# We'll need this when we send_gdb a ^C to GDB. Need to do it before we
+# run the program and gdb starts saving and restoring tty states.
+# On Ultrix, we don't need it and it is really slow (because shell_escape
+# doesn't use vfork).
+if ![istarget "*-*-ultrix*"] then {
+ gdb_test "shell stty intr '^C'" ""
+}
+
+set message "first continue"
+gdb_test_multiple "continue" "first continue" {
+ -re "error:.*$gdb_prompt $" {
+ fail "$message"
+ }
+ -re "Continuing" {
+ pass "$message"
+ }
+}
+
+# Send a Ctrl-C and verify that we can do info threads and continue
+after 1000
+send_gdb "\003"
+set message "stop threads 1"
+gdb_test_multiple "" "stop threads 1" {
+ -re "\\\[New \[^\]\]*\\\]\r\n" {
+ exp_continue
+ }
+ -re "\\\[\[^\]\]* exited\\\]\r\n" {
+ exp_continue
+ }
+ -re "Thread \[^\n\]* executing\r\n" {
+ exp_continue
+ }
+ -re "Program received signal SIGINT.*$gdb_prompt $" {
+ pass "$message"
+ }
+ timeout {
+ fail "$message (timeout)"
+ }
+}
+
+gdb_test "info threads" ".*1 Thread.*.LWP.*"
+
+set message "second continue"
+gdb_test_multiple "continue" "second continue" {
+ -re "error:.*$gdb_prompt $" {
+ fail "$message"
+ }
+ -re "Continuing" {
+ pass "$message"
+ }
+}
+
+# Send another Ctrl-C and verify that we can do info threads and quit
+after 1000
+send_gdb "\003"
+set message "stop threads 2"
+gdb_test_multiple "" "stop threads 2" {
+ -re "\\\[New \[^\]\]*\\\]\r\n" {
+ exp_continue
+ }
+ -re "\\\[\[^\]\]* exited\\\]\r\n" {
+ exp_continue
+ }
+ -re "Thread \[^\n\]* executing\r\n" {
+ exp_continue
+ }
+ -re "Program received signal SIGINT.*$gdb_prompt $" {
+ pass "stop threads 2"
+ }
+}
+
+gdb_test_multiple "quit" "GDB exits after stopping multithreaded program" {
+ -re "The program is running. Exit anyway\\? \\(y or n\\) $" {
+ send_gdb "y\n"
+ exp_continue
+ }
+ eof {
+ pass "GDB exits after stopping multithreaded program"
+ }
+ timeout {
+ fail "GDB exits after stopping multithreaded program (timeout)"
+ }
+}
+
diff --git a/gdb/testsuite/gdb.threads/pthread_cond_wait.c b/gdb/testsuite/gdb.threads/pthread_cond_wait.c
new file mode 100644
index 00000000000..ae87f8cb765
--- /dev/null
+++ b/gdb/testsuite/gdb.threads/pthread_cond_wait.c
@@ -0,0 +1,76 @@
+/* A small multi-threaded test case.
+
+ 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. */
+
+#include <pthread.h>
+#include <stdio.h>
+#include <time.h>
+
+void
+cond_wait (pthread_cond_t *cond, pthread_mutex_t *mut)
+{
+ pthread_mutex_lock(mut);
+ pthread_cond_wait (cond, mut);
+ pthread_mutex_unlock (mut);
+}
+
+void
+noreturn (void)
+{
+ pthread_mutex_t mut;
+ pthread_cond_t cond;
+
+ pthread_mutex_init (&mut, NULL);
+ pthread_cond_init (&cond, NULL);
+
+ /* Wait for a condition that will never be signaled, so we effectively
+ block the thread here. */
+ cond_wait (&cond, &mut);
+}
+
+void *
+forever_pthread (void *unused)
+{
+ noreturn ();
+}
+
+void
+break_me (void)
+{
+ /* Just an anchor to help putting a breakpoint. */
+}
+
+int
+main (void)
+{
+ pthread_t forever;
+ const struct timespec ts = { 0, 10000000 }; /* 0.01 sec */
+
+ pthread_create (&forever, NULL, forever_pthread, NULL);
+ for (;;)
+ {
+ nanosleep (&ts, NULL);
+ break_me();
+ }
+
+ return 0;
+}
+
diff --git a/gdb/testsuite/gdb.threads/pthread_cond_wait.exp b/gdb/testsuite/gdb.threads/pthread_cond_wait.exp
new file mode 100644
index 00000000000..72ae03a0cd9
--- /dev/null
+++ b/gdb/testsuite/gdb.threads/pthread_cond_wait.exp
@@ -0,0 +1,73 @@
+# Copyright (C) 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@gnu.org
+
+# This file verifies that GDB is able to compute a backtrace for a thread
+# being blocked on a call to pthread_cond_wait().
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+set testfile "pthread_cond_wait"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}"]] != "" } {
+ return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+gdb_test "break break_me" \
+ "Breakpoint 1 at .*: file .*${srcfile}, line .*" \
+ "breakpoint on break_me"
+
+gdb_test "run" \
+ ".*Breakpoint 1, break_me ().*" \
+ "run to break_me"
+
+#
+# Backtrace all threads, find the one running noreturn, and
+# verify that we are able to get a sensible backtrace, including
+# the frame for the pthread_cond_wait() call.
+#
+# The string below will only match if the functions named
+# occur in a single thread's backtrace, in the given order.
+#
+
+global hex
+global decimal
+
+#
+# This is a "backtrace break" ("btb"):
+#
+set btb "\[^\r\n\]+\[\r\n\]+\#${decimal}\[ \t\]+${hex} in "
+
+# One of the threads is blocked on a call to pthread_cond_wait, and
+# we want to verify that we are able to get a sensible backtrace for
+# that thread. Because we don't know its thread ID, we can't switch
+# to it before doing the backtrace. So we get a backtrace for all
+# threads, and verify that one them returns the expected backtrace.
+gdb_test "thread apply all backtrace" \
+ "pthread_cond_wait${btb}cond_wait${btb}noreturn${btb}forever_pthread.*" \
+ "backtrace in blocked thread"
+
diff --git a/gdb/testsuite/gdb.threads/pthreads.c b/gdb/testsuite/gdb.threads/pthreads.c
index d82d550ffb4..abedb248b3e 100644
--- a/gdb/testsuite/gdb.threads/pthreads.c
+++ b/gdb/testsuite/gdb.threads/pthreads.c
@@ -1,5 +1,5 @@
/* Pthreads test program.
- Copyright 1996, 2002, 2003
+ Copyright 1996, 2002, 2003, 2004
Free Software Foundation, Inc.
Written by Fred Fish of Cygnus Support
@@ -23,6 +23,7 @@
Boston, MA 02111-1307, USA. */
#include <stdio.h>
+#include <stdlib.h>
#include <pthread.h>
/* Under OSF 2.0 & 3.0 and HPUX 10, the second arg of pthread_create
diff --git a/gdb/testsuite/gdb.threads/pthreads.exp b/gdb/testsuite/gdb.threads/pthreads.exp
index 5dbe1a8348f..a60a3d372fe 100644
--- a/gdb/testsuite/gdb.threads/pthreads.exp
+++ b/gdb/testsuite/gdb.threads/pthreads.exp
@@ -1,4 +1,5 @@
-# Copyright (C) 1996, 1997, 2003 Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004
+# Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -230,9 +231,9 @@ proc check_control_c {} {
fail "Continue with all threads running (timeout)"
}
}
- sleep 1
+ after 2000
+ send_gdb "\003"
set description "Stopped with a ^C"
- after 1000 [send_gdb "\003"]
gdb_expect {
-re "Program received signal SIGINT.*$gdb_prompt $" {
pass $description
diff --git a/gdb/testsuite/gdb.threads/schedlock.c b/gdb/testsuite/gdb.threads/schedlock.c
index 13f9e75d2df..29022824d26 100644
--- a/gdb/testsuite/gdb.threads/schedlock.c
+++ b/gdb/testsuite/gdb.threads/schedlock.c
@@ -1,3 +1,22 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ 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. */
+
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
@@ -33,7 +52,7 @@ int main() {
void *thread_function(void *arg) {
int my_number = (long) arg;
- int *myp = &args[my_number];
+ int *myp = (int *) &args[my_number];
/* Don't run forever. Run just short of it :) */
while (*myp > 0)
diff --git a/gdb/testsuite/gdb.threads/staticthreads.c b/gdb/testsuite/gdb.threads/staticthreads.c
new file mode 100644
index 00000000000..57defefcae4
--- /dev/null
+++ b/gdb/testsuite/gdb.threads/staticthreads.c
@@ -0,0 +1,73 @@
+/* This test program is part of GDB, The GNU debugger.
+
+ Copyright 2004 Free Software Foundation, Inc.
+
+ Originally written by Jeff Johnston <jjohnstn@redhat.com>,
+ contributed by Red Hat
+
+ 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. */
+
+#include <pthread.h>
+#include <semaphore.h>
+#include <stdio.h>
+#include <limits.h>
+#include <errno.h>
+
+sem_t semaphore;
+
+void *
+thread_function (void *arg)
+{
+ printf ("Thread executing\n");
+ while (sem_wait (&semaphore) != 0)
+ {
+ if (errno != EINTR)
+ {
+ perror ("thread_function");
+ return;
+ }
+ }
+ return NULL;
+}
+
+int
+main (int argc, char **argv)
+{
+ pthread_attr_t attr;
+
+ pthread_attr_init (&attr);
+ pthread_attr_setstacksize (&attr, PTHREAD_STACK_MIN);
+
+ if (sem_init (&semaphore, 0, 0) == -1)
+ {
+ perror ("semaphore");
+ return -1;
+ }
+
+
+ /* Create a thread, wait for it to complete. */
+ {
+ pthread_t thread;
+ pthread_create (&thread, &attr, thread_function, NULL);
+ sem_post (&semaphore);
+ pthread_join (thread, NULL);
+ }
+
+ pthread_attr_destroy (&attr);
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.threads/staticthreads.exp b/gdb/testsuite/gdb.threads/staticthreads.exp
new file mode 100644
index 00000000000..bf04fa3bcee
--- /dev/null
+++ b/gdb/testsuite/gdb.threads/staticthreads.exp
@@ -0,0 +1,95 @@
+# static.exp -- test script, for 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.
+
+# Based on manythreads written by Jeff Johnston, contributed by Red
+# Hat.
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+set testfile "staticthreads"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+set static_flag "-static"
+
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
+ executable \
+ [list debug "incdir=${objdir}" "additional_flags=${static_flag}" \
+ ]] != "" } {
+ return -1
+}
+
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+gdb_test "set print sevenbit-strings" ""
+
+
+# See if the static multi-threaded program runs.
+
+runto_main
+gdb_test "break sem_post"
+set test "Continue to main's call of sem_post"
+gdb_test_multiple "continue" "$test" {
+ -re " sem_post .*$gdb_prompt " {
+ pass "$test"
+ }
+ -re "Program received signal .*$gdb_prompt " {
+ kfail gdb/1328 "$test"
+ }
+}
+
+
+# See if handle SIG32 helps (a little) with a static multi-threaded
+# program.
+
+rerun_to_main
+gdb_test "handle SIG32 nostop noprint pass"
+set test "Handle SIG32 helps"
+gdb_test "continue" " sem_post .*" "handle SIG32 helps"
+
+
+# See if info threads produces anything approaching a thread list.
+
+set test "info threads"
+gdb_test_multiple "info threads" "$test" {
+ -re " Thread .*$gdb_prompt " {
+ pass "$test"
+ }
+ -re "$gdb_prompt " {
+ kfail gdb/1328 "$test"
+ }
+}
+
+
+# Check that the program can be quit.
+
+set test "GDB exits with static thread program"
+gdb_test_multiple "quit" "$test" {
+ -re "The program is running. Exit anyway\\? \\(y or n\\) $" {
+ send_gdb "y\n"
+ exp_continue
+ }
+ eof {
+ pass "$test"
+ }
+}
diff --git a/gdb/testsuite/gdb.threads/thread-specific.c b/gdb/testsuite/gdb.threads/thread-specific.c
index 88a462dac29..8839d72e176 100644
--- a/gdb/testsuite/gdb.threads/thread-specific.c
+++ b/gdb/testsuite/gdb.threads/thread-specific.c
@@ -53,7 +53,7 @@ int main() {
void *thread_function(void *arg) {
int my_number = (long) arg;
- int *myp = &args[my_number];
+ int *myp = (int *) &args[my_number];
/* Don't run forever. Run just short of it :) */
while (*myp > 0)
diff --git a/gdb/testsuite/gdb.threads/thread_check.c b/gdb/testsuite/gdb.threads/thread_check.c
new file mode 100644
index 00000000000..58cb79e01fa
--- /dev/null
+++ b/gdb/testsuite/gdb.threads/thread_check.c
@@ -0,0 +1,75 @@
+/*
+* Copyright (C) 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.
+
+* This file was written by Steve Munroe. (sjmunroe@us.ibm.com)
+* Test break points and single step on thread functions.
+*/
+
+#include <string.h>
+#include <unistd.h>
+#include <pthread.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+
+#define N 2
+
+static void *
+tf (void *arg)
+{
+ int n = (int) (long int) arg;
+ char number[160];
+ int unslept = 10;
+
+ sprintf(number, "tf(%ld): begin", (long)arg);
+ puts (number);
+
+ while (unslept > 0)
+ unslept = sleep(unslept);
+
+ sprintf(number, "tf(%ld): end", (long)arg);
+ puts (number);
+ return NULL;
+}
+
+int main (int argc, char *argv[])
+{
+ int n;
+ int unslept = 2;
+ pthread_t th[N];
+
+ for (n = 0; n < N; ++n)
+ if (pthread_create (&th[n], NULL, tf, (void *) (long int) n) != 0)
+ {
+ while (unslept > 0)
+ unslept = sleep(2);
+ puts ("create failed");
+ exit (1);
+ }
+
+ puts("after create");
+
+ for (n = 0; n < N; ++n)
+ if (pthread_join (th[n], NULL) != 0)
+ {
+ puts ("join failed");
+ exit (1);
+ }
+
+ puts("after join");
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.threads/thread_check.exp b/gdb/testsuite/gdb.threads/thread_check.exp
new file mode 100644
index 00000000000..95b89d03968
--- /dev/null
+++ b/gdb/testsuite/gdb.threads/thread_check.exp
@@ -0,0 +1,96 @@
+# Copyright (C) 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 Manoj Iyer. (manjo@austin.ibm.com)
+# Test break points and single step on thread functions.
+#
+# Test Purpose:
+# - Test that breakpoints, continue in a threaded application works.
+# On powerpc64-unknown-linux-gnu system, running kernel version
+# 2.6.5-7.71-pseries64 this test is known to fail due to kernel bug
+# in ptrace system call.
+#
+# Test Strategy:
+# - tbug.c creates 2 threads
+# - start gdb
+# - create 2 breakpoints #1 main() #2 tf() (the thread function)
+# - run gdb till #1 main() breakpoint is reached
+# - continue to breakpoint #2 tf()
+# - delete all breakpoints
+# - exit gdb.
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+set testfile "thread_check"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}"]] != "" } {
+ return -1
+}
+
+
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+if ![runto_main] then {
+ fail "Can't run to main"
+ return 1;
+}
+
+
+#
+# set breakpoint at thread fucntion tf
+#
+gdb_test "break tf" \
+ "Breakpoint.*at.* file .*$srcfile, line.*" \
+ "breakpoint at tf"
+
+
+#
+#
+# continue to tf() breakpoint #2
+#
+gdb_test "continue" \
+ ".*Breakpoint 2.*tf.* at .*tbug.* .*\r\n.*$gdb_prompt $" \
+ "continue to tf"
+
+#
+# backtrace from thread function.
+#
+gdb_test "backtrace" \
+ "#0 .*tf .*at .*tbug.*" \
+ "backtrace from thread function"
+
+
+#
+# delete all breakpoints
+#
+delete_breakpoints
+
+#
+# exit gdb
+#
+gdb_exit
diff --git a/gdb/testsuite/gdb.threads/watchthreads.exp b/gdb/testsuite/gdb.threads/watchthreads.exp
new file mode 100644
index 00000000000..d6e89d93824
--- /dev/null
+++ b/gdb/testsuite/gdb.threads/watchthreads.exp
@@ -0,0 +1,125 @@
+# 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.
+
+# Check that GDB can support multiple watchpoints across threads.
+
+if $tracelevel {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+# This test verifies that a watchpoint is detected in the proper thread
+# so the test is only meaningful on a system with hardware watchpoints.
+if [target_info exists gdb,no_hardware_watchpoints] {
+ return 0;
+}
+
+set testfile "schedlock"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}"]] != "" } {
+ return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+gdb_test "set can-use-hw-watchpoints 1" "" ""
+
+#
+# Run to `main' where we begin our tests.
+#
+
+if ![runto_main] then {
+ gdb_suppress_tests
+}
+
+set args_0 0
+set args_1 0
+
+# Watch values that will be modified by distinct threads.
+gdb_test "watch args\[0\]" "Hardware watchpoint 2: args\\\[0\\\]"
+gdb_test "watch args\[1\]" "Hardware watchpoint 3: args\\\[1\\\]"
+
+# Loop and continue to allow both watchpoints to be triggered.
+for {set i 0} {$i < 30} {incr i} {
+ set test_flag 0
+ gdb_test_multiple "continue" "threaded watch loop" {
+ -re "Hardware watchpoint 2: args\\\[0\\\].*Old value = 0.*New value = 1.*main \\\(\\\) at .*schedlock.c:21.*$gdb_prompt $"
+ { set args_0 1; set test_flag 1 }
+ -re "Hardware watchpoint 3: args\\\[1\\\].*Old value = 0.*New value = 1.*main \\\(\\\) at .*schedlock.c:21.*$gdb_prompt $"
+ { set args_1 1; set test_flag 1 }
+ -re "Hardware watchpoint 2: args\\\[0\\\].*Old value = $args_0.*New value = [expr $args_0+1].*in thread_function \\\(arg=0x0\\\) at .*schedlock.c:42.*$gdb_prompt $"
+ { set args_0 [expr $args_0+1]; set test_flag 1 }
+ -re "Hardware watchpoint 3: args\\\[1\\\].*Old value = $args_1.*New value = [expr $args_1+1].*in thread_function \\\(arg=0x1\\\) at .*schedlock.c:42.*$gdb_prompt $"
+ { set args_1 [expr $args_1+1]; set test_flag 1 }
+ }
+ # If we fail above, don't bother continuing loop
+ if { $test_flag == 0 } {
+ set i 30;
+ }
+}
+
+# Print success message if loop succeeded.
+if { $test_flag == 1 } {
+ pass "threaded watch loop"
+}
+
+# Verify that we hit first watchpoint in main thread.
+set message "first watchpoint on args\[0\] hit"
+if { $args_0 > 0 } {
+ pass $message
+} else {
+ fail $message
+}
+
+# Verify that we hit second watchpoint in main thread.
+set message "first watchpoint on args\[1\] hit"
+if { $args_1 > 0 } {
+ pass $message
+} else {
+ fail $message
+}
+
+# Verify that we hit first watchpoint in child thread.
+set message "watchpoint on args\[0\] hit in thread"
+if { $args_0 > 1 } {
+ pass $message
+} else {
+ fail $message
+}
+
+# Verify that we hit second watchpoint in child thread.
+set message "watchpoint on args\[1\] hit in thread"
+if { $args_1 > 1 } {
+ pass $message
+} else {
+ fail $message
+}
+
+# Verify that all watchpoint hits are accounted for.
+set message "combination of threaded watchpoints = 30"
+if { [expr $args_0+$args_1] == 30 } {
+ pass $message
+} else {
+ fail $message
+}
diff --git a/gdb/testsuite/lib/compiler.c b/gdb/testsuite/lib/compiler.c
index b1f1f5d5f62..8ebccaf95c4 100644
--- a/gdb/testsuite/lib/compiler.c
+++ b/gdb/testsuite/lib/compiler.c
@@ -16,8 +16,7 @@
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 */
+ */
/* Sometimes the behavior of a test depends upon the compiler used to
compile the test program. A test script can call get_compiler_info
@@ -32,34 +31,36 @@
TODO: all clients should use test_compiler_info and should not
use gcc_compiled, hp_cc_compiler, or hp_aCC_compiler.
- TODO: purge signed_keyword_not_used. */
+ */
-set compiler_info ""
+/* Note the semicolon at the end of this line. Older versions of
+ hp c++ have a bug in string preprocessing: if the last token on a
+ line is a string, then the preprocessor concatenates the next line
+ onto the current line and eats the newline! That messes up TCL of
+ course. That happens with HP aC++ A.03.13, but it no longer happens
+ with HP aC++ A.03.45. */
+
+set compiler_info "unknown" ;
#if defined (__GNUC__)
-set compiler_info [join {gcc __GNUC__ __GNUC_MINOR__ } -]
-set gcc_compiled __GNUC__
+#if defined (__GNUC_PATCHLEVEL__)
+/* Only GCC versions >= 3.0 define the __GNUC_PATCHLEVEL__ macro. */
+set compiler_info [join {gcc __GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__} -]
#else
-set gcc_compiled 0
+set compiler_info [join {gcc __GNUC__ __GNUC_MINOR__ "unknown"} -]
+#endif
+#endif
+
+#if defined (__HP_CXD_SPP)
+/* older hp ansi c, such as A.11.01.25171.gp, defines this */
+set compiler_info [join {hpcc __HP_CXD_SPP} -]
#endif
#if defined (__HP_cc)
+/* newer hp ansi c, such as B.11.11.28706.gp, defines this */
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 0c5eb663b96..4e4eeee1ba7 100644
--- a/gdb/testsuite/lib/compiler.cc
+++ b/gdb/testsuite/lib/compiler.cc
@@ -16,38 +16,39 @@
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 exactly like compiler.c. I could just use compiler.c if
I could be sure that every C++ compiler accepted extensions of ".c". */
-set compiler_info ""
+/* Note the semicolon at the end of this line. Older versions of
+ hp c++ have a bug in string preprocessing: if the last token on a
+ line is a string, then the preprocessor concatenates the next line
+ onto the current line and eats the newline! That messes up TCL of
+ course. That happens with HP aC++ A.03.13, but it no longer happens
+ with HP aC++ A.03.45. */
+
+set compiler_info "unknown" ;
#if defined (__GNUC__)
-set compiler_info [join {gcc __GNUC__ __GNUC_MINOR__ } -]
-set gcc_compiled __GNUC__
+#if defined (__GNUC_PATCHLEVEL__)
+/* Only GCC versions >= 3.0 define the __GNUC_PATCHLEVEL__ macro. */
+set compiler_info [join {gcc __GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__} -]
#else
-set gcc_compiled 0
+set compiler_info [join {gcc __GNUC__ __GNUC_MINOR__ "unknown"} -]
+#endif
+#endif
+
+#if defined (__HP_CXD_SPP)
+/* older hp ansi c, such as A.11.01.25171.gp, defines this */
+set compiler_info [join {hpcc __HP_CXD_SPP} -]
#endif
#if defined (__HP_cc)
+/* newer hp ansi c, such as B.11.11.28706.gp, defines this */
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/cp-support.exp b/gdb/testsuite/lib/cp-support.exp
new file mode 100644
index 00000000000..7ce1e4806a7
--- /dev/null
+++ b/gdb/testsuite/lib/cp-support.exp
@@ -0,0 +1,469 @@
+# This test code is part of GDB, the GNU debugger.
+
+# 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.
+
+# Auxiliary function to check for known problems.
+#
+# EXPECTED_STRING is the string expected by the test.
+#
+# ACTUAL_STRING is the actual string output by gdb.
+#
+# ERRATA_TABLE is a list of lines of the form:
+#
+# { expected-string broken-string {eval-block} }
+#
+# If there is a line for the given EXPECTED_STRING, and if the
+# ACTUAL_STRING output by gdb is the same as the BROKEN_STRING in the
+# table, then I eval the eval-block.
+
+proc cp_check_errata { expected_string actual_string errata_table } {
+ foreach erratum $errata_table {
+ if { "$expected_string" == [lindex $erratum 0]
+ && "$actual_string" == [lindex $erratum 1] } then {
+ eval [lindex $erratum 2]
+ }
+ }
+}
+
+# Test ptype of a class.
+#
+# Different C++ compilers produce different output. To accommodate all
+# the variations listed below, I read the output of "ptype" and process
+# each line, matching it to the class description given in the
+# parameters.
+#
+# IN_COMMAND and IN_TESTNAME are the command and testname for
+# gdb_test_multiple. If IN_TESTNAME is the empty string, then it
+# defaults to IN_COMMAND.
+#
+# IN_KEY is "class" or "struct". For now, I ignore it, and allow either
+# "class" or "struct" in the output, as long as the access specifiers all
+# work out okay.
+#
+# IN_TAG is the class tag or structure tag.
+#
+# IN_CLASS_TABLE is a list of class information. Each entry contains a
+# keyword and some values. The keywords and their values are:
+#
+# { base "base-declaration" }
+#
+# the class has a base with the given declaration.
+#
+# { vbase "name" }
+#
+# the class has a virtual base pointer with the given name. this
+# is for gcc 2.95.3, which emits ptype entries for the virtual base
+# pointers. the vbase list includes both indirect and direct
+# virtual base classes (indeed, a virtual base is usually
+# indirect), so this information cannot be derived from the base
+# declarations.
+#
+# { field "access" "declaration" }
+#
+# the class has a data field with the given access type and the
+# given declaration.
+#
+# { method "access" "declaration" }
+#
+# the class has a member function with the given access type
+# and the given declaration.
+#
+# If you test the same class declaration more than once, you can specify
+# IN_CLASS_TABLE as "ibid". "ibid" means: look for a previous class
+# table that had the same IN_KEY and IN_TAG, and re-use that table.
+#
+# IN_TAIL is the expected text after the close brace, specifically the "*"
+# in "struct { ... } *". This is an optional parameter. The default
+# value is "", for no tail.
+#
+# IN_ERRATA_TABLE is a list of errata entries. See cp_check_errata for the
+# format of the errata table. Note: the errata entries are not subject to
+# demangler syntax adjustment, so you have to make a bigger table
+# with lines for each output variation.
+#
+# gdb can vary the output of ptype in several ways:
+#
+# . CLASS/STRUCT
+#
+# The output can start with either "class" or "struct", depending on
+# what the symbol table reader in gdb decides. This is usually
+# unrelated to the original source code.
+#
+# dwarf-2 debug info distinguishes class/struct, but gdb ignores it
+# stabs+ debug info does not distinguish class/struct
+# hp debug info distinguishes class/struct, and gdb honors it
+#
+# I tried to accommodate this with regular expressions such as
+# "((class|struct) A \{ public:|struct A \{)", but that turns into a
+# hairy mess because of optional private virtual base pointers and
+# optional public synthetic operators. This is the big reason I gave
+# up on regular expressions and started parsing the output.
+#
+# . REDUNDANT ACCESS SPECIFIER
+#
+# In "class { private: ... }" or "struct { public: ... }", gdb might
+# or might not emit a redundant initial access specifier, depending
+# on the gcc version.
+#
+# . VIRTUAL BASE POINTERS
+#
+# If a class has virtual bases, either direct or indirect, the class
+# will have virtual base pointers. With gcc 2.95.3, gdb prints lines
+# for these virtual base pointers. This does not happen with gcc
+# 3.3.4, gcc 3.4.1, or hp acc A.03.45.
+#
+# I accept these lines. These lines are optional; but if I see one of
+# these lines, then I expect to see all of them.
+#
+# Note: drow considers printing these lines to be a bug in gdb.
+#
+# . SYNTHETIC METHODS
+#
+# A C++ compiler may synthesize some methods: an assignment
+# operator, a copy constructor, a constructor, and a destructor. The
+# compiler might include debug information for these methods.
+#
+# dwarf-2 gdb does not show these methods
+# stabs+ gdb shows these methods
+# hp gdb does not show these methods
+#
+# I accept these methods. These lines are optional, and any or
+# all of them might appear, mixed in anywhere in the regular methods.
+#
+# With gcc v2, the synthetic copy-ctor and ctor have an additional
+# "int" parameter at the beginning, the "in-charge" flag.
+#
+# . DEMANGLER SYNTAX VARIATIONS
+#
+# Different demanglers produce "int foo(void)" versus "int foo()",
+# "const A&" versus "const A &", and so on.
+#
+# TESTED WITH
+#
+# gcc 2.95.3 -gdwarf-2
+# gcc 2.95.3 -gstabs+
+# gcc 3.3.4 -gdwarf-2
+# gcc 3.3.4 -gstabs+
+# gcc 3.4.1 -gdwarf-2
+# gcc 3.4.1 -gstabs+
+# gcc HEAD 20040731 -gdwarf-2
+# gcc HEAD 20040731 -gstabs+
+#
+# TODO
+#
+# Tagless structs.
+#
+# "A*" versus "A *" and "A&" versus "A &" in user methods.
+#
+# Test with hp ACC.
+#
+# -- chastain 2004-08-07
+
+proc cp_test_ptype_class { in_command in_testname in_key in_tag in_class_table { in_tail "" } { in_errata_table { } } } {
+ global gdb_prompt
+ set wsopt "\[\r\n\t \]*"
+
+ # The test name defaults to the command.
+
+ if { "$in_testname" == "" } then { set in_testname "$in_command" }
+
+ # Save class tables in a history array for reuse.
+
+ global cp_class_table_history
+ if { $in_class_table == "ibid" } then {
+ if { ! [info exists cp_class_table_history("$in_key,$in_tag") ] } then {
+ fail "$in_testname // bad ibid"
+ return
+ }
+ set in_class_table $cp_class_table_history("$in_key,$in_tag")
+ } else {
+ set cp_class_table_history("$in_key,$in_tag") $in_class_table
+ }
+
+ # Split the class table into separate tables.
+
+ set list_bases { }
+ set list_vbases { }
+ set list_fields { }
+ set list_methods { }
+
+ foreach class_line $in_class_table {
+ switch [lindex $class_line 0] {
+ "base" { lappend list_bases [lindex $class_line 1] }
+ "vbase" { lappend list_vbases [lindex $class_line 1] }
+ "field" { lappend list_fields [lrange $class_line 1 2] }
+ "method" { lappend list_methods [lrange $class_line 1 2] }
+ default { fail "$in_testname // bad line in class table: $class_line"; return; }
+ }
+ }
+
+ # Construct a list of synthetic operators.
+ # These are: { count ccess-type regular-expression }.
+
+ set list_synth { }
+ lappend list_synth [list 0 "public" "$in_tag & operator=\\($in_tag const ?&\\);"]
+ lappend list_synth [list 0 "public" "$in_tag\\((int,|) ?$in_tag const ?&\\);"]
+ lappend list_synth [list 0 "public" "$in_tag\\((int|void|)\\);"]
+
+ # Actually do the ptype.
+
+ set parse_okay 0
+ gdb_test_multiple "$in_command" "$in_testname // parse failed" {
+ -re "type = (struct|class)${wsopt}(\[A-Za-z0-9_\]*)${wsopt}((:\[^\{\]*)?)${wsopt}\{(.*)\}${wsopt}(\[^\r\n\]*)\[\r\n\]+$gdb_prompt $" {
+ set parse_okay 1
+ set actual_key $expect_out(1,string)
+ set actual_tag $expect_out(2,string)
+ set actual_base_string $expect_out(3,string)
+ set actual_body $expect_out(5,string)
+ set actual_tail $expect_out(6,string)
+ }
+ }
+ if { ! $parse_okay } then { return }
+
+ # Check the actual key. It would be nice to require that it match
+ # the input key, but gdb does not support that. For now, accept any
+ # $actual_key as long as the access property of each field/method
+ # matches.
+
+ switch "$actual_key" {
+ "class" { set access "private" }
+ "struct" { set access "public" }
+ default {
+ cp_check_errata "class" "$actual_key" $in_errata_table
+ cp_check_errata "struct" "$actual_key" $in_errata_table
+ fail "$in_testname // wrong key: $actual_key"
+ return
+ }
+ }
+
+ # Check the actual tag.
+
+ if { "$actual_tag" != "$in_tag" } then {
+ cp_check_errata "$in_tag" "$actual_tag" $in_errata_table
+ fail "$in_testname // wrong tag: $actual_tag"
+ return
+ }
+
+ # Check the actual bases.
+ # First parse them into a list.
+
+ set list_actual_bases { }
+ if { "$actual_base_string" != "" } then {
+ regsub "^:${wsopt}" $actual_base_string "" actual_base_string
+ set list_actual_bases [split $actual_base_string ","]
+ }
+
+ # Check the base count.
+
+ if { [llength $list_actual_bases] < [llength $list_bases] } then {
+ fail "$in_testname // too few bases"
+ return
+ }
+ if { [llength $list_actual_bases] > [llength $list_bases] } then {
+ fail "$in_testname // too many bases"
+ return
+ }
+
+ # Check each base.
+
+ foreach actual_base $list_actual_bases {
+ set actual_base [string trim $actual_base]
+ set base [lindex $list_bases 0]
+ if { "$actual_base" != "$base" } then {
+ cp_check_errata "$base" "$actual_base" $in_errata_table
+ fail "$in_testname // wrong base: $actual_base"
+ return
+ }
+ set list_bases [lreplace $list_bases 0 0]
+ }
+
+ # Parse each line in the body.
+
+ set last_was_access 0
+ set vbase_match 0
+
+ foreach actual_line [split $actual_body "\r\n"] {
+
+ # Chomp the line.
+
+ set actual_line [string trim $actual_line]
+ if { "$actual_line" == "" } then { continue }
+
+ # Access specifiers.
+
+ if { [regexp "^(public|protected|private)${wsopt}:\$" "$actual_line" s0 s1] } then {
+ set access "$s1"
+ if { $last_was_access } then {
+ fail "$in_testname // redundant access specifier"
+ return
+ }
+ set last_was_access 1
+ continue
+ } else {
+ set last_was_access 0
+ }
+
+ # Optional virtual base pointer.
+
+ if { [ llength $list_vbases ] > 0 } then {
+ set vbase [lindex $list_vbases 0]
+ if { [ regexp "$vbase \\*(_vb.|_vb\\\$|__vb_)\[0-9\]*$vbase;" $actual_line ] } then {
+ if { "$access" != "private" } then {
+ cp_check_errata "private" "$access" $in_errata_table
+ fail "$in_testname // wrong access specifier for virtual base: $access"
+ return
+ }
+ set list_vbases [lreplace $list_vbases 0 0]
+ set vbase_match 1
+ continue
+ }
+ }
+
+ # Data field.
+
+ if { [llength $list_fields] > 0 } then {
+ set field_access [lindex [lindex $list_fields 0] 0]
+ set field_decl [lindex [lindex $list_fields 0] 1]
+ if { "$actual_line" == "$field_decl" } then {
+ if { "$access" != "$field_access" } then {
+ cp_check_errata "$field_access" "$access" $in_errata_table
+ fail "$in_testname // wrong access specifier for field: $access"
+ return
+ }
+ set list_fields [lreplace $list_fields 0 0]
+ continue
+ }
+
+ # Data fields must appear before synths and methods.
+ cp_check_errata "$field_decl" "$actual_line" $in_errata_table
+ fail "$in_testname // unrecognized line type 1: $actual_line"
+ return
+ }
+
+ # Method function.
+
+ if { [llength $list_methods] > 0 } then {
+ set method_access [lindex [lindex $list_methods 0] 0]
+ set method_decl [lindex [lindex $list_methods 0] 1]
+ if { "$actual_line" == "$method_decl" } then {
+ if { "$access" != "$method_access" } then {
+ cp_check_errata "$method_access" "$access" $in_errata_table
+ fail "$in_testname // wrong access specifier for method: $access"
+ return
+ }
+ set list_methods [lreplace $list_methods 0 0]
+ continue
+ }
+
+ # gcc 2.95.3 shows "foo()" as "foo(void)".
+ regsub -all "\\(\\)" $method_decl "(void)" method_decl
+ if { "$actual_line" == "$method_decl" } then {
+ if { "$access" != "$method_access" } then {
+ cp_check_errata "$method_access" "$access" $in_errata_table
+ fail "$in_testname // wrong access specifier for method: $access"
+ return
+ }
+ set list_methods [lreplace $list_methods 0 0]
+ continue
+ }
+ }
+
+ # Synthetic operators. These are optional and can be mixed in
+ # with the methods in any order, but duplicates are wrong.
+ #
+ # This test must come after the user methods, so that a user
+ # method which matches a synth-method pattern is treated
+ # properly as a user method.
+
+ set synth_match 0
+ for { set isynth 0 } { $isynth < [llength $list_synth] } { incr isynth } {
+ set synth [lindex $list_synth $isynth]
+ set synth_count [lindex $synth 0]
+ set synth_access [lindex $synth 1]
+ set synth_re [lindex $synth 2]
+
+ if { [ regexp "$synth_re" "$actual_line" ] } then {
+
+ if { "$access" != "$synth_access" } then {
+ cp_check_errata "$synth_access" "$access" $in_errata_table
+ fail "$in_testname // wrong access specifier for synthetic operator: $access"
+ return
+ }
+
+ if { $synth_count > 0 } then {
+ cp_check_errata "$actual_line" "$actual_line" $in_errata_table
+ fail "$in_testname // duplicate synthetic operator: $actual_line"
+ }
+
+ # Update the count in list_synth.
+
+ incr synth_count
+ set synth [list $synth_count $synth_access "$synth_re"]
+ set list_synth [lreplace $list_synth $isynth $isynth $synth]
+
+ # Match found.
+
+ set synth_match 1
+ break
+ }
+ }
+ if { $synth_match } then { continue }
+
+ # Unrecognized line.
+
+ if { [llength $list_methods] > 0 } then {
+ set method_decl [lindex [lindex $list_methods 0] 1]
+ cp_check_errata "$method_decl" "$actual_line" $in_errata_table
+ }
+
+ fail "$in_testname // unrecognized line type 2: $actual_line"
+ return
+ }
+
+ # Check for missing elements.
+
+ if { $vbase_match } then {
+ if { [llength $list_vbases] > 0 } then {
+ fail "$in_testname // missing virtual base pointers"
+ return
+ }
+ }
+
+ if { [llength $list_fields] > 0 } then {
+ fail "$in_testname // missing fields"
+ return
+ }
+
+ if { [llength $list_methods] > 0 } then {
+ fail "$in_testname // missing methods"
+ return
+ }
+
+ # Check the tail.
+
+ set actual_tail [string trim $actual_tail]
+ if { "$actual_tail" != "$in_tail" } then {
+ cp_check_errata "$in_tail" "$actual_tail" $in_errata_table
+ fail "$in_testname // wrong tail: $actual_tail"
+ return
+ }
+
+ # It all worked!
+
+ pass "$in_testname"
+ return
+}
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index f49cbbf9855..91001185623 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.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
-
# This file was written by Fred Fish. (fnf@cygnus.com)
# Generic gdb subroutines that should work for any target. If these
@@ -183,7 +180,7 @@ proc gdb_run_cmd {args} {
if [target_info exists gdb,do_reload_on_run] {
# Specifying no file, defaults to the executable
# currently being debugged.
- if { [gdb_load ""] < 0 } {
+ if { [gdb_load ""] != 0 } {
return;
}
send_gdb "continue\n";
@@ -228,7 +225,7 @@ proc gdb_run_cmd {args} {
send_gdb "y\n"
}
-re "The program is not being run.*$gdb_prompt $" {
- if { [gdb_load ""] < 0 } {
+ if { [gdb_load ""] != 0 } {
return;
}
send_gdb "jump *$start\n";
@@ -250,7 +247,7 @@ proc gdb_run_cmd {args} {
}
if [target_info exists gdb,do_reload_on_run] {
- if { [gdb_load ""] < 0 } {
+ if { [gdb_load ""] != 0 } {
return;
}
}
@@ -661,7 +658,7 @@ proc gdb_test_multiple { command message user_code } {
fail "$errmsg"
set result -1
}
- -re ".*$gdb_prompt $" {
+ -re "\r\n$gdb_prompt $" {
if ![string match "" $message] then {
fail "$message"
}
@@ -700,7 +697,17 @@ proc gdb_test_multiple { command message user_code } {
}
set result 0
- gdb_expect $tmt $code
+ set code [catch {gdb_expect $tmt $code} string]
+ if {$code == 1} {
+ global errorInfo errorCode;
+ return -code error -errorinfo $errorInfo -errorcode $errorCode $string
+ } elseif {$code == 2} {
+ return -code return $string
+ } elseif {$code == 3} {
+ return
+ } elseif {$code > 4} {
+ return -code $code $string
+ }
return $result
}
@@ -946,39 +953,56 @@ proc default_gdb_exit {} {
unset gdb_spawn_id
}
+# Load a file into the debugger.
+# The return value is 0 for success, -1 for failure.
#
-# load a file into the debugger.
-# return a -1 if anything goes wrong.
+# This procedure also set the global variable GDB_FILE_CMD_DEBUG_INFO
+# to one of these values:
#
+# debug file was loaded successfully and has debug information
+# nodebug file was loaded successfully and has no debug information
+# fail file was not loaded
+#
+# I tried returning this information as part of the return value,
+# but ran into a mess because of the many re-implementations of
+# gdb_load in config/*.exp.
+#
+# TODO: gdb.base/sepdebug.exp and gdb.stabs/weird.exp might be able to use
+# this if they can get more information set.
+
proc gdb_file_cmd { arg } {
+ global gdb_prompt
global verbose
- global loadpath
- global loadfile
global GDB
- global gdb_prompt
- upvar timeout timeout
+
+ # Set whether debug info was found.
+ # Default to "fail".
+ global gdb_file_cmd_debug_info
+ set gdb_file_cmd_debug_info "fail"
if [is_remote host] {
- set arg [remote_download host $arg];
+ set arg [remote_download host $arg]
if { $arg == "" } {
- error "download failed"
- return -1;
+ perror "download failed"
+ return -1
}
}
send_gdb "file $arg\n"
gdb_expect 120 {
+ -re "Reading symbols from.*no debugging symbols found.*done.*$gdb_prompt $" {
+ verbose "\t\tLoaded $arg into the $GDB with no debugging symbols"
+ set gdb_file_cmd_debug_info "nodebug"
+ return 0
+ }
-re "Reading symbols from.*done.*$gdb_prompt $" {
verbose "\t\tLoaded $arg into the $GDB"
- return 0
- }
- -re "has no symbol-table.*$gdb_prompt $" {
- perror "$arg wasn't compiled with \"-g\""
- return -1
+ set gdb_file_cmd_debug_info "debug"
+ return 0
}
-re "A program is being debugged already.*Kill it.*y or n. $" {
send_gdb "y\n"
- verbose "\t\tKilling previous program being debugged"
+ verbose "\t\tKilling previous program being debugged"
exp_continue
}
-re "Load new symbol table from \".*\".*y or n. $" {
@@ -986,32 +1010,33 @@ proc gdb_file_cmd { arg } {
gdb_expect 120 {
-re "Reading symbols from.*done.*$gdb_prompt $" {
verbose "\t\tLoaded $arg with new symbol table into $GDB"
- return 0
+ set gdb_file_cmd_debug_info "debug"
+ return 0
}
timeout {
perror "(timeout) Couldn't load $arg, other program already loaded."
- return -1
+ return -1
}
}
}
-re "No such file or directory.*$gdb_prompt $" {
- perror "($arg) No such file or directory\n"
- return -1
+ perror "($arg) No such file or directory"
+ return -1
}
-re "$gdb_prompt $" {
perror "couldn't load $arg into $GDB."
- return -1
+ return -1
}
timeout {
perror "couldn't load $arg into $GDB (timed out)."
- return -1
+ return -1
}
eof {
# This is an attempt to detect a core dump, but seems not to
# work. Perhaps we need to match .* followed by eof, in which
# gdb_expect does not seem to have a way to do that.
perror "couldn't load $arg into $GDB (end of file)."
- return -1
+ return -1
}
}
}
@@ -1111,6 +1136,12 @@ proc skip_cplus_tests {} {
return 0
}
+# Return a 1 if I don't even want to try to test FORTRAN.
+
+proc skip_fortran_tests {} {
+ return 0
+}
+
# Skip all the tests in the file if you are not on an hppa running
# hpux target.
@@ -1124,7 +1155,6 @@ 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.
#
@@ -1190,10 +1220,11 @@ proc get_compiler_info {binfile args} {
# These come from compiler.c or compiler.cc
global compiler_info
+
+ # Legacy global data symbols.
global gcc_compiled
global hp_cc_compiler
global hp_aCC_compiler
- global signed_keyword_not_used
# Choose which file to preprocess.
set ifile "${srcdir}/lib/compiler.c"
@@ -1207,15 +1238,42 @@ proc get_compiler_info {binfile args} {
set cppout [ gdb_compile "${ifile}" "" preprocess [list "$args" quiet] ]
log_file -a "$outdir/$tool.log"
- # Source the output.
+ # Eval the output.
+ set unknown 0
foreach cppline [ split "$cppout" "\n" ] {
- if { ! [ regexp "^#" "$cppline" ] } {
- if { ! [ regexp "^\[\n\r\t \]*$" "$cppline" ] } {
- verbose "get_compiler_info: $cppline" 2
- eval "$cppline"
- }
+ if { [ regexp "^#" "$cppline" ] } {
+ # line marker
+ } elseif { [ regexp "^\[\n\r\t \]*$" "$cppline" ] } {
+ # blank line
+ } elseif { [ regexp "^\[\n\r\t \]*set\[\n\r\t \]" "$cppline" ] } {
+ # eval this line
+ verbose "get_compiler_info: $cppline" 2
+ eval "$cppline"
+ } else {
+ # unknown line
+ verbose -log "get_compiler_info: $cppline"
+ set unknown 1
}
}
+
+ # Reset to unknown compiler if any diagnostics happened.
+ if { $unknown } {
+ set compiler_info "unknown"
+ }
+
+ # Set the legacy symbols.
+ set gcc_compiled 0
+ set hp_cc_compiler 0
+ set hp_aCC_compiler 0
+ if { [regexp "^gcc-1-" "$compiler_info" ] } { set gcc_compiled 1 }
+ if { [regexp "^gcc-2-" "$compiler_info" ] } { set gcc_compiled 2 }
+ if { [regexp "^gcc-3-" "$compiler_info" ] } { set gcc_compiled 3 }
+ if { [regexp "^gcc-4-" "$compiler_info" ] } { set gcc_compiled 4 }
+ if { [regexp "^gcc-5-" "$compiler_info" ] } { set gcc_compiled 5 }
+ if { [regexp "^hpcc-" "$compiler_info" ] } { set hp_cc_compiler 1 }
+ if { [regexp "^hpacc-" "$compiler_info" ] } { set hp_aCC_compiler 1 }
+
+ # Log what happened.
verbose -log "get_compiler_info: $compiler_info"
# Most compilers will evaluate comparisons and other boolean
@@ -1593,7 +1651,7 @@ proc gdb_exit { } {
#
# gdb_load -- load a file into the debugger.
-# return a -1 if anything goes wrong.
+# Many files in config/*.exp override this procedure.
#
proc gdb_load { arg } {
return [gdb_file_cmd $arg]
@@ -1763,66 +1821,107 @@ proc gdb_step_for_stub { } {
}
}
-### gdb_get_line_number TEXT [FILE]
-###
-### Search the source file FILE, and return the line number of a line
-### containing TEXT. Use this function instead of hard-coding line
-### numbers into your test script.
-###
-### Specifically, this function uses GDB's "search" command to search
-### FILE for the first line containing TEXT, and returns its line
-### number. Thus, FILE must be a source file, compiled into the
-### executable you are running. If omitted, FILE defaults to the
-### value of the global variable `srcfile'; most test scripts set
-### `srcfile' appropriately at the top anyway.
-###
-### Use this function to keep your test scripts independent of the
-### exact line numbering of the source file. Don't write:
-###
-### send_gdb "break 20"
-###
-### This means that if anyone ever edits your test's source file,
-### your test could break. Instead, put a comment like this on the
-### source file line you want to break at:
-###
-### /* breakpoint spot: frotz.exp: test name */
-###
-### and then write, in your test script (which we assume is named
-### frotz.exp):
-###
-### send_gdb "break [gdb_get_line_number "frotz.exp: test name"]\n"
-###
-### (Yes, Tcl knows how to handle the nested quotes and brackets.
-### Try this:
-### $ tclsh
-### % puts "foo [lindex "bar baz" 1]"
-### foo baz
-### %
-### Tcl is quite clever, for a little stringy language.)
-
-proc gdb_get_line_number {text {file /omitted/}} {
- global gdb_prompt;
- global srcfile;
+# gdb_get_line_number TEXT [FILE]
+#
+# Search the source file FILE, and return the line number of the
+# first line containing TEXT. If no match is found, return -1.
+#
+# TEXT is a string literal, not a regular expression.
+#
+# The default value of FILE is "$srcdir/$subdir/$srcfile". If FILE is
+# specified, and does not start with "/", then it is assumed to be in
+# "$srcdir/$subdir". This is awkward, and can be fixed in the future,
+# by changing the callers and the interface at the same time.
+# In particular: gdb.base/break.exp, gdb.base/condbreak.exp,
+# gdb.base/ena-dis-br.exp.
+#
+# Use this function to keep your test scripts independent of the
+# exact line numbering of the source file. Don't write:
+#
+# send_gdb "break 20"
+#
+# This means that if anyone ever edits your test's source file,
+# your test could break. Instead, put a comment like this on the
+# source file line you want to break at:
+#
+# /* breakpoint spot: frotz.exp: test name */
+#
+# and then write, in your test script (which we assume is named
+# frotz.exp):
+#
+# send_gdb "break [gdb_get_line_number "frotz.exp: test name"]\n"
+#
+# (Yes, Tcl knows how to handle the nested quotes and brackets.
+# Try this:
+# $ tclsh
+# % puts "foo [lindex "bar baz" 1]"
+# foo baz
+# %
+# Tcl is quite clever, for a little stringy language.)
+#
+# ===
+#
+# The previous implementation of this procedure used the gdb search command.
+# This version is different:
+#
+# . It works with MI, and it also works when gdb is not running.
+#
+# . It operates on the build machine, not the host machine.
+#
+# . For now, this implementation fakes a current directory of
+# $srcdir/$subdir to be compatible with the old implementation.
+# This will go away eventually and some callers will need to
+# be changed.
+#
+# . The TEXT argument is literal text and matches literally,
+# not a regular expression as it was before.
+#
+# . State changes in gdb, such as changing the current file
+# and setting $_, no longer happen.
+#
+# After a bit of time we can forget about the differences from the
+# old implementation.
+#
+# --chastain 2004-08-05
- if {! [string compare $file /omitted/]} {
- set file $srcfile
+proc gdb_get_line_number { text { file "" } } {
+ global srcdir
+ global subdir
+ global srcfile
+
+ if { "$file" == "" } then {
+ set file "$srcfile"
+ }
+ if { ! [regexp "^/" "$file"] } then {
+ set file "$srcdir/$subdir/$file"
}
- set result -1;
- gdb_test "list ${file}:1,1" ".*" ""
- send_gdb "search ${text}\n"
- gdb_expect {
- -re "\[\r\n\]+(\[0-9\]+)\[ \t\].*${text}.*$gdb_prompt $" {
- set result $expect_out(1,string)
- }
- -re ".*$gdb_prompt $" {
- fail "find line number containing \"${text}\""
- }
- timeout {
- fail "find line number containing \"${text}\" (timeout)"
- }
+ if { [ catch { set fd [open "$file"] } message ] } then {
+ perror "$message"
+ return -1
}
- return $result;
+
+ set found -1
+ for { set line 1 } { 1 } { incr line } {
+ if { [ catch { set nchar [gets "$fd" body] } message ] } then {
+ perror "$message"
+ return -1
+ }
+ if { $nchar < 0 } then {
+ break
+ }
+ if { [string first "$text" "$body"] >= 0 } then {
+ set found $line
+ break
+ }
+ }
+
+ if { [ catch { close "$fd" } message ] } then {
+ perror "$message"
+ return -1
+ }
+
+ return $found
}
# gdb_continue_to_end:
diff --git a/gdb/testsuite/lib/insight-support.exp b/gdb/testsuite/lib/insight-support.exp
deleted file mode 100644
index cbdf163c85f..00000000000
--- a/gdb/testsuite/lib/insight-support.exp
+++ /dev/null
@@ -1,318 +0,0 @@
-# GDB Testsuite Support for Insight.
-#
-# Copyright 2001 Red Hat, Inc.
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License (GPL) 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.
-
-# Initializes the display for gdbtk testing.
-# Returns 1 if tests should run, 0 otherwise.
-proc gdbtk_initialize_display {} {
- global _using_windows
-
- # This is hacky, but, we don't have much choice. When running
- # expect under Windows, tcl_platform(platform) is "unix".
- if {![info exists _using_windows]} {
- set _using_windows [expr {![catch {exec cygpath --help}]}]
- }
-
- if {![_gdbtk_xvfb_init]} {
- if {$_using_windows} {
- untested "No GDB_DISPLAY -- skipping tests"
- } else {
- untested "No GDB_DISPLAY or Xvfb -- skipping tests"
- }
-
- return 0
- }
-
- return 1
-}
-
-# From dejagnu:
-# srcdir = testsuite src dir (e.g., devo/gdb/testsuite)
-# objdir = testsuite obj dir (e.g., gdb/testsuite)
-# subdir = subdir of testsuite (e.g., gdb.gdbtk)
-#
-# To gdbtk:
-# env(DEFS)=the "defs" files (e.g., devo/gdb/testsuite/gdb.gdbtk/defs)
-# env(SRCDIR)=directory containing the test code (e.g., *.test)
-# env(OBJDIR)=directory which contains any executables
-# (e.g., gdb/testsuite/gdb.gdbtk)
-proc gdbtk_start {test} {
- global verbose
- global GDB
- global GDBFLAGS
- global env srcdir subdir objdir
-
- gdb_stop_suppressing_tests;
-
- # Need to convert ::GDB to use (-)?insight...
- if {[regsub {gdb$} $GDB insight newGDB]} {
- set INSIGHT $newGDB
- } else {
- perror "Cannot find Insight executable"
- exit 1
- }
-
- verbose "Starting $INSIGHT -nx -q --tclcommand=$test"
-
- set real_test [which $test]
- if {$real_test == 0} {
- perror "$test is not found"
- exit 1
- }
-
- if {![is_remote host]} {
- if { [which $INSIGHT] == 0 } {
- perror "$INSIGHT does not exist."
- exit 1
- }
- }
-
- set wd [pwd]
-
- # Find absolute path to test
- set test [to_tcl_path -abs $test]
-
- # Set some environment variables
- cd $srcdir
- set abs_srcdir [pwd]
- set env(DEFS) [to_tcl_path -abs [file join $abs_srcdir $subdir defs]]
-
- cd $wd
- cd [file join $objdir $subdir]
- set env(OBJDIR) [pwd]
- cd $wd
-
- # Set info about target into env
- _gdbtk_export_target_info
-
- set env(SRCDIR) $abs_srcdir
- set env(GDBTK_VERBOSE) 1
- set env(GDBTK_LOGFILE) [to_tcl_path [file join $objdir gdb.log]]
-
- set err [catch {exec $INSIGHT -nx -q --tclcommand=$test} res]
- if { $err } {
- perror "Execing $INSIGHT failed: $res"
- append res "\nERROR gdb-crash"
- }
- return $res
-}
-
-# Start xvfb when using it.
-# The precedence is:
-# 1. If GDB_DISPLAY is set (and not ""), use it
-# 2. If Xvfb exists, use it (not on cygwin)
-# 3. Skip tests
-proc _gdbtk_xvfb_init {} {
- global env spawn_id _xvfb_spawn_id _using_windows
-
- if {[info exists env(GDB_DISPLAY)]} {
- if {$env(GDB_DISPLAY) != ""} {
- set env(DISPLAY) $env(GDB_DISPLAY)
- } else {
- # Suppress tests
- return 0
- }
- } elseif {!$_using_windows && [which Xvfb] != 0} {
- set screen ":[getpid]"
- set pid [spawn Xvfb $screen -ac]
- set _xvfb_spawn_id $spawn_id
- set env(DISPLAY) localhost$screen
- } else {
- # No Xvfb found -- skip test
- return 0
- }
-
- return 1
-}
-
-# Kill xvfb
-proc _gdbtk_xvfb_exit {} {
- global objdir subdir env _xvfb_spawn_id
-
- if {[info exists _xvfb_spawn_id]} {
- exec kill [exp_pid -i $_xvfb_spawn_id]
- wait -i $_xvfb_spawn_id
- }
-}
-
-# help proc for setting tcl-style paths from unix-style paths
-# pass "-abs" to make it an absolute path
-proc to_tcl_path {unix_path {arg {}}} {
- global _using_windows
-
- if {[string compare $unix_path "-abs"] == 0} {
- set unix_path $arg
- set wd [pwd]
- cd [file dirname $unix_path]
- set dirname [pwd]
- set unix_name [file join $dirname [file tail $unix_path]]
- cd $wd
- }
-
- if {$_using_windows} {
- set unix_path [exec cygpath -aw $unix_path]
- set unix_path [join [split $unix_path \\] /]
- }
-
- return $unix_path
-}
-
-# Set information about the target into the environment
-# variable TARGET_INFO. This array will contain a list
-# of commands that are necessary to run a target.
-#
-# This is mostly devined from how dejagnu works, what
-# procs are defined, and analyzing unix.exp, monitor.exp,
-# and sim.exp.
-#
-# Array elements exported:
-# Index Meaning
-# ----- -------
-# init list of target/board initialization commands
-# target target command for target/board
-# load load command for target/board
-# run run command for target_board
-proc _gdbtk_export_target_info {} {
- global env
-
- # Figure out what "target class" the testsuite is using,
- # i.e., sim, monitor, native
- if {[string compare [info proc gdb_target_monitor] gdb_target_monitor] == 0} {
- # Using a monitor/remote target
- set target monitor
- } elseif {[string compare [info proc gdb_target_sim] gdb_target_sim] == 0} {
- # Using a simulator target
- set target simulator
- } elseif {[string compare [info proc gdb_target_sid] gdb_target_sid] == 0} {
- # Using sid
- set target sid
- } else {
- # Assume native
- set target native
- }
-
- # Now setup the array to be exported.
- set info(init) {}
- set info(target) {}
- set info(load) {}
- set info(run) {}
-
- switch $target {
- simulator {
- set opts "[target_info gdb,target_sim_options]"
- set info(target) "target sim $opts"
- set info(load) "load"
- set info(run) "run"
- }
-
- monitor {
- # Setup options for the connection
- if {[target_info exists baud]} {
- lappend info(init) "set remotebaud [target_info baud]"
- }
- if {[target_info exists binarydownload]} {
- lappend info(init) "set remotebinarydownload [target_info binarydownload]"
- }
- if {[target_info exists disable_x_packet]} {
- lappend info(init) "set remote X-packet disable"
- }
- if {[target_info exists disable_z_packet]} {
- lappend info(init) "set remote Z-packet disable"
- }
-
- # Get target name and connection info
- if {[target_info exists gdb_protocol]} {
- set targetname "[target_info gdb_protocol]"
- } else {
- set targetname "not_specified"
- }
- if {[target_info exists gdb_serial]} {
- set serialport "[target_info gdb_serial]"
- } elseif {[target_info exists netport]} {
- set serialport "[target_info netport]"
- } else {
- set serialport "[target_info serial]"
- }
-
- set info(target) "target $targetname $serialport"
- set info(load) "load"
- set info(run) "continue"
- }
-
- sid {
- # We must start sid first, since Insight won't have a clue
- # about how to do this.
- sid_start
- set info(target) "target [target_info gdb_protocol] [target_info netport]"
- set info(load) "load"
- set info(run) "continue"
- }
-
- native {
- set info(run) "run"
- }
- }
-
- # Export the array to the environment
- set env(TARGET_INFO) [array get info]
-}
-
-# gdbtk tests call this function to print out the results of the
-# tests. The argument is a proper list of lists of the form:
-# {status name description msg}. All of these things typically
-# come from the testsuite harness.
-proc gdbtk_analyze_results {results} {
- foreach test $results {
- set status [lindex $test 0]
- set name [lindex $test 1]
- set description [lindex $test 2]
- set msg [lindex $test 3]
-
- switch $status {
- PASS {
- pass "$description ($name)"
- }
-
- FAIL {
- fail "$description ($name)"
- }
-
- ERROR {
- perror "$name"
- }
-
- XFAIL {
- xfail "$description ($name)"
- }
-
- XPASS {
- xpass "$description ($name)"
- }
- }
- }
-}
-
-proc gdbtk_done {{results {}}} {
- global _xvfb_spawn_id
- gdbtk_analyze_results $results
-
- # Kill off xvfb if using it
- if {[info exists _xvfb_spawn_id]} {
- _gdbtk_xvfb_exit
- }
-
- # Yich. If we're using sid, we must kill it
- if {[string compare [info proc gdb_target_sid] gdb_target_sid] == 0} {
- sid_exit
- }
-}
diff --git a/gdb/testsuite/lib/java.exp b/gdb/testsuite/lib/java.exp
index 5c1432fcd37..3a0b2140763 100644
--- a/gdb/testsuite/lib/java.exp
+++ b/gdb/testsuite/lib/java.exp
@@ -1,4 +1,21 @@
-# Copyright (C) 1998, 1999 Red Hat, Inc.
+# This test code is part of GDB, the GNU debugger.
+
+# Copyright 1998, 1999, 2000, 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.
load_lib "libgloss.exp"