This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2] (Ada) New command to stop at start of exception handlers.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]