Fix "catch exception" with dynamic linking
authorTom Tromey <tromey@adacore.com>
Wed, 27 Mar 2019 21:00:21 +0000 (15:00 -0600)
committerTom Tromey <tromey@adacore.com>
Tue, 30 Apr 2019 13:32:11 +0000 (07:32 -0600)
commit2ff0a947394eebf5ff9cd26088dce60ec8c10b48
tree9aab473acb25d94e6d595dcc1860ca53f356b553
parenta776957c8c3a9177345ee7ca91077234ed7f508e
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.
gdb/ChangeLog
gdb/ada-lang.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.ada/catch_ex_std.exp [new file with mode: 0644]
gdb/testsuite/gdb.ada/catch_ex_std/foo.adb [new file with mode: 0644]
gdb/testsuite/gdb.ada/catch_ex_std/some_package.adb [new file with mode: 0644]
gdb/testsuite/gdb.ada/catch_ex_std/some_package.ads [new file with mode: 0644]
gdb/testsuite/lib/ada.exp
gdb/testsuite/lib/gdb.exp
This page took 0.02766 seconds and 4 git commands to generate.