1# Copyright 2010, 2011 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 21set testfile symbol-without-target_section 22set srclibfile ${testfile}.c 23set binlibfile ${testfile}.x 24set srcmainfile start.c 25set binmainfile ${testfile} 26if { [gdb_compile "${srcdir}/${subdir}/${srclibfile}" \ 27 "${objdir}/${subdir}/${binlibfile}" object {debug}] != "" } { 28 untested ${testfile}.exp 29 return -1 30} 31if {[build_executable ${testfile}.exp ${binmainfile} ${srcmainfile} {debug}] == -1} { 32 return -1 33} 34clean_restart ${binlibfile} 35 36gdb_test "add-symbol-file ${objdir}/${subdir}/${binmainfile} 0" \ 37 "Reading symbols from .*" \ 38 "add-symbol-file" \ 39 "add symbol table from file \".*\" at.*\\(y or n\\) " "y" 40gdb_test "list main" 41gdb_test "print symbol_without_target_section" 42