Imported Upstream version 7.9
[platform/upstream/gdb.git] / gdb / testsuite / gdb.base / symbol-without-target_section.exp
1 # Copyright 2010-2015 Free Software Foundation, Inc.
2
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.
7 #
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.
12 #
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/>.
15
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 main" to have some local BLOCK set in lookup_symbol_global.
20
21 standard_testfile start.c .c
22 set binlibfile ${testfile}.x
23
24 if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" \
25                   [standard_output_file ${binlibfile}] object {debug}] != "" } {
26     untested ${testfile}.exp
27     return -1
28 }
29 if {[build_executable ${testfile}.exp ${testfile} ${srcfile} {debug}] == -1} {
30     return -1
31 }
32 clean_restart ${binlibfile}
33
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 main"
39 gdb_test "print symbol_without_target_section"