aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/lib
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2019-03-27 15:00:21 -0600
committerTom Tromey <tromey@adacore.com>2019-04-30 07:32:11 -0600
commit2ff0a947394eebf5ff9cd26088dce60ec8c10b48 (patch)
tree9aab473acb25d94e6d595dcc1860ca53f356b553 /gdb/testsuite/lib
parenta776957c8c3a9177345ee7ca91077234ed7f508e (diff)
downloadgdb-2ff0a947394eebf5ff9cd26088dce60ec8c10b48.zip
gdb-2ff0a947394eebf5ff9cd26088dce60ec8c10b48.tar.gz
gdb-2ff0a947394eebf5ff9cd26088dce60ec8c10b48.tar.bz2
Fix "catch exception" with dynamic linking
When an Ada program is dynamically linked against libgnat, and when one of the standard exceptions is used, the exception object may be referenced by the main executable using a copy relocation. In this situation, a "catch exception" for those exceptions will not manage to stop. This happens because, under the hood, "catch exception" creates an expression object that examines the object addresses -- but in this case, the address will be incorrect. This patch fixes the problem by arranging for these filter expressions to examine all the relevant minimal symbols. This way, the object from libgnat will be found as well. Tested on x86-64 Fedora 29. gdb/ChangeLog 2019-04-30 Tom Tromey <tromey@adacore.com> * ada-lang.c (ada_lookup_simple_minsyms): New function. (create_excep_cond_exprs): Iterate over program spaces. (ada_exception_catchpoint_cond_string): Examine all minimal symbols for exception types. gdb/testsuite/ChangeLog 2019-04-30 Tom Tromey <tromey@adacore.com> * lib/ada.exp (find_ada_tool): New proc. * lib/gdb.exp (gdb_compile_shlib): Allow .o files as inputs. * gdb.ada/catch_ex_std.exp: New file. * gdb.ada/catch_ex_std/foo.adb: New file. * gdb.ada/catch_ex_std/some_package.adb: New file. * gdb.ada/catch_ex_std/some_package.ads: New file.
Diffstat (limited to 'gdb/testsuite/lib')
-rw-r--r--gdb/testsuite/lib/ada.exp27
-rw-r--r--gdb/testsuite/lib/gdb.exp15
2 files changed, 37 insertions, 5 deletions
diff --git a/gdb/testsuite/lib/ada.exp b/gdb/testsuite/lib/ada.exp
index ee9ade1..1345c74 100644
--- a/gdb/testsuite/lib/ada.exp
+++ b/gdb/testsuite/lib/ada.exp
@@ -78,3 +78,30 @@ proc standard_ada_testfile {base_file {dir ""}} {
set srcfile $srcdir/$subdir/$testdir/$testfile.adb
set binfile [standard_output_file $testfile]
}
+
+# 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]
+ }
+
+ if {$result == ""} {
+ set result [transform $tool]
+ }
+
+ return $result
+}
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 25d370e..57866da 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -3832,11 +3832,16 @@ proc gdb_compile_shlib {sources dest options} {
set outdir [file dirname $dest]
set objects ""
foreach source $sources {
- set sourcebase [file tail $source]
- if {[gdb_compile $source "${outdir}/${sourcebase}.o" object $obj_options] != ""} {
- return -1
- }
- lappend objects ${outdir}/${sourcebase}.o
+ set sourcebase [file tail $source]
+ if {[file extension $source] == ".o"} {
+ # Already a .o file.
+ lappend objects $source
+ } elseif {[gdb_compile $source "${outdir}/${sourcebase}.o" object \
+ $obj_options] != ""} {
+ return -1
+ } else {
+ lappend objects ${outdir}/${sourcebase}.o
+ }
}
set link_options $options