diff options
author | Jason Molenda <jmolenda@apple.com> | 1999-06-28 16:06:02 +0000 |
---|---|---|
committer | Jason Molenda <jmolenda@apple.com> | 1999-06-28 16:06:02 +0000 |
commit | 085dd6e638eca9d348100c8f0e8cae04e20d58a1 (patch) | |
tree | 1e740197cdfedb994222a003ea531ec2febaf173 /gdb/testsuite | |
parent | 303f629d619e7bf37b97c2af6f72aba488669044 (diff) | |
download | gdb-085dd6e638eca9d348100c8f0e8cae04e20d58a1.zip gdb-085dd6e638eca9d348100c8f0e8cae04e20d58a1.tar.gz gdb-085dd6e638eca9d348100c8f0e8cae04e20d58a1.tar.bz2 |
import gdb-1999-06-28 snapshot
Diffstat (limited to 'gdb/testsuite')
104 files changed, 3767 insertions, 1170 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 93630d2..376c575 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,105 @@ +1999-06-25 Stan Shebs <shebs@andros.cygnus.com> + + From Jimmy Guo <guo@cup.hp.com> and others at HP: + * lib/gdb.exp (get_compiler_info): Add detection for assorted + HP compilers, also set the globals $true and $false. + + * gdb.base/annota1.c, bitfields.c, break.c, call-ar-st.c, + call-rt-st.c, call-strs.c, callfuncs.c, callfuncs2.c, condbreak.c, + coremaker.c, ending-run.c, exprs.c, funcargs.c, interrupt.c, + jump.c, langs0.c, langs1.c, langs2.c, list0.c, list1.c, + long_long.c, mips_pro.c, nodebug.c, opaque0.c, opaque1.c, + printcmds.c, ptype.c, recurse.c, restore.c, return.c, run.c, + scope0.c, scope1.c, setshow.c, setvar.c, shmain.c, shr1.c, shr2.c, + sigall.c, signals.c, so-impl-ld.c, so-indr-cl.c, solib.c, + solib1.c, solib2.c, step-test.c, twice.c, varargs.c, watchpoint.c, + whatis.c} Add C++ compatible function definitions and return + types, add includes for library functions. + * gdb.base/ptype.c (my_false, my_true): Use instead of false/true. + * gdb.base/step-test.c (myglob): Rename from glob. + * gdb.base/attach.c, attach2.c, average.c, execd-prog.c, + foll-exec.c, foll-fork.c, foll-vfork.c, sum.c, vforked-prog.c: New + files, move here from gdb.hp. + * gdb.base/annota1.exp, break.exp, call-ar-st.exp, call-rt-st.exp, + commands.exp, condbreak.exp, define.exp, ena-dis-br.exp, + ending-run.exp, jump.exp. list.exp, long_long.exp, so-impl-ld.exp: + Adjust line numbers in regexps. + + * gdb.base/all-bin.exp, eval-skip.exp, exprs.exp, logical.exp, + miscexprs.exp, pointers.exp, relational.exp: Use $true and $false + instead of 0/1. + + * gdb.base/attach.exp, dbx.exp, foll-exec.exp, foll-fork.exp, + foll-vfork.exp: New files, move here from gdb.hp. + * gdb.base/page.exp: New file, test of pagination command. + + * gdb.base/watchpoint.c (recurser): New function, for watchpoint + recursion test. + * gdb.base/watchpoint.exp: Add more test cases for watchpoints. + + * gdb.base/so-impl-ld.exp, gdb.base/so-indr-cl.exp, + gdb.base/solib.exp: Fix compiler invocation process. + + * gdb.base/callfuncs.exp, gdb.base/callfuncs2.exp: Don't xfail for + HP-UX 11, turn off overload resolution explicitly. + * gdb.base/commands.exp: Set argument list explicitly, add + watchpoint test. + * gdb.base/completion.exp: Enable if HP-UX, tweak tests to make + them work. + * gdb.base/constvars.exp, gdb.base/volatile.exp: Escape the + expressions properly. + * gdb.base/corefile.exp: Loosen the match slightly. + * gdb.base/default.exp: Allow "Error accessing memory" message + also. + * gdb.base/display.exp: Skip over x/0 j if PA64. + * gdb.base/funcargs.exp: Add xfails for HP-UX. + * gdb.base/interrupt.exp: Ditto. + * gdb.base/langs.exp: Add symbolic matches governed by compiler + in use. + * gdb.base/list.exp: Add xfails for HP-UX. + * gdb.base/long_long.exp: Refine some of the numeric matches. + * gdb.base/mips_pro.exp: Xfail on HP-UX. + * gdb.base/miscexprs.exp: Add PA2.0 case for array size test. + * gdb.base/nodebug.exp: Succeed on more varieties of output. + * gdb.base/opaque.exp: Remove some HP-UX xfails. + * gdb.base/ptype.exp: Succeed on more varieties of output. + * gdb.base/scope.exp: Add xfails for HP-UX. + * gdb.base/sect-cmd.exp: Add more cases. + * gdb.base/setvar.exp: Add xfails for HP-UX. + * gdb.base/shlib-call.exp: Loosen some matches slightly. + * gdb.base/signals.exp: Match on void symbolically. + * gdb.base/step-test.exp: Add case for PA64. + * gdb.base/term.exp: Add exit and restart. + * gdb.base/twice.exp: Clean up after self. + * gdb.base/varargs.exp: Disable overload resolution explicitly. + * gdb.base/whatis.exp: Allow more ways to pass tests. + + * gdb.base/smoke.exp, gdb.base/smoke.c, gdb.base/smoke.cc: Remove, + no longer useful. + +Fri Jun 25 19:27:28 1999 Andrew Cagney <cagney@b1.cygnus.com> + + * lib/gdb.exp (proc gdb_expect_list): New procedure. Matches a + list of patterns. + * gdb.base/call-ar-st.exp: Use gdb_expect_list in "print + print_double_array(double_array)", "continuing to breakpoint + 1018", "print print_double_array(array_d)" and "continuing to + 1034" tests. + +1999-06-24 Jason Molenda (jsm@bugshack.cygnus.com) + + * Makefile.in: Add empty html and install-html targets. + +1999-06-24 Stan Shebs <shebs@andros.cygnus.com> + + * config/mt-*: Remove, these haven't been used since 1996. + +1999-06-22 Stan Shebs <shebs@andros.cygnus.com> + + * gdb.base/call-strs.c, gdb.base/ending-run.c, + gdb.base/step-test.c: Include stdlib.h and string.h as needed. + * gdb.c++/member-ptr.exp: Skip over these tests if using G++. + 1999-06-18 Stan Shebs <shebs@andros.cygnus.com> * gdb.c++/overload.exp: XFAIL everything if using G++, add a diff --git a/gdb/testsuite/Makefile.in b/gdb/testsuite/Makefile.in index d763450..c3b94f7 100644 --- a/gdb/testsuite/Makefile.in +++ b/gdb/testsuite/Makefile.in @@ -89,6 +89,8 @@ INFODIRS=doc info: install-info: dvi: +html: +install-html: install: diff --git a/gdb/testsuite/gdb.base/all-bin.exp b/gdb/testsuite/gdb.base/all-bin.exp index 4d6662b..5208ef3 100644 --- a/gdb/testsuite/gdb.base/all-bin.exp +++ b/gdb/testsuite/gdb.base/all-bin.exp @@ -45,6 +45,10 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } +if [get_compiler_info ${binfile}] { + return -1 +} + gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir @@ -206,7 +210,7 @@ gdb_expect { send_gdb "print v_int <= v_short\n" gdb_expect { - -re ".*0.*$gdb_prompt $" { + -re ".*$false.*$gdb_prompt $" { pass "print value of v_int<=v_short" } -re ".*$gdb_prompt $" { fail "print value of v_int<=v_short" } @@ -236,7 +240,7 @@ gdb_expect { send_gdb "print v_int <= v_signed_short\n" gdb_expect { - -re ".*0.*$gdb_prompt $" { + -re ".*$false.*$gdb_prompt $" { pass "print value of v_int<=v_signed_short" } -re ".*$gdb_prompt $" { fail "print value of v_int<=v_signed_short" } @@ -246,7 +250,7 @@ gdb_expect { send_gdb "print v_int <= v_unsigned_short\n" gdb_expect { - -re ".*0.*$gdb_prompt $" { + -re ".*$false.*$gdb_prompt $" { pass "print value of v_int<=v_unsigned_short" } -re ".*$gdb_prompt $" { fail "print value of v_int<=v_unsigned_short" } @@ -256,7 +260,7 @@ gdb_expect { send_gdb "print v_int <= v_signed_int\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of v_int<=v_signed_int" } -re ".*$gdb_prompt $" { fail "print value of v_int<=v_signed_int" } @@ -266,7 +270,7 @@ gdb_expect { send_gdb "print v_int <= v_unsigned_int\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of v_int<=v_unsigned_int" } -re ".*$gdb_prompt $" { fail "print value of v_int<=v_unsigned_int" } @@ -276,7 +280,7 @@ gdb_expect { send_gdb "print v_int <= v_long\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of v_int<=v_long" } -re ".*$gdb_prompt $" { fail "print value of v_int<=v_long" } @@ -286,7 +290,7 @@ gdb_expect { send_gdb "print v_int <= v_signed_long\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of v_int<=v_signed_long" } -re ".*$gdb_prompt $" { fail "print value of v_int<=v_signed_long" } @@ -296,7 +300,7 @@ gdb_expect { send_gdb "print v_int <= v_unsigned_long\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of v_int<=v_unsigned_long" } -re ".*$gdb_prompt $" { fail "print value of v_int<=v_unsigned_long" } @@ -306,7 +310,7 @@ gdb_expect { send_gdb "print v_int <= v_float\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of v_int<=v_float" } -re ".*$gdb_prompt $" { fail "print value of v_int<=v_float" } @@ -316,7 +320,7 @@ gdb_expect { send_gdb "print v_int <= v_double\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of v_int<=v_double" } -re ".*$gdb_prompt $" { fail "print value of v_int<=v_double" } @@ -335,7 +339,7 @@ gdb_test "set variable v_unsigned_long=0" "" "set v_unsigned_long=0" send_gdb "print v_int && v_char\n" gdb_expect { - -re ".*0.*$gdb_prompt $" { + -re ".*$false.*$gdb_prompt $" { pass "print value of v_int&&v_char" } -re ".*$gdb_prompt $" { fail "print value of v_int&&v_char" } @@ -344,7 +348,7 @@ gdb_expect { send_gdb "print v_int && v_short\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of v_int&&v_short" } -re ".*$gdb_prompt $" { fail "print value of v_int&&v_short" } @@ -354,7 +358,7 @@ gdb_expect { send_gdb "print v_int && v_signed_char\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of v_int&&v_signed_char" } -re ".*$gdb_prompt $" { fail "print value of v_int&&v_signed_char" } @@ -364,7 +368,7 @@ gdb_expect { send_gdb "print v_int && v_unsigned_char\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of v_int&&v_unsigned_char" } -re ".*$gdb_prompt $" { fail "print value of v_int&&v_unsigned_char" } @@ -374,7 +378,7 @@ gdb_expect { send_gdb "print v_int && v_signed_short\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of v_int&&v_signed_short" } -re ".*$gdb_prompt $" { fail "print value of v_int&&v_signed_short" } @@ -384,7 +388,7 @@ gdb_expect { send_gdb "print v_int && v_unsigned_short\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of v_int&&v_unsigned_short" } -re ".*$gdb_prompt $" { fail "print value of v_int&&v_unsigned_short" } @@ -394,7 +398,7 @@ gdb_expect { send_gdb "print v_int && v_signed_int\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of v_int&&v_signed_int" } -re ".*$gdb_prompt $" { fail "print value of v_int&&v_signed_int" } @@ -404,7 +408,7 @@ gdb_expect { send_gdb "print v_int && v_unsigned_int\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of v_int&&v_unsigned_int" } -re ".*$gdb_prompt $" { fail "print value of v_int&&v_unsigned_int" } @@ -414,7 +418,7 @@ gdb_expect { send_gdb "print v_int && v_long\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of v_int&&v_long" } -re ".*$gdb_prompt $" { fail "print value of v_int&&v_long" } @@ -424,7 +428,7 @@ gdb_expect { send_gdb "print v_int && v_signed_long\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of v_int&&v_signed_long" } -re ".*$gdb_prompt $" { fail "print value of v_int&&v_signed_long" } @@ -434,7 +438,7 @@ gdb_expect { send_gdb "print v_int && v_unsigned_long\n" gdb_expect { - -re ".*0.*$gdb_prompt $" { + -re ".*$false.*$gdb_prompt $" { pass "print value of v_int&&v_unsigned_long" } -re ".*$gdb_prompt $" { fail "print value of v_int&&v_unsigned_long" } @@ -444,7 +448,7 @@ gdb_expect { send_gdb "print v_int && v_float\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of v_int&&v_float" } -re ".*$gdb_prompt $" { fail "print value of v_int&&v_float" } @@ -454,7 +458,7 @@ gdb_expect { send_gdb "print v_int && v_double\n" gdb_expect { - -re ".*0.*$gdb_prompt $" { + -re ".*$false.*$gdb_prompt $" { pass "print value of v_int&&v_double" } -re ".*$gdb_prompt $" { fail "print value of v_int&&v_double" } diff --git a/gdb/testsuite/gdb.base/annota1.c b/gdb/testsuite/gdb.base/annota1.c index 7eeee77..7d423e0 100644 --- a/gdb/testsuite/gdb.base/annota1.c +++ b/gdb/testsuite/gdb.base/annota1.c @@ -6,16 +6,28 @@ #endif +#ifdef PROTOTYPES +void +handle_USR1 (int sig) +{ +} +#else void handle_USR1 (sig) int sig; { } +#endif int value; +#ifdef PROTOTYPES +int +main (void) +#else int main () +#endif { int my_array[3] = { 1, 2, 3 }; diff --git a/gdb/testsuite/gdb.base/annota1.exp b/gdb/testsuite/gdb.base/annota1.exp index 4239822..ba24fe9 100644 --- a/gdb/testsuite/gdb.base/annota1.exp +++ b/gdb/testsuite/gdb.base/annota1.exp @@ -62,7 +62,7 @@ if [target_info exists gdb_stub] { # # the line at which break main will put the breakpoint # -set main_line 20 +set main_line 32 # The commands we test here produce many lines of output; disable "press # <return> to continue" prompts. @@ -143,7 +143,7 @@ gdb_expect { #exp_internal 1 send_gdb "run\n" gdb_expect { - -re "\r\n\032\032post-prompt\r\nStarting program: $binfile \(\r\n\r\n\032\032frames-invalid\)+\(\r\n\r\n\032\032breakpoints-invalid\)*.*\(\r\n\r\n\032\032frames-invalid\)*\r\n\r\n\032\032starting\(\r\n\r\n\032\032frames-invalid\)+\r\n\r\n\032\032breakpoint 1\r\n\r\nBreakpoint 1, \r\n\032\032frame-begin 0 $hex\r\n\r\n\032\032frame-function-name\r\nmain\r\n\032\032frame-args\r\n \\(\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n.*annota1.c\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n$main_line\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source.*$srcfile:$main_line:.*:beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped\r\n$gdb_prompt$" \ + -re "\r\n\032\032post-prompt\r\nStarting program: $binfile \(\r\n\r\n\032\032frames-invalid\)+\(\r\n\r\n\032\032breakpoints-invalid\)*.*\(\r\n\r\n\032\032frames-invalid\)*\r\n\r\n\032\032starting\(\r\n\r\n\032\032frames-invalid\)+\r\n\r\n\032\032breakpoint 1\r\n\r\nBreakpoint 1, \r\n\032\032frame-begin 0 $hex\r\n\r\n\032\032frame-function-name\r\nmain\r\n\032\032frame-args\r\n \\(\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n.*annota1.c\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n$main_line\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source.*$srcfile:$main_line:.*:beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped\r\n.*$gdb_prompt$" \ { pass "run until main breakpoint" } -re ".*$gdb_prompt$" { fail "run until main breakpoint" } timeout { fail "run until main breakpoint (timeout)" } @@ -258,7 +258,7 @@ gdb_expect { # 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${srcdir}/${subdir}/${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:.*:185:beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped\r\n$gdb_prompt$" \ + -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${srcdir}/${subdir}/${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$" \ { pass "send SIGUSR1" } -re ".*$gdb_prompt$" { fail "send SIGUSR1" } timeout { fail "send SIGUSR1 (timeout)" } diff --git a/gdb/testsuite/gdb.base/bitfields.c b/gdb/testsuite/gdb.base/bitfields.c index 930b244..3e6b2e6 100644 --- a/gdb/testsuite/gdb.base/bitfields.c +++ b/gdb/testsuite/gdb.base/bitfields.c @@ -5,7 +5,7 @@ this may cause some tests to fail. But at least we can still compile the test program and run the tests... */ -#ifndef __STDC__ +#if !defined(__STDC__) && !defined(__cplusplus) #define signed /**/ #endif diff --git a/gdb/testsuite/gdb.base/break.c b/gdb/testsuite/gdb.base/break.c index 491d6e5..6acbf9b 100644 --- a/gdb/testsuite/gdb.base/break.c +++ b/gdb/testsuite/gdb.base/break.c @@ -29,6 +29,7 @@ char *arg; #else /* ! vxworks */ # include <stdio.h> +# include <stdlib.h> #endif /* ! vxworks */ /* @@ -38,20 +39,34 @@ char *arg; * of gcc have or have had problems with this). */ +#ifdef PROTOTYPES +int marker1 (void) { return (0); } +int marker2 (int a) { return (1); } +void marker3 (char *a, char *b) {} +void marker4 (long d) {} +#else int marker1 () { return (0); } int marker2 (a) int a; { return (1); } void marker3 (a, b) char *a, *b; {} void marker4 (d) long d; {} +#endif /* * This simple classical example of recursion is useful for * testing stack backtraces and such. */ +#ifdef PROTOTYPES +int factorial(int); + +int +main (int argc, char **argv, char **envp) +#else int main (argc, argv, envp) int argc; char *argv[], **envp; +#endif { #ifdef usestubs set_debug_traps(); @@ -70,8 +85,12 @@ char *argv[], **envp; return 0; } +#ifdef PROTOTYPES +int factorial (int value) +#else int factorial (value) int value; +#endif { if (value > 1) { value *= factorial (value - 1); diff --git a/gdb/testsuite/gdb.base/break.exp b/gdb/testsuite/gdb.base/break.exp index 300a4e6..115cd80 100644 --- a/gdb/testsuite/gdb.base/break.exp +++ b/gdb/testsuite/gdb.base/break.exp @@ -39,6 +39,10 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } +if [get_compiler_info ${binfile}] { + return -1 +} + gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir @@ -88,22 +92,22 @@ gdb_test "break $srcfile:factorial" \ # # test break at line number # -gdb_test "break 64" \ - "Breakpoint.*at.* file .*$srcfile, line 64\\." \ +gdb_test "break 79" \ + "Breakpoint.*at.* file .*$srcfile, line 79\\." \ "breakpoint line number" # # test duplicate breakpoint # -gdb_test "break 64" \ - "Note: breakpoint \[0-9\]+ also set at pc.*Breakpoint \[0-9\]+ at.* file .*$srcfile, line 64\\." \ +gdb_test "break 79" \ + "Note: breakpoint \[0-9\]+ also set at pc.*Breakpoint \[0-9\]+ at.* file .*$srcfile, line 79\\." \ "breakpoint duplicate" # # test break at line number in file # -gdb_test "break $srcfile:70" \ - "Breakpoint.*at.* file .*$srcfile, line 70\\." \ +gdb_test "break $srcfile:85" \ + "Breakpoint.*at.* file .*$srcfile, line 85\\." \ "breakpoint line number in file" @@ -111,18 +115,23 @@ gdb_test "break $srcfile:70" \ # check to see what breakpoints are set # if [target_info exists gdb_stub] { - set main_line 57 + set main_line 72 } else { - set main_line 60 + set main_line 75 } +if {$hp_aCC_compiler} { + set proto "\\(int\\)" +} else { + set proto "" +} gdb_test "info break" \ "Num Type\[ \]+Disp Enb Address\[ \]+What.* \[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$main_line.* -\[0-9\]+\[\t \]+breakpoint keep y.* in factorial at .*$srcfile:76.* -\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:64.* -\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:64.* -\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:70" \ +\[0-9\]+\[\t \]+breakpoint keep y.* in factorial$proto at .*$srcfile:95.* +\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:79.* +\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:79.* +\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:85" \ "breakpoint info" @@ -150,35 +159,35 @@ if ![target_info exists use_gdb_stub] { send_gdb "y\n" exp_continue } - -re "Starting program.*Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:60.*60\[\t \]+if .argc.* \{.*$gdb_prompt $"\ + -re "Starting program.*Breakpoint \[0-9\]+,.*main .*argc.*argv.* at .*$srcfile:75.*75\[\t \]+if .argc.* \{.*$gdb_prompt $"\ { pass "run until function breakpoint" } -re ".*$gdb_prompt $" { fail "run until function breakpoint" } timeout { fail "run until function breakpoint (timeout)" } } } else { if ![target_info exists gdb_stub] { - gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:60.*60\[\t \]+if .argc.*\{" "stub continue" + gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:75.*75\[\t \]+if .argc.*\{" "stub continue" } } # # run until the breakpoint at a line number # -gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:64.*64\[\t \]+printf.*factorial.*" \ +gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:79.*79\[\t \]+printf.*factorial.*" \ "run until breakpoint set at a line number" # # Run until the breakpoint set in a function in a file # for {set i 6} {$i >= 1} {incr i -1} { - gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, factorial \\(value=$i\\) at .*$srcfile:76.*76\[\t \]+if .value > 1. \{" \ + gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, factorial \\(value=$i\\) at .*$srcfile:95.*95\[\t \]+.*if .value > 1. \{.*" \ "run until file:function($i) breakpoint" } # # run until the file:function breakpoint at a line number in a file # -gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:70.*70\[\t \]+return 0;" \ +gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:85.*85\[\t \]+return 0;" \ "run until file:linenum breakpoint" # @@ -202,31 +211,38 @@ gdb_test "tbreak $srcfile:factorial" "Breakpoint.*at.* file .*$srcfile, line.*" # # test break at line number # -send_gdb "tbreak 64\n" +send_gdb "tbreak 79\n" gdb_expect { - -re "Breakpoint.*at.* file .*$srcfile, line 64.*$gdb_prompt $" { pass "Temporary breakpoint line number #1" } + -re "Breakpoint.*at.* file .*$srcfile, line 79.*$gdb_prompt $" { pass "Temporary breakpoint line number #1" } -re ".*$gdb_prompt $" { pass "Temporary breakpoint line number #1" } timeout { fail "breakpoint line number #1 (timeout)" } } -gdb_test "tbreak 60" "Breakpoint.*at.* file .*$srcfile, line 60.*" "Temporary breakpoint line number #2" +gdb_test "tbreak 75" "Breakpoint.*at.* file .*$srcfile, line 75.*" "Temporary breakpoint line number #2" # # test break at line number in file # -send_gdb "tbreak $srcfile:70\n" +send_gdb "tbreak $srcfile:85\n" gdb_expect { - -re "Breakpoint.*at.* file .*$srcfile, line 70.*$gdb_prompt $" { pass "Temporary breakpoint line number in file #1" } + -re "Breakpoint.*at.* file .*$srcfile, line 85.*$gdb_prompt $" { pass "Temporary breakpoint line number in file #1" } -re ".*$gdb_prompt $" { pass "Temporary breakpoint line number in file #1" } timeout { fail "Temporary breakpoint line number in file #1 (timeout)" } } -gdb_test "tbreak $srcfile:66" "Breakpoint.*at.* file .*$srcfile, line 66.*" "Temporary breakpoint line number in file #2" +gdb_test "tbreak $srcfile:81" "Breakpoint.*at.* file .*$srcfile, line 81.*" "Temporary breakpoint line number in file #2" # # check to see what breakpoints are set (temporary this time) # -gdb_test "info break" "Num Type.*Disp Enb Address.*What.*\[\r\n\]\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$main_line.*\[\r\n\]\[0-9\]+\[\t \]+breakpoint del.*y.*in factorial at .*$srcfile:76.*\[\r\n\]\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:64.*\[\r\n\]\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:70.*" "Temporary breakpoint info" +gdb_test "info break" "Num Type.*Disp Enb Address.*What.*\[\r\n\] +\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:$main_line.*\[\r\n\] +\[0-9\]+\[\t \]+breakpoint del.*y.*in factorial$proto at .*$srcfile:95.*\[\r\n\] +\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:79.*\[\r\n\] +\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:75.*\[\r\n\] +\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:85.*\[\r\n\] +\[0-9\]+\[\t \]+breakpoint del.*y.*in main at .*$srcfile:81.*" \ + "Temporary breakpoint info" #*********** @@ -301,18 +317,18 @@ gdb_expect { # Verify that "until <location>" works. (This is really just syntactic # sugar for "tbreak <location>; continue".) # -send_gdb "until 64\n" +send_gdb "until 79\n" gdb_expect { - -re "main .* at .*:64.*$gdb_prompt $"\ - {pass "until 64"} + -re "main .* at .*:79.*$gdb_prompt $"\ + {pass "until 79"} -re "$gdb_prompt $"\ - {fail "until 64"} - timeout {fail "(timeout) until 64"} + {fail "until 79"} + timeout {fail "(timeout) until 79"} } # Verify that a malformed "until" is gracefully caught. # -send_gdb "until 65 then stop\n" +send_gdb "until 80 then stop\n" gdb_expect { -re "Junk at end of arguments..*$gdb_prompt $"\ {pass "malformed until"} @@ -379,13 +395,13 @@ gdb_expect { # if ![runto_main] then { fail "break tests suppressed" } -send_gdb "break 64\n" +send_gdb "break 79\n" gdb_expect { - -re "Breakpoint (\[0-9\]*) at .*, line 64.*$gdb_prompt $"\ - {pass "set to-be-silent break 64"} + -re "Breakpoint (\[0-9\]*) at .*, line 79.*$gdb_prompt $"\ + {pass "set to-be-silent break 79"} -re "$gdb_prompt $"\ - {fail "set to-be-silent break 64"} - timeout {fail "(timeout) set to-be-silent break 64"} + {fail "set to-be-silent break 79"} + timeout {fail "(timeout) set to-be-silent break 79"} } send_gdb "commands $expect_out(1,string)\n" @@ -393,33 +409,33 @@ send_gdb "silent\n" send_gdb "end\n" gdb_expect { -re ".*$gdb_prompt $"\ - {pass "set silent break 64"} - timeout {fail "(timeout) set silent break 64"} + {pass "set silent break 79"} + timeout {fail "(timeout) set silent break 79"} } send_gdb "info break $expect_out(1,string)\n" gdb_expect { - -re "\[0-9\]*\[ \t\]*breakpoint.*:64\r\n\[ \t\]*silent.*$gdb_prompt $"\ - {pass "info silent break 64"} + -re "\[0-9\]*\[ \t\]*breakpoint.*:79\r\n\[ \t\]*silent.*$gdb_prompt $"\ + {pass "info silent break 79"} -re "$gdb_prompt $"\ - {fail "info silent break 64"} - timeout {fail "(timeout) info silent break 64"} + {fail "info silent break 79"} + timeout {fail "(timeout) info silent break 79"} } send_gdb "continue\n" gdb_expect { -re "Continuing.\r\n$gdb_prompt $"\ - {pass "hit silent break 64"} + {pass "hit silent break 79"} -re "$gdb_prompt $"\ - {fail "hit silent break 64"} - timeout {fail "(timeout) hit silent break 64"} + {fail "hit silent break 79"} + timeout {fail "(timeout) hit silent break 79"} } send_gdb "bt\n" gdb_expect { - -re "#0 main .* at .*:64.*$gdb_prompt $"\ - {pass "stopped for silent break 64"} + -re "#0 main .* at .*:79.*$gdb_prompt $"\ + {pass "stopped for silent break 79"} -re "$gdb_prompt $"\ - {fail "stopped for silent break 64"} - timeout {fail "(timeout) stopped for silent break 64"} + {fail "stopped for silent break 79"} + timeout {fail "(timeout) stopped for silent break 79"} } # Verify that GDB can at least parse a breakpoint with the @@ -427,7 +443,7 @@ gdb_expect { # thread-specific breakpoint really triggers appropriately. # The gdb.threads subdirectory contains tests for that.) # -send_gdb "break 65 thread 999\n" +send_gdb "break 80 thread 999\n" gdb_expect { -re "Unknown thread 999.*$gdb_prompt $"\ {pass "thread-specific breakpoint on non-existent thread disallowed"} @@ -435,7 +451,7 @@ gdb_expect { {fail "thread-specific breakpoint on non-existent thread disallowed"} timeout {fail "(timeout) thread-specific breakpoint on non-existent thread disallowed"} } -send_gdb "break 65 thread foo\n" +send_gdb "break 80 thread foo\n" gdb_expect { -re "Junk after thread keyword..*$gdb_prompt $"\ {pass "thread-specific breakpoint on bogus thread ID disallowed"} @@ -447,7 +463,7 @@ gdb_expect { # Verify that GDB responds gracefully to a breakpoint command with # trailing garbage. # -send_gdb "break 65 foo\n" +send_gdb "break 80 foo\n" gdb_expect { -re "Junk at end of arguments..*$gdb_prompt $"\ {pass "breakpoint with trailing garbage disallowed"} @@ -466,9 +482,9 @@ gdb_expect { {pass "step over breakpoint"} timeout {fail "(timeout) step over breakpoint"} } -send_gdb "clear 66\n" +send_gdb "clear 81\n" gdb_expect { - -re "No breakpoint at 66..*$gdb_prompt $"\ + -re "No breakpoint at 81..*$gdb_prompt $"\ {pass "clear line has no breakpoint disallowed"} -re "$gdb_prompt $"\ {fail "clear line has no breakpoint disallowed"} @@ -485,15 +501,15 @@ gdb_expect { # Verify that a breakpoint can be set via a convenience variable. # -send_gdb "set \$foo=66\n" +send_gdb "set \$foo=81\n" gdb_expect { -re "$gdb_prompt $"\ - {pass "set convenience variable \$foo to 66"} - timeout {fail "(timeout) set convenience variable \$foo to 66"} + {pass "set convenience variable \$foo to 81"} + timeout {fail "(timeout) set convenience variable \$foo to 81"} } send_gdb "break \$foo\n" gdb_expect { - -re "Breakpoint (\[0-9\]*) at .*, line 66.*$gdb_prompt $"\ + -re "Breakpoint (\[0-9\]*) at .*, line 81.*$gdb_prompt $"\ {pass "set breakpoint via convenience variable"} -re "$gdb_prompt $"\ {fail "set breakpoint via convenience variable"} @@ -503,11 +519,11 @@ gdb_expect { # Verify that GDB responds gracefully to an attempt to set a # breakpoint via a convenience variable whose type is not integer. # -send_gdb "set \$foo=66.5\n" +send_gdb "set \$foo=81.5\n" gdb_expect { -re "$gdb_prompt $"\ - {pass "set convenience variable \$foo to 66.5"} - timeout {fail "(timeout) set convenience variable \$foo to 66.5"} + {pass "set convenience variable \$foo to 81.5"} + timeout {fail "(timeout) set convenience variable \$foo to 81.5"} } send_gdb "break \$foo\n" gdb_expect { @@ -522,7 +538,7 @@ gdb_expect { # send_gdb "break marker2\n" gdb_expect { - -re "Breakpoint (\[0-9\]*) at .*, line 42.*$gdb_prompt $"\ + -re "Breakpoint (\[0-9\]*) at .*, line 4\[49\].*$gdb_prompt $"\ {pass "set breakpoint on to-be-called function"} -re "$gdb_prompt $"\ {fail "set breakpoint on to-be-called function"} @@ -530,7 +546,7 @@ gdb_expect { } send_gdb "print marker2(99)\n" gdb_expect { - -re "The program being debugged stopped while in a function called from GDB.\r\nWhen the function .marker2. is done executing, GDB will silently\r\nstop .instead of continuing to evaluate the expression containing\r\nthe function call...*$gdb_prompt $"\ + -re "The program being debugged stopped while in a function called from GDB.\r\nWhen the function .marker2$proto. is done executing, GDB will silently\r\nstop .instead of continuing to evaluate the expression containing\r\nthe function call...*$gdb_prompt $"\ {pass "hit breakpoint on called function"} -re "$gdb_prompt $"\ {fail "hit breakpoint on called function"} @@ -543,7 +559,9 @@ gdb_expect { if [istarget "hppa*-*-hpux*"] then { send_gdb "bt\n" gdb_expect { - -re "#0\[ \t\]*marker2.*:42\r\n#1.*_sr4export.*$gdb_prompt $"\ + -re "#0\[ \t\]*marker2.*:4\[49\]\r\n#1.*_sr4export.*$gdb_prompt $"\ + {pass "backtrace while in called function"} + -re "#0\[ \t\]*marker2.*:4\[49\]\r\n#1.*function called from gdb.*$gdb_prompt $"\ {pass "backtrace while in called function"} -re "$gdb_prompt $"\ {fail "backtrace while in called function"} @@ -551,7 +569,9 @@ if [istarget "hppa*-*-hpux*"] then { } send_gdb "finish\n" gdb_expect { - -re "Run till exit from .*marker2.* at .*42\r\n.* in _sr4export.*$gdb_prompt $"\ + -re "Run till exit from .*marker2.* at .*4\[49\]\r\n.* in _sr4export.*$gdb_prompt $"\ + {pass "finish from called function"} + -re "Run till exit from .*marker2.* at .*4\[49\]\r\n.*function called from gdb.*$gdb_prompt $"\ {pass "finish from called function"} -re "$gdb_prompt $"\ {fail "finish from called function"} diff --git a/gdb/testsuite/gdb.base/call-ar-st.c b/gdb/testsuite/gdb.base/call-ar-st.c index bb30e50..6d1b999 100644 --- a/gdb/testsuite/gdb.base/call-ar-st.c +++ b/gdb/testsuite/gdb.base/call-ar-st.c @@ -141,9 +141,13 @@ struct int_char_combo_t { * IN id_int student -- enumerated type * IN colors shirt -- enumerated type *****************************************************************/ +#ifdef PROTOTYPES +void print_student_id_shirt_color (id_int student, colors shirt) +#else void print_student_id_shirt_color ( student, shirt ) id_int student; colors shirt; +#endif { printf("student id : %d\t", student); @@ -192,9 +196,12 @@ void print_student_id_shirt_color ( student, shirt ) * PRINT_CHAR_ARRAY : * IN char array_c[] -- character array *****************************************************************/ +#ifdef PROTOTYPES +void print_char_array (char array_c[]) +#else void print_char_array ( array_c ) char array_c[]; - +#endif { int index; @@ -212,9 +219,12 @@ void print_char_array ( array_c ) * PRINT_DOUBLE_ARRAY : * IN double array_d[] -- array of doubles *****************************************************************/ +#ifdef PROTOTYPES +void print_double_array (double array_d[]) +#else void print_double_array (array_d) double array_d[]; - +#endif { int index; @@ -232,9 +242,12 @@ void print_double_array (array_d) * PRINT_FLOAT_ARRAY: * IN float array_f[] -- array of floats *****************************************************************/ +#ifdef PROTOTYPES +void print_float_array (float array_f[]) +#else void print_float_array ( array_f ) float array_f[]; - +#endif { int index; @@ -253,9 +266,12 @@ void print_float_array ( array_f ) * PRINT_INT_ARRAY: * IN int array_i[] -- array of integers *****************************************************************/ +#ifdef PROTOTYPES +void print_int_array (int array_i[]) +#else void print_int_array ( array_i ) int array_i[]; - +#endif { int index; @@ -277,12 +293,15 @@ void print_int_array ( array_i ) * IN float array_f[] -- array of floats * IN double array_d[] -- array of doubles *****************************************************************/ +#ifdef PROTOTYPES +void print_all_arrays(int array_i[], char array_c[], float array_f[], double array_d[]) +#else void print_all_arrays( array_i, array_c, array_f, array_d ) int array_i[]; char array_c[]; float array_f[]; double array_d[]; - +#endif { print_int_array(array_i); print_char_array(array_c); @@ -306,8 +325,12 @@ void loop_count () { * A do nothing function. Used to provide a point at which calls can be made. * IN int seed *****************************************************************/ +#ifdef PROTOTYPES +void compute_with_small_structs (int seed) +#else void compute_with_small_structs ( seed ) int seed; +#endif { struct small_rep_info_t array[4]; @@ -337,6 +360,9 @@ void compute_with_small_structs ( seed ) * IN unsigned e -- 0 or 1 * IN unsigned o -- 0 or 1 *****************************************************************/ +#ifdef PROTOTYPES +void init_bit_flags (struct bit_flags_t *bit_flags, unsigned a, unsigned b, unsigned g, unsigned d, unsigned e, unsigned o) +#else void init_bit_flags ( bit_flags, a, b, g, d, e, o ) struct bit_flags_t *bit_flags; unsigned a; @@ -345,6 +371,7 @@ unsigned g; unsigned d; unsigned e; unsigned o; +#endif { bit_flags->alpha = a; @@ -370,6 +397,9 @@ unsigned o; * IN unsigned e -- 0 or 1 * IN unsigned o -- 0 or 1 *****************************************************************/ +#ifdef PROTOTYPES +void init_bit_flags_combo (struct bit_flags_combo_t *bit_flags_combo, unsigned a, unsigned b, char ch1, unsigned g, unsigned d, char ch2, unsigned e, unsigned o) +#else void init_bit_flags_combo ( bit_flags_combo, a, b, ch1, g, d, ch2, e, o ) struct bit_flags_combo_t *bit_flags_combo; unsigned a; @@ -380,6 +410,7 @@ void init_bit_flags_combo ( bit_flags_combo, a, b, ch1, g, d, ch2, e, o ) char ch2; unsigned e; unsigned o; +#endif { bit_flags_combo->alpha = a; @@ -398,9 +429,13 @@ void init_bit_flags_combo ( bit_flags_combo, a, b, ch1, g, d, ch2, e, o ) * OUT struct one_double_t *one_double -- structure to fill * IN double init_val *****************************************************************/ +#ifdef PROTOTYPES +void init_one_double (struct one_double_t *one_double, double init_val) +#else void init_one_double ( one_double, init_val ) struct one_double_t *one_double; double init_val; +#endif { one_double->double1 = init_val; @@ -412,10 +447,14 @@ void init_one_double ( one_double, init_val ) * IN float init_val1 * IN float init_val2 *****************************************************************/ +#ifdef PROTOTYPES +void init_two_floats (struct two_floats_t *two_floats, float init_val1, float init_val2) +#else void init_two_floats ( two_floats, init_val1, init_val2 ) struct two_floats_t *two_floats; float init_val1; float init_val2; +#endif { two_floats->float1 = init_val1; two_floats->float2 = init_val2; @@ -427,10 +466,14 @@ void init_two_floats ( two_floats, init_val1, init_val2 ) * IN char init_val1 * IN char init_val2 *****************************************************************/ +#ifdef PROTOTYPES +void init_two_chars (struct two_char_t *two_char, char init_val1, char init_val2) +#else void init_two_chars ( two_char, init_val1, init_val2 ) struct two_char_t *two_char; char init_val1; char init_val2; +#endif { two_char->ch1 = init_val1; @@ -444,11 +487,15 @@ void init_two_chars ( two_char, init_val1, init_val2 ) * IN char init_val2 * IN char init_val3 *****************************************************************/ +#ifdef PROTOTYPES +void init_three_chars (struct three_char_t *three_char, char init_val1, char init_val2, char init_val3) +#else void init_three_chars ( three_char, init_val1, init_val2, init_val3 ) struct three_char_t *three_char; char init_val1; char init_val2; char init_val3; +#endif { three_char->ch1 = init_val1; @@ -465,6 +512,9 @@ void init_three_chars ( three_char, init_val1, init_val2, init_val3 ) * IN char init_val4 * IN char init_val5 *****************************************************************/ +#ifdef PROTOTYPES +void init_five_chars (struct five_char_t *five_char, char init_val1, char init_val2, char init_val3, char init_val4, char init_val5) +#else void init_five_chars ( five_char, init_val1, init_val2, init_val3,init_val4,init_val5 ) struct five_char_t *five_char; char init_val1; @@ -472,6 +522,7 @@ void init_five_chars ( five_char, init_val1, init_val2, init_val3,init_val4,init char init_val3; char init_val4; char init_val5; +#endif { five_char->ch1 = init_val1; five_char->ch2 = init_val2; @@ -486,10 +537,14 @@ void init_five_chars ( five_char, init_val1, init_val2, init_val3,init_val4,init * IN int init_val1 * IN char init_val2 *****************************************************************/ +#ifdef PROTOTYPES +void init_int_char_combo (struct int_char_combo_t *combo, int init_val1, char init_val2) +#else void init_int_char_combo ( combo, init_val1, init_val2 ) struct int_char_combo_t *combo; int init_val1; char init_val2; +#endif { combo->int1 = init_val1; @@ -501,10 +556,13 @@ void init_int_char_combo ( combo, init_val1, init_val2 ) * OUT struct small_rep_into_t *small_struct -- structure to be filled * IN int seed *****************************************************************/ +#ifdef PROTOTYPES +void init_struct_rep(struct small_rep_info_t *small_struct, int seed) +#else void init_struct_rep( small_struct, seed ) struct small_rep_info_t *small_struct; int seed; - +#endif { small_struct->value = 2 + (seed*2); @@ -516,6 +574,24 @@ void init_struct_rep( small_struct, seed ) * Takes all the small structures as input and calls the appropriate * initialization routine for each structure *****************************************************************/ +#ifdef PROTOTYPES +void init_small_structs ( + struct small_rep_info_t *struct1, + struct small_rep_info_t *struct2, + struct small_rep_info_t *struct3, + struct small_rep_info_t *struct4, + struct bit_flags_t *flags, + struct bit_flags_combo_t *flags_combo, + struct three_char_t *three_char, + struct five_char_t *five_char, + struct int_char_combo_t *int_char_combo, + struct one_double_t *d1, + struct one_double_t *d2, + struct one_double_t *d3, + struct two_floats_t *f1, + struct two_floats_t *f2, + struct two_floats_t *f3) +#else void init_small_structs (struct1, struct2, struct3,struct4,flags,flags_combo, three_char, five_char,int_char_combo, d1, d2,d3,f1,f2,f3) struct small_rep_info_t *struct1; @@ -533,7 +609,7 @@ three_char, five_char,int_char_combo, d1, d2,d3,f1,f2,f3) struct two_floats_t *f1; struct two_floats_t *f2; struct two_floats_t *f3; - +#endif { init_bit_flags(flags, (unsigned)1, (unsigned)0, (unsigned)1, @@ -560,6 +636,19 @@ three_char, five_char,int_char_combo, d1, d2,d3,f1,f2,f3) * PRINT_TEN_DOUBLES : * ????????????????????????????? ****************************************************************/ +#ifdef PROTOTYPES +void print_ten_doubles ( + double d1, + double d2, + double d3, + double d4, + double d5, + double d6, + double d7, + double d8, + double d9, + double d10) +#else void print_ten_doubles ( d1, d2, d3, d4, d5, d6, d7, d8, d9, d10 ) double d1; double d2; @@ -571,6 +660,7 @@ void print_ten_doubles ( d1, d2, d3, d4, d5, d6, d7, d8, d9, d10 ) double d8; double d9; double d10; +#endif { printf("Two Doubles : %f\t%f\n", d1, d2); @@ -584,8 +674,12 @@ void print_ten_doubles ( d1, d2, d3, d4, d5, d6, d7, d8, d9, d10 ) * PRINT_BIT_FLAGS : * IN struct bit_flags_t bit_flags ****************************************************************/ +#ifdef PROTOTYPES +void print_bit_flags (struct bit_flags_t bit_flags) +#else void print_bit_flags ( bit_flags ) struct bit_flags_t bit_flags; +#endif { if (bit_flags.alpha) printf("alpha\n"); @@ -600,8 +694,12 @@ struct bit_flags_t bit_flags; * PRINT_BIT_FLAGS_COMBO : * IN struct bit_flags_combo_t bit_flags_combo ****************************************************************/ +#ifdef PROTOTYPES +void print_bit_flags_combo (struct bit_flags_combo_t bit_flags_combo) +#else void print_bit_flags_combo ( bit_flags_combo ) -struct bit_flags_combo_t bit_flags_combo; + struct bit_flags_combo_t bit_flags_combo; +#endif { if (bit_flags_combo.alpha) printf("alpha\n"); @@ -617,8 +715,12 @@ struct bit_flags_combo_t bit_flags_combo; * PRINT_ONE_DOUBLE : * IN struct one_double_t one_double ****************************************************************/ +#ifdef PROTOTYPES +void print_one_double (struct one_double_t one_double) +#else void print_one_double ( one_double ) struct one_double_t one_double; +#endif { printf("Contents of one_double_t: \n\n"); @@ -629,8 +731,12 @@ struct one_double_t one_double; * PRINT_TWO_FLOATS : * IN struct two_floats_t two_floats ****************************************************************/ +#ifdef PROTOTYPES +void print_two_floats (struct two_floats_t two_floats) +#else void print_two_floats ( two_floats ) struct two_floats_t two_floats; +#endif { printf("Contents of two_floats_t: \n\n"); @@ -641,8 +747,12 @@ struct two_floats_t two_floats; * PRINT_TWO_CHARS : * IN struct two_char_t two_char ****************************************************************/ +#ifdef PROTOTYPES +void print_two_chars (struct two_char_t two_char) +#else void print_two_chars ( two_char ) struct two_char_t two_char; +#endif { printf("Contents of two_char_t: \n\n"); @@ -653,8 +763,12 @@ struct two_char_t two_char; * PRINT_THREE_CHARS : * IN struct three_char_t three_char ****************************************************************/ +#ifdef PROTOTYPES +void print_three_chars (struct three_char_t three_char) +#else void print_three_chars ( three_char ) struct three_char_t three_char; +#endif { printf("Contents of three_char_t: \n\n"); @@ -665,8 +779,12 @@ struct three_char_t three_char; * PRINT_FIVE_CHARS : * IN struct five_char_t five_char ****************************************************************/ +#ifdef PROTOTYPES +void print_five_chars (struct five_char_t five_char) +#else void print_five_chars ( five_char ) struct five_char_t five_char; +#endif { printf("Contents of five_char_t: \n\n"); @@ -679,8 +797,12 @@ struct five_char_t five_char; * PRINT_INT_CHAR_COMBO : * IN struct int_char_combo_t int_char_combo ****************************************************************/ +#ifdef PROTOTYPES +void print_int_char_combo (struct int_char_combo_t int_char_combo) +#else void print_int_char_combo ( int_char_combo ) struct int_char_combo_t int_char_combo; +#endif { printf("Contents of int_char_combo_t: \n\n"); @@ -695,11 +817,17 @@ struct int_char_combo_t int_char_combo; * IN struct small_rep_info_t struct2 * IN struct small_rep_info_t struct3 ****************************************************************/ +#ifdef PROTOTYPES +void print_struct_rep( + struct small_rep_info_t struct1, + struct small_rep_info_t struct2, + struct small_rep_info_t struct3) +#else void print_struct_rep( struct1, struct2, struct3) struct small_rep_info_t struct1; struct small_rep_info_t struct2; struct small_rep_info_t struct3; - +#endif { @@ -721,13 +849,21 @@ void print_struct_rep( struct1, struct2, struct3) * IN struct small_rep_info_t struct3 * IN struct small_rep_info_t struct4 ****************************************************************/ +#ifdef PROTOTYPES +void sum_struct_print ( + int seed, + struct small_rep_info_t struct1, + struct small_rep_info_t struct2, + struct small_rep_info_t struct3, + struct small_rep_info_t struct4) +#else void sum_struct_print ( seed, struct1, struct2, struct3, struct4) int seed; struct small_rep_info_t struct1; struct small_rep_info_t struct2; struct small_rep_info_t struct3; struct small_rep_info_t struct4; - +#endif { int sum; @@ -742,6 +878,24 @@ void sum_struct_print ( seed, struct1, struct2, struct3, struct4) * All of the small structures of odd sizes (40 bits, 8bits, etc.) * are pushed onto the stack. ****************************************************************/ +#ifdef PROTOTYPES +void print_small_structs ( + struct small_rep_info_t struct1, + struct small_rep_info_t struct2, + struct small_rep_info_t struct3, + struct small_rep_info_t struct4, + struct bit_flags_t flags, + struct bit_flags_combo_t flags_combo, + struct three_char_t three_char, + struct five_char_t five_char, + struct int_char_combo_t int_char_combo, + struct one_double_t d1, + struct one_double_t d2, + struct one_double_t d3, + struct two_floats_t f1, + struct two_floats_t f2, + struct two_floats_t f3) +#else void print_small_structs ( struct1, struct2, struct3, struct4, flags, flags_combo, three_char, five_char, int_char_combo, d1, d2,d3,f1,f2,f3) struct small_rep_info_t struct1; @@ -759,6 +913,7 @@ flags_combo, three_char, five_char, int_char_combo, d1, d2,d3,f1,f2,f3) struct two_floats_t f1; struct two_floats_t f2; struct two_floats_t f3; +#endif { print_bit_flags(flags); print_bit_flags_combo(flags_combo); @@ -784,6 +939,30 @@ flags_combo, three_char, five_char, int_char_combo, d1, d2,d3,f1,f2,f3) * may force more space to be pushed onto the stack as part of the callers * frame. ****************************************************************/ +#ifdef PROTOTYPES +void print_long_arg_list ( + double a, + double b, + int c, + int d, + int e, + int f, + struct small_rep_info_t struct1, + struct small_rep_info_t struct2, + struct small_rep_info_t struct3, + struct small_rep_info_t struct4, + struct bit_flags_t flags, + struct bit_flags_combo_t flags_combo, + struct three_char_t three_char, + struct five_char_t five_char, + struct int_char_combo_t int_char_combo, + struct one_double_t d1, + struct one_double_t d2, + struct one_double_t d3, + struct two_floats_t f1, + struct two_floats_t f2, + struct two_floats_t f3) +#else void print_long_arg_list ( a, b, c, d, e, f, struct1, struct2, struct3, struct4, flags, flags_combo, three_char, five_char, int_char_combo, d1,d2,d3, f1, f2, f3 ) @@ -808,7 +987,7 @@ f1, f2, f3 ) struct two_floats_t f1; struct two_floats_t f2; struct two_floats_t f3; - +#endif { printf("double : %f\n", a); printf("double : %f\n", b); @@ -822,9 +1001,12 @@ f1, f2, f3 ) } +#ifdef PROTOTYPES +void print_one_large_struct (struct array_rep_info_t linked_list1) +#else void print_one_large_struct( linked_list1 ) struct array_rep_info_t linked_list1; - +#endif { /* printf("Contents of linked list1: \n\n"); @@ -845,11 +1027,17 @@ void print_one_large_struct( linked_list1 ) * IN struct array_rep_info_t linked_list2 * IN struct array_rep_info_t linked_list3 ****************************************************************/ +#ifdef PROTOTYPES +void print_array_rep( + struct array_rep_info_t linked_list1, + struct array_rep_info_t linked_list2, + struct array_rep_info_t linked_list3) +#else void print_array_rep( linked_list1, linked_list2, linked_list3 ) struct array_rep_info_t linked_list1; struct array_rep_info_t linked_list2; struct array_rep_info_t linked_list3; - +#endif { int index; @@ -895,13 +1083,21 @@ void print_array_rep( linked_list1, linked_list2, linked_list3 ) * IN struct array_rep_info_t linked_list3 * IN struct array_rep_info_t linked_list4 ****************************************************************/ +#ifdef PROTOTYPES +void sum_array_print ( + int seed, + struct array_rep_info_t linked_list1, + struct array_rep_info_t linked_list2, + struct array_rep_info_t linked_list3, + struct array_rep_info_t linked_list4) +#else void sum_array_print ( seed, linked_list1, linked_list2, linked_list3,linked_list4) int seed; struct array_rep_info_t linked_list1; struct array_rep_info_t linked_list2; struct array_rep_info_t linked_list3; struct array_rep_info_t linked_list4; - +#endif { int index; int sum; @@ -925,10 +1121,15 @@ void sum_array_print ( seed, linked_list1, linked_list2, linked_list3,linked_lis * IN struct array_rep_info_t *linked_list * IN int seed ****************************************************************/ +#ifdef PROTOTYPES +void init_array_rep( + struct array_rep_info_t *linked_list, + int seed) +#else void init_array_rep( linked_list, seed ) struct array_rep_info_t *linked_list; int seed; - +#endif { int index; @@ -994,7 +1195,8 @@ int main () { for (index = 0; index < 120; index++) { if ((index%2) == 0) char_array[index] = 'Z'; else char_array[index] = 'a'; - } char_array[120] = '\0'; /* call-ar-st.exp uses line numbers everywhere */ + } + char_array[120] = '\0'; for (index = 0; index < 100; index++) { double_array[index] = index*23.4567; diff --git a/gdb/testsuite/gdb.base/call-ar-st.exp b/gdb/testsuite/gdb.base/call-ar-st.exp index d737219..5662eb7 100644 --- a/gdb/testsuite/gdb.base/call-ar-st.exp +++ b/gdb/testsuite/gdb.base/call-ar-st.exp @@ -101,25 +101,36 @@ if ![runto_main] then { continue } -#go -until 1007 -gdb_test "tbreak 1007" \ - "Breakpoint \[0-9\]+.*file.*$srcfile, line 1007.*" \ - "tbreakpoint line 1007" +#go -until 1209 +gdb_test "tbreak 1209" \ + "Breakpoint \[0-9\]+.*file.*$srcfile, line 1209.*" \ + "tbreakpoint line 1209" gdb_test continue \ -"Continuing\\..*main \\(\\) at.*$srcfile:1007.*" \ +"Continuing\\..*main \\(\\) at.*$srcfile:1209.*" \ "run until breakpoint set at a line" #call print_double_array(double_array) if {![target_info exists gdb,skip_float_tests]} { send_gdb "print print_double_array(double_array)\n" - gdb_expect { - -re "array_d :\[ \t\r\n\]+=========\[ \t\r\n\]+\[ \t\r\n\]+0.000000\[ \t\r\n\]+23.456700 46.913400 70.370100 93.826800 117.283500 140.740200 164.196900 187.653600\[ \t\r\n\]+211.110300 234.567000 258.023700 281.480400 304.937100 328.393800 351.850500 375.307200\[ \t\r\n\]+398.763900 422.220600 445.677300 469.134000 492.590700 516.047400 539.504100 562.960800\[ \t\r\n\]+586.417500 609.874200 633.330900 656.787600 680.244300 703.701000 727.157700 750.614400\[ \t\r\n\]+774.071100 797.527800 820.984500 844.441200 867.897900 891.354600 914.811300 938.268000\[ \t\r\n\]+961.724700 985.181400 1008.638100 1032.094800 1055.551500 1079.008200 1102.464900 1125.921600\[ \t\r\n\]+1149.378300 1172.835000 1196.291700 1219.748400 1243.205100 1266.661800 1290.118500 1313.575200\[ \t\r\n\]+1337.031900 1360.488600 1383.945300 1407.402000 1430.858700 1454.315400 1477.772100 1501.228800\[ \t\r\n\]+1524.685500 1548.142200 1571.598900 1595.055600 1618.512300 1641.969000 1665.425700 1688.882400\[ \t\r\n\]+1712.339100 1735.795800 1759.252500 1782.709200 1806.165900 1829.622600 1853.079300 1876.536000\[ \t\r\n\]+1899.992700 1923.449400 1946.906100 1970.362800 1993.819500 2017.276200 2040.732900 2064.189600\[ \t\r\n\]+2087.646300 2111.103000 2134.559700 2158.016400 2181.473100 2204.929800 2228.386500 2251.843200\[ \t\r\n\]+2275.299900 2298.756600 2322.213300\[ \t\r\n\]+\[ \t\r\n\]+.*$gdb_prompt $" { - pass "print print_double_array(double_array)" - } - -re ".*$gdb_prompt $" { fail "print print_double_array(double_array)" } - timeout { fail "(timeout) print print_double_array(double_array)" } + gdb_expect_list "print print_double_array(double_array)" ".*$gdb_prompt $" { + "\[ \t\r\n\]+array_d :" + "\[ \t\r\n\]+=========" + "\[ \t\r\n\]+0.000000" + "\[ \t\r\n\]+23.456700 46.913400 70.370100 93.826800 117.283500 140.740200 164.196900 187.653600" + "\[ \t\r\n\]+211.110300 234.567000 258.023700 281.480400 304.937100 328.393800 351.850500 375.307200" + "\[ \t\r\n\]+398.763900 422.220600 445.677300 469.134000 492.590700 516.047400 539.504100 562.960800" + "\[ \t\r\n\]+586.417500 609.874200 633.330900 656.787600 680.244300 703.701000 727.157700 750.614400" + "\[ \t\r\n\]+774.071100 797.527800 820.984500 844.441200 867.897900 891.354600 914.811300 938.268000" + "\[ \t\r\n\]+961.724700 985.181400 1008.638100 1032.094800 1055.551500 1079.008200 1102.464900 1125.921600" + "\[ \t\r\n\]+1149.378300 1172.835000 1196.291700 1219.748400 1243.205100 1266.661800 1290.118500 1313.575200" + "\[ \t\r\n\]+1337.031900 1360.488600 1383.945300 1407.402000 1430.858700 1454.315400 1477.772100 1501.228800" + "\[ \t\r\n\]+1524.685500 1548.142200 1571.598900 1595.055600 1618.512300 1641.969000 1665.425700 1688.882400" + "\[ \t\r\n\]+1712.339100 1735.795800 1759.252500 1782.709200 1806.165900 1829.622600 1853.079300 1876.536000" + "\[ \t\r\n\]+1899.992700 1923.449400 1946.906100 1970.362800 1993.819500 2017.276200 2040.732900 2064.189600" + "\[ \t\r\n\]+2087.646300 2111.103000 2134.559700 2158.016400 2181.473100 2204.929800 2228.386500 2251.843200" + "\[ \t\r\n\]+2275.299900 2298.756600 2322.213300\[ \t\r\n\]+\[ \t\r\n\]+" } } @@ -136,18 +147,18 @@ gdb_expect { -#go -until 1014 -gdb_test "tbreak 1014" \ -"Breakpoint.*file.*$srcfile, line 1014.*" \ -"tbreakpoint line 1014" +#go -until 1216 +gdb_test "tbreak 1216" \ +"Breakpoint.*file.*$srcfile, line 1216.*" \ +"tbreakpoint line 1216" send_gdb "continue\n" gdb_expect { - -re "array_c :\[ \t\r\n\]+=========\[ \t\r\n\]+\[ \t\r\n\]+Z\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZ\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZ\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZa\[ \t\r\n\]+\[ \t\r\n\]+\[ \t\r\n\]+main.*at.*$srcfile:1014\[ \t\r\n\]+.*print_double_array\\(double_array\\).*$gdb_prompt $" { - pass "continue to 1014" + -re "array_c :\[ \t\r\n\]+=========\[ \t\r\n\]+\[ \t\r\n\]+Z\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZ\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZ\[ \t\r\n\]+aZaZaZaZaZaZaZaZaZa\[ \t\r\n\]+\[ \t\r\n\]+\[ \t\r\n\]+main.*at.*$srcfile:1216\[ \t\r\n\]+.*print_double_array\\(double_array\\).*$gdb_prompt $" { + pass "continue to 1216" } - -re ".*$gdb_prompt $" { fail "continue to 1014" } - timeout { fail "(timeout) continue to 1014" } + -re ".*$gdb_prompt $" { fail "continue to 1216" } + timeout { fail "(timeout) continue to 1216" } } # I am disabling this test, because it takes too long. I verified by @@ -163,19 +174,40 @@ gdb_expect { # } #set timeout $oldtimeout -#go -until 1018 -gdb_test "tbreak 1018" \ - "Breakpoint.* file .*$srcfile, line 1018.*" \ - "tbreakpoint line 1018" +#go -until 1220 +gdb_test "tbreak 1220" \ + "Breakpoint.* file .*$srcfile, line 1220.*" \ + "tbreakpoint line 1220" -gdb_test continue \ -"Continuing\\..*array_d :.*array_f :.*student id :\[\t \]+.*YELLOW.*array_i :.*main \\(\\) at .*call-ar-st.c:1018\[ \t\r\n\]+.*print_all_arrays\\(integer_array, char_array, float_array, double_array\\)." \ -"continuing to breakpoint 1018" +send_gdb "continue\n" +gdb_expect_list "continuing to breakpoint 1220" ".*$gdb_prompt $" { + "Continuing\\." + "\[ \t\r\n\]+array_d :" + "\[ \t\r\n\]+=========" + "\[ \t\r\n\]+0.000000" + "\[ \t\r\n\]+23.456700 46.913400 70.370100 93.826800 117.283500 140.740200 164.196900 187.653600" + "\[ \t\r\n\]+211.110300 234.567000 258.023700 281.480400 304.937100 328.393800 351.850500 375.307200" + "\[ \t\r\n\]+398.763900 422.220600 445.677300 469.134000 492.590700 516.047400 539.504100 562.960800" + "\[ \t\r\n\]+586.417500 609.874200 633.330900 656.787600 680.244300 703.701000 727.157700 750.614400" + "\[ \t\r\n\]+774.071100 797.527800 820.984500 844.441200 867.897900 891.354600 914.811300 938.268000" + "\[ \t\r\n\]+961.724700 985.181400 1008.638100 1032.094800 1055.551500 1079.008200 1102.464900 1125.921600" + "\[ \t\r\n\]+1149.378300 1172.835000 1196.291700 1219.748400 1243.205100 1266.661800 1290.118500 1313.575200" + "\[ \t\r\n\]+1337.031900 1360.488600 1383.945300 1407.402000 1430.858700 1454.315400 1477.772100 1501.228800" + "\[ \t\r\n\]+1524.685500 1548.142200 1571.598900 1595.055600 1618.512300 1641.969000 1665.425700 1688.882400" + "\[ \t\r\n\]+1712.339100 1735.795800 1759.252500 1782.709200 1806.165900 1829.622600 1853.079300 1876.536000" + "\[ \t\r\n\]+1899.992700 1923.449400 1946.906100 1970.362800 1993.819500 2017.276200 2040.732900 2064.189600" + "\[ \t\r\n\]+2087.646300 2111.103000 2134.559700 2158.016400 2181.473100 2204.929800 2228.386500 2251.843200" + "\[ \t\r\n\]+2275.299900 2298.756600 2322.213300\[ \t\r\n\]+\[ \t\r\n\]+" + ".*array_f :" + ".*student id :\[\t \]+.*YELLOW" + ".*array_i :" + ".*main \\(\\) at .*call-ar-st.c:1220\[ \t\r\n\]+.*print_all_arrays\\(integer_array, char_array, float_array, double_array\\)." +} #step send_gdb "step\n" gdb_expect { - -re "print_all_arrays \\(array_i=, array_c=.ZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZa., array_f=, array_d=\\) at .*call-ar-st.c:287\[ \t\r\n\]+287.*print_int_array\\(array_i\\);.*$gdb_prompt $" {pass "step inside print_all_arrays"} + -re "print_all_arrays \\(array_i=, array_c=.ZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZaZa., array_f=, array_d=\\) at .*call-ar-st.c:306\[ \t\r\n\]+306.*print_int_array\\(array_i\\);.*$gdb_prompt $" {pass "step inside print_all_arrays"} -re ".*$gdb_prompt $" { fail "step inside print_all_arrays" } timeout { fail "step inside print_all_arrays (timeout)" } } @@ -184,7 +216,7 @@ gdb_test continue \ #step -over send_gdb "next\n" gdb_expect { - -re "array_i :.*288.*print_char_array\\(array_c\\);.*$gdb_prompt $" {pass "next over print_int_array in print-all_arrays"} + -re "array_i :.*307.*print_char_array\\(array_c\\);.*$gdb_prompt $" {pass "next over print_int_array in print-all_arrays"} -re ".*$gdb_prompt $" { fail "next over print_int_array in print-all_arrays" } timeout { fail "next over print_int_array in print-all_arrays (timeout)" } } @@ -194,21 +226,52 @@ gdb_test continue \ #call print_double_array(array_d) if {![target_info exists gdb,skip_float_tests]} { send_gdb "print print_double_array(array_d)\n" - gdb_expect { - -re "array_d :\[ \t\r\n\]+=========\[ \t\r\n\]+\[ \t\r\n\]+0.000000\[ \t\r\n\]+23.456700 46.913400 70.370100 93.826800 117.283500 140.740200 164.196900 187.653600\[ \t\r\n\]+211.110300 234.567000 258.023700 281.480400 304.937100 328.393800 351.850500 375.307200\[ \t\r\n\]+398.763900 422.220600 445.677300 469.134000 492.590700 516.047400 539.504100 562.960800\[ \t\r\n\]+586.417500 609.874200 633.330900 656.787600 680.244300 703.701000 727.157700 750.614400\[ \t\r\n\]+774.071100 797.527800 820.984500 844.441200 867.897900 891.354600 914.811300 938.268000\[ \t\r\n\]+961.724700 985.181400 1008.638100 1032.094800 1055.551500 1079.008200 1102.464900 1125.921600\[ \t\r\n\]+1149.378300 1172.835000 1196.291700 1219.748400 1243.205100 1266.661800 1290.118500 1313.575200\[ \t\r\n\]+1337.031900 1360.488600 1383.945300 1407.402000 1430.858700 1454.315400 1477.772100 1501.228800\[ \t\r\n\]+1524.685500 1548.142200 1571.598900 1595.055600 1618.512300 1641.969000 1665.425700 1688.882400\[ \t\r\n\]+1712.339100 1735.795800 1759.252500 1782.709200 1806.165900 1829.622600 1853.079300 1876.536000\[ \t\r\n\]+1899.992700 1923.449400 1946.906100 1970.362800 1993.819500 2017.276200 2040.732900 2064.189600\[ \t\r\n\]+2087.646300 2111.103000 2134.559700 2158.016400 2181.473100 2204.929800 2228.386500 2251.843200\[ \t\r\n\]+2275.299900 2298.756600 2322.213300\[ \t\r\n\]+\[ \t\r\n\]+.*$gdb_prompt $" { - pass "print print_double_array(array_d)" - } - -re ".*$gdb_prompt $" { fail "print print_double_array(array_d)" } - timeout { fail "(timeout) print print_double_array(array_d)" } + gdb_expect_list "print print_double_array(array_d)" ".*$gdb_prompt $" { + "array_d :" + "\[ \t\r\n\]+=========" + "\[ \t\r\n\]+\[ \t\r\n\]+0.000000" + "\[ \t\r\n\]+23.456700 46.913400 70.370100 93.826800 117.283500 140.740200 164.196900 187.653600" + "\[ \t\r\n\]+211.110300 234.567000 258.023700 281.480400 304.937100 328.393800 351.850500 375.307200" + "\[ \t\r\n\]+398.763900 422.220600 445.677300 469.134000 492.590700 516.047400 539.504100 562.960800" + "\[ \t\r\n\]+586.417500 609.874200 633.330900 656.787600 680.244300 703.701000 727.157700 750.614400" + "\[ \t\r\n\]+774.071100 797.527800 820.984500 844.441200 867.897900 891.354600 914.811300 938.268000" + "\[ \t\r\n\]+961.724700 985.181400 1008.638100 1032.094800 1055.551500 1079.008200 1102.464900 1125.921600" + "\[ \t\r\n\]+1149.378300 1172.835000 1196.291700 1219.748400 1243.205100 1266.661800 1290.118500 1313.575200" + "\[ \t\r\n\]+1337.031900 1360.488600 1383.945300 1407.402000 1430.858700 1454.315400 1477.772100 1501.228800" + "\[ \t\r\n\]+1524.685500 1548.142200 1571.598900 1595.055600 1618.512300 1641.969000 1665.425700 1688.882400" + "\[ \t\r\n\]+1712.339100 1735.795800 1759.252500 1782.709200 1806.165900 1829.622600 1853.079300 1876.536000" + "\[ \t\r\n\]+1899.992700 1923.449400 1946.906100 1970.362800 1993.819500 2017.276200 2040.732900 2064.189600" + "\[ \t\r\n\]+2087.646300 2111.103000 2134.559700 2158.016400 2181.473100 2204.929800 2228.386500 2251.843200" + "\[ \t\r\n\]+2275.299900 2298.756600 2322.213300\[ \t\r\n\]+\[ \t\r\n\]+" } } -#go -until 1034 -gdb_test "tbreak 1034" \ -"Breakpoint.* file .*$srcfile, line 1034.*" \ -"tbreakpoint line 1034" +#go -until 1236 +gdb_test "tbreak 1236" \ +"Breakpoint.* file .*$srcfile, line 1236.*" \ +"tbreakpoint line 1236" -gdb_test continue "Continuing\\..*array_c.*array_f.*array_d.*HELLO WORLD.*main \\(\\) at .*call-ar-st.c:1034.*printf\\(.BYE BYE FOR NOW.n.\\)." "continuing to 1034" +send_gdb "continue\n" +gdb_expect_list "continuing to 1236" ".*$gdb_prompt $" { + "Continuing\\..*array_c" + ".*array_f" + "\[ \t\r\n\]+array_d :" + "\[ \t\r\n\]+=========" + "\[ \t\r\n\]+0.000000" + "\[ \t\r\n\]+23.456700 46.913400 70.370100 93.826800 117.283500 140.740200 164.196900 187.653600" + "\[ \t\r\n\]+211.110300 234.567000 258.023700 281.480400 304.937100 328.393800 351.850500 375.307200" + "\[ \t\r\n\]+398.763900 422.220600 445.677300 469.134000 492.590700 516.047400 539.504100 562.960800" + "\[ \t\r\n\]+586.417500 609.874200 633.330900 656.787600 680.244300 703.701000 727.157700 750.614400" + "\[ \t\r\n\]+774.071100 797.527800 820.984500 844.441200 867.897900 891.354600 914.811300 938.268000" + "\[ \t\r\n\]+961.724700 985.181400 1008.638100 1032.094800 1055.551500 1079.008200 1102.464900 1125.921600" + "\[ \t\r\n\]+1149.378300 1172.835000 1196.291700 1219.748400 1243.205100 1266.661800 1290.118500 1313.575200" + "\[ \t\r\n\]+1337.031900 1360.488600 1383.945300 1407.402000 1430.858700 1454.315400 1477.772100 1501.228800" + "\[ \t\r\n\]+1524.685500 1548.142200 1571.598900 1595.055600 1618.512300 1641.969000 1665.425700 1688.882400" + "\[ \t\r\n\]+1712.339100 1735.795800 1759.252500 1782.709200 1806.165900 1829.622600 1853.079300 1876.536000" + "\[ \t\r\n\]+1899.992700 1923.449400 1946.906100 1970.362800 1993.819500 2017.276200 2040.732900 2064.189600" + "\[ \t\r\n\]+2087.646300 2111.103000 2134.559700 2158.016400 2181.473100 2204.929800 2228.386500 2251.843200" + "\[ \t\r\n\]+2275.299900 2298.756600 2322.213300.*HELLO WORLD.*main \\(\\) at .*call-ar-st.c:1236.*printf\\(.BYE BYE FOR NOW.n.\\)." +} #call sum_array_print(10, *list1, *list2, *list3, *list4) @@ -225,9 +288,9 @@ gdb_expect { #step over send_gdb "n\n" gdb_expect { - -re ".*BYE BYE FOR NOW.*1035.*printf\\(.VERY GREEN GRASS.n.\\);.*$gdb_prompt $" { pass "next to 1035"} - -re ".*$gdb_prompt $" { fail "next to 1035" } - timeout { fail "next to 1035(timeout)" } + -re ".*BYE BYE FOR NOW.*1237.*printf\\(.VERY GREEN GRASS.n.\\);.*$gdb_prompt $" { pass "next to 1237"} + -re ".*$gdb_prompt $" { fail "next to 1237" } + timeout { fail "next to 1237(timeout)" } } #call print_array_rep(\*list1, \*list2, \*list3) @@ -241,17 +304,17 @@ gdb_expect { timeout { fail "(timeout) print print_array_rep(*list1, *list2, *list3)" } } -#go -until 1039 -gdb_test "tbreak 1039" \ - "Breakpoint..* file .*$srcfile, line 1039.*" \ - "tbreakpoint line 1039" +#go -until 1241 +gdb_test "tbreak 1241" \ + "Breakpoint..* file .*$srcfile, line 1241.*" \ + "tbreakpoint line 1241" send_gdb "continue\n" gdb_expect { - -re ".*main \\(\\) at .*call-ar-st.c:1039\r\n1039\t\[ \]+sum_array_print\\(10, \\*list1, \\*list2, \\*list3, \\*list4\\);.*$gdb_prompt $" { - pass "continue to 1039"} - -re ".*$gdb_prompt $" { fail "continue to 1039"} - timeout { fail "(timeout) continue to 1039"} + -re ".*main \\(\\) at .*call-ar-st.c:1241\r\n1241\t\[ \]+sum_array_print\\(10, \\*list1, \\*list2, \\*list3, \\*list4\\);.*$gdb_prompt $" { + pass "continue to 1241"} + -re ".*$gdb_prompt $" { fail "continue to 1241"} + timeout { fail "(timeout) continue to 1241"} } @@ -268,7 +331,7 @@ gdb_test "break sum_array_print" \ ".*Breakpoint ${decimal}: file .*call-ar-st.c, line.*" \ "set breakpoint in sum_array_print" gdb_test "continue" \ - ".*Breakpoint ${decimal}, sum_array_print \\(seed=10, linked_list1=.next_index = .1, 2, 3, 4, 5, 6, 7, 8, 9, 10., values = .4, 6, 8, 10, 12, 14, 16, 18, 20, 22., head = 0., linked_list2=.next_index = .1, 2, 3, 4, 5, 6, 7, 8, 9, 10., values = .8, 10, 12, 14, 16, 18, 20, 22, 24, 26., head = 0., linked_list3=.next_index = .1, 2, 3, 4, 5, 6, 7, 8, 9, 10., values = .10, 12, 14, 16, 18, 20, 22, 24, 26, 28., head = 0., linked_list4=.next_index = .1, 2, 3, 4, 5, 6, 7, 8, 9, 10., values = .20, 22, 24, 26, 28, 30, 32, 34, 36, 38., head = 0.\\) at .*call-ar-st.c:909\[ \t\n\r\]+909.*printf\\(.Sum of 4 arrays, by element \\(add in seed as well\\).*\\);.*" \ + ".*Breakpoint ${decimal}, sum_array_print \\(seed=10, linked_list1=.next_index = .1, 2, 3, 4, 5, 6, 7, 8, 9, 10., values = .4, 6, 8, 10, 12, 14, 16, 18, 20, 22., head = 0., linked_list2=.next_index = .1, 2, 3, 4, 5, 6, 7, 8, 9, 10., values = .8, 10, 12, 14, 16, 18, 20, 22, 24, 26., head = 0., linked_list3=.next_index = .1, 2, 3, 4, 5, 6, 7, 8, 9, 10., values = .10, 12, 14, 16, 18, 20, 22, 24, 26, 28., head = 0., linked_list4=.next_index = .1, 2, 3, 4, 5, 6, 7, 8, 9, 10., values = .20, 22, 24, 26, 28, 30, 32, 34, 36, 38., head = 0.\\) at .*call-ar-st.c:1105\[ \t\n\r\]+1105.*printf\\(.Sum of 4 arrays, by element \\(add in seed as well\\).*\\);.*" \ "check args of sum_array_print" #call print_array_rep(linked_list1, linked_list2, linked_list3) @@ -285,17 +348,17 @@ gdb_test "continue" \ #} -#go -until 1079 -gdb_test "tbreak 1079" \ - "Breakpoint.* file .*call-ar-st.c, line 1079.*" \ - "tbreakpoint line 1079" +#go -until 1281 +gdb_test "tbreak 1281" \ + "Breakpoint.* file .*call-ar-st.c, line 1281.*" \ + "tbreakpoint line 1281" send_gdb "continue\n" gdb_expect { - -re "Continuing\\..*Sum of 4 arrays.*Contents of linked list1.*Contents of two_floats_t.*main \\(\\) at .*call-ar-st.c:1079.*c = 0.*$gdb_prompt $" { - pass "continue to 1079"} - -re ".*$gdb_prompt $" { fail "continue to 1079"} - timeout { fail "(timeout) continue to 1079"} + -re "Continuing\\..*Sum of 4 arrays.*Contents of linked list1.*Contents of two_floats_t.*main \\(\\) at .*call-ar-st.c:1281.*c = 0.*$gdb_prompt $" { + pass "continue to 1281"} + -re ".*$gdb_prompt $" { fail "continue to 1281"} + timeout { fail "(timeout) continue to 1281"} } #call print_small_structs(*struct1, *struct2, *struct3, *struct4,*flags, *flags_combo, @@ -334,30 +397,51 @@ if {![target_info exists gdb,skip_float_tests]} { } } -#go -until 1084 -gdb_test "tbreak 1084" \ - "Breakpoint .* file .*call-ar-st.c, line 1084.*" \ - "tbreakpoint line 1084" - -gdb_test continue "Continuing\\..*main \\(.*\\) at.*call-ar-st.c:1084\[\t\r\n \]+1084.*print_long_arg_list \\( a, b, c, d, e, f, .struct1, .struct2, .struct3, .struct4,.*" "continue to 1084" - -# We can't just assume that a "step" will get us into print_long_arg_list here,either. -gdb_test "tbreak print_long_arg_list" \ - "Breakpoint .* file .*call-ar-st.c, line .*" \ - "tbreak in print_long_arg_list after stepping into memcpy" -send_gdb "continue\n" -if {![target_info exists gdb,skip_float_tests]} { - gdb_expect { - -re ".*print_long_arg_list \\(a=22.219999999999999, b=33.332999999999998, c=0, d=-25, e=100, f=2345, struct1=\{value = 6, head = 0\}, struct2=\{value = 10, head = 0\}, struct3=\{value = 12, head = 0\}, struct4=\{value = 14, head = 0\}, flags=\{alpha = 1, beta = 0, gamma = 1, delta = 0, epsilon = 1, omega = 0\}, flags_combo=\{alpha = 1, beta = 0, ch1 = 121 \'y\', gamma = 1, delta = 0, ch2 = 110 \'n\', epsilon = 1, omega = 0\}, three_char=\{ch1 = 97 \'a\', ch2 = 98 \'b\', ch3 = 99 \'c\'\}, five_char=\{ch1 = 108 \'l\', ch2 = 109 \'m\', ch3 = 110 \'n\', ch4 = 111 \'o\', ch5 = 112 \'p\'\}, int_char_combo=\{int1 = 123, ch1 = 122 \'z\'\}, d1=\{double1 = 10.5\}, d2=\{double1 = -3.3399999999999999\}, d3=\{double1 = 675.09123\}, f1=\{float1 = 45.2340012, float2 = 43.5999985\}, f2=\{float1 = 78.0100021, float2 = 122.099998\}, f3=\{float1 = -1232.34497, float2 = -199.210007\}\\) at ${srcdir}/${subdir}/${srcfile}:813\[\r\n\]+813\[ \t\]+printf\\(\"double :.*\", a\\);.*$gdb_prompt $" {pass "step into print_long_arg_list"} - -re ".*$gdb_prompt $" { fail "step into print_long_arg_list" } - timeout { fail "step into print_long_arg_list (timeout)" } - } +#go -until 1286 +gdb_test "tbreak 1286" \ + "Breakpoint .* file .*call-ar-st.c, line 1286.*" \ + "tbreakpoint line 1286" + +gdb_test continue "Continuing\\..*main \\(.*\\) at.*call-ar-st.c:1286\[\t\r\n \]+1286.*print_long_arg_list \\( a, b, c, d, e, f, .struct1, .struct2, .struct3, .struct4,.*" "continue to 1286" + +if { [istarget "hppa*-*-hpux*"] } { + # + # NOTE:(FIXME) + # the aCC demangler cannot demangle the name of a function with >10 args. + # so I added a .* after the name of the function, to match the + # incredibly long mangled name + # (getting aCC's libdemangle.a bundled w/ the system?) + # DTS CLLbs16994 coulter 990114 + # + # FIXME: use step for hppa* testing for now + # guo 990621 + # + send_gdb "step\n" + gdb_expect { + -re ".*print_long_arg_list.*\\(a=22.219999999999999, b=33.332999999999998, c=0, d=-25, e=100, f=2345, struct1=\{value = 6, head = 0\}, struct2=\{value = 10, head = 0\}, struct3=\{value = 12, head = 0\}, struct4=\{value = 14, head = 0\}, flags=\{alpha = 1, beta = 0, gamma = 1, delta = 0, epsilon = 1, omega = 0\}, flags_combo=\{alpha = 1, beta = 0, ch1 = 121 \'y\', gamma = 1, delta = 0, ch2 = 110 \'n\', epsilon = 1, omega = 0\}, three_char=\{ch1 = 97 \'a\', ch2 = 98 \'b\', ch3 = 99 \'c\'\}, five_char=\{ch1 = 108 \'l\', ch2 = 109 \'m\', ch3 = 110 \'n\', ch4 = 111 \'o\', ch5 = 112 \'p\'\}, int_char_combo=\{int1 = 123, ch1 = 122 \'z\'\}, d1=\{double1 = 10.5\}, d2=\{double1 = -3.3399999999999999\}, d3=\{double1 = 675.09123\}, f1=\{float1 = 45.2340012, float2 = 43.5999985\}, f2=\{float1 = 78.0100021, float2 = 122.099998\}, f3=\{float1 = -1232.34497, float2 = -199.210007\}\\) at ${srcdir}/${subdir}/${srcfile}:992\[\r\n\]+992\[ \t\]+printf\\(\"double :.*\", a\\);.*$gdb_prompt $" {pass "step into print_long_arg_list"} + -re ".*$gdb_prompt $" { fail "step into print_long_arg_list" } + timeout { fail "step into print_long_arg_list (timeout)" } + } } else { - gdb_expect { - -re ".*print_long_arg_list \\(.*\\).*$gdb_prompt $" { pass "step into print_long_arg_list" } - -re ".*$gdb_prompt $" { fail "step into print_long_arg_list" } - timeout { fail "step into print_long_arg_list (timeout)" } - } + + # We can't just assume that a "step" will get us into print_long_arg_list here,either. + gdb_test "tbreak print_long_arg_list" \ + "Breakpoint .* file .*call-ar-st.c, line .*" \ + "tbreak in print_long_arg_list after stepping into memcpy" + send_gdb "continue\n" + if {![target_info exists gdb,skip_float_tests]} { + gdb_expect { + -re ".*print_long_arg_list \\(a=22.219999999999999, b=33.332999999999998, c=0, d=-25, e=100, f=2345, struct1=\{value = 6, head = 0\}, struct2=\{value = 10, head = 0\}, struct3=\{value = 12, head = 0\}, struct4=\{value = 14, head = 0\}, flags=\{alpha = 1, beta = 0, gamma = 1, delta = 0, epsilon = 1, omega = 0\}, flags_combo=\{alpha = 1, beta = 0, ch1 = 121 \'y\', gamma = 1, delta = 0, ch2 = 110 \'n\', epsilon = 1, omega = 0\}, three_char=\{ch1 = 97 \'a\', ch2 = 98 \'b\', ch3 = 99 \'c\'\}, five_char=\{ch1 = 108 \'l\', ch2 = 109 \'m\', ch3 = 110 \'n\', ch4 = 111 \'o\', ch5 = 112 \'p\'\}, int_char_combo=\{int1 = 123, ch1 = 122 \'z\'\}, d1=\{double1 = 10.5\}, d2=\{double1 = -3.3399999999999999\}, d3=\{double1 = 675.09123\}, f1=\{float1 = 45.2340012, float2 = 43.5999985\}, f2=\{float1 = 78.0100021, float2 = 122.099998\}, f3=\{float1 = -1232.34497, float2 = -199.210007\}\\) at ${srcdir}/${subdir}/${srcfile}:992\[\r\n\]+992\[ \t\]+printf\\(\"double :.*\", a\\);.*$gdb_prompt $" {pass "step into print_long_arg_list"} + -re ".*$gdb_prompt $" { fail "step into print_long_arg_list" } + timeout { fail "step into print_long_arg_list (timeout)" } + } + } else { + gdb_expect { + -re ".*print_long_arg_list \\(.*\\).*$gdb_prompt $" { pass "step into print_long_arg_list" } + -re ".*$gdb_prompt $" { fail "step into print_long_arg_list" } + timeout { fail "step into print_long_arg_list (timeout)" } + } + } } #call print_small_structs(struct1, struct2, struct3, struct4, flags, flags_combo, three_char, five_char, int_char_combo, d1, d2, d3, f1, f2, f3) @@ -373,19 +457,25 @@ if {![target_info exists gdb,skip_float_tests]} { } -#go -until 1098 -gdb_test "tbreak 1098" \ - "Breakpoint.* file .*call-ar-st.c, line 1098.*" \ - "tbreakpoint line 1098" +#go -until 1300 +gdb_test "tbreak 1300" \ + "Breakpoint.* file .*call-ar-st.c, line 1300.*" \ + "tbreakpoint line 1300" + +gdb_test continue "Continuing\\..*Contents of two_floats_t:.*main \\(\\) at.*call-ar-st.c:1300.*1300.*init_bit_flags_combo\\(flags_combo, \\(unsigned\\)1, \\(unsigned\\)0, .y.,.*" \ + "continue to 1300" + -gdb_test continue "Continuing\\..*Contents of two_floats_t:.*main \\(\\) at.*call-ar-st.c:1098.*1098.*init_bit_flags_combo\\(flags_combo, \\(unsigned\\)1, \\(unsigned\\)0, .y.,.*" \ - "continue to 1098" +# FIXME: +# HP aCC demangler currently does not handle hp aCC functions with >10 args +# DTS CLLbs16994 coulter 990114 +if {$hp_aCC_compiler} {setup_xfail "hppa*-*-*"} #step send_gdb "step\n" gdb_expect { -re " -init_bit_flags_combo \\(bit_flags_combo=, a=1, b=0, ch1=121 .y., g=1, d=0, ch2=110 .n., e=1, o=0\\) at .*call-ar-st.c:385\[ \t\n\r\]+385.*bit_flags_combo->alpha = a;.*$gdb_prompt $" { +init_bit_flags_combo \\(bit_flags_combo=, a=1, b=0, ch1=121 .y., g=1, d=0, ch2=110 .n., e=1, o=0\\) at .*call-ar-st.c:416\[ \t\n\r\]+416.*bit_flags_combo->alpha = a;.*$gdb_prompt $" { pass "step into init_bit_flags_combo"} -re ".*$gdb_prompt $" { fail "step into init_bit_flags_combo" } timeout { fail "step into init_bit_flags_combo (timeout)" } @@ -402,13 +492,13 @@ gdb_expect { } -#go -until 1103 -gdb_test "tbreak 1103" \ - "Breakpoint.* file .*call-ar-st.c, line 1103.*" \ - "tbreakpoint line 1103" +#go -until 1305 +gdb_test "tbreak 1305" \ + "Breakpoint.* file .*call-ar-st.c, line 1305.*" \ + "tbreakpoint line 1305" -gdb_test continue "Continuing\\..*main \\(\\) at .*call-ar-st.c:1103\[\r\n\t \]+1103.*init_int_char_combo\\(int_char_combo, 13, .!.\\);" \ -"continue to 1103" +gdb_test continue "Continuing\\..*main \\(\\) at .*call-ar-st.c:1305\[\r\n\t \]+1305.*init_int_char_combo\\(int_char_combo, 13, .!.\\);" \ +"continue to 1305" #call print_long_arg_list(a, b, c, d, e, f, *struct1, *struct2, *struct3, *struct4, *flags, *flags_combo, *three_char, *five_char, *int_char_combo, *d1, *d2, *d3, *f1, *f2, *f3) if {![target_info exists gdb,skip_float_tests]} { @@ -423,13 +513,13 @@ if {![target_info exists gdb,skip_float_tests]} { } -#go -until 1109 -gdb_test "tbreak 1109" \ - "Breakpoint.* file .*call-ar-st.c, line 1109.*" \ - "tbreakpoint line 1109" +#go -until 1311 +gdb_test "tbreak 1311" \ + "Breakpoint.* file .*call-ar-st.c, line 1311.*" \ + "tbreakpoint line 1311" -gdb_test continue "Continuing\\..*main \\(\\) at .*call-ar-st.c:1109\[ \t\n\r\]+1109.*compute_with_small_structs\\(35\\);" \ -"continue to 1109" +gdb_test continue "Continuing\\..*main \\(\\) at .*call-ar-st.c:1311\[ \t\n\r\]+1311.*compute_with_small_structs\\(35\\);" \ +"continue to 1311" #call sum_struct_print(10, *struct1, *struct2, *struct3, *struct4) diff --git a/gdb/testsuite/gdb.base/call-rt-st.c b/gdb/testsuite/gdb.base/call-rt-st.c index ad40a70..712f70e 100644 --- a/gdb/testsuite/gdb.base/call-rt-st.c +++ b/gdb/testsuite/gdb.base/call-rt-st.c @@ -119,6 +119,16 @@ void loop_count () { * IN unsigned e -- 0 or 1 * IN unsigned o -- 0 or 1 *****************************************************************/ +#ifdef PROTOTYPES +void init_bit_flags ( +struct bit_flags_t *bit_flags, +unsigned a, +unsigned b, +unsigned g, +unsigned d, +unsigned e, +unsigned o) +#else void init_bit_flags (bit_flags,a,b,g,d,e,o) struct bit_flags_t *bit_flags; unsigned a; @@ -127,6 +137,7 @@ unsigned g; unsigned d; unsigned e; unsigned o; +#endif { bit_flags->alpha = a; @@ -152,6 +163,18 @@ unsigned o; * IN unsigned e -- 0 or 1 * IN unsigned o -- 0 or 1 *****************************************************************/ +#ifdef PROTOTYPES +void init_bit_flags_combo ( +struct bit_flags_combo_t *bit_flags_combo, +unsigned a, +unsigned b, +char ch1, +unsigned g, +unsigned d, +char ch2, +unsigned e, +unsigned o) +#else void init_bit_flags_combo (bit_flags_combo, a, b, ch1, g, d, ch2, e, o) struct bit_flags_combo_t *bit_flags_combo; unsigned a; @@ -162,6 +185,7 @@ unsigned d; char ch2; unsigned e; unsigned o; +#endif { bit_flags_combo->alpha = a; @@ -180,9 +204,13 @@ unsigned o; * OUT struct one_double_t *one_double -- structure to fill * IN double init_val *****************************************************************/ +#ifdef PROTOTYPES +void init_one_double ( struct one_double_t *one_double, double init_val) +#else void init_one_double (one_double, init_val) struct one_double_t *one_double; double init_val; +#endif { one_double->double1 = init_val; @@ -194,10 +222,17 @@ double init_val; * IN float init_val1 * IN float init_val2 *****************************************************************/ +#ifdef PROTOTYPES +void init_two_floats ( + struct two_floats_t *two_floats, + float init_val1, + float init_val2) +#else void init_two_floats (two_floats, init_val1, init_val2) struct two_floats_t *two_floats; float init_val1; float init_val2; +#endif { two_floats->float1 = init_val1; @@ -211,11 +246,19 @@ float init_val2; * IN char init_val2 * IN char init_val3 *****************************************************************/ +#ifdef PROTOTYPES +void init_three_chars ( +struct three_char_t *three_char, +char init_val1, +char init_val2, +char init_val3) +#else void init_three_chars ( three_char, init_val1, init_val2, init_val3) struct three_char_t *three_char; char init_val1; char init_val2; char init_val3; +#endif { three_char->ch1 = init_val1; @@ -232,6 +275,15 @@ char init_val3; * IN char init_val4 * IN char init_val5 *****************************************************************/ +#ifdef PROTOTYPES +void init_five_chars ( +struct five_char_t *five_char, +char init_val1, +char init_val2, +char init_val3, +char init_val4, +char init_val5) +#else void init_five_chars ( five_char, init_val1, init_val2, init_val3, init_val4, init_val5) struct five_char_t *five_char; char init_val1; @@ -239,6 +291,7 @@ char init_val2; char init_val3; char init_val4; char init_val5; +#endif { five_char->ch1 = init_val1; @@ -254,10 +307,17 @@ char init_val5; * IN int init_val1 * IN char init_val2 *****************************************************************/ +#ifdef PROTOTYPES +void init_int_char_combo ( +struct int_char_combo_t *combo, +int init_val1, +char init_val2) +#else void init_int_char_combo ( combo, init_val1, init_val2) struct int_char_combo_t *combo; int init_val1; char init_val2; +#endif { combo->int1 = init_val1; @@ -269,10 +329,15 @@ char init_val2; * OUT struct small_rep_into_t *small_struct -- structure to be filled * IN int seed *****************************************************************/ +#ifdef PROTOTYPES +void init_struct_rep( + struct small_rep_info_t *small_struct, + int seed) +#else void init_struct_rep( small_struct, seed) struct small_rep_info_t *small_struct; int seed; - +#endif { small_struct->value = 2 + (seed*2); @@ -283,8 +348,12 @@ int seed; * PRINT_BIT_FLAGS : * IN struct bit_flags_t bit_flags ****************************************************************/ +#ifdef PROTOTYPES +struct bit_flags_t print_bit_flags (struct bit_flags_t bit_flags) +#else struct bit_flags_t print_bit_flags ( bit_flags) struct bit_flags_t bit_flags; +#endif { if (bit_flags.alpha) printf("alpha\n"); @@ -301,8 +370,12 @@ struct bit_flags_t bit_flags; * PRINT_BIT_FLAGS_COMBO : * IN struct bit_flags_combo_t bit_flags_combo ****************************************************************/ +#ifdef PROTOTYPES +struct bit_flags_combo_t print_bit_flags_combo (struct bit_flags_combo_t bit_flags_combo) +#else struct bit_flags_combo_t print_bit_flags_combo ( bit_flags_combo ) struct bit_flags_combo_t bit_flags_combo; +#endif { if (bit_flags_combo.alpha) printf("alpha\n"); @@ -320,8 +393,12 @@ struct bit_flags_combo_t bit_flags_combo; * PRINT_ONE_DOUBLE : * IN struct one_double_t one_double ****************************************************************/ +#ifdef PROTOTYPES +struct one_double_t print_one_double (struct one_double_t one_double) +#else struct one_double_t print_one_double ( one_double ) struct one_double_t one_double; +#endif { printf("Contents of one_double_t: \n\n"); @@ -334,8 +411,12 @@ struct one_double_t one_double; * PRINT_TWO_FLOATS : * IN struct two_floats_t two_floats ****************************************************************/ +#ifdef PROTOTYPES +struct two_floats_t print_two_floats (struct two_floats_t two_floats) +#else struct two_floats_t print_two_floats ( two_floats ) struct two_floats_t two_floats; +#endif { printf("Contents of two_floats_t: \n\n"); @@ -348,8 +429,12 @@ struct two_floats_t two_floats; * PRINT_THREE_CHARS : * IN struct three_char_t three_char ****************************************************************/ +#ifdef PROTOTYPES +struct three_char_t print_three_chars (struct three_char_t three_char) +#else struct three_char_t print_three_chars ( three_char ) struct three_char_t three_char; +#endif { printf("Contents of three_char_t: \n\n"); @@ -362,8 +447,12 @@ struct three_char_t three_char; * PRINT_FIVE_CHARS : * IN struct five_char_t five_char ****************************************************************/ +#ifdef PROTOTYPES +struct five_char_t print_five_chars (struct five_char_t five_char) +#else struct five_char_t print_five_chars ( five_char ) struct five_char_t five_char; +#endif { printf("Contents of five_char_t: \n\n"); @@ -378,8 +467,12 @@ struct five_char_t five_char; * PRINT_INT_CHAR_COMBO : * IN struct int_char_combo_t int_char_combo ****************************************************************/ +#ifdef PROTOTYPES +struct int_char_combo_t print_int_char_combo (struct int_char_combo_t int_char_combo) +#else struct int_char_combo_t print_int_char_combo ( int_char_combo ) struct int_char_combo_t int_char_combo; +#endif { printf("Contents of int_char_combo_t: \n\n"); @@ -391,9 +484,12 @@ struct int_char_combo_t int_char_combo; /***************************************************************** * PRINT_STRUCT_REP : ****************************************************************/ +#ifdef PROTOTYPES +struct small_rep_info_t print_struct_rep(struct small_rep_info_t struct1) +#else struct small_rep_info_t print_struct_rep( struct1 ) struct small_rep_info_t struct1; - +#endif { printf("Contents of struct1: \n\n"); @@ -406,8 +502,12 @@ struct small_rep_info_t struct1; } +#ifdef PROTOTYPES +struct array_rep_info_t print_one_large_struct(struct array_rep_info_t linked_list1) +#else struct array_rep_info_t print_one_large_struct( linked_list1 ) struct array_rep_info_t linked_list1; +#endif { @@ -423,10 +523,13 @@ struct array_rep_info_t linked_list1; * IN struct array_rep_info_t *linked_list * IN int seed ****************************************************************/ +#ifdef PROTOTYPES +void init_array_rep(struct array_rep_info_t *linked_list, int seed) +#else void init_array_rep( linked_list, seed ) struct array_rep_info_t *linked_list; int seed; - +#endif { int index; diff --git a/gdb/testsuite/gdb.base/call-rt-st.exp b/gdb/testsuite/gdb.base/call-rt-st.exp index 2c419ae..a1cca70 100644 --- a/gdb/testsuite/gdb.base/call-rt-st.exp +++ b/gdb/testsuite/gdb.base/call-rt-st.exp @@ -122,8 +122,10 @@ gdb_expect { send_gdb "finish\n" gdb_expect { - -re "Run till exit from .0 loop_count \\(\\) at.*call-rt-st.c:106\[ \t\r\n\]+main \\(\\) at.*call-rt-st.c:514\[ \t\r\n\]+514\[\t \]+return 0;.*$gdb_prompt $" { - pass "finish out from loop_count"} + -re "Run till exit from .0 loop_count \\(\\) at.*call-rt-st.c:106\[ \t\r\n\]+main \\(\\) at.*call-rt-st.c:617\[ \t\r\n\]+617\[\t \]+return 0;.*$gdb_prompt $" { + pass "finish out from loop_count (line 617)"} + -re "Run till exit from .0 loop_count \\(\\) at.*call-rt-st.c:106\[ \t\r\n\]+main \\(\\) at.*call-rt-st.c:615\[ \t\r\n\]+615\[\t \]+loop_count.*$gdb_prompt $" { + pass "finish out from loop_count (line 615)"} -re ".*$gdb_prompt $" { fail "finish out from loop_count"} timeout { fail "(timeout)finish out from loop_count"} } diff --git a/gdb/testsuite/gdb.base/call-strs.c b/gdb/testsuite/gdb.base/call-strs.c index 02870e0..f3bc8da 100644 --- a/gdb/testsuite/gdb.base/call-strs.c +++ b/gdb/testsuite/gdb.base/call-strs.c @@ -1,16 +1,33 @@ #include <stdio.h> +#include <stdlib.h> +#include <string.h> + char buf[100]; char bigbuf[1000]; char * s; +#ifdef PROTOTYPES +char * str_func1(char *s1) +#else char * str_func1(s1) char *s1; +#endif { printf("first string arg is: %s\n", s1); strcpy(bigbuf, s1); return bigbuf; } +#ifdef PROTOTYPES +char * str_func( +char * s1, +char * s2, +char * s3, +char * s4, +char * s5, +char * s6, +char * s7) +#else char * str_func(s1, s2, s3, @@ -25,6 +42,7 @@ char * s4; char * s5; char * s6; char * s7; +#endif { printf("first string arg is: %s\n", s1); printf("second string arg is: %s\n", s2); @@ -49,11 +67,12 @@ link_malloc () return (char*) malloc (1); } -main() +int main() { s = &buf[0]; strcpy(buf, "test string"); str_func("abcd", "efgh", "ijkl", "mnop", "qrst", "uvwx", "yz12"); str_func1("abcd"); + return 0; } diff --git a/gdb/testsuite/gdb.base/call-strs.exp b/gdb/testsuite/gdb.base/call-strs.exp index 1d4cc4a..84c1ef5 100644 --- a/gdb/testsuite/gdb.base/call-strs.exp +++ b/gdb/testsuite/gdb.base/call-strs.exp @@ -217,26 +217,25 @@ gdb_expect { timeout { fail "(timeout) call str_func(\"a\",\"b\",\"c\",\"d\",\"e\",\"f\",\"g\")" } } -#print str_func(s,s,s,s,s,s,s,s) -send_gdb "print str_func(s,s,s,s,s,s,s,s)\n" +#print str_func(s,s,s,s,s,s,s) +send_gdb "print str_func(s,s,s,s,s,s,s)\n" gdb_expect { -re "first string arg is: test string\[ \t\r\n\]+second string arg is: test string\[ \t\r\n\]+third string arg is: test string\[ \t\r\n\]+fourth string arg is: test string\[ \t\r\n\]+fifth string arg is: test string\[ \t\r\n\]+sixth string arg is: test string\[ \t\r\n\]+seventh string arg is: test string\[ \t\r\n\]+.*\"test stringtest stringtest stringtest stringtest stringtest stringtest string\".*$gdb_prompt $" { - pass "print str_func(s,s,s,s,s,s,s,s)" + pass "print str_func(s,s,s,s,s,s,s)" } - -re ".*$gdb_prompt $" { fail "print str_func(s,s,s,s,s,s,s,s)" } - timeout { fail "(timeout) print str_func(s,s,s,s,s,s,s,s)" } + -re ".*$gdb_prompt $" { fail "print str_func(s,s,s,s,s,s,s)" } + timeout { fail "(timeout) print str_func(s,s,s,s,s,s,s)" } } -#call str_func(s,s,s,s,s,s,s,s) -send_gdb "call str_func(s,s,s,s,s,s,s,s)\n" +#call str_func(s,s,s,s,s,s,s) +send_gdb "call str_func(s,s,s,s,s,s,s)\n" gdb_expect { -re "first string arg is: test string\[ \t\r\n\]+second string arg is: test string\[ \t\r\n\]+third string arg is: test string\[ \t\r\n\]+fourth string arg is: test string\[ \t\r\n\]+fifth string arg is: test string\[ \t\r\n\]+sixth string arg is: test string\[ \t\r\n\]+seventh string arg is: test string\[ \t\r\n\]+.*\"test stringtest stringtest stringtest stringtest stringtest stringtest string\".*$gdb_prompt $" { - pass "call str_func(s,s,s,s,s,s,s,s)" + pass "call str_func(s,s,s,s,s,s,s)" } - -re ".*$gdb_prompt $" { fail "call str_func(s,s,s,s,s,s,s,s)" } - timeout { fail "(timeout) call str_func(s,s,s,s,s,s,s,s)" } + -re ".*$gdb_prompt $" { fail "call str_func(s,s,s,s,s,s,s)" } + timeout { fail "(timeout) call str_func(s,s,s,s,s,s,s)" } } gdb_exit return 0 -~ diff --git a/gdb/testsuite/gdb.base/callfuncs.c b/gdb/testsuite/gdb.base/callfuncs.c index 56b9ba8..ecf9026 100644 --- a/gdb/testsuite/gdb.base/callfuncs.c +++ b/gdb/testsuite/gdb.base/callfuncs.c @@ -8,6 +8,9 @@ #define PARAMS(paramlist) paramlist #endif +# include <stdlib.h> +# include <string.h> + char char_val1 = 'a'; char char_val2 = 'b'; @@ -28,8 +31,8 @@ double double_val2 = -67.66; #define DELTA (0.001) -char *string_val1 = "string 1"; -char *string_val2 = "string 2"; +char *string_val1 = (char *)"string 1"; +char *string_val2 = (char *)"string 2"; char char_array_val1[] = "carray 1"; char char_array_val2[] = "carray 2"; @@ -46,15 +49,20 @@ struct struct1 { /* Some functions that can be passed as arguments to other test functions, or called directly. */ - -int add (a, b) -int a, b; +#ifdef PROTOTYPES +int add (int a, int b) +#else +int add (a, b) int a, b; +#endif { return (a + b); } -int doubleit (a) -int a; +#ifdef PROTOTYPES +int doubleit (int a) +#else +int doubleit (a) int a; +#endif { return (a + a); } @@ -69,20 +77,29 @@ enum enumtype enum_val1 = enumval1; enum enumtype enum_val2 = enumval2; enum enumtype enum_val3 = enumval3; -int t_enum_value1 (enum_arg) -enum enumtype enum_arg; +#ifdef PROTOTYPES +int t_enum_value1 (enum enumtype enum_arg) +#else +int t_enum_value1 (enum_arg) enum enumtype enum_arg; +#endif { return (enum_arg == enum_val1); } -int t_enum_value2 (enum_arg) -enum enumtype enum_arg; +#ifdef PROTOTYPES +int t_enum_value2 (enum enumtype enum_arg) +#else +int t_enum_value2 (enum_arg) enum enumtype enum_arg; +#endif { return (enum_arg == enum_val2); } -int t_enum_value3 (enum_arg) -enum enumtype enum_arg; +#ifdef PROTOTYPES +int t_enum_value3 (enum enumtype enum_arg) +#else +int t_enum_value3 (enum_arg) enum enumtype enum_arg; +#endif { return (enum_arg == enum_val3); } @@ -90,9 +107,11 @@ enum enumtype enum_arg; /* A function that takes a vector of integers (along with an explicit count) and returns their sum. */ -int sum_args (argc, argv) -int argc; -int argv[]; +#ifdef PROTOTYPES +int sum_args (int argc, int argv[]) +#else +int sum_args (argc, argv) int argc; int argv[]; +#endif { int sumval = 0; int idx; @@ -107,6 +126,15 @@ int argv[]; /* Test that we can call functions that take structs and return members from that struct */ +#ifdef PROTOTYPES +char t_structs_c (struct struct1 tstruct) { return (tstruct.c); } +short t_structs_s (struct struct1 tstruct) { return (tstruct.s); } +int t_structs_i (struct struct1 tstruct) { return (tstruct.i); } +long t_structs_l (struct struct1 tstruct) { return (tstruct.l); } +float t_structs_f (struct struct1 tstruct) { return (tstruct.f); } +double t_structs_d (struct struct1 tstruct) { return (tstruct.d); } +char *t_structs_a (struct struct1 tstruct) { return (tstruct.a); } +#else char t_structs_c (tstruct) struct struct1 tstruct; { return (tstruct.c); } short t_structs_s (tstruct) struct struct1 tstruct; { return (tstruct.s); } int t_structs_i (tstruct) struct struct1 tstruct; { return (tstruct.i); } @@ -114,19 +142,30 @@ long t_structs_l (tstruct) struct struct1 tstruct; { return (tstruct.l); } float t_structs_f (tstruct) struct struct1 tstruct; { return (tstruct.f); } double t_structs_d (tstruct) struct struct1 tstruct; { return (tstruct.d); } char *t_structs_a (tstruct) struct struct1 tstruct; { return (tstruct.a); } +#endif /* Test that calling functions works if there are a lot of arguments. */ +#ifdef PROTOTYPES +int +sum10 (int i0, int i1, int i2, int i3, int i4, int i5, int i6, int i7, int i8, int i9) +#else int sum10 (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9) int i0, i1, i2, i3, i4, i5, i6, i7, i8, i9; +#endif { return i0 + i1 + i2 + i3 + i4 + i5 + i6 + i7 + i8 + i9; } /* Test that args are passed in the right order. */ +#ifdef PROTOTYPES +int +cmp10 (int i0, int i1, int i2, int i3, int i4, int i5, int i6, int i7, int i8, int i9) +#else int cmp10 (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9) int i0, i1, i2, i3, i4, i5, i6, i7, i8, i9; +#endif { return (i0 == 0) && (i1 == 1) && (i2 == 2) && (i3 == 3) && (i4 == 4) && @@ -152,14 +191,21 @@ int main () either 0 or 1, depending upon whether the values were passed incorrectly or correctly, respectively. */ +#ifdef PROTOTYPES +int t_char_values (char char_arg1, char char_arg2) +#else int t_char_values (char_arg1, char_arg2) char char_arg1, char_arg2; +#endif { return ((char_arg1 == char_val1) && (char_arg2 == char_val2)); } int -#ifdef NO_PROTOTYPES +#ifdef PROTOTYPES +t_small_values (char arg1, short arg2, int arg3, char arg4, short arg5, + char arg6, short arg7, int arg8, short arg9, short arg10) +#else t_small_values (arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) char arg1; short arg2; @@ -171,34 +217,47 @@ t_small_values (arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) int arg8; short arg9; short arg10; -#else -t_small_values (char arg1, short arg2, int arg3, char arg4, short arg5, - char arg6, short arg7, int arg8, short arg9, short arg10) #endif { return arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10; } +#ifdef PROTOTYPES +int t_short_values (short short_arg1, short short_arg2) +#else int t_short_values (short_arg1, short_arg2) -short short_arg1, short_arg2; + short short_arg1, short_arg2; +#endif { return ((short_arg1 == short_val1) && (short_arg2 == short_val2)); } +#ifdef PROTOTYPES +int t_int_values (int int_arg1, int int_arg2) +#else int t_int_values (int_arg1, int_arg2) int int_arg1, int_arg2; +#endif { return ((int_arg1 == int_val1) && (int_arg2 == int_val2)); } +#ifdef PROTOTYPES +int t_long_values (long long_arg1, long long_arg2) +#else int t_long_values (long_arg1, long_arg2) long long_arg1, long_arg2; +#endif { return ((long_arg1 == long_val1) && (long_arg2 == long_val2)); } +#ifdef PROTOTYPES +int t_float_values (float float_arg1, float float_arg2) +#else int t_float_values (float_arg1, float_arg2) float float_arg1, float_arg2; +#endif { return ((float_arg1 - float_val1) < DELTA && (float_arg1 - float_val1) > -DELTA @@ -207,13 +266,13 @@ float float_arg1, float_arg2; } int -#ifdef NO_PROTOTYPES +#ifdef PROTOTYPES +t_float_values2 (float float_arg1, float float_arg2) +#else /* In this case we are just duplicating t_float_values, but that is the easiest way to deal with either ANSI or non-ANSI. */ t_float_values2 (float_arg1, float_arg2) float float_arg1, float_arg2; -#else -t_float_values2 (float float_arg1, float float_arg2) #endif { return ((float_arg1 - float_val1) < DELTA @@ -222,8 +281,12 @@ t_float_values2 (float float_arg1, float float_arg2) && (float_arg2 - float_val2) > -DELTA); } +#ifdef PROTOTYPES +int t_double_values (double double_arg1, double double_arg2) +#else int t_double_values (double_arg1, double_arg2) double double_arg1, double_arg2; +#endif { return ((double_arg1 - double_val1) < DELTA && (double_arg1 - double_val1) > -DELTA @@ -231,15 +294,23 @@ double double_arg1, double_arg2; && (double_arg2 - double_val2) > -DELTA); } +#ifdef PROTOTYPES +int t_string_values (char *string_arg1, char *string_arg2) +#else int t_string_values (string_arg1, string_arg2) char *string_arg1, *string_arg2; +#endif { return (!strcmp (string_arg1, string_val1) && !strcmp (string_arg2, string_val2)); } +#ifdef PROTOTYPES +int t_char_array_values (char char_array_arg1[], char char_array_arg2[]) +#else int t_char_array_values (char_array_arg1, char_array_arg2) char char_array_arg1[], char_array_arg2[]; +#endif { return (!strcmp (char_array_arg1, char_array_val1) && !strcmp (char_array_arg2, char_array_val2)); @@ -264,17 +335,25 @@ char char_array_arg1[], char_array_arg2[]; that function indirectly through the function pointer. This would fail on the HPPA. */ +#ifdef PROTOTYPES +int t_func_values (int (*func_arg1)(int, int), int (*func_arg2)(int)) +#else int t_func_values (func_arg1, func_arg2) int (*func_arg1) PARAMS ((int, int)); int (*func_arg2) PARAMS ((int)); +#endif { return ((*func_arg1) (5,5) == (*func_val1) (5,5) && (*func_arg2) (6) == (*func_val2) (6)); } +#ifdef PROTOTYPES +int t_call_add (int (*func_arg1)(int, int), int a, int b) +#else int t_call_add (func_arg1, a, b) int (*func_arg1) PARAMS ((int, int)); int a, b; +#endif { return ((*func_arg1)(a, b)); } diff --git a/gdb/testsuite/gdb.base/callfuncs.exp b/gdb/testsuite/gdb.base/callfuncs.exp index 19b5c96..7db87b7 100644 --- a/gdb/testsuite/gdb.base/callfuncs.exp +++ b/gdb/testsuite/gdb.base/callfuncs.exp @@ -31,14 +31,8 @@ set testfile "callfuncs" set srcfile ${testfile}.c set binfile ${objdir}/${subdir}/${testfile} -set prototypes 1 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - set prototypes 0; - # 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 {debug additional_flags=-DNO_PROTOTYPES}] != "" } { 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,6 +42,12 @@ if [get_compiler_info ${binfile}] { return -1; } +if {$hp_aCC_compiler} { + set prototypes 1 +} else { + set prototypes 0 +} + # The a29k can't call functions, so don't even bother with this test. if [target_info exists gdb,cannot_call_functions] { setup_xfail "*-*-*" 2416 @@ -129,13 +129,13 @@ proc do_function_calls {} { # Gcc emits different stabs for the two parameters; the first is # claimed to be a float, the second a double. # dbxout.c in gcc claims this is the desired behavior. - setup_xfail "mn10300-*-*" + setup_xfail "mn10300-*-*" "hppa*-*-*11*" gdb_test "p t_float_values(3.14159,-2.3765)" " = 1" - setup_xfail "mn10300-*-*" + setup_xfail "mn10300-*-*" "hppa*-*-*11*" gdb_test "p t_float_values(float_val1,float_val2)" " = 1" - setup_xfail "mn10300-*-*" + setup_xfail "mn10300-*-*" "hppa*-*-*11*" gdb_test "p t_float_values(3.14159,float_val2)" " = 1" - setup_xfail "mn10300-*-*" + setup_xfail "mn10300-*-*" "hppa*-*-*11*" gdb_test "p t_float_values(float_val1,-2.3765)" " = 1" # Test passing of arguments which might not be widened. @@ -144,7 +144,7 @@ proc do_function_calls {} { # Although PR 5318 mentions SunOS specifically, this seems # to be a generic problem on quite a few platforms. if $prototypes then { - setup_xfail "hppa*-*-*" "sparc-*-*" "mips*-*-*" 5318 + setup_xfail "sparc-*-*" "mips*-*-*" 5318 if {!$gcc_compiled} then { setup_xfail "alpha-dec-osf2*" "i*86-*-sysv4*" 5318 } @@ -186,7 +186,17 @@ proc do_function_calls {} { setup_xfail "rs6000*-*-*" setup_xfail "powerpc*-*-*" if {!$gcc_compiled && [istarget hppa*-*-hpux*]} then { - gdb_test "p t_func_values(add,func_val2)" "You cannot.*ignored.*" + send_gdb "p t_func_values(add,func_val2)\n" + gdb_expect { + -re "You cannot.*ignored.*" {pass "p t_func_values(add,func_val2)"} + -re "Program received signal SIGBUS, Bus error.*" { + if [istarget hppa*-*-hpux*] { + pass "p t_func_values(add,func_val2)" + } else { + fail "p t_func_values(add,func_val2)" + } + } + } } else { gdb_test "p t_func_values(add,func_val2)" " = 1" } @@ -194,7 +204,17 @@ proc do_function_calls {} { setup_xfail "rs6000*-*-*" setup_xfail "powerpc*-*-*" if {!$gcc_compiled && [istarget hppa*-*-hpux*]} then { - gdb_test "p t_func_values(func_val1,doubleit)" "You cannot.*ignored.*" + send_gdb "p t_func_values(func_val1,doubleit)\n" + gdb_expect { + -re "You cannot.*ignored.*" {pass "p t_func_values(func_val1,doubleit)"} + -re "Program received signal SIGBUS, Bus error.*" { + if [istarget hppa*-*-hpux*] { + pass "p t_func_values(func_val1,doubleit)" + } else { + fail "p t_func_values(func_val1,doubleit)" + } + } + } } else { gdb_test "p t_func_values(func_val1,doubleit)" " = 1" } @@ -204,7 +224,17 @@ proc do_function_calls {} { setup_xfail "rs6000*-*-*" setup_xfail "powerpc*-*-*" if {!$gcc_compiled && [istarget hppa*-*-hpux*]} then { - gdb_test "p t_call_add(add,3,4)" "You cannot.*ignored.*" + send_gdb "p t_call_add(add,3,4)\n" + gdb_expect { + -re "You cannot.*ignored.*" {pass "p t_call_add(add,3,4)"} + -re "Program received signal SIGBUS, Bus error.*" { + if [istarget hppa*-*-hpux*] { + pass "p t_call_add(add,3,4)" + } else { + fail "p t_call_add(add,3,4)" + } + } + } } else { gdb_test "p t_call_add(add,3,4)" " = 7" } @@ -255,12 +285,27 @@ gdb_test "set print sevenbit-strings" "" gdb_test "set print address off" "" gdb_test "set width 0" "" -if { ![set_lang_c] } { - gdb_suppress_tests; -} else { +if { $hp_aCC_compiler } { + # Do not set language explicitly to 'C'. This will cause aCC + # tests to fail because promotion rules are different. Just let + # the language be set to the default. + if { ![runto_main] } { gdb_suppress_tests; } + + # However, turn off overload-resolution for aCC. Having it on causes + # a lot of failures. + + gdb_test "set overload-resolution 0" ".*" +} else { + if { ![set_lang_c] } { + gdb_suppress_tests; + } else { + if { ![runto_main] } { + gdb_suppress_tests; + } + } } gdb_test "next" ".*" diff --git a/gdb/testsuite/gdb.base/callfuncs2.c b/gdb/testsuite/gdb.base/callfuncs2.c index ac14d45..550a970 100644 --- a/gdb/testsuite/gdb.base/callfuncs2.c +++ b/gdb/testsuite/gdb.base/callfuncs2.c @@ -8,6 +8,8 @@ #define PARAMS(paramlist) paramlist #endif +# include <string.h> + char char_val1 = 'a'; char char_val2 = 'b'; @@ -28,8 +30,8 @@ double double_val2 = -67.66; #define DELTA (0.001) -char *string_val1 = "string 1"; -char *string_val2 = "string 2"; +char *string_val1 = (char *)"string 1"; +char *string_val2 = (char *)"string 2"; char char_array_val1[] = "carray 1"; char char_array_val2[] = "carray 2"; @@ -46,15 +48,21 @@ struct struct1 { /* Some functions that can be passed as arguments to other test functions, or called directly. */ - -int add (a, b) -int a, b; +#ifdef PROTOTYPES +int add (int a, int b) +#else +int add (a, b) int a, b; +#endif { return (a + b); } +#ifdef PROTOTYPES +int doubleit (int a) +#else int doubleit (a) int a; +#endif { return (a + a); } @@ -69,20 +77,32 @@ enum enumtype enum_val1 = enumval1; enum enumtype enum_val2 = enumval2; enum enumtype enum_val3 = enumval3; +#ifdef PROTOTYPES +int t_enum_value1 (enum enumtype enum_arg) +#else t_enum_value1 (enum_arg) enum enumtype enum_arg; +#endif { return (enum_arg == enum_val1); } +#ifdef PROTOTYPES +int t_enum_value2 (enum enumtype enum_arg) +#else t_enum_value2 (enum_arg) enum enumtype enum_arg; +#endif { return (enum_arg == enum_val2); } +#ifdef PROTOTYPES +int t_enum_value3 (enum enumtype enum_arg) +#else t_enum_value3 (enum_arg) enum enumtype enum_arg; +#endif { return (enum_arg == enum_val3); } @@ -90,9 +110,13 @@ enum enumtype enum_arg; /* A function that takes a vector of integers (along with an explicit count) and returns their sum. */ +#ifdef PROTOTYPES +int sum_args (int argc, int argv[]) +#else int sum_args (argc, argv) int argc; int argv[]; +#endif { int sumval = 0; int idx; @@ -107,6 +131,15 @@ int argv[]; /* Test that we can call functions that take structs and return members from that struct */ +#ifdef PROTOTYPES +char t_structs_c (struct struct1 tstruct) { return (tstruct.c); } +short t_structs_s (struct struct1 tstruct) { return (tstruct.s); } +int t_structs_i (struct struct1 tstruct) { return (tstruct.i); } +long t_structs_l (struct struct1 tstruct) { return (tstruct.l); } +float t_structs_f (struct struct1 tstruct) { return (tstruct.f); } +double t_structs_d (struct struct1 tstruct) { return (tstruct.d); } +char *t_structs_a (struct struct1 tstruct) { return (tstruct.a); } +#else char t_structs_c (tstruct) struct struct1 tstruct; { return (tstruct.c); } short t_structs_s (tstruct) struct struct1 tstruct; { return (tstruct.s); } int t_structs_i (tstruct) struct struct1 tstruct; { return (tstruct.i); } @@ -114,11 +147,16 @@ long t_structs_l (tstruct) struct struct1 tstruct; { return (tstruct.l); } float t_structs_f (tstruct) struct struct1 tstruct; { return (tstruct.f); } double t_structs_d (tstruct) struct struct1 tstruct; { return (tstruct.d); } char *t_structs_a (tstruct) struct struct1 tstruct; { return (tstruct.a); } +#endif /* Test that calling functions works if there are a lot of arguments. */ +#ifdef PROTOTYPES +int sum10 (int i0, int i1, int i2, int i3, int i4, int i5, int i6, int i7, int i8, int i9) +#else int sum10 (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9) int i0, i1, i2, i3, i4, i5, i6, i7, i8, i9; +#endif { return i0 + i1 + i2 + i3 + i4 + i5 + i6 + i7 + i8 + i9; } @@ -126,27 +164,40 @@ sum10 (i0, i1, i2, i3, i4, i5, i6, i7, i8, i9) /* Gotta have a main to be able to generate a linked, runnable executable, and also provide a useful place to set a breakpoint. */ +#ifdef PROTOTYPES +int main() +#else main () +#endif { #ifdef usestubs set_debug_traps(); breakpoint(); #endif t_structs_c(struct_val1); + return 0; + } /* Functions that expect specific values to be passed and return either 0 or 1, depending upon whether the values were passed incorrectly or correctly, respectively. */ +#ifdef PROTOTYPES +int t_char_values (char char_arg1, char char_arg2) +#else int t_char_values (char_arg1, char_arg2) char char_arg1, char_arg2; +#endif { return ((char_arg1 == char_val1) && (char_arg2 == char_val2)); } int -#ifdef NO_PROTOTYPES +#ifdef PROTOTYPES +t_small_values (char arg1, short arg2, int arg3, char arg4, short arg5, + char arg6, short arg7, int arg8, short arg9, short arg10) +#else t_small_values (arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) char arg1; short arg2; @@ -158,34 +209,47 @@ t_small_values (arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) int arg8; short arg9; short arg10; -#else -t_small_values (char arg1, short arg2, int arg3, char arg4, short arg5, - char arg6, short arg7, int arg8, short arg9, short arg10) #endif { return arg1 + arg2 + arg3 + arg4 + arg5 + arg6 + arg7 + arg8 + arg9 + arg10; } +#ifdef PROTOTYPES +int t_short_values (short short_arg1, short short_arg2) +#else int t_short_values (short_arg1, short_arg2) short short_arg1, short_arg2; +#endif { return ((short_arg1 == short_val1) && (short_arg2 == short_val2)); } +#ifdef PROTOTYPES +int t_int_values (int int_arg1, int int_arg2) +#else int t_int_values (int_arg1, int_arg2) int int_arg1, int_arg2; +#endif { return ((int_arg1 == int_val1) && (int_arg2 == int_val2)); } +#ifdef PROTOTYPES +int t_long_values (long long_arg1, long long_arg2) +#else int t_long_values (long_arg1, long_arg2) long long_arg1, long_arg2; +#endif { return ((long_arg1 == long_val1) && (long_arg2 == long_val2)); } +#ifdef PROTOTYPES +int t_float_values (float float_arg1, float float_arg2) +#else int t_float_values (float_arg1, float_arg2) float float_arg1, float_arg2; +#endif { return ((float_arg1 - float_val1) < DELTA && (float_arg1 - float_val1) > -DELTA @@ -194,13 +258,13 @@ float float_arg1, float_arg2; } int -#ifdef NO_PROTOTYPES +#ifdef PROTOTYPES +t_float_values2 (float float_arg1, float float_arg2) +#else /* In this case we are just duplicating t_float_values, but that is the easiest way to deal with either ANSI or non-ANSI. */ t_float_values2 (float_arg1, float_arg2) float float_arg1, float_arg2; -#else -t_float_values2 (float float_arg1, float float_arg2) #endif { return ((float_arg1 - float_val1) < DELTA @@ -209,8 +273,12 @@ t_float_values2 (float float_arg1, float float_arg2) && (float_arg2 - float_val2) > -DELTA); } +#ifdef PROTOTYPES +int t_double_values (double double_arg1, double double_arg2) +#else int t_double_values (double_arg1, double_arg2) double double_arg1, double_arg2; +#endif { return ((double_arg1 - double_val1) < DELTA && (double_arg1 - double_val1) > -DELTA @@ -218,15 +286,23 @@ double double_arg1, double_arg2; && (double_arg2 - double_val2) > -DELTA); } +#ifdef PROTOTYPES +int t_string_values (char *string_arg1, char *string_arg2) +#else int t_string_values (string_arg1, string_arg2) char *string_arg1, *string_arg2; +#endif { return (!strcmp (string_arg1, string_val1) && !strcmp (string_arg2, string_val2)); } +#ifdef PROTOTYPES +int t_char_array_values (char char_array_arg1[], char char_array_arg2[]) +#else int t_char_array_values (char_array_arg1, char_array_arg2) char char_array_arg1[], char_array_arg2[]; +#endif { return (!strcmp (char_array_arg1, char_array_val1) && !strcmp (char_array_arg2, char_array_val2)); @@ -251,17 +327,25 @@ char char_array_arg1[], char_array_arg2[]; that function indirectly through the function pointer. This would fail on the HPPA. */ +#ifdef PROTOTYPES +int t_func_values (int (*func_arg1)(int, int), int (*func_arg2)(int)) +#else int t_func_values (func_arg1, func_arg2) int (*func_arg1) PARAMS ((int, int)); int (*func_arg2) PARAMS ((int)); +#endif { return ((*func_arg1) (5,5) == (*func_val1) (5,5) && (*func_arg2) (6) == (*func_val2) (6)); } +#ifdef PROTOTYPES +int t_call_add (int (*func_arg1)(int, int), int a, int b) +#else int t_call_add (func_arg1, a, b) int (*func_arg1) PARAMS ((int, int)); int a, b; +#endif { return ((*func_arg1)(a, b)); } diff --git a/gdb/testsuite/gdb.base/callfuncs2.exp b/gdb/testsuite/gdb.base/callfuncs2.exp index 8b17b63..078e467 100644 --- a/gdb/testsuite/gdb.base/callfuncs2.exp +++ b/gdb/testsuite/gdb.base/callfuncs2.exp @@ -19,7 +19,7 @@ # This file was written by Fred Fish. (fnf@cygnus.com) -# SAME tests as in callfuncs.exp but here the inferior program does not call malloc. +# SAME tests as in callfns.exp but here the inferior program does not call malloc. @@ -34,14 +34,8 @@ set testfile "callfuncs2" set srcfile ${testfile}.c set binfile ${objdir}/${subdir}/${testfile} -set prototypes 1 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - set prototypes 0; - # 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 {debug additional_flags=-DNO_PROTOTYPES}] != "" } { 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 @@ -51,6 +45,11 @@ if [get_compiler_info ${binfile}] { return -1; } +if {$hp_aCC_compiler} { + set prototypes 1 +} else { + set prototypes 0 +} # The a29k can't call functions, so don't even bother with this test. @@ -134,13 +133,13 @@ proc do_function_calls {} { # Gcc emits different stabs for the two parameters; the first is # claimed to be a float, the second a double. # dbxout.c in gcc claims this is the desired behavior. - setup_xfail "mn10300-*-*" + setup_xfail "mn10300-*-*" "hppa*-*-*11*" gdb_test "p t_float_values(3.14159,-2.3765)" " = 1" - setup_xfail "mn10300-*-*" + setup_xfail "mn10300-*-*" "hppa*-*-*11*" gdb_test "p t_float_values(float_val1,float_val2)" " = 1" - setup_xfail "mn10300-*-*" + setup_xfail "mn10300-*-*" "hppa*-*-*11*" gdb_test "p t_float_values(3.14159,float_val2)" " = 1" - setup_xfail "mn10300-*-*" + setup_xfail "mn10300-*-*" "hppa*-*-*11*" gdb_test "p t_float_values(float_val1,-2.3765)" " = 1" # Test passing of arguments which might not be widened. @@ -149,7 +148,7 @@ proc do_function_calls {} { # Although PR 5318 mentions SunOS specifically, this seems # to be a generic problem on quite a few platforms. if $prototypes then { - setup_xfail "hppa*-*-*" "sparc-*-*" "mips*-*-*" 5318 + setup_xfail "sparc-*-*" "mips*-*-*" 5318 if {!$gcc_compiled} then { setup_xfail "alpha-dec-osf2*" "i*86-*-sysv4*" 5318 } @@ -193,7 +192,17 @@ proc do_function_calls {} { setup_xfail "powerpc*-*-*" if {!$gcc_compiled && [istarget hppa*-*-hpux*]} then { - gdb_test "p t_func_values(add,func_val2)" "You cannot.*ignored.*" + send_gdb "p t_func_values(add,func_val2)\n" + gdb_expect { + -re "You cannot.*ignored.*" {pass "p t_func_values(add,func_val2)"} + -re "Program received signal SIGBUS, Bus error.*" { + if [istarget hppa*-*-hpux*] { + pass "p t_func_values(add,func_val2)" + } else { + fail "p t_func_values(add,func_val2)" + } + } + } } else { gdb_test "p t_func_values(add,func_val2)" " = 1" } @@ -202,7 +211,17 @@ proc do_function_calls {} { setup_xfail "powerpc*-*-*" if {!$gcc_compiled && [istarget hppa*-*-hpux*]} then { - gdb_test "p t_func_values(func_val1,doubleit)" "You cannot.*ignored.*" + send_gdb "p t_func_values(func_val1,doubleit)\n" + gdb_expect { + -re "You cannot.*ignored.*" {pass "p t_func_values(func_val1,doubleit)"} + -re "Program received signal SIGBUS, Bus error.*" { + if [istarget hppa*-*-hpux*] { + pass "p t_func_values(func_val1,doubleit)" + } else { + fail "p t_func_values(func_val1,doubleit)" + } + } + } } else { gdb_test "p t_func_values(func_val1,doubleit)" " = 1" } @@ -213,7 +232,17 @@ proc do_function_calls {} { setup_xfail "powerpc*-*-*" if {!$gcc_compiled && [istarget hppa*-*-hpux*]} then { - gdb_test "p t_call_add(add,3,4)" "You cannot.*ignored.*" + send_gdb "p t_call_add(add,3,4)\n" + gdb_expect { + -re "You cannot.*ignored.*" {pass "p t_call_add(add,3,4)"} + -re "Program received signal SIGBUS, Bus error.*" { + if [istarget hppa*-*-hpux*] { + pass "p t_call_add(add,3,4)" + } else { + fail "p t_call_add(add,3,4)" + } + } + } } else { gdb_test "p t_call_add(add,3,4)" " = 7" } @@ -262,12 +291,24 @@ gdb_test "set print sevenbit-strings" "" gdb_test "set print address off" "" gdb_test "set width 0" "" -if { ![set_lang_c] } { - gdb_suppress_tests; -} else { +if { $hp_aCC_compiler } { + # Do not set language explicitly to 'C'. This will cause aCC + # tests to fail because promotion rules are different. Just let + # the language be set to the default. + if { ![runto_main] } { gdb_suppress_tests; } + + gdb_test "set overload-resolution 0" ".*" +} else { + if { ![set_lang_c] } { + gdb_suppress_tests; + } else { + if { ![runto_main] } { + gdb_suppress_tests; + } + } } gdb_test "next" ".*" diff --git a/gdb/testsuite/gdb.base/commands.exp b/gdb/testsuite/gdb.base/commands.exp index 72356ec..62d9f10 100644 --- a/gdb/testsuite/gdb.base/commands.exp +++ b/gdb/testsuite/gdb.base/commands.exp @@ -93,6 +93,7 @@ proc progvar_simple_while_test {} { return } + gdb_test "set args 5" "" "set args in progvar_simple_while_test" if { ![runto factorial] } then { gdb_suppress_tests } # Don't depend upon argument passing, since most simulators don't currently # support it. Bash value variable to be what we want. @@ -110,6 +111,7 @@ proc progvar_complex_if_while_test {} { return } + gdb_test "set args 4" "" "set args in progvar_complex_if_while_test" if { ![runto factorial] } then { gdb_suppress_tests } # Don't depend upon argument passing, since most simulators don't currently # support it. Bash value variable to be what we want. @@ -125,6 +127,7 @@ proc if_while_breakpoint_command_test {} { return } + gdb_test "set args 5" "" "set args in if_while_breakpoint_command_test" if { ![runto factorial] } then { gdb_suppress_tests } # Don't depend upon argument passing, since most simulators don't currently # support it. Bash value variable to be what we want. @@ -155,6 +158,7 @@ proc infrun_breakpoint_command_test {} { return } + gdb_test "set args 6" "" "set args in progvar_simple_while_test" if { ![runto factorial] } then { gdb_suppress_tests } # Don't depend upon argument passing, since most simulators don't currently # support it. Bash value variable to be what we want. @@ -177,8 +181,14 @@ proc infrun_breakpoint_command_test {} { } gdb_test "step\nstep\nstep\nstep\nbt\nend" "" \ "commands in infrun_breakpoint_command_test #2" - - gdb_test "continue" "Breakpoint \[0-9\]*, factorial \\(value=5\\).*at.* + + if { [istarget "hppa*-hp-hpux*"] } { + gdb_test "continue" \ + "Continuing.*.*.*Breakpoint \[0-9\]*, factorial \\(value=5\\).*at.*\[0-9\]*\[ \]*if \\(value > 1\\) \{.*\[0-9\]*\[ \]*value \\*= factorial \\(value - 1\\);.*" \ + "contiune in infrun_breakpoint_command_test" + } else { + gdb_test "continue" \ + "Breakpoint \[0-9\]*, factorial \\(value=5\\).*at.* \[0-9\]*\[ \]*if \\(value > 1\\) \{.* \[0-9\]*\[ \]*value \\*= factorial \\(value - 1\\);.* factorial \\(value=4\\) at.*\[0-9\]*\[ \]*if \\(value > 1\\) \{.* @@ -190,7 +200,9 @@ factorial \\(value=3\\) at .* #2 \[0-9a-fx\]* in factorial \\(value=5\\).* #3 \[0-9a-fx\]* in factorial \\(value=6\\).* #4 \[0-9a-fx\]* in main \\(.*\\).*" \ - "continue in infrun_breakpoint_command_test"; + "continue in infrun_breakpoint_command_test"; + } + gdb_stop_suppressing_tests; } @@ -200,6 +212,7 @@ proc breakpoint_command_test {} { return } + gdb_test "set args 6" "" "set args in breakpoint_command_test" if { ![runto factorial] } then { gdb_suppress_tests; } # Don't depend upon argument passing, since most simulators don't currently # support it. Bash value variable to be what we want. @@ -207,7 +220,7 @@ proc breakpoint_command_test {} { delete_breakpoints gdb_test "break factorial" "Breakpoint.*at.*" "break factorial #2" gdb_test "commands\nprintf \"Now the value is %d\\n\", value\nend" \ - "Type commands.*\nEnd with.*" "commands in breakpoint_command_test" + "End with.*" "commands in breakpoint_command_test" gdb_test "continue" "Breakpoint \[0-9\]*, factorial.*Now the value is 5" \ "continue in breakpoint_command_test" gdb_test "print value" " = 5" "print value in breakpoint_command_test" @@ -236,7 +249,84 @@ proc user_defined_command_test {} { gdb_test "show user mycommand" "while.*set.*if.*p/x.*else.*p/x.*end.*" "display user command in user_defined_command_test" } +proc watchpoint_command_test {} { + global noargs + global gdb_prompt + + if [target_info exists noargs] { + verbose "Skipping watchpoint_command_test because of noargs." + return + } + + gdb_test "set args 6" "" "set args in watchpoint_command_test" + if { ![runto factorial] } then { return } + delete_breakpoints + + # Verify that we can create a watchpoint, and give it a commands + # list that continues the inferior. We set the watchpoint on a + # local variable, too, so that it self-deletes when the watched + # data goes out of scope. + # + # What should happen is: Each time the watchpoint triggers, it + # continues the inferior. Eventually, the watchpoint will self- + # delete, when the watched variable is out of scope. But by that + # time, the inferior should have exited. GDB shouldn't crash or + # anything untoward as a result of this. + # + set wp_id -1 + + send_gdb "watch local_var\n" + gdb_expect { + -re ".*\[Ww\]atchpoint (\[0-9\]*): local_var.*$gdb_prompt $" { + set wp_id $expect_out(1,string) + pass "watch local_var" + } + -re "$gdb_prompt $"\ + {fail "watch local_var"} + timeout {fail "(timeout) watch local_var"} + } + if {$wp_id == -1} {return} + + send_gdb "commands $wp_id\n" + gdb_expect { + -re "Type commands for when breakpoint $wp_id is hit, one per line.*>"\ + {pass "begin commands on watch"} + -re "$gdb_prompt $"\ + {fail "begin commands on watch"} + timeout {fail "(timeout) begin commands on watch"} + } + send_gdb "print value\n" + gdb_expect { + -re ">"\ + {pass "add print command to watch"} + -re "$gdb_prompt $"\ + {fail "add print command to watch"} + timeout {fail "(timeout) add print command to watch"} + } + send_gdb "continue\n" + gdb_expect { + -re ">"\ + {pass "add continue command to watch"} + -re "$gdb_prompt $"\ + {fail "add continue command to watch"} + timeout {fail "(timeout) add continue command to watch"} + } + send_gdb "end\n" + gdb_expect { + -re "$gdb_prompt $"\ + {pass "begin commands on watch"} + timeout {fail "(timeout) begin commands on watch"} + } + send_gdb "continue\n" + gdb_expect { + -re "Continuing.*\[Ww\]atchpoint $wp_id deleted because the program has left the block in.*which its expression is valid.*run.c:57.*"\ + {pass "continue with watch"} + -re "$gdb_prompt $"\ + {fail "continue with watch"} + timeout {fail "(timeout) continue with watch"} + } +} proc test_command_prompt_position {} { global gdb_prompt @@ -295,6 +385,7 @@ if_while_breakpoint_command_test infrun_breakpoint_command_test breakpoint_command_test user_defined_command_test +watchpoint_command_test test_command_prompt_position diff --git a/gdb/testsuite/gdb.base/completion.exp b/gdb/testsuite/gdb.base/completion.exp index b4d97f0..327f37d 100644 --- a/gdb/testsuite/gdb.base/completion.exp +++ b/gdb/testsuite/gdb.base/completion.exp @@ -52,9 +52,10 @@ if $tracelevel then { } -#skip all these tests for now (FIXME) - -continue +if { ![istarget "hppa*-hp-hpux*"] } { + #skip all these tests for now (FIXME) + continue +} global usestubs @@ -71,6 +72,10 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } +if [get_compiler_info ${binfile}] { + return -1; +} + gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir @@ -81,7 +86,7 @@ if ![runto_main] then { } set oldtimeout1 $timeout -set timeout [expr $timeout + 500] +set timeout 30 send_gdb "hfgfh\t" @@ -162,31 +167,33 @@ sleep 1 gdb_expect { -re "^p\\\x07$"\ { send_gdb "\n" + sleep 1 gdb_expect { -re "The history is empty\\..*$gdb_prompt $"\ { pass "complete 'p'"} -re ".*$gdb_prompt $" { fail "complete 'p'"} - timeout {fail "(timeout) complete 'p'"} + timeout {fail "(timeout) complete 'p' 2"} } } -re ".*$gdb_prompt $" { fail "complete 'p'" } - timeout { fail "(timeout) complete 'p'" } + timeout { fail "(timeout) complete 'p' 1" } } send_gdb "p \t" -sleep 1 +sleep 3 gdb_expect { -re "^p \\\x07$"\ { send_gdb "\n" + sleep 1 gdb_expect { -re "The history is empty\\..*$gdb_prompt $"\ { pass "complete 'p '"} -re ".*$gdb_prompt $" { fail "complete 'p '"} - timeout {fail "(timeout) complete 'p '"} + timeout {fail "(timeout) complete 'p ' 1"} } } -re ".*$gdb_prompt $" { fail "complete 'p '" } - timeout { fail "(timeout) complete 'p '" } + timeout { fail "(timeout) complete 'p ' 2" } } @@ -283,7 +290,7 @@ gdb_expect { -re "^info $"\ { send_gdb "\n" gdb_expect { - -re "\"info\" must be followed by the name of an info command\\.\r\nList of info subcommands:\r\n\r\ninfo address.*info watchpoints.*\r\n\r\nType \"help info\" followed by info subcommand name for full documentation.\r\nCommand name abbreviations are allowed if unambiguous\\..*$gdb_prompt $"\ + -re "\"info\" must be followed by the name of an info command\\.\r\nList of info subcommands:\r\n\r\n.*info address.*info watchpoints.*\r\n\r\nType \"help info\" followed by info subcommand name for full documentation.\r\nCommand name abbreviations are allowed if unambiguous\\..*$gdb_prompt $"\ { pass "complete 'info'"} -re ".*$gdb_prompt $" { fail "complete 'info'"} timeout {fail "(timeout) complete 'info'"} @@ -299,7 +306,7 @@ gdb_expect { -re "^info \\\x07$"\ { send_gdb "\n" gdb_expect { - -re "\"info\" must be followed by the name of an info command\\.\r\nList of info subcommands:\r\n\r\ninfo address.*Type \"help info\" followed by info subcommand name for full documentation.\r\nCommand name abbreviations are allowed if unambiguous\\..*$gdb_prompt $"\ + -re "\"info\" must be followed by the name of an info command\\.\r\nList of info subcommands:\r\n\r\n.*info address.*Type \"help info\" followed by info subcommand name for full documentation.\r\nCommand name abbreviations are allowed if unambiguous\\..*$gdb_prompt $"\ { pass "complete 'info '"} -re ".*$gdb_prompt $" { fail "complete 'info '"} timeout {fail "(timeout) complete 'info '"} @@ -313,7 +320,7 @@ gdb_expect { send_gdb "info \t" sleep 1 gdb_expect { - -re "^info \0x7$"\ + -re "^info \\\x07$"\ { send_gdb "\t" gdb_expect { -re "address.*types.*$gdb_prompt info $"\ @@ -368,26 +375,46 @@ gdb_expect { send_gdb "p 'a\t" sleep 1 -gdb_expect { - -re "^p 'a\\\x07$"\ - { send_gdb "\t" - gdb_expect { - -re "a64l.*atol.*$gdb_prompt p .a$"\ - { send_gdb "\n" - gdb_expect { - -re "Invalid character constant\\..*$gdb_prompt $"\ - { pass "complete (2) 'p \'a'"} - -re ".*$gdb_prompt $" { fail "complete (2) 'p \'a'"} - timeout {fail "(timeout) complete (2) 'p \'a'"} - } - } - -re ".*$gdb_prompt $" { fail "complete (2) 'p \'a'"} - timeout {fail "(timeout) complete (2) 'p \'a'"} - } - } - -re ".*$gdb_prompt $" { fail "complete (2) 'p \'a'" } - timeout { fail "(timeout) complete (2) 'p \'a'" } - } +gdb_expect { + -re "^p 'a\\\x07$" { + send_gdb "\t" + gdb_expect { + -re "a64l.*atol.*$gdb_prompt p .a$" { + send_gdb "\n" + gdb_expect { + -re "Invalid character constant\\..*$gdb_prompt $" { + pass "complete (2) 'p \'a'" + } + -re ".*$gdb_prompt $" { fail "complete (2) 'p \'a'" } + timeout { fail "(timeout) complete (2) 'p \'a'" } + } + } + -re "(There are $decimal possibilities\\. Do you really\r\nwish to see them all.|Display all $decimal possibilities.) \\(y or n\\)$" { + send_gdb "n" + gdb_expect { + -re "\\(gdb\\) p 'a$" { + send_gdb "\n" + gdb_expect { + -re "Invalid character constant\\..*$gdb_prompt $" { + pass "complete (2) 'p \'a'" + } + -re ".*$gdb_prompt $" { + fail "complete (2) 'p \'a'" + } + timeout { fail "(timeout) complete (2) 'p \'a'" } + } + } + -re ".*$gdb_prompt $" { fail "complete (2) 'p \'a'" } + timeout { fail "(timeout) complete (2) 'p \'a'" } + } + } + -re ".*$gdb_prompt $" { fail "complete (2) 'p \'a'" } + timeout { fail "(timeout) complete (2) 'p \'a'" } + } + } + -re ".*$gdb_prompt $" { fail "complete (2) 'p \'a'" } + timeout { fail "(timeout) complete (2) 'p \'a'" } +} send_gdb "p b-a\t" @@ -408,57 +435,79 @@ gdb_expect { send_gdb "p b-a\t" sleep 1 -gdb_expect { - -re "^p b-a\\\x07$"\ - { send_gdb "\t" - gdb_expect { - -re "a64l.*atol.*$gdb_prompt p b-a$"\ - { send_gdb "\n" - gdb_expect { - -re "No symbol \"b\" in current context\\..*$gdb_prompt $"\ - { pass "complete (2) 'p b-a'"} - -re ".*$gdb_prompt $" { fail "complete (2) 'p b-a'"} - timeout {fail "(timeout) complete (2) 'p b-a'"} - } - } - -re ".*$gdb_prompt $" { fail "complete (2) 'p b-a'"} - timeout {fail "(timeout) complete (2) 'p b-a'"} - } - } - -re ".*$gdb_prompt $" { fail "complete (2) 'p b-a'" } - timeout { fail "(timeout) complete (2) 'p b-a'" } +gdb_expect { + -re "^p b-a\\\x07$" { + send_gdb "\t" + gdb_expect { + -re "a64l.*atol.*$gdb_prompt p b-a$" { + send_gdb "\n" + gdb_expect { + -re "No symbol \"b\" in current context\\..*$gdb_prompt $" { + pass "complete (2) 'p b-a'" + } + -re ".*$gdb_prompt $" { fail "complete (2) 'p b-a'" } + timeout { fail "(timeout) complete (2) 'p b-a'" } + } + } + -re "(There are $decimal possibilities\\. Do you really\r\nwish to see them all.|Display all $decimal possibilities.) \\(y or n\\)$" { + send_gdb "n" + gdb_expect { + -re "\\(gdb\\) p b-a$" { + send_gdb "\n" + gdb_expect { + -re "No symbol \"b\" in current context\\..*$gdb_prompt $" { + pass "complete (2) 'p b-a'" + } + -re ".*$gdb_prompt $" { + fail "complete (2) 'p b-a'" + } + timeout { fail "(timeout) complete (2) 'p b-a'" } + } + } + -re ".*$gdb_prompt $" { fail "complete (2) 'p b-a'" } + timeout { fail "(timeout) complete (2) 'p b-a'" } + } + } + -re ".*$gdb_prompt $" { fail "complete (2) 'p b-a'" } + timeout { fail "(timeout) complete (2) 'p b-a'" } } - + } + -re ".*$gdb_prompt $" { fail "complete (2) 'p b-a'" } + timeout { fail "(timeout) complete (2) 'p b-a'" } +} send_gdb "p b-\t" sleep 1 gdb_expect { - -re "^p b-\\\x07$"\ - { send_gdb "\t" - gdb_expect { - -re "There are $decimal possibilities\\. Do you really\r\nwish to see them all. \\(y or n\\)$"\ - { send_gdb "n" - gdb_expect { - -re "\\(gdb\\) p b-$"\ - { send_gdb "\n" - gdb_expect { - -re "No symbol \"b\" in current context\\..*$gdb_prompt $"\ - { pass "complete (2) 'p b-'"} - -re ".*$gdb_prompt $" { fail "complete (2) 'p b-'"} - timeout {fail "(timeout) complete (2) 'p b-'"} - } - } - -re ".*$gdb_prompt $" { fail "complete (2) 'p b-'"} - timeout {fail "(timeout) complete (2) 'p b-'"} - } - } - -re ".*$gdb_prompt $" { fail "complete (2) 'p b-'"} - timeout {fail "(timeout) complete (2) 'p b-'"} - } - } - -re ".*$gdb_prompt $" { fail "complete (2) 'p b-'" } - timeout { fail "(timeout) complete (2) 'p b-'" } - } + -re "^p b-\\\x07$" { + send_gdb "\t" + gdb_expect { + -re "(There are $decimal possibilities\\. Do you really\r\nwish to see them all.|Display all $decimal possibilities.) \\(y or n\\)$" { + send_gdb "n" + gdb_expect { + -re "\\(gdb\\) p b-$" { + send_gdb "\n" + gdb_expect { + -re "No symbol \"b\" in current context\\..*$gdb_prompt $" { + pass "complete (2) 'p b-'" + } + -re ".*$gdb_prompt $" { + fail "complete (2) 'p b-'" + } + timeout { fail "(timeout) complete (2) 'p b-'" } + } + } + -re ".*$gdb_prompt $" { fail "complete (2) 'p b-'" } + timeout { fail "(timeout) complete (2) 'p b-'" } + } + } + -re ".*$gdb_prompt $" { fail "complete (2) 'p b-'" } + timeout { fail "(timeout) complete (2) 'p b-'" } + } + } + -re ".*$gdb_prompt $" { fail "complete (2) 'p b-'" } + timeout { fail "(timeout) complete (2) 'p b-'" } +} send_gdb "file ${objdir}/Make\t" sleep 1 @@ -487,7 +536,7 @@ gdb_expect { send_gdb "file ${srcdir}/gdb.base/a1\t" sleep 1 gdb_expect { - -re "^file ${srcdir}/gdb.base/.*'a1.*-selftest\\.exp' $"\ + -re "^file ${srcdir}/gdb.base/.*'a1.*-self\\.exp' $"\ { send_gdb "\n" gdb_expect { -re "\r\nA program is being debugged already\\. Kill it\\? \\(y or n\\) $" @@ -513,13 +562,14 @@ send_gdb "info func mark\t" sleep 1 gdb_expect { -re "^info func mark.*er$"\ - { send_gdb "\t\t" + { + send_gdb "\t\t" sleep 3 gdb_expect { - -re "marker1 marker2 marker3 marker4.*$gdb_prompt info func marker$"\ + -re "marker1.*$gdb_prompt info func marker$"\ { send_gdb "\n" gdb_expect { - -re "All functions matching regular expression \"marker\":\r\n\r\nFile.*break.c:\r\nint marker1\\(\\);\r\nint marker2\\(int\\).*marker3\\(char.*char.*\\);\r\n$gdb_prompt $"\ + -re "All functions matching regular expression \"marker\":\r\n\r\nFile.*break.c:\r\nint marker1\\(.*\\);\r\nint marker2\\(int\\).*marker3\\(char.*char.*\\).*marker4\\(long\\);\r\n$gdb_prompt $"\ { pass "complete 'info func mar'"} -re ".*$gdb_prompt $" { fail "complete 'info func mar'"} timeout {fail "(timeout) complete 'info func mar'"} @@ -540,6 +590,8 @@ gdb_expect { -re "ask.*child.*parent.*$gdb_prompt set follow-fork-mode $"\ { send_gdb "\n" gdb_expect { + -re "Requires an argument.*parent.*child.*ask.*$gdb_prompt $"\ + { pass "complete 'set follow-fork-mode'"} -re "Ambiguous item \"\"\\..*$gdb_prompt $"\ { pass "complete 'set follow-fork-mode'"} -re ".*$gdb_prompt $" { fail "complete 'set follow-fork-mode'"} diff --git a/gdb/testsuite/gdb.base/condbreak.c b/gdb/testsuite/gdb.base/condbreak.c index 491d6e5..6acbf9b 100644 --- a/gdb/testsuite/gdb.base/condbreak.c +++ b/gdb/testsuite/gdb.base/condbreak.c @@ -29,6 +29,7 @@ char *arg; #else /* ! vxworks */ # include <stdio.h> +# include <stdlib.h> #endif /* ! vxworks */ /* @@ -38,20 +39,34 @@ char *arg; * of gcc have or have had problems with this). */ +#ifdef PROTOTYPES +int marker1 (void) { return (0); } +int marker2 (int a) { return (1); } +void marker3 (char *a, char *b) {} +void marker4 (long d) {} +#else int marker1 () { return (0); } int marker2 (a) int a; { return (1); } void marker3 (a, b) char *a, *b; {} void marker4 (d) long d; {} +#endif /* * This simple classical example of recursion is useful for * testing stack backtraces and such. */ +#ifdef PROTOTYPES +int factorial(int); + +int +main (int argc, char **argv, char **envp) +#else int main (argc, argv, envp) int argc; char *argv[], **envp; +#endif { #ifdef usestubs set_debug_traps(); @@ -70,8 +85,12 @@ char *argv[], **envp; return 0; } +#ifdef PROTOTYPES +int factorial (int value) +#else int factorial (value) int value; +#endif { if (value > 1) { value *= factorial (value - 1); diff --git a/gdb/testsuite/gdb.base/condbreak.exp b/gdb/testsuite/gdb.base/condbreak.exp index 281616b..8f8f11c 100644 --- a/gdb/testsuite/gdb.base/condbreak.exp +++ b/gdb/testsuite/gdb.base/condbreak.exp @@ -43,6 +43,10 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } +if [get_compiler_info ${binfile}] { + return -1; +} + gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir @@ -74,8 +78,8 @@ gdb_test "delete 2" \ # # test conditional break at line number # -gdb_test "break 64 if 1==1" \ - "Breakpoint.*at.* file .*$srcfile, line 64\\." \ +gdb_test "break 79 if 1==1" \ + "Breakpoint.*at.* file .*$srcfile, line 79\\." \ "break line if condition" gdb_test "delete 3" \ @@ -92,8 +96,8 @@ gdb_test "break marker1 if (1==1)" \ # # test conditional break at line number # -gdb_test "break 64 if (1==1)" \ - "Breakpoint.*at.* file .*$srcfile, line 64\\." \ +gdb_test "break 79 if (1==1)" \ + "Breakpoint.*at.* file .*$srcfile, line 79\\." \ "break line if (condition)" gdb_test "break marker2 if (a==43)" \ @@ -104,15 +108,23 @@ gdb_test "break marker2 if (a==43)" \ # check to see what breakpoints are set # -set main_line 60 +if {$hp_aCC_compiler} { + set marker1_proto "\\(void\\)" + set marker2_proto "\\(int\\)" +} else { + set marker1_proto "" + set marker2_proto "" +} + +set main_line 75 gdb_test "info break" \ "Num Type\[ \]+Disp Enb Address\[ \]+What.* \[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$main_line.* -\[0-9\]+\[\t \]+breakpoint keep y.* in marker1 at .*$srcfile:41.* +\[0-9\]+\[\t \]+breakpoint keep y.* in marker1$marker1_proto at .*$srcfile:4\[38\].* \[\t \]+stop only if 1 == 1.* -\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:64.* +\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:79.* \[\t \]+stop only if 1 == 1.* -\[0-9\]+\[\t \]+breakpoint keep y.* in marker2 at .*$srcfile:42.* +\[0-9\]+\[\t \]+breakpoint keep y.* in marker2$marker2_proto at .*$srcfile:4\[49\].* \[\t \]+stop only if a == 43.*" \ "breakpoint info" @@ -127,19 +139,21 @@ rerun_to_main # # run until the breakpoint at a line number # -gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:64.*64\[\t \]+printf.*factorial.*" \ +gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, main \\(argc=.*, argv=.*, envp=.*\\) at .*$srcfile:79.*79\[\t \]+printf.*factorial.*" \ "run until breakpoint set at a line number" # # run until the breakpoint at marker1 # -gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, marker1 \\(\\) at .*$srcfile:41.*41\[\t \]+.*" \ +gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, marker1 \\(\\) at .*$srcfile:4\[38\].*4\[38\]\[\t \]+.*" \ "run until breakpoint at marker1" # # run until the breakpoint at marker2 # -gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, marker2 \\(a=43\\) at .*$srcfile:42.*42\[\t \]+.*" \ +#See 11512CLLbs +setup_xfail hppa2.0w-*-* +gdb_test "continue" "Continuing\\..*Breakpoint \[0-9\]+, marker2 \\(a=43\\) at .*$srcfile:4\[49\].*4\[49\]\[\t \]+.*" \ "run until breakpoint at marker2" diff --git a/gdb/testsuite/gdb.base/constvars.exp b/gdb/testsuite/gdb.base/constvars.exp index 518e5ca..312b524 100644 --- a/gdb/testsuite/gdb.base/constvars.exp +++ b/gdb/testsuite/gdb.base/constvars.exp @@ -41,8 +41,14 @@ set testfile "constvars" 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." +if [istarget "hppa*-*-*"] { + set lang "c++" +} else { + set lang "" +} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [concat debug $lang]] != "" } { + 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 @@ -94,7 +100,7 @@ send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $" if {$gcc_compiled} then { setup_xfail "*-*-*" } send_gdb "ptype qux1\n" gdb_expect { - -re "type = int \\(const char, const char &, const char *, char * const\\).*$gdb_prompt $" { + -re "type = int \\(const char, const char, const char \\*, char \\* const\\).*$gdb_prompt $" { pass "ptype qux1" } -re ".*$gdb_prompt $" { fail "ptype qux1" } @@ -150,102 +156,100 @@ proc do_constvar_tests {} { gdb_test "ptype languid" "type = const double" gdb_test "print *legend" " = 66 'B'" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype legend" "type = const char *" + gdb_test "ptype legend" "type = const char \\*" gdb_test "print *legerdemain" " = 10 '\\\\n'" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype legerdemain" "type = const unsigned char *" + gdb_test "ptype legerdemain" "type = const unsigned char \\*" gdb_test "print *leniency" " = 20" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype leniency" "type = const short *" + gdb_test "ptype leniency" "type = const short \\*" gdb_test "print *leonine" " = 30" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype leonine" "type = const unsigned short *" + gdb_test "ptype leonine" "type = const unsigned short \\*" gdb_test "print *lesion" " = 40" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype lesion" "type = const long *" + gdb_test "ptype lesion" "type = const long \\*" gdb_test "print *lethal" " = 50" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype lethal" "type = const unsigned long *" + gdb_test "ptype lethal" "type = const unsigned long \\*" gdb_test "print *lethargic" " = 60" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype lethargic" "type = const float *" + gdb_test "ptype lethargic" "type = const float \\*" gdb_test "print *levity" " = 70" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype levity" "type = const double *" + gdb_test "ptype levity" "type = const double \\*" gdb_test "print *lewd" " = 65 'A'" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype lewd" "type = const char * const" + gdb_test "ptype lewd" "type = const char \\* const" gdb_test "print *lexicographer" " = 1 '.001'" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype lexicographer" "type = const unsigned char * const" + gdb_test "ptype lexicographer" "type = const unsigned char \\* const" gdb_test "print *lexicon" " = 2" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype lexicon" "type = const short * const" + gdb_test "ptype lexicon" "type = const short \\* const" gdb_test "print *liaison" " = 3" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype liaison" "type = const unsigned short * const" + gdb_test "ptype liaison" "type = const unsigned short \\* const" gdb_test "print *libation" " = 4" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype libation" "type = const long * const" + gdb_test "ptype libation" "type = const long \\* const" gdb_test "print *libelous" " = 5" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype libelous" "type = const unsigned long * const" + gdb_test "ptype libelous" "type = const unsigned long \\* const" gdb_test "print *libertine" " = 6" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype libertine" "type = const float * const" + gdb_test "ptype libertine" "type = const float \\* const" gdb_test "print *libidinous" " = 7" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype libidinous" "type = const double * const" + gdb_test "ptype libidinous" "type = const double \\* const" gdb_test "print *languish" " = 65 'A'" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype languish" "type = const char *" + gdb_test "ptype languish" "type = const char \\*" gdb_test "print *languor" " = 1 '.001'" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype languor" "type = const unsigned char *" + gdb_test "ptype languor" "type = const unsigned char \\*" gdb_test "print *lank" " = 2" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype lank" "type = const short *" + gdb_test "ptype lank" "type = const short \\*" gdb_test "print *lapidary" " = 3" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype lapidary" "type = const unsigned short *" + gdb_test "ptype lapidary" "type = const unsigned short \\*" gdb_test "print *larceny" " = 4" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype larceny" "type = const long *" + gdb_test "ptype larceny" "type = const long \\*" gdb_test "print *largess" " = 5" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype largess" "type = const unsigned long *" + gdb_test "ptype largess" "type = const unsigned long \\*" gdb_test "print *lascivious" " = 6" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype lascivious" "type = const float *" + gdb_test "ptype lascivious" "type = const float \\*" gdb_test "print *lassitude" " = 7" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype lassitude" "type = const double *" + gdb_test "ptype lassitude" "type = const double \\*" gdb_test "print *lamprey" " = 66 'B'" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype lamprey" "type = char * const" + gdb_test "ptype lamprey" "type = char \\* const" gdb_test "print *lariat" " = 10 '\\\\n'" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype lariat" "type = unsigned char * const" + gdb_test "ptype lariat" "type = unsigned char \\* const" gdb_test "print *laudanum" " = 20" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype laudanum" "type = short * const" + gdb_test "ptype laudanum" "type = short \\* const" gdb_test "print *lecithin" " = 30" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype lecithin" "type = unsigned short * const" + gdb_test "ptype lecithin" "type = unsigned short \\* const" gdb_test "print *leviathan" " = 40" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype leviathan" "type = long * const" + gdb_test "ptype leviathan" "type = long \\* const" gdb_test "print *libretto" " = 50" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype libretto" "type = unsigned long * const" + gdb_test "ptype libretto" "type = unsigned long \\* const" gdb_test "print *lissome" " = 60" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype lissome" "type = float * const" + gdb_test "ptype lissome" "type = float \\* const" gdb_test "print *locust" " = 70" if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype locust" "type = double * const" - if {$gcc_compiled} then { setup_xfail "*-*-*" } - gdb_test "ptype radiation" "type = const char &" + gdb_test "ptype locust" "type = double \\* const" } do_constvar_tests diff --git a/gdb/testsuite/gdb.base/corefile.exp b/gdb/testsuite/gdb.base/corefile.exp index 83b78c4..b267730 100644 --- a/gdb/testsuite/gdb.base/corefile.exp +++ b/gdb/testsuite/gdb.base/corefile.exp @@ -183,13 +183,13 @@ gdb_test "print coremaker_data" "\\\$$decimal = 202" gdb_test "print coremaker_bss" "\\\$$decimal = 10" gdb_test "print coremaker_ro" "\\\$$decimal = 201" -if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" } gdb_test "print func2::coremaker_local" "\\\$$decimal = {0, 1, 2, 3, 4}" # Somehow we better test the ability to read the registers out of the core # file correctly. I don't think the other tests do this. gdb_test "bt" "abort.*func2.*func1.*main.*" "backtrace in corefile.exp" +gdb_test "up" "#\[0-9\]* *\[0-9xa-fH'\]* in .* \\(\\).*" "up in corefile.exp" # Test ability to read mmap'd data @@ -217,7 +217,8 @@ gdb_expect { # test reinit_frame_cache gdb_load ${binfile} +# HP defect CLLbs17002 setup_xfail "*-*-*" -gdb_test "up" "#\[0-9\]* *\[0-9xa-fH'\]* in .* \\(\\)" "up in corefile.exp" +gdb_test "up" "#\[0-9\]* *\[0-9xa-fH'\]* in .* \\(\\)" "up in corefile.exp (reinit)" gdb_test "core" "No core file now." diff --git a/gdb/testsuite/gdb.base/coremaker.c b/gdb/testsuite/gdb.base/coremaker.c index 56239e9..4bb16d4 100644 --- a/gdb/testsuite/gdb.base/coremaker.c +++ b/gdb/testsuite/gdb.base/coremaker.c @@ -6,6 +6,8 @@ #include <fcntl.h> #include <sys/mman.h> #include <signal.h> +#include <stdlib.h> +#include <unistd.h> #ifndef __STDC__ #define const /**/ @@ -33,7 +35,6 @@ void mmapdata () { int j, fd; - extern void *malloc (); /* Allocate and initialize a buffer that will be used to write the file that is later mapped in. */ @@ -112,9 +113,10 @@ func1 () func2 (); } -main () +int main () { mmapdata (); func1 (); + return 0; } diff --git a/gdb/testsuite/gdb.base/default.exp b/gdb/testsuite/gdb.base/default.exp index 2a342aa..528d5a9 100644 --- a/gdb/testsuite/gdb.base/default.exp +++ b/gdb/testsuite/gdb.base/default.exp @@ -67,6 +67,11 @@ if ![target_info exists use_gdb_stub] { setup_xfail "mips-idt-*" "a29k-*-udi" gdb_test "backtrace" "No stack." + + # ba and bac are no longer unique command prefixes. So these tests + # elict an error from GDB. + # GDB needs to be fixed to map unique alias here for ba bac. + # foreach i "bt ba bac" { setup_xfail "mips-idt-*" "a29k-*-udi" gdb_test $i "No stack." "backtrace \"$i\" abbreviation" @@ -335,6 +340,7 @@ gdb_test "info types" "All defined types:" "info types" #test info variables gdb_test "info variables" "All defined variables:" "info variables" #test info warranty +setup_xfail "hppa*-hp-hpux*" gdb_test "info warranty" "NO WARRANTY.*\[\r\n\]+ *11. *BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY.*\[\r\n\]+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN.*\[\r\n\]+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES.*\[\r\n\]+PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED.*\[\r\n\]+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF.*\[\r\n\]+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS.*\[\r\n\]+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE.*\[\r\n\]+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,.*\[\r\n\]+REPAIR OR CORRECTION..*\[\r\n\]+ *12. *IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING.*\[\r\n\]+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR.*\[\r\n\]+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,.*\[\r\n\]+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING.*\[\r\n\]+OUT OF THE USE OR INABILITY TO USE THE PROGRAM .INCLUDING BUT NOT LIMITED.*\[\r\n\]+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY.*\[\r\n\]+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER.*\[\r\n\]+PROGRAMS., EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE.*\[\r\n\]+POSSIBILITY OF SUCH DAMAGES.*" "info warranty" #test info watchpoints gdb_test "info watchpoints" "No breakpoints or watchpoints." "info watchpoints" @@ -646,7 +652,7 @@ gdb_test "show values" "" "show values" #test show verbose gdb_test "show verbose" "Verbose printing of informational messages is o.*|Verbosity is off.*" "show verbose" #test show version - +setup_xfail "hppa*-hp-hpux*" gdb_test "show version" "GNU gdb \[0-9\.\]*.*\[\r\n\]+Copyright \[0-9\]* Free Software Foundation, Inc.*\[\r\n\]+GDB is free software, covered by the GNU General Public License, and you are.*\[\r\n\]+welcome to change it and/or distribute copies of it under certain conditions.*\[\r\n\]+Type \"show copying\" to see the conditions.*\[\r\n\]+There is absolutely no warranty for GDB. Type \"show warranty\" for details.*\[\r\n\]+This GDB was configured as .*|GDB is free software and you are welcome to distribute copies of it.*\[\r\n\]+ under certain conditions; type \"show copying\" to see the conditions..*\[\r\n\]+There is absolutely no warranty for GDB; type \"show warranty\" for details..*\[\r\n\]+GDB.*Copyright \[0-9\]* Free Software Foundation, Inc.*" "show version" #test show width gdb_test "show width" "Number of characters gdb thinks are in a line is.*" "show width" @@ -719,8 +725,7 @@ gdb_expect { if ![istarget "*-*-udi*"] then { send_gdb "target remote\n" gdb_expect { - -re "To open a remote debug connection, you need to specify what.* -serial device is attached to the remote system .e.g. /dev/ttya.*$gdb_prompt $"\ + -re "To open a remote debug connection, you need to specify what.*serial.*device is attached to the remote system .e.g. /dev/ttya.*$gdb_prompt $"\ { pass "target remote" } -re ".*A program is being debugged already. Kill it. .y or n.*$" { send_gdb "n\n" @@ -792,6 +797,16 @@ setup_xfail "a29k-*-udi" gdb_test "where" "No stack." "where" #test x #The case in which it prints a number is for vxgdb. -gdb_test "x" "0x0:.*0x\[0-9\]*|0x0:.*Cannot access memory at address 0x0." "x" +send_gdb "x\n" +gdb_expect { + -re "0x0:.*Cannot access memory at address 0x0..*$gdb_prompt $" { + pass "x" + } + -re "0x0:.*Error accessing memory address 0x0:.*$gdb_prompt $" { + pass "x" + } + -re ".*$gdb_prompt $" { fail "x" } + timeout { fail "(timeout) x" } +} gdb_exit diff --git a/gdb/testsuite/gdb.base/define.exp b/gdb/testsuite/gdb.base/define.exp index 1cd06a9..d4423da 100644 --- a/gdb/testsuite/gdb.base/define.exp +++ b/gdb/testsuite/gdb.base/define.exp @@ -68,7 +68,7 @@ gdb_expect { # send_gdb "nextwhere\n" gdb_expect { - -re ".*64\[ \t\]*printf.*#0\[ \t\]*main.*:64.*$gdb_prompt $"\ + -re ".*79\[ \t\]*printf.*#0\[ \t\]*main.*:79.*$gdb_prompt $"\ {pass "use user command: nextwhere"} -re "$gdb_prompt $"\ {fail "use user command: nextwhere"} @@ -224,7 +224,7 @@ gdb_expect { send_gdb "next\n" gdb_expect { - -re "#0\[ \t\]*main.*:66.*$gdb_prompt $"\ + -re "#0\[ \t\]*main.*:81.*$gdb_prompt $"\ {pass "use hook-stop command"} -re "$gdb_prompt $"\ {fail "use hook-stop command"} diff --git a/gdb/testsuite/gdb.base/display.exp b/gdb/testsuite/gdb.base/display.exp index 638072c..59ac18d 100644 --- a/gdb/testsuite/gdb.base/display.exp +++ b/gdb/testsuite/gdb.base/display.exp @@ -46,6 +46,15 @@ gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} +# Some coverage stuff +# +gdb_test "kill" ".*The program is not being run.*" "" +gdb_test "detach" ".*" "" +gdb_test "run" ".*" "" + +gdb_load ${binfile} +gdb_test "kill" ".*" "" +gdb_test "detach" ".*" "" # Ok, on to real life # @@ -132,8 +141,14 @@ gdb_test "printf \"%d\" j" ".*Invalid argument syntax.*" "" # play with "p", too # gdb_test "p/r j" ".*Undefined output format.*" "" +gdb_test "p j" ".*" "debug test output" #gdb_test "x/rx j" ".*Cannot access memory.*" "no error!" -gdb_test "x/0 j" ".*" "x/0 j" +# x/0 j doesn't produce any output and terminates PA64 process when testing +if [istarget "hppa*-hp-hpux11*"] { + xfail "'x/0 j' terminate PA64 process - skipped test point" +} else { + gdb_test "x/0 j" ".*" "x/0 j" +} gdb_test "p/0 j" ".*Item count other than 1 is meaningless.*" "p/0 j" gdb_test "p/s sum" ".*Format letter.*is meaningless.*" " no s" gdb_test "p/i sum" ".*Format letter.*is meaningless.*.*" "no i" diff --git a/gdb/testsuite/gdb.base/ena-dis-br.exp b/gdb/testsuite/gdb.base/ena-dis-br.exp index f5656d8..f7be986 100644 --- a/gdb/testsuite/gdb.base/ena-dis-br.exp +++ b/gdb/testsuite/gdb.base/ena-dis-br.exp @@ -74,7 +74,7 @@ if ![runto_main] then { fail "enable/disable break tests suppressed" } # send_gdb "break marker1\n" gdb_expect { - -re "Breakpoint (\[0-9\]*) at .*, line 41.*$gdb_prompt $"\ + -re "Breakpoint (\[0-9\]*) at .*, line 4\[38\].*$gdb_prompt $"\ {pass "break marker1"} -re "$gdb_prompt $"\ {fail "break marker1"} @@ -118,7 +118,7 @@ gdb_expect { # send_gdb "break marker2\n" gdb_expect { - -re "Breakpoint (\[0-9\]*) at .*, line 42.*$gdb_prompt $"\ + -re "Breakpoint (\[0-9\]*) at .*, line 4\[49\].*$gdb_prompt $"\ {pass "break marker2"} -re "$gdb_prompt $"\ {fail "break marker2"} @@ -172,7 +172,7 @@ if ![runto_main] then { fail "enable/disable break tests suppressed" } send_gdb "break marker3\n" gdb_expect { - -re "Breakpoint (\[0-9\]*) at .*, line 43.*$gdb_prompt $"\ + -re "Breakpoint (\[0-9\]*) at .*, line (45|50).*$gdb_prompt $"\ {pass "break marker3"} -re "$gdb_prompt $"\ {fail "break marker3"} @@ -197,7 +197,7 @@ gdb_expect { send_gdb "continue\n" gdb_expect { - -re ".*marker3 .*:43.*$gdb_prompt $"\ + -re ".*marker3 .*:(45|50).*$gdb_prompt $"\ {pass "continue to auto-deleted break marker3"} -re "Breakpoint \[0-9\]*, marker3.*$gdb_prompt $"\ {fail "continue to auto-deleted break marker3"} @@ -222,7 +222,7 @@ gdb_expect { # send_gdb "break marker4\n" gdb_expect { - -re "Breakpoint (\[0-9\]*) at .*, line 44.*$gdb_prompt $"\ + -re "Breakpoint (\[0-9\]*) at .*, line (46|51).*$gdb_prompt $"\ {pass "break marker4"} -re "$gdb_prompt $"\ {fail "break marker4"} @@ -253,7 +253,7 @@ if ![runto_main] then { fail "enable/disable break tests suppressed" } send_gdb "break marker1\n" gdb_expect { - -re "Breakpoint (\[0-9\]*) at .*, line 41.*$gdb_prompt $"\ + -re "Breakpoint (\[0-9\]*) at .*, line 4\[38\].*$gdb_prompt $"\ {pass "break marker1"} -re "$gdb_prompt $"\ {fail "break marker1"} @@ -340,7 +340,7 @@ if ![runto_main] then { fail "enable/disable break tests suppressed" } send_gdb "break marker1\n" gdb_expect { - -re "Breakpoint (\[0-9\]*) at .*, line 41.*$gdb_prompt $"\ + -re "Breakpoint (\[0-9\]*) at .*, line 4\[38\].*$gdb_prompt $"\ {pass "break marker1"} -re "$gdb_prompt $"\ {fail "break marker1"} @@ -377,7 +377,7 @@ rerun_to_main send_gdb "continue\n" gdb_expect { - -re ".*marker1 .*:41.*$gdb_prompt $"\ + -re ".*marker1 .*:4\[38\].*$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"} @@ -393,7 +393,7 @@ if ![runto_main] then { fail "enable/disable break tests suppressed" } send_gdb "break marker1\n" gdb_expect { - -re "Breakpoint (\[0-9\]*) at .*, line 41.*$gdb_prompt $"\ + -re "Breakpoint (\[0-9\]*) at .*, line 4\[38\].*$gdb_prompt $"\ {pass "break marker1"} -re "$gdb_prompt $"\ {fail "break marker1"} @@ -435,9 +435,9 @@ gdb_expect { # if ![runto_main] then { fail "enable/disable break tests suppressed" } -send_gdb "break 64\n" +send_gdb "break 79\n" gdb_expect { - -re "Breakpoint \[0-9\]*.*, line 64.*$gdb_prompt $"\ + -re "Breakpoint \[0-9\]*.*, line 79.*$gdb_prompt $"\ {pass "prepare to continue with ignore count"} -re "$gdb_prompt $"\ {fail "prepare to continue with ignore count"} @@ -454,7 +454,7 @@ gdb_expect { send_gdb "next\n" gdb_expect { - -re ".*66\[ \t\]*marker1.*$gdb_prompt $"\ + -re ".*81\[ \t\]*marker1.*$gdb_prompt $"\ {pass "step after continue with ignore count"} -re "$gdb_prompt $"\ {fail "step after continue with ignore count"} diff --git a/gdb/testsuite/gdb.base/ending-run.c b/gdb/testsuite/gdb.base/ending-run.c index 56335cf..0936146 100644 --- a/gdb/testsuite/gdb.base/ending-run.c +++ b/gdb/testsuite/gdb.base/ending-run.c @@ -2,15 +2,20 @@ * <leaves-core-file-on-quit> bugs. */ #include <stdio.h> +#include <stdlib.h> +#ifdef PROTOTYPES +int callee (int x) +#else int callee( x ) int x; +#endif { int y = x * x; return (y - 2); } -main() +int main() { int *p; @@ -24,4 +29,5 @@ main() } printf( " Goodbye!\n" ); + return 0; } diff --git a/gdb/testsuite/gdb.base/ending-run.exp b/gdb/testsuite/gdb.base/ending-run.exp index 8f102fb..e36c975 100644 --- a/gdb/testsuite/gdb.base/ending-run.exp +++ b/gdb/testsuite/gdb.base/ending-run.exp @@ -52,39 +52,39 @@ gdb_load ${binfile} # to the prolog--that's another bug...) # gdb_test "b 1" ".*Breakpoint.*line 1.*" "bpt at line before routine" -gdb_test "b 8" ".*Note.*also.*Breakpoint.*2.*" "" +gdb_test "b 13" ".*Note.*also.*Breakpoint.*2.*" "" # Set up to go to the next-to-last line of the program # -gdb_test "b 26" ".*Breakpoint.*3.*" "" +gdb_test "b 31" ".*Breakpoint.*3.*" "" # Expect to hit the bp at line "1", but symbolize this -# as line "8". Then try to clear it--this should work. +# as line "13". Then try to clear it--this should work. # if [target_info exists use_gdb_stub] { - gdb_test "continue" ".*Breakpoint.*1.*callee.*8.*" "" + gdb_test "continue" ".*Breakpoint.*1.*callee.*13.*" "" } else { - gdb_test "r" ".*Breakpoint.*1.*callee.*8.*" "" + gdb_test "r" ".*Breakpoint.*1.*callee.*13.*" "" } gdb_test "cle" ".*Deleted breakpoints 2 1.*" "clear worked" send_gdb "i b\n" gdb_expect { -re ".*breakpoint.*breakpoint.*$gdb_prompt $" { fail "clear bp" } - -re ".*3.*main.*26.*$gdb_prompt $" { pass "cleared bp at line before routine" } + -re ".*3.*main.*31.*$gdb_prompt $" { pass "cleared bp at line before routine" } -re ".*$gdb_prompt $" { fail "info b" } } # Test some other "clear" combinations # gdb_test "b 1" ".*Breakpoint.*4.*" "" -gdb_test "b 8" ".*Note.*also.*Breakpoint.*5.*" "" -gdb_test "cle 8" ".*Deleted breakpoint 5.*" "Only cleared 1 by line" +gdb_test "b 13" ".*Note.*also.*Breakpoint.*5.*" "" +gdb_test "cle 13" ".*Deleted breakpoint 5.*" "Only cleared 1 by line" -send_gdb "inf line 8\n" +send_gdb "inf line 13\n" gdb_expect { -re ".*address (0x\[0-9a-fA-F]*).*$gdb_prompt $" { set line_eight $expect_out(1,string) - gdb_test "b 8" ".*Breakpoint.*6.*" "" + gdb_test "b 13" ".*Breakpoint.*6.*" "" gdb_test "cle *$line_eight" ".*Deleted breakpoints 6 4.*" "Clear 2 by address" } -re ".*$gdb_prompt $" { @@ -92,13 +92,13 @@ gdb_expect { } } -send_gdb "inf line 9\n" +send_gdb "inf line 14\n" gdb_expect { -re ".*address (0x\[0-9a-fA-F]*).*$gdb_prompt $" { set line_nine $expect_out(1,string) - gdb_test "b 9" ".*Breakpoint.*7.*" "" + gdb_test "b 14" ".*Breakpoint.*7.*" "" gdb_test "b *$line_nine" ".*Note.*also.*Breakpoint.*8.*" "" - gdb_test "c" ".*Breakpoint.*7.*callee.*9.*" "" + gdb_test "c" ".*Breakpoint.*7.*callee.*14.*" "" gdb_test "cle" ".*Deleted breakpoints 8 7.*" "Clear 2 by default" } -re ".*$gdb_prompt $" { @@ -111,7 +111,7 @@ gdb_expect { -re ".*breakpoint.*breakpoint.*$gdb_prompt $" { fail "didn't clear bps" } - -re ".*3.*main.*26.*$gdb_prompt $" { + -re ".*3.*main.*31.*$gdb_prompt $" { pass "all set to continue" } -re ".*$gdb_prompt $" { @@ -123,14 +123,14 @@ gdb_expect { # See if we can step out with control. The "1 2 3" stuff # is output from the program. # -gdb_test "cont" ".*Breakpoint.*26.*" "" -gdb_test "next" ".*1 2 7 14 23 34 47 62 79 Goodbye!.*27.*" "Step to return" +gdb_test "cont" ".*Breakpoint.*32.*" "" +gdb_test "next" ".*1 2 7 14 23 34 47 62 79 Goodbye!.*32.*" "Step to return" set old_timeout $timeout set timeout 50 send_gdb "next\n" gdb_expect { - -re "27.*$gdb_prompt $" { + -re "33.*$gdb_prompt $" { # sometimes we stop at the closing brace, if so, do another next send_gdb "next\n" gdb_expect { @@ -141,6 +141,9 @@ gdb_expect { -re ".*in.*start.*$gdb_prompt $" { pass "step out of main" } + -re ".*in.*\\\$START\\\$.*from.*dld.sl.*$gdb_prompt $" { + pass "step out of main" + } -re ".*$gdb_prompt $" { fail "step at end 2" } timeout { fail "hang or timeout on step at end 2" } } @@ -152,6 +155,9 @@ gdb_expect { -re ".*in.*start.*$gdb_prompt $" { pass "step out of main" } + -re ".*in.*\\\$START\\\$.*from.*dld.sl.*$gdb_prompt $" { + pass "step out of main 2" + } -re ".*in.*currently asm.*$gdb_prompt $" { pass "step out of main into assembler" } @@ -163,7 +169,18 @@ gdb_expect { } if {![target_info exists use_cygmon] || ![target_info use_cygmon]} { - gdb_test "n" ".*Single.*Program exited.*" "step to end of run" + send_gdb "n\n" + gdb_expect { + -re ".*Single.*Program exited.*$gdb_prompt $" { + pass "step to end of run 1" + } + -re ".*Single.*in exit.*from.*dld.sl.*$gdb_prompt $" { + pass "step to end of run 2" + gdb_test "c" ".*" "continue after exit" + } + timeout { fail "(timeout) step to end of run" } + } + set timeout $old_timeout gdb_test "n" ".*The program is not being run.*" "don't step after run" diff --git a/gdb/testsuite/gdb.base/eval-skip.exp b/gdb/testsuite/gdb.base/eval-skip.exp index 4e17e61..c82652f 100644 --- a/gdb/testsuite/gdb.base/eval-skip.exp +++ b/gdb/testsuite/gdb.base/eval-skip.exp @@ -48,8 +48,9 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } - - +if [get_compiler_info $binfile] { + return -1 +} gdb_exit gdb_start @@ -67,10 +68,9 @@ gdb_test "set variable y=2" "" "set variable y=2" gdb_test "set variable z=2" "" "set variable z=2" gdb_test "set variable w=3" "" "set variable w=3" - send_gdb "print (0 && (x+y))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (x+y))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (x+y))" } @@ -80,7 +80,7 @@ gdb_expect { send_gdb "print (0 && (x-y))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (x-y))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (x-y))" } @@ -90,7 +90,7 @@ gdb_expect { send_gdb "print (0 && (x*y))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (x*y))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (x*y))" } @@ -101,7 +101,7 @@ gdb_expect { send_gdb "print (0 && (x/y))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (x/y))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (x/y))" } @@ -111,7 +111,7 @@ gdb_expect { send_gdb "print (0 && (x%y))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (x%y))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (x%y))" } @@ -121,7 +121,7 @@ gdb_expect { send_gdb "print (0 && (x&&y))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (x&&y))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (x&&y))" } @@ -132,7 +132,7 @@ gdb_expect { send_gdb "print (0 && (x||y))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (x||y))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (x||y))" } @@ -143,7 +143,7 @@ gdb_expect { send_gdb "print (0 && (x&y))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (x&y))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (x&y))" } @@ -153,7 +153,7 @@ gdb_expect { send_gdb "print (0 && (x|y))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (x|y))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (x|y))" } @@ -163,7 +163,7 @@ gdb_expect { send_gdb "print (0 && (x^y))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (x^y))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (x^y))" } @@ -174,7 +174,7 @@ gdb_expect { send_gdb "print (0 && (x < y))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (x < y))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (x < y))" } @@ -184,7 +184,7 @@ gdb_expect { send_gdb "print (0 && (x <= y))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (x <= y))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (x <= y))" } @@ -195,7 +195,7 @@ gdb_expect { send_gdb "print (0 && (x>y))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (x>y))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (x>y))" } @@ -205,7 +205,7 @@ gdb_expect { send_gdb "print (0 && (x>=y))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (x>=y))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (x>=y))" } @@ -216,7 +216,7 @@ gdb_expect { send_gdb "print (0 && (x==y))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (x==y))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (x==y))" } @@ -226,7 +226,7 @@ gdb_expect { send_gdb "print (0 && (x!=y))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (x!=y))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (x!=y))" } @@ -236,7 +236,7 @@ gdb_expect { send_gdb "print (0 && (x<<31))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (x<<31))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (x<<31))" } @@ -246,7 +246,7 @@ gdb_expect { send_gdb "print (0 && (x>>31))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (x>>31))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (x>>31))" } @@ -257,7 +257,7 @@ gdb_expect { send_gdb "print (0 && (!x))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (!x))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (!x))" } @@ -267,7 +267,7 @@ gdb_expect { send_gdb "print (0 && (~x))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (~x))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (~x))" } @@ -276,7 +276,7 @@ gdb_expect { send_gdb "print (0 && (-x))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (-x))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (-x))" } @@ -286,7 +286,7 @@ gdb_expect { send_gdb "print (0 && (x++))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (x++))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (x++))" } @@ -296,7 +296,7 @@ gdb_expect { send_gdb "print (0 && (++x))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (++x))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (++x))" } @@ -306,7 +306,7 @@ gdb_expect { send_gdb "print (0 && (x--))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (x--))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (x--))" } @@ -316,7 +316,7 @@ gdb_expect { send_gdb "print (0 && (--x))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (--x))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (--x))" } @@ -325,7 +325,7 @@ gdb_expect { send_gdb "print (0 && (x+=7))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (x+=7))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (x+=7))" } @@ -334,7 +334,7 @@ gdb_expect { send_gdb "print (0 && (x=y))\n" gdb_expect { - -re ".$decimal = 0\r\n$gdb_prompt $" { + -re ".$decimal = $false\r\n$gdb_prompt $" { pass "print value of (0 && (x=y))" } -re ".*$gdb_prompt $" { fail "print value of (0 && (x=y))" } diff --git a/gdb/testsuite/gdb.base/exprs.c b/gdb/testsuite/gdb.base/exprs.c index e5c7351..b35c3a5 100644 --- a/gdb/testsuite/gdb.base/exprs.c +++ b/gdb/testsuite/gdb.base/exprs.c @@ -1,7 +1,11 @@ +#ifdef PROTOTYPES +int main (int argc, char **argv, char **envp) +#else main (argc, argv, envp) int argc; char **argv; char **envp; +#endif { extern void dummy(); #ifdef usestubs @@ -9,6 +13,8 @@ main (argc, argv, envp) breakpoint(); #endif dummy(); + return 0; + } /* We put main() right up front so its line number doesn't keep changing. */ @@ -44,7 +50,6 @@ unsigned long v_unsigned_long; float v_float; double v_double; - /* * Now some derived types, which are arrays, functions-returning, * pointers, structures, unions, and enumerations. @@ -70,7 +75,6 @@ unsigned long v_unsigned_long_array[2]; float v_float_array[2]; double v_double_array[2]; - /**** pointers *******/ char *v_char_pointer; @@ -203,8 +207,6 @@ void dummy() v_float = 100.0; v_double = 200.0; - - v_char_array[0] = v_char; v_signed_char_array[0] = v_signed_char; v_unsigned_char_array[0] = v_unsigned_char; @@ -223,7 +225,6 @@ void dummy() v_float_array[0] = v_float; v_double_array[0] = v_double; - v_char_pointer = &v_char; v_signed_char_pointer = &v_signed_char; v_unsigned_char_pointer = &v_unsigned_char; diff --git a/gdb/testsuite/gdb.base/exprs.exp b/gdb/testsuite/gdb.base/exprs.exp index cdf33dc..f31407c 100644 --- a/gdb/testsuite/gdb.base/exprs.exp +++ b/gdb/testsuite/gdb.base/exprs.exp @@ -73,150 +73,145 @@ proc test_expr { args } { # # test expressions with "char" types # -test_expr "set variable v_char=127" "print v_char == 0" "\\$\[0-9\]* = 0" "print v_char == 127" "\\$\[0-9\]* = 1" "print char ==" -test_expr "set variable v_char=127" "print v_char != 0" "\\$\[0-9\]* = 1" "print v_char != 127" "\\$\[0-9\]* = 0" "print char !=" -test_expr "set variable v_char=127" "print v_char < 0" "\\$\[0-9\]* = 0" "print v_char < 127" "\\$\[0-9\]* = 0" "print char <" -test_expr "set variable v_char=127" "print v_char > 0" "\\$\[0-9\]* = 1" "print v_char > 127" "\\$\[0-9\]* = 0" "print char >" +test_expr "set variable v_char=127" "print v_char == 0" "\\$\[0-9\]* = $false" "print v_char == 127" "\\$\[0-9\]* = $true" "print char ==" +test_expr "set variable v_char=127" "print v_char != 0" "\\$\[0-9\]* = $true" "print v_char != 127" "\\$\[0-9\]* = $false" "print char !=" +test_expr "set variable v_char=127" "print v_char < 0" "\\$\[0-9\]* = $false" "print v_char < 127" "\\$\[0-9\]* = $false" "print char <" +test_expr "set variable v_char=127" "print v_char > 0" "\\$\[0-9\]* = $true" "print v_char > 127" "\\$\[0-9\]* = $false" "print char >" # # test expressions with "signed char" types # -test_expr "set variable v_signed_char=127" "print v_signed_char == 0" "\\$\[0-9\]* = 0" "print v_signed_char == 127" "\\$\[0-9\]* = 1" "print signed char ==" -test_expr "set variable v_signed_char=127" "print v_signed_char != 0" "\\$\[0-9\]* = 1" "print v_signed_char != 127" "\\$\[0-9\]* = 0" "print signed char !=" -test_expr "set variable v_signed_char=127" "print v_signed_char < 0" "\\$\[0-9\]* = 0" "print v_signed_char < 127" "\\$\[0-9\]* = 0" "print signed char <" -test_expr "set variable v_signed_char=127" "print v_signed_char > 0" "\\$\[0-9\]* = 1" "print v_signed_char > 127" "\\$\[0-9\]* = 0" "print signed char >" +test_expr "set variable v_signed_char=127" "print v_signed_char == 0" "\\$\[0-9\]* = $false" "print v_signed_char == 127" "\\$\[0-9\]* = $true" "print signed char ==" +test_expr "set variable v_signed_char=127" "print v_signed_char != 0" "\\$\[0-9\]* = $true" "print v_signed_char != 127" "\\$\[0-9\]* = $false" "print signed char !=" +test_expr "set variable v_signed_char=127" "print v_signed_char < 0" "\\$\[0-9\]* = $false" "print v_signed_char < 127" "\\$\[0-9\]* = $false" "print signed char <" +test_expr "set variable v_signed_char=127" "print v_signed_char > 0" "\\$\[0-9\]* = $true" "print v_signed_char > 127" "\\$\[0-9\]* = $false" "print signed char >" # make char a minus -test_expr "set variable v_signed_char=-1" "print v_signed_char == 0" "\\$\[0-9\]* = 0" "print v_signed_char == -1" "\\$\[0-9\]* = 1" "print signed char == (minus)" -test_expr "set variable v_signed_char=-1" "print v_signed_char != 0" "\\$\[0-9\]* = 1" "print v_signed_char != -1" "\\$\[0-9\]* = 0" "print signed char != (minus)" -test_expr "set variable v_signed_char=-1" "print v_signed_char < 0" "\\$\[0-9\]* = 1" "print v_signed_char < 127" "\\$\[0-9\]* = 1" "print signed char < (minus)" -test_expr "set variable v_signed_char=-1" "print v_signed_char > 0" "\\$\[0-9\]* = 0" "print v_signed_char > 127" "\\$\[0-9\]* = 0" "print signed char > (minus)" +test_expr "set variable v_signed_char=-1" "print v_signed_char == 0" "\\$\[0-9\]* = $false" "print v_signed_char == -1" "\\$\[0-9\]* = $true" "print signed char == (minus)" +test_expr "set variable v_signed_char=-1" "print v_signed_char != 0" "\\$\[0-9\]* = $true" "print v_signed_char != -1" "\\$\[0-9\]* = $false" "print signed char != (minus)" +test_expr "set variable v_signed_char=-1" "print v_signed_char < 0" "\\$\[0-9\]* = $true" "print v_signed_char < 127" "\\$\[0-9\]* = $true" "print signed char < (minus)" +test_expr "set variable v_signed_char=-1" "print v_signed_char > 0" "\\$\[0-9\]* = $false" "print v_signed_char > 127" "\\$\[0-9\]* = $false" "print signed char > (minus)" # # test expressions with "unsigned char" types # -test_expr "set variable v_unsigned_char=127" "print v_unsigned_char == 0" "\\$\[0-9\]* = 0" "print v_unsigned_char == 127" "\\$\[0-9\]* = 1" "print unsigned char ==" -test_expr "set variable v_unsigned_char=127" "print v_unsigned_char != 0" "\\$\[0-9\]* = 1" "print v_unsigned_char != 127" "\\$\[0-9\]* = 0" "print unsigned char !=" -test_expr "set variable v_unsigned_char=127" "print v_unsigned_char < 0" "\\$\[0-9\]* = 0" "print v_unsigned_char < 127" "\\$\[0-9\]* = 0" "print unsigned char <" -test_expr "set variable v_unsigned_char=127" "print v_unsigned_char > 0" "\\$\[0-9\]* = 1" "print v_unsigned_char > 127" "\\$\[0-9\]* = 0" "print unsigned char >" +test_expr "set variable v_unsigned_char=127" "print v_unsigned_char == 0" "\\$\[0-9\]* = $false" "print v_unsigned_char == 127" "\\$\[0-9\]* = $true" "print unsigned char ==" +test_expr "set variable v_unsigned_char=127" "print v_unsigned_char != 0" "\\$\[0-9\]* = $true" "print v_unsigned_char != 127" "\\$\[0-9\]* = $false" "print unsigned char !=" +test_expr "set variable v_unsigned_char=127" "print v_unsigned_char < 0" "\\$\[0-9\]* = $false" "print v_unsigned_char < 127" "\\$\[0-9\]* = $false" "print unsigned char <" +test_expr "set variable v_unsigned_char=127" "print v_unsigned_char > 0" "\\$\[0-9\]* = $true" "print v_unsigned_char > 127" "\\$\[0-9\]* = $false" "print unsigned char >" # make char a minus # FIXME: gdb mishandles the cast (unsigned char) on the i960, so I've # set up an expected failure for this case. setup_xfail "i960-*-*" 1821 -test_expr "set variable v_unsigned_char=~0" "print v_unsigned_char == 0" "\\$\[0-9\]* = 0" "print v_unsigned_char == ~0" "\\$\[0-9\]* = 0" "print v_unsigned_char == (unsigned char)~0" "\\$\[0-9\]* = 1" "print unsigned char == (~0)" +test_expr "set variable v_unsigned_char=~0" "print v_unsigned_char == 0" "\\$\[0-9\]* = $false" "print v_unsigned_char == ~0" "\\$\[0-9\]* = $false" "print v_unsigned_char == (unsigned char)~0" "\\$\[0-9\]* = $true" "print unsigned char == (~0)" # FIXME: gdb mishandles the cast (unsigned char) on the i960, so I've # set up an expected failure for this case. setup_xfail "i960-*-*" 1821 -test_expr "set variable v_unsigned_char=~0" "print v_unsigned_char != 0" "\\$\[0-9\]* = 1" "print v_unsigned_char != (unsigned char)~0" "\\$\[0-9\]* = 0" "print unsigned char != (~0)" -test_expr "set variable v_unsigned_char=~0" "print v_unsigned_char < 0" "\\$\[0-9\]* = 0" "print v_unsigned_char < 127" "\\$\[0-9\]* = 0" "print unsigned char < (~0)" -test_expr "set variable v_unsigned_char=~0" "print v_unsigned_char > 0" "\\$\[0-9\]* = 1" "print v_unsigned_char > 127" "\\$\[0-9\]* = 1" "print unsigned char > (~0)" +test_expr "set variable v_unsigned_char=~0" "print v_unsigned_char != 0" "\\$\[0-9\]* = $true" "print v_unsigned_char != (unsigned char)~0" "\\$\[0-9\]* = $false" "print unsigned char != (~0)" +test_expr "set variable v_unsigned_char=~0" "print v_unsigned_char < 0" "\\$\[0-9\]* = $false" "print v_unsigned_char < 127" "\\$\[0-9\]* = $false" "print unsigned char < (~0)" +test_expr "set variable v_unsigned_char=~0" "print v_unsigned_char > 0" "\\$\[0-9\]* = $true" "print v_unsigned_char > 127" "\\$\[0-9\]* = $true" "print unsigned char > (~0)" # # test expressions with "short" types # -test_expr "set variable v_short=0x7FFF" "print v_short == 0" "\\$\[0-9\]* = 0" "print v_short == 0x7FFF" "\\$\[0-9\]* = 1" "print signed short ==" -test_expr "set variable v_short=0x7FFF" "print v_short != 0" "\\$\[0-9\]* = 1" "print v_short != 0x7FFF" "\\$\[0-9\]* = 0" "print signed short !=" -test_expr "set variable v_short=0x7FFF" "print v_short < 0" "\\$\[0-9\]* = 0" "print v_short < 0x7FFF" "\\$\[0-9\]* = 0" "print signed short <" -test_expr "set variable v_short=0x7FFF" "print v_short > 0" "\\$\[0-9\]* = 1" "print v_short > 0x7FFF" "\\$\[0-9\]* = 0" "print signed short >" +test_expr "set variable v_short=0x7FFF" "print v_short == 0" "\\$\[0-9\]* = $false" "print v_short == 0x7FFF" "\\$\[0-9\]* = $true" "print signed short ==" +test_expr "set variable v_short=0x7FFF" "print v_short != 0" "\\$\[0-9\]* = $true" "print v_short != 0x7FFF" "\\$\[0-9\]* = $false" "print signed short !=" +test_expr "set variable v_short=0x7FFF" "print v_short < 0" "\\$\[0-9\]* = $false" "print v_short < 0x7FFF" "\\$\[0-9\]* = $false" "print signed short <" +test_expr "set variable v_short=0x7FFF" "print v_short > 0" "\\$\[0-9\]* = $true" "print v_short > 0x7FFF" "\\$\[0-9\]* = $false" "print signed short >" # make short a minus -test_expr "set variable v_short=-1" "print v_short == 0" "\\$\[0-9\]* = 0" "print v_short == -1" "\\$\[0-9\]* = 1" "print signed short == (minus)" -test_expr "set variable v_short=-1" "print v_short != 0" "\\$\[0-9\]* = 1" "print v_short != -1" "\\$\[0-9\]* = 0" "print signed short != (minus)" -test_expr "set variable v_short=-1" "print v_short < 0" "\\$\[0-9\]* = 1" "print v_short < 0x7FFF" "\\$\[0-9\]* = 1" "print signed short < (minus)" -test_expr "set variable v_short=-1" "print v_short > 0" "\\$\[0-9\]* = 0" "print v_short > 0x7FFF" "\\$\[0-9\]* = 0" "print signed short > (minus)" +test_expr "set variable v_short=-1" "print v_short == 0" "\\$\[0-9\]* = $false" "print v_short == -1" "\\$\[0-9\]* = $true" "print signed short == (minus)" +test_expr "set variable v_short=-1" "print v_short != 0" "\\$\[0-9\]* = $true" "print v_short != -1" "\\$\[0-9\]* = $false" "print signed short != (minus)" +test_expr "set variable v_short=-1" "print v_short < 0" "\\$\[0-9\]* = $true" "print v_short < 0x7FFF" "\\$\[0-9\]* = $true" "print signed short < (minus)" +test_expr "set variable v_short=-1" "print v_short > 0" "\\$\[0-9\]* = $false" "print v_short > 0x7FFF" "\\$\[0-9\]* = $false" "print signed short > (minus)" # # test expressions with "signed short" types # -test_expr "set variable v_signed_short=0x7FFF" "print v_signed_short == 0" "\\$\[0-9\]* = 0" "print v_signed_short == 0x7FFF" "\\$\[0-9\]* = 1" "print signed signed short ==" -test_expr "set variable v_signed_short=0x7FFF" "print v_signed_short != 0" "\\$\[0-9\]* = 1" "print v_signed_short != 0x7FFF" "\\$\[0-9\]* = 0" "print signed signed short !=" -test_expr "set variable v_signed_short=0x7FFF" "print v_signed_short < 0" "\\$\[0-9\]* = 0" "print v_signed_short < 0x7FFF" "\\$\[0-9\]* = 0" "print signed signed short <" -test_expr "set variable v_signed_short=0x7FFF" "print v_signed_short > 0" "\\$\[0-9\]* = 1" "print v_signed_short > 0x7FFF" "\\$\[0-9\]* = 0" "print signed signed short >" +test_expr "set variable v_signed_short=0x7FFF" "print v_signed_short == 0" "\\$\[0-9\]* = $false" "print v_signed_short == 0x7FFF" "\\$\[0-9\]* = $true" "print signed signed short ==" +test_expr "set variable v_signed_short=0x7FFF" "print v_signed_short != 0" "\\$\[0-9\]* = $true" "print v_signed_short != 0x7FFF" "\\$\[0-9\]* = $false" "print signed signed short !=" +test_expr "set variable v_signed_short=0x7FFF" "print v_signed_short < 0" "\\$\[0-9\]* = $false" "print v_signed_short < 0x7FFF" "\\$\[0-9\]* = $false" "print signed signed short <" +test_expr "set variable v_signed_short=0x7FFF" "print v_signed_short > 0" "\\$\[0-9\]* = $true" "print v_signed_short > 0x7FFF" "\\$\[0-9\]* = $false" "print signed signed short >" # make short a minus -test_expr "set variable v_signed_short=-1" "print v_signed_short == 0" "\\$\[0-9\]* = 0" "print v_signed_short == -1" "\\$\[0-9\]* = 1" "print signed signed short == (minus)" -test_expr "set variable v_signed_short=-1" "print v_signed_short != 0" "\\$\[0-9\]* = 1" "print v_signed_short != -1" "\\$\[0-9\]* = 0" "print signed signed short != (minus)" -test_expr "set variable v_signed_short=-1" "print v_signed_short < 0" "\\$\[0-9\]* = 1" "print v_signed_short < 0x7FFF" "\\$\[0-9\]* = 1" "print signed signed short < (minus)" -test_expr "set variable v_signed_short=-1" "print v_signed_short > 0" "\\$\[0-9\]* = 0" "print v_signed_short > 0x7FFF" "\\$\[0-9\]* = 0" "print signed signed short > (minus)" +test_expr "set variable v_signed_short=-1" "print v_signed_short == 0" "\\$\[0-9\]* = $false" "print v_signed_short == -1" "\\$\[0-9\]* = $true" "print signed signed short == (minus)" +test_expr "set variable v_signed_short=-1" "print v_signed_short != 0" "\\$\[0-9\]* = $true" "print v_signed_short != -1" "\\$\[0-9\]* = $false" "print signed signed short != (minus)" +test_expr "set variable v_signed_short=-1" "print v_signed_short < 0" "\\$\[0-9\]* = $true" "print v_signed_short < 0x7FFF" "\\$\[0-9\]* = $true" "print signed signed short < (minus)" +test_expr "set variable v_signed_short=-1" "print v_signed_short > 0" "\\$\[0-9\]* = $false" "print v_signed_short > 0x7FFF" "\\$\[0-9\]* = $false" "print signed signed short > (minus)" # # test expressions with "unsigned short" types # -test_expr "set variable v_unsigned_short=0x7FFF" "print v_unsigned_short == 0" "\\$\[0-9\]* = 0" "print v_unsigned_short == 0x7FFF" "\\$\[0-9\]* = 1" "print unsigned short ==" -test_expr "set variable v_unsigned_short=0x7FFF" "print v_unsigned_short != 0" "\\$\[0-9\]* = 1" "print v_unsigned_short != 0x7FFF" "\\$\[0-9\]* = 0" "print unsigned short !=" -test_expr "set variable v_unsigned_short=0x7FFF" "print v_unsigned_short < 0" "\\$\[0-9\]* = 0" "print v_unsigned_short < 0x7FFF" "\\$\[0-9\]* = 0" "print unsigned short <" -test_expr "set variable v_unsigned_short=0x7FFF" "print v_unsigned_short > 0" "\\$\[0-9\]* = 1" "print v_unsigned_short > 0x7FFF" "\\$\[0-9\]* = 0" "print unsigned short >" +test_expr "set variable v_unsigned_short=0x7FFF" "print v_unsigned_short == 0" "\\$\[0-9\]* = $false" "print v_unsigned_short == 0x7FFF" "\\$\[0-9\]* = $true" "print unsigned short ==" +test_expr "set variable v_unsigned_short=0x7FFF" "print v_unsigned_short != 0" "\\$\[0-9\]* = $true" "print v_unsigned_short != 0x7FFF" "\\$\[0-9\]* = $false" "print unsigned short !=" +test_expr "set variable v_unsigned_short=0x7FFF" "print v_unsigned_short < 0" "\\$\[0-9\]* = $false" "print v_unsigned_short < 0x7FFF" "\\$\[0-9\]* = $false" "print unsigned short <" +test_expr "set variable v_unsigned_short=0x7FFF" "print v_unsigned_short > 0" "\\$\[0-9\]* = $true" "print v_unsigned_short > 0x7FFF" "\\$\[0-9\]* = $false" "print unsigned short >" # make short a minus -# note that (unsigned short) ~0 == ~0 iff sizeof(short) == sizeof(int), -# so we can't test v_unsigned_short != ~0 -test_expr "set variable v_unsigned_short=~0" \ - "print v_unsigned_short == 0" "\\$\[0-9\]* = 0" \ - "print v_unsigned_short == (unsigned short)~0" "\\$\[0-9\]* = 1" \ - "print unsigned short == (~0)" -test_expr "set variable v_unsigned_short=~0" "print v_unsigned_short != 0" "\\$\[0-9\]* = 1" "print v_unsigned_short != (unsigned short)~0" "\\$\[0-9\]* = 0" "print unsigned short != (~0)" -test_expr "set variable v_unsigned_short=~0" "print v_unsigned_short < 0" "\\$\[0-9\]* = 0" "print v_unsigned_short < 0x7FFF" "\\$\[0-9\]* = 0" "print unsigned short < (~0)" -test_expr "set variable v_unsigned_short=~0" "print v_unsigned_short > 0" "\\$\[0-9\]* = 1" "print v_unsigned_short > 0x7FFF" "\\$\[0-9\]* = 1" "print unsigned short > (~0)" +test_expr "set variable v_unsigned_short=~0" "print v_unsigned_short == 0" "\\$\[0-9\]* = $false" "print v_unsigned_short == ~0" "\\$\[0-9\]* = $false" "print v_unsigned_short == (unsigned short)~0" "\\$\[0-9\]* = $true" "print unsigned short == (~0)" +test_expr "set variable v_unsigned_short=~0" "print v_unsigned_short != 0" "\\$\[0-9\]* = $true" "print v_unsigned_short != (unsigned short)~0" "\\$\[0-9\]* = $false" "print unsigned short != (~0)" +test_expr "set variable v_unsigned_short=~0" "print v_unsigned_short < 0" "\\$\[0-9\]* = $false" "print v_unsigned_short < 0x7FFF" "\\$\[0-9\]* = $false" "print unsigned short < (~0)" +test_expr "set variable v_unsigned_short=~0" "print v_unsigned_short > 0" "\\$\[0-9\]* = $true" "print v_unsigned_short > 0x7FFF" "\\$\[0-9\]* = $true" "print unsigned short > (~0)" # # test expressions with "int" types # -test_expr "set variable v_int=0x7FFF" "print v_int == 0" "\\$\[0-9\]* = 0" "print v_int == 0x7FFF" "\\$\[0-9\]* = 1" "print signed int ==" -test_expr "set variable v_int=0x7FFF" "print v_int != 0" "\\$\[0-9\]* = 1" "print v_int != 0x7FFF" "\\$\[0-9\]* = 0" "print signed int !=" -test_expr "set variable v_int=0x7FFF" "print v_int < 0" "\\$\[0-9\]* = 0" "print v_int < 0x7FFF" "\\$\[0-9\]* = 0" "print signed int <" -test_expr "set variable v_int=0x7FFF" "print v_int > 0" "\\$\[0-9\]* = 1" "print v_int > 0x7FFF" "\\$\[0-9\]* = 0" "print signed int >" +test_expr "set variable v_int=0x7FFF" "print v_int == 0" "\\$\[0-9\]* = $false" "print v_int == 0x7FFF" "\\$\[0-9\]* = $true" "print signed int ==" +test_expr "set variable v_int=0x7FFF" "print v_int != 0" "\\$\[0-9\]* = $true" "print v_int != 0x7FFF" "\\$\[0-9\]* = $false" "print signed int !=" +test_expr "set variable v_int=0x7FFF" "print v_int < 0" "\\$\[0-9\]* = $false" "print v_int < 0x7FFF" "\\$\[0-9\]* = $false" "print signed int <" +test_expr "set variable v_int=0x7FFF" "print v_int > 0" "\\$\[0-9\]* = $true" "print v_int > 0x7FFF" "\\$\[0-9\]* = $false" "print signed int >" # make int a minus -test_expr "set variable v_int=-1" "print v_int == 0" "\\$\[0-9\]* = 0" "print v_int == -1" "\\$\[0-9\]* = 1" "print signed int == (minus)" -test_expr "set variable v_int=-1" "print v_int != 0" "\\$\[0-9\]* = 1" "print v_int != -1" "\\$\[0-9\]* = 0" "print signed int != (minus)" -test_expr "set variable v_int=-1" "print v_int < 0" "\\$\[0-9\]* = 1" "print v_int < 0x7FFF" "\\$\[0-9\]* = 1" "print signed int < (minus)" -test_expr "set variable v_int=-1" "print v_int > 0" "\\$\[0-9\]* = 0" "print v_int > 0x7FFF" "\\$\[0-9\]* = 0" "print signed int > (minus)" +test_expr "set variable v_int=-1" "print v_int == 0" "\\$\[0-9\]* = $false" "print v_int == -1" "\\$\[0-9\]* = $true" "print signed int == (minus)" +test_expr "set variable v_int=-1" "print v_int != 0" "\\$\[0-9\]* = $true" "print v_int != -1" "\\$\[0-9\]* = $false" "print signed int != (minus)" +test_expr "set variable v_int=-1" "print v_int < 0" "\\$\[0-9\]* = $true" "print v_int < 0x7FFF" "\\$\[0-9\]* = $true" "print signed int < (minus)" +test_expr "set variable v_int=-1" "print v_int > 0" "\\$\[0-9\]* = $false" "print v_int > 0x7FFF" "\\$\[0-9\]* = $false" "print signed int > (minus)" # # test expressions with "signed int" types # -test_expr "set variable v_signed_int=0x7FFF" "print v_signed_int == 0" "\\$\[0-9\]* = 0" "print v_signed_int == 0x7FFF" "\\$\[0-9\]* = 1" "print signed signed int ==" -test_expr "set variable v_signed_int=0x7FFF" "print v_signed_int != 0" "\\$\[0-9\]* = 1" "print v_signed_int != 0x7FFF" "\\$\[0-9\]* = 0" "print signed signed int !=" -test_expr "set variable v_signed_int=0x7FFF" "print v_signed_int < 0" "\\$\[0-9\]* = 0" "print v_signed_int < 0x7FFF" "\\$\[0-9\]* = 0" "print signed signed int <" -test_expr "set variable v_signed_int=0x7FFF" "print v_signed_int > 0" "\\$\[0-9\]* = 1" "print v_signed_int > 0x7FFF" "\\$\[0-9\]* = 0" "print signed signed int >" +test_expr "set variable v_signed_int=0x7FFF" "print v_signed_int == 0" "\\$\[0-9\]* = $false" "print v_signed_int == 0x7FFF" "\\$\[0-9\]* = $true" "print signed signed int ==" +test_expr "set variable v_signed_int=0x7FFF" "print v_signed_int != 0" "\\$\[0-9\]* = $true" "print v_signed_int != 0x7FFF" "\\$\[0-9\]* = $false" "print signed signed int !=" +test_expr "set variable v_signed_int=0x7FFF" "print v_signed_int < 0" "\\$\[0-9\]* = $false" "print v_signed_int < 0x7FFF" "\\$\[0-9\]* = $false" "print signed signed int <" +test_expr "set variable v_signed_int=0x7FFF" "print v_signed_int > 0" "\\$\[0-9\]* = $true" "print v_signed_int > 0x7FFF" "\\$\[0-9\]* = $false" "print signed signed int >" # make int a minus -test_expr "set variable v_signed_int=-1" "print v_signed_int == 0" "\\$\[0-9\]* = 0" "print v_signed_int == -1" "\\$\[0-9\]* = 1" "print signed signed int == (minus)" -test_expr "set variable v_signed_int=-1" "print v_signed_int != 0" "\\$\[0-9\]* = 1" "print v_signed_int != -1" "\\$\[0-9\]* = 0" "print signed signed int != (minus)" -test_expr "set variable v_signed_int=-1" "print v_signed_int < 0" "\\$\[0-9\]* = 1" "print v_signed_int < 0x7FFF" "\\$\[0-9\]* = 1" "print signed signed int < (minus)" -test_expr "set variable v_signed_int=-1" "print v_signed_int > 0" "\\$\[0-9\]* = 0" "print v_signed_int > 0x7FFF" "\\$\[0-9\]* = 0" "print signed signed int > (minus)" +test_expr "set variable v_signed_int=-1" "print v_signed_int == 0" "\\$\[0-9\]* = $false" "print v_signed_int == -1" "\\$\[0-9\]* = $true" "print signed signed int == (minus)" +test_expr "set variable v_signed_int=-1" "print v_signed_int != 0" "\\$\[0-9\]* = $true" "print v_signed_int != -1" "\\$\[0-9\]* = $false" "print signed signed int != (minus)" +test_expr "set variable v_signed_int=-1" "print v_signed_int < 0" "\\$\[0-9\]* = $true" "print v_signed_int < 0x7FFF" "\\$\[0-9\]* = $true" "print signed signed int < (minus)" +test_expr "set variable v_signed_int=-1" "print v_signed_int > 0" "\\$\[0-9\]* = $false" "print v_signed_int > 0x7FFF" "\\$\[0-9\]* = $false" "print signed signed int > (minus)" # # test expressions with "unsigned int" types # -test_expr "set variable v_unsigned_int=0x7FFF" "print v_unsigned_int == 0" "\\$\[0-9\]* = 0" "print v_unsigned_int == 0x7FFF" "\\$\[0-9\]* = 1" "print unsigned int ==" -test_expr "set variable v_unsigned_int=0x7FFF" "print v_unsigned_int != 0" "\\$\[0-9\]* = 1" "print v_unsigned_int != 0x7FFF" "\\$\[0-9\]* = 0" "print unsigned int !=" -test_expr "set variable v_unsigned_int=0x7FFF" "print v_unsigned_int < 0" "\\$\[0-9\]* = 0" "print v_unsigned_int < 0x7FFF" "\\$\[0-9\]* = 0" "print unsigned int <" -test_expr "set variable v_unsigned_int=0x7FFF" "print v_unsigned_int > 0" "\\$\[0-9\]* = 1" "print v_unsigned_int > 0x7FFF" "\\$\[0-9\]* = 0" "print unsigned int >" +test_expr "set variable v_unsigned_int=0x7FFF" "print v_unsigned_int == 0" "\\$\[0-9\]* = $false" "print v_unsigned_int == 0x7FFF" "\\$\[0-9\]* = $true" "print unsigned int ==" +test_expr "set variable v_unsigned_int=0x7FFF" "print v_unsigned_int != 0" "\\$\[0-9\]* = $true" "print v_unsigned_int != 0x7FFF" "\\$\[0-9\]* = $false" "print unsigned int !=" +test_expr "set variable v_unsigned_int=0x7FFF" "print v_unsigned_int < 0" "\\$\[0-9\]* = $false" "print v_unsigned_int < 0x7FFF" "\\$\[0-9\]* = $false" "print unsigned int <" +test_expr "set variable v_unsigned_int=0x7FFF" "print v_unsigned_int > 0" "\\$\[0-9\]* = $true" "print v_unsigned_int > 0x7FFF" "\\$\[0-9\]* = $false" "print unsigned int >" # make int a minus -test_expr "set variable v_unsigned_int=~0" "print v_unsigned_int == 0" "\\$\[0-9\]* = 0" "print v_unsigned_int == ~0" "\\$\[0-9\]* = 1" "print v_unsigned_int == (unsigned int)~0" "\\$\[0-9\]* = 1" "print unsigned int == (~0)" -test_expr "set variable v_unsigned_int=~0" "print v_unsigned_int != 0" "\\$\[0-9\]* = 1" "print v_unsigned_int != (unsigned int)~0" "\\$\[0-9\]* = 0" "print unsigned int != (~0)" -test_expr "set variable v_unsigned_int=~0" "print v_unsigned_int < 0" "\\$\[0-9\]* = 0" "print v_unsigned_int < 0x7FFF" "\\$\[0-9\]* = 0" "print unsigned int < (~0)" -test_expr "set variable v_unsigned_int=~0" "print v_unsigned_int > 0" "\\$\[0-9\]* = 1" "print v_unsigned_int > 0x7FFF" "\\$\[0-9\]* = 1" "print unsigned int > (~0)" +test_expr "set variable v_unsigned_int=~0" "print v_unsigned_int == 0" "\\$\[0-9\]* = $false" "print v_unsigned_int == ~0" "\\$\[0-9\]* = $true" "print v_unsigned_int == (unsigned int)~0" "\\$\[0-9\]* = $true" "print unsigned int == (~0)" +test_expr "set variable v_unsigned_int=~0" "print v_unsigned_int != 0" "\\$\[0-9\]* = $true" "print v_unsigned_int != (unsigned int)~0" "\\$\[0-9\]* = $false" "print unsigned int != (~0)" +test_expr "set variable v_unsigned_int=~0" "print v_unsigned_int < 0" "\\$\[0-9\]* = $false" "print v_unsigned_int < 0x7FFF" "\\$\[0-9\]* = $false" "print unsigned int < (~0)" +test_expr "set variable v_unsigned_int=~0" "print v_unsigned_int > 0" "\\$\[0-9\]* = $true" "print v_unsigned_int > 0x7FFF" "\\$\[0-9\]* = $true" "print unsigned int > (~0)" # # test expressions with "long" types # -test_expr "set variable v_long=0x7FFF" "print v_long == 0" "\\$\[0-9\]* = 0" "print v_long == 0x7FFF" "\\$\[0-9\]* = 1" "print signed long ==" -test_expr "set variable v_long=0x7FFF" "print v_long != 0" "\\$\[0-9\]* = 1" "print v_long != 0x7FFF" "\\$\[0-9\]* = 0" "print signed long !=" -test_expr "set variable v_long=0x7FFF" "print v_long < 0" "\\$\[0-9\]* = 0" "print v_long < 0x7FFF" "\\$\[0-9\]* = 0" "print signed long <" -test_expr "set variable v_long=0x7FFF" "print v_long > 0" "\\$\[0-9\]* = 1" "print v_long > 0x7FFF" "\\$\[0-9\]* = 0" "print signed long >" +test_expr "set variable v_long=0x7FFF" "print v_long == 0" "\\$\[0-9\]* = $false" "print v_long == 0x7FFF" "\\$\[0-9\]* = $true" "print signed long ==" +test_expr "set variable v_long=0x7FFF" "print v_long != 0" "\\$\[0-9\]* = $true" "print v_long != 0x7FFF" "\\$\[0-9\]* = $false" "print signed long !=" +test_expr "set variable v_long=0x7FFF" "print v_long < 0" "\\$\[0-9\]* = $false" "print v_long < 0x7FFF" "\\$\[0-9\]* = $false" "print signed long <" +test_expr "set variable v_long=0x7FFF" "print v_long > 0" "\\$\[0-9\]* = $true" "print v_long > 0x7FFF" "\\$\[0-9\]* = $false" "print signed long >" # make long a minus -test_expr "set variable v_long=-1" "print v_long == 0" "\\$\[0-9\]* = 0" "print v_long == -1" "\\$\[0-9\]* = 1" "print signed long == (minus)" -test_expr "set variable v_long=-1" "print v_long != 0" "\\$\[0-9\]* = 1" "print v_long != -1" "\\$\[0-9\]* = 0" "print signed long != (minus)" -test_expr "set variable v_long=-1" "print v_long < 0" "\\$\[0-9\]* = 1" "print v_long < 0x7FFF" "\\$\[0-9\]* = 1" "print signed long < (minus)" -test_expr "set variable v_long=-1" "print v_long > 0" "\\$\[0-9\]* = 0" "print v_long > 0x7FFF" "\\$\[0-9\]* = 0" "print signed long > (minus)" +test_expr "set variable v_long=-1" "print v_long == 0" "\\$\[0-9\]* = $false" "print v_long == -1" "\\$\[0-9\]* = $true" "print signed long == (minus)" +test_expr "set variable v_long=-1" "print v_long != 0" "\\$\[0-9\]* = $true" "print v_long != -1" "\\$\[0-9\]* = $false" "print signed long != (minus)" +test_expr "set variable v_long=-1" "print v_long < 0" "\\$\[0-9\]* = $true" "print v_long < 0x7FFF" "\\$\[0-9\]* = $true" "print signed long < (minus)" +test_expr "set variable v_long=-1" "print v_long > 0" "\\$\[0-9\]* = $false" "print v_long > 0x7FFF" "\\$\[0-9\]* = $false" "print signed long > (minus)" # # test expressions with "signed long" types # -test_expr "set variable v_signed_long=0x7FFF" "print v_signed_long == 0" "\\$\[0-9\]* = 0" "print v_signed_long == 0x7FFF" "\\$\[0-9\]* = 1" "print signed signed long ==" -test_expr "set variable v_signed_long=0x7FFF" "print v_signed_long != 0" "\\$\[0-9\]* = 1" "print v_signed_long != 0x7FFF" "\\$\[0-9\]* = 0" "print signed signed long !=" -test_expr "set variable v_signed_long=0x7FFF" "print v_signed_long < 0" "\\$\[0-9\]* = 0" "print v_signed_long < 0x7FFF" "\\$\[0-9\]* = 0" "print signed signed long <" -test_expr "set variable v_signed_long=0x7FFF" "print v_signed_long > 0" "\\$\[0-9\]* = 1" "print v_signed_long > 0x7FFF" "\\$\[0-9\]* = 0" "print signed signed long >" +test_expr "set variable v_signed_long=0x7FFF" "print v_signed_long == 0" "\\$\[0-9\]* = $false" "print v_signed_long == 0x7FFF" "\\$\[0-9\]* = $true" "print signed signed long ==" +test_expr "set variable v_signed_long=0x7FFF" "print v_signed_long != 0" "\\$\[0-9\]* = $true" "print v_signed_long != 0x7FFF" "\\$\[0-9\]* = $false" "print signed signed long !=" +test_expr "set variable v_signed_long=0x7FFF" "print v_signed_long < 0" "\\$\[0-9\]* = $false" "print v_signed_long < 0x7FFF" "\\$\[0-9\]* = $false" "print signed signed long <" +test_expr "set variable v_signed_long=0x7FFF" "print v_signed_long > 0" "\\$\[0-9\]* = $true" "print v_signed_long > 0x7FFF" "\\$\[0-9\]* = $false" "print signed signed long >" # make long a minus -test_expr "set variable v_signed_long=-1" "print v_signed_long == 0" "\\$\[0-9\]* = 0" "print v_signed_long == -1" "\\$\[0-9\]* = 1" "print signed signed long == (minus)" -test_expr "set variable v_signed_long=-1" "print v_signed_long != 0" "\\$\[0-9\]* = 1" "print v_signed_long != -1" "\\$\[0-9\]* = 0" "print signed signed long != (minus)" -test_expr "set variable v_signed_long=-1" "print v_signed_long < 0" "\\$\[0-9\]* = 1" "print v_signed_long < 0x7FFF" "\\$\[0-9\]* = 1" "print signed signed long < (minus)" -test_expr "set variable v_signed_long=-1" "print v_signed_long > 0" "\\$\[0-9\]* = 0" "print v_signed_long > 0x7FFF" "\\$\[0-9\]* = 0" "print signed signed long > (minus)" +test_expr "set variable v_signed_long=-1" "print v_signed_long == 0" "\\$\[0-9\]* = $false" "print v_signed_long == -1" "\\$\[0-9\]* = $true" "print signed signed long == (minus)" +test_expr "set variable v_signed_long=-1" "print v_signed_long != 0" "\\$\[0-9\]* = $true" "print v_signed_long != -1" "\\$\[0-9\]* = $false" "print signed signed long != (minus)" +test_expr "set variable v_signed_long=-1" "print v_signed_long < 0" "\\$\[0-9\]* = $true" "print v_signed_long < 0x7FFF" "\\$\[0-9\]* = $true" "print signed signed long < (minus)" +test_expr "set variable v_signed_long=-1" "print v_signed_long > 0" "\\$\[0-9\]* = $false" "print v_signed_long > 0x7FFF" "\\$\[0-9\]* = $false" "print signed signed long > (minus)" # # test expressions with "unsigned long" types # -test_expr "set variable v_unsigned_long=0x7FFF" "print v_unsigned_long == 0" "\\$\[0-9\]* = 0" "print v_unsigned_long == 0x7FFF" "\\$\[0-9\]* = 1" "print unsigned long ==" -test_expr "set variable v_unsigned_long=0x7FFF" "print v_unsigned_long != 0" "\\$\[0-9\]* = 1" "print v_unsigned_long != 0x7FFF" "\\$\[0-9\]* = 0" "print unsigned long !=" -test_expr "set variable v_unsigned_long=0x7FFF" "print v_unsigned_long < 0" "\\$\[0-9\]* = 0" "print v_unsigned_long < 0x7FFF" "\\$\[0-9\]* = 0" "print unsigned long <" -test_expr "set variable v_unsigned_long=0x7FFF" "print v_unsigned_long > 0" "\\$\[0-9\]* = 1" "print v_unsigned_long > 0x7FFF" "\\$\[0-9\]* = 0" "print unsigned long >" +test_expr "set variable v_unsigned_long=0x7FFF" "print v_unsigned_long == 0" "\\$\[0-9\]* = $false" "print v_unsigned_long == 0x7FFF" "\\$\[0-9\]* = $true" "print unsigned long ==" +test_expr "set variable v_unsigned_long=0x7FFF" "print v_unsigned_long != 0" "\\$\[0-9\]* = $true" "print v_unsigned_long != 0x7FFF" "\\$\[0-9\]* = $false" "print unsigned long !=" +test_expr "set variable v_unsigned_long=0x7FFF" "print v_unsigned_long < 0" "\\$\[0-9\]* = $false" "print v_unsigned_long < 0x7FFF" "\\$\[0-9\]* = $false" "print unsigned long <" +test_expr "set variable v_unsigned_long=0x7FFF" "print v_unsigned_long > 0" "\\$\[0-9\]* = $true" "print v_unsigned_long > 0x7FFF" "\\$\[0-9\]* = $false" "print unsigned long >" # make long a minus -test_expr "set variable v_unsigned_long=~0" "print v_unsigned_long == 0" "\\$\[0-9\]* = 0" "print v_unsigned_long == ~0" "\\$\[0-9\]* = 1" "print v_unsigned_long == (unsigned long)~0" "\\$\[0-9\]* = 1" "print unsigned long == (~0)" -test_expr "set variable v_unsigned_long=~0" "print v_unsigned_long != 0" "\\$\[0-9\]* = 1" "print v_unsigned_long != (unsigned long)~0" "\\$\[0-9\]* = 0" "print unsigned long != (~0)" -test_expr "set variable v_unsigned_long=~0" "print v_unsigned_long < 0" "\\$\[0-9\]* = 0" "print v_unsigned_long < 0x7FFF" "\\$\[0-9\]* = 0" "print unsigned long < (~0)" -test_expr "set variable v_unsigned_long=~0" "print v_unsigned_long > 0" "\\$\[0-9\]* = 1" "print v_unsigned_long > 0x7FFF" "\\$\[0-9\]* = 1" "print unsigned long > (~0)" +test_expr "set variable v_unsigned_long=~0" "print v_unsigned_long == 0" "\\$\[0-9\]* = $false" "print v_unsigned_long == ~0" "\\$\[0-9\]* = $true" "print v_unsigned_long == (unsigned long)~0" "\\$\[0-9\]* = $true" "print unsigned long == (~0)" +test_expr "set variable v_unsigned_long=~0" "print v_unsigned_long != 0" "\\$\[0-9\]* = $true" "print v_unsigned_long != (unsigned long)~0" "\\$\[0-9\]* = $false" "print unsigned long != (~0)" +test_expr "set variable v_unsigned_long=~0" "print v_unsigned_long < 0" "\\$\[0-9\]* = $false" "print v_unsigned_long < 0x7FFF" "\\$\[0-9\]* = $false" "print unsigned long < (~0)" +test_expr "set variable v_unsigned_long=~0" "print v_unsigned_long > 0" "\\$\[0-9\]* = $true" "print v_unsigned_long > 0x7FFF" "\\$\[0-9\]* = $true" "print unsigned long > (~0)" diff --git a/gdb/testsuite/gdb.base/funcargs.c b/gdb/testsuite/gdb.base/funcargs.c index ead67e5..98d390b 100644 --- a/gdb/testsuite/gdb.base/funcargs.c +++ b/gdb/testsuite/gdb.base/funcargs.c @@ -71,8 +71,12 @@ char carray[] = {'a', 'n', ' ', 'a', 'r', 'r', 'a', 'y', '\0'}; /* Test various permutations and interleaving of integral arguments */ +#ifdef PROTOTYPES +void call0a (char c, short s, int i, long l) +#else call0a (c, s, i, l) char c; short s; int i; long l; +#endif { c = 'a'; s = 5; @@ -80,26 +84,42 @@ char c; short s; int i; long l; l = 7; } +#ifdef PROTOTYPES +void call0b (short s, int i, long l, char c) +#else call0b (s, i, l, c) short s; int i; long l; char c; +#endif { s = 6; i = 7; l = 8; c = 'j'; } +#ifdef PROTOTYPES +void call0c (int i, long l, char c, short s) +#else call0c (i, l, c, s) int i; long l; char c; short s; +#endif { i = 3; l = 4; c = 'k'; s = 5; } +#ifdef PROTOTYPES +void call0d (long l, char c, short s, int i) +#else call0d (l, c, s, i) long l; char c; short s; int i; +#endif { l = 7; c = 'z'; s = 8; i = 9; } +#ifdef PROTOTYPES +void call0e (char c1, long l, char c2, int i, char c3, short s, char c4, char c5) +#else call0e (c1, l, c2, i, c3, s, c4, c5) char c1; long l; char c2; int i; char c3; short s; char c4; char c5; +#endif { c1 = 'a'; l = 5; c2 = 'b'; i = 7; c3 = 'c'; s = 7; c4 = 'f'; c5 = 'g'; } @@ -108,33 +128,53 @@ char c1; long l; char c2; int i; char c3; short s; char c4; char c5; /* Test various permutations and interleaving of unsigned integral arguments */ +#ifdef PROTOTYPES +void call1a (unsigned char uc, unsigned short us, unsigned int ui, unsigned long ul) +#else call1a (uc, us, ui, ul) unsigned char uc; unsigned short us; unsigned int ui; unsigned long ul; +#endif { uc = 5; us = 6; ui = 7; ul = 8; } +#ifdef PROTOTYPES +void call1b (unsigned short us, unsigned int ui, unsigned long ul, unsigned char uc) +#else call1b (us, ui, ul, uc) unsigned short us; unsigned int ui; unsigned long ul; unsigned char uc; +#endif { uc = 5; us = 6; ui = 7; ul = 8; } +#ifdef PROTOTYPES +void call1c (unsigned int ui, unsigned long ul, unsigned char uc, unsigned short us) +#else call1c (ui, ul, uc, us) unsigned int ui; unsigned long ul; unsigned char uc; unsigned short us; +#endif { uc = 5; us = 6; ui = 7; ul = 8; } +#ifdef PROTOTYPES +void call1d (unsigned long ul, unsigned char uc, unsigned short us, unsigned int ui) +#else call1d (ul, uc, us, ui) unsigned long ul; unsigned char uc; unsigned short us; unsigned int ui; +#endif { uc = 5; us = 6; ui = 7; ul = 8; } +#ifdef PROTOTYPES +void call1e (unsigned char uc1, unsigned long ul, unsigned char uc2, unsigned int ui, unsigned char uc3, unsigned short us, unsigned char uc4, unsigned char uc5) +#else call1e (uc1, ul, uc2, ui, uc3, us, uc4, uc5) unsigned char uc1; unsigned long ul; unsigned char uc2; unsigned int ui; unsigned char uc3; unsigned short us; unsigned char uc4; unsigned char uc5; +#endif { uc1 = 5; ul = 7; uc2 = 8; ui = 9; uc3 = 10; us = 11; uc4 = 12; uc5 = 55; } @@ -143,57 +183,93 @@ unsigned char uc3; unsigned short us; unsigned char uc4; unsigned char uc5; floating point arguments. */ +#ifdef PROTOTYPES +void call2a (char c, float f1, short s, double d1, int i, float f2, long l, double d2) +#else call2a (c, f1, s, d1, i, f2, l, d2) char c; float f1; short s; double d1; int i; float f2; long l; double d2; +#endif { c = 'a'; f1 = 0.0; s = 5; d1 = 0.0; i = 6; f2 = 0.1; l = 7; d2 = 0.2; } +#ifdef PROTOTYPES +void call2b (float f1, short s, double d1, int i, float f2, long l, double d2, char c) +#else call2b (f1, s, d1, i, f2, l, d2, c) float f1; short s; double d1; int i; float f2; long l; double d2; char c; +#endif { c = 'a'; f1 = 0.0; s = 5; d1 = 0.0; i = 6; f2 = 0.1; l = 7; d2 = 0.2; } +#ifdef PROTOTYPES +void call2c (short s, double d1, int i, float f2, long l, double d2, char c, float f1) +#else call2c (s, d1, i, f2, l, d2, c, f1) short s; double d1; int i; float f2; long l; double d2; char c; float f1; +#endif { c = 'a'; f1 = 0.0; s = 5; d1 = 0.0; i = 6; f2 = 0.1; l = 7; d2 = 0.2; } +#ifdef PROTOTYPES +void call2d (double d1, int i, float f2, long l, double d2, char c, float f1, short s) +#else call2d (d1, i, f2, l, d2, c, f1, s) double d1; int i; float f2; long l; double d2; char c; float f1; short s; +#endif { c = 'a'; f1 = 0.0; s = 5; d1 = 0.0; i = 6; f2 = 0.1; l = 7; d2 = 0.2; } +#ifdef PROTOTYPES +void call2e (int i, float f2, long l, double d2, char c, float f1, short s, double d1) +#else call2e (i, f2, l, d2, c, f1, s, d1) int i; float f2; long l; double d2; char c; float f1; short s; double d1; +#endif { c = 'a'; f1 = 0.0; s = 5; d1 = 0.0; i = 6; f2 = 0.1; l = 7; d2 = 0.2; } +#ifdef PROTOTYPES +void call2f (float f2, long l, double d2, char c, float f1, short s, double d1, int i) +#else call2f (f2, l, d2, c, f1, s, d1, i) float f2; long l; double d2; char c; float f1; short s; double d1; int i; +#endif { c = 'a'; f1 = 0.0; s = 5; d1 = 0.0; i = 6; f2 = 0.1; l = 7; d2 = 0.2; } +#ifdef PROTOTYPES +void call2g (long l, double d2, char c, float f1, short s, double d1, int i, float f2) +#else call2g (l, d2, c, f1, s, d1, i, f2) long l; double d2; char c; float f1; short s; double d1; int i; float f2; +#endif { c = 'a'; f1 = 0.0; s = 5; d1 = 0.0; i = 6; f2 = 0.1; l = 7; d2 = 0.2; } +#ifdef PROTOTYPES +void call2h (double d2, char c, float f1, short s, double d1, int i, float f2, long l) +#else call2h (d2, c, f1, s, d1, i, f2, l) double d2; char c; float f1; short s; double d1; int i; float f2; long l; +#endif { c = 'a'; f1 = 0.0; s = 5; d1 = 0.0; i = 6; f2 = 0.1; l = 7; d2 = 0.2; } +#ifdef PROTOTYPES +void call2i (char c1, float f1, char c2, char c3, double d1, char c4, char c5, char c6, float f2, short s, char c7, double d2) +#else call2i (c1, f1, c2, c3, d1, c4, c5, c6, f2, s, c7, d2) char c1; float f1; char c2; char c3; double d1; char c4; char c5; char c6; float f2; short s; char c7; double d2; +#endif { c1 = 'a'; f1 = 0.0; c2 = 5; d1 = 0.0; c3 = 6; f2 = 0.1; c4 = 7; d2 = 0.2; c5 = 's'; c6 = 'f'; c7 = 'z'; s = 77; @@ -203,21 +279,33 @@ float f2; short s; char c7; double d2; /* Test pointers to various integral and floating types. */ +#ifdef PROTOTYPES +void call3a (char *cp, short *sp, int *ip, long *lp) +#else call3a (cp, sp, ip, lp) char *cp; short *sp; int *ip; long *lp; +#endif { cp = 0; sp = 0; ip = 0; lp = 0; } +#ifdef PROTOTYPES +void call3b (unsigned char *ucp, unsigned short *usp, unsigned int *uip, unsigned long *ulp) +#else call3b (ucp, usp, uip, ulp) unsigned char *ucp; unsigned short *usp; unsigned int *uip; unsigned long *ulp; +#endif { ucp = 0; usp = 0; uip = 0; ulp = 0; } +#ifdef PROTOTYPES +void call3c (float *fp, double *dp) +#else call3c (fp, dp) float *fp; double *dp; +#endif { fp = 0; dp = 0; } @@ -226,12 +314,20 @@ float *fp; double *dp; /* Test passing structures and unions by reference. */ +#ifdef PROTOTYPES +void call4a (struct stag *stp) +#else call4a (stp) -struct stag *stp; { -stp = 0;} +struct stag *stp; +#endif +{stp = 0;} +#ifdef PROTOTYPES +void call4b (union utag *unp) +#else call4b (unp) union utag *unp; +#endif { unp = 0; } @@ -240,165 +336,258 @@ union utag *unp; /* Test passing structures and unions by value. */ +#ifdef PROTOTYPES +void call5a (struct stag st) +#else call5a (st) -struct stag st; {st.s1 = 5;} +struct stag st; +#endif +{st.s1 = 5;} +#ifdef PROTOTYPES +void call5b (union utag un) +#else call5b (un) -union utag un; {un.u1 = 7;} +union utag un; +#endif +{un.u1 = 7;} /* Test shuffling of args */ -call6a (c, s, i, l, f, d, uc, us, ui, ul) -char c; short s; int i; long l; float f; double d; -unsigned char uc; unsigned short us; unsigned int ui; unsigned long ul; +void call6k () { - c = c; - call6b (s, i, l, f, d, uc, us, ui, ul); } -call6b (s, i, l, f, d, uc, us, ui, ul) -short s; int i; long l; float f; double d; -unsigned char uc; unsigned short us; unsigned int ui; unsigned long ul; +#ifdef PROTOTYPES +void call6j (unsigned long ul) +#else +call6j (ul) +unsigned long ul; +#endif { - s = s; - call6c (i, l, f, d, uc, us, ui, ul); + ul = ul; + call6k (); } -call6c (i, l, f, d, uc, us, ui, ul) -int i; long l; float f; double d; -unsigned char uc; unsigned short us; unsigned int ui; unsigned long ul; +#ifdef PROTOTYPES +void call6i (unsigned int ui, unsigned long ul) +#else +call6i (ui, ul) +unsigned int ui; unsigned long ul; +#endif { - i = i; - call6d (l, f, d, uc, us, ui, ul); + ui = ui; + call6j (ul); } -call6d (l, f, d, uc, us, ui, ul) -long l; float f; double d; -unsigned char uc; unsigned short us; unsigned int ui; unsigned long ul; +#ifdef PROTOTYPES +void call6h (unsigned short us, unsigned int ui, unsigned long ul) +#else +call6h (us, ui, ul) +unsigned short us; unsigned int ui; unsigned long ul; +#endif { - l = l; - call6e (f, d, uc, us, ui, ul); + us = us; + call6i (ui, ul); } -call6e (f, d, uc, us, ui, ul) -float f; double d; +#ifdef PROTOTYPES +void call6g (unsigned char uc, unsigned short us, unsigned int ui, unsigned long ul) +#else +call6g (uc, us, ui, ul) unsigned char uc; unsigned short us; unsigned int ui; unsigned long ul; +#endif { - f = f; - call6f (d, uc, us, ui, ul); + uc = uc; + call6h (us, ui, ul); } +#ifdef PROTOTYPES +void call6f (double d, unsigned char uc, unsigned short us, unsigned int ui, unsigned long ul) +#else call6f (d, uc, us, ui, ul) double d; unsigned char uc; unsigned short us; unsigned int ui; unsigned long ul; +#endif { d = d; call6g (uc, us, ui, ul); } -call6g (uc, us, ui, ul) +#ifdef PROTOTYPES +void call6e (float f, double d, unsigned char uc, unsigned short us, unsigned int ui, unsigned long ul) +#else +call6e (f, d, uc, us, ui, ul) +float f; double d; unsigned char uc; unsigned short us; unsigned int ui; unsigned long ul; +#endif { - uc = uc; - call6h (us, ui, ul); + f = f; + call6f (d, uc, us, ui, ul); } -call6h (us, ui, ul) -unsigned short us; unsigned int ui; unsigned long ul; +#ifdef PROTOTYPES +void call6d (long l, float f, double d, unsigned char uc, unsigned short us, unsigned int ui, unsigned long ul) +#else +call6d (l, f, d, uc, us, ui, ul) +long l; float f; double d; +unsigned char uc; unsigned short us; unsigned int ui; unsigned long ul; +#endif { - us = us; - call6i (ui, ul); + l = l; + call6e (f, d, uc, us, ui, ul); } -call6i (ui, ul) -unsigned int ui; unsigned long ul; +#ifdef PROTOTYPES +void call6c (int i, long l, float f, double d, unsigned char uc, unsigned short us, unsigned int ui, unsigned long ul) +#else +call6c (i, l, f, d, uc, us, ui, ul) +int i; long l; float f; double d; +unsigned char uc; unsigned short us; unsigned int ui; unsigned long ul; +#endif { - ui = ui; - call6j (ul); + i = i; + call6d (l, f, d, uc, us, ui, ul); } -call6j (ul) -unsigned long ul; +#ifdef PROTOTYPES +void call6b (short s, int i, long l, float f, double d, unsigned char uc, unsigned short us, unsigned int ui, unsigned long ul) +#else +call6b (s, i, l, f, d, uc, us, ui, ul) +short s; int i; long l; float f; double d; +unsigned char uc; unsigned short us; unsigned int ui; unsigned long ul; +#endif { - ul = ul; - call6k (); + s = s; + call6c (i, l, f, d, uc, us, ui, ul); } -call6k () +#ifdef PROTOTYPES +void call6a (char c, short s, int i, long l, float f, double d, unsigned char uc, unsigned short us, unsigned int ui, unsigned long ul) +#else +call6a (c, s, i, l, f, d, uc, us, ui, ul) +char c; short s; int i; long l; float f; double d; +unsigned char uc; unsigned short us; unsigned int ui; unsigned long ul; +#endif { + c = c; + call6b (s, i, l, f, d, uc, us, ui, ul); } - /* Test shuffling of args, round robin */ -call7a (c, i, s, l, f, uc, d, us, ul, ui) +#ifdef PROTOTYPES +void call7k (char c, int i, short s, long l, float f, unsigned char uc, double d, unsigned short us, unsigned long ul, unsigned int ui) +#else +call7k (c, i, s, l, f, uc, d, us, ul, ui) char c; int i; short s; long l; float f; unsigned char uc; double d; unsigned short us; unsigned long ul; unsigned int ui; +#endif { - call7b (i, s, l, f, uc, d, us, ul, ui, c); + c = 'a'; i = 7; s = 8; l = 7; f = 0.3; uc = 44; d = 0.44; us = 77; + ul = 43; ui = 33; } -call7b (i, s, l, f, uc, d, us, ul, ui, c) -int i; short s; long l; float f; unsigned char uc; double d; unsigned short us; unsigned long ul; unsigned int ui; char c; +#ifdef PROTOTYPES +void call7j (unsigned int ui, char c, int i, short s, long l, float f, unsigned char uc, double d, unsigned short us, unsigned long ul) +#else +call7j (ui, c, i, s, l, f, uc, d, us, ul) +unsigned int ui; char c; int i; short s; long l; float f; unsigned char uc; double d; unsigned short us; unsigned long ul; +#endif { - call7c (s, l, f, uc, d, us, ul, ui, c, i); + call7k (c, i, s, l, f, uc, d, us, ul, ui); } -call7c (s, l, f, uc, d, us, ul, ui, c, i) -short s; long l; float f; unsigned char uc; double d; unsigned short us; unsigned long ul; unsigned int ui; char c; int i; +#ifdef PROTOTYPES +void call7i (unsigned long ul, unsigned int ui, char c, int i, short s, long l, float f, unsigned char uc, double d, unsigned short us) +#else +call7i (ul, ui, c, i, s, l, f, uc, d, us) +unsigned long ul; unsigned int ui; char c; int i; short s; long l; float f; unsigned char uc; double d; unsigned short us; +#endif { - call7d (l, f, uc, d, us, ul, ui, c, i, s); + call7j (ui, c, i, s, l, f, uc, d, us, ul); } -call7d (l, f, uc, d, us, ul, ui, c, i, s) -long l; float f; unsigned char uc; double d; unsigned short us; unsigned long ul; unsigned int ui; char c; int i; short s; +#ifdef PROTOTYPES +void call7h (unsigned short us, unsigned long ul, unsigned int ui, char c, int i, short s, long l, float f, unsigned char uc, double d) +#else +call7h (us, ul, ui, c, i, s, l, f, uc, d) +unsigned short us; unsigned long ul; unsigned int ui; char c; int i; short s; long l; float f; unsigned char uc; double d; +#endif { - call7e (f, uc, d, us, ul, ui, c, i, s, l); + call7i (ul, ui, c, i, s, l, f, uc, d, us); } -call7e (f, uc, d, us, ul, ui, c, i, s, l) -float f; unsigned char uc; double d; unsigned short us; unsigned long ul; unsigned int ui; char c; int i; short s; long l; +#ifdef PROTOTYPES +void call7g (double d, unsigned short us, unsigned long ul, unsigned int ui, char c, int i, short s, long l, float f, unsigned char uc) +#else +call7g (d, us, ul, ui, c, i, s, l, f, uc) +double d; unsigned short us; unsigned long ul; unsigned int ui; char c; int i; short s; long l; float f; unsigned char uc; +#endif { - call7f (uc, d, us, ul, ui, c, i, s, l, f); + call7h (us, ul, ui, c, i, s, l, f, uc, d); } +#ifdef PROTOTYPES +void call7f (unsigned char uc, double d, unsigned short us, unsigned long ul, unsigned int ui, char c, int i, short s, long l, float f) +#else call7f (uc, d, us, ul, ui, c, i, s, l, f) unsigned char uc; double d; unsigned short us; unsigned long ul; unsigned int ui; char c; int i; short s; long l; float f; +#endif { call7g (d, us, ul, ui, c, i, s, l, f, uc); } -call7g (d, us, ul, ui, c, i, s, l, f, uc) -double d; unsigned short us; unsigned long ul; unsigned int ui; char c; int i; short s; long l; float f; unsigned char uc; +#ifdef PROTOTYPES +void call7e (float f, unsigned char uc, double d, unsigned short us, unsigned long ul, unsigned int ui, char c, int i, short s, long l) +#else +call7e (f, uc, d, us, ul, ui, c, i, s, l) +float f; unsigned char uc; double d; unsigned short us; unsigned long ul; unsigned int ui; char c; int i; short s; long l; +#endif { - call7h (us, ul, ui, c, i, s, l, f, uc, d); + call7f (uc, d, us, ul, ui, c, i, s, l, f); } -call7h (us, ul, ui, c, i, s, l, f, uc, d) -unsigned short us; unsigned long ul; unsigned int ui; char c; int i; short s; long l; float f; unsigned char uc; double d; +#ifdef PROTOTYPES +void call7d (long l, float f, unsigned char uc, double d, unsigned short us, unsigned long ul, unsigned int ui, char c, int i, short s) +#else +call7d (l, f, uc, d, us, ul, ui, c, i, s) +long l; float f; unsigned char uc; double d; unsigned short us; unsigned long ul; unsigned int ui; char c; int i; short s; +#endif { - call7i (ul, ui, c, i, s, l, f, uc, d, us); + call7e (f, uc, d, us, ul, ui, c, i, s, l); } -call7i (ul, ui, c, i, s, l, f, uc, d, us) -unsigned long ul; unsigned int ui; char c; int i; short s; long l; float f; unsigned char uc; double d; unsigned short us; +#ifdef PROTOTYPES +void call7c (short s, long l, float f, unsigned char uc, double d, unsigned short us, unsigned long ul, unsigned int ui, char c, int i) +#else +call7c (s, l, f, uc, d, us, ul, ui, c, i) +short s; long l; float f; unsigned char uc; double d; unsigned short us; unsigned long ul; unsigned int ui; char c; int i; +#endif { - call7j (ui, c, i, s, l, f, uc, d, us, ul); + call7d (l, f, uc, d, us, ul, ui, c, i, s); } -call7j (ui, c, i, s, l, f, uc, d, us, ul) -unsigned int ui; char c; int i; short s; long l; float f; unsigned char uc; double d; unsigned short us; unsigned long ul; +#ifdef PROTOTYPES +void call7b (int i, short s, long l, float f, unsigned char uc, double d, unsigned short us, unsigned long ul, unsigned int ui, char c) +#else +call7b (i, s, l, f, uc, d, us, ul, ui, c) +int i; short s; long l; float f; unsigned char uc; double d; unsigned short us; unsigned long ul; unsigned int ui; char c; +#endif { - call7k (c, i, s, l, f, uc, d, us, ul, ui); + call7c (s, l, f, uc, d, us, ul, ui, c, i); } -call7k (c, i, s, l, f, uc, d, us, ul, ui) +#ifdef PROTOTYPES +void call7a (char c, int i, short s, long l, float f, unsigned char uc, double d, unsigned short us, unsigned long ul, unsigned int ui) +#else +call7a (c, i, s, l, f, uc, d, us, ul, ui) char c; int i; short s; long l; float f; unsigned char uc; double d; unsigned short us; unsigned long ul; unsigned int ui; +#endif { - c = 'a'; i = 7; s = 8; l = 7; f = 0.3; uc = 44; d = 0.44; us = 77; - ul = 43; ui = 33; + call7b (i, s, l, f, uc, d, us, ul, ui, c); } @@ -412,13 +601,17 @@ typedef struct s long l; } SVAL; -hitbottom () +void hitbottom () { } +#ifdef PROTOTYPES +void recurse (SVAL a, int depth) +#else void recurse (a, depth) SVAL a; int depth; +#endif { a.s = a.i = a.l = --depth; if (depth == 0) @@ -427,7 +620,7 @@ int depth; recurse (a, depth); } -test_struct_args () +void test_struct_args () { SVAL s; s.s = 5; s.i = 5; s.l = 5; @@ -438,12 +631,16 @@ test_struct_args () calls alloca may do things differently with respect to frames. So give it a try. */ +#ifdef PROTOTYPES +void localvars_after_alloca (char c, short s, int i, long l) +#else int localvars_after_alloca (c, s, i, l) char c; short s; int i; long l; +#endif { #ifdef HAVE_STACK_ALLOCA /* No need to use the alloca.c alloca-on-top-of-malloc; it doesn't @@ -458,21 +655,29 @@ localvars_after_alloca (c, s, i, l) l = 7; } +#ifdef PROTOTYPES +void call_after_alloca_subr (char c, short s, int i, long l, unsigned char uc, unsigned short us, unsigned int ui, unsigned long ul) +#else void call_after_alloca_subr (c, s, i, l, uc, us, ui, ul) char c; int i; short s; long l; unsigned char uc; unsigned short us; unsigned long ul; unsigned int ui; +#endif { c = 'a'; i = 7; s = 8; l = 7; uc = 44; us = 77; ul = 43; ui = 33; } +#ifdef PROTOTYPES +void call_after_alloca (char c, short s, int i, long l) +#else int call_after_alloca (c, s, i, l) char c; short s; int i; long l; +#endif { #ifdef HAVE_STACK_ALLOCA /* No need to use the alloca.c alloca-on-top-of-malloc; it doesn't @@ -491,9 +696,13 @@ call_after_alloca (c, s, i, l) will require a trampoline between dyncall and this function on the call path, then another trampoline on between this function and main on the return path. */ +#ifdef PROTOTYPES +double call_with_trampolines (double d1) +#else double call_with_trampolines (d1) double d1; +#endif { return d1; } /* End of call_with_trampolines, this comment is needed by funcargs.exp */ @@ -506,10 +715,10 @@ marker_indirect_call () {} void marker_call_with_trampolines () {} -main () +int main () { - int (*pointer_to_call0a) () = call0a; - double (*pointer_to_call_with_trampolines) () = call_with_trampolines; + void (*pointer_to_call0a) (char, short, int, long) = (void (*)(char, short, int, long))call0a; + double (*pointer_to_call_with_trampolines) (double) = call_with_trampolines; #ifdef usestubs set_debug_traps(); @@ -579,4 +788,5 @@ main () (*pointer_to_call0a) (c, s, i, l); /* Second step into call0a. */ marker_call_with_trampolines (); (*pointer_to_call_with_trampolines) (d); /* Test multiple trampolines. */ + return 0; } diff --git a/gdb/testsuite/gdb.base/funcargs.exp b/gdb/testsuite/gdb.base/funcargs.exp index cc7a6d6..baa4ab6 100644 --- a/gdb/testsuite/gdb.base/funcargs.exp +++ b/gdb/testsuite/gdb.base/funcargs.exp @@ -167,6 +167,7 @@ proc float_and_integral_args {} { global gdb_prompt global det_file global gcc_compiled + global hp_cc_compiler delete_breakpoints @@ -186,55 +187,67 @@ proc float_and_integral_args {} { # code is broken. setup_xfail "a29k-*-udi" if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "mips-sgi-irix5*" } + # The debug info. for "f" is not correct. It's a known bug. + if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*} gdb_run_cmd gdb_expect { -re ".* call2a \\(c=97 'a', f1=4, s=1, d1=5, i=2, f2=4, l=3, d2=5\\) .*$gdb_prompt $" { pass "run to call2a" } + -re ".* call2a \\(c=97 'a', f1=.*, s=1, d1=5, i=2, f2=4, l=3, d2=5\\) .*$gdb_prompt $" { xfail "run to call2a" } -re "$gdb_prompt $" { fail "run to call2a" ; gdb_suppress_tests; } timeout { fail "(timeout) run to call2a" ; gdb_suppress_tests; } } # Print each arg as a double check to see if we can print gdb_test "print c" ".* = 97 'a'" "print c after run to call2a" + if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*} gdb_test "print f1" ".* = 4" "print f1 after run to call2a" gdb_test "print s" ".* = 1" "print s after run to call2a" gdb_test "print d1" ".* = 5" "print d1 after run to call2a" gdb_test "print i" ".* = 2" "print i after run to call2a" + if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*} gdb_test "print f2" ".* = 4" "print f2 after run to call2a" gdb_test "print l" ".* = 3" "print l after run to call2a" gdb_test "print d2" ".* = 5" "print d2 after run to call2a" setup_xfail "rs6000-*-*" + if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*} if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix*" } # Continue; should stop at call2b and print actual arguments. if [gdb_test "cont" ".* call2b \\(f1=4, s=1, d1=5, i=2, f2=4, l=3, d2=5, c=97 'a'\\) .*" "continue to call2b"] { gdb_suppress_tests; } + if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*} # Continue; should stop at call2c and print actual arguments. if [gdb_test "cont" ".* call2c \\(s=1, d1=5, i=2, f2=4, l=3, d2=5, c=97 'a', f1=4\\) .*" "continue to call2c"] { gdb_suppress_tests; } + if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*} # Continue; should stop at call2d and print actual arguments. if [gdb_test "cont" ".* call2d \\(d1=5, i=2, f2=4, l=3, d2=5, c=97 'a', f1=4, s=1\\) .*" "continue to call2d"] { gdb_suppress_tests; } + if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*} # Continue; should stop at call2e and print actual arguments. if [gdb_test "cont" ".* call2e \\(i=2, f2=4, l=3, d2=5, c=97 'a', f1=4, s=1, d1=5\\) .*" "continue to call2e"] { gdb_suppress_tests; } + if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*} # Continue; should stop at call2f and print actual arguments. if [gdb_test "cont" ".* call2f \\(f2=4, l=3, d2=5, c=97 'a', f1=4, s=1, d1=5, i=2\\) .*" "continue to call2f"] { gdb_suppress_tests; } + if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*} # Continue; should stop at call2g and print actual arguments. if [gdb_test "cont" ".* call2g \\(l=3, d2=5, c=97 'a', f1=4, s=1, d1=5, i=2, f2=4\\) .*" "continue to call2g"] { gdb_suppress_tests; } + if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*} # Continue; should stop at call2h and print actual arguments. if [gdb_test "cont" ".* call2h \\(d2=5, c=97 'a', f1=4, s=1, d1=5, i=2, f2=4, l=3\\) .*" "continue to call2h"] { gdb_suppress_tests; @@ -245,6 +258,7 @@ proc float_and_integral_args {} { delete_breakpoints gdb_breakpoint call2i + if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*} # Continue; should stop at call2i and print actual arguments. if [gdb_test "cont" ".* call2i \\(c1=97 'a', f1=4, c2=97 'a', c3=97 'a', d1=5, c4=97 'a', c5=97 'a', c6=97 'a', f2=4, s=1, c7=97 'a', d2=5\\) .*" "continue to call2i"] { gdb_suppress_tests; @@ -449,6 +463,7 @@ proc discard_and_shuffle {} { global decimal global det_file global gcc_compiled + global hp_cc_compiler delete_breakpoints @@ -480,8 +495,30 @@ proc discard_and_shuffle {} { setup_xfail "mips-sgi-irix5*" } - if [gdb_test "backtrace 100" " call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* main \\(.*\\).*" "backtrace from call6a"] { - gdb_suppress_tests; + # The debug info. for "f" is not correct. It's a known bug. + if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*} + send_gdb "backtrace 100\n" + gdb_expect { + -re "backtrace 100\[\r\n\]+ +.* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r +.* main \\(.*\\) .*\r +$gdb_prompt $" { + pass "backtrace from call6a" + } + -re "backtrace 100\[\r\n\]+ +.* call6a \\(c=97 'a', s=1, i=2, l=3, f=.*, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\r +.* main \\(.*\\) .*\r +$gdb_prompt $" { + xfail "backtrace from call6a" + } + -re "$gdb_prompt $" { + fail "backtrace from call6a" + gdb_suppress_tests + } + timeout { + fail "(timeout) backtrace from call6a" + gdb_suppress_tests + } } # Continue; should stop at call6b and print actual arguments. @@ -489,7 +526,8 @@ proc discard_and_shuffle {} { gdb_continue call6b - if [gdb_test "backtrace 100" " call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* main \\(.*\\).*" "backtrace from call6b"] { + if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*} + if [gdb_test "backtrace 100" ".* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\]*.* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* main \\(.*\\) .*\[\r\n\]" "backtrace from call6b"] { gdb_suppress_tests; } @@ -498,7 +536,8 @@ proc discard_and_shuffle {} { gdb_continue call6c - if [gdb_test "backtrace 100" " call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* main \\(.*\\).*" "backtrace from call6c"] { + if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*} + if [gdb_test "backtrace 100" ".* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n].* main \\(.*\\) .*" "backtrace from call6c"] { gdb_suppress_tests; } # Continue; should stop at call6d and print actual arguments. @@ -506,7 +545,8 @@ proc discard_and_shuffle {} { gdb_continue call6d - if [gdb_test "backtrace 100" " call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* main \\(.*\\).*" "backtrace from call6d"] { + if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*} + if [gdb_test "backtrace 100" ".* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n].* main \\(.*\\) .*" "backtrace from call6d"] { gdb_suppress_tests; } @@ -515,7 +555,8 @@ proc discard_and_shuffle {} { gdb_continue call6e - if [gdb_test "backtrace 100" " call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* main \\(.*\\).*" "backtrace from call6e"] { + if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*} + if [gdb_test "backtrace 100" ".* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n].* main \\(.*\\) .*" "backtrace from call6e"] { gdb_suppress_tests; } @@ -524,7 +565,8 @@ proc discard_and_shuffle {} { gdb_continue call6f - if [gdb_test "backtrace 100" " call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* main \\(.*\\).*" "backtrace from call6f"] { + if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*} + if [gdb_test "backtrace 100" ".* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n].* main \\(.*\\) .*" "backtrace from call6f"] { gdb_suppress_tests; } @@ -533,7 +575,8 @@ proc discard_and_shuffle {} { gdb_continue call6g - if [gdb_test "backtrace 100" " call6g \\(uc=98 'b', us=6, ui=7, ul=8\\).* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* main \\(.*\\).*" "backtrace from call6g"] { + if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*} + if [gdb_test "backtrace 100" ".* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n].* main \\(.*\\) .*" "backtrace from call6g"] { gdb_suppress_tests; } @@ -542,7 +585,8 @@ proc discard_and_shuffle {} { gdb_continue call6h - if [gdb_test "backtrace 100" " call6h \\(us=6, ui=7, ul=8\\).* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\).* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* main \\(.*\\).*" "backtrace from call6h"] { + if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*} + if [gdb_test "backtrace 100" ".* call6h \\(us=6, ui=7, ul=8\\) .*\[\r\n\].* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n].* main \\(.*\\) .*" "backtrace from call6h"] { gdb_suppress_tests; } @@ -558,7 +602,8 @@ proc discard_and_shuffle {} { gdb_continue call6i - if [gdb_test "backtrace 100" " call6i \\(ui=7, ul=8\\).* call6h \\(us=6, ui=7, ul=8\\).* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\).* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* main \\(.*\\).*" "backtrace from call6i"] { + if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*} + if [gdb_test "backtrace 100" ".* call6i \\(ui=7, ul=8\\) .*\[\r\n\].* call6h \\(us=6, ui=7, ul=8\\) .*\[\r\n\].* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n].* main \\(.*\\) .*" "backtrace from call6i"] { gdb_suppress_tests; } @@ -567,7 +612,8 @@ proc discard_and_shuffle {} { gdb_continue call6j - if [gdb_test "backtrace 100" " call6j \\(ul=8\\).* call6i \\(ui=7, ul=8\\).* call6h \\(us=6, ui=7, ul=8\\).* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\).* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* main \\(.*\\).*" "backtrace from call6j"] { + if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*} + if [gdb_test "backtrace 100" ".* call6j \\(ul=8\\) .*\[\r\n\].* call6i \\(ui=7, ul=8\\) .*\[\r\n\].* call6h \\(us=6, ui=7, ul=8\\) .*\[\r\n\].* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n].* main \\(.*\\) .*" "backtrace from call6j"] { gdb_suppress_tests; } @@ -578,7 +624,8 @@ proc discard_and_shuffle {} { setup_xfail "i960-*-vxworks" 1786 gdb_continue call6k - if [gdb_test "backtrace 100" " call6k \\(\\).* call6j \\(ul=8\\).* call6i \\(ui=7, ul=8\\).* call6h \\(us=6, ui=7, ul=8\\).* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\).* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\).* main \\(.*\\).*" "backtrace from call6k"] { + if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*} + if [gdb_test "backtrace 100" ".* call6k \\(\\) .*\[\r\n\].* call6j \\(ul=8\\) .*\[\r\n\].* call6i \\(ui=7, ul=8\\) .*\[\r\n\].* call6h \\(us=6, ui=7, ul=8\\) .*\[\r\n\].* call6g \\(uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6f \\(d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6e \\(f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6d \\(l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6c \\(i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6b \\(s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n\].* call6a \\(c=97 'a', s=1, i=2, l=3, f=4, d=5, uc=98 'b', us=6, ui=7, ul=8\\) .*\[\r\n].* main \\(.*\\) .*" "backtrace from call6k"] { gdb_suppress_tests; } gdb_stop_suppressing_tests; @@ -595,6 +642,7 @@ proc shuffle_round_robin {} { global decimal global det_file global gcc_compiled + global hp_cc_compiler delete_breakpoints @@ -624,7 +672,25 @@ proc shuffle_round_robin {} { setup_xfail "i960-*-*" 1813 if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "mips-sgi-irix5*" } - gdb_test "backtrace 100" " call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\).* main \\(.*\\).*" "backtrace from call7a" + # The debug info. for "f" is not correct. It's a known bug. + if {$hp_cc_compiler} {setup_xfail hppa2.0w-*-*} + send_gdb "backtrace 100\n" + gdb_expect { + -re "backtrace 100\[\r\n\]+ +.* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r +.* main \\(.*\\) .*\r +$gdb_prompt $" { + pass "backtrace from call7a" + } + -re "backtrace 100\[\r\n\]+ +.* call7a \\(c=97 'a', i=2, s=1, l=3, f=.*, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\r +.* main \\(.*\\) .*\r +$gdb_prompt $" { + xfail "backtrace from call7a" + } + -re "$gdb_prompt $" { fail "backtrace from call7a" ; return } + timeout { fail "(timeout) backtrace from call7a" ; return } + } # Continue; should stop at call7b and print actual arguments. # Print backtrace. @@ -633,43 +699,43 @@ proc shuffle_round_robin {} { if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } - gdb_test "backtrace 100" " call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\).* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\).* main \\(.*\\).*" "backtrace from call7b" + gdb_test "backtrace 100" ".* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\[\r\n\].* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\[\r\n\].* main \\(.*\\) .*\[\r\n\].*" "backtrace from call7b" # Continue; should stop at call7c and print actual arguments. # Print backtrace. gdb_continue call7c - gdb_test "backtrace 100" " call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\).* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\).* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\).* main \\(.*\\).*" "backtrace from call7c" + gdb_test "backtrace 100" ".* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\[\r\n\].* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\[\r\n\].* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\[\r\n\].* main \\(.*\\) .*\[\r\n\].*" "backtrace from call7c" # Continue; should stop at call7d and print actual arguments. # Print backtrace. gdb_continue call7d - gdb_test "backtrace 100" " call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\).* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\).* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\).* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\).* main \\(.*\\).*" "backtrace from call7d" + gdb_test "backtrace 100" ".* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\[\r\n\].* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\[\r\n\].* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\[\r\n\].* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\[\r\n\].* main \\(.*\\) .*\[\r\n\].*" "backtrace from call7d" gdb_continue call7e - gdb_test "backtrace 100" " call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\).* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\).* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\).* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\).* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\).* main \\(.*\\).*" "backtrace from call7e" + gdb_test "backtrace 100" ".* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\[\r\n\].* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\[\r\n\].* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\[\r\n\].* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\[\r\n\].* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\[\r\n\].* main \\(.*\\) .*\[\r\n\].*" "backtrace from call7e" # Continue; should stop at call7f and print actual arguments. # Print backtrace. gdb_continue call7f - gdb_test "backtrace 100" " call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\).* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\).* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\).* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\).* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\).* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\).* main \\(.*\\).*" "backtrace from call7f" + gdb_test "backtrace 100" ".* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\[\r\n\].* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\[\r\n\].* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\[\r\n\].* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\[\r\n\].* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\[\r\n\].* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\[\r\n\].* main \\(.*\\) .*\[\r\n\].*" "backtrace from call7f" # Continue; should stop at call7g and print actual arguments. # Print backtrace. gdb_continue call7g - gdb_test "backtrace 100" " call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\).* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\).* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\).* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\).* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\).* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\).* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\).* main \\(.*\\).*" "backtrace from call7g" + gdb_test "backtrace 100" ".* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) .*\[\r\n\].* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\[\r\n\].* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\[\r\n\].* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\[\r\n\].* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\[\r\n\].* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\[\r\n\].* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\[\r\n\].* main \\(.*\\) .*\[\r\n\].*" "backtrace from call7g" gdb_continue call7h - gdb_test "backtrace 100" " call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\).* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\).* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\).* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\).* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\).* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\).* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\).* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\).* main \\(.*\\).*" "backtrace from call7h" + gdb_test "backtrace 100" ".* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\) .*\[\r\n\].* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) .*\[\r\n\].* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\[\r\n\].* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\[\r\n\].* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\[\r\n\].* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\[\r\n\].* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\[\r\n\].* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\[\r\n\].* main \\(.*\\) .*\[\r\n\].*" "backtrace from call7h" # monitor only allows 8 breakpoints; w89k board allows 10, so # break them up into two groups. @@ -683,14 +749,14 @@ proc shuffle_round_robin {} { gdb_continue call7i - gdb_test "backtrace 100" " call7i \\(ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\\).* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\).* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\).* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\).* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\).* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\).* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\).* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\).* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\).* main \\(.*\\).*" "backtrace from call7i" + gdb_test "backtrace 100" ".* call7i \\(ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\\) .*\[\r\n\].* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\) .*\[\r\n\].* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) .*\[\r\n\].* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\[\r\n\].* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\[\r\n\].* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\[\r\n\].* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\[\r\n\].* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\[\r\n\].* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\[\r\n\].* main \\(.*\\) .*\[\r\n\].*" "backtrace from call7i" # Continue; should stop at call7j and print actual arguments. # Print backtrace. gdb_continue call7j - gdb_test "backtrace 100" " call7j \\(ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8\\).* call7i \\(ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\\).* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\).* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\).* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\).* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\).* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\).* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\).* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\).* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\).* main \\(.*\\).*" "backtrace from call7j" + gdb_test "backtrace 100" ".* call7j \\(ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8\\) .*\[\r\n\].* call7i \\(ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\\) .*\[\r\n\].* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\) .*\[\r\n\].* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) .*\[\r\n\].* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\[\r\n\].* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\[\r\n\].* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\[\r\n\].* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\[\r\n\].* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\[\r\n\].* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\[\r\n\].* main \\(.*\\) .*\[\r\n\].*" "backtrace from call7j" # Continue; should stop at call7k and print actual arguments. # Print backtrace. @@ -698,7 +764,7 @@ proc shuffle_round_robin {} { gdb_continue call7k if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix*" } - gdb_test "backtrace 100" " call7k \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\).* call7j \\(ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8\\).* call7i \\(ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\\).* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\).* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\).* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\).* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\).* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\).* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\).* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\).* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\).* main \\(.*\\).*" "backtrace from call7k" + gdb_test "backtrace 100" ".* call7k \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\[\r\n\].* call7j \\(ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8\\) .*\[\r\n\].* call7i \\(ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6\\) .*\[\r\n\].* call7h \\(us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5\\) .*\[\r\n\].* call7g \\(d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b'\\) .*\[\r\n\].* call7f \\(uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3, f=4\\) .*\[\r\n\].* call7e \\(f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1, l=3\\) .*\[\r\n\].* call7d \\(l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2, s=1\\) .*\[\r\n\].* call7c \\(s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a', i=2\\) .*\[\r\n\].* call7b \\(i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7, c=97 'a'\\) .*\[\r\n\].* call7a \\(c=97 'a', i=2, s=1, l=3, f=4, uc=98 'b', d=5, us=6, ul=8, ui=7\\) .*\[\r\n\].* main \\(.*\\) .*\[\r\n\].*" "backtrace from call7k" gdb_stop_suppressing_tests; } @@ -729,7 +795,7 @@ proc recursive_structs_by_value {} { # The a29k fails all of these tests, perhaps because the prologue # code is broken. setup_xfail "a29k-*-udi" - gdb_test "backtrace 100" " hitbottom \\(\\).* recurse \\(a=\{s = 0, i = 0, l = 0\}, depth=0\\).* recurse \\(a=\{s = 1, i = 1, l = 1\}, depth=1\\).* recurse \\(a=\{s = 2, i = 2, l = 2\}, depth=2\\).* recurse \\(a=\{s = 3, i = 3, l = 3\}, depth=3\\).* recurse \\(a=\{s = 4, i = 4, l = 4\}, depth=4\\).* test_struct_args \\(\\).* main \\(.*\\).*" "recursive passing of structs by value" + gdb_test "backtrace 100" ".* hitbottom \\(\\) .*\[\r\n\].* recurse \\(a=\{s = 0, i = 0, l = 0\}, depth=0\\) .*\[\r\n\].* recurse \\(a=\{s = 1, i = 1, l = 1\}, depth=1\\) .*\[\r\n\].* recurse \\(a=\{s = 2, i = 2, l = 2\}, depth=2\\) .*\[\r\n\].* recurse \\(a=\{s = 3, i = 3, l = 3\}, depth=3\\) .*\[\r\n\].* recurse \\(a=\{s = 4, i = 4, l = 4\}, depth=4\\) .*\[\r\n\].* test_struct_args \\(\\) .*\[\r\n\].* main \\(.*\\) .*\[\r\n\]" "recursive passing of structs by value" } else { fail "recursive passing of structs by value (sparclet)" } @@ -859,10 +925,12 @@ proc localvars_in_indirect_call { } { send_gdb "finish\n" gdb_expect { -re "\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*First.*$gdb_prompt $" { +#On hppa2.0w-hp-hpux11.00, gdb finishes at one line earlier than +#hppa1.1-hp-hpux11.00. Therefore, an extra "step" is necessary to continue the test. send_gdb "step\n" exp_continue } - -re "\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*Second.*$gdb_prompt $" { + -re ".*\\(\\*pointer_to_call0a\\) \\(c, s, i, l\\);.*Second.*$gdb_prompt $" { pass "finish from indirectly called function" } -re ".*$gdb_prompt $" { @@ -922,7 +990,8 @@ proc test_stepping_over_trampolines { } { send_gdb "step\n" gdb_expect { -re "main .* at.*$gdb_prompt $" { - pass "stepping back to main from function called with trampolines" ; + pass "stepping back to main from function called with trampolines" ; + gdb_suppress_tests } -re "\}.*End of call_with_trampolines.*$gdb_prompt $" { send_gdb "step\n" diff --git a/gdb/testsuite/gdb.base/interrupt.c b/gdb/testsuite/gdb.base/interrupt.c index 120697b..a895d4b 100644 --- a/gdb/testsuite/gdb.base/interrupt.c +++ b/gdb/testsuite/gdb.base/interrupt.c @@ -1,5 +1,7 @@ #include <errno.h> #include <stdio.h> +#include <unistd.h> +#include <stdlib.h> int main () { @@ -28,6 +30,7 @@ main () else write (1, &x, 1); } + return 0; } int diff --git a/gdb/testsuite/gdb.base/interrupt.exp b/gdb/testsuite/gdb.base/interrupt.exp index 60cf838..379df02 100644 --- a/gdb/testsuite/gdb.base/interrupt.exp +++ b/gdb/testsuite/gdb.base/interrupt.exp @@ -105,7 +105,14 @@ if ![file exists $binfile] then { fail "child died when we called func1, skipped rest of tests" return } - -re "$gdb_prompt $" { fail "call function when asleep (wrong output)" } + -re "$gdb_prompt $" { + # On HPUX-11.0 'send "p func1 ()"' above + # terminates the program. A defect is pending on this + # issue [defect #DTS CHFts24203]. Hence calling setup_xfail + # below. + setup_xfail "hppa*-*-*11*" + fail "call function when asleep (wrong output)" + } default { # This fail probably happens whenever we use /proc (we @@ -114,7 +121,6 @@ if ![file exists $binfile] then { setup_xfail "sparc*-*-solaris2*" setup_xfail "mips-*-ultrix*" - setup_xfail "hppa*-*-*" setup_xfail "i386*-*-bsd*" setup_xfail "i*86-*-solaris2*" setup_xfail "*-*-sysv4*" @@ -154,6 +160,9 @@ if ![file exists $binfile] then { # The optional leading \r\n is in case we sent a newline above # to wake the program, in which case the program now sends it # back. + # FIXME: The pattern below leads to an expected success on HPUX-11.0 + # but the success is spurious. Need to provide the right reg.expr. + # here. gdb_expect { -re "^(\r\n|)data\r\n(|data\r\n)$" { pass "echo data" } timeout { fail "echo data (timeout)" } diff --git a/gdb/testsuite/gdb.base/jump.c b/gdb/testsuite/gdb.base/jump.c index e16d0fd..aae94f7 100644 --- a/gdb/testsuite/gdb.base/jump.c +++ b/gdb/testsuite/gdb.base/jump.c @@ -2,18 +2,23 @@ particularly deep about the functionality nor names in here. */ +#ifdef PROTOTYPES +static int square (int x) +#else static int square (x) int x; +#endif { return x*x; } -main () +int main () { int i = 99; i++; i = square (i); i--; + return 0; } diff --git a/gdb/testsuite/gdb.base/jump.exp b/gdb/testsuite/gdb.base/jump.exp index c110e21..cca9094 100644 --- a/gdb/testsuite/gdb.base/jump.exp +++ b/gdb/testsuite/gdb.base/jump.exp @@ -56,10 +56,10 @@ if ![runto_main] then { # Set a breakpoint on the statement that we're about to jump to. # The statement doesn't contain a function call. # -send_gdb "break 18\n" +send_gdb "break 22\n" set bp_on_non_call 0 gdb_expect { - -re "\[Bb\]reakpoint (\[0-9\]*) at 0x\[0-9a-fA-F\]*: file .*${srcfile}, line 18.*$gdb_prompt $"\ + -re "\[Bb\]reakpoint (\[0-9\]*) at 0x\[0-9a-fA-F\]*: file .*${srcfile}, line 22.*$gdb_prompt $"\ {set bp_on_non_call $expect_out(1,string) pass "break before jump to non-call"} -re "$gdb_prompt $"\ @@ -69,9 +69,9 @@ gdb_expect { # Can we jump to the statement? Do we stop there? # -send_gdb "jump 18\n" +send_gdb "jump 22\n" gdb_expect { - -re "Breakpoint \[0-9\]*, .*${srcfile}:18.*$gdb_prompt $"\ + -re "Breakpoint \[0-9\]*, .*${srcfile}:22.*$gdb_prompt $"\ {pass "jump to non-call"} -re "$gdb_prompt $"\ {fail "jump to non-call"} @@ -81,10 +81,10 @@ gdb_expect { # Set a breakpoint on the statement that we're about to jump to. # The statement does contain a function call. # -send_gdb "break 17\n" +send_gdb "break 21\n" set bp_on_call 0 gdb_expect { - -re "\[Bb\]reakpoint (\[0-9\]*) at 0x\[0-9a-fA-F\]*: file .*${srcfile}, line 17.*$gdb_prompt $"\ + -re "\[Bb\]reakpoint (\[0-9\]*) at 0x\[0-9a-fA-F\]*: file .*${srcfile}, line 21.*$gdb_prompt $"\ {set bp_on_call $expect_out(1,string) pass "break before jump to call"} -re "$gdb_prompt $"\ @@ -94,9 +94,9 @@ gdb_expect { # Can we jump to the statement? Do we stop there? # -send_gdb "jump 17\n" +send_gdb "jump 21\n" gdb_expect { - -re "Breakpoint \[0-9\]*, .*${srcfile}:17.*$gdb_prompt $"\ + -re "Breakpoint \[0-9\]*, .*${srcfile}:21.*$gdb_prompt $"\ {pass "jump to call"} -re "$gdb_prompt $"\ {fail "jump to call"} @@ -114,9 +114,9 @@ gdb_expect { timeout {fail "(timeout) disable breakpoint on call"} } -send_gdb "jump 17\n" +send_gdb "jump 21\n" gdb_expect { - -re "Breakpoint \[0-9\]*, .*${srcfile}:18.*$gdb_prompt $"\ + -re "Breakpoint \[0-9\]*, .*${srcfile}:22.*$gdb_prompt $"\ {pass "jump to call with disabled breakpoint"} -re "$gdb_prompt $"\ {fail "jump to call with disabled breakpoint"} @@ -138,7 +138,7 @@ gdb_expect { # Verify that GDB responds gracefully to the "jump" command with # trailing junk. # -send_gdb "jump 17 100\n" +send_gdb "jump 21 100\n" gdb_expect { -re "Junk at end of line specification: 100.*$gdb_prompt $"\ {pass "jump with trailing argument junk"} @@ -154,9 +154,9 @@ gdb_expect { # # Try it both ways: confirming and not confirming the jump. # -send_gdb "jump 8\n" +send_gdb "jump 12\n" gdb_expect { - -re "Line 8 is not in `main'. Jump anyway.*y or n. $"\ + -re "Line 12 is not in `main'. Jump anyway.*y or n. $"\ {send_gdb "n\n" gdb_expect { -re "Not confirmed.*$gdb_prompt $"\ @@ -171,9 +171,9 @@ gdb_expect { timeout {fail "(timeout) aborted jump out of current function"} } -send_gdb "jump 8\n" +send_gdb "jump 12\n" gdb_expect { - -re "Line 8 is not in `main'. Jump anyway.*y or n. $"\ + -re "Line 12 is not in `main'. Jump anyway.*y or n. $"\ {send_gdb "y\n" gdb_expect { -re "Continuing at.*$gdb_prompt $"\ diff --git a/gdb/testsuite/gdb.base/langs.exp b/gdb/testsuite/gdb.base/langs.exp index 464c797..9ed1e91 100644 --- a/gdb/testsuite/gdb.base/langs.exp +++ b/gdb/testsuite/gdb.base/langs.exp @@ -49,6 +49,8 @@ if { [gdb_compile "${binfile}0.o ${binfile}1.o ${binfile}2.o" ${binfile} execut gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } +set oldtimeout $timeout +set timeout 10 @@ -63,12 +65,31 @@ gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_load $binfile -gdb_test "b langs0" {Function "langs0" not defined\.} \ +gdb_test "b langs0" "Function \"langs0\" not defined\.|Breakpoint .* (deferred).*" \ "break on nonexistent function in langs.exp" +if {$hp_aCC_compiler} { + set isfixed 1 + set lang c\\+\\+ + set ext cxx + set foo_func foo__Fi__Fi + set do_func do::langs0 +} else { + if {$hp_cc_compiler} { + set isfixed 1 + set lang c + set ext c + } else { + set isfixed 0 + } + set foo_func foo__Fi + set do_func langs0__2do +} + if [runto csub] then { - gdb_test "show language" "currently c\".*" \ + if { !$isfixed } { set lang c } + gdb_test "show language" "currently $lang\".*" \ "show language at csub in langs.exp" # On some machines, foo doesn't get demangled because the N_SOL for # langs2.cxx is seen only after the function stab for foo. So @@ -76,36 +97,41 @@ if [runto csub] then { # even though only the latter is correct. I haven't tried to xfail it # because it depends on details of the compiler. - if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" } - gdb_test "bt" "#0.*csub.*#1.*(foo|foo__Fi) \\(.*#2.*cppsub_ .*#3.*fsub.*#4.*langs0__2do \\(.*#5 \[0-9a-fx\]* in main.*" "backtrace in langs.exp" + # Take out xfail. This test has been passing for some time now. + #if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" } + gdb_test "bt" "#0.*csub.*#1.*(foo|$foo_func) \\(.*#2.*cppsub_ .*#3.*fsub.*#4.*$do_func \\(.*#5 \[0-9a-fx\]* in main.*" "backtrace in langs.exp" + if { !$isfixed } { set lang c\\+\\+; set ext cxx } if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" } - gdb_test "up" ".* in (foo|foo__Fi) .* at langs2\\.cxx.*return csub \\(.*" \ + gdb_test "up" ".* in (foo|$foo_func).* at langs2\\.$ext.*return csub \\(.*" \ "up to foo in langs.exp" - gdb_test "show language" "currently c\\+\\+.*" \ + gdb_test "show language" "currently $lang.*" \ "show language at foo in langs.exp" if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" } - gdb_test "up" ".* in cppsub_ .* at langs2\\.cxx.*return foo \\(.*" \ + gdb_test "up" ".* in cppsub_ .* at langs2\\.$ext.*return foo \\(.*" \ "up to cppsub_ in langs.exp" - gdb_test "show language" "currently c\\+\\+.*" \ + gdb_test "show language" "currently $lang.*" \ "show language at cppsub_ in langs.exp" + if { !$isfixed } { set lang fortran } if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" } - gdb_test "up" ".* in fsub.* at langs1\\.f.*return \\(cppsub .*" \ + gdb_test "up" ".* in fsub.* at langs1\\.f.*" \ "up to fsub in langs.exp" - gdb_test "show language" "currently fortran.*" \ + gdb_test "show language" "currently $lang.*" \ "show language at fsub in langs.exp" - if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" } - gdb_test "up" ".* in langs0__2do .* at .*langs0\\.c.*return fsub.*" \ + # Take out xfail. This test has been passing for sometime now. + #if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" } + if { !$isfixed } { set lang c } + gdb_test "up" ".* in $do_func .* at .*langs0\\.c.*return fsub.*" \ "up to langs0__2do in langs.exp" - gdb_test "show language" "currently c\".*" \ + gdb_test "show language" "currently $lang\".*" \ "show language at langs0__2do in langs.exp" gdb_test "up" ".* in main .* at .*langs0\\.c.*if \\(langs0__2do \\(.*" \ "up to main in langs.exp" - gdb_test "show language" "currently c\".*" \ + gdb_test "show language" "currently $lang\".*" \ "show language at main in langs.exp" if [target_info exists gdb,noresults] { return } @@ -119,4 +145,5 @@ if [runto csub] then { } } +set timeout $oldtimeout return 0 diff --git a/gdb/testsuite/gdb.base/langs0.c b/gdb/testsuite/gdb.base/langs0.c index 69c0ce8..1477a32 100644 --- a/gdb/testsuite/gdb.base/langs0.c +++ b/gdb/testsuite/gdb.base/langs0.c @@ -1,8 +1,14 @@ /* This file is actually in C, it is not supposed to simulate something translated from another language or anything like that. */ +#ifdef PROTOTYPES +extern int fsub_(); + +int csub (int x) +#else int csub (x) int x; +#endif { return x + 1; } diff --git a/gdb/testsuite/gdb.base/langs1.c b/gdb/testsuite/gdb.base/langs1.c index 7842259..8ffd13f 100644 --- a/gdb/testsuite/gdb.base/langs1.c +++ b/gdb/testsuite/gdb.base/langs1.c @@ -16,14 +16,22 @@ static integer c__10000 = 10000; /* I am not sure whether there is a way to have a fortran program without */ /* a MAIN, but it does not really harm us to have one. */ +#ifdef PROTOTYPES +/* Main program */ void MAIN__() +#else /* Main program */ MAIN__() +#endif { } /* MAIN__ */ #line 4 "langs1.f" /* Subroutine */ int fsub_() { +#ifdef PROTOTYPES + extern integer cppsub_(int*); +#else extern integer cppsub_(); +#endif #line 5 "langs1.f" #line 6 "langs1.f" diff --git a/gdb/testsuite/gdb.base/langs2.c b/gdb/testsuite/gdb.base/langs2.c index be2a60c..502b800 100644 --- a/gdb/testsuite/gdb.base/langs2.c +++ b/gdb/testsuite/gdb.base/langs2.c @@ -1,4 +1,20 @@ /* This is intended to be a vague simulation of cfront output. */ +#ifdef PROTOTYPES +#line 1 "langs2.cxx" +extern int csub (int); +int +foo__Fi (int x) +{ + return csub (x / 2); +} + +extern int cppsub_ (int *y); +int +cppsub_ (int * y) +{ + return foo__Fi (*y); +} +#else #line 1 "langs2.cxx" extern int csub (); int @@ -13,3 +29,4 @@ cppsub_ (y) int *y; { return foo__Fi (*y); } +#endif diff --git a/gdb/testsuite/gdb.base/list.exp b/gdb/testsuite/gdb.base/list.exp index f597b9a..3652be9 100644 --- a/gdb/testsuite/gdb.base/list.exp +++ b/gdb/testsuite/gdb.base/list.exp @@ -84,6 +84,8 @@ proc set_listsize { arg } { proc test_listsize {} { global gdb_prompt + global hp_cc_compiler + global hp_aCC_compiler # Show default size @@ -101,10 +103,10 @@ proc test_listsize {} { # Ensure we can limit printouts to one line - if [ set_listsize 1 ] then { - setup_xfail "*-*-*" + if [set_listsize 1] { + if {!$hp_cc_compiler && !$hp_aCC_compiler} { setup_xfail "*-*-*" } gdb_test "list 1" "1\[ \t\]+#include \"list0.h\"" "list line 1 with listsize 1" - setup_xfail "*-*-*" + if {!$hp_cc_compiler && !$hp_aCC_compiler} { setup_xfail "*-*-*" } gdb_test "list 2" "2\[ \t\]+" "list line 2 with listsize 1" } @@ -113,7 +115,7 @@ proc test_listsize {} { if [ set_listsize 2 ] { gdb_test "list 1" "1\[ \t\]+#include \"list0.h\"" "list line 1 with listsize 2" gdb_test "list 2" "1\[ \t\]+#include \"list0.h\"\r\n2\[ \t\]+" "list line 2 with listsize 2" - gdb_test "list 3" "2\[ \t\]+\r\n3\[ \t\]+main \[)(\]+" "list line 3 with listsize 2" + gdb_test "list 3" "2\[ \t\]+\r\n3\[ \t\]+int main \[)(\]+" "list line 3 with listsize 2" } # Try small listsize > 1 that is an odd number @@ -121,18 +123,18 @@ proc test_listsize {} { if [ set_listsize 3 ] { setup_xfail "*-*-*" gdb_test "list 1" "1\[ \t\]+#include \"list0.h\"2\[ \t\]+" "list line 1 with listsize 3" - setup_xfail "*-*-*" - gdb_test "list 2" "1\[ \t\]+#include \"list0.h\".*3\[ \t\]+main \[)(\]+" "list line 2 with listsize 3" + if {!$hp_cc_compiler && !$hp_aCC_compiler} { setup_xfail "*-*-*" } + gdb_test "list 2" "1\[ \t\]+#include \"list0.h\".*3\[ \t\]+int main \[)(\]+" "list line 2 with listsize 3" - setup_xfail "*-*-*" - gdb_test "list 3" "2\[ \t\]+\r\n3\[ \t\]+main \[(\]+\[)\]+\r\n4\[ \t\]+\{" "list line 3 with listsize 3" + if {!$hp_cc_compiler && !$hp_aCC_compiler} { setup_xfail "*-*-*" } + gdb_test "list 3" "2\[ \t\]+\r\n3\[ \t\]+int main \[(\]+\[)\]+\r\n4\[ \t\]+\{" "list line 3 with listsize 3" } # Try small listsize > 2 that is an even number. if [ set_listsize 4 ] then { gdb_test "list 1" "1\[ \t\]+#include \"list0.h\"\r\n2\[ \t\]+" "list line 1 with listsize 4" - gdb_test "list 2" "1\[ \t\]+#include \"list0.h\".*3\[ \t\]+main \[)(\]+" "list line 2 with listsize 4" + gdb_test "list 2" "1\[ \t\]+#include \"list0.h\".*3\[ \t\]+int main \[)(\]+" "list line 2 with listsize 4" gdb_test "list 3" "1\[ \t\]+#include \"list0.h\".*4\[ \t\]+\{" "list line 3 with listsize 4" gdb_test "list 4" "2\[ \t\]+\r\n.*5\[ \t\]+int x;.*" "list line 4 with listsize 4" @@ -141,9 +143,9 @@ proc test_listsize {} { # Try a size larger than the entire file. if [ set_listsize 100 ] then { - gdb_test "list 1" "1\[ \t\]+#include \"list0.h\".*\r\n42\[ \t\]+\}" "list line 1 with listsize 100" + gdb_test "list 1" "1\[ \t\]+#include \"list0.h\".*\r\n4\[23\]\[ \t\]+\}" "list line 1 with listsize 100" - gdb_test "list 10" "1\[ \t\]+#include \"list0.h\".*\r\n42\[ \t\]+\}" "list line 10 with listsize 100" + gdb_test "list 10" "1\[ \t\]+#include \"list0.h\".*\r\n4\[23\]\[ \t\]+\}" "list line 10 with listsize 100" } # Try listsize of 0 which suppresses printing. @@ -168,12 +170,12 @@ proc test_list_include_file {} { setup_xfail "a29k-*-udi" setup_xfail_format "DWARF 1" setup_xfail_format "COFF" - gdb_test "list list0.h:1" "1\[ \t\]+/\[*\]+ An include file .*5\[ \t\]+foo \[(\]+x\[)\]+" "list line 1 in include file" + gdb_test "list list0.h:1" "1\[ \t\]+/\[*\]+ An include file .*4\[ \t\]+.*foo \(.*x.*\).*" "list line 1 in include file" setup_xfail "a29k-*-udi" setup_xfail_format "DWARF 1" setup_xfail_format "COFF" - gdb_test "list list0.h:100" "Line number 95 out of range; .*list0.h has 36 lines." "list message for lines past EOF" + gdb_test "list list0.h:100" "Line number 95 out of range; .*list0.h has 3\[67\] lines." "list message for lines past EOF" } # @@ -203,7 +205,7 @@ proc test_list_filename_and_number {} { } send_gdb "list list1.c:1\n" gdb_expect { - -re "1\[ \t\]+void.*5\[ \t\]+printf \[(\]+.*\[)\]+;\r\n$gdb_prompt $" { + -re "1\[ \t\]+\#include.*4\[ \t\]+.*int oof\[ \t\]*\(.*\);\r\n.*$gdb_prompt $" { incr testcnt } -re ".*$gdb_prompt $" { fail "list list1.c:1" ; gdb_suppress_tests } @@ -211,7 +213,7 @@ proc test_list_filename_and_number {} { } send_gdb "list list1.c:12\n" gdb_expect { - -re "7\[ \t\]+long_line \[(\]+.*\[)\]+;.*14\[ \t\]+\}\r\n.*$gdb_prompt $" { + -re "12\[ \t\]+long_line \[(\]+.*\[)\]+;.*13\[ \t\]+\}\r\n.*$gdb_prompt $" { incr testcnt } -re ".*$gdb_prompt $" { fail "list list1.c:12" ; gdb_suppress_tests } @@ -237,7 +239,7 @@ proc test_list_function {} { # Ultrix gdb takes the second case below; it's also correct. # SunPRO cc is the third case. - gdb_test "list bar" "(1\[ \t\]+void.*7\[ \t\]*long_line ..;.*9\[ \t\]*|1\[ \t\]+void.*8\[ \t\]+\}|1\[ \t\]+void.*7\[ \t\]*long_line ..;)" "list function in source file 2" + gdb_test "list bar" "(4\[ \t\]+void.*\[ \t\]*long_line.*;.*bar.*9\[ \t\]*.*|1\[ \t\]+void.*8\[ \t\]+\}|1\[ \t\]+void.*7\[ \t\]*long_line ..;|7\[ \t\]+void.*14\[ \t\]+\})" "list function in source file 2" # Test "list function" for C include file # Ultrix gdb is the second case, still correct. @@ -275,7 +277,7 @@ proc test_list_forward {} { send_gdb "list\n" gdb_expect { - -re "35\[ \t\]+foo \[(\]+.*\[)\]+;.*42\[ \t\]+\}\r\n$gdb_prompt $" { incr testcnt } + -re "35\[ \t\]+foo \\(.*\\);.*42\[ \t\]+.*\}\r\n$gdb_prompt $" { incr testcnt } -re ".*$gdb_prompt $" { fail "list 35-42" ; gdb_suppress_tests } timeout { fail "list 35-42 (timeout)" ; gdb_suppress_tests } } @@ -291,7 +293,7 @@ proc test_list_backwards {} { send_gdb "list list0.c:33\n" gdb_expect { - -re "28\[ \t\]+foo \[(\]+.*\[)\]+;.*37\[ \t\]+\r\n$gdb_prompt $" { incr testcnt } + -re "28\[ \t\]+foo \\(.*\\);.*37\[ \t\]+\}\r\n$gdb_prompt $" { incr testcnt } -re ".*$gdb_prompt $" { fail "list list0.c:33" ; gdb_suppress_tests } timeout { fail "list list0.c:33 (timeout)" ; gdb_suppress_tests } } @@ -328,17 +330,17 @@ proc test_list_backwards {} { proc test_list_range {} { global gdb_prompt - gdb_test "list list0.c:2,list0.c:5" "2\[ \t\]+\r\n3\[ \t\]+main \[)(\]+.*5\[ \t\]+int x;" "list range; filename:line1,filename:line2" + gdb_test "list list0.c:2,list0.c:5" "2\[ \t\]+\r\n3\[ \t\]+int main \[)(\]+.*5\[ \t\]+int x;" "list range; filename:line1,filename:line2" - gdb_test "list 2,5" "2\[ \t\]+\r\n3\[ \t\]+main \[)(\]+.*5\[ \t\]+int x;" "list range; line1,line2" + gdb_test "list 2,5" "2\[ \t\]+\r\n3\[ \t\]+int main \[)(\]+.*5\[ \t\]+int x;" "list range; line1,line2" # gdb_test "list -1,6" "Line number 0 out of range; .*list0.c has 39 lines." "list range; lower bound negative" # gdb_test "list -100,-40" "Line number -60 out of range; .*list0.c has 39 lines." "list range; both bounds negative" - gdb_test "list 30,43" "30\[ \t\]+foo \[(\]+.*\[)\]+;.*42\[ \t\]+\}" "list range; upper bound past EOF" + gdb_test "list 30,45" "30\[ \t\]+foo \(.*\);.*43\[ \t\]+\}" "list range; upper bound past EOF" - gdb_test "list 43,100" "Line number 43 out of range; .*list0.c has 42 lines." "list range; both bounds past EOF" + gdb_test "list 45,100" "Line number 45 out of range; .*list0.c has 43 lines." "list range; both bounds past EOF" gdb_test "list list0.c:2,list1.c:17" "Specified start and end are in different files." "list range, must be same files" } @@ -375,7 +377,7 @@ proc test_list_filename_and_function {} { setup_xfail "rs6000-*-aix*" send_gdb "list list0.c:unused\n" gdb_expect { - -re "36\[ \t\]+\}.*42\[ \t\]+\}\r\n$gdb_prompt $" { + -re "40\[ \t\]+unused.*43\[ \t\]+\}\r\n$gdb_prompt $" { incr testcnt } -re "37.*42\[ \t\]+\}\r\n$gdb_prompt $" { @@ -417,13 +419,13 @@ proc test_list_filename_and_function {} { # a29k-amd-udi is the third case. send_gdb "list list1.c:bar\n" gdb_expect { - -re "1\[ \t\]+void.*8\[ \t\]+\}\r\n$gdb_prompt $" { + -re "4\[ \t\]+void.*13\[ \t\]+\}\r\n$gdb_prompt $" { incr testcnt } - -re "1\[ \t\]+void.*7\[ \t\]*long_line ..;\r\n$gdb_prompt $" { + -re "4\[ \t\]+void.*12\[ \t\]*long_line ..;\r\n$gdb_prompt $" { incr testcnt } - -re "1\[ \t\]+void.*9\[ \t\]*\r\n$gdb_prompt $" { + -re "4\[ \t\]+void.*11\[ \t\]*\r\n$gdb_prompt $" { incr testcnt } -re ".*$gdb_prompt $" { fail "list list1.c:bar" } @@ -437,10 +439,10 @@ proc test_list_filename_and_function {} { setup_xfail "rs6000-*-aix*" send_gdb "list list1.c:unused\n" gdb_expect { - -re "7\[ \t\]+long_line \[(\]\[)\];.*14\[ \t\]+\}\r\n.*$gdb_prompt $" { + -re "12\[ \t\]+long_line \[(\]\[)\];.*13\[ \t\]+\}\r\n.*$gdb_prompt $" { incr testcnt } - -re "9.*14\[ \t\]+\}\r\n.*$gdb_prompt $" { + -re "14.*19\[ \t\]+\}\r\n.*$gdb_prompt $" { incr testcnt } -re ".*$gdb_prompt $" { fail "list list1.c:unused" } @@ -463,10 +465,10 @@ proc test_list_filename_and_function {} { gdb_test "list list0.c:foo" "Function \"foo\" not defined in .*list0.c" "list filename:function; wrong filename rejected" - gdb_test "list foobar.c:main" "No source file named foobar.c." "list filename:function; nonexistant file" + gdb_test "list foobar.c:main" "No source file named foobar.c.|Location not found" "list filename:function; nonexistant file" setup_xfail_format "DWARF 1" - gdb_test "list list0.h:foobar" "Function \"foobar\" not defined." "list filename:function; nonexistant function" + gdb_test "list list0.h:foobar" "Function \"foobar\" not defined.|Location not found" "list filename:function; nonexistant function" } @@ -478,11 +480,11 @@ proc test_forward_search {} { # lines 20-23. This depends on whether the line number of a function # is considered to be the openbrace or the first statement--either one # is acceptable. - gdb_test "list long_line" "20\[ \t\]+long_line .*" + gdb_test "list long_line" "24\[ \t\]+long_line .*" gdb_test "search 4321" " not found" - gdb_test "search 6789" "24\[ \t\]+oof .6789.;" + gdb_test "search 6789" "28\[ \t\]+oof .6789.;" # Test that GDB won't crash if the line being searched is extremely long. @@ -519,3 +521,5 @@ if [ set_listsize 10 ] then { test_list_filename_and_function test_forward_search } + +remote_exec build "rm -f list0.h" diff --git a/gdb/testsuite/gdb.base/list0.c b/gdb/testsuite/gdb.base/list0.c index a5561a7..b50fdd4 100644 --- a/gdb/testsuite/gdb.base/list0.c +++ b/gdb/testsuite/gdb.base/list0.c @@ -1,6 +1,6 @@ #include "list0.h" -main () +int main () { int x; #ifdef usestubs @@ -33,6 +33,7 @@ main () foo (x++); foo (x++); foo (x++); + return 0; } static void diff --git a/gdb/testsuite/gdb.base/list1.c b/gdb/testsuite/gdb.base/list1.c index 51632b9..6094104 100644 --- a/gdb/testsuite/gdb.base/list1.c +++ b/gdb/testsuite/gdb.base/list1.c @@ -1,6 +1,11 @@ -void -bar (x) -int x; +#include <stdio.h> + +#ifdef PROTOTYPES +void long_line (); int oof (int); +void bar (int x) +#else +void bar (x) int x; +#endif { printf ("%d\n", x); @@ -12,11 +17,10 @@ unused () { /* Not used for anything */ } - - -/* This routine has a very long line that will break searching in older - versions of GDB. */ - +/* This routine has a very long line that will break searching in older versions of GDB. */ +#ifdef PROTOTYPES +void +#endif long_line () { oof (67); @@ -25,9 +29,11 @@ long_line () oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* 5 */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* 10 */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* 15 */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* 20 */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* 25 */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* 30 */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* 35 */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* 40 */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* 45 */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* 50 */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* 55 */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* 60 */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* 65 */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (12); /* */ oof (12); oof (12); oof (12); oof (12); oof (12); oof (1234); /* 70 */ } - -oof (n) - int n; +#ifdef PROTOTYPES +int oof (int n) +#else +oof (n) int n; +#endif { return n + 1; } diff --git a/gdb/testsuite/gdb.base/logical.exp b/gdb/testsuite/gdb.base/logical.exp index 0458e61..9d410c6 100644 --- a/gdb/testsuite/gdb.base/logical.exp +++ b/gdb/testsuite/gdb.base/logical.exp @@ -44,7 +44,9 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } - +if [get_compiler_info ${binfile}] { + return -1; +} gdb_exit gdb_start @@ -102,7 +104,7 @@ gdb_expect { send_gdb "print x && y\n" gdb_expect { - -re ".*0.*$gdb_prompt $" { + -re ".*$false.*$gdb_prompt $" { pass "print value of x<y" } -re ".*$gdb_prompt $" { fail "print value of x<y" } @@ -113,7 +115,7 @@ gdb_expect { send_gdb "print x || y\n" gdb_expect { - -re ".*0.*$gdb_prompt $" { + -re ".*$false.*$gdb_prompt $" { pass "print value of x<=y" } -re ".*$gdb_prompt $" { fail "print value of x<=y" } @@ -122,7 +124,7 @@ gdb_expect { send_gdb "print !x\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of x>y" } -re ".*$gdb_prompt $" { fail "print value of x>y" } @@ -133,7 +135,7 @@ gdb_test "set variable y=1" "" "set variable y=1" send_gdb "print x && y\n" gdb_expect { - -re ".*0.*$gdb_prompt $" { + -re ".*$false.*$gdb_prompt $" { pass "print value of x<y" } -re ".*$gdb_prompt $" { fail "print value of x<y" } @@ -144,7 +146,7 @@ gdb_expect { send_gdb "print x || y\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of x<=y" } -re ".*$gdb_prompt $" { fail "print value of x<=y" } @@ -155,7 +157,7 @@ gdb_test "set variable x=1" "" "set variable x=1" send_gdb "print x && y\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of x<y" } -re ".*$gdb_prompt $" { fail "print value of x<y" } @@ -166,7 +168,7 @@ gdb_expect { send_gdb "print x || y\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of x<=y" } -re ".*$gdb_prompt $" { fail "print value of x<=y" } @@ -175,7 +177,7 @@ gdb_expect { send_gdb "print !x\n" gdb_expect { - -re ".*0.*$gdb_prompt $" { + -re ".*$false.*$gdb_prompt $" { pass "print value of x>y" } -re ".*$gdb_prompt $" { fail "print value of x>y" } @@ -186,7 +188,7 @@ gdb_test "set variable y=0" "" "set variable y=0" send_gdb "print x && y\n" gdb_expect { - -re ".*0.*$gdb_prompt $" { + -re ".*$false.*$gdb_prompt $" { pass "print value of x<y" } -re ".*$gdb_prompt $" { fail "print value of x<y" } @@ -197,7 +199,7 @@ gdb_expect { send_gdb "print x || y\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of x<=y" } -re ".*$gdb_prompt $" { fail "print value of x<=y" } @@ -216,7 +218,7 @@ gdb_test "set variable z=0" "" "set variable z=0" send_gdb "print x && y && z\n" gdb_expect { - -re ".*0.*$gdb_prompt $" { + -re ".*$false.*$gdb_prompt $" { pass "print value of x && y && z (000)" } -re ".*$gdb_prompt $" { fail "print value of x && y && z (000) " } @@ -225,7 +227,7 @@ gdb_expect { send_gdb "print x || y || z\n" gdb_expect { - -re ".*0.*$gdb_prompt $" { + -re ".*$false.*$gdb_prompt $" { pass "print value of x || y || z (000)" } -re ".*$gdb_prompt $" { fail "print value of x || y || z (000)" } @@ -234,7 +236,7 @@ gdb_expect { send_gdb "print !!x\n" gdb_expect { - -re ".*0.*$gdb_prompt $" { + -re ".*$false.*$gdb_prompt $" { pass "print value of !!x (0)" } -re ".*$gdb_prompt $" { fail "print value of !!x (0)" } @@ -246,7 +248,7 @@ gdb_test "set variable y=1" "" "set variable y=1" send_gdb "print x && y && z\n" gdb_expect { - -re ".*0.*$gdb_prompt $" { + -re ".*$false.*$gdb_prompt $" { pass "print value of x && y && z (010)" } -re ".*$gdb_prompt $" { fail "print value of x && y && z (010) " } @@ -255,7 +257,7 @@ gdb_expect { send_gdb "print x || y || z\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of x || y || z (010)" } -re ".*$gdb_prompt $" { fail "print value of x || y || z (010)" } @@ -267,7 +269,7 @@ gdb_test "set variable z=1" "" "set variable z=1" send_gdb "print x && y && z\n" gdb_expect { - -re ".*0.*$gdb_prompt $" { + -re ".*$false.*$gdb_prompt $" { pass "print value of x && y && z (011)" } -re ".*$gdb_prompt $" { fail "print value of x && y && z (011) " } @@ -276,7 +278,7 @@ gdb_expect { send_gdb "print x || y || z\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of x || y || z (011)" } -re ".*$gdb_prompt $" { fail "print value of x || y || z (011)" } @@ -288,7 +290,7 @@ gdb_test "set variable x=1" "" "set variable x=1" send_gdb "print x && y && z\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of x && y && z (111)" } -re ".*$gdb_prompt $" { fail "print value of x && y && z (111) " } @@ -297,7 +299,7 @@ gdb_expect { send_gdb "print x || y || z\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of x || y || z (111)" } -re ".*$gdb_prompt $" { fail "print value of x || y || z (111)" } @@ -306,7 +308,7 @@ gdb_expect { send_gdb "print !!x\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of !!x (1)" } -re ".*$gdb_prompt $" { fail "print value of !!x (1)" } @@ -318,7 +320,7 @@ gdb_test "set variable z=0" "" "set variable z=0" send_gdb "print x && y && z\n" gdb_expect { - -re ".*0.*$gdb_prompt $" { + -re ".*$false.*$gdb_prompt $" { pass "print value of x && y && z (110)" } -re ".*$gdb_prompt $" { fail "print value of x && y && z (110) " } @@ -327,7 +329,7 @@ gdb_expect { send_gdb "print x || y || z\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of x || y || z (110)" } -re ".*$gdb_prompt $" { fail "print value of x || y || z (110)" } @@ -341,7 +343,7 @@ gdb_test "set variable y=0" "" "set variable y=0" send_gdb "print x && y && z\n" gdb_expect { - -re ".*0.*$gdb_prompt $" { + -re ".*$false.*$gdb_prompt $" { pass "print value of x && y && z (100)" } -re ".*$gdb_prompt $" { fail "print value of x && y && z (100) " } @@ -350,7 +352,7 @@ gdb_expect { send_gdb "print x || y || z\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of x || y || z (100)" } -re ".*$gdb_prompt $" { fail "print value of x || y || z (100)" } @@ -364,7 +366,7 @@ gdb_test "set variable z=1" "" "set variable z=1" send_gdb "print x && y && z\n" gdb_expect { - -re ".*0.*$gdb_prompt $" { + -re ".*$false.*$gdb_prompt $" { pass "print value of x && y && z (101)" } -re ".*$gdb_prompt $" { fail "print value of x && y && z (101) " } @@ -373,7 +375,7 @@ gdb_expect { send_gdb "print x || y || z\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of x || y || z (101)" } -re ".*$gdb_prompt $" { fail "print value of x || y || z (101)" } @@ -385,7 +387,7 @@ gdb_test "set variable x=0" "" "set variable x=0" send_gdb "print x && y && z\n" gdb_expect { - -re ".*0.*$gdb_prompt $" { + -re ".*$false.*$gdb_prompt $" { pass "print value of x && y && z (001)" } -re ".*$gdb_prompt $" { fail "print value of x && y && z (001) " } @@ -394,7 +396,7 @@ gdb_expect { send_gdb "print x || y || z\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of x || y || z (001)" } -re ".*$gdb_prompt $" { fail "print value of x || y || z (001)" } @@ -409,7 +411,7 @@ gdb_expect { send_gdb "print !x && y\n" gdb_expect { - -re ".*0.*$gdb_prompt $" { + -re ".*$false.*$gdb_prompt $" { pass "print value of !x && y (00)" } -re ".*$gdb_prompt $" { fail "print value of !x && y (00)" } @@ -422,7 +424,7 @@ gdb_test "set variable x=1" "" "set variable x=1" send_gdb "print !x && y\n" gdb_expect { - -re ".*0.*$gdb_prompt $" { + -re ".*$false.*$gdb_prompt $" { pass "print value of !x && y (10)" } -re ".*$gdb_prompt $" { fail "print value of !x && y (10)" } @@ -436,7 +438,7 @@ gdb_test "set variable y=1" "" "set variable y=1" send_gdb "print !x || y\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of !x || y (11)" } -re ".*$gdb_prompt $" { fail "print value of !x || y (11)" } @@ -449,7 +451,7 @@ gdb_test "set variable x=0" "" "set variable x=0" send_gdb "print !x || y\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of !x || y (01)" } -re ".*$gdb_prompt $" { fail "print value of !x || y (01)" } @@ -463,7 +465,7 @@ gdb_test "set variable z=0" "" "set variable z=0" send_gdb "print x || y && z\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of x || y && z (110)" } -re ".*$gdb_prompt $" { fail "print value of x || y && z (110)" } @@ -476,7 +478,7 @@ gdb_test "set variable y=0" "" "set variable y=0" send_gdb "print x || y && z\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of x || y && z (100)" } -re ".*$gdb_prompt $" { fail "print value of x || y && z (100)" } @@ -489,12 +491,12 @@ gdb_test "set variable x=0" "" "set variable x=0" send_gdb "print x || !y && z\n" gdb_expect { - -re ".*0.*$gdb_prompt $" { + -re ".*$false.*$gdb_prompt $" { gdb_test "set variable x=1" "" "set variable x=1" send_gdb "print x || !y && z\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of x || !y && z " } -re ".*$gdb_prompt $" { fail "print value of x || !y && z" } @@ -517,7 +519,7 @@ gdb_test "set variable z=3" "" "set variable z=3" send_gdb "print x > y || w == z\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of x > y || w == z" } -re ".*$gdb_prompt $" { fail "print value of x > y || w == z" } @@ -533,7 +535,7 @@ gdb_test "set variable z=3" "" "set variable z=3" send_gdb "print x >= y && w != z\n" gdb_expect { - -re ".*0.*$gdb_prompt $" { + -re ".*$false.*$gdb_prompt $" { pass "print value of x >= y || w != z" } -re ".*$gdb_prompt $" { fail "print value of x >= y || w != z" } @@ -550,7 +552,7 @@ gdb_test "set variable z=3" "" "set variable z=3" send_gdb "print ! x > y || w + z\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of x > y || w != z" } -re ".*$gdb_prompt $" { fail "print value of x > y || w != z" } diff --git a/gdb/testsuite/gdb.base/long_long.c b/gdb/testsuite/gdb.base/long_long.c index 096528d..a76e279 100644 --- a/gdb/testsuite/gdb.base/long_long.c +++ b/gdb/testsuite/gdb.base/long_long.c @@ -7,8 +7,12 @@ * 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; @@ -32,6 +36,8 @@ int known_types() /* Stop here and look! */ hex = bin - dec | oct; + + return 0; } int main() { diff --git a/gdb/testsuite/gdb.base/long_long.exp b/gdb/testsuite/gdb.base/long_long.exp index aca59c2..52e6ff5 100644 --- a/gdb/testsuite/gdb.base/long_long.exp +++ b/gdb/testsuite/gdb.base/long_long.exp @@ -35,20 +35,14 @@ if [get_compiler_info ${binfile}] { return -1 } -if {$gcc_compiled == 0} { - if [istarget "hppa*-hp-hpux*"] then { - ### FIXME +e only works with HP's compiler - set additional_flags "additional_flags=+e -w" - } else { - # don't know what the compiler is, hope it supports long long! - set additional_flags "additional_flags=-w" - } +if {$hp_cc_compiler} { + set flag "+e" } else { - set additional_flags "additional_flags=-w" + set flag "" } -if { [gdb_compile "${srcfile}" "${binfile}" executable [list debug $additional_flags]] != "" } { - gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +if { [gdb_compile "${srcfile}" "${binfile}" executable [concat debug "additional_flags=$flag -w"]] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } # use this to debug: @@ -64,35 +58,40 @@ if { ![runto known_types] } then { return } -gdb_test "n 4" ".*34.*" "get to known place" +gdb_test "n 4" ".*38.*" "get to known place" # Check the hack for long long prints. # -gdb_test "p/x hex" ".*0x0.*" "default print hex" -gdb_test "p/x dec" ".*0xab54a98ceb1f0ad2.*" "default print dec" -gdb_test "p/x bin" ".*0x123456789abcdef.*" "default print bin" -gdb_test "p/x oct" ".*0xa72ee53977053977.*" "default print oct" - -gdb_test "p/x hex" ".*0x0.*" "hex print" -gdb_test "p/u dec" ".*12345678901234567890.*" "decimal print" -gdb_test "p/t bin" ".*100100011010001010110011110001001101010111100110111101111.*" "binary print" +gdb_test "p/x hex" ".*0x0*0.*" "hex print p/x" +gdb_test "p/x 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/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" # Try all the combinations to bump up coverage. # gdb_test "p/d oct" ".*12046818088235383159.*" "" -gdb_test "p/u oct" ".*0xa72ee53977053977.*" "" +gdb_test "p/u oct" ".*12046818088235383159.*" "" gdb_test "p/o oct" ".*.*" "" gdb_test "p/t oct" ".*1010011100101110111001010011100101110111000001010011100101110111.*" "" -gdb_test "p/a oct" ".*That operation is not available.*" "" -gdb_test "p/c oct" ".*0xa72ee53977053977.*" "" +gdb_test "p/a oct" ".*0x.*77053977.*" "" +gdb_test "p/c oct" ".*'w'.*" "" gdb_test "p/f oct" ".*-5.9822653797615723e-120.*" "" 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.*" "" -gdb_test "p/a *(int *)&oct" ".*0xa72ee539.*" "" +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.*" "" @@ -100,9 +99,9 @@ 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.*" "" -gdb_test "p/a *(short *)&oct" ".*0xffffa72e.*" "" +gdb_test "p/a *(short *)&oct" ".*0xf*ffffa72e.*" "" gdb_test "p/c *(short *)&oct" ".* 46 '.'.*" "" -gdb_test "p/a **short *)&oct" ".*0xffffa72e <.*" "" +gdb_test "p/a *(short *)&oct" ".*0xf*ffffa72e.*" "" gdb_test "p/f *(short *)&oct" ".*-22738.*" "" gdb_test "x/x &oct" ".*0xa72ee539.*" "" @@ -110,8 +109,8 @@ gdb_test "x/d &oct" ".*.-1490098887*" "" gdb_test "x/u &oct" ".*2804868409.*" "" gdb_test "x/o &oct" ".*024713562471.*" "" gdb_test "x/t &oct" ".*10100111001011101110010100111001.*" "" -gdb_test "x/a &oct" ".*0xa72ee539 <.*" "" -gdb_test "x/c &oct" ".*-89 'M-''.*" "" +gdb_test "x/a &oct" ".*0xa72ee539.*" "" +gdb_test "x/c &oct" ".*-89 '\\\\247'.*" "" gdb_test "x/f &oct" ".*-5.9822653797615723e-120.*" "" gdb_test "x/2x &oct" ".*.*" "" diff --git a/gdb/testsuite/gdb.base/mips_pro.c b/gdb/testsuite/gdb.base/mips_pro.c index d2d1884..b659d82 100644 --- a/gdb/testsuite/gdb.base/mips_pro.c +++ b/gdb/testsuite/gdb.base/mips_pro.c @@ -1,15 +1,25 @@ /* Tests regarding examination of prologues. */ +#ifdef PROTOTYPES +int +inner (int z) +#else int inner (z) int z; +#endif { return 2 * z; } +#ifdef PROTOTYPES +int +middle (int x) +#else int middle (x) int x; +#endif { if (x == 0) return inner (5); @@ -17,15 +27,27 @@ middle (x) return inner (6); } +#ifdef PROTOTYPES +int +top (int y) +#else int top (y) int y; +#endif { return middle (y + 1); } +#ifdef PROTOTYPES +int +main (int argc, char **argv) +#else int main (argc, argv) + int argc; + char **argv; +#endif { #ifdef usestubs set_debug_traps(); diff --git a/gdb/testsuite/gdb.base/mips_pro.exp b/gdb/testsuite/gdb.base/mips_pro.exp index 2b94de6..ea2461e 100644 --- a/gdb/testsuite/gdb.base/mips_pro.exp +++ b/gdb/testsuite/gdb.base/mips_pro.exp @@ -55,7 +55,7 @@ gdb_load ${binfile} if [runto middle] then { # PR 3016 if {$gcc_compiled} then { - setup_xfail "mips*-sgi-irix4*" "mips64*-*-elf" + setup_xfail "hppa*-*-*" "mips*-sgi-irix4*" "mips64*-*-elf" } gdb_test "backtrace" "#0.*middle.*#1.*top.*#2.*main.*" } diff --git a/gdb/testsuite/gdb.base/miscexprs.exp b/gdb/testsuite/gdb.base/miscexprs.exp index d42e5ab..9778423 100644 --- a/gdb/testsuite/gdb.base/miscexprs.exp +++ b/gdb/testsuite/gdb.base/miscexprs.exp @@ -44,6 +44,9 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } +if [get_compiler_info ${binfile}] { + return -1; +} gdb_exit gdb_start @@ -90,6 +93,9 @@ gdb_expect { -re ".\[0-9\]* = $hex \"\".*$gdb_prompt $" { pass "print value of &cbig.c\[0\]" } + -re ".\[0-9\]* = $hex \"*\".*$gdb_prompt $" { + pass "print value of &cbig.c\[0\]" + } -re ".*$gdb_prompt $" { fail "print value of &cbig.c\[0\]" } timeout { fail "(timeout) print value of &cbig.c\[0\]" } } @@ -158,7 +164,7 @@ gdb_expect { send_gdb "print !ibig.i\[100\]\n" gdb_expect { - -re ".\[0-9\]* = 0.*$gdb_prompt $" { + -re ".\[0-9\]* = $false.*$gdb_prompt $" { pass "print value of !ibig.i\[100\]" } -re ".*$gdb_prompt $" { fail "print value of !ibig.i\[100\]" } @@ -167,7 +173,7 @@ gdb_expect { send_gdb "print !sbig.s\[90\]\n" gdb_expect { - -re ".\[0-9\]* = 0.*$gdb_prompt $" { + -re ".\[0-9\]* = $false.*$gdb_prompt $" { pass "print value of !sbig.s\[90\]" } -re ".*$gdb_prompt $" { fail "print value of !sbig.s\[90\]" } @@ -177,7 +183,7 @@ gdb_expect { send_gdb "print !fbig.f\[100\]\n" gdb_expect { - -re ".\[0-9\]* = 0.*$gdb_prompt $" { + -re ".\[0-9\]* = $false.*$gdb_prompt $" { pass "print value of !ibig.i\[100\]" } -re ".*$gdb_prompt $" { fail "print value of !ibig.i\[100\]" } @@ -186,7 +192,7 @@ gdb_expect { send_gdb "print !dbig.d\[202\]\n" gdb_expect { - -re ".\[0-9\]* = 0.*$gdb_prompt $" { + -re ".\[0-9\]* = $false.*$gdb_prompt $" { pass "print value of !ibig.i\[100\]" } -re ".*$gdb_prompt $" { fail "print value of !ibig.i\[100\]" } @@ -224,7 +230,7 @@ gdb_expect { send_gdb "print !(sbig.s\[90\] * 2)\n" gdb_expect { - -re ".\[0-9\]* = 0.*$gdb_prompt $" { + -re ".\[0-9\]* = $false.*$gdb_prompt $" { pass "print value of !(sbig.s\[90\] * 2)" } -re ".*$gdb_prompt $" { fail "print value of !(sbig.s\[90\] * 2)" } @@ -252,6 +258,18 @@ gdb_expect { } +if [istarget "hppa2.0w*-*-*"] then { +send_gdb "print sizeof(lbig)\n" +gdb_expect { + -re ".\[0-9\]* = 7200.*$gdb_prompt $" { + pass "print value of sizeof(lbig)" + } + -re ".*$gdb_prompt $" { fail "print value of sizeof(lbig)" } + timeout { fail "(timeout) print value of sizeof(lbig)" } + } +} + +if ![istarget "hppa2.0w*-*-*"] then { send_gdb "print sizeof(lbig)\n" gdb_expect { -re ".\[0-9\]* = 3600.*$gdb_prompt $" { @@ -260,6 +278,7 @@ gdb_expect { -re ".*$gdb_prompt $" { fail "print value of sizeof(lbig)" } timeout { fail "(timeout) print value of sizeof(lbig)" } } +} send_gdb "print ibig.i\[100\] << 2\n" gdb_expect { diff --git a/gdb/testsuite/gdb.base/nodebug.c b/gdb/testsuite/gdb.base/nodebug.c index 4aad099..3e0a4ce 100644 --- a/gdb/testsuite/gdb.base/nodebug.c +++ b/gdb/testsuite/gdb.base/nodebug.c @@ -1,3 +1,4 @@ +#include <stdlib.h> /* Test that things still (sort of) work when compiled without -g. */ int dataglobal = 3; /* Should go in global data */ @@ -5,31 +6,51 @@ static int datalocal = 4; /* Should go in local data */ int bssglobal; /* Should go in global bss */ static int bsslocal; /* Should go in local bss */ +#ifdef PROTOTYPES +int +inner (int x) +#else int inner (x) int x; +#endif { return x + dataglobal + datalocal + bssglobal + bsslocal; } +#ifdef PROTOTYPES +static short +middle (int x) +#else static short middle (x) int x; +#endif { return 2 * inner (x); } +#ifdef PROTOTYPES +short +top (int x) +#else short top (x) int x; +#endif { return 2 * middle (x); } +#ifdef PROTOTYPES +int +main (int argc, char **argv) +#else int main (argc, argv) int argc; char **argv; +#endif { #ifdef usestubs set_debug_traps(); @@ -38,14 +59,16 @@ main (argc, argv) return top (argc); } -char *malloc (); - int *x; +#ifdef PROTOTYPES +int array_index (char *arr, int i) +#else int array_index (arr, i) char *arr; int i; +#endif { /* The basic concept is just "return arr[i];". But call malloc so that gdb will be able to call functions. */ diff --git a/gdb/testsuite/gdb.base/nodebug.exp b/gdb/testsuite/gdb.base/nodebug.exp index e4f8a35..684476e 100644 --- a/gdb/testsuite/gdb.base/nodebug.exp +++ b/gdb/testsuite/gdb.base/nodebug.exp @@ -72,28 +72,28 @@ if [runto inner] then { if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix5*" "mips-sgi-irix6*" } gdb_test "p top" \ - "{(<(text variable|function), no debug info>|short \\(\\))} \[0-9a-fx]* <top>" + "\{(<(text variable|function), no debug info>|short \\(int\\)|short \\(\\))\} \[0-9a-fx]* <top(\\(int\\)|)>" if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix5*" "mips-sgi-irix6*" } gdb_test "whatis top" \ - "(<(text variable|function), no debug info>|short \\(\\))" + "(<(text variable|function), no debug info>|short \\(int\\)|short \\(\\))" if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" } - gdb_test "ptype top" "(short|int) \\((|<non-float parameter>|<non-float parameter>, <non-float parameter>)\\)" + gdb_test "ptype top" "(short|int) \\((|void|int|<non-float parameter>|<non-float parameter>, <non-float parameter>)\\)" if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix5*" } setup_xfail "mips-sgi-irix6*" gdb_test "p middle" \ - "{(<(text variable|function), no debug info>|short \\(\\))} \[0-9a-fx]* <middle>" + "\{(<(text variable|function), no debug info>|short \\(int\\)|short \\(\\))\} \[0-9a-fx]* <middle(\\(int\\)|)>" if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix5*" } setup_xfail "mips-sgi-irix6*" gdb_test "whatis middle" \ - "(<(text variable|function), no debug info>|short \\(\\))" + "(<(text variable|function), no debug info>|short \\(int\\)|short \\(\\))" setup_xfail "mips-sgi-irix6*" - gdb_test "ptype middle" "(short|int) \\((|<non-float parameter>|<non-float parameter>, <non-float parameter>)\\)" + gdb_test "ptype middle" "(short|int) \\((|void|int|<non-float parameter>|<non-float parameter>, <non-float parameter>)\\)" gdb_test "p dataglobal" "= 3" gdb_test "whatis dataglobal" \ - "<(data variable|variable), no debug info>" - gdb_test "ptype dataglobal" "<(data variable|variable), no debug info>" + "<(data variable|variable), no debug info>|int" + gdb_test "ptype dataglobal" "<(data variable|variable), no debug info>|int" # The only symbol xcoff puts out for statics is for the TOC entry. # Possible, but hairy, for gdb to deal. Right now it doesn't, it @@ -115,8 +115,8 @@ if [runto inner] then { gdb_test "ptype datalocal" "<(data variable|variable), no debug info>" gdb_test "p bssglobal" "= 0" - gdb_test "whatis bssglobal" "<(data variable|variable), no debug info>" - gdb_test "ptype bssglobal" "<(data variable|variable), no debug info>" + gdb_test "whatis bssglobal" "<(data variable|variable), no debug info>|int" + gdb_test "ptype bssglobal" "<(data variable|variable), no debug info>|int" setup_xfail "rs6000*-*-aix*" setup_xfail "powerpc*-*-aix*" @@ -145,12 +145,27 @@ if [runto inner] then { # This test is not as obscure as it might look. `p getenv ("TERM")' # is a real-world example, at least on many systems. - if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" "mips-sgi-irix6*" } + if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix6*" } if [target_info exists gdb,cannot_call_functions] { setup_xfail "*-*-*" 2416 fail "p/c array_index(\"abcdef\",2)" } else { - gdb_test {p/c array_index("abcdef",2)} " = 99 'c'" + # + # On HP-UX, a support function (__d_plt_call) necessary to + # implement an inferior call is normally only available when + # the inferior was compiled with -g. Thus, we expect this + # testpoint to fail on HP-UX. + if { [istarget "hppa*-hpux*"] } { + send_gdb "p/c array_index(\"abcdef\",2)\n" + gdb_expect { + -re ".*Suggest linking executable with -g.*$gdb_prompt $" { pass "p/c array_index(\"abcdef\",2)" } + -re ".*Cannot find __wdb_call_dummy in.*end.o.*" { pass "p/c array_index(\"abcdef\",2)" } + -re ".*99 'c'.*" { pass "p/c array_index(\"abcdef\",2)" } + timeout { fail "(timeout) p/c array_index" } + } + } else { + gdb_test {p/c array_index("abcdef",2)} " = 99 'c'" + } } # Now, try that we can give names of file-local symbols which happen diff --git a/gdb/testsuite/gdb.base/opaque.exp b/gdb/testsuite/gdb.base/opaque.exp index 92e6459..a3bc26f 100644 --- a/gdb/testsuite/gdb.base/opaque.exp +++ b/gdb/testsuite/gdb.base/opaque.exp @@ -106,7 +106,7 @@ gdb_test "whatis foop" \ # Ensure that we know the form of the structure that foop points to. setup_xfail_on_opaque_pointer -if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "hppa*-*-hpux*" } +if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" } gdb_test "ptype foop" \ "type = struct foo \{\[\r\n\]+ int a;\[\r\n\]+ int b;\[\r\n\]+\} \[*\]+" \ "ptype on opaque struct pointer (statically)" @@ -167,7 +167,7 @@ gdb_test "whatis foop" \ # Ensure that we know the form of the thing foop points to. setup_xfail_on_opaque_pointer -if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "hppa*-*-hpux*" } +if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" } gdb_test "ptype foop" \ "type = struct foo \{\[\r\n\]+ int a;\[\r\n\]+ int b;\[\r\n\]+\} \[*\]+" \ "ptype on opaque struct pointer (dynamically) 1" @@ -181,7 +181,7 @@ gdb_test "whatis afoo" \ gdb_test "ptype afoo" \ "type = struct foo \{\[\r\n\]+ int a;\[\r\n\]+ int b;\[\r\n\]+\}" \ - "ptype on opaque struct instance (dynamically) 1" + "ptype on opaque struct instance (dynamically) xyz 1" # Ensure that we know the form of an explicit struct foo. @@ -220,7 +220,29 @@ gdb_test "whatis foop" \ # Ensure that we know the form of the thing foop points to. setup_xfail_on_opaque_pointer -if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "hppa*-*-hpux*" } +if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" } +gdb_test "ptype foop" \ + "type = struct foo \{\[\r\n\]+ int a;\[\r\n\]+ int b;\[\r\n\]+\} \[*\]+" \ + "ptype on opaque struct pointer (dynamically) 2" + +gdb_test "whatis afoo" \ + "type = struct foo" \ + "whatis on opaque struct instance (dynamically) 1" + + +# Ensure that we know the form of afoo, an instance of a struct foo. + +gdb_test "ptype afoo" \ + "type = struct foo \{\r\n int a;\r\n int b;\r\n\}" \ + "ptype on opaque struct instance (dynamically) 1" + +gdb_test "ptype afoo" \ + "type = struct foo \{\[\r\n\]*.*int a;\[\r\n\]*.*int b;\[\r\n\]*}\[\r\n\]*" \ + "ptype on opaque struct instance (dynamically) pqr 1" + + +# Ensure that we know the form of an explicit struct foo. + gdb_test "ptype foop" \ "type = struct foo \{\[\r\n\]+ int a;\[\r\n\]+ int b;\[\r\n\]+\} \[*\]+" \ "ptype on opaque struct pointer (dynamically) 2" diff --git a/gdb/testsuite/gdb.base/opaque0.c b/gdb/testsuite/gdb.base/opaque0.c index c6e239e..5ec4a2a 100644 --- a/gdb/testsuite/gdb.base/opaque0.c +++ b/gdb/testsuite/gdb.base/opaque0.c @@ -7,6 +7,9 @@ struct foo *foop; extern struct foo *getfoo (); +#ifdef PROTOTYPES +extern void putfoo (struct foo *foop); +#endif int main () { diff --git a/gdb/testsuite/gdb.base/opaque1.c b/gdb/testsuite/gdb.base/opaque1.c index 4a3c855..c34f7aa 100644 --- a/gdb/testsuite/gdb.base/opaque1.c +++ b/gdb/testsuite/gdb.base/opaque1.c @@ -8,7 +8,7 @@ struct foo *getfoo () return (&afoo); } -#ifdef __STDC__ +#ifdef PROTOTYPES void putfoo (struct foo *foop) #else void putfoo (foop) diff --git a/gdb/testsuite/gdb.base/pointers.exp b/gdb/testsuite/gdb.base/pointers.exp index 7a0e44f..6b9f135 100644 --- a/gdb/testsuite/gdb.base/pointers.exp +++ b/gdb/testsuite/gdb.base/pointers.exp @@ -43,6 +43,9 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } +if [get_compiler_info ${binfile}] { + return -1; +} gdb_exit gdb_start @@ -153,7 +156,7 @@ gdb_expect { send_gdb "print v_int_pointer == v_int_pointer2\n" gdb_expect { - -re ".*= 0.*$gdb_prompt $" { + -re ".*= $false.*$gdb_prompt $" { pass "pointer1==pointer2" } -re ".*$gdb_prompt $" { fail "pointer1==pointer2" } @@ -162,7 +165,7 @@ gdb_expect { send_gdb "print v_int_pointer != v_int_pointer2\n" gdb_expect { - -re ".*= 1.*$gdb_prompt $" { + -re ".*= $true.*$gdb_prompt $" { pass "pointer1!=pointer2" } -re ".*$gdb_prompt $" { fail "pointer1!=pointer2" } @@ -172,7 +175,7 @@ gdb_expect { send_gdb "print v_int_pointer <= v_int_pointer2\n" gdb_expect { - -re ".*= 1.*$gdb_prompt $" { + -re ".*= $true.*$gdb_prompt $" { pass "pointer1<=pointer2" } -re ".*$gdb_prompt $" { fail "pointer1<=pointer2" } @@ -182,7 +185,7 @@ gdb_expect { send_gdb "print v_int_pointer >= v_int_pointer2\n" gdb_expect { - -re ".*= 0.*$gdb_prompt $" { + -re ".*= $false.*$gdb_prompt $" { pass "pointer1>=pointer2" } -re ".*$gdb_prompt $" { fail "pointer1>=pointer2" } @@ -192,7 +195,7 @@ gdb_expect { send_gdb "print v_int_pointer < v_int_pointer2\n" gdb_expect { - -re ".*= 1.*$gdb_prompt $" { + -re ".*= $true.*$gdb_prompt $" { pass "pointer1<pointer2" } -re ".*$gdb_prompt $" { fail "pointer1<pointer2" } @@ -201,7 +204,7 @@ gdb_expect { send_gdb "print v_int_pointer > v_int_pointer2\n" gdb_expect { - -re ".*= 0.*$gdb_prompt $" { + -re ".*= $false.*$gdb_prompt $" { pass "pointer1>pointer2" } -re ".*$gdb_prompt $" { fail "pointer1>pointer2" } diff --git a/gdb/testsuite/gdb.base/printcmds.c b/gdb/testsuite/gdb.base/printcmds.c index 6f2238b..2708074 100644 --- a/gdb/testsuite/gdb.base/printcmds.c +++ b/gdb/testsuite/gdb.base/printcmds.c @@ -1,7 +1,7 @@ /* This table is used as a source for every ascii character. It is explicitly unsigned to avoid differences due to native characters being either signed or unsigned. */ - +#include <stdlib.h> unsigned char ctable1[256] = { 0000, 0001, 0002, 0003, 0004, 0005, 0006, 0007, 0010, 0011, 0012, 0013, 0014, 0015, 0016, 0017, @@ -64,7 +64,7 @@ int int2dim[3][4] = {{0,1,2,3},{4,5,6,7},{8,9,10,11}}; int int3dim[2][3][2] = {{{0,1},{2,3},{4,5}},{{6,7},{8,9},{10,11}}}; int int4dim[1][2][3][2] = {{{{0,1},{2,3},{4,5}},{{6,7},{8,9},{10,11}}}}; -char *teststring = "teststring contents"; +char *teststring = (char*)"teststring contents"; /* Test printing of a struct containing character arrays. */ @@ -86,7 +86,7 @@ struct some_arrays *parrays = &arrays; /* -- */ -main () +int main () { #ifdef usestubs set_debug_traps(); diff --git a/gdb/testsuite/gdb.base/ptype.c b/gdb/testsuite/gdb.base/ptype.c index 8013435..07d6afe 100644 --- a/gdb/testsuite/gdb.base/ptype.c +++ b/gdb/testsuite/gdb.base/ptype.c @@ -6,6 +6,7 @@ /* * First the basic C types. */ +#include <stdlib.h> #if !defined (__STDC__) && !defined (_AIX) #define signed /**/ @@ -213,21 +214,22 @@ enum cars {bmw, porsche} sportscar; typedef enum {FALSE, TRUE} boolean; boolean v_boolean; -typedef enum bvals {false, true} boolean2; +/*note: aCC has bool type predefined with 'false' and 'true'*/ +typedef enum bvals {my_false, my_true} boolean2; boolean2 v_boolean2; enum misordered {two = 2, one = 1, zero = 0, three = 3}; +/* Seems like we need a variable of this type to get the type to be put + in the executable, at least for AIX xlc. */ +enum misordered v_misordered = three; + /***********/ -main () +int main () { /* Ensure that malloc is a pointer type; avoid use of "void" and any include files. */ - extern char *malloc(); - - /* Seems like we need a variable of this type to get the type to be put - in the executable, at least for AIX xlc. */ - enum misordered v_misordered = three; +/* extern char *malloc();*/ /* Some of the tests in ptype.exp require invoking malloc, so make sure it is linked in to this program. */ @@ -309,5 +311,6 @@ main () v_t_struct_p = 0; v_boolean = FALSE; - v_boolean2 = false; + v_boolean2 = my_false; + return 0; } diff --git a/gdb/testsuite/gdb.base/ptype.exp b/gdb/testsuite/gdb.base/ptype.exp index 1ef6771..98d4586 100644 --- a/gdb/testsuite/gdb.base/ptype.exp +++ b/gdb/testsuite/gdb.base/ptype.exp @@ -94,7 +94,7 @@ if [gdb_test "ptype v_t_struct_p->v_float_member" "type = float"]<0 then { # IBM's xlc puts out bogus stabs--the stuff field is type 42, # which isn't defined. -gdb_test "ptype struct link" "type = struct link \{.*\[\r\n\] struct link \[*\]next;.*\[\r\n\] struct link \[*(\]+linkfunc\[)(\]+(struct link \[*\], int\[)\]|);.*\[\r\n\] struct t_struct stuff.1..2..3.;.*\[\r\n\]\}.*" "ptype linked list structure" +gdb_test "ptype struct link" "type = struct link \{\[\r\n\]+\[ \t\]+struct link \\*next;\[\r\n\]+\[ \t\]+struct link \\*\\(\\*linkfunc\\)\\((struct link \\*, int|void|)\\);\[\r\n\]+\[ \t\]+struct t_struct stuff.1..2..3.;\[\r\n\]+\}.*" "ptype linked list structure" # # test ptype command with unions @@ -103,7 +103,7 @@ gdb_test "ptype union t_union" "type = union t_union \{.*\[\r\n\] (unsigned | # IBM's xlc puts out bogus stabs--the stuff field is type 42, # which isn't defined. -gdb_test "ptype union tu_link" "type = union tu_link .*\[\r\n\] struct link \[*\]next;.*\[\r\n\] struct link \[(\*\]+linkfunc\[)(\]+(struct link \[*\], int\[)\]|);.*\[\r\n\] struct t_struct stuff.1..2..3.;.*\[\r\n\]\}.*" "ptype linked list union" +gdb_test "ptype union tu_link" "type = union tu_link \{\[\r\n\]+\[ \t\]+struct link \\*next;\[\r\n\]+\[ \t\]+struct link \\*\\(\\*linkfunc\\)\\((struct link \\*, int|void|)\\);\[\r\n\]+\[ \t\]+struct t_struct stuff.1..2..3.;\[\r\n\]+\}.*" "ptype linked list union" # # test ptype command with enums @@ -117,7 +117,7 @@ gdb_test "ptype enum colors" "type = enum colors \{yellow, purple, pink\}.*" "pt # # test ptype command with enums as typedef # -gdb_test "ptype boolean" "type = enum \{FALSE, TRUE\}.*" "ptype unnamed typedef'd enumeration" +gdb_test "ptype boolean" "type = enum (boolean |)\{FALSE, TRUE\}.*" "ptype unnamed typedef'd enumeration" # And check that whatis shows the name, not "enum {...}". # This probably fails for all DWARF 1 cases, so assume so for now. -fnf @@ -128,21 +128,23 @@ gdb_test "ptype boolean" "type = enum \{FALSE, TRUE\}.*" "ptype unnamed typedef' # GDB's behavior is correct; the type which the variable is defined # as (51) doesn't have a name. Only 55 has a name. -if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "i*86-*-sysv4*" } +if {!$gcc_compiled && !$hp_aCC_compiler} { + setup_xfail "rs6000-*-*" "i*86-*-sysv4*" "hppa*-*-*" # CLLbs14773 +} setup_xfail_format "DWARF 1" -gdb_test "whatis v_boolean" "type = boolean" \ +gdb_test "whatis v_boolean" "type = (enum |)boolean" \ "whatis unnamed typedef'd enum (compiler bug in IBM's xlc)" # Same thing with struct and union. -gdb_test "ptype t_struct3" "type = struct \{.* +gdb_test "ptype t_struct3" "type = struct (t_struct3 |)\{.* *double v_double_member;.* *int v_int_member;.*\}" "printing typedef'd struct" -gdb_test "ptype t_union3" "type = union \{.* +gdb_test "ptype t_union3" "type = union (t_union3 |)\{.* *double v_double_member;.* *int v_int_member;.*\}" "printing typedef'd union" -gdb_test "ptype enum bvals" "type = enum bvals \{false, true\}.*" "ptype named typedef'd enumf'd enum" +gdb_test "ptype enum bvals" "type = enum bvals \{my_false, my_true\}.*" "ptype named typedef'd enumf'd enum" # # test ptype command with out-of-order enum values @@ -365,6 +367,7 @@ gdb_test "ptype v_int" "type = int.*" "ptype int" if {!$gcc_compiled} then { setup_xfail "rs6000-*-*" "i*86-*-sysv4*" } setup_xfail_format "DWARF 1" +if {$hp_aCC_compiler} {setup_xfail "hppa*-*-*"} gdb_test "ptype t_char_array" "type = (|unsigned )char \\\[0?\\\]" # @@ -489,21 +492,34 @@ gdb_test "ptype t_char_array" "type = (|unsigned )char \\\[0?\\\]" # # test ptype command with nested structure and union # -gdb_test "ptype struct outer_struct" "type = struct outer_struct \{.*\[\r\n\] int outer_int;.*\[\r\n\] struct inner_struct inner_struct_instance;.*\[\r\n\] union inner_union inner_union_instance;.*\[\r\n\] (long|long int|int) outer_long;.*\[\r\n\]\}.*" "ptype outer structure" +if {$hp_aCC_compiler} { + set outer "outer_struct::" + set struct "" + set union "" +} else { + set outer "" + set struct "struct" + set union "union" +} +gdb_test "ptype struct outer_struct" "type = struct outer_struct \{.*\[\r\n\]+\ +.*int outer_int;.*\[\r\n\]+\ +.*(struct|) ${outer}inner_struct inner_struct_instance;.*\[\r\n\]+\ +.*(union|) ${outer}inner_union inner_union_instance;.*\[\r\n\]+\ +.*(long|long int|int) outer_long;.*\[\r\n\]\}.*" "ptype outer structure" -gdb_test "ptype struct inner_struct" "type = struct inner_struct \{.*\[\r\n\] int inner_int;.*\[\r\n\] (long|long int|int) inner_long;.*\[\r\n\]\}.*" "ptype inner structure" +gdb_test "ptype ${struct} ${outer}inner_struct" "type = struct ${outer}inner_struct \{.*\[\r\n\] int inner_int;.*\[\r\n\] (long|long int|int) inner_long;.*\[\r\n\]\}.*" "ptype inner structure" -gdb_test "ptype union inner_union" "type = union inner_union \{.*\[\r\n\] int inner_union_int;.*\[\r\n\] (long|long int|int) inner_union_long;.*\[\r\n\]\}.*" "ptype inner union" +gdb_test "ptype ${union} ${outer}inner_union" "type = union ${outer}inner_union \{.*\[\r\n\] int inner_union_int;.*\[\r\n\] (long|long int|int) inner_union_long;.*\[\r\n\]\}.*" "ptype inner union" -gdb_test "ptype nested_su" "type = struct outer_struct \{.*\[\r\n\] int outer_int;.*\[\r\n\] struct inner_struct inner_struct_instance;.*\[\r\n\] union inner_union inner_union_instance;.*\[\r\n\] (long|long int|int) outer_long;.*\[\r\n\]\}.*" "ptype nested structure" +gdb_test "ptype nested_su" "type = struct outer_struct \{.*\[\r\n\] int outer_int;.*\[\r\n\] (struct |)${outer}inner_struct inner_struct_instance;.*\[\r\n\] (union |)${outer}inner_union inner_union_instance;.*\[\r\n\] (long|long int|int) outer_long;.*\[\r\n\]\}.*" "ptype nested structure" gdb_test "ptype nested_su.outer_int" "type = int.*" "ptype outer int" -gdb_test "ptype nested_su.inner_struct_instance" "type = struct inner_struct \{.*\[\r\n\] int inner_int;.*\[\r\n\] (long|long int|int) inner_long;.*\[\r\n\]\}.*" "ptype nested structure #2" +gdb_test "ptype nested_su.inner_struct_instance" "type = struct ${outer}inner_struct \{.*\[\r\n\] int inner_int;.*\[\r\n\] (long|long int|int) inner_long;.*\[\r\n\]\}.*" "ptype nested structure #2" gdb_test "ptype nested_su.inner_struct_instance.inner_int" "type = int.*" "ptype inner int" -gdb_test "ptype nested_su.inner_union_instance" "type = union inner_union \{.*\[\r\n\] int inner_union_int;.*\[\r\n\] (long|long int|int) inner_union_long;.*\[\r\n\]\}.*" "ptype nested union" +gdb_test "ptype nested_su.inner_union_instance" "type = union ${outer}inner_union \{.*\[\r\n\] int inner_union_int;.*\[\r\n\] (long|long int|int) inner_union_long;.*\[\r\n\]\}.*" "ptype nested union" # Test printing type of string constants and array constants, but # requires a running process. These call malloc, and can take a long diff --git a/gdb/testsuite/gdb.base/recurse.c b/gdb/testsuite/gdb.base/recurse.c index 1d6892d..7981778 100644 --- a/gdb/testsuite/gdb.base/recurse.c +++ b/gdb/testsuite/gdb.base/recurse.c @@ -1,9 +1,14 @@ /* Trivial code used to test watchpoints in recursive code and auto-deletion of watchpoints as they go out of scope. */ +#ifdef PROTOTYPES +static int +recurse (int a) +#else static int recurse (a) int a; +#endif { int b = 0; @@ -15,11 +20,12 @@ recurse (a) return b; } -main() +int main() { #ifdef usestubs set_debug_traps(); breakpoint(); #endif recurse (10); + return 0; } diff --git a/gdb/testsuite/gdb.base/relational.exp b/gdb/testsuite/gdb.base/relational.exp index 6a0b38a..fd03a41 100644 --- a/gdb/testsuite/gdb.base/relational.exp +++ b/gdb/testsuite/gdb.base/relational.exp @@ -42,6 +42,9 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } +if [get_compiler_info ${binfile}] { + return -1; +} gdb_exit gdb_start @@ -108,7 +111,7 @@ gdb_expect { send_gdb "print x < y\n" gdb_expect { - -re ".*0.*$gdb_prompt $" { + -re ".*$false.*$gdb_prompt $" { pass "print value of x<y" } -re ".*$gdb_prompt $" { fail "print value of x<y" } @@ -117,7 +120,7 @@ gdb_expect { send_gdb "print x <= y\n" gdb_expect { - -re ".*0.*$gdb_prompt $" { + -re ".*$false.*$gdb_prompt $" { pass "print value of x<=y" } -re ".*$gdb_prompt $" { fail "print value of x<=y" } @@ -126,7 +129,7 @@ gdb_expect { send_gdb "print x > y\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of x>y" } -re ".*$gdb_prompt $" { fail "print value of x>y" } @@ -135,7 +138,7 @@ gdb_expect { send_gdb "print x >= y\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of x>=y" } -re ".*$gdb_prompt $" { fail "print value of x>=y" } @@ -144,7 +147,7 @@ gdb_expect { send_gdb "print x == y\n" gdb_expect { - -re ".*0.*$gdb_prompt $" { + -re ".*$false.*$gdb_prompt $" { pass "print value of x==y" } -re ".*$gdb_prompt $" { fail "print value of x==y" } @@ -153,7 +156,7 @@ gdb_expect { send_gdb "print x != y\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of x!=y" } -re ".*$gdb_prompt $" { fail "print value of x!=y" } @@ -172,7 +175,7 @@ gdb_test "set variable z=2" "" "set variable z" send_gdb "print x < y < z\n" gdb_expect { - -re ".*1\r\n$gdb_prompt $" { + -re ".*$true.*\r\n$gdb_prompt $" { pass "print value of x<y<z" } -re ".*$gdb_prompt $" { fail "print value of x<y<z" } @@ -181,7 +184,7 @@ gdb_expect { send_gdb "print x <= y <= z\n" gdb_expect { - -re ".*1\r\n$gdb_prompt $" { + -re ".*$true\r\n$gdb_prompt $" { pass "print value of x<=y<=z" } -re ".*$gdb_prompt $" { fail "print value of x<=y<=z" } @@ -190,7 +193,7 @@ gdb_expect { send_gdb "print x > y > z\n" gdb_expect { - -re ".*0\r\n$gdb_prompt $" { + -re ".*$false.*\r\n$gdb_prompt $" { pass "print value of x>y>z" } -re 8".*$gdb_prompt $" { fail "print value of x>y>z" } @@ -199,7 +202,7 @@ gdb_expect { send_gdb "print x >= y >= z\n" gdb_expect { - -re ".*0\r\n$gdb_prompt $" { + -re ".*$false.*\r\n$gdb_prompt $" { pass "print value of x>=y>=z" } -re ".*$gdb_prompt $" { fail "print value of x>=y>=z" } @@ -213,7 +216,7 @@ gdb_test "set variable z=1" "" "set variable z" send_gdb "print x == y == z\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of x==y==z" } -re ".*$gdb_prompt $" { fail "print value of x==y==z" } @@ -225,7 +228,7 @@ gdb_test "set variable z=0" "" "set variable z" send_gdb "print x != y != z\n" gdb_expect { - -re ".*0\r\n$gdb_prompt $" { + -re ".*$false\r\n$gdb_prompt $" { pass "print value of x!=y!=z" } -re ".*$gdb_prompt $" { fail "print value of x!=y!=z" } @@ -242,7 +245,7 @@ gdb_test "set variable z=2" "" "set variable z" send_gdb "print x < y == z\n" gdb_expect { - -re ".*0.*$gdb_prompt $" { + -re ".*$false.*$gdb_prompt $" { pass "print value of x<y==z" } -re ".*$gdb_prompt $" { fail "print value of x<y==z" } @@ -252,7 +255,7 @@ gdb_expect { # 0 2 2 send_gdb "print x < y != z\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of x<y!=z" } -re ".*$gdb_prompt $" { fail "print value of x<y!=z" } @@ -267,7 +270,7 @@ gdb_test "set variable z=1" "" "set variable z" # 2 3 1 send_gdb "print x < y <= z\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of x<y<=z" } -re ".*$gdb_prompt $" { fail "print value of x<y<=z" } @@ -278,7 +281,7 @@ gdb_expect { # 2 3 1 send_gdb "print x < y >= z\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of x<y>=z" } -re ".*$gdb_prompt $" { fail "print value of x<y>=z" } @@ -292,7 +295,7 @@ gdb_test "set variable z=0" "" " set variable z" # 2 3 0 send_gdb "print x < y > z\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of x<y>z" } -re ".*$gdb_prompt $" { fail "print value of x<y>z" } @@ -305,7 +308,7 @@ gdb_test "set variable x=1" "" " set variable x" # 1 3 0 send_gdb "print x > y >= z\n" gdb_expect { - -re ".*1.*$gdb_prompt $" { + -re ".*$true.*$gdb_prompt $" { pass "print value of x>y>=z" } -re ".*$gdb_prompt $" { fail "print value of x>y>=z" } @@ -318,7 +321,7 @@ gdb_test "set variable z=2" "" " set variable z" # 1 3 2 send_gdb "print x > y == z\n" gdb_expect { - -re ".*0.*$gdb_prompt $" { + -re ".*$false.*$gdb_prompt $" { pass "print value of x>y==z" } -re ".*$gdb_prompt $" { fail "print value of x>y==z" } @@ -332,7 +335,7 @@ gdb_test "set variable z=0" "" " set variable z" # 2 3 0 send_gdb "print x > y != z\n" gdb_expect { - -re ".*0.*$gdb_prompt $" { + -re ".*$false.*$gdb_prompt $" { pass "print value of x>y!=z" } -re ".*$gdb_prompt $" { fail "print value of x>y!=z" } @@ -345,7 +348,7 @@ gdb_test "set variable x=4" "" "set x to 4" # 4 3 0 send_gdb "print x > y <= z\n" gdb_expect { - -re ".*0.*$gdb_prompt $" { + -re ".*$false.*$gdb_prompt $" { pass "print value of x>y<=z" } -re ".*$gdb_prompt $" { fail "print value of x>y<=z" } @@ -355,7 +358,7 @@ gdb_expect { # 4 3 0 send_gdb "print x >= y == z\n" gdb_expect { - -re ".*0\r\n$gdb_prompt $" { + -re ".*$false\r\n$gdb_prompt $" { pass "print value of x>=y==z" } -re ".*$gdb_prompt $" { fail "print value of x>=y==z" } @@ -368,7 +371,7 @@ gdb_test "set variable x=2" "" " set variable x" # 2 3 0 send_gdb "print x >= y != z\n" gdb_expect { - -re ".*0\r\n$gdb_prompt $" { + -re ".*$false\r\n$gdb_prompt $" { pass "print value of x>=y!=z" } -re ".*$gdb_prompt $" { fail "print value of x>=y!=z" } @@ -382,7 +385,7 @@ gdb_test "set variable z=4" "" " set variable z" # 0 3 4 send_gdb "print x >= y <= z\n" gdb_expect { - -re ".*1\r\n$gdb_prompt $" { + -re ".*$true\r\n$gdb_prompt $" { pass "print value of x>=y<=z" } -re ".*$gdb_prompt $" { fail "print value of x>=y<=z" } @@ -392,7 +395,7 @@ gdb_expect { # 0 3 4 send_gdb "print x <= y == z\n" gdb_expect { - -re ".*0\r\n$gdb_prompt $" { + -re ".*$false\r\n$gdb_prompt $" { pass "print value of x<=y==z" } -re ".*$gdb_prompt $" { fail "print value of x<=y==z" } @@ -404,7 +407,7 @@ gdb_test "set variable x=2" "" " set variable x" # 2 3 4 send_gdb "print x <= y != z\n" gdb_expect { - -re ".*1\r\n$gdb_prompt $" { + -re ".*$true\r\n$gdb_prompt $" { pass "print value of x<=y!=z" } -re ".*$gdb_prompt $" { fail "print value of x<=y!=z" } @@ -415,7 +418,7 @@ gdb_expect { # 2 3 4 send_gdb "print x == y != z\n" gdb_expect { - -re ".*1\r\n$gdb_prompt $" { + -re ".*$true\r\n$gdb_prompt $" { pass "print value of x==y!=z" } -re ".*$gdb_prompt $" { fail "print value of x==y!=z" } @@ -432,7 +435,7 @@ gdb_test "set variable z=0" "" " set variable z" # 2 3 0 send_gdb "print x >= (y < z)\n" gdb_expect { - -re ".*1\r\n$gdb_prompt $" { + -re ".*$true\r\n$gdb_prompt $" { pass "print value of x>=(y<z)" } -re ".*$gdb_prompt $" { fail "print value of x>=(y<z)" } @@ -443,7 +446,7 @@ gdb_expect { # 2 3 0 send_gdb "print x >= (y != z)\n" gdb_expect { - -re ".*1\r\n$gdb_prompt $" { + -re ".*$true\r\n$gdb_prompt $" { pass "print value of x>=(y!=z)" } -re ".*$gdb_prompt $" { fail "print value of x>=(y*!=z)" } @@ -453,7 +456,7 @@ gdb_expect { # 2 3 0 send_gdb "print x == (y == z)\n" gdb_expect { - -re ".*0\r\n$gdb_prompt $" { + -re ".*$false\r\n$gdb_prompt $" { pass "print value of x==(y==z)" } -re ".*$gdb_prompt $" { fail "print value of x==(y==z)" } @@ -467,7 +470,7 @@ gdb_test "set variable z=4" "" " set variable z" # 1 3 4 send_gdb "print (x == y) < z\n" gdb_expect { - -re ".*1\r\n$gdb_prompt $" { + -re ".*$true\r\n$gdb_prompt $" { pass "print value of (x==y)<z" } -re ".*$gdb_prompt $" { fail "print value of (x==y)<z" } diff --git a/gdb/testsuite/gdb.base/restore.c b/gdb/testsuite/gdb.base/restore.c index a65d648..2469430 100644 --- a/gdb/testsuite/gdb.base/restore.c +++ b/gdb/testsuite/gdb.base/restore.c @@ -248,7 +248,7 @@ driver (void) /* generated code ends here */ -main () +int main () { register int local; #ifdef usestubs diff --git a/gdb/testsuite/gdb.base/return.c b/gdb/testsuite/gdb.base/return.c index e19d1a0..d11a4b5 100644 --- a/gdb/testsuite/gdb.base/return.c +++ b/gdb/testsuite/gdb.base/return.c @@ -1,7 +1,7 @@ #include <stdio.h> /* Test "return" command. */ -func1 () +void func1 () { printf("in func1\n"); } @@ -21,7 +21,7 @@ func3 () int tmp2; double tmp3; -main () +int main () { #ifdef usestubs set_debug_traps(); @@ -32,4 +32,5 @@ main () tmp2 = func2 (); tmp3 = func3 (); printf("exiting\n"); + return 0; } diff --git a/gdb/testsuite/gdb.base/run.c b/gdb/testsuite/gdb.base/run.c index 40ec720..25b8a4a 100644 --- a/gdb/testsuite/gdb.base/run.c +++ b/gdb/testsuite/gdb.base/run.c @@ -34,11 +34,20 @@ char *arg; #else /* ! vxworks */ # include <stdio.h> +# include <stdlib.h> #endif /* ! vxworks */ +#ifdef PROTOTYPES +int factorial (int); + +int +main (int argc, char **argv, char **envp) +#else +int main (argc, argv, envp) int argc; char *argv[], **envp; +#endif { #ifdef usestubs set_debug_traps(); @@ -57,11 +66,17 @@ char *argv[], **envp; return 0; } -int factorial (value) -int value; +#ifdef PROTOTYPES +int factorial (int value) +#else +int factorial (value) int value; +#endif { + int local_var; + if (value > 1) { value *= factorial (value - 1); } + local_var = value; return (value); } diff --git a/gdb/testsuite/gdb.base/scope.exp b/gdb/testsuite/gdb.base/scope.exp index 6a92ca7..708bc42 100644 --- a/gdb/testsuite/gdb.base/scope.exp +++ b/gdb/testsuite/gdb.base/scope.exp @@ -59,6 +59,7 @@ proc test_at_main {} { global srcdir global subdir global gcc_compiled + global hp_cc_compiler # skip past init. There may be a call to __main at the start of # main, so the first next may only get us to the init0 call. @@ -111,6 +112,8 @@ proc test_at_main {} { # Print scope1.c::filelocal, which is 2 if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } + #DTS 11747CLLbs + if {$hp_cc_compiler} then { setup_xfail "hppa2.0w-*-*"} if [gdb_test "print 'scope1.c'::filelocal" "\\\$$decimal = 2" "print 'scope1.c'::filelocal" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::filelocal"] { gdb_suppress_tests ; } @@ -119,6 +122,8 @@ proc test_at_main {} { # Print scope1.c::filelocal_bss, which is 102 if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } + #DTS 11747CLLbs + if {$hp_cc_compiler} then { setup_xfail "hppa2.0w-*-*"} if [gdb_test "print 'scope1.c'::filelocal_bss" "\\\$$decimal = 102" "print 'scope1.c'::filelocal_bss" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::filelocal_bss"] { gdb_suppress_tests ; } @@ -127,6 +132,8 @@ proc test_at_main {} { # Print scope1.c::filelocal_ro, which is 202 if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } + #DTS 11747CLLbs + if {$hp_cc_compiler} then { setup_xfail "hppa2.0w-*-*"} if [gdb_test "print 'scope1.c'::filelocal_ro" "\\\$$decimal = 202" "print 'scope1.c'::filelocal_ro" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::filelocal_ro"] { gdb_suppress_tests ; } @@ -134,7 +141,6 @@ proc test_at_main {} { # Print scope1.c::foo::funclocal, which is 3 - if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" } if [gdb_test "print foo::funclocal" "\\\$$decimal = 3" "print foo::funclocal" ] { gdb_suppress_tests ; } @@ -238,12 +244,10 @@ proc test_at_foo {} { gdb_test "print funclocal" "\\\$$decimal = 3" "print funclocal at foo" - if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" } gdb_test "print foo::funclocal" "\\\$$decimal = 3" \ "print foo::funclocal at foo" if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } - if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" } gdb_test "print 'scope1.c'::foo::funclocal" "\\\$$decimal = 3" "print 'scope1.c'::foo::funclocal at foo" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal" @@ -252,12 +256,10 @@ proc test_at_foo {} { gdb_test "print funclocal_bss" "\\\$$decimal = 103" \ "print funclocal_bss at foo" - if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" } gdb_test "print foo::funclocal_bss" "\\\$$decimal = 103" \ "print foo::funclocal_bss at foo" if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } - if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" } gdb_test "print 'scope1.c'::foo::funclocal_bss" "\\\$$decimal = 103" "print 'scope1.c'::foo::funclocal_bss at foo" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal_bss" @@ -266,23 +268,19 @@ proc test_at_foo {} { gdb_test "print funclocal_ro" "\\\$$decimal = 203" \ "print funclocal_ro at foo" - if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" } gdb_test "print foo::funclocal_ro" "\\\$$decimal = 203" \ "print foo::funclocal_ro at foo" if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } - if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" } gdb_test "print 'scope1.c'::foo::funclocal_ro" "\\\$$decimal = 203" "print 'scope1.c'::foo::funclocal_ro at foo" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal_ro" # Print scope1.c::bar::funclocal, which is 4 - if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" } gdb_test "print bar::funclocal" "\\\$$decimal = 4" \ "print bar::funclocal at foo" if {$gcc_compiled} then { setup_xfail "rs6000-*-*" } - if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" } gdb_test "print 'scope1.c'::bar::funclocal" "\\\$$decimal = 4" "print 'scope1.c'::bar::funclocal at foo" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::bar::funclocal" gdb_stop_suppressing_tests; @@ -365,7 +363,6 @@ proc test_at_bar {} { # Print scope1.c::foo::funclocal, which is 3 - if {!$gcc_compiled} then { setup_xfail "hppa*-*-hpux*" } if [gdb_test "print foo::funclocal" "\\\$$decimal = 3" "print foo::funclocal at bar" ] { gdb_suppress_tests ; } diff --git a/gdb/testsuite/gdb.base/scope0.c b/gdb/testsuite/gdb.base/scope0.c index 3a1b89e..ad994fc 100644 --- a/gdb/testsuite/gdb.base/scope0.c +++ b/gdb/testsuite/gdb.base/scope0.c @@ -5,7 +5,19 @@ static int filelocal_bss; /* In BSS section */ #endif static const int filelocal_ro = 201; /* In Read-Only Data section */ -main () +extern void init1(); +extern void foo(); + +int autovars (int bcd, int abc); +int localscopes (int x); +int useit (int val); +void init0(); +void marker1 (); +void marker2 (); +void marker3 (); +void marker4 (); + +int main () { #ifdef usestubs set_debug_traps(); @@ -19,14 +31,14 @@ main () /* On some systems, such as AIX, unreferenced variables are deleted from the executable. */ -usestatics () +void usestatics () { useit (filelocal); useit (filelocal_bss); useit (filelocal_ro); } -init0 () +void init0 () { filelocal_bss = 101; init1 (); @@ -34,9 +46,14 @@ init0 () /* This is to derail optimizer in localscopes. Return 1 + 2 + . . . + N. */ +#ifdef PROTOTYPES +int +sum_upto (int n) +#else int sum_upto (n) int n; +#endif { int i; int retval = 0; @@ -46,8 +63,13 @@ sum_upto (n) return retval; } +#ifdef PROTOTYPES +int +useit (int val) +#else int useit (val) +#endif { static int usedval; @@ -55,10 +77,15 @@ useit (val) return val + sum_upto (0); } +#ifdef PROTOTYPES +int +autovars (int bcd, int abc) +#else int autovars (bcd, abc) int bcd; int abc; +#endif { int i0 = useit (0), i1 = useit (1), i2 = useit (2); int i3 = useit (3), i4 = useit (4), i5 = useit (5); @@ -133,9 +160,14 @@ autovars (bcd, abc) + i91 + i92 + i93 + i94 + i95 + i96 + i97 + i98 + i99 + abc + bcd; } +#ifdef PROTOTYPES +int +localscopes (int x) +#else int localscopes (x) int x; +#endif { int localval; int retval; @@ -170,7 +202,7 @@ localscopes (x) return retval; } -marker1 () {} -marker2 () {} -marker3 () {} -marker4 () {} +void marker1 () {} +void marker2 () {} +void marker3 () {} +void marker4 () {} diff --git a/gdb/testsuite/gdb.base/scope1.c b/gdb/testsuite/gdb.base/scope1.c index cccad6f..8c32522 100644 --- a/gdb/testsuite/gdb.base/scope1.c +++ b/gdb/testsuite/gdb.base/scope1.c @@ -5,8 +5,11 @@ static int filelocal_bss; /* In BSS section */ #endif static const int filelocal_ro = 202; /* In Read-Only Data section */ -foo () +void foo () { + + void bar (); + static int funclocal = 3; /* In Data section */ static int funclocal_bss; /* In BSS section */ static const int funclocal_ro = 203; /* RO Data */ @@ -16,28 +19,34 @@ foo () bar (); } -bar () +void bar () { static int funclocal = 4; /* In data section */ static int funclocal_bss; /* In BSS section */ funclocal_bss = 104; } -init1 () +void init1 () { filelocal_bss = 102; } /* On some systems, such as AIX, unreferenced variables are deleted from the executable. */ -usestatics1 () +void usestatics1 () { + void useit1 (int val); + useit1 (filelocal); useit1 (filelocal_bss); useit1 (filelocal_ro); } -useit1 (val) +#ifdef PROTOTYPES +void useit1 (int val) +#else +void useit1 (val) int val; +#endif { static int usedval; diff --git a/gdb/testsuite/gdb.base/sect-cmd.exp b/gdb/testsuite/gdb.base/sect-cmd.exp index 27bde04..d07def5 100644 --- a/gdb/testsuite/gdb.base/sect-cmd.exp +++ b/gdb/testsuite/gdb.base/sect-cmd.exp @@ -59,10 +59,15 @@ if ![runto_main] then { fail "section command tests suppressed" } # not clear that there'll be a section named "$CODE$" in such # programs.) # + +set address1 "" +set address2 "" send_gdb "info files\n" gdb_expect { - -re ".*(0x\[0-9a-fA-F\]*) - (0x\[0-9a-fA-F\]*) is .CODE..*$gdb_prompt $"\ - {pass "info files"} + -re ".*(0x\[0-9a-fA-F\]*) - (0x\[0-9a-fA-F\]*) is .(CODE|text).*$gdb_prompt $"\ + {pass "info files" + set address1 $expect_out(1,string) + set address2 $expect_out(2,string)} -re "$gdb_prompt $"\ {fail "info files"} timeout {fail "(timeout) info files"} @@ -71,13 +76,24 @@ gdb_expect { # Reset the section to that same starting address, which should be # harmless (i.e., we just want to exercise the section command). # -send_gdb "section \$CODE\$ $expect_out(1,string)\n" -gdb_expect { - -re ".*$expect_out(1,string) \- $expect_out(2,string) is .CODE..*$gdb_prompt $"\ - {pass "set section command"} - -re "$gdb_prompt $"\ - {fail "set section command"} - timeout {fail "(timeout) set section command"} +if [istarget "hppa2.0w-*-*"] then { + send_gdb "section \.text $address1\n" + gdb_expect { + -re ".*$address1 \- $address2 is .text.*$gdb_prompt $"\ + {pass "set section command"} + -re "$gdb_prompt $"\ + {fail "set section command"} + timeout {fail "(timeout) set section command"} + } +} else { + send_gdb "section \$CODE\$ $address1\n" + gdb_expect { + -re ".*$address1 \- $address2 is .CODE..*$gdb_prompt $"\ + {pass "set section command"} + -re "$gdb_prompt $"\ + {fail "set section command"} + timeout {fail "(timeout) set section command"} + } } # Verify that GDB responds gracefully to a non-existent section name. diff --git a/gdb/testsuite/gdb.base/setshow.c b/gdb/testsuite/gdb.base/setshow.c index ed4e7a9..fbaba0f 100644 --- a/gdb/testsuite/gdb.base/setshow.c +++ b/gdb/testsuite/gdb.base/setshow.c @@ -3,10 +3,15 @@ #include <stdio.h> +#ifdef PROTOTYPES +int +main(int argc, char **argv) +#else int main(argc, argv) int argc; char **argv; +#endif { int i = 1; #ifdef usestubs diff --git a/gdb/testsuite/gdb.base/setvar.c b/gdb/testsuite/gdb.base/setvar.c index 7162155..969de0d 100644 --- a/gdb/testsuite/gdb.base/setvar.c +++ b/gdb/testsuite/gdb.base/setvar.c @@ -1,7 +1,13 @@ +#include <stdlib.h> + +#ifdef PROTOTYPES +int main (int argc, char **argv, char **envp) +#else main (argc, argv, envp) int argc; char **argv; char **envp; +#endif { extern void dummy(); #ifdef usestubs @@ -9,6 +15,7 @@ main (argc, argv, envp) breakpoint(); #endif dummy(); + return 0; } /* We put main() right up front so its line number doesn't keep changing. */ diff --git a/gdb/testsuite/gdb.base/setvar.exp b/gdb/testsuite/gdb.base/setvar.exp index 96d3eb4..e7d31dc 100644 --- a/gdb/testsuite/gdb.base/setvar.exp +++ b/gdb/testsuite/gdb.base/setvar.exp @@ -329,8 +329,12 @@ gdb_test "print *(v_signed_short_pointer+1)" ".\[0-9\]*.*=.*-456" gdb_test "set v_unsigned_short_pointer=v_unsigned_short_array" "" gdb_test "set variable *(v_unsigned_short_pointer)=123" "" gdb_test "set variable *(v_unsigned_short_pointer+1)=-456" "" +# DTS 10060CLLbs - bad type info from cc +if {$hp_cc_compiler} {setup_xfail hppa*-*-*11*} gdb_test "print v_unsigned_short_array" ".\[0-9\]* =.*\{123,.*65080\}" \ "set variable unsigned short pointer" +# DTS 10060CLLbs - bad type info from cc +if {$hp_cc_compiler} {setup_xfail hppa*-*-*11*} gdb_test "print *(v_unsigned_short_pointer+1)" ".\[0-9\]* = 65080" # # test "set variable" for type "int *" @@ -385,6 +389,8 @@ v_long_member = 3,.*v_float_member = 4,.*v_double_member = 5.*\}" \ # the type of the structure to be specified, as in # v_struct1 = (struct t_struct) {32, 33, 34, 35, 36, 37} # GDB should do the same if it wants to provide this feature. +# However, for HP's aCC this is OK, so we skip the tests for aCC +if {! $hp_aCC_compiler} { if [target_info exists gdb,cannot_call_functions] { setup_xfail "*-*-*" 2416 fail "set variable v_struct1 = {32, 33, 34, 35, 36, 37}" @@ -398,6 +404,7 @@ gdb_test "print v_struct1" \ .*v_int_member = 2,.*\ v_long_member = 3,.*v_float_member = 4,.*v_double_member = 5.*\}" \ "set print structure #2" +} # Test printing of enumeration bitfields. # GNU C supports them, some other compilers don't. diff --git a/gdb/testsuite/gdb.base/shlib-call.exp b/gdb/testsuite/gdb.base/shlib-call.exp index 414d742..4e1daac 100644 --- a/gdb/testsuite/gdb.base/shlib-call.exp +++ b/gdb/testsuite/gdb.base/shlib-call.exp @@ -180,7 +180,7 @@ gdb_test "break shr2" \ "Breakpoint.*file.*shr2.c, line.*" \ "breakpoint function shr2" -gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, shr2 \\(.*\\) at.*shr2\\.c:3.*3.*return 2.x;" \ +gdb_test continue "Continuing\\..*Breakpoint \[0-9\]+, shr2 \\(.*\\) at.*shr2\\.c:7.*7.*return 2.x;" \ "run until breakpoint set at a function" @@ -249,10 +249,10 @@ send_gdb "set width 0\n" ; gdb_expect -re "$gdb_prompt $" # PR's 16495, 18213 # test that we can re-set breakpoints in shared libraries -gdb_test "break shr1" "Breakpoint 1 at .*" "set bp in shared library" +gdb_test "break shr1" "Breakpoint 1.*" "set bp in shared library" gdb_test "run" "Starting program:.*Breakpoint 1,.*" "run to bp in shared library" -gdb_test "cont" "Program exited normally." +gdb_test "cont" ".*Program exited normally..*" gdb_test "run" "Starting program:.*Breakpoint 1,.*" "re-run to bp in shared library (PR's 16495, 18213)" -gdb_test "cont" "Program exited normally." +gdb_test "cont" ".*Program exited normally..*" return 0 diff --git a/gdb/testsuite/gdb.base/shmain.c b/gdb/testsuite/gdb.base/shmain.c index dda5091..7013db5 100644 --- a/gdb/testsuite/gdb.base/shmain.c +++ b/gdb/testsuite/gdb.base/shmain.c @@ -3,8 +3,10 @@ #include "ss.h" #include <stdio.h> -extern int shr1(); -extern int shr2(); +extern int structarg(struct s); +extern int pstructarg(struct s*); +extern int shr1(int); +extern int shr2(int); extern float sg; int eglob; @@ -16,13 +18,27 @@ struct { int g; +#ifdef PROTOTYPES +int local_structarg(struct s x) +#else int local_structarg(x) struct s x; +#endif { return x.b; } -main() +#ifdef PROTOTYPES +int mainshr1(int g) +#else +int mainshr1(g) +int g; +#endif +{ + return 2*g; +} + +int main() { struct s y; g = 1; @@ -36,12 +52,5 @@ main() g = local_structarg(y); g = structarg(y); g = pstructarg(&y); - - return (0); -} - -int mainshr1(g) -int g; -{ - return 2*g; + return 0; } diff --git a/gdb/testsuite/gdb.base/shr1.c b/gdb/testsuite/gdb.base/shr1.c index 0efaff5..a0257e4 100644 --- a/gdb/testsuite/gdb.base/shr1.c +++ b/gdb/testsuite/gdb.base/shr1.c @@ -7,8 +7,12 @@ float sg = 5.5; int sgi = 2; static int sgs = 7; +#ifdef PROTOTYPES +int shr1(int x) +#else int shr1(x) int x; +#endif { f mumble; int l; @@ -25,20 +29,32 @@ int x; return 2*x; } +#ifdef PROTOTYPES +static int shr1_local(int x) +#else static int shr1_local(x) int x; +#endif { return 2*x; } +#ifdef PROTOTYPES +int structarg(struct s x) +#else int structarg(x) struct s x; +#endif { return x.a; } +#ifdef PROTOTYPES +int pstructarg(struct s *x) +#else int pstructarg(x) struct s *x; +#endif { return x->a; } diff --git a/gdb/testsuite/gdb.base/shr2.c b/gdb/testsuite/gdb.base/shr2.c index 94d5df9..de34986 100644 --- a/gdb/testsuite/gdb.base/shr2.c +++ b/gdb/testsuite/gdb.base/shr2.c @@ -1,11 +1,17 @@ -int shr2(x) +#ifdef PROTOTYPES +int shr2(int x) +#else +int shr2(x) int x; +#endif { return 2*x; } -int shr2_local(x) +#ifdef PROTOTYPES +int shr2_local(int x) +#else +int shr2_local(x) int x; +#endif { return 2*x; } - - diff --git a/gdb/testsuite/gdb.base/sigall.c b/gdb/testsuite/gdb.base/sigall.c index 1ab08e7..30d06f3 100644 --- a/gdb/testsuite/gdb.base/sigall.c +++ b/gdb/testsuite/gdb.base/sigall.c @@ -1,4 +1,5 @@ #include <signal.h> +#include <unistd.h> #ifdef __sh__ #define signal(a,b) /* Signals not supported on this target - make them go away */ @@ -7,429 +8,784 @@ /* Signal handlers, we set breakpoints in them to make sure that the signals really get delivered. */ +#ifdef PROTOTYPES +void +handle_ABRT (int sig) +#else void handle_ABRT (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_HUP (int sig) +#else void handle_HUP (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_QUIT (int sig) +#else void handle_QUIT (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_ILL (int sig) +#else void handle_ILL (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_EMT (int sig) +#else void handle_EMT (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_FPE (int sig) +#else void handle_FPE (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_BUS (int sig) +#else void handle_BUS (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_SEGV (int sig) +#else void handle_SEGV (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_SYS (int sig) +#else void handle_SYS (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_PIPE (int sig) +#else void handle_PIPE (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_ALRM (int sig) +#else void handle_ALRM (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_URG (int sig) +#else void handle_URG (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_TSTP (int sig) +#else void handle_TSTP (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_CONT (int sig) +#else void handle_CONT (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_CHLD (int sig) +#else void handle_CHLD (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_TTIN (int sig) +#else void handle_TTIN (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_TTOU (int sig) +#else void handle_TTOU (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_IO (int sig) +#else void handle_IO (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_XCPU (int sig) +#else void handle_XCPU (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_XFSZ (int sig) +#else void handle_XFSZ (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_VTALRM (int sig) +#else void handle_VTALRM (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_PROF (int sig) +#else void handle_PROF (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_WINCH (int sig) +#else void handle_WINCH (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_LOST (int sig) +#else void handle_LOST (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_USR1 (int sig) +#else void handle_USR1 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_USR2 (int sig) +#else void handle_USR2 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_PWR (int sig) +#else void handle_PWR (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_POLL (int sig) +#else void handle_POLL (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_WIND (int sig) +#else void handle_WIND (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_PHONE (int sig) +#else void handle_PHONE (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_WAITING (int sig) +#else void handle_WAITING (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_LWP (int sig) +#else void handle_LWP (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_DANGER (int sig) +#else void handle_DANGER (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_GRANT (int sig) +#else void handle_GRANT (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_RETRACT (int sig) +#else void handle_RETRACT (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_MSG (int sig) +#else void handle_MSG (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_SOUND (int sig) +#else void handle_SOUND (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_SAK (int sig) +#else void handle_SAK (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_PRIO (int sig) +#else void handle_PRIO (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_33 (int sig) +#else void handle_33 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_34 (int sig) +#else void handle_34 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_35 (int sig) +#else void handle_35 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_36 (int sig) +#else void handle_36 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_37 (int sig) +#else void handle_37 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_38 (int sig) +#else void handle_38 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_39 (int sig) +#else void handle_39 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_40 (int sig) +#else void handle_40 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_41 (int sig) +#else void handle_41 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_42 (int sig) +#else void handle_42 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_43 (int sig) +#else void handle_43 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_44 (int sig) +#else void handle_44 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_45 (int sig) +#else void handle_45 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_46 (int sig) +#else void handle_46 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_47 (int sig) +#else void handle_47 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_48 (int sig) +#else void handle_48 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_49 (int sig) +#else void handle_49 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_50 (int sig) +#else void handle_50 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_51 (int sig) +#else void handle_51 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_52 (int sig) +#else void handle_52 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_53 (int sig) +#else void handle_53 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_54 (int sig) +#else void handle_54 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_55 (int sig) +#else void handle_55 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_56 (int sig) +#else void handle_56 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_57 (int sig) +#else void handle_57 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_58 (int sig) +#else void handle_58 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_59 (int sig) +#else void handle_59 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_60 (int sig) +#else void handle_60 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_61 (int sig) +#else void handle_61 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_62 (int sig) +#else void handle_62 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_63 (int sig) +#else void handle_63 (sig) int sig; +#endif { } +#ifdef PROTOTYPES +void +handle_TERM (int sig) +#else void handle_TERM (sig) int sig; +#endif { } @@ -438,6 +794,7 @@ int gen_ABRT () { kill (getpid (), SIGABRT); + return 0; } int @@ -448,6 +805,7 @@ gen_HUP () #else handle_HUP (0); #endif +return 0; } int @@ -458,6 +816,7 @@ gen_QUIT () #else handle_QUIT (0); #endif +return 0; } int @@ -468,6 +827,7 @@ gen_ILL () #else handle_ILL (0); #endif +return 0; } int @@ -478,6 +838,7 @@ gen_EMT () #else handle_EMT (0); #endif +return 0; } int x; @@ -499,6 +860,7 @@ gen_FPE () #else kill (getpid (), SIGFPE); #endif +return 0; } int @@ -509,6 +871,7 @@ gen_BUS () #else handle_BUS (0); #endif +return 0; } int @@ -519,6 +882,7 @@ gen_SEGV () #else handle_SEGV (0); #endif +return 0; } int @@ -529,6 +893,7 @@ gen_SYS () #else handle_SYS (0); #endif +return 0; } int @@ -539,6 +904,7 @@ gen_PIPE () #else handle_PIPE (0); #endif +return 0; } int @@ -549,6 +915,7 @@ gen_ALRM () #else handle_ALRM (0); #endif +return 0; } int @@ -559,6 +926,7 @@ gen_URG () #else handle_URG (0); #endif +return 0; } int @@ -569,6 +937,7 @@ gen_TSTP () #else handle_TSTP (0); #endif +return 0; } int @@ -579,6 +948,7 @@ gen_CONT () #else handle_CONT (0); #endif +return 0; } int @@ -589,6 +959,7 @@ gen_CHLD () #else handle_CHLD (0); #endif +return 0; } int @@ -599,6 +970,7 @@ gen_TTIN () #else handle_TTIN (0); #endif +return 0; } int @@ -609,6 +981,7 @@ gen_TTOU () #else handle_TTOU (0); #endif +return 0; } int @@ -619,6 +992,7 @@ gen_IO () #else handle_IO (0); #endif +return 0; } int @@ -629,6 +1003,7 @@ gen_XCPU () #else handle_XCPU (0); #endif +return 0; } int @@ -639,6 +1014,7 @@ gen_XFSZ () #else handle_XFSZ (0); #endif +return 0; } int @@ -649,6 +1025,7 @@ gen_VTALRM () #else handle_VTALRM (0); #endif +return 0; } int @@ -659,6 +1036,7 @@ gen_PROF () #else handle_PROF (0); #endif +return 0; } int @@ -669,6 +1047,7 @@ gen_WINCH () #else handle_WINCH (0); #endif +return 0; } int @@ -679,6 +1058,7 @@ gen_LOST () #else handle_LOST (0); #endif +return 0; } int @@ -689,6 +1069,7 @@ gen_USR1 () #else handle_USR1 (0); #endif +return 0; } int @@ -699,6 +1080,7 @@ gen_USR2 () #else handle_USR2 (0); #endif +return 0; } int @@ -709,6 +1091,7 @@ gen_PWR () #else handle_PWR (0); #endif +return 0; } int @@ -719,6 +1102,7 @@ gen_POLL () #else handle_POLL (0); #endif +return 0; } int @@ -729,6 +1113,7 @@ gen_WIND () #else handle_WIND (0); #endif +return 0; } int @@ -739,6 +1124,7 @@ gen_PHONE () #else handle_PHONE (0); #endif +return 0; } int @@ -749,6 +1135,7 @@ gen_WAITING () #else handle_WAITING (0); #endif +return 0; } int @@ -759,6 +1146,7 @@ gen_LWP () #else handle_LWP (0); #endif +return 0; } int @@ -769,6 +1157,7 @@ gen_DANGER () #else handle_DANGER (0); #endif +return 0; } int @@ -779,6 +1168,7 @@ gen_GRANT () #else handle_GRANT (0); #endif +return 0; } int @@ -789,6 +1179,7 @@ gen_RETRACT () #else handle_RETRACT (0); #endif +return 0; } int @@ -799,6 +1190,7 @@ gen_MSG () #else handle_MSG (0); #endif +return 0; } int @@ -809,6 +1201,7 @@ gen_SOUND () #else handle_SOUND (0); #endif +return 0; } int @@ -819,6 +1212,7 @@ gen_SAK () #else handle_SAK (0); #endif +return 0; } int @@ -829,6 +1223,7 @@ gen_PRIO () #else handle_PRIO (0); #endif +return 0; } int @@ -839,6 +1234,7 @@ gen_33 () #else handle_33 (0); #endif +return 0; } int @@ -849,6 +1245,7 @@ gen_34 () #else handle_34 (0); #endif +return 0; } int @@ -859,6 +1256,7 @@ gen_35 () #else handle_35 (0); #endif +return 0; } int @@ -869,6 +1267,7 @@ gen_36 () #else handle_36 (0); #endif +return 0; } int @@ -879,6 +1278,7 @@ gen_37 () #else handle_37 (0); #endif +return 0; } int @@ -889,6 +1289,7 @@ gen_38 () #else handle_38 (0); #endif +return 0; } int @@ -899,6 +1300,7 @@ gen_39 () #else handle_39 (0); #endif +return 0; } int @@ -909,6 +1311,7 @@ gen_40 () #else handle_40 (0); #endif +return 0; } int @@ -919,6 +1322,7 @@ gen_41 () #else handle_41 (0); #endif +return 0; } int @@ -929,6 +1333,7 @@ gen_42 () #else handle_42 (0); #endif +return 0; } int @@ -939,6 +1344,7 @@ gen_43 () #else handle_43 (0); #endif +return 0; } int @@ -949,6 +1355,7 @@ gen_44 () #else handle_44 (0); #endif +return 0; } int @@ -959,6 +1366,7 @@ gen_45 () #else handle_45 (0); #endif +return 0; } int @@ -969,6 +1377,7 @@ gen_46 () #else handle_46 (0); #endif +return 0; } int @@ -979,6 +1388,7 @@ gen_47 () #else handle_47 (0); #endif +return 0; } int @@ -989,6 +1399,7 @@ gen_48 () #else handle_48 (0); #endif +return 0; } int @@ -999,6 +1410,7 @@ gen_49 () #else handle_49 (0); #endif +return 0; } int @@ -1009,6 +1421,7 @@ gen_50 () #else handle_50 (0); #endif +return 0; } int @@ -1019,6 +1432,7 @@ gen_51 () #else handle_51 (0); #endif +return 0; } int @@ -1029,6 +1443,7 @@ gen_52 () #else handle_52 (0); #endif +return 0; } int @@ -1039,6 +1454,7 @@ gen_53 () #else handle_53 (0); #endif +return 0; } int @@ -1049,6 +1465,7 @@ gen_54 () #else handle_54 (0); #endif +return 0; } int @@ -1059,6 +1476,7 @@ gen_55 () #else handle_55 (0); #endif +return 0; } int @@ -1069,6 +1487,7 @@ gen_56 () #else handle_56 (0); #endif +return 0; } int @@ -1079,6 +1498,7 @@ gen_57 () #else handle_57 (0); #endif +return 0; } int @@ -1089,6 +1509,7 @@ gen_58 () #else handle_58 (0); #endif +return 0; } int @@ -1099,6 +1520,7 @@ gen_59 () #else handle_59 (0); #endif +return 0; } int @@ -1109,6 +1531,7 @@ gen_60 () #else handle_60 (0); #endif +return 0; } int @@ -1119,6 +1542,7 @@ gen_61 () #else handle_61 (0); #endif +return 0; } int @@ -1129,6 +1553,7 @@ gen_62 () #else handle_62 (0); #endif +return 0; } int @@ -1139,12 +1564,14 @@ gen_63 () #else handle_63 (0); #endif +return 0; } int gen_TERM () { kill (getpid (), SIGTERM); +return 0; } int diff --git a/gdb/testsuite/gdb.base/signals.c b/gdb/testsuite/gdb.base/signals.c index 280e6e7..f1ebcfc 100644 --- a/gdb/testsuite/gdb.base/signals.c +++ b/gdb/testsuite/gdb.base/signals.c @@ -1,6 +1,7 @@ /* Test GDB dealing with stuff like stepping into sigtramp. */ #include <signal.h> +#include <unistd.h> #ifdef __sh__ #define signal(a,b) /* Signals not supported on this target - make them go away */ @@ -9,9 +10,14 @@ static int count = 0; +#ifdef PROTOTYPES +static void +handler (int sig) +#else static void handler (sig) int sig; +#endif { signal (sig, handler); ++count; diff --git a/gdb/testsuite/gdb.base/signals.exp b/gdb/testsuite/gdb.base/signals.exp index 16528f7..6511b2e 100644 --- a/gdb/testsuite/gdb.base/signals.exp +++ b/gdb/testsuite/gdb.base/signals.exp @@ -42,6 +42,12 @@ if [get_compiler_info ${binfile}] { return -1; } +if {$hp_cc_compiler} { + set void 0 +} else { + set void void +} + proc signal_tests_1 {} { global gdb_prompt if [runto_main] then { @@ -380,7 +386,7 @@ if [runto_main] then { # lose its cool, this is not a problem, it just has to note # that the breakpoint condition is false and keep going. - gdb_test "p func1 ()" "^p func1 \\(\\)\r\n.\[0-9\]* = void" \ + gdb_test "p func1 ()" "^p func1 \\(\\)\r\n.\[0-9\]* = $void" \ "p func1 () #1 in signals.exp" # Make sure the count got incremented. diff --git a/gdb/testsuite/gdb.base/so-impl-ld.c b/gdb/testsuite/gdb.base/so-impl-ld.c index a8fa189..9310bca 100644 --- a/gdb/testsuite/gdb.base/so-impl-ld.c +++ b/gdb/testsuite/gdb.base/so-impl-ld.c @@ -4,9 +4,13 @@ #include <stdio.h> -extern int solib_main (int); +#if defined(__cplusplus) || defined(__STDCPP__) +extern "C" int solib_main (int arg); +#else +int solib_main (int arg); +#endif -main () +int main () { int result; @@ -15,4 +19,5 @@ main () /* Call it again. */ result = solib_main (result); + return 0; } diff --git a/gdb/testsuite/gdb.base/so-impl-ld.exp b/gdb/testsuite/gdb.base/so-impl-ld.exp index a52aa1f..beb2a6a 100644 --- a/gdb/testsuite/gdb.base/so-impl-ld.exp +++ b/gdb/testsuite/gdb.base/so-impl-ld.exp @@ -68,28 +68,23 @@ if {[gdb_compile "${srcdir}/${subdir}/${libfile}1.c" "${libfile}1.o" object [lis } if [istarget "hppa*-hp-hpux*"] then { - remote_exec build "ld -b ${libfile}1.o -o ${libfile}1.sl" + remote_exec build "ld -b ${libfile}1.o -o ${objdir}/${subdir}/${libfile}1.sl" } else { set additional_flags "additional_flags=-shared" - gdb_compile "${libfile}1.o" "${libfile}1.sl" executable [list debug $additional_flags] + gdb_compile "${libfile}1.o" "${objdir}/${subdir}/${libfile}1.sl" executable [list debug $additional_flags] } # Build the test case #remote_exec build "$CC -Aa -g ${srcfile} ${libfile}1.sl -o ${binfile}" -if {$gcc_compiled == 0} { - if [istarget "hppa*-hp-hpux*"] then { - set additional_flags "additional_flags=-Ae" - } else { - # don't know what the compiler is, hope for the best, maybe it's ANSI... - set additional_flags "" - } +if {$hp_cc_compiler} { + set additional_flags "additional_flags=-Ae" } else { set additional_flags "" } -if {[gdb_compile "${srcdir}/${subdir}/${srcfile} ${libfile}1.sl" "${binfile}" executable [list debug $additional_flags]] != ""} { +if {[gdb_compile "${srcdir}/${subdir}/${srcfile} ${objdir}/${subdir}/${libfile}1.sl" "${binfile}" executable [list debug $additional_flags]] != ""} { perror "Couldn't build ${binfile}" return -1 } @@ -110,7 +105,7 @@ if ![runto_main] then { fail "implicit solibs tests suppressed" } # send_gdb "next\n" gdb_expect { - -re "17\[ \t\]*result = solib_main .result.*$gdb_prompt $"\ + -re "21\[ \t\]*result = solib_main .result.*$gdb_prompt $"\ {pass "step over solib call"} -re "$gdb_prompt $"\ {fail "step over solib call"} @@ -121,7 +116,7 @@ gdb_expect { # send_gdb "step\n" gdb_expect { - -re "solib_main .arg=10000. at.*${libfile}1.c:8.*$gdb_prompt $"\ + -re "solib_main .arg=10000. at.*${libfile}1.c:17.*$gdb_prompt $"\ {pass "step into solib call"} -re "$gdb_prompt $"\ {fail "step into solib call"} @@ -132,7 +127,7 @@ gdb_expect { # send_gdb "next\n" gdb_expect { - -re "9\[ \t\]*\}.*$gdb_prompt $"\ + -re "18\[ \t\]*\}.*$gdb_prompt $"\ {pass "step in solib call"} -re "$gdb_prompt $"\ {fail "step in solib call"} @@ -148,7 +143,7 @@ gdb_expect { # we haven't left the callee yet, so do another next send_gdb "next\n" gdb_expect { - -re "main .. at.*so-impl-ld.c:18.*$gdb_prompt $"\ + -re "main .. at.*so-impl-ld.c:22.*$gdb_prompt $"\ {pass "step out of solib call"} -re "$gdb_prompt $"\ {fail "step out of solib call"} @@ -156,7 +151,7 @@ gdb_expect { } } - -re "main .. at.*so-impl-ld.c:18.*$gdb_prompt $"\ + -re "main .. at.*so-impl-ld.c:22.*$gdb_prompt $"\ {pass "step out of solib call"} -re "$gdb_prompt $"\ {fail "step out of solib call"} diff --git a/gdb/testsuite/gdb.base/so-indr-cl.c b/gdb/testsuite/gdb.base/so-indr-cl.c index dc29bad..f31800d 100644 --- a/gdb/testsuite/gdb.base/so-indr-cl.c +++ b/gdb/testsuite/gdb.base/so-indr-cl.c @@ -3,21 +3,28 @@ */ #include <stdio.h> +#ifdef PROTOTYPES +extern "C" int solib_main (int); +static int +solib_wrapper (int (*function)(int)) +#else extern int solib_main (int); static int solib_wrapper (function) int (*function)(int); +#endif { return (*function)(100); } -main () +int main () { int result; /* This is an indirect call to solib_main. */ result = solib_wrapper (solib_main); + return 0; } diff --git a/gdb/testsuite/gdb.base/so-indr-cl.exp b/gdb/testsuite/gdb.base/so-indr-cl.exp index e37878e..6847289 100644 --- a/gdb/testsuite/gdb.base/so-indr-cl.exp +++ b/gdb/testsuite/gdb.base/so-indr-cl.exp @@ -51,13 +51,8 @@ if [get_compiler_info ${binfile}] { #remote_exec build "$CC -g +z -c ${libfile}1.c -o ${libfile}1.o" -if {$gcc_compiled == 0} { - if [istarget "hppa*-hp-hpux*"] then { - set additional_flags "additional_flags=+z" - } else { - # don't know what the compiler is... - set additional_flags "" - } +if {$hp_cc_compiler || $hp_aCC_compiler} { + set additional_flags "additional_flags=+z" } else { set additional_flags "additional_flags=-fpic" } @@ -77,13 +72,8 @@ if [istarget "hppa*-hp-hpux*"] then { #remote_exec build "$CC -Aa -g ${srcfile} ${libfile}1.sl -o ${binfile}" -if {$gcc_compiled == 0} { - if [istarget "hppa*-hp-hpux*"] then { - set additional_flags "additional_flags=-Ae" - } else { - # don't know what the compiler is, hope for the best, maybe it's ANSI... - set additional_flags "" - } +if {$hp_cc_compiler} { + set additional_flags "additional_flags=-Ae" } else { set additional_flags "" } @@ -119,6 +109,8 @@ send_gdb "break solib_main\n" gdb_expect { -re "Cannot break on solib_main without a running program.*$gdb_prompt $"\ {pass "break on indirect solib call before running"} + -re "Breakpoint.*deferred.*\\(\"solib_main\" was not found.*$gdb_prompt $"\ + {pass "break on indirect solib call before running 2"} -re "$gdb_prompt $"\ {fail "break on indirect solib call before running"} timeout {fail "(timeout) break on indirect solib call before running"} diff --git a/gdb/testsuite/gdb.base/solib.c b/gdb/testsuite/gdb.base/solib.c index ff9d359..6fb9f5e 100644 --- a/gdb/testsuite/gdb.base/solib.c +++ b/gdb/testsuite/gdb.base/solib.c @@ -7,12 +7,12 @@ #include <stdio.h> #include <dl.h> -main () +int main () { shl_t solib_handle; int dummy; int status; - int (*solib_main) (); + int (*solib_main) (int); /* Load a shlib, with immediate binding of all symbols. @@ -56,4 +56,5 @@ main () /* All done. */ dummy = -1; + return 0; } diff --git a/gdb/testsuite/gdb.base/solib.exp b/gdb/testsuite/gdb.base/solib.exp index f452194..5e25b68 100644 --- a/gdb/testsuite/gdb.base/solib.exp +++ b/gdb/testsuite/gdb.base/solib.exp @@ -86,6 +86,31 @@ if [istarget "hppa*-*-hpux*"] { gdb_compile "${binfile}1.o" "${binfile}1.sl" executable [list debug $additional_flags] gdb_compile "${binfile}2.o" "${binfile}2.sl" executable [list debug $additional_flags] } + +# Build a version where the main program is in a shared library. For +# testing an indirect call made in a shared library. + +if {[gdb_compile "${srcdir}/${subdir}/${testfile}.c" "${binfile}_sl.o" object [list debug $additional_flags]] != ""} { + perror "Couldn't compile ${testfile}.c for ${binfile}_sl.o" + #return -1 +} + +if { [istarget "hppa*-*-hpux*"] } { + remote_exec build "ld -b ${binfile}_sl.o -o ${binfile}_sl.sl" +} else { + set additional_flags "additional_flags=-shared" + gdb_compile "${binfile}_sl.o" "${binfile}_sl.sl" executable [list debug $additional_flags] +} + +if { [istarget "hppa*-*-hpux*"] } { + set additional_flags "-Wl,-u,main" + if { [gdb_compile "${binfile}_sl.sl" "${binfile}_sl" executable [list debug $additional_flags]] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." + } +} else { + # FIXME: need to fill this part in for non-HP build +} + #cd .. # Start with a fresh gdb @@ -316,4 +341,20 @@ gdb_expect { # gdb_exit + +# +# Test stepping into an indirect call in a shared library. +# + +gdb_start +gdb_load ${binfile}_sl +gdb_test "break main" ".*deferred. at .main..*" "break on main" +gdb_test "run" ".*Breakpoint.*main.*solib.c.*" "hit breakpoint at main" +gdb_test "break 45" "Breakpoint.*solib.c, line 45.*" "break on indirect call" +gdb_test "continue" "Continuing.*solib.c:45.*" \ + "continue to break on indirect call" +gdb_test "step" "solib_main.*solib1.c:17.*return arg.arg.*" \ + "step into indirect call from a shared library" +gdb_exit + return 0 diff --git a/gdb/testsuite/gdb.base/solib1.c b/gdb/testsuite/gdb.base/solib1.c index eecf024..2e51750 100644 --- a/gdb/testsuite/gdb.base/solib1.c +++ b/gdb/testsuite/gdb.base/solib1.c @@ -2,8 +2,17 @@ library, for use by the solib.exp testcase. It simply returns the square of its integer argument. */ +#if defined(__cplusplus) || defined(__STDCPP__) +extern "C" int +solib_main (int arg) +#else +#ifdef PROTOTYPES +int solib_main (int arg) +#else int solib_main (arg) int arg; +#endif +#endif { return arg*arg; } diff --git a/gdb/testsuite/gdb.base/solib2.c b/gdb/testsuite/gdb.base/solib2.c index 2cd4513..8c69d8b 100644 --- a/gdb/testsuite/gdb.base/solib2.c +++ b/gdb/testsuite/gdb.base/solib2.c @@ -2,8 +2,18 @@ library, for use by the solib.exp testcase. It simply returns the cube of its integer argument. */ +#ifdef __cplusplus +extern "C" { +#endif +#ifdef PROTOTYPES +int solib_main (int arg) +#else int solib_main (arg) int arg; +#endif { return arg*arg*arg; } +#ifdef __cplusplus +} +#endif diff --git a/gdb/testsuite/gdb.base/step-test.c b/gdb/testsuite/gdb.base/step-test.c index 7130725..a1e1dc4 100644 --- a/gdb/testsuite/gdb.base/step-test.c +++ b/gdb/testsuite/gdb.base/step-test.c @@ -1,9 +1,12 @@ +#include <stdlib.h> +#include <string.h> + /* Test various kinds of stepping. */ -int glob = 0; +int myglob = 0; int callee() { - glob++; + myglob++; return 0; } /* A structure which, we hope, will need to be passed using memcpy. */ @@ -14,7 +17,7 @@ struct rhomboidal { void large_struct_by_value (struct rhomboidal r) { - glob += r.rather_large[42]; /* step-test.exp: arrive here 1 */ + myglob += r.rather_large[42]; /* step-test.exp: arrive here 1 */ } int main () { diff --git a/gdb/testsuite/gdb.base/step-test.exp b/gdb/testsuite/gdb.base/step-test.exp index 85744d7..6eeda0b 100644 --- a/gdb/testsuite/gdb.base/step-test.exp +++ b/gdb/testsuite/gdb.base/step-test.exp @@ -66,7 +66,7 @@ gdb_test "next" ".*${decimal}.*callee.*INTO.*" "next over" # Step into call # -gdb_test "step" ".*${decimal}.*glob.*" "step into" +gdb_test "step" ".*${decimal}.*myglob.*" "step into" # Step out of call # @@ -74,7 +74,18 @@ gdb_test "step" ".*${decimal}.*glob.*" "step into" # platforms, on which `finish' will return you to some kind of pop # instruction, which is attributed to the line containing the function # call? -gdb_test "finish" ".*${decimal}.*a.*5.*= a.*3.*" "step out" + +# On PA64 we end up at a different instruction than PA32 +if { [istarget "hppa2.0w-hp-hpux*"] } { + 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" } + } +} else { + gdb_test "finish" ".*${decimal}.*a.*5.*= a.*3.*" "step out" +} ### Testing nexti and stepi. ### @@ -154,6 +165,16 @@ gdb_expect { puts "*** Matched success..." pass "stepi: finish call" } + -re ".*${decimal}.*callee.*STEPI.*$gdb_prompt $" { + # On PA64 we end up at a different instruction than PA32 + if { [istarget "hppa2.0w-hp-hpux*"] } { + puts "*** Matched success..." + pass "stepi: finish call 2" + } else { + fail "stepi: finish call 2" + return + } + } -re "$gdb_prompt $" { # We got something else. Fail. fail "stepi: finish call" diff --git a/gdb/testsuite/gdb.base/term.exp b/gdb/testsuite/gdb.base/term.exp index 211a94c..26c1032 100644 --- a/gdb/testsuite/gdb.base/term.exp +++ b/gdb/testsuite/gdb.base/term.exp @@ -43,6 +43,8 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } +gdb_exit +gdb_start delete_breakpoints gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} diff --git a/gdb/testsuite/gdb.base/twice.c b/gdb/testsuite/gdb.base/twice.c index c50a2b3..09eb2dd 100644 --- a/gdb/testsuite/gdb.base/twice.c +++ b/gdb/testsuite/gdb.base/twice.c @@ -1,3 +1,4 @@ +#include <stdio.h> int nothing () { @@ -6,7 +7,7 @@ int nothing () } -main () +int main () { int y ; @@ -16,4 +17,5 @@ main () #endif y = nothing () ; printf ("hello\n") ; + return 0; } diff --git a/gdb/testsuite/gdb.base/twice.exp b/gdb/testsuite/gdb.base/twice.exp index 8d8c403..4c96b36 100644 --- a/gdb/testsuite/gdb.base/twice.exp +++ b/gdb/testsuite/gdb.base/twice.exp @@ -60,4 +60,5 @@ if [runto_main] then { gdb_test "step" "nothing \\(\\) at.*" } +remote_exec build "rm -f twice.c" return 0 diff --git a/gdb/testsuite/gdb.base/varargs.c b/gdb/testsuite/gdb.base/varargs.c index 729d7df..6664253 100644 --- a/gdb/testsuite/gdb.base/varargs.c +++ b/gdb/testsuite/gdb.base/varargs.c @@ -18,11 +18,12 @@ short s; unsigned short us; int a,b,c,d; int max_val; +long long ll; float fa,fb,fc,fd; double da,db,dc,dd; double dmax_val; -main() { +int main() { c = -1; uc = 1; s = -2; @@ -43,6 +44,8 @@ main() { dd = 2.0; dmax_val = find_max_double(3, 1.0, 4.0, 2.0); dmax_val = find_max_double(a, db, dc, dd); + + return 0; } /* Integer varargs, 1 declared arg */ diff --git a/gdb/testsuite/gdb.base/varargs.exp b/gdb/testsuite/gdb.base/varargs.exp index 72fd2f5..2fb8f3b 100644 --- a/gdb/testsuite/gdb.base/varargs.exp +++ b/gdb/testsuite/gdb.base/varargs.exp @@ -48,23 +48,14 @@ if [get_compiler_info ${binfile}] { return -1 } -if {$gcc_compiled == 0} { - if [istarget "hppa*-hp-hpux*"] then { - set additional_flags "additional_flags=-Ae" - } else { - # don't know what the compiler is, hope for the best, maybe it's ANSI... - set additional_flags "" - } +if {$hp_cc_compiler} { + set additional_flags "additional_flags=-Ae" } else { set additional_flags "" } # build the first test case -#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." -#} - -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug $additional_flags]] != "" } { +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug ${additional_flags}}] != "" } { gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } @@ -84,6 +75,18 @@ if ![runto_main] then { continue } +if { $hp_aCC_compiler } { + # When compiled w/ aCC we need to disable overload resolution + # for command line calls. + # We need it for vararg calls since the aCC compiler gives us no + # information about the undeclared arguments, or even that there + # _are_ undeclared arguments. As far as gdb is concerned it only + # knows about the declared arguments. So we need to force the call + # even though the overload resolution mechanism says that the types + # don't match. + # - guo + gdb_test "set overload-resolution 0" "" +} send_gdb "print find_max1(5,1,2,3,4,5)\n" gdb_expect { diff --git a/gdb/testsuite/gdb.base/volatile.exp b/gdb/testsuite/gdb.base/volatile.exp index a2a2b59..7796ed5 100644 --- a/gdb/testsuite/gdb.base/volatile.exp +++ b/gdb/testsuite/gdb.base/volatile.exp @@ -49,7 +49,13 @@ set testfile "constvars" set srcfile ${testfile}.c set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { +if [istarget "hppa*-*-*"] { + set lang "c++" +} else { + set lang "" +} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [concat debug $lang]] != "" } { gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." } @@ -100,142 +106,142 @@ send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $" # these tests are all expected to fail if GCC is the compiler. -sts if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype vox" "type = volatile char" +gdb_test "ptype vox" "type = volatile char.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype victuals" "type = volatile unsigned char" +gdb_test "ptype victuals" "type = volatile unsigned char.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype vixen" "type = volatile short" +gdb_test "ptype vixen" "type = volatile short.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype vitriol" "type = volatile unsigned short" +gdb_test "ptype vitriol" "type = volatile unsigned short.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype vellum" "type = volatile long" +gdb_test "ptype vellum" "type = volatile long.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype valve" "type = volatile unsigned long" +gdb_test "ptype valve" "type = volatile unsigned long.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype vacuity" "type = volatile float" +gdb_test "ptype vacuity" "type = volatile float.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype vertigo" "type = volatile double" +gdb_test "ptype vertigo" "type = volatile double.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype vampire" "type = volatile char *" +gdb_test "ptype vampire" "type = volatile char \\*.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype viper" "type = volatile unsigned char *" +gdb_test "ptype viper" "type = volatile unsigned char \\*.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype vigour" "type = volatile short *" +gdb_test "ptype vigour" "type = volatile short \\*.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype vapour" "type = volatile unsigned short *" +gdb_test "ptype vapour" "type = volatile unsigned short \\*.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype ventricle" "type = volatile long *" +gdb_test "ptype ventricle" "type = volatile long \\*.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype vigintillion" "type = volatile unsigned long *" +gdb_test "ptype vigintillion" "type = volatile unsigned long \\*.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype vocation" "type = volatile float *" +gdb_test "ptype vocation" "type = volatile float \\*.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype veracity" "type = volatile double *" +gdb_test "ptype veracity" "type = volatile double \\*.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype vapidity" "type = volatile char * volatile" +gdb_test "ptype vapidity" "type = volatile char \\* volatile.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype velocity" "type = volatile unsigned char * volatile" +gdb_test "ptype velocity" "type = volatile unsigned char \\* volatile.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype veneer" "type = volatile short * volatile" +gdb_test "ptype veneer" "type = volatile short \\* volatile.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype video" "type = volatile unsigned short * volatile" +gdb_test "ptype video" "type = volatile unsigned short \\* volatile.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype vacuum" "type = volatile long * volatile" +gdb_test "ptype vacuum" "type = volatile long \\* volatile.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype veniality" "type = volatile unsigned long * volatile" +gdb_test "ptype veniality" "type = volatile unsigned long \\* volatile.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype vitality" "type = volatile float * volatile" +gdb_test "ptype vitality" "type = volatile float \\* volatile.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype voracity" "type = volatile double * volatile" +gdb_test "ptype voracity" "type = volatile double \\* volatile.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype victor" "type = const volatile char" +gdb_test "ptype victor" "type = const volatile char.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype vicar" "type = const volatile unsigned char" +gdb_test "ptype vicar" "type = const volatile unsigned char.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype victory" "type = const volatile char *" +gdb_test "ptype victory" "type = const volatile char \\*.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype vicarage" "type = const volatile unsigned char *" +gdb_test "ptype vicarage" "type = const volatile unsigned char \\*.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype vein" "type = volatile char * const" +gdb_test "ptype vein" "type = volatile char \\* const.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype vogue" "type = volatile unsigned char * const" +gdb_test "ptype vogue" "type = volatile unsigned char \\* const.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype cavern" "type = const volatile char * const" +gdb_test "ptype cavern" "type = const volatile char \\* const.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype coverlet" "type = const volatile unsigned char * const" +gdb_test "ptype coverlet" "type = const volatile unsigned char \\* const.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype caveat" "type = const char * volatile" +gdb_test "ptype caveat" "type = const char \\* volatile.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype covenant" "type = const unsigned char * volatile" +gdb_test "ptype covenant" "type = const unsigned char \\* volatile.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype vizier" "type = const volatile char * volatile" +gdb_test "ptype vizier" "type = const volatile char \\* volatile.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype vanadium" "type = const volatile unsigned char * volatile" +gdb_test "ptype vanadium" "type = const volatile unsigned char \\* volatile.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype vane" "type = char * const volatile" +gdb_test "ptype vane" "type = char \\* const volatile.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype veldt" "type = unsigned char * const volatile" +gdb_test "ptype veldt" "type = unsigned char \\* const volatile.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype cove" "type = const char * const volatile" +gdb_test "ptype cove" "type = const char \\* const volatile.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype cavity" "type = const unsigned char * const volatile" +gdb_test "ptype cavity" "type = const unsigned char \\* const volatile.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype vagus" "type = volatile char * const volatile" +gdb_test "ptype vagus" "type = volatile char \\* const volatile.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype vagrancy" "type = volatile unsigned char * const volatile" +gdb_test "ptype vagrancy" "type = volatile unsigned char \\* const volatile.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype vagary" "type = const volatile char * const volatile" +gdb_test "ptype vagary" "type = const volatile char \\* const volatile.*" if {$gcc_compiled} then { setup_xfail "*-*-*" } -gdb_test "ptype vendor" "type = const volatile unsigned char * const volatile" +gdb_test "ptype vendor" "type = const volatile unsigned char \\* const volatile.*" # test function parameters if {$gcc_compiled} then { setup_xfail "*-*-*" } send_gdb "ptype qux2\n" gdb_expect { - -re "type = int \\(volatile unsigned char, const volatile int, volatile short &, volatile long \\*, float \\* volatile, const volatile signed char \\* const volatile\\)" { + -re "type = int \\(volatile unsigned char, const volatile int, volatile short, volatile long \\*, float \\* volatile, const volatile signed char \\* const volatile\\).*$gdb_prompt $" { pass "ptype qux2" } -re ".*$gdb_prompt $" { fail "ptype qux2" } diff --git a/gdb/testsuite/gdb.base/watchpoint.c b/gdb/testsuite/gdb.base/watchpoint.c index bd54f3e..14ccecd 100644 --- a/gdb/testsuite/gdb.base/watchpoint.c +++ b/gdb/testsuite/gdb.base/watchpoint.c @@ -1,4 +1,5 @@ #include <stdio.h> +#include <unistd.h> /* * Since using watchpoints can be very slow, we have to take some pains to * ensure that we don't run too long with them enabled or we run the risk @@ -28,6 +29,7 @@ int ival1 = -1; int ival2 = -1; int ival3 = -1; int ival4 = -1; +int ival5 = -1; char buf[10]; struct foo { @@ -53,9 +55,32 @@ void marker5 () { } +void marker6 () +{ +} + +#ifdef PROTOTYPES +void recurser (int x) +#else +void recurser (x) int x; +#endif +{ + int local_x; + + if (x > 0) + recurser (x-1); + local_x = x; +} + void func2 () { + int local_a; + static int static_b; + + ival5++; + local_a = ival5; + static_b = local_a; } int @@ -120,5 +145,30 @@ int main () are not evaluating the watchpoint expression correctly. */ struct1.val = 5; marker5 (); + + /* We're going to watch locals of func2, to see that out-of-scope + watchpoints are detected and properly deleted. + */ + marker6 (); + + /* This invocation is used for watches of a single + local variable. */ + func2 (); + + /* This invocation is used for watches of an expression + involving a local variable. */ + func2 (); + + /* This invocation is used for watches of a static + (non-stack-based) local variable. */ + func2 (); + + /* This invocation is used for watches of a local variable + when recursion happens. + */ + marker6 (); + recurser (2); + + marker6 (); return 0; } diff --git a/gdb/testsuite/gdb.base/watchpoint.exp b/gdb/testsuite/gdb.base/watchpoint.exp index 53f2e8b..7dced3b 100644 --- a/gdb/testsuite/gdb.base/watchpoint.exp +++ b/gdb/testsuite/gdb.base/watchpoint.exp @@ -30,20 +30,12 @@ set testfile "watchpoint" set srcfile ${testfile}.c set binfile ${objdir}/${subdir}/${testfile} +set wp_set 1 if [get_compiler_info ${binfile}] { return -1 } -# if we are on HPUX and we are not compiled with gcc, then skip these tests. - -if [istarget hppa*-*-hpux*] { - if {!$gcc_compiled} { - continue - } -} - - 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." } @@ -69,6 +61,7 @@ proc initialize {} { global hex global decimal global srcfile + global wp_set if [gdb_test "break marker1" "Breakpoint 1 at $hex: file .*$srcfile, line $decimal.*" "set breakpoint at marker1" ] { return 0; @@ -85,11 +78,27 @@ proc initialize {} { } - if [gdb_test "watch ival3" ".*\[Ww\]atchpoint 3: ival3" "set watchpoint on ival3" ] { - return 0; + # ??rehrauer: To fix DTS #CHFts23014, in which setting a watchpoint + # before running can cause the inferior to croak on HP-UX 10.30 and + # 11.0 for reasons as yet unknown, we've disabled the ability to set + # watches without a running inferior. Verify the restriction. + # + send_gdb "watch ival3\n" + gdb_expect { + -re ".*\[Ww\]atchpoint 3: ival3.*$gdb_prompt $" { + pass "set watchpoint on ival3" + } + -re "warning: can't do that without a running program; try \"break main\", \"run\" first.*$gdb_prompt $" { + pass "set watchpoint on ival3" + set wp_set 0 + return 1 + } + timeout { + fail "(timeout) set watchpoint on ival3" + return 0 + } } - # "info watch" is the same as "info break" if [gdb_test "info watch" "1\[ \]*breakpoint.*marker1.*\r\n2\[ \]*breakpoint.*marker2.*\r\n3\[ \]*.*watchpoint.*ival3" "watchpoint found in watchpoint/breakpoint table" ] { @@ -117,11 +126,14 @@ proc test_simple_watchpoint {} { global gdb_prompt global hex global decimal + global wp_set # Ensure that the watchpoint is disabled when we startup. - if [gdb_test "disable 3" "^disable 3\[\r\n\]+" "disable watchpoint in test_simple_watchpoint" ] { - return 0; + if { $wp_set } { + if [gdb_test "disable 3" "^disable 3\[\r\n\]+" "disable watchpoint in test_simple_watchpoint" ] { + return 0; + } } @@ -143,6 +155,51 @@ proc test_simple_watchpoint {} { } } + if { !$wp_set } { + # ??rehrauer: To fix DTS #CHFts23014, in which setting a watchpoint + # before running can cause the inferior to croak on HP-UX 10.30 and + # 11.0 for reasons as yet unknown, we've disabled the ability to set + # watches without a running inferior. The following testpoints used + # to be in [initialize]. + # + send_gdb "watch ival3\n" + gdb_expect { + -re ".*\[Ww\]atchpoint 3: ival3\r\n$gdb_prompt $" { + pass "set watchpoint on ival3" + } + -re ".*$gdb_prompt $" { fail "set watchpoint on ival3" } + timeout { fail "set watchpoint on ival3 (timeout)" } + } + + set wp_set 1 + + # "info watch" is the same as "info break" + + send_gdb "info watch\n" + gdb_expect { + -re "1\[ \]*breakpoint.*marker1.*\r\n2\[ \]*breakpoint.*marker2.*\r\n3\[ \]*.*watchpoint.*ival3\r\n$gdb_prompt $" { + pass "watchpoint found in watchpoint/breakpoint table" + } + -re ".*$gdb_prompt $" { + fail "watchpoint found in watchpoint/breakpoint table" + } + timeout { + fail "watchpoint found in watchpoint/breakpoint table" + } + } + + # After installing the watchpoint, we disable it until we are ready + # to use it. This allows the test program to run at full speed until + # we get to the first marker function. + + send_gdb "disable 3\n" + gdb_expect { + -re "disable 3\[\r\n\]+$gdb_prompt $" { pass "disable watchpoint" } + -re ".*$gdb_prompt $" { fail "disable watchpoint" } + timeout { fail "disable watchpoint (timeout)" } + } + } + # After reaching the marker function, enable the watchpoint. if [gdb_test "enable 3" "^enable 3\[\r\n\]+" "enable watchpoint" ] { @@ -221,6 +278,9 @@ proc test_disabling_watchpoints {} { global decimal global hex + # "info watch" is the same as "info break" + gdb_test "info watch" "\[0-9\]+\[ \]*breakpoint.*marker1.*\r\n\[0-9\]+\[ \]*breakpoint.*marker2.*\r\n\[0-9]+\[ \]*.*watchpoint.*ival3\r\n\.*\[0-9\]+ times.*" "watchpoints found in watchpoint/breakpoint table" + # Ensure that the watchpoint is disabled when we startup. if [gdb_test "disable 3" "^disable 3\[\r\n\]+" "disable watchpoint in test_disabling_watchpoints" ] { @@ -270,7 +330,7 @@ proc test_disabling_watchpoints {} { # Check watchpoint list, looking for the entry that confirms the # watchpoint is disabled. - gdb_test "info watchpoints" "3\[ \]*.*watchpoint\[ \]*keep\[ \]*n\[ \]*ival3\r\n.*" "watchpoint disabled in table" + gdb_test "info watchpoints" "\[0-9]+\[ \]*.*watchpoint\[ \]*keep\[ \]*n\[ \]*ival3\r\n.*" "watchpoint disabled in table" # Continue until we hit the finishing marker function. # Make sure we hit no more watchpoints. @@ -293,35 +353,30 @@ proc test_stepping {} { gdb_test "break func2 if 0" "Breakpoint.*at.*" gdb_test "p \$func2_breakpoint_number = \$bpnum" " = .*" - # The HPPA has a problem here if it's not using hardware watchpoints - if {[ istarget "hppa*-*-*" ] && ![ istarget "hppa*-*-*bsd*" ]} then { - # Don't actually try doing the call, if we do we can't continue. - setup_xfail "*-*-*" - fail "calling function with watchpoint enabled" - } else { - # The problem is that GDB confuses stepping through the call - # dummy with hitting the breakpoint at the end of the call dummy. - # Will be fixed once all architectures define - # CALL_DUMMY_BREAKPOINT_OFFSET. - setup_xfail "*-*-*" - # This doesn't occur if the call dummy starts with a call, - # because we are out of the dummy by the first time the inferior - # stops. - clear_xfail "d10v*-*-*" - clear_xfail "m68*-*-*" - clear_xfail "i*86*-*-*" - clear_xfail "vax-*-*" - # The following architectures define CALL_DUMMY_BREAKPOINT_OFFSET. - clear_xfail "alpha-*-*" - clear_xfail "mips*-*-*" - clear_xfail "sparc-*-*" - clear_xfail "hppa*-*-*bsd*" - # It works with the generic inferior function calling code too. - clear_xfail "mn10200*-*-*" - clear_xfail "mn10300*-*-*" - gdb_test "p func1 ()" "= 73" \ - "calling function with watchpoint enabled" - } + # The problem is that GDB confuses stepping through the call + # dummy with hitting the breakpoint at the end of the call dummy. + # Will be fixed once all architectures define + # CALL_DUMMY_BREAKPOINT_OFFSET. + setup_xfail "*-*-*" + # This doesn't occur if the call dummy starts with a call, + # because we are out of the dummy by the first time the inferior + # stops. + clear_xfail "d10v*-*-*" + clear_xfail "m68*-*-*" + clear_xfail "i*86*-*-*" + clear_xfail "vax-*-*" + # The following architectures define CALL_DUMMY_BREAKPOINT_OFFSET. + clear_xfail "alpha-*-*" + clear_xfail "mips*-*-*" + clear_xfail "sparc-*-*" + clear_xfail "hppa*-*-*bsd*" + # It works with the generic inferior function calling code too. + clear_xfail "mn10200*-*-*" + clear_xfail "mn10300*-*-*" + # The following architectures define CALL_DUMMY_HAS_COMPLETED. + clear_xfail "hppa*-*-*hpux*" + gdb_test "p func1 ()" "= 73" \ + "calling function with watchpoint enabled" # # "finish" brings us back to main. @@ -495,18 +550,82 @@ proc test_complex_watchpoint {} { gdb_test "cont" "Continuing.*Breakpoint.*marker5 \\(\\).*" \ "did not trigger wrong watchpoint" + # Test watches of things declared locally in a function. + # In particular, test that a watch of stack-based things + # is deleted when the stack-based things go out of scope. + # + gdb_test "disable" "" "disable in test_complex_watchpoint" + gdb_test "break marker6" ".*Breakpoint.*" + gdb_test "cont" "Continuing.*Breakpoint.*marker6 \\(\\).*" \ + "continue to marker6" + gdb_test "break func2" ".*Breakpoint.*" + gdb_test "cont" "Continuing.*func2.*" + + # Test a watch of a single stack-based variable, whose scope + # is the function we're now in. This should auto-delete when + # execution exits the scope of the watchpoint. + # + gdb_test "watch local_a" ".*\[Ww\]atchpoint \[0-9\]*: local_a" "set local watch" + gdb_test "cont" "\[Ww\]atchpoint.*local_a.*" "trigger local watch" + gdb_test "cont" "Continuing.*\[Ww\]atchpoint .* deleted because the program has left the block in.*which its expression is valid.*" "self-delete local watch" + + gdb_test "cont" "Continuing.*func2.*" + # We should be in "func2" again now. Test a watch of an + # expression which includes both a stack-based local and + # something whose scope is larger than this invocation + # of "func2". This should also auto-delete. + # + gdb_test "watch local_a + ival5" ".*\[Ww\]atchpoint \[0-9\]*: local_a . ival5" \ + "set partially local watch" + gdb_test "cont" "Continuing.*\[Ww\]atchpoint .*: local_a . ival5.*" \ + "trigger1 partially local watch" + gdb_test "cont" "Continuing.*\[Ww\]atchpoint .*: local_a . ival5.*" \ + "trigger2 partially local watch" + gdb_test "cont" "Continuing.*\[Ww\]atchpoint .* deleted because the program has left the block in.*which its expression is valid.*" \ + "self-delete partially local watch" + + # We should be in "func2" again now. Test a watch of a + # static (non-stack-based) local. Since this has scope + # across any invocations of "func2", it should not auto- + # delete. + # + gdb_test "cont" "Continuing.*func2.*" + gdb_test "watch static_b" ".*\[Ww\]atchpoint \[0-9\]*: static_b" \ + "set static local watch" + gdb_test "cont" "Continuing.*\[Ww\]atchpoint .*: static_b.*" \ + "trigger static local watch" + gdb_test "cont" "Continuing.*marker6 \\(\\).*" \ + "continue after trigger static local watch" + gdb_test "info break" ".*watchpoint.*static_b.*" \ + "static local watch did not self-delete" + + # We should be in "recurser" now. Test a watch of a stack- + # based local. Symbols mentioned in a watchpoint are bound + # at watchpoint-creation. Thus, a watch of a stack-based + # local to a recursing function should be bound only to that + # one invocation, and should not trigger for other invocations. + # + gdb_test "tbreak recurser" ".*Breakpoint.*" + gdb_test "cont" "Continuing.*recurser.*" + gdb_test "watch local_x" ".*\[Ww\]atchpoint \[0-9\]*: local_x" \ + "set local watch in recursive call" + gdb_test "cont" "Continuing.*\[Ww\]atchpoint .*: local_x.*New value = 2.*" \ + "trigger local watch in recursive call" + gdb_test "cont" "Continuing.*\[Ww\]atchpoint .* deleted because the program has left the block in.*which its expression is valid.*" \ + "self-delete local watch in recursive call" + # Disable everything so we can finish the program at full speed gdb_test "disable" "" "disable in test_complex_watchpoint" if [target_info exists gdb,noresults] { return } - - gdb_continue_to_end "continue to exit in test_complex_watchpoint" + gdb_continue_to_end "continue to exit in test_complex_watchpoint" } } # Start with a fresh gdb. +gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_load $binfile @@ -576,4 +695,82 @@ if [initialize] then { [istarget "m32r-*-*"]} then { test_complex_watchpoint } + + # Verify that a user can force GDB to use "slow" watchpoints. + # (This proves rather little on kernels that don't support + # fast watchpoints, but still...) + # + if ![runto_main] then { fail "watch tests suppressed" } + + send_gdb "set can-use-hw-watchpoints 0\n" + gdb_expect { + -re "$gdb_prompt $"\ + {pass "disable fast watches"} + timeout {fail "(timeout) disable fast watches"} + } + send_gdb "show can-use-hw-watchpoints\n" + gdb_expect { + -re "Debugger's willingness to use watchpoint hardware is 0.*$gdb_prompt $"\ + {pass "show disable fast watches"} + -re "$gdb_prompt $"\ + {fail "show disable fast watches"} + timeout {fail "(timeout) show disable fast watches"} + } + send_gdb "watch ival3 if count > 1\n" + gdb_expect { + -re "Watchpoint \[0-9\]*: ival3.*$gdb_prompt $"\ + {pass "set slow conditional watch"} + -re "$gdb_prompt $"\ + {fail "set slow conditional watch"} + timeout {fail "(timeout) set slow conditional watch"} + } + send_gdb "continue\n" + gdb_expect { + -re "Watchpoint \[0-9\]*: ival3.*Old value = 1.*New value = 2.*$gdb_prompt $"\ + {pass "trigger slow conditional watch"} + -re "$gdb_prompt $"\ + {fail "trigger slow conditional watch"} + timeout {fail "(timeout) trigger slow conditional watch"} + } + + # We've explicitly disabled hardware watches. Verify that GDB + # + # + send_gdb "rwatch ival3\n" + gdb_expect { + -re "Expression cannot be implemented with read/access watchpoint..*$gdb_prompt $"\ + {pass "rwatch disallowed when can-set-hw-watchpoints cleared"} + -re "$gdb_prompt $"\ + {fail "rwatch disallowed when can-set-hw-watchpoints cleared"} + timeout {fail "(timeout) rwatch disallowed when can-use-hw-watchpoints cleared"} + } + + # Read- and access watchpoints are unsupported on HP-UX. Verify + # that GDB gracefully responds to requests to create them. + # + if [istarget "hppa*-*-hpux*"] then { + send_gdb "set can-use-hw-watchpoints 1\n" + gdb_expect { + -re "$gdb_prompt $"\ + {pass "enable fast watches"} + timeout {fail "(timeout) enable fast watches"} + } + send_gdb "rwatch ival3\n" + gdb_expect { + -re "Target does not have this type of hardware watchpoint support.*$gdb_prompt $"\ + {pass "read watches disallowed"} + -re "$gdb_prompt $"\ + {fail "read watches disallowed"} + timeout {fail "(timeout) read watches disallowed"} + } + + send_gdb "awatch ival3\n" + gdb_expect { + -re "Target does not have this type of hardware watchpoint support.*$gdb_prompt $"\ + {pass "access watches disallowed"} + -re "$gdb_prompt $"\ + {fail "access watches disallowed"} + timeout {fail "(timeout) access watches disallowed"} + } + } } diff --git a/gdb/testsuite/gdb.base/whatis.c b/gdb/testsuite/gdb.base/whatis.c index 6d8d1e6..63d5d3d 100644 --- a/gdb/testsuite/gdb.base/whatis.c +++ b/gdb/testsuite/gdb.base/whatis.c @@ -188,7 +188,7 @@ enum cars {chevy, ford, porsche} clunker; /***********/ -main () +int main () { #ifdef usestubs set_debug_traps(); diff --git a/gdb/testsuite/gdb.base/whatis.exp b/gdb/testsuite/gdb.base/whatis.exp index 1f4e8b3..d540e4c 100644 --- a/gdb/testsuite/gdb.base/whatis.exp +++ b/gdb/testsuite/gdb.base/whatis.exp @@ -49,14 +49,6 @@ gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_load $binfile -# If we did not use the signed keyword when compiling the file, don't -# expect GDB to know that char is signed. -if $signed_keyword_not_used then { - set signed_char "char" -} else { - set signed_char "signed char" -} - # Define a procedure to set up an xfail for all targets that put out a # `long' type as an `int' type. # Sun/Ultrix cc have this problem. @@ -77,10 +69,21 @@ proc setup_xfail_on_long_vs_int {} { # uses in the stabs. So we need to deal with names both from gcc and # native compilers. # + 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" +} setup_xfail "a29k-*-*" if {!$gcc_compiled} then { setup_xfail "mips-sgi-irix*" } gdb_test "whatis v_signed_char" \ @@ -270,13 +273,21 @@ gdb_test "whatis v_double_pointer" \ "whatis double pointer" +if { $hp_aCC_compiler } { + set unstruct "unnamed\.struct\..*" + set ununion "unnamed\.union\..*" +} else { + set unstruct "\.\.\." + set ununion "\.\.\." +} + # test whatis command with structure types gdb_test "whatis v_struct1" \ "type = struct t_struct" \ "whatis named structure" gdb_test "whatis v_struct2" \ - "type = struct \{...\}" \ + "type = struct \{$unstruct\}" \ "whatis unnamed structure" @@ -286,68 +297,78 @@ gdb_test "whatis v_union" \ "whatis named union" gdb_test "whatis v_union2" \ - "type = union \{...\}" \ + "type = union \{$ununion\}" \ "whatis unnamed union" +if { [istarget "hppa*-hp-hpux10.20"] && $hp_aCC_compiler } { + # On HP-UX 10.20 with aCC compiler and objdebug mode, + # we need the 'void' pattern; without objdebug mode, + # we still need to '' pattern. + # FIXME: need to look into this further. + # - guo + set void "(void|)" +} else { + set void "" +} # test whatis command with functions return type gdb_test "whatis v_char_func" \ - "type = (signed |unsigned |)char \\(\\)" \ + "type = (signed |unsigned |)char \\($void\\)" \ "whatis char function" gdb_test "whatis v_signed_char_func" \ - "type = (signed |unsigned |)char \\(\\)" \ + "type = (signed |unsigned |)char \\($void\\)" \ "whatis signed char function" gdb_test "whatis v_unsigned_char_func" \ - "type = unsigned char \\(\\)" \ + "type = unsigned char \\($void\\)" \ "whatis unsigned char function" gdb_test "whatis v_short_func" \ - "type = short (int |)\\(\\)" \ + "type = short (int |)\\($void\\)" \ "whatis short function" gdb_test "whatis v_signed_short_func" \ - "type = (signed |)short (int |)\\(\\)" \ + "type = (signed |)short (int |)\\($void\\)" \ "whatis signed short function" gdb_test "whatis v_unsigned_short_func" \ - "type = (unsigned short|short unsigned int) \\(\\)" \ + "type = (unsigned short|short unsigned int) \\($void\\)" \ "whatis unsigned short function" gdb_test "whatis v_int_func" \ - "type = int \\(\\)" \ + "type = int \\($void\\)" \ "whatis int function" gdb_test "whatis v_signed_int_func" \ - "type = (signed |)int \\(\\)" \ + "type = (signed |)int \\($void\\)" \ "whatis signed int function" gdb_test "whatis v_unsigned_int_func" \ - "type = unsigned int \\(\\)" \ + "type = unsigned int \\($void\\)" \ "whatis unsigned int function" gdb_test "whatis v_long_func" \ - "type = (long|int|long int) \\(\\)" \ + "type = (long|int|long int) \\($void\\)" \ "whatis long function" gdb_test "whatis v_signed_long_func" \ - "type = (signed |)(int|long|long int) \\(\\)" \ + "type = (signed |)(int|long|long int) \\($void\\)" \ "whatis signed long function" gdb_test "whatis v_unsigned_long_func" \ - "type = (unsigned (int|long|long int)|long unsigned int) \\(\\)" \ + "type = (unsigned (int|long|long int)|long unsigned int) \\($void\\)" \ "whatis unsigned long function" # Sun /bin/cc calls this a function returning double. if {!$gcc_compiled} then {setup_xfail "*-sun-sunos4*"} gdb_test "whatis v_float_func" \ - "type = float \\(\\)" \ + "type = float \\($void\\)" \ "whatis float function" gdb_test "whatis v_double_func" \ - "type = double \\(\\)" \ + "type = double \\($void\\)" \ "whatis double function" \ @@ -376,8 +397,14 @@ gdb_test "whatis nested_su.outer_int" \ "type = int" \ "whatis outer structure member" +if {$hp_aCC_compiler} { + set outer "outer_struct::" +} else { + set outer "" +} + gdb_test "whatis nested_su.inner_struct_instance" \ - "type = struct inner_struct" \ + "type = struct ${outer}inner_struct" \ "whatis inner structure" gdb_test "whatis nested_su.inner_struct_instance.inner_int" \ @@ -385,7 +412,7 @@ gdb_test "whatis nested_su.inner_struct_instance.inner_int" \ "whatis inner structure member" gdb_test "whatis nested_su.inner_union_instance" \ - "type = union inner_union" \ + "type = union ${outer}inner_union" \ "whatis inner union" gdb_test "whatis nested_su.inner_union_instance.inner_union_int" \ diff --git a/gdb/testsuite/gdb.c++/member-ptr.exp b/gdb/testsuite/gdb.c++/member-ptr.exp index 7b4dd7c..9bf2431 100644 --- a/gdb/testsuite/gdb.c++/member-ptr.exp +++ b/gdb/testsuite/gdb.c++/member-ptr.exp @@ -42,6 +42,20 @@ set testfile "member-ptr" set srcfile ${testfile}.cc set binfile ${objdir}/${subdir}/${testfile} +# Create and source the file that provides information about the compiler +# used to compile the test case. + +if [get_compiler_info ${binfile} "c++"] { + return -1 +} + +# Nearly all of these tests fail when compiled with G++, so just give up +# until GDB gets enhanced. -sts 1999-06-22 + +if {$gcc_compiled} { + continue +} + 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." } diff --git a/gdb/testsuite/gdb.chill/ChangeLog b/gdb/testsuite/gdb.chill/ChangeLog index 9db44ea..fe5a317 100644 --- a/gdb/testsuite/gdb.chill/ChangeLog +++ b/gdb/testsuite/gdb.chill/ChangeLog @@ -1,3 +1,9 @@ +1999-06-25 Stan Shebs <shebs@andros.cygnus.com> + + From Jimmy Guo <guo@cup.hp.com>: + * xstruct-grt.ch, xstruct.ch, xstruct.exp: Rename to mollify + doschk. + Thu May 21 02:45:18 1998 Felix Lee <flee@zog.cygnus.com> * chexp.exp: fix tests that assume >16-bit ints. diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 95ed534..cb277be 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -63,6 +63,8 @@ if ![info exists gdb_prompt] then { set gdb_prompt "\[(\]gdb\[)\]" } +### Only procedures should come after this point. + # # gdb_version -- extract and print the version number of GDB # @@ -893,7 +895,40 @@ proc get_compiler_info {binfile args} { } } - source ${binfile}.ci + uplevel \#0 { set gcc_compiled 0 } + + if { [llength $args] == 0 || $args != "f77" } { + source ${binfile}.ci + } + + # Most compilers will evaluate comparisons and other boolean + # operations to 0 or 1. + uplevel \#0 { set true 1 } + uplevel \#0 { set false 0 } + + uplevel \#0 { set hp_cc_compiler 0 } + uplevel \#0 { set hp_aCC_compiler 0 } + uplevel \#0 { set hp_f77_compiler 0 } + uplevel \#0 { set hp_f90_compiler 0 } + if { !$gcc_compiled && [istarget "hppa*-*-hpux*"] } { + # Check for the HP compilers + set compiler [lindex [split [get_compiler $args] " "] 0] + catch "exec what $compiler" output + if [regexp ".*HP aC\\+\\+.*" $output] { + uplevel \#0 { set hp_aCC_compiler 1 } + # Use of aCC results in boolean results being displayed as + # "true" or "false" + uplevel \#0 { set true true } + uplevel \#0 { set false false } + } elseif [regexp ".*HP C Compiler.*" $output] { + uplevel \#0 { set hp_cc_compiler 1 } + } elseif [regexp ".*HP-UX f77.*" $output] { + uplevel \#0 { set hp_f77_compiler 1 } + } elseif [regexp ".*HP-UX f90.*" $output] { + uplevel \#0 { set hp_f90_compiler 1 } + } + } + return 0; } @@ -1060,6 +1095,52 @@ proc gdb_expect { args } { } } +# +# Check for long sequence of output by parts. +# TEST: is the test message. +# SENTINEL: Is the terminal pattern indicating that output has finished. +# LIST: is the sequence of outputs to match. +# If the sentinel is recognized early, it is considered an error. +# +proc gdb_expect_list {test sentinal list} { + global gdb_prompt + set index 0 + while { ${index} >= 0 && ${index} < [llength ${list}] } { + set pattern [lindex ${list} ${index}] + set index [expr ${index} + 1] + if { ${index} == [llength ${list}] } { + gdb_expect { + -re "${pattern}${sentinal}" { + pass "${test} (sentinal)" + } + timeout { + fail "(timeout on sentinal) ${test}" + set index -1 + } + } + } else { + gdb_expect { + -re "${pattern}" { + pass "${test} (line ${index})" + } + -re "${sentinal}" { + fail "${test} (line ${index})" + set index -1 + } + timeout { + fail "(timeout on line ${index}) ${test}" + set index -1 + } + } + } + } + if { ${index} >= 0 } { + pass "${test}" + } +} + +# +# proc gdb_suppress_entire_file { reason } { global suppress_flag; |