Add command to list Ada exceptions
authorJoel Brobecker <brobecker@adacore.com>
Thu, 7 Nov 2013 13:40:48 +0000 (17:40 +0400)
committerJoel Brobecker <brobecker@adacore.com>
Tue, 12 Nov 2013 02:45:29 +0000 (06:45 +0400)
commit778865d3e288f4fcf3b293e78d52cd5dacb4b999
tree9bc37efb587b92f4e942f94cb9d5d5d07339a04c
parent304a8ac17c606a83a60a371267daa71ab0bcbc12
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/ChangeLog
gdb/ada-lang.c
gdb/ada-lang.h
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.ada/info_exc.exp [new file with mode: 0644]
gdb/testsuite/gdb.ada/info_exc/const.ads [new file with mode: 0644]
gdb/testsuite/gdb.ada/info_exc/foo.adb [new file with mode: 0644]
This page took 0.032779 seconds and 4 git commands to generate.