diff options
author | Tom de Vries <tdevries@suse.de> | 2023-08-04 15:02:43 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2023-08-04 15:02:43 +0200 |
commit | b44293099e215d6558a8d91b5eaab137218d2e27 (patch) | |
tree | 49c02e1b0f510e51b75cd425f1bbc0f4030620cb /gdb/testsuite/gdb.base/index-cache.c | |
parent | edb157dfc6a7c0918aa67439c4ea6fd6161f3841 (diff) | |
download | binutils-b44293099e215d6558a8d91b5eaab137218d2e27.zip binutils-b44293099e215d6558a8d91b5eaab137218d2e27.tar.gz binutils-b44293099e215d6558a8d91b5eaab137218d2e27.tar.bz2 |
[gdb/testsuite] Extend gdb.base/index-cache.exp
The test-case gdb.base/index-cache.exp uses only one source file, which
contains main.
While doing "file $exec", in set_initial_language a symbol lookup of "main" is
done, causing the symtab containing main to be expanded.
Handling of main is special, and a future optimization may skip the lookup and
expansion.
Reliably exercise:
- the lookup of main, expanding the symtab containing main, by doing
"ptype main", and
- the lookup of another symbol, expanding a symtab not containing main, by:
- adding another source file containing function foo, and
- doing "ptype foo".
This triggered a segfault with target board native-extended-gdbserver, filed
as PR symtab/30712, but that seems to be fixed by a previous commit in this
series.
Tested on x86_64-linux.
Approved-By: Tom Tromey <tom@tromey.com>
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30712
Diffstat (limited to 'gdb/testsuite/gdb.base/index-cache.c')
-rw-r--r-- | gdb/testsuite/gdb.base/index-cache.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gdb/testsuite/gdb.base/index-cache.c b/gdb/testsuite/gdb.base/index-cache.c index 16521df..fecba98 100644 --- a/gdb/testsuite/gdb.base/index-cache.c +++ b/gdb/testsuite/gdb.base/index-cache.c @@ -15,9 +15,11 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ +extern int foo (void); + int -main () +main (void) { - return 0; + return foo (); } |