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] |
Hello, For Ada, we provide a command "catch exception [EXCEPTION_NAME]" that stops the execution when an exception is raised. If an exception name is specified in the command, then the debugger only stops when a specific exception is raised. The matching of the exception is performed through an internal condition that looks like this: long_integer (e) = long_integer (&EXCEPTION_NAME)" (where "e" is a parameter of the function where we inserted the catchpoint that contains a pointer to the exception data). The way it works is: For every EXCEPTION_NAME, the compiler defines an entity whose name is EXCEPTION_NAME (fully qualified). So when we want to verify whether we have raised a given exception, we just verify that its address is the address of the symbol whose name is EXCEPTION_NAME. Ada defines some standard exception names such as Constraint_Error (used when using a value that's out of bounds, for instance), Program_Error, Tasking_Error, etc. With GNAT, these exceptions are defined inside runtime units which are not compiled with debugging info. The situation that we ran into was a situation where the user defined several enumerates whose name was Constraint_Error (there were several enumeration types involved). As a result, the evaluation of the condition above ends up finding the enumerates which had no relevance whatsoever for our condition. We dealt with the situation by taking a compromise: We believe that this type of situation is not very common. In all my years at AdaCore, we have only had one report of such issue. So what we did was make the pre-defined exception names a little special, and assume that "constraint_error" in the catch exception command means the pre-defined exception. If the user ever happened to define his own exception with a name identical to one of the pre-defined exception (which should be very rare), and wants to break on his exception, then he'll have to use the fully-qualified name of his exception. 2008-09-30 Joel Brobecker <brobecker@adacore.com> * ada-lang.c (standard_exc): New static constant. (ada_exception_catchpoint_cond_string): Add special handling for the predefined exceptions. Tested on x86-linux. Checked in. I will see if I can add a note in our documentation about this (as a separate patch). -- Joel
Attachment:
std-exc.diff
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |