OLD | NEW |
1 # Copyright 1992, 1994-2004, 2007-2012 Free Software Foundation, Inc. | 1 # Copyright 1992, 1994-2004, 2007-2012 Free Software Foundation, Inc. |
2 | 2 |
3 # This program is free software; you can redistribute it and/or modify | 3 # This program is free software; you can redistribute it and/or modify |
4 # it under the terms of the GNU General Public License as published by | 4 # it under the terms of the GNU General Public License as published by |
5 # the Free Software Foundation; either version 3 of the License, or | 5 # the Free Software Foundation; either version 3 of the License, or |
6 # (at your option) any later version. | 6 # (at your option) any later version. |
7 # | 7 # |
8 # This program is distributed in the hope that it will be useful, | 8 # This program is distributed in the hope that it will be useful, |
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 # GNU General Public License for more details. | 11 # GNU General Public License for more details. |
12 # | 12 # |
13 # You should have received a copy of the GNU General Public License | 13 # You should have received a copy of the GNU General Public License |
14 # along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
15 | 15 |
16 # This file was written by Fred Fish. (fnf@cygnus.com) | 16 # This file was written by Fred Fish. (fnf@cygnus.com) |
17 # and modified by Bob Manson. (manson@cygnus.com) | 17 # and modified by Bob Manson. (manson@cygnus.com) |
18 | 18 |
19 if $tracelevel then { | |
20 strace $tracelevel | |
21 } | |
22 | |
23 set testfile "callfuncs" | 19 set testfile "callfuncs" |
24 set srcfile ${testfile}.c | 20 set srcfile ${testfile}.c |
25 set binfile ${objdir}/${subdir}/${testfile} | 21 set binfile ${objdir}/${subdir}/${testfile} |
26 | 22 |
27 set compile_flags {debug} | 23 set compile_flags {debug} |
28 if [support_complex_tests] { | 24 if [support_complex_tests] { |
29 lappend compile_flags "additional_flags=-DTEST_COMPLEX" | 25 lappend compile_flags "additional_flags=-DTEST_COMPLEX" |
30 } | 26 } |
31 | 27 |
32 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable $com
pile_flags] != "" } { | 28 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable $com
pile_flags] != "" } { |
33 untested callfuncs.exp | 29 untested callfuncs.exp |
34 return -1 | 30 return -1 |
35 } | 31 } |
36 | 32 |
37 # Create and source the file that provides information about the compiler | 33 # Create and source the file that provides information about the compiler |
38 # used to compile the test case. | 34 # used to compile the test case. |
39 | 35 |
40 if [get_compiler_info ${binfile}] { | 36 if [get_compiler_info] { |
41 return -1; | 37 return -1; |
42 } | 38 } |
43 | 39 |
44 if {$hp_aCC_compiler} { | 40 if {$hp_aCC_compiler} { |
45 set prototypes 1 | 41 set prototypes 1 |
46 } else { | 42 } else { |
47 set prototypes 0 | 43 set prototypes 0 |
48 } | 44 } |
49 | 45 |
50 # Some targets can't do function calls, so don't even bother with this | 46 # Some targets can't do function calls, so don't even bother with this |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 setup_kfail_for_target gdb/12796 "x86_64-*-*" | 250 setup_kfail_for_target gdb/12796 "x86_64-*-*" |
255 gdb_test "p t_structs_dc(struct_val1)" ".*= 4 \\+ 4 \\* I" \ | 251 gdb_test "p t_structs_dc(struct_val1)" ".*= 4 \\+ 4 \\* I" \ |
256 "call inferior func with struct - returns double _Complex" | 252 "call inferior func with struct - returns double _Complex" |
257 | 253 |
258 setup_kfail_for_target gdb/12783 "i?86-*-*" | 254 setup_kfail_for_target gdb/12783 "i?86-*-*" |
259 setup_kfail_for_target gdb/12796 "x86_64-*-*" | 255 setup_kfail_for_target gdb/12796 "x86_64-*-*" |
260 gdb_test "p t_structs_ldc(struct_val1)" "= 5 \\+ 5 \\* I" \ | 256 gdb_test "p t_structs_ldc(struct_val1)" "= 5 \\+ 5 \\* I" \ |
261 "call inferior func with struct - returns long double _Complex" | 257 "call inferior func with struct - returns long double _Complex" |
262 } | 258 } |
263 | 259 |
264 gdb_test "p t_structs_a(struct_val1)" "= (.unsigned char .. )?\"foo\"" \ | 260 gdb_test "p t_structs_a(struct_val1)" "= (.unsigned char .. )?<buf.*> \"foo\
"" \ |
265 "call inferior func with struct - returns char *" | 261 "call inferior func with struct - returns char *" |
266 } | 262 } |
267 | 263 |
268 # Procedure to get current content of all registers. | 264 # Procedure to get current content of all registers. |
269 proc fetch_all_registers {test} { | 265 proc fetch_all_registers {test} { |
270 global gdb_prompt | 266 global gdb_prompt |
271 | 267 |
272 set all_registers_lines {} | 268 set all_registers_lines {} |
273 set bad -1 | 269 set bad -1 |
274 # Former trailing `\[\r\n\]+' may eat just \r leaving \n in the buffer | 270 # Former trailing `\[\r\n\]+' may eat just \r leaving \n in the buffer |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 gdb_test {set $sp = -1} | 532 gdb_test {set $sp = -1} |
537 gdb_test "call doubleit (1)" ".*" "sp == -1: call doubleit (1)" | 533 gdb_test "call doubleit (1)" ".*" "sp == -1: call doubleit (1)" |
538 | 534 |
539 gdb_test {set $sp = $old_sp} | 535 gdb_test {set $sp = $old_sp} |
540 } | 536 } |
541 | 537 |
542 # Test function descriptor resolution - the separate debug info .opd section | 538 # Test function descriptor resolution - the separate debug info .opd section |
543 # handling vs. local labels `.L'... as `Lcallfunc' starts with `L'. | 539 # handling vs. local labels `.L'... as `Lcallfunc' starts with `L'. |
544 | 540 |
545 gdb_test "print callfunc (Lcallfunc, 5)" " = 12" | 541 gdb_test "print callfunc (Lcallfunc, 5)" " = 12" |
| 542 |
| 543 # Regression test for function pointer cast. |
| 544 gdb_test "print *((int *(*) (void)) voidfunc)()" " = 23" |
OLD | NEW |