OLD | NEW |
1 # Copyright 1988, 1990-1992, 1994-1997, 1999, 2002-2004, 2007-2012 Free | 1 # Copyright 1988, 1990-1992, 1994-1997, 1999, 2002-2004, 2007-2012 Free |
2 # Software Foundation, Inc. | 2 # Software 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 Rob Savoye. (rob@cygnus.com) | 17 # This file was written by Rob Savoye. (rob@cygnus.com) |
18 | 18 |
19 if $tracelevel { | |
20 strace $tracelevel | |
21 } | |
22 | |
23 # | 19 # |
24 # test running programs | 20 # test running programs |
25 # | 21 # |
26 | 22 |
27 if [target_info exists no_long_long] { | 23 if [target_info exists no_long_long] { |
28 set exec_opts [list debug additional_flags=-DNO_LONG_LONG] | 24 set exec_opts [list debug additional_flags=-DNO_LONG_LONG] |
29 } else { | 25 } else { |
30 set exec_opts [list debug] | 26 set exec_opts [list debug] |
31 } | 27 } |
32 | 28 |
33 set testfile whatis | 29 set testfile whatis |
34 set srcfile ${testfile}.c | 30 set srcfile ${testfile}.c |
35 set binfile ${objdir}/${subdir}/${testfile} | 31 set binfile ${objdir}/${subdir}/${testfile} |
36 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable $exe
c_opts] != "" } { | 32 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable $exe
c_opts] != "" } { |
37 untested whatis.exp | 33 untested whatis.exp |
38 return -1 | 34 return -1 |
39 } | 35 } |
40 | 36 |
41 # Create and source the file that provides information about the compiler | 37 # Create and source the file that provides information about the compiler |
42 # used to compile the test case. | 38 # used to compile the test case. |
43 if [get_compiler_info ${binfile}] { | 39 if [get_compiler_info] { |
44 return -1; | 40 return -1; |
45 } | 41 } |
46 | 42 |
47 # Start with a fresh gdb. | 43 # Start with a fresh gdb. |
48 | 44 |
49 gdb_exit | 45 gdb_exit |
50 gdb_start | 46 gdb_start |
51 gdb_reinitialize_dir $srcdir/$subdir | 47 gdb_reinitialize_dir $srcdir/$subdir |
52 gdb_load $binfile | 48 gdb_load $binfile |
53 | 49 |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 | 458 |
463 # test whatis command with typedefs | 459 # test whatis command with typedefs |
464 | 460 |
465 gdb_test "whatis char_addr" \ | 461 gdb_test "whatis char_addr" \ |
466 "type = char \\*" \ | 462 "type = char \\*" \ |
467 "whatis using typedef type name" | 463 "whatis using typedef type name" |
468 | 464 |
469 gdb_test "whatis a_char_addr" \ | 465 gdb_test "whatis a_char_addr" \ |
470 "type = char_addr" \ | 466 "type = char_addr" \ |
471 "whatis applied to variable defined by typedef" | 467 "whatis applied to variable defined by typedef" |
| 468 |
| 469 # Regression tests for PR 9514. |
| 470 |
| 471 gdb_test "whatis void (**)()" \ |
| 472 "type = void \\(\\*\\*\\)\\(\\)" \ |
| 473 "whatis applied to pointer to pointer to function" |
| 474 |
| 475 gdb_test "whatis void (** const)()" \ |
| 476 "type = void \\(\\*\\* const\\)\\(\\)" \ |
| 477 "whatis applied to const pointer to pointer to function" |
| 478 |
| 479 gdb_test "whatis void (* const *)()" \ |
| 480 "type = void \\(\\* const \\*\\)\\(\\)" \ |
| 481 "whatis applied to pointer to const pointer to function" |
| 482 |
| 483 gdb_test "whatis int *(*)()" \ |
| 484 "type = int \\*\\(\\*\\)\\(\\)" \ |
| 485 "whatis applied to pointer to function returning pointer to int" |
| 486 |
| 487 gdb_test "whatis int *(**)()" \ |
| 488 "type = int \\*\\(\\*\\*\\)\\(\\)" \ |
| 489 "whatis applied to pointer to pointer to function returning pointer to int" |
| 490 |
| 491 gdb_test "whatis char (*(*)())\[23\]" \ |
| 492 "type = char \\(\\*\\(\\*\\)\\(\\)\\)\\\[23\\\]" \ |
| 493 "whatis applied to pointer to function returning pointer to array" |
| 494 |
| 495 gdb_test "whatis int (*)(int, int)" \ |
| 496 "type = int \\(\\*\\)\\(int, int\\)" \ |
| 497 "whatis applied to pointer to function taking int,int and returning int" |
| 498 |
| 499 gdb_test "whatis int (*)(const int *, ...)" \ |
| 500 "type = int \\(\\*\\)\\(const int \\*, \\.\\.\\.\\)" \ |
| 501 "whatis applied to pointer to function taking const int ptr and varargs and
returning int" |
| 502 |
| 503 gdb_test "whatis int (*)(void, int, int)" \ |
| 504 "parameter types following 'void'" \ |
| 505 "whatis applied to function with types trailing 'void'" |
| 506 |
| 507 gdb_test "whatis int (*)(int, void, int)" \ |
| 508 "'void' invalid as parameter type" \ |
| 509 "whatis applied to function with 'void' parameter type" |
OLD | NEW |