public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [commit/Ada] wrong "catch exception" error message when finding trampoline msym.
@ 2013-10-01  9:14 Joel Brobecker
  2013-10-01 15:42 ` Tom Tromey
  0 siblings, 1 reply; 4+ messages in thread
From: Joel Brobecker @ 2013-10-01  9:14 UTC (permalink / raw)
  To: gdb-patches

When building the program with the shared GNAT runtime, the debugger
is unable to insert Ada exception catchpoints until that runtime
has been mapped to memory. In other words, we expect the user to start
the program first, before attempting to insert that catchpoint.

The detection mechanism that tries to provide some useful tips to
the user fails when the program itself contains a trampoline symbol
matching the symbol that the catchpoint is trying to use. This
results in the following error message:

    (gdb) catch exception
    Your Ada runtime appears to be missing some debugging information.
    Cannot insert Ada exception catchpoint in this configuration.

Instead, we expected the following error message:

    (gdb) catch exception
    Unable to insert catchpoint. Try to start the program first.

gdb/ChangeLog:

        * ada-lang.c (ada_has_this_exception_support): Ignore
        mst_solib_trampoline minimal symbols.

Tested on x86_64-linux. Will check it in momentarily.

---
 gdb/ada-lang.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index d2b0ed2..62ca50c 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -11039,7 +11039,10 @@ ada_has_this_exception_support (const struct exception_support_info *einfo)
 	 the name of the exception being raised (this name is printed in
 	 the catchpoint message, and is also used when trying to catch
 	 a specific exception).  We do not handle this case for now.  */
-      if (lookup_minimal_symbol (einfo->catch_exception_sym, NULL, NULL))
+      struct minimal_symbol *msym
+	= lookup_minimal_symbol (einfo->catch_exception_sym, NULL, NULL);
+
+      if (msym && MSYMBOL_TYPE (msym) != mst_solib_trampoline)
 	error (_("Your Ada runtime appears to be missing some debugging "
 		 "information.\nCannot insert Ada exception catchpoint "
 		 "in this configuration."));
-- 
1.8.1.2

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [commit/Ada] wrong "catch exception" error message when finding trampoline msym.
  2013-10-01  9:14 [commit/Ada] wrong "catch exception" error message when finding trampoline msym Joel Brobecker
@ 2013-10-01 15:42 ` Tom Tromey
  2013-10-01 15:55   ` Joel Brobecker
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Tromey @ 2013-10-01 15:42 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:

Joel> When building the program with the shared GNAT runtime, the debugger
Joel> is unable to insert Ada exception catchpoints until that runtime
Joel> has been mapped to memory. In other words, we expect the user to start
Joel> the program first, before attempting to insert that catchpoint.

I'm curious why it doesn't make a pending breakpoint.
This is, in effect, what "catch catch" and "catch throw" do.

It's done manually there, by supplying a re_set method.
See break-catch-throw.c:re_set_exception_catchpoint.

Tom

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [commit/Ada] wrong "catch exception" error message when finding trampoline msym.
  2013-10-01 15:42 ` Tom Tromey
@ 2013-10-01 15:55   ` Joel Brobecker
  2013-10-02  8:59     ` Jerome Guitton
  0 siblings, 1 reply; 4+ messages in thread
From: Joel Brobecker @ 2013-10-01 15:55 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

> Joel> When building the program with the shared GNAT runtime, the debugger
> Joel> is unable to insert Ada exception catchpoints until that runtime
> Joel> has been mapped to memory. In other words, we expect the user to start
> Joel> the program first, before attempting to insert that catchpoint.
> 
> I'm curious why it doesn't make a pending breakpoint.
> This is, in effect, what "catch catch" and "catch throw" do.
> 
> It's done manually there, by supplying a re_set method.
> See break-catch-throw.c:re_set_exception_catchpoint.

Thanks for the tip. We've never looked at this mostly because no one
has ever asked for it.  I will keep that in mind, though.

-- 
Joel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [commit/Ada] wrong "catch exception" error message when finding trampoline msym.
  2013-10-01 15:55   ` Joel Brobecker
@ 2013-10-02  8:59     ` Jerome Guitton
  0 siblings, 0 replies; 4+ messages in thread
From: Jerome Guitton @ 2013-10-02  8:59 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: Tom Tromey, gdb-patches

Joel Brobecker (brobecker@adacore.com):

> > I'm curious why it doesn't make a pending breakpoint.
> > This is, in effect, what "catch catch" and "catch throw" do.
> 
> Thanks for the tip. We've never looked at this mostly because no one
> has ever asked for it.  I will keep that in mind, though.

There could be a problem for configurations where exception
propagation is not supported. In such a case, the Ada run-time lib
does not contain __gnat_debug_raise_exception. So here having a error
message would be better than silently accepting the command and adding
a pending breakpoint that would never be resolved.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-10-02  8:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-01  9:14 [commit/Ada] wrong "catch exception" error message when finding trampoline msym Joel Brobecker
2013-10-01 15:42 ` Tom Tromey
2013-10-01 15:55   ` Joel Brobecker
2013-10-02  8:59     ` Jerome Guitton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).