Fix: Null pointer dereference in ldlex.l
[binutils-gdb.git] / gdb / testsuite / gdb.base / symbol-without-target_section.exp
blob8c9dda2dc0dadc293162aa758d5aa69e049425a1
1 # Copyright 2010-2023 Free Software Foundation, Inc.
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
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
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/>.
16 # Exploit formerly failed assertion in scan_dyntag when it got called for
17 # objfile having ".dynamic" section but without having data loaded in target.
18 # Such file is ${binmainfile} through add-symbol-file here. Set context first
19 # by "list -q main" to have some local BLOCK set in lookup_symbol_global.
21 standard_testfile start.c .c
22 set binlibfile ${testfile}.x
24 if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" \
25 [standard_output_file ${binlibfile}] object {debug}] != "" } {
26 untested "failed to compile"
27 return -1
29 if {[build_executable ${testfile}.exp ${testfile} ${srcfile} {debug}] == -1} {
30 return -1
32 clean_restart ${binlibfile}
34 gdb_test "add-symbol-file [standard_output_file ${testfile}] 0" \
35 "Reading symbols from .*" \
36 "add-symbol-file" \
37 "add symbol table from file \".*\" at.*\\(y or n\\) " "y"
38 gdb_test "list -q main"
39 gdb_test "print symbol_without_target_section"