This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v2] (Ada) New command to stop at start of exception handlers.
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Eli Zaretskii <eliz at gnu dot org>
- Cc: Xavier Roirand <roirand at adacore dot com>, gdb-patches at sourceware dot org
- Date: Wed, 20 Dec 2017 08:45:09 +0400
- Subject: Re: [PATCH v2] (Ada) New command to stop at start of exception handlers.
- Authentication-results: sourceware.org; auth=none
- References: <1513693765-20655-1-git-send-email-roirand@adacore.com> <834lomptj8.fsf@gnu.org>
Hi Eli,
Thanks for the documentation review.
> > +When inserting an handle catchpoint on a user-defined
> > +exception whose name is identical to one of the exceptions
> > +defined by the language, the fully qualified name must be used
> > +as the exception name. Otherwise, @value{GDBN} will assume that it
> > +should stop on the pre-defined exception rather than the
> > +user-defined one. For instance, assuming an exception called
> > + @code{Constraint_Error} is defined in package @code{Pck}, then the
> > +command to use to catch such exceptions handling is
> > +@kbd{catch handle Pck.Constraint_Error}.
>
> This is OK Texinfo-wise, but I wonder whether this default is useful.
> Why not default to the user-defined exception instead in such cases?
> (I'm not an Ada programmer, so apologies if this makes no sense.)
The default that Xavier describes in the documentation is the behavior
we have had for the "catch exception" command for quite a long time,
which is not surprising, as the patch simply reuses that code. So
he simply "inherits" that behavior.
It's extremely rare that a user would define their own exception
using the same name as the name of a standard exception. When
they do, to use it in their code, they must either qualify
the exception name, or else tell the compiler that symbols from
the scope where the exception name is defined can be accessed
without qualifying. Given those elements, we felt at the time
that favoring the system exception over the (rare) user-defined
one would be the more useful default most of the time. Either
way, it should almost never matters in practice.
--
Joel