| OLD | NEW | 
|---|
| 1 # Copyright 1992, 1994-2000, 2002-2004, 2007-2012 Free Software | 1 # Copyright 1992, 1994-2000, 2002-2004, 2007-2012 Free Software | 
| 2 # Foundation, Inc. | 2 # Foundation, Inc. | 
| 3 | 3 | 
| 4 # This program is free software; you can redistribute it and/or modify | 4 # This program is free software; you can redistribute it and/or modify | 
| 5 # it under the terms of the GNU General Public License as published by | 5 # it under the terms of the GNU General Public License as published by | 
| 6 # the Free Software Foundation; either version 3 of the License, or | 6 # the Free Software Foundation; either version 3 of the License, or | 
| 7 # (at your option) any later version. | 7 # (at your option) any later version. | 
| 8 # | 8 # | 
| 9 # This program is distributed in the hope that it will be useful, | 9 # This program is distributed in the hope that it will be useful, | 
| 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 
| 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
| 12 # GNU General Public License for more details. | 12 # GNU General Public License for more details. | 
| 13 # | 13 # | 
| 14 # You should have received a copy of the GNU General Public License | 14 # You should have received a copy of the GNU General Public License | 
| 15 # along with this program.  If not, see <http://www.gnu.org/licenses/>. | 15 # along with this program.  If not, see <http://www.gnu.org/licenses/>. | 
| 16 | 16 | 
| 17 # This file was written by Fred Fish. (fnf@cygnus.com) | 17 # This file was written by Fred Fish. (fnf@cygnus.com) | 
| 18 | 18 | 
| 19 if $tracelevel { |  | 
| 20     strace $tracelevel |  | 
| 21 } |  | 
| 22 |  | 
| 23 | 19 | 
| 24 set testfile "funcargs" | 20 set testfile "funcargs" | 
| 25 set srcfile ${testfile}.c | 21 set srcfile ${testfile}.c | 
| 26 set binfile ${objdir}/${subdir}/${testfile} | 22 set binfile ${objdir}/${subdir}/${testfile} | 
| 27 | 23 | 
| 28 set compile_flags {debug nowarnings quiet} | 24 set compile_flags {debug nowarnings quiet} | 
| 29 if [support_complex_tests] { | 25 if [support_complex_tests] { | 
| 30     lappend compile_flags "additional_flags=-DTEST_COMPLEX" | 26     lappend compile_flags "additional_flags=-DTEST_COMPLEX" | 
| 31 } | 27 } | 
| 32 | 28 | 
| 33 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable $com
      pile_flags] != "" } { | 29 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable $com
      pile_flags] != "" } { | 
| 34      untested funcargs.exp | 30      untested funcargs.exp | 
| 35      return -1 | 31      return -1 | 
| 36 } | 32 } | 
| 37 | 33 | 
| 38 # Create and source the file that provides information about the compiler | 34 # Create and source the file that provides information about the compiler | 
| 39 # used to compile the test case. | 35 # used to compile the test case. | 
| 40 if [get_compiler_info ${binfile}] { | 36 if [get_compiler_info] { | 
| 41     return -1; | 37     return -1; | 
| 42 } | 38 } | 
| 43 | 39 | 
| 44 # | 40 # | 
| 45 # Locate actual args; integral types. | 41 # Locate actual args; integral types. | 
| 46 # | 42 # | 
| 47 | 43 | 
| 48 proc integral_args {} { | 44 proc integral_args {} { | 
| 49     global gdb_prompt | 45     global gdb_prompt | 
| 50     global det_file | 46     global det_file | 
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 262     gdb_breakpoint callce | 258     gdb_breakpoint callce | 
| 263     gdb_breakpoint callcf | 259     gdb_breakpoint callcf | 
| 264 | 260 | 
| 265     # Run; should stop at call1a and print actual arguments. | 261     # Run; should stop at call1a and print actual arguments. | 
| 266     gdb_run_cmd | 262     gdb_run_cmd | 
| 267     gdb_expect { | 263     gdb_expect { | 
| 268         -re ".* callca \\(f1=1 \\+ 2 \\* I, f2=1 \\+ 2 \\* I, f3=1 \\+ 2 \\* I\\
      ) .*$gdb_prompt $" { pass "run to call2a" } | 264         -re ".* callca \\(f1=1 \\+ 2 \\* I, f2=1 \\+ 2 \\* I, f3=1 \\+ 2 \\* I\\
      ) .*$gdb_prompt $" { pass "run to call2a" } | 
| 269         timeout { fail "(timeout) run to callca" ; gdb_suppress_tests; } | 265         timeout { fail "(timeout) run to callca" ; gdb_suppress_tests; } | 
| 270     } | 266     } | 
| 271     gdb_test "cont" ".* callcb \\(d1=3 \\+ 4 \\* I, d2=3 \\+ 4 \\* I, d3=3 \\+ 4
       \\* I\\) .*" "continue to callcb" | 267     gdb_test "cont" ".* callcb \\(d1=3 \\+ 4 \\* I, d2=3 \\+ 4 \\* I, d3=3 \\+ 4
       \\* I\\) .*" "continue to callcb" | 
| 272     gdb_test "cont" ".* callcc \\(ld1=5 \\+ 6 \\* I, ld2=5 \\+ 6 \\* I, ld3=5 \\
      + 6 \\* I\\) .*" "continue to callcb" | 268     gdb_test "cont" ".* callcc \\(ld1=5 \\+ 6 \\* I, ld2=5 \\+ 6 \\* I, ld3=5 \\
      + 6 \\* I\\) .*" "continue to callcc" | 
| 273     gdb_test "cont" ".* callcd \\(fc1=1 \\+ 2 \\* I, dc1=3 \\+ 4 \\* I, ldc1=5 \
      \+ 6 \\* I\\) .*" "continue to callcd" | 269     gdb_test "cont" ".* callcd \\(fc1=1 \\+ 2 \\* I, dc1=3 \\+ 4 \\* I, ldc1=5 \
      \+ 6 \\* I\\) .*" "continue to callcd" | 
| 274     gdb_test "cont" ".* callce \\(dc1=3 \\+ 4 \\* I, ldc1=5 \\+ 6 \\* I, fc1=1 \
      \+ 2 \\* I\\) .*" "continue to callce" | 270     gdb_test "cont" ".* callce \\(dc1=3 \\+ 4 \\* I, ldc1=5 \\+ 6 \\* I, fc1=1 \
      \+ 2 \\* I\\) .*" "continue to callce" | 
| 275     gdb_test "cont" ".* callcf \\(ldc1=5 \\+ 6 \\* I, fc1=1 \\+ 2 \\* I, dc1=3 \
      \+ 4 \\* I\\) .*" "continue to callcf" | 271     gdb_test "cont" ".* callcf \\(ldc1=5 \\+ 6 \\* I, fc1=1 \\+ 2 \\* I, dc1=3 \
      \+ 4 \\* I\\) .*" "continue to callcf" | 
| 276 } | 272 } | 
| 277 | 273 | 
| 278 | 274 | 
| 279 # | 275 # | 
| 280 # Locate actual args; _Complex types and integral. | 276 # Locate actual args; _Complex types and integral. | 
| 281 # | 277 # | 
| 282 proc complex_integral_args {} { | 278 proc complex_integral_args {} { | 
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 329 | 325 | 
| 330     gdb_breakpoint call3a | 326     gdb_breakpoint call3a | 
| 331     gdb_breakpoint call3b | 327     gdb_breakpoint call3b | 
| 332     gdb_breakpoint call3c | 328     gdb_breakpoint call3c | 
| 333 | 329 | 
| 334     # Run; should stop at call3a and print actual arguments. | 330     # Run; should stop at call3a and print actual arguments. | 
| 335     # Try dereferencing the arguments. | 331     # Try dereferencing the arguments. | 
| 336 | 332 | 
| 337     gdb_run_cmd | 333     gdb_run_cmd | 
| 338     gdb_expect { | 334     gdb_expect { | 
| 339 »        -re ".* call3a \\(cp=$hex \"a.*\", sp=$hex, ip=$hex, lp=$hex\\) .*$gdb_
      prompt $" { pass "run to call3a" } | 335 »        -re ".* call3a \\(cp=$hex <c> \"a.*\", sp=$hex <s>, ip=$hex <i>, lp=$he
      x <l>\\) .*$gdb_prompt $" { pass "run to call3a" } | 
| 340          -re "$gdb_prompt $" { fail "run to call3a" ; gdb_suppress_tests; } | 336          -re "$gdb_prompt $" { fail "run to call3a" ; gdb_suppress_tests; } | 
| 341          timeout { fail "(timeout) run to call3a" ; gdb_suppress_tests; } | 337          timeout { fail "(timeout) run to call3a" ; gdb_suppress_tests; } | 
| 342     } | 338     } | 
| 343 | 339 | 
| 344     gdb_test "print *cp" ".* = 97 'a'" | 340     gdb_test "print *cp" ".* = 97 'a'" | 
| 345     gdb_test "print *sp" ".* = 1" | 341     gdb_test "print *sp" ".* = 1" | 
| 346     gdb_test "print *ip" ".* = 2" | 342     gdb_test "print *ip" ".* = 2" | 
| 347     gdb_test "print *lp" ".* = 3" | 343     gdb_test "print *lp" ".* = 3" | 
| 348 | 344 | 
| 349     # Continue; should stop at call3b and print actual arguments. | 345     # Continue; should stop at call3b and print actual arguments. | 
| 350     # Try dereferencing the arguments. | 346     # Try dereferencing the arguments. | 
| 351     if [gdb_test "cont" ".* call3b \\(ucp=$hex \"b.*\", usp=$hex, uip=$hex, ulp=
      $hex\\) .*" "continue to call3b"] { | 347     if [gdb_test "cont" ".* call3b \\(ucp=$hex <uc> \"b.*\", usp=$hex <us>, uip=
      $hex <ui>, ulp=$hex <ul>\\) .*" "continue to call3b"] { | 
| 352         gdb_suppress_tests; | 348         gdb_suppress_tests; | 
| 353     } | 349     } | 
| 354 | 350 | 
| 355     gdb_test "print *ucp" ".* = 98 'b'" | 351     gdb_test "print *ucp" ".* = 98 'b'" | 
| 356     gdb_test "print *usp" ".* = 6" | 352     gdb_test "print *usp" ".* = 6" | 
| 357     gdb_test "print *uip" ".* = 7" | 353     gdb_test "print *uip" ".* = 7" | 
| 358     gdb_test "print *ulp" ".* = 8" | 354     gdb_test "print *ulp" ".* = 8" | 
| 359 | 355 | 
| 360     # Continue; should stop at call3c and print actual arguments. | 356     # Continue; should stop at call3c and print actual arguments. | 
| 361     # Try dereferencing the arguments. | 357     # Try dereferencing the arguments. | 
| 362     if [gdb_test "cont" ".* call3c \\(fp=$hex, dp=$hex\\) .*" "continue to call3
      c"] { | 358     if [gdb_test "cont" ".* call3c \\(fp=$hex <f>, dp=$hex <d>\\) .*" "continue 
      to call3c"] { | 
| 363         gdb_suppress_tests; | 359         gdb_suppress_tests; | 
| 364     } | 360     } | 
| 365 | 361 | 
| 366     gdb_test "print *fp" ".* = 4" | 362     gdb_test "print *fp" ".* = 4" | 
| 367     gdb_test "print *dp" ".* = 5" | 363     gdb_test "print *dp" ".* = 5" | 
| 368 | 364 | 
| 369 #    pass "locate actual args, pointer types" | 365 #    pass "locate actual args, pointer types" | 
| 370     gdb_stop_suppressing_tests; | 366     gdb_stop_suppressing_tests; | 
| 371 } | 367 } | 
| 372 | 368 | 
| (...skipping 12 matching lines...) Expand all  Loading... | 
| 385     delete_breakpoints | 381     delete_breakpoints | 
| 386 | 382 | 
| 387     gdb_breakpoint call4a | 383     gdb_breakpoint call4a | 
| 388     gdb_breakpoint call4b | 384     gdb_breakpoint call4b | 
| 389 | 385 | 
| 390     # Run; should stop at call4a and print actual arguments. | 386     # Run; should stop at call4a and print actual arguments. | 
| 391     # Try dereferencing the arguments. | 387     # Try dereferencing the arguments. | 
| 392 | 388 | 
| 393     gdb_run_cmd | 389     gdb_run_cmd | 
| 394     gdb_expect { | 390     gdb_expect { | 
| 395 »        -re ".* call4a \\(stp=$hex\\) .*$gdb_prompt $" { | 391 »        -re ".* call4a \\(stp=$hex <st>\\) .*$gdb_prompt $" { | 
| 396             pass "run to call4a" | 392             pass "run to call4a" | 
| 397         } | 393         } | 
| 398          -re "$gdb_prompt $" { fail "run to call4a" ; gdb_suppress_tests; } | 394          -re "$gdb_prompt $" { fail "run to call4a" ; gdb_suppress_tests; } | 
| 399          timeout { fail "(timeout) run to call4a" ; gdb_suppress_tests; } | 395          timeout { fail "(timeout) run to call4a" ; gdb_suppress_tests; } | 
| 400     } | 396     } | 
| 401 | 397 | 
| 402     gdb_test "print *stp" ".* = \{s1 = 101, s2 = 102\}" | 398     gdb_test "print *stp" ".* = \{s1 = 101, s2 = 102\}" | 
| 403 | 399 | 
| 404     # Continue; should stop at call4b and print actual arguments. | 400     # Continue; should stop at call4b and print actual arguments. | 
| 405 | 401 | 
| 406     gdb_test "cont" ".* call4b \\(unp=$hex\\) .*" "continue to call4b" | 402     gdb_test "cont" ".* call4b \\(unp=$hex <un>\\) .*" "continue to call4b" | 
| 407 | 403 | 
| 408     # Try dereferencing the arguments. | 404     # Try dereferencing the arguments. | 
| 409     if { $target_sizeof_long == $target_sizeof_int } { | 405     if { $target_sizeof_long == $target_sizeof_int } { | 
| 410         gdb_test "print *unp" ".* = \{u1 = 1, u2 = 1\}" \ | 406         gdb_test "print *unp" ".* = \{u1 = 1, u2 = 1\}" \ | 
| 411                 "print *unp (sizeof long == sizeof int)" | 407                 "print *unp (sizeof long == sizeof int)" | 
| 412     } elseif { ! $target_bigendian_p } { | 408     } elseif { ! $target_bigendian_p } { | 
| 413         gdb_test "print *unp" ".* = \{u1 = 1, u2 = 1\}" \ | 409         gdb_test "print *unp" ".* = \{u1 = 1, u2 = 1\}" \ | 
| 414                 "print *unp (little-endian, sizeof long != sizeof int)" | 410                 "print *unp (little-endian, sizeof long != sizeof int)" | 
| 415     } elseif { $target_sizeof_long == 8 && $target_sizeof_int == 4 } { | 411     } elseif { $target_sizeof_long == 8 && $target_sizeof_int == 4 } { | 
| 416         gdb_test "print *unp" ".* = \{u1 = 1, u2 = 4294967296\}" \ | 412         gdb_test "print *unp" ".* = \{u1 = 1, u2 = 4294967296\}" \ | 
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 962             "\[\r\n\]#5 .* recurse \\(a=\{s = 4, i = 4, l = 4\}, depth=4\\) " | 958             "\[\r\n\]#5 .* recurse \\(a=\{s = 4, i = 4, l = 4\}, depth=4\\) " | 
| 963             "\[\r\n\]#6 .* test_struct_args \\(\\) " | 959             "\[\r\n\]#6 .* test_struct_args \\(\\) " | 
| 964             "\[\r\n\]#7 .* main \\(.*\\) at " | 960             "\[\r\n\]#7 .* main \\(.*\\) at " | 
| 965         } | 961         } | 
| 966     } else { | 962     } else { | 
| 967         fail "recursive passing of structs by value (sparclet)" | 963         fail "recursive passing of structs by value (sparclet)" | 
| 968     } | 964     } | 
| 969     gdb_stop_suppressing_tests; | 965     gdb_stop_suppressing_tests; | 
| 970 } | 966 } | 
| 971 | 967 | 
| 972 proc funcargs_reload { } { |  | 
| 973     global objdir |  | 
| 974     global subdir |  | 
| 975     global binfile |  | 
| 976     global srcdir |  | 
| 977 |  | 
| 978     if [istarget "mips-idt-*"] { |  | 
| 979         # Restart because IDT/SIM runs out of file descriptors. |  | 
| 980         gdb_exit |  | 
| 981         gdb_start |  | 
| 982         gdb_reinitialize_dir $srcdir/$subdir |  | 
| 983         gdb_load ${binfile} |  | 
| 984     } |  | 
| 985 } |  | 
| 986 |  | 
| 987 # | 968 # | 
| 988 # Test for accessing local stack variables in functions which call alloca | 969 # Test for accessing local stack variables in functions which call alloca | 
| 989 # | 970 # | 
| 990 proc localvars_after_alloca { } { | 971 proc localvars_after_alloca { } { | 
| 991     global gdb_prompt | 972     global gdb_prompt | 
| 992     global hex | 973     global hex | 
| 993     global decimal | 974     global decimal | 
| 994     global gcc_compiled | 975     global gcc_compiled | 
| 995 | 976 | 
| 996     if { ! [ runto localvars_after_alloca ] } then { gdb_suppress_tests; } | 977     if { ! [ runto localvars_after_alloca ] } then { gdb_suppress_tests; } | 
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1231         set target_bigendian_p 1 | 1212         set target_bigendian_p 1 | 
| 1232         # pass silently | 1213         # pass silently | 
| 1233     } | 1214     } | 
| 1234 } | 1215 } | 
| 1235 | 1216 | 
| 1236 # Perform tests | 1217 # Perform tests | 
| 1237 | 1218 | 
| 1238 gdb_test_no_output "set print frame-arguments all" | 1219 gdb_test_no_output "set print frame-arguments all" | 
| 1239 | 1220 | 
| 1240 integral_args | 1221 integral_args | 
| 1241 funcargs_reload |  | 
| 1242 unsigned_integral_args | 1222 unsigned_integral_args | 
| 1243 funcargs_reload |  | 
| 1244 if {![target_info exists gdb,skip_float_tests]} { | 1223 if {![target_info exists gdb,skip_float_tests]} { | 
| 1245   float_and_integral_args | 1224   float_and_integral_args | 
| 1246 } | 1225 } | 
| 1247 | 1226 | 
| 1248 # Test _Complex type here if supported. | 1227 # Test _Complex type here if supported. | 
| 1249 if [support_complex_tests] { | 1228 if [support_complex_tests] { | 
| 1250     funcargs_reload |  | 
| 1251     complex_args | 1229     complex_args | 
| 1252 | 1230 | 
| 1253     funcargs_reload |  | 
| 1254     complex_integral_args | 1231     complex_integral_args | 
| 1255 | 1232 | 
| 1256     if {![target_info exists gdb,skip_float_tests]} { | 1233     if {![target_info exists gdb,skip_float_tests]} { | 
| 1257         funcargs_reload |  | 
| 1258         complex_float_integral_args | 1234         complex_float_integral_args | 
| 1259     } | 1235     } | 
| 1260 } | 1236 } | 
| 1261 | 1237 | 
| 1262 funcargs_reload |  | 
| 1263 pointer_args | 1238 pointer_args | 
| 1264 funcargs_reload |  | 
| 1265 structs_by_reference | 1239 structs_by_reference | 
| 1266 funcargs_reload |  | 
| 1267 structs_by_value | 1240 structs_by_value | 
| 1268 funcargs_reload |  | 
| 1269 discard_and_shuffle | 1241 discard_and_shuffle | 
| 1270 funcargs_reload |  | 
| 1271 shuffle_round_robin | 1242 shuffle_round_robin | 
| 1272 funcargs_reload |  | 
| 1273 recursive_structs_by_value | 1243 recursive_structs_by_value | 
| 1274 funcargs_reload |  | 
| 1275 localvars_after_alloca | 1244 localvars_after_alloca | 
| 1276 funcargs_reload |  | 
| 1277 call_after_alloca | 1245 call_after_alloca | 
| 1278 funcargs_reload |  | 
| 1279 localvars_in_indirect_call | 1246 localvars_in_indirect_call | 
| 1280 funcargs_reload |  | 
| 1281 test_stepping_over_trampolines | 1247 test_stepping_over_trampolines | 
| 1282 | 1248 | 
| 1283 set timeout $prev_timeout | 1249 set timeout $prev_timeout | 
| OLD | NEW | 
|---|