Move catch_command_errors and catch_command_errors_const to main.c

We'll need to add error handling code to commands run before the event
loop starts (commands in .gdbinit, -ex commands, etc.).  Turns out
those are run through catch_command_errors, and, catch_command_errors
is used nowhere else.  Move it (and the _const variant) to main.c, so
that we can further specialize it freely.

gdb/
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.
This commit is contained in:
Pedro Alves
2014-07-14 19:55:31 +01:00
parent feefc97b59
commit 9d1e69a214
4 changed files with 57 additions and 45 deletions

View File

@@ -521,35 +521,3 @@ catch_errors (catch_errors_ftype *func, void *func_args, char *errstring,
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;
}