Introduce show_debug_regs
[deliverable/binutils-gdb.git] / gdb / exceptions.h
CommitLineData
60250e8b
AC
1/* Exception (throw catch) mechanism, for GDB, the GNU debugger.
2
ecd75fc8 3 Copyright (C) 1986-2014 Free Software Foundation, Inc.
60250e8b
AC
4
5 This file is part of GDB.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
a9762ec7 9 the Free Software Foundation; either version 3 of the License, or
60250e8b
AC
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
a9762ec7 18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
60250e8b
AC
19
20#ifndef EXCEPTIONS_H
21#define EXCEPTIONS_H
22
ff55e1b5 23#include "common-exceptions.h"
e74e72b4 24#include "ui-out.h"
2a78bfb5 25
c1043fc2 26/* A pre-defined non-exception. */
71fff37b 27extern const struct gdb_exception exception_none;
c1043fc2 28
8a076db9 29/* If E is an exception, print it's error message on the specified
0963b4bd 30 stream. For _fprintf, prefix the message with PREFIX... */
71fff37b
AC
31extern void exception_print (struct ui_file *file, struct gdb_exception e);
32extern void exception_fprintf (struct ui_file *file, struct gdb_exception e,
9cbc821d 33 const char *prefix,
a0b31db1 34 ...) ATTRIBUTE_PRINTF (3, 4);
8a076db9 35
60250e8b
AC
36/* Call FUNC(UIOUT, FUNC_ARGS) but wrapped within an exception
37 handler. If an exception (enum return_reason) is thrown using
38 throw_exception() than all cleanups installed since
39 catch_exceptions() was entered are invoked, the (-ve) exception
40 value is then returned by catch_exceptions. If FUNC() returns
787274f0 41 normally (with a positive or zero return value) then that value is
60250e8b
AC
42 returned by catch_exceptions(). It is an internal_error() for
43 FUNC() to return a negative value.
44
45 For the period of the FUNC() call: UIOUT is installed as the output
46 builder; ERRSTRING is installed as the error/quit message; and a
47 new cleanup_chain is established. The old values are restored
48 before catch_exceptions() returns.
49
50 The variant catch_exceptions_with_msg() is the same as
51 catch_exceptions() but adds the ability to return an allocated
52 copy of the gdb error message. This is used when a silent error is
53 issued and the caller wants to manually issue the error message.
54
787274f0
DE
55 MASK specifies what to catch; it is normally set to
56 RETURN_MASK_ALL, if for no other reason than that the code which
57 calls catch_errors might not be set up to deal with a quit which
58 isn't caught. But if the code can deal with it, it generally
59 should be RETURN_MASK_ERROR, unless for some reason it is more
60 useful to abort only the portion of the operation inside the
61 catch_errors. Note that quit should return to the command line
62 fairly quickly, even if some further processing is being done.
63
60250e8b
AC
64 FIXME; cagney/2001-08-13: The need to override the global UIOUT
65 builder variable should just go away.
66
787274f0 67 This function supersedes catch_errors().
60250e8b
AC
68
69 This function uses SETJMP() and LONGJUMP(). */
70
71struct ui_out;
72typedef int (catch_exceptions_ftype) (struct ui_out *ui_out, void *args);
73extern int catch_exceptions (struct ui_out *uiout,
74 catch_exceptions_ftype *func, void *func_args,
1c3c7ee7 75 return_mask mask);
2a78bfb5 76typedef void (catch_exception_ftype) (struct ui_out *ui_out, void *args);
60250e8b
AC
77extern int catch_exceptions_with_msg (struct ui_out *uiout,
78 catch_exceptions_ftype *func,
79 void *func_args,
1c3c7ee7 80 char **gdberrmsg,
60250e8b 81 return_mask mask);
8a076db9 82
60250e8b 83/* If CATCH_ERRORS_FTYPE throws an error, catch_errors() returns zero
0963b4bd 84 otherwize the result from CATCH_ERRORS_FTYPE is returned. It is
60250e8b 85 probably useful for CATCH_ERRORS_FTYPE to always return a non-zero
0963b4bd 86 value. It's unfortunate that, catch_errors() does not return an
60250e8b
AC
87 indication of the exact exception that it caught - quit_flag might
88 help.
89
787274f0 90 This function is superseded by catch_exceptions(). */
60250e8b
AC
91
92typedef int (catch_errors_ftype) (void *);
93extern int catch_errors (catch_errors_ftype *, void *, char *, return_mask);
94
60250e8b 95#endif
This page took 0.641603 seconds and 4 git commands to generate.