+2014-07-14 Pedro Alves <palves@redhat.com>
+
+ * exceptions.c (catch_command_errors, catch_command_errors_const):
+ Moved to main.c.
+ * exceptions.h (catch_command_errors_ftype)
+ (catch_command_errors_const_ftype): Moved to main.c.
+ (catch_command_errors, catch_command_errors_const): Delete
+ declarations.
+ * main.c (catch_command_errors_ftype)
+ (catch_command_errors_const_ftype): Moved here from exceptions.h.
+ (catch_command_errors, catch_command_errors_const)): Moved here
+ from exceptions.c and make static.
+
2014-07-14 Pedro Alves <palves@redhat.com>
* exceptions.c (print_any_exception): Delete.
return 0;
return val;
}
-
-int
-catch_command_errors (catch_command_errors_ftype *command,
- char *arg, int from_tty, return_mask mask)
-{
- volatile struct gdb_exception e;
-
- TRY_CATCH (e, mask)
- {
- command (arg, from_tty);
- }
- exception_print (gdb_stderr, e);
- if (e.reason < 0)
- return 0;
- return 1;
-}
-
-int
-catch_command_errors_const (catch_command_errors_const_ftype *command,
- const char *arg, int from_tty, return_mask mask)
-{
- volatile struct gdb_exception e;
-
- TRY_CATCH (e, mask)
- {
- command (arg, from_tty);
- }
- exception_print (gdb_stderr, e);
- if (e.reason < 0)
- return 0;
- return 1;
-}
typedef int (catch_errors_ftype) (void *);
extern int catch_errors (catch_errors_ftype *, void *, char *, return_mask);
-/* Template to catch_errors() that wraps calls to command
- functions. */
-
-typedef void (catch_command_errors_ftype) (char *, int);
-extern int catch_command_errors (catch_command_errors_ftype *func,
- char *arg, int from_tty, return_mask);
-
-/* Like catch_command_errors, but works with const command and args. */
-
-typedef void (catch_command_errors_const_ftype) (const char *, int);
-extern int catch_command_errors_const (catch_command_errors_const_ftype *func,
- const char *arg, int from_tty, return_mask);
-
#endif
return 1;
}
+/* Type of the command callback passed to catch_command_errors. */
+
+typedef void (catch_command_errors_ftype) (char *, int);
+
+/* Wrap calls to commands run before the event loop is started. */
+
+static int
+catch_command_errors (catch_command_errors_ftype *command,
+ char *arg, int from_tty, return_mask mask)
+{
+ volatile struct gdb_exception e;
+
+ TRY_CATCH (e, mask)
+ {
+ command (arg, from_tty);
+ }
+ exception_print (gdb_stderr, e);
+ if (e.reason < 0)
+ return 0;
+ return 1;
+}
+
+/* Type of the command callback passed to catch_command_errors_const. */
+
+typedef void (catch_command_errors_const_ftype) (const char *, int);
+
+/* Like catch_command_errors, but works with const command and args. */
+
+static int
+catch_command_errors_const (catch_command_errors_const_ftype *command,
+ const char *arg, int from_tty, return_mask mask)
+{
+ volatile struct gdb_exception e;
+
+ TRY_CATCH (e, mask)
+ {
+ command (arg, from_tty);
+ }
+ exception_print (gdb_stderr, e);
+ if (e.reason < 0)
+ return 0;
+ return 1;
+}
+
/* Arguments of --command option and its counterpart. */
typedef struct cmdarg {
/* Type of this option. */