2021-01-01 16:03:39 +08:00
|
|
|
# Copyright 2004-2021 Free Software Foundation, Inc.
|
2004-04-02 02:42:08 +08:00
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
2007-08-24 02:14:19 +08:00
|
|
|
# the Free Software Foundation; either version 3 of the License, or
|
2004-04-02 02:42:08 +08:00
|
|
|
# (at your option) any later version.
|
2007-08-24 02:14:19 +08:00
|
|
|
#
|
2004-04-02 02:42:08 +08:00
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
2007-08-24 02:14:19 +08:00
|
|
|
#
|
2004-04-02 02:42:08 +08:00
|
|
|
# You should have received a copy of the GNU General Public License
|
2007-08-24 02:14:19 +08:00
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2004-04-02 02:42:08 +08:00
|
|
|
|
[testsuite/Ada] stop using project files when building test programs
The current approach when building Ada programs for testing is
based on the use of a project file (testsuite/gdb.ada/gnat_ada.gpr).
To do that, we pass a number of additional arguments to target_compile,
one of them being the project file (via "-P/path/to/gnat_ada.gpr").
This used to work well-enough, but AdaCore is currently working towards
removing project-file support from gnatmake (the prefered tool for
using project files is gprbuild). So, we need to either switch
the compilation to gprbuild, or stop using project files.
First, using gprbuild is not always what users will be using to
build their applications. So having the option of using gnatmake
provides more flexibility towards exactly reproducing past bugs.
If we ever need a testcase that requires the use of gprbuild, then
I believe support for a new target needs to be added to dejagnu's
target_compile.
Also, the only real reason behind using a project file in the first
place is that we wanted to make it easy to specify the directory
where all compilation artifacts get stored. This is a consequence
of the organization choice we made for gdb.ada to keep each testcase
well organized. It is very easy to achieve that goal without using
project files.
This is therefore what this patch does: It change gdb_compile_ada
to build any program using gnatmake without using a project file
(by temporarily changing the current working directory).
There is a small (beneficial) side-effect; in the situation where
GDB is built in-tree, gnatmake is called as...
% gnatmake [...] unit.adb
... which means that the debugging info in unit.o will say contain
a filename whose name is 'unit.adb', rather than '/path/to/unit.adb'.
This also better matches what users might typically do. But the side-
effect is that the unit name in the GDB output is not always a full
path. This patch tweaks a couple of testcases to make the path part
optional.
gdb/testsuite:
* lib/ada.exp (target_compile_ada_from_dir): New function.
(gdb_compile_ada): Reimplement avoiding the use of project files.
* gdb.ada/gnat_ada.gpr: Delete.
* gdb.ada/cond_lang.exp: Adjust test to make path before
filename optional.
* gdb.ada/small_reg_param.exp: Likewise.
Tested on x86_64-linux, with both in-tree and out-of-tree builds.
2015-12-22 17:28:41 +08:00
|
|
|
# Call target_compile with SOURCE DEST TYPE and OPTIONS as argument,
|
|
|
|
# after having temporarily changed the current working directory to
|
|
|
|
# BUILDDIR.
|
|
|
|
|
|
|
|
proc target_compile_ada_from_dir {builddir source dest type options} {
|
|
|
|
set saved_cwd [pwd]
|
2019-10-10 17:51:34 +08:00
|
|
|
|
|
|
|
global board
|
|
|
|
set board [target_info name]
|
|
|
|
set save_multilib_flag [board_info $board multilib_flags]
|
|
|
|
set multilib_flag ""
|
|
|
|
foreach op $save_multilib_flag {
|
|
|
|
if { $op == "-pie" || $op == "-no-pie" } {
|
|
|
|
# Pretend gnatmake supports -pie/-no-pie, route it to
|
|
|
|
# linker.
|
|
|
|
append multilib_flag " -largs $op -margs"
|
|
|
|
} else {
|
|
|
|
append multilib_flag " $op"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if { $multilib_flag != "" } {
|
|
|
|
unset_board_info "multilib_flags"
|
|
|
|
set_board_info multilib_flags "$multilib_flag"
|
|
|
|
}
|
|
|
|
|
[testsuite/Ada] stop using project files when building test programs
The current approach when building Ada programs for testing is
based on the use of a project file (testsuite/gdb.ada/gnat_ada.gpr).
To do that, we pass a number of additional arguments to target_compile,
one of them being the project file (via "-P/path/to/gnat_ada.gpr").
This used to work well-enough, but AdaCore is currently working towards
removing project-file support from gnatmake (the prefered tool for
using project files is gprbuild). So, we need to either switch
the compilation to gprbuild, or stop using project files.
First, using gprbuild is not always what users will be using to
build their applications. So having the option of using gnatmake
provides more flexibility towards exactly reproducing past bugs.
If we ever need a testcase that requires the use of gprbuild, then
I believe support for a new target needs to be added to dejagnu's
target_compile.
Also, the only real reason behind using a project file in the first
place is that we wanted to make it easy to specify the directory
where all compilation artifacts get stored. This is a consequence
of the organization choice we made for gdb.ada to keep each testcase
well organized. It is very easy to achieve that goal without using
project files.
This is therefore what this patch does: It change gdb_compile_ada
to build any program using gnatmake without using a project file
(by temporarily changing the current working directory).
There is a small (beneficial) side-effect; in the situation where
GDB is built in-tree, gnatmake is called as...
% gnatmake [...] unit.adb
... which means that the debugging info in unit.o will say contain
a filename whose name is 'unit.adb', rather than '/path/to/unit.adb'.
This also better matches what users might typically do. But the side-
effect is that the unit name in the GDB output is not always a full
path. This patch tweaks a couple of testcases to make the path part
optional.
gdb/testsuite:
* lib/ada.exp (target_compile_ada_from_dir): New function.
(gdb_compile_ada): Reimplement avoiding the use of project files.
* gdb.ada/gnat_ada.gpr: Delete.
* gdb.ada/cond_lang.exp: Adjust test to make path before
filename optional.
* gdb.ada/small_reg_param.exp: Likewise.
Tested on x86_64-linux, with both in-tree and out-of-tree builds.
2015-12-22 17:28:41 +08:00
|
|
|
catch {
|
|
|
|
cd $builddir
|
|
|
|
return [target_compile $source $dest $type $options]
|
|
|
|
} result options
|
|
|
|
cd $saved_cwd
|
2019-10-10 17:51:34 +08:00
|
|
|
|
|
|
|
if { $save_multilib_flag != "" } {
|
|
|
|
unset_board_info "multilib_flags"
|
|
|
|
set_board_info multilib_flags $save_multilib_flag
|
|
|
|
}
|
|
|
|
|
[testsuite/Ada] stop using project files when building test programs
The current approach when building Ada programs for testing is
based on the use of a project file (testsuite/gdb.ada/gnat_ada.gpr).
To do that, we pass a number of additional arguments to target_compile,
one of them being the project file (via "-P/path/to/gnat_ada.gpr").
This used to work well-enough, but AdaCore is currently working towards
removing project-file support from gnatmake (the prefered tool for
using project files is gprbuild). So, we need to either switch
the compilation to gprbuild, or stop using project files.
First, using gprbuild is not always what users will be using to
build their applications. So having the option of using gnatmake
provides more flexibility towards exactly reproducing past bugs.
If we ever need a testcase that requires the use of gprbuild, then
I believe support for a new target needs to be added to dejagnu's
target_compile.
Also, the only real reason behind using a project file in the first
place is that we wanted to make it easy to specify the directory
where all compilation artifacts get stored. This is a consequence
of the organization choice we made for gdb.ada to keep each testcase
well organized. It is very easy to achieve that goal without using
project files.
This is therefore what this patch does: It change gdb_compile_ada
to build any program using gnatmake without using a project file
(by temporarily changing the current working directory).
There is a small (beneficial) side-effect; in the situation where
GDB is built in-tree, gnatmake is called as...
% gnatmake [...] unit.adb
... which means that the debugging info in unit.o will say contain
a filename whose name is 'unit.adb', rather than '/path/to/unit.adb'.
This also better matches what users might typically do. But the side-
effect is that the unit name in the GDB output is not always a full
path. This patch tweaks a couple of testcases to make the path part
optional.
gdb/testsuite:
* lib/ada.exp (target_compile_ada_from_dir): New function.
(gdb_compile_ada): Reimplement avoiding the use of project files.
* gdb.ada/gnat_ada.gpr: Delete.
* gdb.ada/cond_lang.exp: Adjust test to make path before
filename optional.
* gdb.ada/small_reg_param.exp: Likewise.
Tested on x86_64-linux, with both in-tree and out-of-tree builds.
2015-12-22 17:28:41 +08:00
|
|
|
return -options $options $result
|
|
|
|
}
|
|
|
|
|
2020-02-18 17:18:36 +08:00
|
|
|
# Compile some Ada code. Return "" if the compile was successful.
|
2004-04-01 08:51:13 +08:00
|
|
|
|
2020-02-18 17:18:36 +08:00
|
|
|
proc gdb_compile_ada_1 {source dest type options} {
|
2004-04-01 08:51:13 +08:00
|
|
|
|
2005-02-03 11:58:53 +08:00
|
|
|
set srcdir [file dirname $source]
|
|
|
|
set gprdir [file dirname $srcdir]
|
2004-04-01 08:51:13 +08:00
|
|
|
set objdir [file dirname $dest]
|
|
|
|
|
2020-02-13 22:42:07 +08:00
|
|
|
file delete $dest
|
|
|
|
|
[testsuite/Ada] stop using project files when building test programs
The current approach when building Ada programs for testing is
based on the use of a project file (testsuite/gdb.ada/gnat_ada.gpr).
To do that, we pass a number of additional arguments to target_compile,
one of them being the project file (via "-P/path/to/gnat_ada.gpr").
This used to work well-enough, but AdaCore is currently working towards
removing project-file support from gnatmake (the prefered tool for
using project files is gprbuild). So, we need to either switch
the compilation to gprbuild, or stop using project files.
First, using gprbuild is not always what users will be using to
build their applications. So having the option of using gnatmake
provides more flexibility towards exactly reproducing past bugs.
If we ever need a testcase that requires the use of gprbuild, then
I believe support for a new target needs to be added to dejagnu's
target_compile.
Also, the only real reason behind using a project file in the first
place is that we wanted to make it easy to specify the directory
where all compilation artifacts get stored. This is a consequence
of the organization choice we made for gdb.ada to keep each testcase
well organized. It is very easy to achieve that goal without using
project files.
This is therefore what this patch does: It change gdb_compile_ada
to build any program using gnatmake without using a project file
(by temporarily changing the current working directory).
There is a small (beneficial) side-effect; in the situation where
GDB is built in-tree, gnatmake is called as...
% gnatmake [...] unit.adb
... which means that the debugging info in unit.o will say contain
a filename whose name is 'unit.adb', rather than '/path/to/unit.adb'.
This also better matches what users might typically do. But the side-
effect is that the unit name in the GDB output is not always a full
path. This patch tweaks a couple of testcases to make the path part
optional.
gdb/testsuite:
* lib/ada.exp (target_compile_ada_from_dir): New function.
(gdb_compile_ada): Reimplement avoiding the use of project files.
* gdb.ada/gnat_ada.gpr: Delete.
* gdb.ada/cond_lang.exp: Adjust test to make path before
filename optional.
* gdb.ada/small_reg_param.exp: Likewise.
Tested on x86_64-linux, with both in-tree and out-of-tree builds.
2015-12-22 17:28:41 +08:00
|
|
|
# Although strictly not necessary, we force the recompilation
|
|
|
|
# of all units (additional_flags=-f). This is what is done
|
|
|
|
# when using GCC to build programs in the other languages,
|
|
|
|
# and it avoids using a stray objfile file from a long-past
|
|
|
|
# run, for instance.
|
2004-04-01 08:51:13 +08:00
|
|
|
append options " ada"
|
[testsuite/Ada] stop using project files when building test programs
The current approach when building Ada programs for testing is
based on the use of a project file (testsuite/gdb.ada/gnat_ada.gpr).
To do that, we pass a number of additional arguments to target_compile,
one of them being the project file (via "-P/path/to/gnat_ada.gpr").
This used to work well-enough, but AdaCore is currently working towards
removing project-file support from gnatmake (the prefered tool for
using project files is gprbuild). So, we need to either switch
the compilation to gprbuild, or stop using project files.
First, using gprbuild is not always what users will be using to
build their applications. So having the option of using gnatmake
provides more flexibility towards exactly reproducing past bugs.
If we ever need a testcase that requires the use of gprbuild, then
I believe support for a new target needs to be added to dejagnu's
target_compile.
Also, the only real reason behind using a project file in the first
place is that we wanted to make it easy to specify the directory
where all compilation artifacts get stored. This is a consequence
of the organization choice we made for gdb.ada to keep each testcase
well organized. It is very easy to achieve that goal without using
project files.
This is therefore what this patch does: It change gdb_compile_ada
to build any program using gnatmake without using a project file
(by temporarily changing the current working directory).
There is a small (beneficial) side-effect; in the situation where
GDB is built in-tree, gnatmake is called as...
% gnatmake [...] unit.adb
... which means that the debugging info in unit.o will say contain
a filename whose name is 'unit.adb', rather than '/path/to/unit.adb'.
This also better matches what users might typically do. But the side-
effect is that the unit name in the GDB output is not always a full
path. This patch tweaks a couple of testcases to make the path part
optional.
gdb/testsuite:
* lib/ada.exp (target_compile_ada_from_dir): New function.
(gdb_compile_ada): Reimplement avoiding the use of project files.
* gdb.ada/gnat_ada.gpr: Delete.
* gdb.ada/cond_lang.exp: Adjust test to make path before
filename optional.
* gdb.ada/small_reg_param.exp: Likewise.
Tested on x86_64-linux, with both in-tree and out-of-tree builds.
2015-12-22 17:28:41 +08:00
|
|
|
append options " additional_flags=-f"
|
|
|
|
append options " additional_flags=-I$srcdir"
|
2004-04-01 08:51:13 +08:00
|
|
|
|
[testsuite/Ada] stop using project files when building test programs
The current approach when building Ada programs for testing is
based on the use of a project file (testsuite/gdb.ada/gnat_ada.gpr).
To do that, we pass a number of additional arguments to target_compile,
one of them being the project file (via "-P/path/to/gnat_ada.gpr").
This used to work well-enough, but AdaCore is currently working towards
removing project-file support from gnatmake (the prefered tool for
using project files is gprbuild). So, we need to either switch
the compilation to gprbuild, or stop using project files.
First, using gprbuild is not always what users will be using to
build their applications. So having the option of using gnatmake
provides more flexibility towards exactly reproducing past bugs.
If we ever need a testcase that requires the use of gprbuild, then
I believe support for a new target needs to be added to dejagnu's
target_compile.
Also, the only real reason behind using a project file in the first
place is that we wanted to make it easy to specify the directory
where all compilation artifacts get stored. This is a consequence
of the organization choice we made for gdb.ada to keep each testcase
well organized. It is very easy to achieve that goal without using
project files.
This is therefore what this patch does: It change gdb_compile_ada
to build any program using gnatmake without using a project file
(by temporarily changing the current working directory).
There is a small (beneficial) side-effect; in the situation where
GDB is built in-tree, gnatmake is called as...
% gnatmake [...] unit.adb
... which means that the debugging info in unit.o will say contain
a filename whose name is 'unit.adb', rather than '/path/to/unit.adb'.
This also better matches what users might typically do. But the side-
effect is that the unit name in the GDB output is not always a full
path. This patch tweaks a couple of testcases to make the path part
optional.
gdb/testsuite:
* lib/ada.exp (target_compile_ada_from_dir): New function.
(gdb_compile_ada): Reimplement avoiding the use of project files.
* gdb.ada/gnat_ada.gpr: Delete.
* gdb.ada/cond_lang.exp: Adjust test to make path before
filename optional.
* gdb.ada/small_reg_param.exp: Likewise.
Tested on x86_64-linux, with both in-tree and out-of-tree builds.
2015-12-22 17:28:41 +08:00
|
|
|
set result [target_compile_ada_from_dir \
|
2016-01-22 08:20:02 +08:00
|
|
|
$objdir [file tail $source] $dest $type $options]
|
2004-04-01 08:51:13 +08:00
|
|
|
|
|
|
|
# The Ada build always produces some output, even when the build
|
|
|
|
# succeeds. Thus, we can not use the output the same way we do in
|
|
|
|
# gdb_compile to determine whether the build has succeeded or not.
|
|
|
|
# We therefore simply check whether the dest file has been created
|
|
|
|
# or not. Unless not present, the build has succeeded.
|
* lib/gdb.exp (gdb_compile_test): New.
(skip_ada_tests, skip_java_tests): New.
(gdb_compile): Use gdb_compile_test for f77.
* lib/ada.exp (gdb_compile_ada): Use gdb_compile_test to record result.
* lib/java.exp (compile_java_from_source): Remove runtests check,
use gdb_compile_test to record result.
* gdb.ada/packed_array.exp, gdb.ada/fixed_points.exp,
gdb.ada/exec_changed.exp, gdb.ada/start.exp,
gdb.ada/watch_arg.exp, gdb.ada/null_record.exp,
gdb.ada/array_return.exp, gdb.ada/arrayidx.exp,
gdb.mi/mi-var-child-f.exp, gdb.fortran/types.exp,
gdb.fortran/array-element.exp, gdb.fortran/subarray.exp,
gdb.fortran/derived-type.exp, gdb.fortran/exprs.exp,
gdb.java/jmisc.exp, gdb.java/jmisc1.exp, gdb.java/jprint.exp,
gdb.java/jv-print.exp, gdb.java/jmain.exp: Add language skip,
adjust gdb_compile invocations.
2009-11-10 18:16:10 +08:00
|
|
|
if [file exists $dest] { set result "" }
|
2020-02-18 17:18:36 +08:00
|
|
|
return $result
|
|
|
|
}
|
|
|
|
|
|
|
|
# Compile some Ada code. Generate "PASS: foo.exp: compilation SOURCE" if the
|
|
|
|
# compile was successful.
|
|
|
|
|
|
|
|
proc gdb_compile_ada {source dest type options} {
|
|
|
|
set result [gdb_compile_ada_1 $source $dest $type $options]
|
|
|
|
|
* lib/gdb.exp (gdb_compile_test): New.
(skip_ada_tests, skip_java_tests): New.
(gdb_compile): Use gdb_compile_test for f77.
* lib/ada.exp (gdb_compile_ada): Use gdb_compile_test to record result.
* lib/java.exp (compile_java_from_source): Remove runtests check,
use gdb_compile_test to record result.
* gdb.ada/packed_array.exp, gdb.ada/fixed_points.exp,
gdb.ada/exec_changed.exp, gdb.ada/start.exp,
gdb.ada/watch_arg.exp, gdb.ada/null_record.exp,
gdb.ada/array_return.exp, gdb.ada/arrayidx.exp,
gdb.mi/mi-var-child-f.exp, gdb.fortran/types.exp,
gdb.fortran/array-element.exp, gdb.fortran/subarray.exp,
gdb.fortran/derived-type.exp, gdb.fortran/exprs.exp,
gdb.java/jmisc.exp, gdb.java/jmisc1.exp, gdb.java/jprint.exp,
gdb.java/jv-print.exp, gdb.java/jmain.exp: Add language skip,
adjust gdb_compile invocations.
2009-11-10 18:16:10 +08:00
|
|
|
gdb_compile_test $source $result
|
|
|
|
return $result
|
2004-04-01 08:51:13 +08:00
|
|
|
}
|
|
|
|
|
2012-07-27 02:43:02 +08:00
|
|
|
# Like standard_testfile, but for Ada. Historically the Ada tests
|
|
|
|
# used a different naming convention from many of the other gdb tests,
|
|
|
|
# and this difference was preserved during the conversion to
|
|
|
|
# standard_testfile. DIR defaults to the base name of the test case;
|
|
|
|
# but can be overridden to find sources in a different subdirectory of
|
|
|
|
# gdb.ada.
|
|
|
|
|
|
|
|
proc standard_ada_testfile {base_file {dir ""}} {
|
|
|
|
global gdb_test_file_name srcdir subdir
|
|
|
|
global testdir testfile srcfile binfile
|
|
|
|
|
|
|
|
if {$dir == ""} {
|
|
|
|
set testdir $gdb_test_file_name
|
|
|
|
} else {
|
|
|
|
set testdir $dir
|
|
|
|
}
|
|
|
|
|
2016-07-06 22:02:48 +08:00
|
|
|
set testfile $base_file
|
|
|
|
set srcfile $srcdir/$subdir/$testdir/$testfile.adb
|
|
|
|
set binfile [standard_output_file $testfile]
|
2012-07-27 02:43:02 +08:00
|
|
|
}
|
2019-03-28 05:00:21 +08:00
|
|
|
|
|
|
|
# A helper function to find the appropriate version of a tool.
|
|
|
|
# TOOL is the tool's name, e.g., "gnatbind" or "gnatlink".
|
|
|
|
|
|
|
|
proc find_ada_tool {tool} {
|
|
|
|
set upper [string toupper $tool]
|
|
|
|
|
|
|
|
set targname ${upper}_FOR_TARGET
|
|
|
|
global $targname
|
|
|
|
if {[info exists $targname]} {
|
|
|
|
return $targname
|
|
|
|
}
|
|
|
|
|
|
|
|
global tool_root_dir
|
|
|
|
set root "$tool_root_dir/gcc"
|
|
|
|
set result ""
|
|
|
|
|
|
|
|
if {![is_remote host]} {
|
|
|
|
set result [lookfor_file $root $tool]
|
[gdb/testsuite] Fix gdb.ada/catch_ex_std.exp gnatlink FAIL
When running test-case gdb.ada/catch_ex.exp using system gnatmake, gnatmake is
invoked like this:
...
Executing on host: \
gnatmake foo.adb -gnata -f -Isrc/gdb/testsuite/gdb.ada/catch_ex -g -lm \
-o outputs/gdb.ada/catch_ex/foo
...
When I try to use a more recent gnatmake, by mocking up a combined build:
...
$ ls -la build/gcc/
lrwxrwxrwx gfortran -> /usr/bin/gfortran-10
lrwxrwxrwx gnatbind -> /usr/bin/gnatbind-10
lrwxrwxrwx gnatlink -> /usr/bin/gnatlink-10
lrwxrwxrwx gnatmake -> /usr/bin/gnatmake-10
lrwxrwxrwx xg++ -> /usr/bin/g++-10
lrwxrwxrwx xgcc -> /usr/bin/gcc-10
...
gnatmake is invoked like this:
...
Executing on host: \
/data/gdb_versions/devel/build/gcc/gnatmake \
-I/data/gdb_versions/devel/build/gcc/ada/rts \
--GCC=/data/gdb_versions/devel/build/gcc/xgcc \
--GNATBIND=/data/gdb_versions/devel/build/gcc/gnatbind \
--GNATLINK=/data/gdb_versions/devel/build/gcc/gnatlink \
-cargs -B/data/gdb_versions/devel/build/gcc \
-largs --GCC=/data/gdb_versions/devel/build/gcc/xgcc \
-B/data/gdb_versions/devel/build/gcc \
-margs foo.adb -gnata -f -Isrc/gdb/testsuite/gdb.ada/catch_ex -g -lm \
-o outputs/gdb.ada/catch_ex/foo
...
This is set up by this bit in find_gnatmake in
/usr/share/dejagnu/libgloss.exp:
...
if {![is_remote host]} {
set file [lookfor_file $tool_root_dir gnatmake]
if { $file == "" } {
set file [lookfor_file $tool_root_dir gcc/gnatmake]
}
if { $file != "" } {
set root [file dirname $file]
set CC "$file -I$root/ada/rts --GCC=$root/xgcc \
--GNATBIND=$root/gnatbind --GNATLINK=$root/gnatlink \
-cargs -B$root \
-largs --GCC=$root/xgcc -B$root -margs"
} else {
...
However, when running test-case gdb.ada/catch_ex_std.exp using the mockup
combined build, we get:
...
Executing on host: \
/data/gdb_versions/devel/build/gcc/gnatlink foo \
-Wl,-rpath,\$ORIGIN -Wl,-lsome_package
b~foo.adb:26:79: "SS_Stack" not declared in "Secondary_Stack"^M
b~foo.adb:26:89: incorrect constraint for this kind of type^M
b~foo.adb:121:56: "Runtime_Default_Sec_Stack_Size" not declared in "Parameters"^M
FAIL: gdb.ada/catch_ex_std.exp: gnatlink foo
...
The problem is caused by the fact that the test uses gnatlink directly
rather than using gnatmake. The invoked gnatlink (which is gnatlink-10) calls
gcc-7, which are incompatible (see gcc PR86211). This problem doesn't occur
with gnatmake because there the gcc to use is passed as an argument to
gnatlink.
Fix this by adding the -largs bit from find_gnatmake in find_ada_tool, for the
case that $tool == gnatlink.
Tested on x86_64-linux, with system gcc, and gcc-10.
gdb/testsuite/ChangeLog:
2020-04-13 Tom de Vries <tdevries@suse.de>
* lib/ada.exp (find_ada_tool): Pass --GCC and -B to gnatlink, similar
to what find_gnatmake does.
2020-04-14 00:53:14 +08:00
|
|
|
if { $result != "" && $tool == "gnatlink" } {
|
|
|
|
set result "$result --GCC=$root/xgcc -B$root"
|
|
|
|
}
|
2019-03-28 05:00:21 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if {$result == ""} {
|
|
|
|
set result [transform $tool]
|
|
|
|
}
|
|
|
|
|
|
|
|
return $result
|
|
|
|
}
|
2019-09-14 16:35:48 +08:00
|
|
|
|
|
|
|
# Return 1 if gnatmake is at least version $MAJOR.x.x
|
|
|
|
|
|
|
|
proc gnatmake_version_at_least { major } {
|
|
|
|
set gnatmake [gdb_find_gnatmake]
|
|
|
|
set gnatmake [lindex [split $gnatmake] 0]
|
2020-02-13 15:37:34 +08:00
|
|
|
if {[catch {exec $gnatmake --version} output]} {
|
|
|
|
return 0
|
|
|
|
}
|
2019-09-14 16:35:48 +08:00
|
|
|
if { [regexp {GNATMAKE ([^ .]+).([^ .]+).([^ .]+)} $output \
|
|
|
|
match gnatmake_major gnatmake_minor gnatmake_micro] } {
|
|
|
|
if { $gnatmake_major >= $major } {
|
|
|
|
return 1
|
|
|
|
} else {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# Unknown, return 1
|
|
|
|
return 1
|
|
|
|
}
|
2019-12-28 09:58:42 +08:00
|
|
|
|
|
|
|
# Return 1 if the GNAT runtime appears to have debug info.
|
|
|
|
|
|
|
|
gdb_caching_proc gnat_runtime_has_debug_info {
|
|
|
|
global srcdir
|
|
|
|
|
|
|
|
set src "$srcdir/lib/gnat_debug_info_test.adb"
|
|
|
|
set dst [standard_output_file "gnat_debug_info_test"]
|
|
|
|
|
2020-02-18 17:18:36 +08:00
|
|
|
if { [gdb_compile_ada_1 $src $dst executable {debug}] != "" } {
|
2019-12-28 09:58:42 +08:00
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
clean_restart $dst
|
|
|
|
|
|
|
|
if { ! [runto "GNAT_Debug_Info_Test"] } {
|
|
|
|
fail "failed to run to GNAT_Debug_Info_Test"
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
set has_debug_info 0
|
|
|
|
|
|
|
|
gdb_test_multiple "whatis __gnat_debug_raise_exception" "" {
|
|
|
|
-re "type = <text variable, no debug info>" { }
|
|
|
|
-re "type = void" {
|
|
|
|
set has_debug_info 1
|
|
|
|
}
|
|
|
|
default {
|
|
|
|
# Some other unexpected output...
|
|
|
|
fail $gdb_test_name
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return $has_debug_info
|
|
|
|
}
|