public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [RFA/Ada(v2) 3/3] Document "info exceptions" and "-info-ada-exception" new commands.
  2013-11-08 12:04 RFA/Ada (v2) new CLI + GDB/MI commands to list Ada exceptions Joel Brobecker
@ 2013-11-08 12:04 ` Joel Brobecker
  2013-11-08 14:21   ` Eli Zaretskii
  2013-11-12  4:07   ` Joel Brobecker
  2013-11-08 12:05 ` [RFA/Ada(v2) 1/3] Add command to list Ada exceptions Joel Brobecker
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 24+ messages in thread
From: Joel Brobecker @ 2013-11-08 12:04 UTC (permalink / raw)
  To: gdb-patches

Hello,

This is the doco & NEWS patch.

gdb/doc/ChangeLog:

        * gdb.texinfo (Ada): Add entry in menu for new "Ada Exceptions" node.
        (Ada Exceptions): New node.
        (GDB/MI): Add entry in menu for new "GDB/MI Ada Exceptions
        Commands" node.
        (GDB/MI Ada Exceptions Commands): New node.
        (GDB/MI Miscellaneous Commands): Document new "info-ada-exceptions"
        field in the output of the "-list-features" command.
        * NEWS: Add entry for the new "info exceptions" CLI command,
        and for the new "-info-ada-exceptions" GDB/MI command.

Tested by rebuilding and inspecting all doc formats.
OK to commit?

Thank you,
-- 
Joel

---
 gdb/NEWS            |  9 +++++
 gdb/doc/gdb.texinfo | 95 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 103 insertions(+), 1 deletion(-)

diff --git a/gdb/NEWS b/gdb/NEWS
index efeda68..62fc172 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -80,6 +80,12 @@ remove-symbol-file -a ADDRESS
   can be identified by its filename or by an address that lies within
   the boundaries of this symbol file in memory.
 
+info exceptions
+info exceptions REGEXP
+  Display the list of Ada exceptions defined in the program being
+  debugged.  If provided, only the exceptions whose name match REGEXP
+  are listed.
+
 * New options
 
 set debug symfile off|on
@@ -163,6 +169,9 @@ show startup-with-shell
   ** The new commands -catch-assert and -catch-exceptions insert
      catchpoints stopping the program when Ada exceptions are raised.
 
+  ** The new command -info-ada-exceptions provides the equivalent of
+     the new "info exceptions" command.
+
 * New system-wide configuration scripts
   A GDB installation now provides scripts suitable for use as system-wide
   configuration scripts for the following systems:
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 39498d7..3eed0af 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -14965,6 +14965,7 @@ to be difficult.
 * Omissions from Ada::          Restrictions on the Ada expression syntax.
 * Additions to Ada::            Extensions of the Ada expression syntax.
 * Stopping Before Main Program:: Debugging the program during elaboration.
+* Ada Exceptions::              Ada Exceptions
 * Ada Tasks::                   Listing and setting breakpoints in tasks.
 * Ada Tasks and Core Files::    Tasking Support when Debugging Core Files
 * Ravenscar Profile::           Tasking Support when using the Ravenscar
@@ -15289,6 +15290,42 @@ Manual, the elaboration code is invoked from a procedure called
 elaboration, simply use the following two commands:
 @code{tbreak adainit} and @code{run}.
 
+@node Ada Exceptions
+@subsubsection Ada Exceptions
+
+A command is provided to list all Ada exceptions:
+
+@table @code
+@kindex info exceptions
+@item info exceptions
+@itemx info exceptions @var{regexp}
+The @code{info exceptions} command allows you to list all Ada exceptions
+defined within the program being debugged, as well as their address.
+With a regular expression, @var{regexp}, as argument, only those exceptions
+whose name matches @var{regexp} are listed.
+@end table
+
+Below is a small example, showing how the command can be used, first
+without argument, and next with a regular expression passed as an
+argument.
+
+@smallexample
+(@value{GDBP}) info exceptions
+All defined Ada exceptions:
+constraint_error: 0x613da0
+program_error: 0x613d20
+storage_error: 0x613ce0
+tasking_error: 0x613ca0
+const.aint_global_e: 0x613b00
+(@value{GDBP}) info exceptions const.aint
+All Ada exceptions matching regular expression "const.aint":
+constraint_error: 0x613da0
+const.aint_global_e: 0x613b00
+@end smallexample
+
+It is also possible to ask @value{GDBN} to stop your program's execution
+when an exception is raised.  For more details, see @ref{Set Catchpoints}.
+
 @node Ada Tasks
 @subsubsection Extensions for Ada Tasks
 @cindex Ada, tasking
@@ -28603,6 +28640,7 @@ may repeat one or more times.
 @end ignore
 * GDB/MI Target Manipulation::
 * GDB/MI File Transfer Commands::
+* GDB/MI Ada Exceptions Commands::
 * GDB/MI Miscellaneous Commands::
 @end menu
 
@@ -34692,6 +34730,59 @@ The corresponding @value{GDBN} command is @samp{remote delete}.
 
 
 @c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@node GDB/MI Ada Exceptions Commands
+@section Ada Exceptions @sc{gdb/mi} Commands
+
+@subheading The @code{-info-ada-exceptions} Command
+@findex -info-ada-exceptions
+
+@subsubheading Synopsis
+
+@smallexample
+ -info-ada-exceptions [ @var{regexp}]
+@end smallexample
+
+List all Ada exceptions defined within the program being debugged.
+With a regular expression @var{regexp}, only those exceptions whose
+name matches @var{regexp} are listed.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{info exceptions}.
+
+@subsubheading Result
+
+The result is a table of Ada exceptions.  The following columns are
+defined for each exception:
+
+@table @samp
+@item name
+The name of the exception.
+
+@item address
+The address of the exception.
+
+@end table
+
+@subsubheading Example
+
+@smallexample
+-info-ada-exceptions aint
+^done,ada-exceptions=@{nr_rows="2",nr_cols="2",
+hdr=[@{width="1",alignment="-1",col_name="name",colhdr="Name"@},
+@{width="1",alignment="-1",col_name="address",colhdr="Address"@}],
+body=[@{name="constraint_error",address="0x0000000000613da0"@},
+@{name="const.aint_global_e",address="0x0000000000613b00"@}]@}
+@end smallexample
+
+@subheading Catching Ada Exceptions
+
+The commands describing how to ask @value{GDBN} to stop when a program
+raises an exception are described at @ref{Ada Exception GDB/MI
+Catchpoint Commands}.
+
+
+@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 @node GDB/MI Miscellaneous Commands
 @section Miscellaneous @sc{gdb/mi} Commands
 
@@ -34877,7 +34968,9 @@ Indicates support for the @code{-data-read-memory-bytes} and the
 Indicates that changes to breakpoints and breakpoints created via the
 CLI will be announced via async records.
 @item ada-task-info
-Indicates support for the @code{-ada-task-info} command.
+indicates support for the @code{-ada-task-info} command.
+@item info-ada-exceptions
+indicates support for the @code{-info-ada-exceptions} command.
 @end table
 
 @subheading The @code{-list-target-features} Command
-- 
1.8.1.2

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

* RFA/Ada (v2) new CLI + GDB/MI commands to list Ada exceptions
@ 2013-11-08 12:04 Joel Brobecker
  2013-11-08 12:04 ` [RFA/Ada(v2) 3/3] Document "info exceptions" and "-info-ada-exception" new commands Joel Brobecker
                   ` (3 more replies)
  0 siblings, 4 replies; 24+ messages in thread
From: Joel Brobecker @ 2013-11-08 12:04 UTC (permalink / raw)
  To: gdb-patches

Following the review of the patches posted at:
http://www.sourceware.org/ml/gdb-patches/2013-11/msg00175.html

Here is a new version.  I believe I followed all the suggestions
made so far (Thank You, Tom and Eli!).

I also added "info-ada-exceptions" to the -list-features command output,
which I just only (re-)discovered.

And this series also includes a doco+NEWS patch, for Eli to review.

Other than that, no other changes.

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

* [RFA/Ada(v2) 1/3] Add command to list Ada exceptions
  2013-11-08 12:04 RFA/Ada (v2) new CLI + GDB/MI commands to list Ada exceptions Joel Brobecker
  2013-11-08 12:04 ` [RFA/Ada(v2) 3/3] Document "info exceptions" and "-info-ada-exception" new commands Joel Brobecker
@ 2013-11-08 12:05 ` Joel Brobecker
  2013-11-08 13:40   ` Pedro Alves
  2013-11-13 17:04   ` Tom Tromey
  2013-11-08 12:27 ` [RFA/Ada(v2) 2/3] Implement GDB/MI equivalent of "info exceptions" CLI command Joel Brobecker
  2013-11-12  3:38 ` RFA/Ada (v2) new CLI + GDB/MI commands to list Ada exceptions Joel Brobecker
  3 siblings, 2 replies; 24+ messages in thread
From: Joel Brobecker @ 2013-11-08 12:05 UTC (permalink / raw)
  To: gdb-patches

This patch adds a new command "info exceptions" whose purpose is to
provide the list of exceptions currently defined in the inferior.
The usage is:

    (gdb) info exceptions [REGEXP]

Without argument, the command lists all exceptions.  Otherwise,
only those whose name match REGEXP are listed.

For instance:

    (gdb) info exceptions
    All defined Ada exceptions:
    constraint_error: 0x613dc0
    program_error: 0x613d40
    storage_error: 0x613d00
    tasking_error: 0x613cc0
    global_exceptions.a_global_exception: 0x613a80
    global_exceptions.a_private_exception: 0x613ac0

The name of the command, as well as its output is part of a legacy
I inherited long ago. It's output being parsed by frontends such as
GPS, I cannot easily change it. Same for the command name.

The implementation is mostly self-contained, and is written in a way
that should make it easy to implement the GDB/MI equivalent. The
careful reviewer will notice that the code added in ada-lang.h could
normally be made private inside ada-lang.c.  But these will be used
by the GDB/MI implementation.  Rather than making those private now,
only to move them later, I've made them public right away.

gdb/ChangeLog:

        * ada-lang.h: #include "vec.h".
        (struct ada_exc_info): New.
        (ada_exc_info): New typedef.
        (DEF_VEC_O(ada_exc_info): New vector.
        (ada_exceptions_list): Add declaration.
        * ada-lang.c (ada_is_exception_sym)
        (ada_is_non_standard_exception_sym, compare_ada_exception_info)
        (sort_remove_dups_ada_exceptions_list)
        (ada_exc_search_name_matches, ada_add_standard_exceptions)
        (ada_add_exceptions_from_frame, ada_add_global_exceptions)
        (ada_exceptions_list, info_exceptions_command): New function.
        (_initialize_ada_language): Add "info exception" command.

gdb/testsuite/ChangeLog:

        * info_exc: New testcase.

Tested on x86_64-linux. OK to checkin?

---
 gdb/ada-lang.c                           | 340 +++++++++++++++++++++++++++++++
 gdb/ada-lang.h                           |  16 ++
 gdb/testsuite/gdb.ada/info_exc.exp       |  57 ++++++
 gdb/testsuite/gdb.ada/info_exc/const.ads |  18 ++
 gdb/testsuite/gdb.ada/info_exc/foo.adb   |  20 ++
 5 files changed, 451 insertions(+)
 create mode 100644 gdb/testsuite/gdb.ada/info_exc.exp
 create mode 100644 gdb/testsuite/gdb.ada/info_exc/const.ads
 create mode 100644 gdb/testsuite/gdb.ada/info_exc/foo.adb

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 3b1e196..55da135 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -12284,6 +12284,340 @@ catch_assert_command (char *arg, int from_tty,
 				   tempflag, 1 /* enabled */,
 				   from_tty);
 }
+
+/* Return non-zero if the symbol SYM is an Ada exception object.  */
+
+static int
+ada_is_exception_sym (struct symbol *sym)
+{
+  const char *type_name = type_name_no_tag (SYMBOL_TYPE (sym));
+
+  return (SYMBOL_CLASS (sym) != LOC_TYPEDEF
+          && SYMBOL_CLASS (sym) != LOC_BLOCK
+          && SYMBOL_CLASS (sym) != LOC_CONST
+          && SYMBOL_CLASS (sym) != LOC_UNRESOLVED
+          && type_name != NULL && strcmp (type_name, "exception") == 0);
+}
+
+/* Given a global symbol SYM, return non-zero iff SYM is a non-standard
+   Ada exception object.  This matches all exceptions except the ones
+   defined by the Ada language.  */
+
+static int
+ada_is_non_standard_exception_sym (struct symbol *sym)
+{
+  int i;
+
+  if (!ada_is_exception_sym (sym))
+    return 0;
+
+  for (i = 0; i < ARRAY_SIZE (standard_exc); i++)
+    if (strcmp (SYMBOL_LINKAGE_NAME (sym), standard_exc[i]) == 0)
+      return 0;  /* A standard exception.  */
+
+  /* Numeric_Error is also a standard exception, so exclude it.
+     See the STANDARD_EXC description for more details as to why
+     this exception is not listed in that array.  */
+  if (strcmp (SYMBOL_LINKAGE_NAME (sym), "numeric_error") == 0)
+    return 0;
+
+  return 1;
+}
+
+/* A helper function for qsort, comparing two struct ada_exc_info
+   objects.
+
+   The comparison is determined first by exception name, and then
+   by exception address.  */
+
+static int
+compare_ada_exception_info (const void *a, const void *b)
+{
+  const struct ada_exc_info *exc_a = (struct ada_exc_info *) a;
+  const struct ada_exc_info *exc_b = (struct ada_exc_info *) b;
+  int result;
+
+  result = strcmp (exc_a->name, exc_b->name);
+  if (result != 0)
+    return result;
+
+  if (exc_a->addr < exc_b->addr)
+    return -1;
+  if (exc_a->addr > exc_b->addr)
+    return 1;
+
+  return 0;
+}
+
+/* Sort EXCEPTIONS using compare_ada_exception_info as the comparison
+   routine, but keeping the first SKIP elements untouched.
+
+   All duplicates are also removed.  */
+
+static void
+sort_remove_dups_ada_exceptions_list (VEC(ada_exc_info) **exceptions,
+				      int skip)
+{
+  struct ada_exc_info *to_sort
+    = VEC_address (ada_exc_info, *exceptions) + skip;
+  int to_sort_len
+    = VEC_length (ada_exc_info, *exceptions) - skip;
+  int i, j;
+
+  qsort (to_sort, to_sort_len, sizeof (struct ada_exc_info),
+	 compare_ada_exception_info);
+
+  for (i = 1, j = 1; i < to_sort_len; i++)
+    if (compare_ada_exception_info (&to_sort[i], &to_sort[j - 1]) != 0)
+      to_sort[j++] = to_sort[i];
+  to_sort_len = j;
+  VEC_truncate(ada_exc_info, *exceptions, skip + to_sort_len);
+}
+
+/* A function intended as the "name_matcher" callback in the struct
+   quick_symbol_functions' expand_symtabs_matching method.
+
+   SEARCH_NAME is the symbol's search name.
+
+   If USER_DATA is not NULL, it is a pointer to a regext_t object
+   used to match the symbol (by natural name).  Otherwise, when USER_DATA
+   is null, no filtering is performed, and all symbols are a positive
+   match.  */
+
+static int
+ada_exc_search_name_matches (const char *search_name, void *user_data)
+{
+  regex_t *preg = user_data;
+
+  if (preg == NULL)
+    return 1;
+
+  /* In Ada, the symbol "search name" is a linkage name, whereas
+     the regular expression used to do the matching refers to
+     the natural name.  So match against the decoded name.  */
+  return (regexec (preg, ada_decode (search_name), 0, NULL, 0) == 0);
+}
+
+/* Add all exceptions defined by the Ada standard whose name match
+   a regular expression.
+
+   If PREG is not NULL, then this regexp_t object is used to
+   perform the symbol name matching.  Otherwise, no name-based
+   filtering is performed.
+
+   EXCEPTIONS is a vector of exceptions to which matching exceptions
+   gets pushed.  */
+
+static void
+ada_add_standard_exceptions (regex_t *preg, VEC(ada_exc_info) **exceptions)
+{
+  int i;
+
+  for (i = 0; i < ARRAY_SIZE (standard_exc); i++)
+    {
+      if (preg == NULL
+	  || regexec (preg, standard_exc[i], 0, NULL, 0) == 0)
+	{
+	  struct bound_minimal_symbol msymbol
+	    = ada_lookup_simple_minsym (standard_exc[i]);
+
+	  if (msymbol.minsym != NULL)
+	    {
+	      struct ada_exc_info info
+		= {standard_exc[i], SYMBOL_VALUE_ADDRESS (msymbol.minsym)};
+
+	      VEC_safe_push (ada_exc_info, *exceptions, &info);
+	    }
+	}
+    }
+}
+
+/* Add all Ada exceptions defined locally and accessible from the given
+   FRAME.
+
+   If PREG is not NULL, then this regexp_t object is used to
+   perform the symbol name matching.  Otherwise, no name-based
+   filtering is performed.
+
+   EXCEPTIONS is a vector of exceptions to which matching exceptions
+   gets pushed.  */
+
+static void
+ada_add_exceptions_from_frame (regex_t *preg, struct frame_info *frame,
+			       VEC(ada_exc_info) **exceptions)
+{
+  struct block *block = get_frame_block (frame, 0);
+
+  while (block != 0)
+    {
+      struct block_iterator iter;
+      struct symbol *sym;
+
+      ALL_BLOCK_SYMBOLS (block, iter, sym)
+	{
+	  switch (SYMBOL_CLASS (sym))
+	    {
+	    case LOC_TYPEDEF:
+	    case LOC_BLOCK:
+	    case LOC_CONST:
+	      break;
+	    default:
+	      if (ada_is_exception_sym (sym))
+		{
+		  struct ada_exc_info info = {SYMBOL_PRINT_NAME (sym),
+					      SYMBOL_VALUE_ADDRESS (sym)};
+
+		  VEC_safe_push (ada_exc_info, *exceptions, &info);
+		}
+	    }
+	}
+      if (BLOCK_FUNCTION (block) != NULL)
+	break;
+      block = BLOCK_SUPERBLOCK (block);
+    }
+}
+
+/* Add all exceptions defined globally whose name name match
+   a regular expression, excluding standard exceptions.
+
+   The reason we exclude standard exceptions is that they need
+   to be handled separately: Standard exceptions are defined inside
+   a runtime unit which is normally not compiled with debugging info,
+   and thus usually do not show up in our symbol search.  However,
+   if the unit was in fact built with debugging info, we need to
+   exclude them because they would duplicate the entry we found
+   during the special loop that specifically searches for those
+   standard exceptions.
+
+   If PREG is not NULL, then this regexp_t object is used to
+   perform the symbol name matching.  Otherwise, no name-based
+   filtering is performed.
+
+   EXCEPTIONS is a vector of exceptions to which matching exceptions
+   gets pushed.  */
+
+static void
+ada_add_global_exceptions (regex_t *preg, VEC(ada_exc_info) **exceptions)
+{
+  struct objfile *objfile;
+  struct symtab *s;
+
+  ALL_OBJFILES (objfile)
+    if (objfile->sf)
+      objfile->sf->qf->expand_symtabs_matching
+	(objfile, NULL, ada_exc_search_name_matches,
+	 VARIABLES_DOMAIN, preg);
+
+  ALL_PRIMARY_SYMTABS (objfile, s)
+    {
+      struct blockvector *bv = BLOCKVECTOR (s);
+      int i;
+
+      for (i = GLOBAL_BLOCK; i <= STATIC_BLOCK; i++)
+	{
+	  struct block *b = BLOCKVECTOR_BLOCK (bv, i);
+	  struct block_iterator iter;
+	  struct symbol *sym;
+
+	  ALL_BLOCK_SYMBOLS (b, iter, sym)
+	    if (ada_is_non_standard_exception_sym (sym)
+		&& (preg == NULL
+		    || regexec (preg, SYMBOL_NATURAL_NAME (sym),
+				0, NULL, 0) == 0))
+	      {
+		struct ada_exc_info info
+		  = {SYMBOL_PRINT_NAME (sym), SYMBOL_VALUE_ADDRESS (sym)};
+
+		VEC_safe_push (ada_exc_info, *exceptions, &info);
+	      }
+	}
+    }
+}
+
+/* Return a vector of ada_exc_info.
+
+   If REGEXP is NULL, all exceptions are included in the result.
+   Otherwise, it should contain a valid regular expression,
+   and only the exceptions whose name match that regular expression
+   are included in the result.
+
+   The exceptions are sorted in the following order:
+     - Standard exceptions (defined by the Ada language), in
+       alphabetical order;
+     - Exceptions only visible from the current frame, in
+       alphabetical order;
+     - Exceptions whose scope is global, in alphabetical order.  */
+
+VEC(ada_exc_info) *
+ada_exceptions_list (const char *regexp)
+{
+  VEC(ada_exc_info) *result = NULL;
+  struct cleanup *old_chain
+    = make_cleanup (VEC_cleanup (ada_exc_info), &result);
+  regex_t *preg = NULL;
+  int prev_len;
+
+  if (regexp != NULL)
+    {
+      preg = alloca (sizeof (regex_t));
+      compile_rx_or_error (preg, regexp, _("invalid regular expression"));
+    }
+
+  /* First, list the known standard exceptions.  These exceptions
+     need to be handled separately, as they are usually defined in
+     runtime units that have been compiled without debugging info.  */
+
+  ada_add_standard_exceptions (preg, &result);
+
+  /* Next, find all exceptions whose scope is local and accessible
+     from the currently selected frame.  */
+
+  if (target_has_registers)
+    {
+      prev_len = VEC_length (ada_exc_info, result);
+      ada_add_exceptions_from_frame (preg, get_selected_frame (NULL),
+				     &result);
+      if (VEC_length (ada_exc_info, result) > prev_len)
+	sort_remove_dups_ada_exceptions_list (&result, prev_len);
+    }
+
+  /* Add all exceptions whose scope is global.  */
+
+  prev_len = VEC_length (ada_exc_info, result);
+  ada_add_global_exceptions (preg, &result);
+  if (VEC_length (ada_exc_info, result) > prev_len)
+    sort_remove_dups_ada_exceptions_list (&result, prev_len);
+
+  discard_cleanups (old_chain);
+  return result;
+}
+
+/* Implement the "info exceptions" command.  */
+
+static void
+info_exceptions_command (char *regexp, int from_tty)
+{
+  VEC(ada_exc_info) *exceptions;
+  struct cleanup *cleanup;
+  struct gdbarch *gdbarch = get_current_arch ();
+  int ix;
+  struct ada_exc_info *info;
+
+  exceptions = ada_exceptions_list (regexp);
+  cleanup = make_cleanup (VEC_cleanup (ada_exc_info), &exceptions);
+
+  if (regexp != NULL)
+    printf_filtered
+      (_("All Ada exceptions matching regular expression \"%s\":\n"), regexp);
+  else
+    printf_filtered (_("All defined Ada exceptions:\n"));
+
+  for (ix = 0; VEC_iterate(ada_exc_info, exceptions, ix, info); ix++)
+    printf_filtered ("%s: %s\n", info->name, paddress (gdbarch, info->addr));
+
+  do_cleanups (cleanup);
+}
+
                                 /* Operators */
 /* Information about operators given special treatment in functions
    below.  */
@@ -12955,6 +13289,12 @@ With an argument, catch only exceptions with the given name."),
 
   varsize_limit = 65536;
 
+  add_info ("exceptions", info_exceptions_command,
+	    _("\
+List all Ada exception names.\n\
+If a regular expression is passed as an argument, only those matching\n\
+the regular expression are listed."));
+
   obstack_init (&symbol_list_obstack);
 
   decoded_names_store = htab_create_alloc
diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h
index 151ced8..eba2802 100644
--- a/gdb/ada-lang.h
+++ b/gdb/ada-lang.h
@@ -27,6 +27,7 @@ struct type_print_options;
 #include "value.h"
 #include "gdbtypes.h"
 #include "breakpoint.h"
+#include "vec.h"
 
 /* Names of specific files known to be part of the runtime
    system and that might consider (confusing) debugging information.
@@ -389,6 +390,21 @@ extern void create_ada_exception_catchpoint
    char *excep_string, char *cond_string, int tempflag, int disabled,
    int from_tty);
 
+/* Some information about a given Ada exception.  */
+
+typedef struct ada_exc_info
+{
+  /* The name of the exception.  */
+  const char *name;
+
+  /* The address of the symbol corresponding to that exception.  */
+  CORE_ADDR addr;
+} ada_exc_info;
+
+DEF_VEC_O(ada_exc_info);
+
+extern VEC(ada_exc_info) *ada_exceptions_list (const char *regexp);
+
 /* Tasking-related: ada-tasks.c */
 
 extern int valid_task_id (int);
diff --git a/gdb/testsuite/gdb.ada/info_exc.exp b/gdb/testsuite/gdb.ada/info_exc.exp
new file mode 100644
index 0000000..3ff5180
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/info_exc.exp
@@ -0,0 +1,57 @@
+# Copyright 2013 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+load_lib "ada.exp"
+
+standard_ada_testfile foo
+
+if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
+  return -1
+}
+
+# A convenience function that joins all the arguments together,
+# with a regexp that matches zero-or-more end of lines in between
+# each argument.  This function is ideal to write the expected output
+# of a GDB command that generates more than a couple of lines, as
+# this allows us to write each line as a separate string, which is
+# easier to read by a human being.
+
+proc multi_line { args } {
+    return [join $args "\[\r\n\]*"]
+}
+
+clean_restart ${testfile}
+
+gdb_test "info exceptions" \
+    [multi_line "All defined Ada exceptions:" \
+                "constraint_error: $hex" \
+                "program_error: $hex" \
+                "storage_error: $hex" \
+                "tasking_error: $hex" \
+                "const.aint_global_e: $hex"]
+
+gdb_test "info exceptions task" \
+    [multi_line "All Ada exceptions matching regular expression \"task\":" \
+                "tasking_error: $hex"]
+
+gdb_test "info exceptions global" \
+    [multi_line "All Ada exceptions matching regular expression \"global\":" \
+                "const.aint_global_e: $hex"]
+
+gdb_test "info exceptions const.aint" \
+    [multi_line "All Ada exceptions matching regular expression \"const\\.aint\":" \
+                "constraint_error: $hex" \
+                "const.aint_global_e: $hex"]
+
diff --git a/gdb/testsuite/gdb.ada/info_exc/const.ads b/gdb/testsuite/gdb.ada/info_exc/const.ads
new file mode 100644
index 0000000..753241e
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/info_exc/const.ads
@@ -0,0 +1,18 @@
+--  Copyright 2013 Free Software Foundation, Inc.
+--
+--  This program is free software; you can redistribute it and/or modify
+--  it under the terms of the GNU General Public License as published by
+--  the Free Software Foundation; either version 3 of the License, or
+--  (at your option) any later version.
+--
+--  This program is distributed in the hope that it will be useful,
+--  but WITHOUT ANY WARRANTY; without even the implied warranty of
+--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+--  GNU General Public License for more details.
+--
+--  You should have received a copy of the GNU General Public License
+--  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+package Const is
+   Aint_Global_E : exception;
+end Const;
diff --git a/gdb/testsuite/gdb.ada/info_exc/foo.adb b/gdb/testsuite/gdb.ada/info_exc/foo.adb
new file mode 100644
index 0000000..e047db2
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/info_exc/foo.adb
@@ -0,0 +1,20 @@
+--  Copyright 2013 Free Software Foundation, Inc.
+--
+--  This program is free software; you can redistribute it and/or modify
+--  it under the terms of the GNU General Public License as published by
+--  the Free Software Foundation; either version 3 of the License, or
+--  (at your option) any later version.
+--
+--  This program is distributed in the hope that it will be useful,
+--  but WITHOUT ANY WARRANTY; without even the implied warranty of
+--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+--  GNU General Public License for more details.
+--
+--  You should have received a copy of the GNU General Public License
+--  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+with Const; use Const;
+procedure Foo is
+begin
+   raise Aint_Global_E;
+end Foo;
-- 
1.8.1.2

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

* [RFA/Ada(v2) 2/3] Implement GDB/MI equivalent of "info exceptions" CLI command.
  2013-11-08 12:04 RFA/Ada (v2) new CLI + GDB/MI commands to list Ada exceptions Joel Brobecker
  2013-11-08 12:04 ` [RFA/Ada(v2) 3/3] Document "info exceptions" and "-info-ada-exception" new commands Joel Brobecker
  2013-11-08 12:05 ` [RFA/Ada(v2) 1/3] Add command to list Ada exceptions Joel Brobecker
@ 2013-11-08 12:27 ` Joel Brobecker
  2013-11-12  3:38 ` RFA/Ada (v2) new CLI + GDB/MI commands to list Ada exceptions Joel Brobecker
  3 siblings, 0 replies; 24+ messages in thread
From: Joel Brobecker @ 2013-11-08 12:27 UTC (permalink / raw)
  To: gdb-patches

This patch implements a new GDB/MI command implementing the equivalent
of the "info exceptions" CLI command.  The command syntax is:

    -info-ada-exceptions [REGEXP]

Here is an example of usage (slightly formatted by hand to make it
easier to read):

    -info-ada-exceptions ions\.a_
    ^done,ada-exceptions=
      {nr_rows="2",nr_cols="2",
       hdr=[{width="1",alignment="-1",col_name="name",colhdr="Name"},
            {width="1",alignment="-1",col_name="address",colhdr="Address"}],
       body=[{name="global_exceptions.a_global_exception",
              address="0x0000000000613a80"},
             {name="global_exceptions.a_private_exception",
              address="0x0000000000613ac0"}]}

Also, in order to allow graphical frontends to easily determine
whether this command is available or not, the output of the
"-list-features" command has been augmented to contain
"info-ada-exceptions".

gdb/Changelog:

        * mi/mi-cmds.h (mi_cmd_info_ada_exceptions): Add declaration.
        * mi/mi-cmds.c (mi_cmds): Add entry for -info-ada-exceptions
        command.
        * mi/mi-cmd-info.c: #include "ada-lang.c" and "arch-utils.c".
        (mi_cmd_info_ada_exceptions): New function.
        * mi/mi-main.c (mi_cmd_list_features): Add "info-ada-exceptions".

gdb/testsuite/ChangeLog:

        * gdb.ada/mi_exc_info: New testcase.

Tested on x86_64-linux. Ok to commit?

---
 gdb/mi/mi-cmd-info.c                        | 51 +++++++++++++++++++++++++++++
 gdb/mi/mi-cmds.c                            |  1 +
 gdb/mi/mi-cmds.h                            |  1 +
 gdb/mi/mi-main.c                            |  1 +
 gdb/testsuite/gdb.ada/mi_exc_info.exp       | 51 +++++++++++++++++++++++++++++
 gdb/testsuite/gdb.ada/mi_exc_info/const.ads | 18 ++++++++++
 gdb/testsuite/gdb.ada/mi_exc_info/foo.adb   | 20 +++++++++++
 7 files changed, 143 insertions(+)
 create mode 100644 gdb/testsuite/gdb.ada/mi_exc_info.exp
 create mode 100644 gdb/testsuite/gdb.ada/mi_exc_info/const.ads
 create mode 100644 gdb/testsuite/gdb.ada/mi_exc_info/foo.adb

diff --git a/gdb/mi/mi-cmd-info.c b/gdb/mi/mi-cmd-info.c
index 8eb4220..aa4d210 100644
--- a/gdb/mi/mi-cmd-info.c
+++ b/gdb/mi/mi-cmd-info.c
@@ -19,6 +19,57 @@
 #include "defs.h"
 #include "osdata.h"
 #include "mi-cmds.h"
+#include "ada-lang.h"
+#include "arch-utils.h"
+
+/* Implement the "-info-ada-exceptions" GDB/MI command.  */
+
+void
+mi_cmd_info_ada_exceptions (char *command, char **argv, int argc)
+{
+  struct ui_out *uiout = current_uiout;
+  struct gdbarch *gdbarch = get_current_arch ();
+  char *regexp;
+  struct cleanup *old_chain;
+  VEC(ada_exc_info) *exceptions;
+  int ix;
+  struct ada_exc_info *info;
+
+  switch (argc)
+    {
+    case 0:
+      regexp = NULL;
+      break;
+    case 1:
+      regexp = argv[0];
+      break;
+    default:
+      error (_("Usage: -info-ada-exceptions [REGEXP]"));
+      break;
+    }
+
+  exceptions = ada_exceptions_list (regexp);
+  old_chain = make_cleanup (VEC_cleanup (ada_exc_info), &exceptions);
+
+  make_cleanup_ui_out_table_begin_end
+    (uiout, 2, VEC_length (ada_exc_info, exceptions), "ada-exceptions");
+  ui_out_table_header (uiout, 1, ui_left, "name", "Name");
+  ui_out_table_header (uiout, 1, ui_left, "address", "Address");
+  ui_out_table_body (uiout);
+
+  for (ix = 0; VEC_iterate(ada_exc_info, exceptions, ix, info); ix++)
+    {
+      struct cleanup *sub_chain;
+
+      sub_chain = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
+      ui_out_field_string (uiout, "name", info->name);
+      ui_out_field_core_addr (uiout, "address", gdbarch, info->addr);
+
+      do_cleanups (sub_chain);
+    }
+
+  do_cleanups (old_chain);
+}
 
 void
 mi_cmd_info_os (char *command, char **argv, int argc)
diff --git a/gdb/mi/mi-cmds.c b/gdb/mi/mi-cmds.c
index 1b8ec92..496a8aa 100644
--- a/gdb/mi/mi-cmds.c
+++ b/gdb/mi/mi-cmds.c
@@ -124,6 +124,7 @@ static struct mi_cmd mi_cmds[] =
   DEF_MI_CMD_CLI ("gdb-version", "show version", 0),
   DEF_MI_CMD_MI ("inferior-tty-set", mi_cmd_inferior_tty_set),
   DEF_MI_CMD_MI ("inferior-tty-show", mi_cmd_inferior_tty_show),
+  DEF_MI_CMD_MI ("info-ada-exceptions", mi_cmd_info_ada_exceptions),
   DEF_MI_CMD_MI ("info-os", mi_cmd_info_os),
   DEF_MI_CMD_MI ("interpreter-exec", mi_cmd_interpreter_exec),
   DEF_MI_CMD_MI ("list-features", mi_cmd_list_features),
diff --git a/gdb/mi/mi-cmds.h b/gdb/mi/mi-cmds.h
index bbca54d..cb8aac1 100644
--- a/gdb/mi/mi-cmds.h
+++ b/gdb/mi/mi-cmds.h
@@ -73,6 +73,7 @@ extern mi_cmd_argv_ftype mi_cmd_file_list_exec_source_files;
 extern mi_cmd_argv_ftype mi_cmd_gdb_exit;
 extern mi_cmd_argv_ftype mi_cmd_inferior_tty_set;
 extern mi_cmd_argv_ftype mi_cmd_inferior_tty_show;
+extern mi_cmd_argv_ftype mi_cmd_info_ada_exceptions;
 extern mi_cmd_argv_ftype mi_cmd_info_os;
 extern mi_cmd_argv_ftype mi_cmd_interpreter_exec;
 extern mi_cmd_argv_ftype mi_cmd_list_features;
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 24ac1e0..bf0fce3 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -1815,6 +1815,7 @@ mi_cmd_list_features (char *command, char **argv, int argc)
       ui_out_field_string (uiout, NULL, "data-read-memory-bytes");
       ui_out_field_string (uiout, NULL, "breakpoint-notifications");
       ui_out_field_string (uiout, NULL, "ada-task-info");
+      ui_out_field_string (uiout, NULL, "info-ada-exceptions");
       
 #if HAVE_PYTHON
       if (gdb_python_initialized)
diff --git a/gdb/testsuite/gdb.ada/mi_exc_info.exp b/gdb/testsuite/gdb.ada/mi_exc_info.exp
new file mode 100644
index 0000000..b77ccbc
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/mi_exc_info.exp
@@ -0,0 +1,51 @@
+# Copyright 2013 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+load_lib "ada.exp"
+
+standard_ada_testfile foo
+
+if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
+  return -1
+}
+
+load_lib mi-support.exp
+set MIFLAGS "-i=mi"
+
+gdb_exit
+if [mi_gdb_start] {
+    continue
+}
+
+mi_delete_breakpoints
+mi_gdb_reinitialize_dir $srcdir/$subdir
+mi_gdb_load ${binfile}
+
+mi_gdb_test "-info-ada-exceptions" \
+  "\\^done,ada-exceptions={nr_rows=\"5\",nr_cols=\"2\",hdr=\\\[{width=\"1\",alignment=\"-1\",col_name=\"name\",colhdr=\"Name\"},{width=\"1\",alignment=\"-1\",col_name=\"address\",colhdr=\"Address\"}\\\],body=\\\[{name=\"constraint_error\",address=\"$hex\"},{name=\"program_error\",address=\"$hex\"},{name=\"storage_error\",address=\"$hex\"},{name=\"tasking_error\",address=\"$hex\"},{name=\"const.aint_global_e\",address=\"$hex\"}\\\]}" \
+  "-info-ada-exceptions"
+
+mi_gdb_test "-info-ada-exceptions task" \
+  "\\^done,ada-exceptions={nr_rows=\"1\",nr_cols=\"2\",hdr=\\\[{width=\"1\",alignment=\"-1\",col_name=\"name\",colhdr=\"Name\"},{width=\"1\",alignment=\"-1\",col_name=\"address\",colhdr=\"Address\"}\\\],body=\\\[{name=\"tasking_error\",address=\"$hex\"}\\\]}" \
+  "-info-ada-exceptions task"
+
+mi_gdb_test "-info-ada-exceptions global" \
+  "\\^done,ada-exceptions={nr_rows=\"1\",nr_cols=\"2\",hdr=\\\[{width=\"1\",alignment=\"-1\",col_name=\"name\",colhdr=\"Name\"},{width=\"1\",alignment=\"-1\",col_name=\"address\",colhdr=\"Address\"}\\\],body=\\\[{name=\"const.aint_global_e\",address=\"$hex\"}\\\]}" \
+  "-info-ada-exceptions global"
+
+mi_gdb_test "-info-ada-exceptions const.aint" \
+  "\\^done,ada-exceptions={nr_rows=\"2\",nr_cols=\"2\",hdr=\\\[{width=\"1\",alignment=\"-1\",col_name=\"name\",colhdr=\"Name\"},{width=\"1\",alignment=\"-1\",col_name=\"address\",colhdr=\"Address\"}\\\],body=\\\[{name=\"constraint_error\",address=\"$hex\"},{name=\"const.aint_global_e\",address=\"$hex\"}\\\]}" \
+  "-info-ada-exceptions const.aint"
+
diff --git a/gdb/testsuite/gdb.ada/mi_exc_info/const.ads b/gdb/testsuite/gdb.ada/mi_exc_info/const.ads
new file mode 100644
index 0000000..753241e
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/mi_exc_info/const.ads
@@ -0,0 +1,18 @@
+--  Copyright 2013 Free Software Foundation, Inc.
+--
+--  This program is free software; you can redistribute it and/or modify
+--  it under the terms of the GNU General Public License as published by
+--  the Free Software Foundation; either version 3 of the License, or
+--  (at your option) any later version.
+--
+--  This program is distributed in the hope that it will be useful,
+--  but WITHOUT ANY WARRANTY; without even the implied warranty of
+--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+--  GNU General Public License for more details.
+--
+--  You should have received a copy of the GNU General Public License
+--  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+package Const is
+   Aint_Global_E : exception;
+end Const;
diff --git a/gdb/testsuite/gdb.ada/mi_exc_info/foo.adb b/gdb/testsuite/gdb.ada/mi_exc_info/foo.adb
new file mode 100644
index 0000000..e047db2
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/mi_exc_info/foo.adb
@@ -0,0 +1,20 @@
+--  Copyright 2013 Free Software Foundation, Inc.
+--
+--  This program is free software; you can redistribute it and/or modify
+--  it under the terms of the GNU General Public License as published by
+--  the Free Software Foundation; either version 3 of the License, or
+--  (at your option) any later version.
+--
+--  This program is distributed in the hope that it will be useful,
+--  but WITHOUT ANY WARRANTY; without even the implied warranty of
+--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+--  GNU General Public License for more details.
+--
+--  You should have received a copy of the GNU General Public License
+--  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+with Const; use Const;
+procedure Foo is
+begin
+   raise Aint_Global_E;
+end Foo;
-- 
1.8.1.2

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

* Re: [RFA/Ada(v2) 1/3] Add command to list Ada exceptions
  2013-11-08 12:05 ` [RFA/Ada(v2) 1/3] Add command to list Ada exceptions Joel Brobecker
@ 2013-11-08 13:40   ` Pedro Alves
  2013-11-08 14:10     ` Joel Brobecker
  2013-11-13 17:04   ` Tom Tromey
  1 sibling, 1 reply; 24+ messages in thread
From: Pedro Alves @ 2013-11-08 13:40 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

Hi Joel,

Only minor comments.

On 11/08/2013 12:03 PM, Joel Brobecker wrote:
>         (DEF_VEC_O(ada_exc_info): New vector.

Something odd here.

> gdb/testsuite/ChangeLog:
>
>         * info_exc: New testcase.

gdb.ada missing.

> +  /* Next, find all exceptions whose scope is local and accessible
> +     from the currently selected frame.  */
> +
> +  if (target_has_registers)
> +    {

Should be has_stack_frames.

-- 
Pedro Alves

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

* Re: [RFA/Ada(v2) 1/3] Add command to list Ada exceptions
  2013-11-08 13:40   ` Pedro Alves
@ 2013-11-08 14:10     ` Joel Brobecker
  2013-11-08 15:47       ` Tom Tromey
  0 siblings, 1 reply; 24+ messages in thread
From: Joel Brobecker @ 2013-11-08 14:10 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 624 bytes --]

Hi Pedro,

> Only minor comments.

Thanks!

> 
> On 11/08/2013 12:03 PM, Joel Brobecker wrote:
> >         (DEF_VEC_O(ada_exc_info): New vector.
> 
> Something odd here.
>
> > gdb/testsuite/ChangeLog:
> >
> >         * info_exc: New testcase.
> 
> gdb.ada missing.
> 
> > +  /* Next, find all exceptions whose scope is local and accessible
> > +     from the currently selected frame.  */
> > +
> > +  if (target_has_registers)
> > +    {
> 
> Should be has_stack_frames.

Indeed!

Attached is a new version of the patch which should fix all the issues
you noticed. It was re-tested on x86_64-linux.

Thanks again,
-- 
Joel

[-- Attachment #2: 0001-Add-command-to-list-Ada-exceptions.patch --]
[-- Type: text/x-diff, Size: 18837 bytes --]

From 0b34944b928030d07abb7c206d888f82b60669b5 Mon Sep 17 00:00:00 2001
From: Joel Brobecker <brobecker@adacore.com>
Date: Thu, 7 Nov 2013 17:40:48 +0400
Subject: [PATCH] Add command to list Ada exceptions

This patch adds a new command "info exceptions" whose purpose is to
provide the list of exceptions currently defined in the inferior.
The usage is:

    (gdb) info exceptions [REGEXP]

Without argument, the command lists all exceptions.  Otherwise,
only those whose name match REGEXP are listed.

For instance:

    (gdb) info exceptions
    All defined Ada exceptions:
    constraint_error: 0x613dc0
    program_error: 0x613d40
    storage_error: 0x613d00
    tasking_error: 0x613cc0
    global_exceptions.a_global_exception: 0x613a80
    global_exceptions.a_private_exception: 0x613ac0

The name of the command, as well as its output is part of a legacy
I inherited long ago. It's output being parsed by frontends such as
GPS, I cannot easily change it. Same for the command name.

The implementation is mostly self-contained, and is written in a way
that should make it easy to implement the GDB/MI equivalent. The
careful reviewer will notice that the code added in ada-lang.h could
normally be made private inside ada-lang.c.  But these will be used
by the GDB/MI implementation.  Rather than making those private now,
only to move them later, I've made them public right away.

gdb/ChangeLog:

        * ada-lang.h: #include "vec.h".
        (struct ada_exc_info): New.
        (ada_exc_info): New typedef.
        (DEF_VEC_O(ada_exc_info)): New vector.
        (ada_exceptions_list): Add declaration.
        * ada-lang.c (ada_is_exception_sym)
        (ada_is_non_standard_exception_sym, compare_ada_exception_info)
        (sort_remove_dups_ada_exceptions_list)
        (ada_exc_search_name_matches, ada_add_standard_exceptions)
        (ada_add_exceptions_from_frame, ada_add_global_exceptions)
        (ada_exceptions_list, info_exceptions_command): New function.
        (_initialize_ada_language): Add "info exception" command.

gdb/testsuite/ChangeLog:

        * gdb.ada/info_exc: New testcase.
---
 gdb/ada-lang.c                           | 340 +++++++++++++++++++++++++++++++
 gdb/ada-lang.h                           |  16 ++
 gdb/testsuite/gdb.ada/info_exc.exp       |  57 ++++++
 gdb/testsuite/gdb.ada/info_exc/const.ads |  18 ++
 gdb/testsuite/gdb.ada/info_exc/foo.adb   |  20 ++
 5 files changed, 451 insertions(+)
 create mode 100644 gdb/testsuite/gdb.ada/info_exc.exp
 create mode 100644 gdb/testsuite/gdb.ada/info_exc/const.ads
 create mode 100644 gdb/testsuite/gdb.ada/info_exc/foo.adb

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 3b1e196..66eb397 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -12284,6 +12284,340 @@ catch_assert_command (char *arg, int from_tty,
 				   tempflag, 1 /* enabled */,
 				   from_tty);
 }
+
+/* Return non-zero if the symbol SYM is an Ada exception object.  */
+
+static int
+ada_is_exception_sym (struct symbol *sym)
+{
+  const char *type_name = type_name_no_tag (SYMBOL_TYPE (sym));
+
+  return (SYMBOL_CLASS (sym) != LOC_TYPEDEF
+          && SYMBOL_CLASS (sym) != LOC_BLOCK
+          && SYMBOL_CLASS (sym) != LOC_CONST
+          && SYMBOL_CLASS (sym) != LOC_UNRESOLVED
+          && type_name != NULL && strcmp (type_name, "exception") == 0);
+}
+
+/* Given a global symbol SYM, return non-zero iff SYM is a non-standard
+   Ada exception object.  This matches all exceptions except the ones
+   defined by the Ada language.  */
+
+static int
+ada_is_non_standard_exception_sym (struct symbol *sym)
+{
+  int i;
+
+  if (!ada_is_exception_sym (sym))
+    return 0;
+
+  for (i = 0; i < ARRAY_SIZE (standard_exc); i++)
+    if (strcmp (SYMBOL_LINKAGE_NAME (sym), standard_exc[i]) == 0)
+      return 0;  /* A standard exception.  */
+
+  /* Numeric_Error is also a standard exception, so exclude it.
+     See the STANDARD_EXC description for more details as to why
+     this exception is not listed in that array.  */
+  if (strcmp (SYMBOL_LINKAGE_NAME (sym), "numeric_error") == 0)
+    return 0;
+
+  return 1;
+}
+
+/* A helper function for qsort, comparing two struct ada_exc_info
+   objects.
+
+   The comparison is determined first by exception name, and then
+   by exception address.  */
+
+static int
+compare_ada_exception_info (const void *a, const void *b)
+{
+  const struct ada_exc_info *exc_a = (struct ada_exc_info *) a;
+  const struct ada_exc_info *exc_b = (struct ada_exc_info *) b;
+  int result;
+
+  result = strcmp (exc_a->name, exc_b->name);
+  if (result != 0)
+    return result;
+
+  if (exc_a->addr < exc_b->addr)
+    return -1;
+  if (exc_a->addr > exc_b->addr)
+    return 1;
+
+  return 0;
+}
+
+/* Sort EXCEPTIONS using compare_ada_exception_info as the comparison
+   routine, but keeping the first SKIP elements untouched.
+
+   All duplicates are also removed.  */
+
+static void
+sort_remove_dups_ada_exceptions_list (VEC(ada_exc_info) **exceptions,
+				      int skip)
+{
+  struct ada_exc_info *to_sort
+    = VEC_address (ada_exc_info, *exceptions) + skip;
+  int to_sort_len
+    = VEC_length (ada_exc_info, *exceptions) - skip;
+  int i, j;
+
+  qsort (to_sort, to_sort_len, sizeof (struct ada_exc_info),
+	 compare_ada_exception_info);
+
+  for (i = 1, j = 1; i < to_sort_len; i++)
+    if (compare_ada_exception_info (&to_sort[i], &to_sort[j - 1]) != 0)
+      to_sort[j++] = to_sort[i];
+  to_sort_len = j;
+  VEC_truncate(ada_exc_info, *exceptions, skip + to_sort_len);
+}
+
+/* A function intended as the "name_matcher" callback in the struct
+   quick_symbol_functions' expand_symtabs_matching method.
+
+   SEARCH_NAME is the symbol's search name.
+
+   If USER_DATA is not NULL, it is a pointer to a regext_t object
+   used to match the symbol (by natural name).  Otherwise, when USER_DATA
+   is null, no filtering is performed, and all symbols are a positive
+   match.  */
+
+static int
+ada_exc_search_name_matches (const char *search_name, void *user_data)
+{
+  regex_t *preg = user_data;
+
+  if (preg == NULL)
+    return 1;
+
+  /* In Ada, the symbol "search name" is a linkage name, whereas
+     the regular expression used to do the matching refers to
+     the natural name.  So match against the decoded name.  */
+  return (regexec (preg, ada_decode (search_name), 0, NULL, 0) == 0);
+}
+
+/* Add all exceptions defined by the Ada standard whose name match
+   a regular expression.
+
+   If PREG is not NULL, then this regexp_t object is used to
+   perform the symbol name matching.  Otherwise, no name-based
+   filtering is performed.
+
+   EXCEPTIONS is a vector of exceptions to which matching exceptions
+   gets pushed.  */
+
+static void
+ada_add_standard_exceptions (regex_t *preg, VEC(ada_exc_info) **exceptions)
+{
+  int i;
+
+  for (i = 0; i < ARRAY_SIZE (standard_exc); i++)
+    {
+      if (preg == NULL
+	  || regexec (preg, standard_exc[i], 0, NULL, 0) == 0)
+	{
+	  struct bound_minimal_symbol msymbol
+	    = ada_lookup_simple_minsym (standard_exc[i]);
+
+	  if (msymbol.minsym != NULL)
+	    {
+	      struct ada_exc_info info
+		= {standard_exc[i], SYMBOL_VALUE_ADDRESS (msymbol.minsym)};
+
+	      VEC_safe_push (ada_exc_info, *exceptions, &info);
+	    }
+	}
+    }
+}
+
+/* Add all Ada exceptions defined locally and accessible from the given
+   FRAME.
+
+   If PREG is not NULL, then this regexp_t object is used to
+   perform the symbol name matching.  Otherwise, no name-based
+   filtering is performed.
+
+   EXCEPTIONS is a vector of exceptions to which matching exceptions
+   gets pushed.  */
+
+static void
+ada_add_exceptions_from_frame (regex_t *preg, struct frame_info *frame,
+			       VEC(ada_exc_info) **exceptions)
+{
+  struct block *block = get_frame_block (frame, 0);
+
+  while (block != 0)
+    {
+      struct block_iterator iter;
+      struct symbol *sym;
+
+      ALL_BLOCK_SYMBOLS (block, iter, sym)
+	{
+	  switch (SYMBOL_CLASS (sym))
+	    {
+	    case LOC_TYPEDEF:
+	    case LOC_BLOCK:
+	    case LOC_CONST:
+	      break;
+	    default:
+	      if (ada_is_exception_sym (sym))
+		{
+		  struct ada_exc_info info = {SYMBOL_PRINT_NAME (sym),
+					      SYMBOL_VALUE_ADDRESS (sym)};
+
+		  VEC_safe_push (ada_exc_info, *exceptions, &info);
+		}
+	    }
+	}
+      if (BLOCK_FUNCTION (block) != NULL)
+	break;
+      block = BLOCK_SUPERBLOCK (block);
+    }
+}
+
+/* Add all exceptions defined globally whose name name match
+   a regular expression, excluding standard exceptions.
+
+   The reason we exclude standard exceptions is that they need
+   to be handled separately: Standard exceptions are defined inside
+   a runtime unit which is normally not compiled with debugging info,
+   and thus usually do not show up in our symbol search.  However,
+   if the unit was in fact built with debugging info, we need to
+   exclude them because they would duplicate the entry we found
+   during the special loop that specifically searches for those
+   standard exceptions.
+
+   If PREG is not NULL, then this regexp_t object is used to
+   perform the symbol name matching.  Otherwise, no name-based
+   filtering is performed.
+
+   EXCEPTIONS is a vector of exceptions to which matching exceptions
+   gets pushed.  */
+
+static void
+ada_add_global_exceptions (regex_t *preg, VEC(ada_exc_info) **exceptions)
+{
+  struct objfile *objfile;
+  struct symtab *s;
+
+  ALL_OBJFILES (objfile)
+    if (objfile->sf)
+      objfile->sf->qf->expand_symtabs_matching
+	(objfile, NULL, ada_exc_search_name_matches,
+	 VARIABLES_DOMAIN, preg);
+
+  ALL_PRIMARY_SYMTABS (objfile, s)
+    {
+      struct blockvector *bv = BLOCKVECTOR (s);
+      int i;
+
+      for (i = GLOBAL_BLOCK; i <= STATIC_BLOCK; i++)
+	{
+	  struct block *b = BLOCKVECTOR_BLOCK (bv, i);
+	  struct block_iterator iter;
+	  struct symbol *sym;
+
+	  ALL_BLOCK_SYMBOLS (b, iter, sym)
+	    if (ada_is_non_standard_exception_sym (sym)
+		&& (preg == NULL
+		    || regexec (preg, SYMBOL_NATURAL_NAME (sym),
+				0, NULL, 0) == 0))
+	      {
+		struct ada_exc_info info
+		  = {SYMBOL_PRINT_NAME (sym), SYMBOL_VALUE_ADDRESS (sym)};
+
+		VEC_safe_push (ada_exc_info, *exceptions, &info);
+	      }
+	}
+    }
+}
+
+/* Return a vector of ada_exc_info.
+
+   If REGEXP is NULL, all exceptions are included in the result.
+   Otherwise, it should contain a valid regular expression,
+   and only the exceptions whose name match that regular expression
+   are included in the result.
+
+   The exceptions are sorted in the following order:
+     - Standard exceptions (defined by the Ada language), in
+       alphabetical order;
+     - Exceptions only visible from the current frame, in
+       alphabetical order;
+     - Exceptions whose scope is global, in alphabetical order.  */
+
+VEC(ada_exc_info) *
+ada_exceptions_list (const char *regexp)
+{
+  VEC(ada_exc_info) *result = NULL;
+  struct cleanup *old_chain
+    = make_cleanup (VEC_cleanup (ada_exc_info), &result);
+  regex_t *preg = NULL;
+  int prev_len;
+
+  if (regexp != NULL)
+    {
+      preg = alloca (sizeof (regex_t));
+      compile_rx_or_error (preg, regexp, _("invalid regular expression"));
+    }
+
+  /* First, list the known standard exceptions.  These exceptions
+     need to be handled separately, as they are usually defined in
+     runtime units that have been compiled without debugging info.  */
+
+  ada_add_standard_exceptions (preg, &result);
+
+  /* Next, find all exceptions whose scope is local and accessible
+     from the currently selected frame.  */
+
+  if (has_stack_frames ())
+    {
+      prev_len = VEC_length (ada_exc_info, result);
+      ada_add_exceptions_from_frame (preg, get_selected_frame (NULL),
+				     &result);
+      if (VEC_length (ada_exc_info, result) > prev_len)
+	sort_remove_dups_ada_exceptions_list (&result, prev_len);
+    }
+
+  /* Add all exceptions whose scope is global.  */
+
+  prev_len = VEC_length (ada_exc_info, result);
+  ada_add_global_exceptions (preg, &result);
+  if (VEC_length (ada_exc_info, result) > prev_len)
+    sort_remove_dups_ada_exceptions_list (&result, prev_len);
+
+  discard_cleanups (old_chain);
+  return result;
+}
+
+/* Implement the "info exceptions" command.  */
+
+static void
+info_exceptions_command (char *regexp, int from_tty)
+{
+  VEC(ada_exc_info) *exceptions;
+  struct cleanup *cleanup;
+  struct gdbarch *gdbarch = get_current_arch ();
+  int ix;
+  struct ada_exc_info *info;
+
+  exceptions = ada_exceptions_list (regexp);
+  cleanup = make_cleanup (VEC_cleanup (ada_exc_info), &exceptions);
+
+  if (regexp != NULL)
+    printf_filtered
+      (_("All Ada exceptions matching regular expression \"%s\":\n"), regexp);
+  else
+    printf_filtered (_("All defined Ada exceptions:\n"));
+
+  for (ix = 0; VEC_iterate(ada_exc_info, exceptions, ix, info); ix++)
+    printf_filtered ("%s: %s\n", info->name, paddress (gdbarch, info->addr));
+
+  do_cleanups (cleanup);
+}
+
                                 /* Operators */
 /* Information about operators given special treatment in functions
    below.  */
@@ -12955,6 +13289,12 @@ With an argument, catch only exceptions with the given name."),
 
   varsize_limit = 65536;
 
+  add_info ("exceptions", info_exceptions_command,
+	    _("\
+List all Ada exception names.\n\
+If a regular expression is passed as an argument, only those matching\n\
+the regular expression are listed."));
+
   obstack_init (&symbol_list_obstack);
 
   decoded_names_store = htab_create_alloc
diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h
index 151ced8..eba2802 100644
--- a/gdb/ada-lang.h
+++ b/gdb/ada-lang.h
@@ -27,6 +27,7 @@ struct type_print_options;
 #include "value.h"
 #include "gdbtypes.h"
 #include "breakpoint.h"
+#include "vec.h"
 
 /* Names of specific files known to be part of the runtime
    system and that might consider (confusing) debugging information.
@@ -389,6 +390,21 @@ extern void create_ada_exception_catchpoint
    char *excep_string, char *cond_string, int tempflag, int disabled,
    int from_tty);
 
+/* Some information about a given Ada exception.  */
+
+typedef struct ada_exc_info
+{
+  /* The name of the exception.  */
+  const char *name;
+
+  /* The address of the symbol corresponding to that exception.  */
+  CORE_ADDR addr;
+} ada_exc_info;
+
+DEF_VEC_O(ada_exc_info);
+
+extern VEC(ada_exc_info) *ada_exceptions_list (const char *regexp);
+
 /* Tasking-related: ada-tasks.c */
 
 extern int valid_task_id (int);
diff --git a/gdb/testsuite/gdb.ada/info_exc.exp b/gdb/testsuite/gdb.ada/info_exc.exp
new file mode 100644
index 0000000..3ff5180
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/info_exc.exp
@@ -0,0 +1,57 @@
+# Copyright 2013 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+load_lib "ada.exp"
+
+standard_ada_testfile foo
+
+if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
+  return -1
+}
+
+# A convenience function that joins all the arguments together,
+# with a regexp that matches zero-or-more end of lines in between
+# each argument.  This function is ideal to write the expected output
+# of a GDB command that generates more than a couple of lines, as
+# this allows us to write each line as a separate string, which is
+# easier to read by a human being.
+
+proc multi_line { args } {
+    return [join $args "\[\r\n\]*"]
+}
+
+clean_restart ${testfile}
+
+gdb_test "info exceptions" \
+    [multi_line "All defined Ada exceptions:" \
+                "constraint_error: $hex" \
+                "program_error: $hex" \
+                "storage_error: $hex" \
+                "tasking_error: $hex" \
+                "const.aint_global_e: $hex"]
+
+gdb_test "info exceptions task" \
+    [multi_line "All Ada exceptions matching regular expression \"task\":" \
+                "tasking_error: $hex"]
+
+gdb_test "info exceptions global" \
+    [multi_line "All Ada exceptions matching regular expression \"global\":" \
+                "const.aint_global_e: $hex"]
+
+gdb_test "info exceptions const.aint" \
+    [multi_line "All Ada exceptions matching regular expression \"const\\.aint\":" \
+                "constraint_error: $hex" \
+                "const.aint_global_e: $hex"]
+
diff --git a/gdb/testsuite/gdb.ada/info_exc/const.ads b/gdb/testsuite/gdb.ada/info_exc/const.ads
new file mode 100644
index 0000000..753241e
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/info_exc/const.ads
@@ -0,0 +1,18 @@
+--  Copyright 2013 Free Software Foundation, Inc.
+--
+--  This program is free software; you can redistribute it and/or modify
+--  it under the terms of the GNU General Public License as published by
+--  the Free Software Foundation; either version 3 of the License, or
+--  (at your option) any later version.
+--
+--  This program is distributed in the hope that it will be useful,
+--  but WITHOUT ANY WARRANTY; without even the implied warranty of
+--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+--  GNU General Public License for more details.
+--
+--  You should have received a copy of the GNU General Public License
+--  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+package Const is
+   Aint_Global_E : exception;
+end Const;
diff --git a/gdb/testsuite/gdb.ada/info_exc/foo.adb b/gdb/testsuite/gdb.ada/info_exc/foo.adb
new file mode 100644
index 0000000..e047db2
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/info_exc/foo.adb
@@ -0,0 +1,20 @@
+--  Copyright 2013 Free Software Foundation, Inc.
+--
+--  This program is free software; you can redistribute it and/or modify
+--  it under the terms of the GNU General Public License as published by
+--  the Free Software Foundation; either version 3 of the License, or
+--  (at your option) any later version.
+--
+--  This program is distributed in the hope that it will be useful,
+--  but WITHOUT ANY WARRANTY; without even the implied warranty of
+--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+--  GNU General Public License for more details.
+--
+--  You should have received a copy of the GNU General Public License
+--  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+with Const; use Const;
+procedure Foo is
+begin
+   raise Aint_Global_E;
+end Foo;
-- 
1.8.1.2


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

* Re: [RFA/Ada(v2) 3/3] Document "info exceptions" and "-info-ada-exception" new commands.
  2013-11-08 12:04 ` [RFA/Ada(v2) 3/3] Document "info exceptions" and "-info-ada-exception" new commands Joel Brobecker
@ 2013-11-08 14:21   ` Eli Zaretskii
  2013-11-10  9:49     ` Joel Brobecker
  2013-11-12  4:07   ` Joel Brobecker
  1 sibling, 1 reply; 24+ messages in thread
From: Eli Zaretskii @ 2013-11-08 14:21 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

> From: Joel Brobecker <brobecker@adacore.com>
> Date: Fri,  8 Nov 2013 16:03:39 +0400
> 
> +The @code{info exceptions} command allows you to list all Ada exceptions
> +defined within the program being debugged, as well as their address.
                                                               ^^^^^^^
"addresses", in plural.

> +With a regular expression, @var{regexp}, as argument, only those exceptions
> +whose name matches @var{regexp} are listed.
         ^^^^^^^^^^^^
"names match", in plural.

> +With a regular expression @var{regexp}, only those exceptions whose
> +name matches @var{regexp} are listed.
   ^^^^^^^^^^^^
Likewise.

OK with those changes.  Thanks.

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

* Re: [RFA/Ada(v2) 1/3] Add command to list Ada exceptions
  2013-11-08 14:10     ` Joel Brobecker
@ 2013-11-08 15:47       ` Tom Tromey
  2013-11-08 16:13         ` Joel Brobecker
  2013-11-10  6:29         ` Joel Brobecker
  0 siblings, 2 replies; 24+ messages in thread
From: Tom Tromey @ 2013-11-08 15:47 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: Pedro Alves, gdb-patches

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

Joel> +VEC(ada_exc_info) *
Joel> +ada_exceptions_list (const char *regexp)
Joel> +{
Joel> +  VEC(ada_exc_info) *result = NULL;
Joel> +  struct cleanup *old_chain
Joel> +    = make_cleanup (VEC_cleanup (ada_exc_info), &result);
Joel> +  regex_t *preg = NULL;
Joel> +  int prev_len;
Joel> +
Joel> +  if (regexp != NULL)
Joel> +    {
Joel> +      preg = alloca (sizeof (regex_t));

I think regex_t is sufficiently small that you might as well declare an
object in the outer scope and avoid alloca.

Joel> +  discard_cleanups (old_chain);

This leaks anything done by compile_rx_or_error.  I think you need to
pass an inner cleanup to do_cleanups.

Tom

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

* Re: [RFA/Ada(v2) 1/3] Add command to list Ada exceptions
  2013-11-08 15:47       ` Tom Tromey
@ 2013-11-08 16:13         ` Joel Brobecker
  2013-11-08 16:32           ` Tom Tromey
  2013-11-10  6:29         ` Joel Brobecker
  1 sibling, 1 reply; 24+ messages in thread
From: Joel Brobecker @ 2013-11-08 16:13 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Pedro Alves, gdb-patches

> Joel> +  if (regexp != NULL)
> Joel> +    {
> Joel> +      preg = alloca (sizeof (regex_t));
> 
> I think regex_t is sufficiently small that you might as well declare an
> object in the outer scope and avoid alloca.

Sure, I can do that. I found this to be a fairly interesting
approach, because it avoids the need to check regexp repeatedly
in order to decide whether to pass &preg, or NULL.

> Joel> +  discard_cleanups (old_chain);
> 
> This leaks anything done by compile_rx_or_error.  I think you need to
> pass an inner cleanup to do_cleanups.

Oops. I will fix!

Thank you :)
-- 
Joel

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

* Re: [RFA/Ada(v2) 1/3] Add command to list Ada exceptions
  2013-11-08 16:13         ` Joel Brobecker
@ 2013-11-08 16:32           ` Tom Tromey
  0 siblings, 0 replies; 24+ messages in thread
From: Tom Tromey @ 2013-11-08 16:32 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: Pedro Alves, gdb-patches

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

Joel> +  if (regexp != NULL)
Joel> +    {
Joel> +      preg = alloca (sizeof (regex_t));
>> 
>> I think regex_t is sufficiently small that you might as well declare an
>> object in the outer scope and avoid alloca.

Joel> Sure, I can do that. I found this to be a fairly interesting
Joel> approach, because it avoids the need to check regexp repeatedly
Joel> in order to decide whether to pass &preg, or NULL.

You can keep preg and set it to point to the real object in the 'if'.

Tom

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

* Re: [RFA/Ada(v2) 1/3] Add command to list Ada exceptions
  2013-11-08 15:47       ` Tom Tromey
  2013-11-08 16:13         ` Joel Brobecker
@ 2013-11-10  6:29         ` Joel Brobecker
  2013-11-11 14:48           ` Tom Tromey
  1 sibling, 1 reply; 24+ messages in thread
From: Joel Brobecker @ 2013-11-10  6:29 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 1611 bytes --]

Hi Tom,

> Joel> +VEC(ada_exc_info) *
> Joel> +ada_exceptions_list (const char *regexp)
> Joel> +{
> Joel> +  VEC(ada_exc_info) *result = NULL;
> Joel> +  struct cleanup *old_chain
> Joel> +    = make_cleanup (VEC_cleanup (ada_exc_info), &result);
> Joel> +  regex_t *preg = NULL;
> Joel> +  int prev_len;
> Joel> +
> Joel> +  if (regexp != NULL)
> Joel> +    {
> Joel> +      preg = alloca (sizeof (regex_t));
> 
> I think regex_t is sufficiently small that you might as well declare an
> object in the outer scope and avoid alloca.
> 
> Joel> +  discard_cleanups (old_chain);
> 
> This leaks anything done by compile_rx_or_error.  I think you need to
> pass an inner cleanup to do_cleanups.

Attached is a new version of the patch. To fix the memory leak, I ended
up splitting the function into two, with one doing the regexp
compilation (with associated cleanup), and one building the list
from the compiled regexp. This allows me to avoid mixing two types
of cleanups within the same function (one that is expected to be
discarded, and one that is expected to be performed). And this also
helps addressing the commend about regex_t, where I now only need to
check regexp once before deciding whether to pass &REG or NULL...

I also took this opportunity to fix "all exceptions whose name" to
follow Eli's advice in the GDB manual, using "whose names" (adding
an 's' at the end of "name").

For your convenience if it helps checking the changes, I've also
attached a diff that only shows the changes applied on top of
the last version sent.

Tested on x86_64-linux again. No regression.

Thank you!
-- 
Joel

[-- Attachment #2: 0001-Add-command-to-list-Ada-exceptions.patch --]
[-- Type: text/x-diff, Size: 19364 bytes --]

From 9c191a5e6d20b92e77aea54fe5516bb8da825967 Mon Sep 17 00:00:00 2001
From: Joel Brobecker <brobecker@adacore.com>
Date: Thu, 7 Nov 2013 17:40:48 +0400
Subject: [PATCH 1/3] Add command to list Ada exceptions

This patch adds a new command "info exceptions" whose purpose is to
provide the list of exceptions currently defined in the inferior.
The usage is:

    (gdb) info exceptions [REGEXP]

Without argument, the command lists all exceptions.  Otherwise,
only those whose name match REGEXP are listed.

For instance:

    (gdb) info exceptions
    All defined Ada exceptions:
    constraint_error: 0x613dc0
    program_error: 0x613d40
    storage_error: 0x613d00
    tasking_error: 0x613cc0
    global_exceptions.a_global_exception: 0x613a80
    global_exceptions.a_private_exception: 0x613ac0

The name of the command, as well as its output is part of a legacy
I inherited long ago. It's output being parsed by frontends such as
GPS, I cannot easily change it. Same for the command name.

The implementation is mostly self-contained, and is written in a way
that should make it easy to implement the GDB/MI equivalent. The
careful reviewer will notice that the code added in ada-lang.h could
normally be made private inside ada-lang.c.  But these will be used
by the GDB/MI implementation.  Rather than making those private now,
only to move them later, I've made them public right away.

gdb/ChangeLog:

        * ada-lang.h: #include "vec.h".
        (struct ada_exc_info): New.
        (ada_exc_info): New typedef.
        (DEF_VEC_O(ada_exc_info)): New vector.
        (ada_exceptions_list): Add declaration.
        * ada-lang.c (ada_is_exception_sym)
        (ada_is_non_standard_exception_sym, compare_ada_exception_info)
        (sort_remove_dups_ada_exceptions_list)
        (ada_exc_search_name_matches, ada_add_standard_exceptions)
        (ada_add_exceptions_from_frame, ada_add_global_exceptions)
        (ada_exceptions_list_1, ada_exceptions_list)
        (info_exceptions_command): New function.
        (_initialize_ada_language): Add "info exception" command.

gdb/testsuite/ChangeLog:

        * gdb.ada/info_exc: New testcase.
---
 gdb/ada-lang.c                           | 357 +++++++++++++++++++++++++++++++
 gdb/ada-lang.h                           |  16 ++
 gdb/testsuite/gdb.ada/info_exc.exp       |  57 +++++
 gdb/testsuite/gdb.ada/info_exc/const.ads |  18 ++
 gdb/testsuite/gdb.ada/info_exc/foo.adb   |  20 ++
 5 files changed, 468 insertions(+)
 create mode 100644 gdb/testsuite/gdb.ada/info_exc.exp
 create mode 100644 gdb/testsuite/gdb.ada/info_exc/const.ads
 create mode 100644 gdb/testsuite/gdb.ada/info_exc/foo.adb

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 3b1e196..e9c20c9 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -12284,6 +12284,357 @@ catch_assert_command (char *arg, int from_tty,
 				   tempflag, 1 /* enabled */,
 				   from_tty);
 }
+
+/* Return non-zero if the symbol SYM is an Ada exception object.  */
+
+static int
+ada_is_exception_sym (struct symbol *sym)
+{
+  const char *type_name = type_name_no_tag (SYMBOL_TYPE (sym));
+
+  return (SYMBOL_CLASS (sym) != LOC_TYPEDEF
+          && SYMBOL_CLASS (sym) != LOC_BLOCK
+          && SYMBOL_CLASS (sym) != LOC_CONST
+          && SYMBOL_CLASS (sym) != LOC_UNRESOLVED
+          && type_name != NULL && strcmp (type_name, "exception") == 0);
+}
+
+/* Given a global symbol SYM, return non-zero iff SYM is a non-standard
+   Ada exception object.  This matches all exceptions except the ones
+   defined by the Ada language.  */
+
+static int
+ada_is_non_standard_exception_sym (struct symbol *sym)
+{
+  int i;
+
+  if (!ada_is_exception_sym (sym))
+    return 0;
+
+  for (i = 0; i < ARRAY_SIZE (standard_exc); i++)
+    if (strcmp (SYMBOL_LINKAGE_NAME (sym), standard_exc[i]) == 0)
+      return 0;  /* A standard exception.  */
+
+  /* Numeric_Error is also a standard exception, so exclude it.
+     See the STANDARD_EXC description for more details as to why
+     this exception is not listed in that array.  */
+  if (strcmp (SYMBOL_LINKAGE_NAME (sym), "numeric_error") == 0)
+    return 0;
+
+  return 1;
+}
+
+/* A helper function for qsort, comparing two struct ada_exc_info
+   objects.
+
+   The comparison is determined first by exception name, and then
+   by exception address.  */
+
+static int
+compare_ada_exception_info (const void *a, const void *b)
+{
+  const struct ada_exc_info *exc_a = (struct ada_exc_info *) a;
+  const struct ada_exc_info *exc_b = (struct ada_exc_info *) b;
+  int result;
+
+  result = strcmp (exc_a->name, exc_b->name);
+  if (result != 0)
+    return result;
+
+  if (exc_a->addr < exc_b->addr)
+    return -1;
+  if (exc_a->addr > exc_b->addr)
+    return 1;
+
+  return 0;
+}
+
+/* Sort EXCEPTIONS using compare_ada_exception_info as the comparison
+   routine, but keeping the first SKIP elements untouched.
+
+   All duplicates are also removed.  */
+
+static void
+sort_remove_dups_ada_exceptions_list (VEC(ada_exc_info) **exceptions,
+				      int skip)
+{
+  struct ada_exc_info *to_sort
+    = VEC_address (ada_exc_info, *exceptions) + skip;
+  int to_sort_len
+    = VEC_length (ada_exc_info, *exceptions) - skip;
+  int i, j;
+
+  qsort (to_sort, to_sort_len, sizeof (struct ada_exc_info),
+	 compare_ada_exception_info);
+
+  for (i = 1, j = 1; i < to_sort_len; i++)
+    if (compare_ada_exception_info (&to_sort[i], &to_sort[j - 1]) != 0)
+      to_sort[j++] = to_sort[i];
+  to_sort_len = j;
+  VEC_truncate(ada_exc_info, *exceptions, skip + to_sort_len);
+}
+
+/* A function intended as the "name_matcher" callback in the struct
+   quick_symbol_functions' expand_symtabs_matching method.
+
+   SEARCH_NAME is the symbol's search name.
+
+   If USER_DATA is not NULL, it is a pointer to a regext_t object
+   used to match the symbol (by natural name).  Otherwise, when USER_DATA
+   is null, no filtering is performed, and all symbols are a positive
+   match.  */
+
+static int
+ada_exc_search_name_matches (const char *search_name, void *user_data)
+{
+  regex_t *preg = user_data;
+
+  if (preg == NULL)
+    return 1;
+
+  /* In Ada, the symbol "search name" is a linkage name, whereas
+     the regular expression used to do the matching refers to
+     the natural name.  So match against the decoded name.  */
+  return (regexec (preg, ada_decode (search_name), 0, NULL, 0) == 0);
+}
+
+/* Add all exceptions defined by the Ada standard whose name match
+   a regular expression.
+
+   If PREG is not NULL, then this regexp_t object is used to
+   perform the symbol name matching.  Otherwise, no name-based
+   filtering is performed.
+
+   EXCEPTIONS is a vector of exceptions to which matching exceptions
+   gets pushed.  */
+
+static void
+ada_add_standard_exceptions (regex_t *preg, VEC(ada_exc_info) **exceptions)
+{
+  int i;
+
+  for (i = 0; i < ARRAY_SIZE (standard_exc); i++)
+    {
+      if (preg == NULL
+	  || regexec (preg, standard_exc[i], 0, NULL, 0) == 0)
+	{
+	  struct bound_minimal_symbol msymbol
+	    = ada_lookup_simple_minsym (standard_exc[i]);
+
+	  if (msymbol.minsym != NULL)
+	    {
+	      struct ada_exc_info info
+		= {standard_exc[i], SYMBOL_VALUE_ADDRESS (msymbol.minsym)};
+
+	      VEC_safe_push (ada_exc_info, *exceptions, &info);
+	    }
+	}
+    }
+}
+
+/* Add all Ada exceptions defined locally and accessible from the given
+   FRAME.
+
+   If PREG is not NULL, then this regexp_t object is used to
+   perform the symbol name matching.  Otherwise, no name-based
+   filtering is performed.
+
+   EXCEPTIONS is a vector of exceptions to which matching exceptions
+   gets pushed.  */
+
+static void
+ada_add_exceptions_from_frame (regex_t *preg, struct frame_info *frame,
+			       VEC(ada_exc_info) **exceptions)
+{
+  struct block *block = get_frame_block (frame, 0);
+
+  while (block != 0)
+    {
+      struct block_iterator iter;
+      struct symbol *sym;
+
+      ALL_BLOCK_SYMBOLS (block, iter, sym)
+	{
+	  switch (SYMBOL_CLASS (sym))
+	    {
+	    case LOC_TYPEDEF:
+	    case LOC_BLOCK:
+	    case LOC_CONST:
+	      break;
+	    default:
+	      if (ada_is_exception_sym (sym))
+		{
+		  struct ada_exc_info info = {SYMBOL_PRINT_NAME (sym),
+					      SYMBOL_VALUE_ADDRESS (sym)};
+
+		  VEC_safe_push (ada_exc_info, *exceptions, &info);
+		}
+	    }
+	}
+      if (BLOCK_FUNCTION (block) != NULL)
+	break;
+      block = BLOCK_SUPERBLOCK (block);
+    }
+}
+
+/* Add all exceptions defined globally whose name name match
+   a regular expression, excluding standard exceptions.
+
+   The reason we exclude standard exceptions is that they need
+   to be handled separately: Standard exceptions are defined inside
+   a runtime unit which is normally not compiled with debugging info,
+   and thus usually do not show up in our symbol search.  However,
+   if the unit was in fact built with debugging info, we need to
+   exclude them because they would duplicate the entry we found
+   during the special loop that specifically searches for those
+   standard exceptions.
+
+   If PREG is not NULL, then this regexp_t object is used to
+   perform the symbol name matching.  Otherwise, no name-based
+   filtering is performed.
+
+   EXCEPTIONS is a vector of exceptions to which matching exceptions
+   gets pushed.  */
+
+static void
+ada_add_global_exceptions (regex_t *preg, VEC(ada_exc_info) **exceptions)
+{
+  struct objfile *objfile;
+  struct symtab *s;
+
+  ALL_OBJFILES (objfile)
+    if (objfile->sf)
+      objfile->sf->qf->expand_symtabs_matching
+	(objfile, NULL, ada_exc_search_name_matches,
+	 VARIABLES_DOMAIN, preg);
+
+  ALL_PRIMARY_SYMTABS (objfile, s)
+    {
+      struct blockvector *bv = BLOCKVECTOR (s);
+      int i;
+
+      for (i = GLOBAL_BLOCK; i <= STATIC_BLOCK; i++)
+	{
+	  struct block *b = BLOCKVECTOR_BLOCK (bv, i);
+	  struct block_iterator iter;
+	  struct symbol *sym;
+
+	  ALL_BLOCK_SYMBOLS (b, iter, sym)
+	    if (ada_is_non_standard_exception_sym (sym)
+		&& (preg == NULL
+		    || regexec (preg, SYMBOL_NATURAL_NAME (sym),
+				0, NULL, 0) == 0))
+	      {
+		struct ada_exc_info info
+		  = {SYMBOL_PRINT_NAME (sym), SYMBOL_VALUE_ADDRESS (sym)};
+
+		VEC_safe_push (ada_exc_info, *exceptions, &info);
+	      }
+	}
+    }
+}
+
+/* Implements ada_exceptions_list with the regular expression passed
+   as a regex_t, rather than a string.
+
+   If not NULL, PREG is used to filter out exceptions whose names
+   do not match.  Otherwise, all exceptions are listed.  */
+
+static VEC(ada_exc_info) *
+ada_exceptions_list_1 (regex_t *preg)
+{
+  VEC(ada_exc_info) *result = NULL;
+  struct cleanup *old_chain
+    = make_cleanup (VEC_cleanup (ada_exc_info), &result);
+  int prev_len;
+
+  /* First, list the known standard exceptions.  These exceptions
+     need to be handled separately, as they are usually defined in
+     runtime units that have been compiled without debugging info.  */
+
+  ada_add_standard_exceptions (preg, &result);
+
+  /* Next, find all exceptions whose scope is local and accessible
+     from the currently selected frame.  */
+
+  if (has_stack_frames ())
+    {
+      prev_len = VEC_length (ada_exc_info, result);
+      ada_add_exceptions_from_frame (preg, get_selected_frame (NULL),
+				     &result);
+      if (VEC_length (ada_exc_info, result) > prev_len)
+	sort_remove_dups_ada_exceptions_list (&result, prev_len);
+    }
+
+  /* Add all exceptions whose scope is global.  */
+
+  prev_len = VEC_length (ada_exc_info, result);
+  ada_add_global_exceptions (preg, &result);
+  if (VEC_length (ada_exc_info, result) > prev_len)
+    sort_remove_dups_ada_exceptions_list (&result, prev_len);
+
+  discard_cleanups (old_chain);
+  return result;
+}
+
+/* Return a vector of ada_exc_info.
+
+   If REGEXP is NULL, all exceptions are included in the result.
+   Otherwise, it should contain a valid regular expression,
+   and only the exceptions whose names match that regular expression
+   are included in the result.
+
+   The exceptions are sorted in the following order:
+     - Standard exceptions (defined by the Ada language), in
+       alphabetical order;
+     - Exceptions only visible from the current frame, in
+       alphabetical order;
+     - Exceptions whose scope is global, in alphabetical order.  */
+
+VEC(ada_exc_info) *
+ada_exceptions_list (const char *regexp)
+{
+  VEC(ada_exc_info) *result = NULL;
+  struct cleanup *old_chain = NULL;
+  regex_t reg;
+
+  if (regexp != NULL)
+    old_chain = compile_rx_or_error (&reg, regexp,
+				     _("invalid regular expression"));
+
+  result = ada_exceptions_list_1 (regexp != NULL ? &reg : NULL);
+
+  if (old_chain != NULL)
+    do_cleanups (old_chain);
+  return result;
+}
+
+/* Implement the "info exceptions" command.  */
+
+static void
+info_exceptions_command (char *regexp, int from_tty)
+{
+  VEC(ada_exc_info) *exceptions;
+  struct cleanup *cleanup;
+  struct gdbarch *gdbarch = get_current_arch ();
+  int ix;
+  struct ada_exc_info *info;
+
+  exceptions = ada_exceptions_list (regexp);
+  cleanup = make_cleanup (VEC_cleanup (ada_exc_info), &exceptions);
+
+  if (regexp != NULL)
+    printf_filtered
+      (_("All Ada exceptions matching regular expression \"%s\":\n"), regexp);
+  else
+    printf_filtered (_("All defined Ada exceptions:\n"));
+
+  for (ix = 0; VEC_iterate(ada_exc_info, exceptions, ix, info); ix++)
+    printf_filtered ("%s: %s\n", info->name, paddress (gdbarch, info->addr));
+
+  do_cleanups (cleanup);
+}
+
                                 /* Operators */
 /* Information about operators given special treatment in functions
    below.  */
@@ -12955,6 +13306,12 @@ With an argument, catch only exceptions with the given name."),
 
   varsize_limit = 65536;
 
+  add_info ("exceptions", info_exceptions_command,
+	    _("\
+List all Ada exception names.\n\
+If a regular expression is passed as an argument, only those matching\n\
+the regular expression are listed."));
+
   obstack_init (&symbol_list_obstack);
 
   decoded_names_store = htab_create_alloc
diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h
index 151ced8..eba2802 100644
--- a/gdb/ada-lang.h
+++ b/gdb/ada-lang.h
@@ -27,6 +27,7 @@ struct type_print_options;
 #include "value.h"
 #include "gdbtypes.h"
 #include "breakpoint.h"
+#include "vec.h"
 
 /* Names of specific files known to be part of the runtime
    system and that might consider (confusing) debugging information.
@@ -389,6 +390,21 @@ extern void create_ada_exception_catchpoint
    char *excep_string, char *cond_string, int tempflag, int disabled,
    int from_tty);
 
+/* Some information about a given Ada exception.  */
+
+typedef struct ada_exc_info
+{
+  /* The name of the exception.  */
+  const char *name;
+
+  /* The address of the symbol corresponding to that exception.  */
+  CORE_ADDR addr;
+} ada_exc_info;
+
+DEF_VEC_O(ada_exc_info);
+
+extern VEC(ada_exc_info) *ada_exceptions_list (const char *regexp);
+
 /* Tasking-related: ada-tasks.c */
 
 extern int valid_task_id (int);
diff --git a/gdb/testsuite/gdb.ada/info_exc.exp b/gdb/testsuite/gdb.ada/info_exc.exp
new file mode 100644
index 0000000..3ff5180
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/info_exc.exp
@@ -0,0 +1,57 @@
+# Copyright 2013 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+load_lib "ada.exp"
+
+standard_ada_testfile foo
+
+if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } {
+  return -1
+}
+
+# A convenience function that joins all the arguments together,
+# with a regexp that matches zero-or-more end of lines in between
+# each argument.  This function is ideal to write the expected output
+# of a GDB command that generates more than a couple of lines, as
+# this allows us to write each line as a separate string, which is
+# easier to read by a human being.
+
+proc multi_line { args } {
+    return [join $args "\[\r\n\]*"]
+}
+
+clean_restart ${testfile}
+
+gdb_test "info exceptions" \
+    [multi_line "All defined Ada exceptions:" \
+                "constraint_error: $hex" \
+                "program_error: $hex" \
+                "storage_error: $hex" \
+                "tasking_error: $hex" \
+                "const.aint_global_e: $hex"]
+
+gdb_test "info exceptions task" \
+    [multi_line "All Ada exceptions matching regular expression \"task\":" \
+                "tasking_error: $hex"]
+
+gdb_test "info exceptions global" \
+    [multi_line "All Ada exceptions matching regular expression \"global\":" \
+                "const.aint_global_e: $hex"]
+
+gdb_test "info exceptions const.aint" \
+    [multi_line "All Ada exceptions matching regular expression \"const\\.aint\":" \
+                "constraint_error: $hex" \
+                "const.aint_global_e: $hex"]
+
diff --git a/gdb/testsuite/gdb.ada/info_exc/const.ads b/gdb/testsuite/gdb.ada/info_exc/const.ads
new file mode 100644
index 0000000..753241e
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/info_exc/const.ads
@@ -0,0 +1,18 @@
+--  Copyright 2013 Free Software Foundation, Inc.
+--
+--  This program is free software; you can redistribute it and/or modify
+--  it under the terms of the GNU General Public License as published by
+--  the Free Software Foundation; either version 3 of the License, or
+--  (at your option) any later version.
+--
+--  This program is distributed in the hope that it will be useful,
+--  but WITHOUT ANY WARRANTY; without even the implied warranty of
+--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+--  GNU General Public License for more details.
+--
+--  You should have received a copy of the GNU General Public License
+--  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+package Const is
+   Aint_Global_E : exception;
+end Const;
diff --git a/gdb/testsuite/gdb.ada/info_exc/foo.adb b/gdb/testsuite/gdb.ada/info_exc/foo.adb
new file mode 100644
index 0000000..e047db2
--- /dev/null
+++ b/gdb/testsuite/gdb.ada/info_exc/foo.adb
@@ -0,0 +1,20 @@
+--  Copyright 2013 Free Software Foundation, Inc.
+--
+--  This program is free software; you can redistribute it and/or modify
+--  it under the terms of the GNU General Public License as published by
+--  the Free Software Foundation; either version 3 of the License, or
+--  (at your option) any later version.
+--
+--  This program is distributed in the hope that it will be useful,
+--  but WITHOUT ANY WARRANTY; without even the implied warranty of
+--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+--  GNU General Public License for more details.
+--
+--  You should have received a copy of the GNU General Public License
+--  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+with Const; use Const;
+procedure Foo is
+begin
+   raise Aint_Global_E;
+end Foo;
-- 
1.8.1.2


[-- Attachment #3: ada-lang.c.diff --]
[-- Type: text/x-diff, Size: 2854 bytes --]

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 66eb397..e9c20c9 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -12534,35 +12534,20 @@ ada_add_global_exceptions (regex_t *preg, VEC(ada_exc_info) **exceptions)
     }
 }
 
-/* Return a vector of ada_exc_info.
-
-   If REGEXP is NULL, all exceptions are included in the result.
-   Otherwise, it should contain a valid regular expression,
-   and only the exceptions whose name match that regular expression
-   are included in the result.
+/* Implements ada_exceptions_list with the regular expression passed
+   as a regex_t, rather than a string.
 
-   The exceptions are sorted in the following order:
-     - Standard exceptions (defined by the Ada language), in
-       alphabetical order;
-     - Exceptions only visible from the current frame, in
-       alphabetical order;
-     - Exceptions whose scope is global, in alphabetical order.  */
+   If not NULL, PREG is used to filter out exceptions whose names
+   do not match.  Otherwise, all exceptions are listed.  */
 
-VEC(ada_exc_info) *
-ada_exceptions_list (const char *regexp)
+static VEC(ada_exc_info) *
+ada_exceptions_list_1 (regex_t *preg)
 {
   VEC(ada_exc_info) *result = NULL;
   struct cleanup *old_chain
     = make_cleanup (VEC_cleanup (ada_exc_info), &result);
-  regex_t *preg = NULL;
   int prev_len;
 
-  if (regexp != NULL)
-    {
-      preg = alloca (sizeof (regex_t));
-      compile_rx_or_error (preg, regexp, _("invalid regular expression"));
-    }
-
   /* First, list the known standard exceptions.  These exceptions
      need to be handled separately, as they are usually defined in
      runtime units that have been compiled without debugging info.  */
@@ -12592,6 +12577,38 @@ ada_exceptions_list (const char *regexp)
   return result;
 }
 
+/* Return a vector of ada_exc_info.
+
+   If REGEXP is NULL, all exceptions are included in the result.
+   Otherwise, it should contain a valid regular expression,
+   and only the exceptions whose names match that regular expression
+   are included in the result.
+
+   The exceptions are sorted in the following order:
+     - Standard exceptions (defined by the Ada language), in
+       alphabetical order;
+     - Exceptions only visible from the current frame, in
+       alphabetical order;
+     - Exceptions whose scope is global, in alphabetical order.  */
+
+VEC(ada_exc_info) *
+ada_exceptions_list (const char *regexp)
+{
+  VEC(ada_exc_info) *result = NULL;
+  struct cleanup *old_chain = NULL;
+  regex_t reg;
+
+  if (regexp != NULL)
+    old_chain = compile_rx_or_error (&reg, regexp,
+				     _("invalid regular expression"));
+
+  result = ada_exceptions_list_1 (regexp != NULL ? &reg : NULL);
+
+  if (old_chain != NULL)
+    do_cleanups (old_chain);
+  return result;
+}
+
 /* Implement the "info exceptions" command.  */
 
 static void

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

* Re: [RFA/Ada(v2) 3/3] Document "info exceptions" and "-info-ada-exception" new commands.
  2013-11-08 14:21   ` Eli Zaretskii
@ 2013-11-10  9:49     ` Joel Brobecker
  0 siblings, 0 replies; 24+ messages in thread
From: Joel Brobecker @ 2013-11-10  9:49 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 320 bytes --]

> OK with those changes.  Thanks.

Thank you for the review and corrections. Attached is what I will commit
once the code is approved. In addition to making the required fixes,
I noticed that I had made the same mistake in NEWS ("whose names",
with an 's' at the end of "name"), so I fixed that too.

Cheers :)
-- 
Joel

[-- Attachment #2: 0003-Document-info-exceptions-and-info-ada-exception-new-.patch --]
[-- Type: text/x-diff, Size: 6511 bytes --]

From b8534d6b307497793d2f3dca065cb1b72858c071 Mon Sep 17 00:00:00 2001
From: Joel Brobecker <brobecker@adacore.com>
Date: Fri, 8 Nov 2013 14:21:14 +0400
Subject: [PATCH 3/3] Document "info exceptions" and "-info-ada-exception" new
 commands.

gdb/doc/ChangeLog:

        * gdb.texinfo (Ada): Add entry in menu for new "Ada Exceptions" node.
        (Ada Exceptions): New node.
        (GDB/MI): Add entry in menu for new "GDB/MI Ada Exceptions
        Commands" node.
        (GDB/MI Ada Exceptions Commands): New node.
        (GDB/MI Miscellaneous Commands): Document new "info-ada-exceptions"
        field in the output of the "-list-features" command.
        * NEWS: Add entry for the new "info exceptions" CLI command,
        and for the new "-info-ada-exceptions" GDB/MI command.
---
 gdb/NEWS            |  9 +++++
 gdb/doc/gdb.texinfo | 95 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 103 insertions(+), 1 deletion(-)

diff --git a/gdb/NEWS b/gdb/NEWS
index efeda68..6c3c272 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -80,6 +80,12 @@ remove-symbol-file -a ADDRESS
   can be identified by its filename or by an address that lies within
   the boundaries of this symbol file in memory.
 
+info exceptions
+info exceptions REGEXP
+  Display the list of Ada exceptions defined in the program being
+  debugged.  If provided, only the exceptions whose names match REGEXP
+  are listed.
+
 * New options
 
 set debug symfile off|on
@@ -163,6 +169,9 @@ show startup-with-shell
   ** The new commands -catch-assert and -catch-exceptions insert
      catchpoints stopping the program when Ada exceptions are raised.
 
+  ** The new command -info-ada-exceptions provides the equivalent of
+     the new "info exceptions" command.
+
 * New system-wide configuration scripts
   A GDB installation now provides scripts suitable for use as system-wide
   configuration scripts for the following systems:
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 39498d7..9127f94 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -14965,6 +14965,7 @@ to be difficult.
 * Omissions from Ada::          Restrictions on the Ada expression syntax.
 * Additions to Ada::            Extensions of the Ada expression syntax.
 * Stopping Before Main Program:: Debugging the program during elaboration.
+* Ada Exceptions::              Ada Exceptions
 * Ada Tasks::                   Listing and setting breakpoints in tasks.
 * Ada Tasks and Core Files::    Tasking Support when Debugging Core Files
 * Ravenscar Profile::           Tasking Support when using the Ravenscar
@@ -15289,6 +15290,42 @@ Manual, the elaboration code is invoked from a procedure called
 elaboration, simply use the following two commands:
 @code{tbreak adainit} and @code{run}.
 
+@node Ada Exceptions
+@subsubsection Ada Exceptions
+
+A command is provided to list all Ada exceptions:
+
+@table @code
+@kindex info exceptions
+@item info exceptions
+@itemx info exceptions @var{regexp}
+The @code{info exceptions} command allows you to list all Ada exceptions
+defined within the program being debugged, as well as their addresses.
+With a regular expression, @var{regexp}, as argument, only those exceptions
+whose names match @var{regexp} are listed.
+@end table
+
+Below is a small example, showing how the command can be used, first
+without argument, and next with a regular expression passed as an
+argument.
+
+@smallexample
+(@value{GDBP}) info exceptions
+All defined Ada exceptions:
+constraint_error: 0x613da0
+program_error: 0x613d20
+storage_error: 0x613ce0
+tasking_error: 0x613ca0
+const.aint_global_e: 0x613b00
+(@value{GDBP}) info exceptions const.aint
+All Ada exceptions matching regular expression "const.aint":
+constraint_error: 0x613da0
+const.aint_global_e: 0x613b00
+@end smallexample
+
+It is also possible to ask @value{GDBN} to stop your program's execution
+when an exception is raised.  For more details, see @ref{Set Catchpoints}.
+
 @node Ada Tasks
 @subsubsection Extensions for Ada Tasks
 @cindex Ada, tasking
@@ -28603,6 +28640,7 @@ may repeat one or more times.
 @end ignore
 * GDB/MI Target Manipulation::
 * GDB/MI File Transfer Commands::
+* GDB/MI Ada Exceptions Commands::
 * GDB/MI Miscellaneous Commands::
 @end menu
 
@@ -34692,6 +34730,59 @@ The corresponding @value{GDBN} command is @samp{remote delete}.
 
 
 @c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+@node GDB/MI Ada Exceptions Commands
+@section Ada Exceptions @sc{gdb/mi} Commands
+
+@subheading The @code{-info-ada-exceptions} Command
+@findex -info-ada-exceptions
+
+@subsubheading Synopsis
+
+@smallexample
+ -info-ada-exceptions [ @var{regexp}]
+@end smallexample
+
+List all Ada exceptions defined within the program being debugged.
+With a regular expression @var{regexp}, only those exceptions whose
+names match @var{regexp} are listed.
+
+@subsubheading @value{GDBN} Command
+
+The corresponding @value{GDBN} command is @samp{info exceptions}.
+
+@subsubheading Result
+
+The result is a table of Ada exceptions.  The following columns are
+defined for each exception:
+
+@table @samp
+@item name
+The name of the exception.
+
+@item address
+The address of the exception.
+
+@end table
+
+@subsubheading Example
+
+@smallexample
+-info-ada-exceptions aint
+^done,ada-exceptions=@{nr_rows="2",nr_cols="2",
+hdr=[@{width="1",alignment="-1",col_name="name",colhdr="Name"@},
+@{width="1",alignment="-1",col_name="address",colhdr="Address"@}],
+body=[@{name="constraint_error",address="0x0000000000613da0"@},
+@{name="const.aint_global_e",address="0x0000000000613b00"@}]@}
+@end smallexample
+
+@subheading Catching Ada Exceptions
+
+The commands describing how to ask @value{GDBN} to stop when a program
+raises an exception are described at @ref{Ada Exception GDB/MI
+Catchpoint Commands}.
+
+
+@c %%%%%%%%%%%%%%%%%%%%%%%%%%%% SECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 @node GDB/MI Miscellaneous Commands
 @section Miscellaneous @sc{gdb/mi} Commands
 
@@ -34877,7 +34968,9 @@ Indicates support for the @code{-data-read-memory-bytes} and the
 Indicates that changes to breakpoints and breakpoints created via the
 CLI will be announced via async records.
 @item ada-task-info
-Indicates support for the @code{-ada-task-info} command.
+indicates support for the @code{-ada-task-info} command.
+@item info-ada-exceptions
+indicates support for the @code{-info-ada-exceptions} command.
 @end table
 
 @subheading The @code{-list-target-features} Command
-- 
1.8.1.2


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

* Re: [RFA/Ada(v2) 1/3] Add command to list Ada exceptions
  2013-11-10  6:29         ` Joel Brobecker
@ 2013-11-11 14:48           ` Tom Tromey
  0 siblings, 0 replies; 24+ messages in thread
From: Tom Tromey @ 2013-11-11 14:48 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

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

Joel> For your convenience if it helps checking the changes, I've also
Joel> attached a diff that only shows the changes applied on top of
Joel> the last version sent.

Joel> Tested on x86_64-linux again. No regression.

Thanks Joel.  It looks good to me.

Tom

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

* Re: RFA/Ada (v2) new CLI + GDB/MI commands to list Ada exceptions
  2013-11-08 12:04 RFA/Ada (v2) new CLI + GDB/MI commands to list Ada exceptions Joel Brobecker
                   ` (2 preceding siblings ...)
  2013-11-08 12:27 ` [RFA/Ada(v2) 2/3] Implement GDB/MI equivalent of "info exceptions" CLI command Joel Brobecker
@ 2013-11-12  3:38 ` Joel Brobecker
  3 siblings, 0 replies; 24+ messages in thread
From: Joel Brobecker @ 2013-11-12  3:38 UTC (permalink / raw)
  To: gdb-patches

Hello,

On Fri, Nov 08, 2013 at 04:03:36PM +0400, Joel Brobecker wrote:
> Following the review of the patches posted at:
> http://www.sourceware.org/ml/gdb-patches/2013-11/msg00175.html

I have now checked in the whole series. Thank you again to everyone
who sent their comments.

> I also added "info-ada-exceptions" to the -list-features command output,
> which I just only (re-)discovered.

I actually sent that part separately, and I am still working on it,
so this part is not in yet.

-- 
Joel

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

* Re: [RFA/Ada(v2) 3/3] Document "info exceptions" and "-info-ada-exception" new commands.
  2013-11-08 12:04 ` [RFA/Ada(v2) 3/3] Document "info exceptions" and "-info-ada-exception" new commands Joel Brobecker
  2013-11-08 14:21   ` Eli Zaretskii
@ 2013-11-12  4:07   ` Joel Brobecker
  1 sibling, 0 replies; 24+ messages in thread
From: Joel Brobecker @ 2013-11-12  4:07 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 1746 bytes --]

> gdb/doc/ChangeLog:
> 
>         * gdb.texinfo (Ada): Add entry in menu for new "Ada Exceptions" node.
>         (Ada Exceptions): New node.
>         (GDB/MI): Add entry in menu for new "GDB/MI Ada Exceptions
>         Commands" node.
>         (GDB/MI Ada Exceptions Commands): New node.
>         (GDB/MI Miscellaneous Commands): Document new "info-ada-exceptions"
>         field in the output of the "-list-features" command.
>         * NEWS: Add entry for the new "info exceptions" CLI command,
>         and for the new "-info-ada-exceptions" GDB/MI command.

I noticed the following little oversight while merging that patch
into AdaCore's repository:

> @@ -34877,7 +34968,9 @@ Indicates support for the @code{-data-read-memory-bytes} and the
>  Indicates that changes to breakpoints and breakpoints created via the
>  CLI will be announced via async records.
>  @item ada-task-info
> -Indicates support for the @code{-ada-task-info} command.
> +indicates support for the @code{-ada-task-info} command.
> +@item info-ada-exceptions
> +indicates support for the @code{-info-ada-exceptions} command.
>  @end table

I accidentally changed the first "Indicates", removing the initial
capital letter, and then duplicated that error in the new entry.
I think that's a mistake I do fairly commonly, because 'y' (yank)
is next to 'u' (lowercase). So when I have a region selected, and
want to copy it, my fat fingers also sometimes lower-case it. Most
of the time, I catch it, but unfortunately not this time.

gdb/doc/ChangeLog:

        * gdb.texinfo (GDB/MI Miscellaneous Commands): Fix the first
        word of a couple of sentences to start with a capital letter.

Checked in as abvious.  And sorry about this little oversight.
-- 
Joel

[-- Attachment #2: 0001-Small-fix-first-word-of-sentence-to-start-with-capit.patch --]
[-- Type: text/x-diff, Size: 1772 bytes --]

From 6adcee1866fe6b700bc1cc5a9675479530af7205 Mon Sep 17 00:00:00 2001
From: Joel Brobecker <brobecker@adacore.com>
Date: Tue, 12 Nov 2013 07:31:04 +0400
Subject: [PATCH] Small fix (first word of sentence to start with capital
 letter)

gdb/doc/ChangeLog:

        * gdb.texinfo (GDB/MI Miscellaneous Commands): Fix the first
        word of a couple of sentences to start with a capital letter.
---
 gdb/doc/ChangeLog   | 5 +++++
 gdb/doc/gdb.texinfo | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index 49ac794..2b13843 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,5 +1,10 @@
 2013-11-12  Joel Brobecker  <brobecker@adacore.com>
 
+	* gdb.texinfo (GDB/MI Miscellaneous Commands): Fix the first
+	word of a couple of sentences to start with a capital letter.
+
+2013-11-12  Joel Brobecker  <brobecker@adacore.com>
+
 	* gdb.texinfo (Ada): Add entry in menu for new "Ada Exceptions" node.
 	(Ada Exceptions): New node.
 	(GDB/MI): Add entry in menu for new "GDB/MI Ada Exceptions
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index dc79ca1..de419ea 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -35079,9 +35079,9 @@ Indicates support for the @code{-data-read-memory-bytes} and the
 Indicates that changes to breakpoints and breakpoints created via the
 CLI will be announced via async records.
 @item ada-task-info
-indicates support for the @code{-ada-task-info} command.
+Indicates support for the @code{-ada-task-info} command.
 @item info-ada-exceptions
-indicates support for the @code{-info-ada-exceptions} command.
+Indicates support for the @code{-info-ada-exceptions} command.
 @end table
 
 @subheading The @code{-list-target-features} Command
-- 
1.8.1.2


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

* Re: [RFA/Ada(v2) 1/3] Add command to list Ada exceptions
  2013-11-08 12:05 ` [RFA/Ada(v2) 1/3] Add command to list Ada exceptions Joel Brobecker
  2013-11-08 13:40   ` Pedro Alves
@ 2013-11-13 17:04   ` Tom Tromey
  2013-11-13 18:29     ` Joel Brobecker
  1 sibling, 1 reply; 24+ messages in thread
From: Tom Tromey @ 2013-11-13 17:04 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

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

Joel> This patch adds a new command "info exceptions" whose purpose is to
Joel> provide the list of exceptions currently defined in the inferior.
Joel> The usage is:

Joel>     (gdb) info exceptions [REGEXP]

Hi Joel.

The new test fails for me like this:

    (gdb) info exceptions
    All defined Ada exceptions:
    const.aint_global_e: 0x608120
    (gdb) FAIL: gdb.ada/info_exc.exp: info exceptions

The test case expects there to be more exceptions:

    gdb_test "info exceptions" \
        [multi_line "All defined Ada exceptions:" \
                    "constraint_error: $hex" \
                    "program_error: $hex" \
                    "storage_error: $hex" \
                    "tasking_error: $hex" \
                    "const.aint_global_e: $hex"]

Any ideas why this may happen?

I'm on Fedora 18 using the system gnat.
I have the libgnat debuginfo installed:

barimba. rpm -qil gcc-debuginfo | grep libgnat
/usr/lib/debug/usr/lib/gcc/x86_64-redhat-linux/4.7.2/adalib/libgnat-4.7.so.debug
/usr/lib/debug/usr/lib/gcc/x86_64-redhat-linux/4.7.2/adalib/libgnat.so.debug
/usr/lib/debug/usr/lib64/libgnat-4.7.so.debug

Tom

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

* Re: [RFA/Ada(v2) 1/3] Add command to list Ada exceptions
  2013-11-13 17:04   ` Tom Tromey
@ 2013-11-13 18:29     ` Joel Brobecker
  2013-11-15  7:28       ` Joel Brobecker
  0 siblings, 1 reply; 24+ messages in thread
From: Joel Brobecker @ 2013-11-13 18:29 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

> The new test fails for me like this:
> 
>     (gdb) info exceptions
>     All defined Ada exceptions:
>     const.aint_global_e: 0x608120
>     (gdb) FAIL: gdb.ada/info_exc.exp: info exceptions
> 
> The test case expects there to be more exceptions:
> 
>     gdb_test "info exceptions" \
>         [multi_line "All defined Ada exceptions:" \
>                     "constraint_error: $hex" \
>                     "program_error: $hex" \
>                     "storage_error: $hex" \
>                     "tasking_error: $hex" \
>                     "const.aint_global_e: $hex"]
> 
> Any ideas why this may happen?
> 
> I'm on Fedora 18 using the system gnat.
> I have the libgnat debuginfo installed:
> 
> barimba. rpm -qil gcc-debuginfo | grep libgnat
> /usr/lib/debug/usr/lib/gcc/x86_64-redhat-linux/4.7.2/adalib/libgnat-4.7.so.debug
> /usr/lib/debug/usr/lib/gcc/x86_64-redhat-linux/4.7.2/adalib/libgnat.so.debug
> /usr/lib/debug/usr/lib64/libgnat-4.7.so.debug

Hmmm, you are missing the standard exceptions, for which you should not
even need debugging information. Could you send me privately the binary
as well as all SO dependencies?

Thanks!
-- 
Joel

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

* Re: [RFA/Ada(v2) 1/3] Add command to list Ada exceptions
  2013-11-13 18:29     ` Joel Brobecker
@ 2013-11-15  7:28       ` Joel Brobecker
  2013-11-15 15:53         ` Tom Tromey
  0 siblings, 1 reply; 24+ messages in thread
From: Joel Brobecker @ 2013-11-15  7:28 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 1354 bytes --]

> > The new test fails for me like this:
> > 
> >     (gdb) info exceptions
> >     All defined Ada exceptions:
> >     const.aint_global_e: 0x608120
> >     (gdb) FAIL: gdb.ada/info_exc.exp: info exceptions
> > 
> > The test case expects there to be more exceptions:
> > 
> >     gdb_test "info exceptions" \
> >         [multi_line "All defined Ada exceptions:" \
> >                     "constraint_error: $hex" \
> >                     "program_error: $hex" \
> >                     "storage_error: $hex" \
> >                     "tasking_error: $hex" \
> >                     "const.aint_global_e: $hex"]
> > 
> > Any ideas why this may happen?

I think I have an idea, now. It is similar to what we need to do
in the "catch exception" testcases, where we start the program
in order to be certain that we can find the symbols from the GNAT
runtime. On Fedora, and I suspect may other distros, the default
for gnatmake is to like against the shared libgnat, whereas the
gnatmake I use links against the static libgnat - this is why
I didn't see that omission. Can you try the attached?

gdb/ChangeLog:

        * gdb.ada/info_exc.exp: Start inferior before starting
        the "info exceptions" tests.
        * gdb.ada/mi_exc_info.exp: Start inferior before starting
        the "-info-ada-exceptions" tests.

Tested on x86_64-linux.

-- 
Joel

[-- Attachment #2: 0001-Start-inferior-before-running-test-listing-Ada-excep.patch --]
[-- Type: text/x-diff, Size: 1977 bytes --]

From d0aa384d0eb08c4bf855a967af49ec15bb513d97 Mon Sep 17 00:00:00 2001
From: Joel Brobecker <brobecker@adacore.com>
Date: Fri, 15 Nov 2013 10:30:00 +0400
Subject: [PATCH] Start inferior before running test listing Ada exceptions.

This patch fixes some spurious failures when the inferior is linked
against the shared version of libgnat by default, as appears to be
the case on many GNU/Linux distributions.  When that happens, we have
to start the program in order to ensure that the GNAT runtime is
mapped to memory, in order for us to find the standard exceptions
(defined within the runtime).  Otherwise, they will not be shown,
as expected, by the debugger.

gdb/ChangeLog:

        * gdb.ada/info_exc.exp: Start inferior before starting
        the "info exceptions" tests.
        * gdb.ada/mi_exc_info.exp: Start inferior before starting
        the "-info-ada-exceptions" tests.
---
 gdb/testsuite/gdb.ada/info_exc.exp    | 5 +++++
 gdb/testsuite/gdb.ada/mi_exc_info.exp | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/gdb/testsuite/gdb.ada/info_exc.exp b/gdb/testsuite/gdb.ada/info_exc.exp
index 3ff5180..9637bce 100644
--- a/gdb/testsuite/gdb.ada/info_exc.exp
+++ b/gdb/testsuite/gdb.ada/info_exc.exp
@@ -34,6 +34,11 @@ proc multi_line { args } {
 
 clean_restart ${testfile}
 
+if ![runto_main] then {
+   fail "Cannot run to main, testcase aborted"
+   return 0
+}
+
 gdb_test "info exceptions" \
     [multi_line "All defined Ada exceptions:" \
                 "constraint_error: $hex" \
diff --git a/gdb/testsuite/gdb.ada/mi_exc_info.exp b/gdb/testsuite/gdb.ada/mi_exc_info.exp
index b77ccbc..8325e90 100644
--- a/gdb/testsuite/gdb.ada/mi_exc_info.exp
+++ b/gdb/testsuite/gdb.ada/mi_exc_info.exp
@@ -29,6 +29,11 @@ if [mi_gdb_start] {
     continue
 }
 
+if ![mi_run_to_main] then {
+   fail "Cannot run to main, testcase aborted"
+   return 0
+}
+
 mi_delete_breakpoints
 mi_gdb_reinitialize_dir $srcdir/$subdir
 mi_gdb_load ${binfile}
-- 
1.8.1.2


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

* Re: [RFA/Ada(v2) 1/3] Add command to list Ada exceptions
  2013-11-15  7:28       ` Joel Brobecker
@ 2013-11-15 15:53         ` Tom Tromey
  2013-11-15 17:06           ` Joel Brobecker
  0 siblings, 1 reply; 24+ messages in thread
From: Tom Tromey @ 2013-11-15 15:53 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

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

Joel> On Fedora, and I suspect may other distros, the default
Joel> for gnatmake is to like against the shared libgnat, whereas the
Joel> gnatmake I use links against the static libgnat - this is why
Joel> I didn't see that omission. Can you try the attached?

Joel>         * gdb.ada/info_exc.exp: Start inferior before starting
Joel>         the "info exceptions" tests.
Joel>         * gdb.ada/mi_exc_info.exp: Start inferior before starting
Joel>         the "-info-ada-exceptions" tests.

Thanks Joel.  This still fails, but in a new way, see appended.

Tom

(gdb) info exceptions
All defined Ada exceptions:
constraint_error: 0x7ffff7fce600
program_error: 0x7ffff7fce580
storage_error: 0x7ffff7fce540
tasking_error: 0x7ffff7fce500
<_abort_signal>: 0x7ffff7fce4c0
ada.calendar.time_error: 0x7ffff7fcc060
ada.calendar.time_zones.unknown_zone_error: 0x7ffff7fcc0c0
ada.command_line.response_file.circularity_detected: 0x7ffff7fcc180
ada.command_line.response_file.file_does_not_exist: 0x7ffff7fcc240
ada.command_line.response_file.line_too_long: 0x7ffff7fcc200
ada.command_line.response_file.no_closing_quote: 0x7ffff7fcc1c0
ada.containers.capacity_error: 0x7ffff7fcc2c0
ada.io_exceptions.data_error: 0x7ffff7fcc440
ada.io_exceptions.device_error: 0x7ffff7fcc4c0
ada.io_exceptions.end_error: 0x7ffff7fcc480
ada.io_exceptions.layout_error: 0x7ffff7fcc400
ada.io_exceptions.mode_error: 0x7ffff7fcc580
ada.io_exceptions.name_error: 0x7ffff7fcc540
ada.io_exceptions.status_error: 0x7ffff7fcc5c0
ada.io_exceptions.use_error: 0x7ffff7fcc500
ada.numerics.argument_error: 0x7ffff7fcc740
ada.strings.index_error: 0x7ffff7fcc8a0
ada.strings.length_error: 0x7ffff7fcc920
ada.strings.pattern_error: 0x7ffff7fcc8e0
ada.strings.translation_error: 0x7ffff7fcc860
ada.strings.utf_encoding.encoding_error: 0x7ffff7fcc9a0
ada.tags.tag_error: 0x7ffff7fccac0
ada.text_io.editing.picture_error: 0x7ffff7fccb00
ada.wide_text_io.editing.picture_error: 0x7ffff7fccc80
ada.wide_wide_text_io.editing.picture_error: 0x7ffff7fccd20
const.aint_global_e: 0x608120
gnat.awk.data_error: 0x7ffff7fcce80
gnat.awk.end_error: 0x7ffff7fccf00
gnat.awk.field_error: 0x7ffff7fccec0
gnat.awk.file_error: 0x7ffff7fccf40
gnat.awk.session_error: 0x7ffff7fccf80
gnat.calendar.time_io.picture_error: 0x7ffff7fccfe0
gnat.cgi.cookie.cookie_not_found: 0x7ffff7fcd0c0
gnat.cgi.data_error: 0x7ffff7fcd060
gnat.cgi.parameter_not_found: 0x7ffff7fcd020
gnat.command_line.exit_from_command_line: 0x7ffff7fcd120
gnat.command_line.invalid_parameter: 0x7ffff7fcd160
gnat.command_line.invalid_section: 0x7ffff7fcd1e0
gnat.command_line.invalid_switch: 0x7ffff7fcd1a0
gnat.debug_pools.accessing_deallocated_storage: 0x7ffff7fcd300
gnat.debug_pools.accessing_not_allocated_storage: 0x7ffff7fcd340
gnat.debug_pools.freeing_deallocated_storage: 0x7ffff7fcd280
gnat.debug_pools.freeing_not_allocated_storage: 0x7ffff7fcd2c0
gnat.directory_operations.directory_error: 0x7ffff7fcd3a0
gnat.expect.invalid_process: 0x7ffff7fcd440
gnat.expect.process_died: 0x7ffff7fcd400
gnat.lock_files.lock_error: 0x7ffff7fcd4a0
gnat.perfect_hash_generators.too_many_tries: 0x7ffff7fcd540
gnat.serial_communications.serial_error: 0x7ffff7fcd5a0
gnat.sockets.host_error: 0x7ffff7fce7c0
gnat.sockets.service_error: 0x7ffff7fce780
gnat.sockets.socket_error: 0x7ffff7fce800
gnat.sockets.thin_common.in_addr_access_pointers.pointer_error: 0x7ffff7fce900
gnat.spitbol.patterns.pattern_stack_overflow: 0x7ffff7fcd920
gnat.string_split.index_error: 0x7ffff7fcd9a0
gnat.wide_string_split.index_error: 0x7ffff7fcda00
gnat.wide_wide_string_split.index_error: 0x7ffff7fcda40
interfaces.c.strings.dereference_error: 0x7ffff7fcdd60
interfaces.c.strings.update_error: 0x7ffff7fcdd20
interfaces.c.terminator_error: 0x7ffff7fcda80
interfaces.cobol.conversion_error: 0x7ffff7fcdce0
system.assertions.assert_failure: 0x7ffff7fcddc0
system.aux_dec.non_ada_error: 0x7ffff7fcde00
system.exceptions.foreign_exception: 0x7ffff7fcdee0
system.global_locks.lock_error: 0x7ffff7fcdfe0
system.regexp.error_in_regexp: 0x7ffff7fce240
system.regpat.expression_error: 0x7ffff7fce280
system.rpc.communication_error: 0x7ffff7fce2c0
(gdb) FAIL: gdb.ada/info_exc.exp: info exceptions

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

* Re: [RFA/Ada(v2) 1/3] Add command to list Ada exceptions
  2013-11-15 15:53         ` Tom Tromey
@ 2013-11-15 17:06           ` Joel Brobecker
  2013-11-15 17:48             ` Tom Tromey
  0 siblings, 1 reply; 24+ messages in thread
From: Joel Brobecker @ 2013-11-15 17:06 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 1512 bytes --]

> Joel>         * gdb.ada/info_exc.exp: Start inferior before starting
> Joel>         the "info exceptions" tests.
> Joel>         * gdb.ada/mi_exc_info.exp: Start inferior before starting
> Joel>         the "-info-ada-exceptions" tests.
> 
> Thanks Joel.  This still fails, but in a new way, see appended.

Humpf :-(. At least that's progress.

This one is pretty easy to understand: Because you have debugging
info for *all* runtime units, "info exceptions" gets to list them
as well. The output you're getting is legit, so we have to accept it.
That's a bit unfortunate, as this forces us to introduce wildcards
in the expected output. Oh well...

I've pushed the patch you tested, and then pushed also the attached
patch.

gdb/testsuite/ChangeLog:

        * gdb.ada/info_exc.exp: Allow other global exceptions to be
        listed in the output of "info exceptions".
        * gdb.ada/mi_exc_info.exp: Allow other global exceptions to be
        listed in the output of "-info-ada-exceptions".

I did not test it on Fedora, since I haven't installed much on
the VM I just created. But I tested on my x86_64-linux laptop,
by reproducing another form of the same problem, involving the
use of "gnatmake -f -a -g" instead of plain "gnatmake -g" to build
the program. The added options force the GNAT runtime to be recompiled,
thus putting me in the same situation as you. The testsuite passes
for me in both situations (no debug info, with debug info).

Hopefully that'll solve your issue as well.

-- 
Joel

[-- Attachment #2: 0001-gdb.ada-info_exc.exp-mi_exc_info.exp-handle-runtimes.patch --]
[-- Type: text/x-diff, Size: 2848 bytes --]

From 2d4bfc30088a64073d5c73d3b1afa7601a826763 Mon Sep 17 00:00:00 2001
From: Joel Brobecker <brobecker@adacore.com>
Date: Fri, 15 Nov 2013 20:34:09 +0400
Subject: [PATCH] gdb.ada/info_exc.exp,mi_exc_info.exp: handle runtimes with
 full debug info.

If the runtime has full debug info, then the non-standard exceptions
declared in the GNAT runtime will appear in the list of exceptions
printed by GDB ("info exceptions" or "-info-ada-exceptions").
This is valid output, so this patch allows for it.

gdb/testsuite/ChangeLog:

        * gdb.ada/info_exc.exp: Allow other global exceptions to be
        listed in the output of "info exceptions".
        * gdb.ada/mi_exc_info.exp: Allow other global exceptions to be
        listed in the output of "-info-ada-exceptions".
---
 gdb/testsuite/gdb.ada/info_exc.exp    | 4 +++-
 gdb/testsuite/gdb.ada/mi_exc_info.exp | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/gdb/testsuite/gdb.ada/info_exc.exp b/gdb/testsuite/gdb.ada/info_exc.exp
index 9637bce..9210029 100644
--- a/gdb/testsuite/gdb.ada/info_exc.exp
+++ b/gdb/testsuite/gdb.ada/info_exc.exp
@@ -45,7 +45,9 @@ gdb_test "info exceptions" \
                 "program_error: $hex" \
                 "storage_error: $hex" \
                 "tasking_error: $hex" \
-                "const.aint_global_e: $hex"]
+                ".*" \
+                "const.aint_global_e: $hex" \
+                ".*"]
 
 gdb_test "info exceptions task" \
     [multi_line "All Ada exceptions matching regular expression \"task\":" \
diff --git a/gdb/testsuite/gdb.ada/mi_exc_info.exp b/gdb/testsuite/gdb.ada/mi_exc_info.exp
index 8325e90..14a9e4d 100644
--- a/gdb/testsuite/gdb.ada/mi_exc_info.exp
+++ b/gdb/testsuite/gdb.ada/mi_exc_info.exp
@@ -39,7 +39,7 @@ mi_gdb_reinitialize_dir $srcdir/$subdir
 mi_gdb_load ${binfile}
 
 mi_gdb_test "-info-ada-exceptions" \
-  "\\^done,ada-exceptions={nr_rows=\"5\",nr_cols=\"2\",hdr=\\\[{width=\"1\",alignment=\"-1\",col_name=\"name\",colhdr=\"Name\"},{width=\"1\",alignment=\"-1\",col_name=\"address\",colhdr=\"Address\"}\\\],body=\\\[{name=\"constraint_error\",address=\"$hex\"},{name=\"program_error\",address=\"$hex\"},{name=\"storage_error\",address=\"$hex\"},{name=\"tasking_error\",address=\"$hex\"},{name=\"const.aint_global_e\",address=\"$hex\"}\\\]}" \
+  "\\^done,ada-exceptions={nr_rows=\"$decimal\",nr_cols=\"2\",hdr=\\\[{width=\"1\",alignment=\"-1\",col_name=\"name\",colhdr=\"Name\"},{width=\"1\",alignment=\"-1\",col_name=\"address\",colhdr=\"Address\"}\\\],body=\\\[{name=\"constraint_error\",address=\"$hex\"},{name=\"program_error\",address=\"$hex\"},{name=\"storage_error\",address=\"$hex\"},{name=\"tasking_error\",address=\"$hex\"},.*{name=\"const.aint_global_e\",address=\"$hex\"}.*\\\]}" \
   "-info-ada-exceptions"
 
 mi_gdb_test "-info-ada-exceptions task" \
-- 
1.8.1.2


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

* Re: [RFA/Ada(v2) 1/3] Add command to list Ada exceptions
  2013-11-15 17:06           ` Joel Brobecker
@ 2013-11-15 17:48             ` Tom Tromey
  2013-11-15 18:01               ` Joel Brobecker
  0 siblings, 1 reply; 24+ messages in thread
From: Tom Tromey @ 2013-11-15 17:48 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

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

Joel> Hopefully that'll solve your issue as well.

Almost there :)

    info exceptions global
    All Ada exceptions matching regular expression "global":
    const.aint_global_e: 0x608120
    system.global_locks.lock_error: 0x7ffff7fcdfe0
    (gdb) FAIL: gdb.ada/info_exc.exp: info exceptions global

I'm not sure if this was there before and I missed it, or if it is new.

Same failure for the MI case:

    -info-ada-exceptions global
    ^done,ada-exceptions={nr_rows="2",nr_cols="2",hdr=[{width="1",alignment="-1",col_name="name",colhdr="Name"},{width="1",alignment="-1",col_name="address",colhdr="Address"}],body=[{name="const.aint_global_e",address="0x0000000000608120"},{name="system.global_locks.lock_error",address="0x00007ffff7fcdfe0"}]}
    (gdb) 
    FAIL: gdb.ada/mi_exc_info.exp: -info-ada-exceptions global


Tom

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

* Re: [RFA/Ada(v2) 1/3] Add command to list Ada exceptions
  2013-11-15 17:48             ` Tom Tromey
@ 2013-11-15 18:01               ` Joel Brobecker
  2013-11-15 18:23                 ` Tom Tromey
  0 siblings, 1 reply; 24+ messages in thread
From: Joel Brobecker @ 2013-11-15 18:01 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 1391 bytes --]

> Almost there :)

(noisy sigh...). Sorry about this mess, Tom.

>     info exceptions global
>     All Ada exceptions matching regular expression "global":
>     const.aint_global_e: 0x608120
>     system.global_locks.lock_error: 0x7ffff7fcdfe0
>     (gdb) FAIL: gdb.ada/info_exc.exp: info exceptions global
> 
> I'm not sure if this was there before and I missed it, or if it is new.

It was probably there before. I didn't see it on my machine, because
not all runtime units get re-built with "-a -f", only the ones needed
by the program.

Can you try the attached patch? If it wasn't so late here, I'd test it
myself on the fedora machine - if it still fails, I promise, I will
get myself setup on fedora.

gdb/testsuite/ChangeLog:

        * info_exc/const.ads (Aint_Global_GDB_E): Renames Aint_Global_E.
        * info_exc/foo.adb: Adjust to new exception name.
        * info_exc.exp: Adjust after exception renaming in const.ads.
        Update "info exception global" test to test "info exceptions
        global_gdb" instead.

        * mi_exc_info/const.ads (Aint_Global_GDB_E): Renames Aint_Global_E.
        * mi_exc_info/foo.adb (Adjust to new exception name.
        * mi_exc_info.exp: Adjust after exception renaming in const.ads.
        Update "-info-ada-exceptions global" test to test
        "-info-ada-exceptions global_gdb" instead.

Tested on x86_64-linux.

-- 
Joel

[-- Attachment #2: 0001-gdb.ada-info_exc.exp-mi_exc_info.exp-Use-more-unique.patch --]
[-- Type: text/x-diff, Size: 7559 bytes --]

From 5aa2ad37e69981d120d594afbaba88c3810433f5 Mon Sep 17 00:00:00 2001
From: Joel Brobecker <brobecker@adacore.com>
Date: Fri, 15 Nov 2013 21:46:34 +0400
Subject: [PATCH] gdb.ada/info_exc.exp,mi_exc_info.exp: Use more unique
 exception name.

In the case where the GNAT runtime was built with full debugging info,
several of the exceptions defined there might have a name contain
the word "global". To make this less likely, this patch renames
the exception name, replacing "Global" by "Global_GDB". It still
keeps the exeption name relatively short, while it is unlikely that
the GNAT runtime have an exception whose name explicitly mentions GDB,
and even less likely that it contains "Global_GDB".

gdb/testsuite/ChangeLog:

        * info_exc/const.ads (Aint_Global_GDB_E): Renames Aint_Global_E.
        * info_exc/foo.adb: Adjust to new exception name.
        * info_exc.exp: Adjust after exception renaming in const.ads.
        Update "info exception global" test to test "info exceptions
        global_gdb" instead.

        * mi_exc_info/const.ads (Aint_Global_GDB_E): Renames Aint_Global_E.
        * mi_exc_info/foo.adb (Adjust to new exception name.
        * mi_exc_info.exp: Adjust after exception renaming in const.ads.
        Update "-info-ada-exceptions global" test to test
        "-info-ada-exceptions global_gdb" instead.
---
 gdb/testsuite/gdb.ada/info_exc.exp          | 10 +++++-----
 gdb/testsuite/gdb.ada/info_exc/const.ads    |  2 +-
 gdb/testsuite/gdb.ada/info_exc/foo.adb      |  2 +-
 gdb/testsuite/gdb.ada/mi_exc_info.exp       | 10 +++++-----
 gdb/testsuite/gdb.ada/mi_exc_info/const.ads |  2 +-
 gdb/testsuite/gdb.ada/mi_exc_info/foo.adb   |  2 +-
 6 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/gdb/testsuite/gdb.ada/info_exc.exp b/gdb/testsuite/gdb.ada/info_exc.exp
index 9210029..087ae32 100644
--- a/gdb/testsuite/gdb.ada/info_exc.exp
+++ b/gdb/testsuite/gdb.ada/info_exc.exp
@@ -46,19 +46,19 @@ gdb_test "info exceptions" \
                 "storage_error: $hex" \
                 "tasking_error: $hex" \
                 ".*" \
-                "const.aint_global_e: $hex" \
+                "const.aint_global_gdb_e: $hex" \
                 ".*"]
 
 gdb_test "info exceptions task" \
     [multi_line "All Ada exceptions matching regular expression \"task\":" \
                 "tasking_error: $hex"]
 
-gdb_test "info exceptions global" \
-    [multi_line "All Ada exceptions matching regular expression \"global\":" \
-                "const.aint_global_e: $hex"]
+gdb_test "info exceptions global_gdb" \
+    [multi_line "All Ada exceptions matching regular expression \"global_gdb\":" \
+                "const.aint_global_gdb_e: $hex"]
 
 gdb_test "info exceptions const.aint" \
     [multi_line "All Ada exceptions matching regular expression \"const\\.aint\":" \
                 "constraint_error: $hex" \
-                "const.aint_global_e: $hex"]
+                "const.aint_global_gdb_e: $hex"]
 
diff --git a/gdb/testsuite/gdb.ada/info_exc/const.ads b/gdb/testsuite/gdb.ada/info_exc/const.ads
index 753241e..20a8424 100644
--- a/gdb/testsuite/gdb.ada/info_exc/const.ads
+++ b/gdb/testsuite/gdb.ada/info_exc/const.ads
@@ -14,5 +14,5 @@
 --  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 package Const is
-   Aint_Global_E : exception;
+   Aint_Global_GDB_E : exception;
 end Const;
diff --git a/gdb/testsuite/gdb.ada/info_exc/foo.adb b/gdb/testsuite/gdb.ada/info_exc/foo.adb
index e047db2..f00a09e 100644
--- a/gdb/testsuite/gdb.ada/info_exc/foo.adb
+++ b/gdb/testsuite/gdb.ada/info_exc/foo.adb
@@ -16,5 +16,5 @@
 with Const; use Const;
 procedure Foo is
 begin
-   raise Aint_Global_E;
+   raise Aint_Global_GDB_E;
 end Foo;
diff --git a/gdb/testsuite/gdb.ada/mi_exc_info.exp b/gdb/testsuite/gdb.ada/mi_exc_info.exp
index 14a9e4d..6ca2328 100644
--- a/gdb/testsuite/gdb.ada/mi_exc_info.exp
+++ b/gdb/testsuite/gdb.ada/mi_exc_info.exp
@@ -39,18 +39,18 @@ mi_gdb_reinitialize_dir $srcdir/$subdir
 mi_gdb_load ${binfile}
 
 mi_gdb_test "-info-ada-exceptions" \
-  "\\^done,ada-exceptions={nr_rows=\"$decimal\",nr_cols=\"2\",hdr=\\\[{width=\"1\",alignment=\"-1\",col_name=\"name\",colhdr=\"Name\"},{width=\"1\",alignment=\"-1\",col_name=\"address\",colhdr=\"Address\"}\\\],body=\\\[{name=\"constraint_error\",address=\"$hex\"},{name=\"program_error\",address=\"$hex\"},{name=\"storage_error\",address=\"$hex\"},{name=\"tasking_error\",address=\"$hex\"},.*{name=\"const.aint_global_e\",address=\"$hex\"}.*\\\]}" \
+  "\\^done,ada-exceptions={nr_rows=\"$decimal\",nr_cols=\"2\",hdr=\\\[{width=\"1\",alignment=\"-1\",col_name=\"name\",colhdr=\"Name\"},{width=\"1\",alignment=\"-1\",col_name=\"address\",colhdr=\"Address\"}\\\],body=\\\[{name=\"constraint_error\",address=\"$hex\"},{name=\"program_error\",address=\"$hex\"},{name=\"storage_error\",address=\"$hex\"},{name=\"tasking_error\",address=\"$hex\"},.*{name=\"const.aint_global_gdb_e\",address=\"$hex\"}.*\\\]}" \
   "-info-ada-exceptions"
 
 mi_gdb_test "-info-ada-exceptions task" \
   "\\^done,ada-exceptions={nr_rows=\"1\",nr_cols=\"2\",hdr=\\\[{width=\"1\",alignment=\"-1\",col_name=\"name\",colhdr=\"Name\"},{width=\"1\",alignment=\"-1\",col_name=\"address\",colhdr=\"Address\"}\\\],body=\\\[{name=\"tasking_error\",address=\"$hex\"}\\\]}" \
   "-info-ada-exceptions task"
 
-mi_gdb_test "-info-ada-exceptions global" \
-  "\\^done,ada-exceptions={nr_rows=\"1\",nr_cols=\"2\",hdr=\\\[{width=\"1\",alignment=\"-1\",col_name=\"name\",colhdr=\"Name\"},{width=\"1\",alignment=\"-1\",col_name=\"address\",colhdr=\"Address\"}\\\],body=\\\[{name=\"const.aint_global_e\",address=\"$hex\"}\\\]}" \
-  "-info-ada-exceptions global"
+mi_gdb_test "-info-ada-exceptions global_gdb" \
+  "\\^done,ada-exceptions={nr_rows=\"1\",nr_cols=\"2\",hdr=\\\[{width=\"1\",alignment=\"-1\",col_name=\"name\",colhdr=\"Name\"},{width=\"1\",alignment=\"-1\",col_name=\"address\",colhdr=\"Address\"}\\\],body=\\\[{name=\"const.aint_global_gdb_e\",address=\"$hex\"}\\\]}" \
+  "-info-ada-exceptions global_gdb"
 
 mi_gdb_test "-info-ada-exceptions const.aint" \
-  "\\^done,ada-exceptions={nr_rows=\"2\",nr_cols=\"2\",hdr=\\\[{width=\"1\",alignment=\"-1\",col_name=\"name\",colhdr=\"Name\"},{width=\"1\",alignment=\"-1\",col_name=\"address\",colhdr=\"Address\"}\\\],body=\\\[{name=\"constraint_error\",address=\"$hex\"},{name=\"const.aint_global_e\",address=\"$hex\"}\\\]}" \
+  "\\^done,ada-exceptions={nr_rows=\"2\",nr_cols=\"2\",hdr=\\\[{width=\"1\",alignment=\"-1\",col_name=\"name\",colhdr=\"Name\"},{width=\"1\",alignment=\"-1\",col_name=\"address\",colhdr=\"Address\"}\\\],body=\\\[{name=\"constraint_error\",address=\"$hex\"},{name=\"const.aint_global_gdb_e\",address=\"$hex\"}\\\]}" \
   "-info-ada-exceptions const.aint"
 
diff --git a/gdb/testsuite/gdb.ada/mi_exc_info/const.ads b/gdb/testsuite/gdb.ada/mi_exc_info/const.ads
index 753241e..20a8424 100644
--- a/gdb/testsuite/gdb.ada/mi_exc_info/const.ads
+++ b/gdb/testsuite/gdb.ada/mi_exc_info/const.ads
@@ -14,5 +14,5 @@
 --  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 package Const is
-   Aint_Global_E : exception;
+   Aint_Global_GDB_E : exception;
 end Const;
diff --git a/gdb/testsuite/gdb.ada/mi_exc_info/foo.adb b/gdb/testsuite/gdb.ada/mi_exc_info/foo.adb
index e047db2..f00a09e 100644
--- a/gdb/testsuite/gdb.ada/mi_exc_info/foo.adb
+++ b/gdb/testsuite/gdb.ada/mi_exc_info/foo.adb
@@ -16,5 +16,5 @@
 with Const; use Const;
 procedure Foo is
 begin
-   raise Aint_Global_E;
+   raise Aint_Global_GDB_E;
 end Foo;
-- 
1.8.1.2


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

* Re: [RFA/Ada(v2) 1/3] Add command to list Ada exceptions
  2013-11-15 18:01               ` Joel Brobecker
@ 2013-11-15 18:23                 ` Tom Tromey
  2013-11-16  3:51                   ` pushed: " Joel Brobecker
  0 siblings, 1 reply; 24+ messages in thread
From: Tom Tromey @ 2013-11-15 18:23 UTC (permalink / raw)
  To: Joel Brobecker; +Cc: gdb-patches

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

Joel> (noisy sigh...). Sorry about this mess, Tom.

Hahaha.  This is just a minor blip.

Joel> Can you try the attached patch?

It worked fine for me.  Thank you.

Tom

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

* pushed: [RFA/Ada(v2) 1/3] Add command to list Ada exceptions
  2013-11-15 18:23                 ` Tom Tromey
@ 2013-11-16  3:51                   ` Joel Brobecker
  0 siblings, 0 replies; 24+ messages in thread
From: Joel Brobecker @ 2013-11-16  3:51 UTC (permalink / raw)
  To: gdb-patches

> Joel> Can you try the attached patch?
> 
> It worked fine for me.  Thank you.

Great. Thanks for the testing, Tom. Patch has just been pushed.

-- 
Joel

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

end of thread, other threads:[~2013-11-16  2:48 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-08 12:04 RFA/Ada (v2) new CLI + GDB/MI commands to list Ada exceptions Joel Brobecker
2013-11-08 12:04 ` [RFA/Ada(v2) 3/3] Document "info exceptions" and "-info-ada-exception" new commands Joel Brobecker
2013-11-08 14:21   ` Eli Zaretskii
2013-11-10  9:49     ` Joel Brobecker
2013-11-12  4:07   ` Joel Brobecker
2013-11-08 12:05 ` [RFA/Ada(v2) 1/3] Add command to list Ada exceptions Joel Brobecker
2013-11-08 13:40   ` Pedro Alves
2013-11-08 14:10     ` Joel Brobecker
2013-11-08 15:47       ` Tom Tromey
2013-11-08 16:13         ` Joel Brobecker
2013-11-08 16:32           ` Tom Tromey
2013-11-10  6:29         ` Joel Brobecker
2013-11-11 14:48           ` Tom Tromey
2013-11-13 17:04   ` Tom Tromey
2013-11-13 18:29     ` Joel Brobecker
2013-11-15  7:28       ` Joel Brobecker
2013-11-15 15:53         ` Tom Tromey
2013-11-15 17:06           ` Joel Brobecker
2013-11-15 17:48             ` Tom Tromey
2013-11-15 18:01               ` Joel Brobecker
2013-11-15 18:23                 ` Tom Tromey
2013-11-16  3:51                   ` pushed: " Joel Brobecker
2013-11-08 12:27 ` [RFA/Ada(v2) 2/3] Implement GDB/MI equivalent of "info exceptions" CLI command Joel Brobecker
2013-11-12  3:38 ` RFA/Ada (v2) new CLI + GDB/MI commands to list Ada exceptions Joel Brobecker

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).