gdb: rewrite how per language primitive types are managed
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.fortran / library-module.exp
CommitLineData
b811d2c2 1# Copyright 2010-2020 Free Software Foundation, Inc.
f55ee35c
JK
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
a54a7f13
PA
16load_lib fortran.exp
17
18if {[skip_fortran_tests]} { return -1 }
19
cf09b3e4 20standard_testfile library-module-main.f90
f55ee35c 21set srclibfile ${testfile}-lib.f90
cf09b3e4 22set libfile [standard_output_file ${testfile}-lib.so]
f55ee35c
JK
23
24# Required for -fPIC by gdb_compile_shlib.
4c93b1db 25if [get_compiler_info] {
f55ee35c
JK
26 warning "Could not get compiler info"
27 return -1
28}
29
cf09b3e4 30if { [gdb_compile_shlib "${srcdir}/${subdir}/${srclibfile}" $libfile {debug f90}] != "" } {
84c93cd5 31 untested "failed to compile shared library"
f55ee35c
JK
32 return -1
33}
34
35# prepare_for_testing cannot be used as linking with $libfile cannot be passed
36# just for the linking phase (and not the source compilation phase). And any
37# warnings on ignored $libfile abort the process.
38
cf09b3e4 39if { [gdb_compile $srcdir/$subdir/$srcfile $binfile executable [list debug f90 shlib=$libfile]] != "" } {
84c93cd5 40 untested "failed to compile"
f55ee35c
JK
41 return -1
42}
43
cf09b3e4 44clean_restart $testfile
f55ee35c 45
d9019901 46gdb_load_shlib $libfile
4255c8d2 47
86cd6bc8
AKS
48if ![fortran_runto_main] then {
49 perror "couldn't run to main"
f55ee35c
JK
50 continue
51}
52
53gdb_breakpoint $srclibfile:[gdb_get_line_number "i-is-2-in-lib" $srclibfile]
54gdb_continue_to_breakpoint "i-is-2-in-lib" ".*i-is-2-in-lib.*"
55gdb_test "print var_i" " = 2" "print var_i in lib"
56
57gdb_breakpoint $srcfile:[gdb_get_line_number "i-is-2-in-main" $srcfile]
58gdb_continue_to_breakpoint "i-is-2-in-main" ".*i-is-2-in-main.*"
59gdb_test "print var_i" " = 2" "print var_i in main"
60
61gdb_test "print var_j" " = 3"
62gdb_test "print var_k" "No symbol \"var_k\" in current context\\."
This page took 1.191481 seconds and 4 git commands to generate.