mirror of
https://github.com/darlinghq/darling-gdb.git
synced 2024-11-27 22:10:32 +00:00
2005-01-12 Andrew Cagney <cagney@gnu.org>
* exceptions.c (exception_none): New variable. * Makefile.in: Update dependencies. * interps.c: Include "exceptions.h". (interpreter_exec_cmd, interp_exec): Update to return "struct exception" * exceptions.h (no_exception): Declare. * tui/tui-interp.c (tui_exec): Update to return "struct exception" * mi/mi-interp.c: Include "exceptions.h". (mi_cmd_interpreter_exec, mi_interpreter_exec): Update to return 'struct exception". * cli/cli-interp.c (cli_interpreter_exec, safe_execute_command) (do_captured_execute_command): Update to use catch_exception. * interps.h: Include "exceptions.h". (interp_exec_ftype, interp_exec): Return "struct exception".
This commit is contained in:
parent
2a78bfb53c
commit
c1043fc2c1
@ -1,5 +1,20 @@
|
|||||||
2005-01-12 Andrew Cagney <cagney@gnu.org>
|
2005-01-12 Andrew Cagney <cagney@gnu.org>
|
||||||
|
|
||||||
|
* exceptions.c (exception_none): New variable.
|
||||||
|
* Makefile.in: Update dependencies.
|
||||||
|
* interps.c: Include "exceptions.h".
|
||||||
|
(interpreter_exec_cmd, interp_exec): Update to return "struct
|
||||||
|
exception"
|
||||||
|
* exceptions.h (no_exception): Declare.
|
||||||
|
* tui/tui-interp.c (tui_exec): Update to return "struct exception"
|
||||||
|
* mi/mi-interp.c: Include "exceptions.h".
|
||||||
|
(mi_cmd_interpreter_exec, mi_interpreter_exec): Update to return
|
||||||
|
'struct exception".
|
||||||
|
* cli/cli-interp.c (cli_interpreter_exec, safe_execute_command)
|
||||||
|
(do_captured_execute_command): Update to use catch_exception.
|
||||||
|
* interps.h: Include "exceptions.h".
|
||||||
|
(interp_exec_ftype, interp_exec): Return "struct exception".
|
||||||
|
|
||||||
* exceptions.h (throw_reason): Rename throw_exception.
|
* exceptions.h (throw_reason): Rename throw_exception.
|
||||||
(enum errors, struct exception): Define.
|
(enum errors, struct exception): Define.
|
||||||
(catch_exception_ftype): Define.
|
(catch_exception_ftype): Define.
|
||||||
|
@ -714,7 +714,7 @@ inf_loop_h = inf-loop.h
|
|||||||
inflow_h = inflow.h $(terminal_h)
|
inflow_h = inflow.h $(terminal_h)
|
||||||
inf_ptrace_h = inf-ptrace.h
|
inf_ptrace_h = inf-ptrace.h
|
||||||
inf_ttrace_h = inf-ttrace.h
|
inf_ttrace_h = inf-ttrace.h
|
||||||
interps_h = interps.h
|
interps_h = interps.h $(exceptions_h)
|
||||||
jv_lang_h = jv-lang.h
|
jv_lang_h = jv-lang.h
|
||||||
kod_h = kod.h
|
kod_h = kod.h
|
||||||
language_h = language.h
|
language_h = language.h
|
||||||
@ -1758,13 +1758,13 @@ breakpoint.o: breakpoint.c $(defs_h) $(symtab_h) $(frame_h) $(breakpoint_h) \
|
|||||||
$(objfiles_h) $(source_h) $(linespec_h) $(completer_h) $(gdb_h) \
|
$(objfiles_h) $(source_h) $(linespec_h) $(completer_h) $(gdb_h) \
|
||||||
$(ui_out_h) $(cli_script_h) $(gdb_assert_h) $(block_h) $(solist_h) \
|
$(ui_out_h) $(cli_script_h) $(gdb_assert_h) $(block_h) $(solist_h) \
|
||||||
$(observer_h) $(exceptions_h) $(gdb_events_h)
|
$(observer_h) $(exceptions_h) $(gdb_events_h)
|
||||||
bsd-uthread.o: bsd-uthread.c $(defs_h) $(gdb_core_h) $(gdbthread_h) \
|
|
||||||
$(inferior_h) $(objfiles_h) $(observer_h) $(regcache_h) \
|
|
||||||
$(solist_h) $(symfile_h) $(target_h) $(gdb_assert_h) \
|
|
||||||
$(gdb_obstack_h) $(bsd_uthread_h)
|
|
||||||
bsd-kvm.o: bsd-kvm.c $(defs_h) $(cli_cmds_h) $(command_h) $(frame_h) \
|
bsd-kvm.o: bsd-kvm.c $(defs_h) $(cli_cmds_h) $(command_h) $(frame_h) \
|
||||||
$(regcache_h) $(target_h) $(value_h) $(gdbcore_h) $(gdb_assert_h) \
|
$(regcache_h) $(target_h) $(value_h) $(gdbcore_h) $(gdb_assert_h) \
|
||||||
$(readline_h) $(bsd_kvm_h)
|
$(readline_h) $(bsd_kvm_h)
|
||||||
|
bsd-uthread.o: bsd-uthread.c $(defs_h) $(gdbcore_h) $(gdbthread_h) \
|
||||||
|
$(inferior_h) $(objfiles_h) $(observer_h) $(regcache_h) $(solist_h) \
|
||||||
|
$(symfile_h) $(target_h) $(gdb_assert_h) $(gdb_obstack_h) \
|
||||||
|
$(bsd_uthread_h)
|
||||||
buildsym.o: buildsym.c $(defs_h) $(bfd_h) $(gdb_obstack_h) $(symtab_h) \
|
buildsym.o: buildsym.c $(defs_h) $(bfd_h) $(gdb_obstack_h) $(symtab_h) \
|
||||||
$(symfile_h) $(objfiles_h) $(gdbtypes_h) $(gdb_assert_h) \
|
$(symfile_h) $(objfiles_h) $(gdbtypes_h) $(gdb_assert_h) \
|
||||||
$(complaints_h) $(gdb_string_h) $(expression_h) $(bcache_h) \
|
$(complaints_h) $(gdb_string_h) $(expression_h) $(bcache_h) \
|
||||||
@ -1896,7 +1896,9 @@ event-loop.o: event-loop.c $(defs_h) $(event_loop_h) $(event_top_h) \
|
|||||||
event-top.o: event-top.c $(defs_h) $(top_h) $(inferior_h) $(target_h) \
|
event-top.o: event-top.c $(defs_h) $(top_h) $(inferior_h) $(target_h) \
|
||||||
$(terminal_h) $(event_loop_h) $(event_top_h) $(interps_h) \
|
$(terminal_h) $(event_loop_h) $(event_top_h) $(interps_h) \
|
||||||
$(exceptions_h) $(gdbcmd_h) $(readline_h) $(readline_history_h)
|
$(exceptions_h) $(gdbcmd_h) $(readline_h) $(readline_history_h)
|
||||||
exceptions.o: exceptions.c
|
exceptions.o: exceptions.c $(defs_h) $(exceptions_h) $(breakpoint_h) \
|
||||||
|
$(target_h) $(inferior_h) $(annotate_h) $(ui_out_h) $(gdb_assert_h) \
|
||||||
|
$(gdb_string_h)
|
||||||
exec.o: exec.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) $(gdbcmd_h) \
|
exec.o: exec.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) $(gdbcmd_h) \
|
||||||
$(language_h) $(symfile_h) $(objfiles_h) $(completer_h) $(value_h) \
|
$(language_h) $(symfile_h) $(objfiles_h) $(completer_h) $(value_h) \
|
||||||
$(exec_h) $(readline_h) $(gdb_string_h) $(gdbcore_h) $(gdb_stat_h) \
|
$(exec_h) $(readline_h) $(gdb_string_h) $(gdbcore_h) $(gdb_stat_h) \
|
||||||
@ -2109,7 +2111,7 @@ inf-ttrace.o: inf-ttrace.c $(defs_h) $(command_h) $(gdbcore_h) \
|
|||||||
$(gdb_assert_h) $(gdb_string_h) $(inf_child_h) $(inf_ttrace_h)
|
$(gdb_assert_h) $(gdb_string_h) $(inf_child_h) $(inf_ttrace_h)
|
||||||
interps.o: interps.c $(defs_h) $(gdbcmd_h) $(ui_out_h) $(event_loop_h) \
|
interps.o: interps.c $(defs_h) $(gdbcmd_h) $(ui_out_h) $(event_loop_h) \
|
||||||
$(event_top_h) $(interps_h) $(completer_h) $(gdb_string_h) \
|
$(event_top_h) $(interps_h) $(completer_h) $(gdb_string_h) \
|
||||||
$(gdb_events_h) $(gdb_assert_h) $(top_h)
|
$(gdb_events_h) $(gdb_assert_h) $(top_h) $(exceptions_h)
|
||||||
irix5-nat.o: irix5-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) $(target_h) \
|
irix5-nat.o: irix5-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) $(target_h) \
|
||||||
$(regcache_h) $(gdb_string_h) $(gregset_h) $(mips_tdep_h)
|
$(regcache_h) $(gdb_string_h) $(gregset_h) $(mips_tdep_h)
|
||||||
jv-exp.o: jv-exp.c $(defs_h) $(gdb_string_h) $(expression_h) $(value_h) \
|
jv-exp.o: jv-exp.c $(defs_h) $(gdb_string_h) $(expression_h) $(value_h) \
|
||||||
@ -2945,7 +2947,8 @@ mi-getopt.o: $(srcdir)/mi/mi-getopt.c $(defs_h) $(mi_getopt_h) \
|
|||||||
$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-getopt.c
|
$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-getopt.c
|
||||||
mi-interp.o: $(srcdir)/mi/mi-interp.c $(defs_h) $(gdb_string_h) $(interps_h) \
|
mi-interp.o: $(srcdir)/mi/mi-interp.c $(defs_h) $(gdb_string_h) $(interps_h) \
|
||||||
$(event_top_h) $(event_loop_h) $(inferior_h) $(ui_out_h) $(top_h) \
|
$(event_top_h) $(event_loop_h) $(inferior_h) $(ui_out_h) $(top_h) \
|
||||||
$(mi_main_h) $(mi_cmds_h) $(mi_out_h) $(mi_console_h)
|
$(exceptions_h) $(mi_main_h) $(mi_cmds_h) $(mi_out_h) \
|
||||||
|
$(mi_console_h)
|
||||||
$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-interp.c
|
$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-interp.c
|
||||||
mi-main.o: $(srcdir)/mi/mi-main.c $(defs_h) $(target_h) $(inferior_h) \
|
mi-main.o: $(srcdir)/mi/mi-main.c $(defs_h) $(target_h) $(inferior_h) \
|
||||||
$(gdb_string_h) $(exceptions_h) $(top_h) $(gdbthread_h) $(mi_cmds_h) \
|
$(gdb_string_h) $(exceptions_h) $(top_h) $(gdbthread_h) $(mi_cmds_h) \
|
||||||
|
@ -34,9 +34,8 @@ struct ui_out *cli_uiout;
|
|||||||
/* These are the ui_out and the interpreter for the console interpreter. */
|
/* These are the ui_out and the interpreter for the console interpreter. */
|
||||||
|
|
||||||
/* Longjmp-safe wrapper for "execute_command" */
|
/* Longjmp-safe wrapper for "execute_command" */
|
||||||
static int do_captured_execute_command (struct ui_out *uiout, void *data);
|
static struct exception safe_execute_command (struct ui_out *uiout,
|
||||||
static enum gdb_rc safe_execute_command (struct ui_out *uiout, char *command,
|
char *command, int from_tty);
|
||||||
int from_tty);
|
|
||||||
struct captured_execute_command_args
|
struct captured_execute_command_args
|
||||||
{
|
{
|
||||||
char *command;
|
char *command;
|
||||||
@ -93,11 +92,11 @@ cli_interpreter_display_prompt_p (void *data)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static struct exception
|
||||||
cli_interpreter_exec (void *data, const char *command_str)
|
cli_interpreter_exec (void *data, const char *command_str)
|
||||||
{
|
{
|
||||||
int result;
|
|
||||||
struct ui_file *old_stream;
|
struct ui_file *old_stream;
|
||||||
|
struct exception result;
|
||||||
|
|
||||||
/* FIXME: cagney/2003-02-01: Need to const char *propogate
|
/* FIXME: cagney/2003-02-01: Need to const char *propogate
|
||||||
safe_execute_command. */
|
safe_execute_command. */
|
||||||
@ -115,23 +114,22 @@ cli_interpreter_exec (void *data, const char *command_str)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static void
|
||||||
do_captured_execute_command (struct ui_out *uiout, void *data)
|
do_captured_execute_command (struct ui_out *uiout, void *data)
|
||||||
{
|
{
|
||||||
struct captured_execute_command_args *args =
|
struct captured_execute_command_args *args =
|
||||||
(struct captured_execute_command_args *) data;
|
(struct captured_execute_command_args *) data;
|
||||||
execute_command (args->command, args->from_tty);
|
execute_command (args->command, args->from_tty);
|
||||||
return GDB_RC_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum gdb_rc
|
static struct exception
|
||||||
safe_execute_command (struct ui_out *uiout, char *command, int from_tty)
|
safe_execute_command (struct ui_out *uiout, char *command, int from_tty)
|
||||||
{
|
{
|
||||||
struct captured_execute_command_args args;
|
struct captured_execute_command_args args;
|
||||||
args.command = command;
|
args.command = command;
|
||||||
args.from_tty = from_tty;
|
args.from_tty = from_tty;
|
||||||
return catch_exceptions (uiout, do_captured_execute_command, &args,
|
return catch_exception (uiout, do_captured_execute_command, &args,
|
||||||
NULL, RETURN_MASK_ALL);
|
RETURN_MASK_ALL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -32,6 +32,8 @@
|
|||||||
#include "gdb_assert.h"
|
#include "gdb_assert.h"
|
||||||
#include "gdb_string.h"
|
#include "gdb_string.h"
|
||||||
|
|
||||||
|
const struct exception exception_none = { 0, NO_ERROR, NULL };
|
||||||
|
|
||||||
/* One should use catch_errors rather than manipulating these
|
/* One should use catch_errors rather than manipulating these
|
||||||
directly. */
|
directly. */
|
||||||
#if defined(HAVE_SIGSETJMP)
|
#if defined(HAVE_SIGSETJMP)
|
||||||
|
@ -62,6 +62,9 @@ struct exception
|
|||||||
char *message;
|
char *message;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* A pre-defined non-exception. */
|
||||||
|
extern const struct exception exception_none;
|
||||||
|
|
||||||
/* Throw an exception (as described by "struct exception"). Will
|
/* Throw an exception (as described by "struct exception"). Will
|
||||||
execute a LONG JUMP to the inner most containing exception handler
|
execute a LONG JUMP to the inner most containing exception handler
|
||||||
established using catch_exceptions() (or similar).
|
established using catch_exceptions() (or similar).
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
#include "gdb-events.h"
|
#include "gdb-events.h"
|
||||||
#include "gdb_assert.h"
|
#include "gdb_assert.h"
|
||||||
#include "top.h" /* For command_loop. */
|
#include "top.h" /* For command_loop. */
|
||||||
|
#include "exceptions.h"
|
||||||
|
|
||||||
struct interp
|
struct interp
|
||||||
{
|
{
|
||||||
@ -304,14 +305,14 @@ interp_exec_p (struct interp *interp)
|
|||||||
return interp->procs->exec_proc != NULL;
|
return interp->procs->exec_proc != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
struct exception
|
||||||
interp_exec (struct interp *interp, const char *command_str)
|
interp_exec (struct interp *interp, const char *command_str)
|
||||||
{
|
{
|
||||||
if (interp->procs->exec_proc != NULL)
|
if (interp->procs->exec_proc != NULL)
|
||||||
{
|
{
|
||||||
return interp->procs->exec_proc (interp->data, command_str);
|
return interp->procs->exec_proc (interp->data, command_str);
|
||||||
}
|
}
|
||||||
return 0;
|
return exception_none;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* A convenience routine that nulls out all the
|
/* A convenience routine that nulls out all the
|
||||||
@ -398,7 +399,8 @@ interpreter_exec_cmd (char *args, int from_tty)
|
|||||||
|
|
||||||
for (i = 1; i < nrules; i++)
|
for (i = 1; i < nrules; i++)
|
||||||
{
|
{
|
||||||
if (!interp_exec (interp_to_use, prules[i]))
|
struct exception e = interp_exec (interp_to_use, prules[i]);
|
||||||
|
if (!e.reason)
|
||||||
{
|
{
|
||||||
interp_set (old_interp);
|
interp_set (old_interp);
|
||||||
interp_set_quiet (interp_to_use, old_quiet);
|
interp_set_quiet (interp_to_use, old_quiet);
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
#ifndef INTERPS_H
|
#ifndef INTERPS_H
|
||||||
#define INTERPS_H
|
#define INTERPS_H
|
||||||
|
|
||||||
|
#include "exceptions.h"
|
||||||
|
|
||||||
struct ui_out;
|
struct ui_out;
|
||||||
struct interp;
|
struct interp;
|
||||||
|
|
||||||
@ -31,14 +33,15 @@ extern int interp_resume (struct interp *interp);
|
|||||||
extern int interp_suspend (struct interp *interp);
|
extern int interp_suspend (struct interp *interp);
|
||||||
extern int interp_prompt_p (struct interp *interp);
|
extern int interp_prompt_p (struct interp *interp);
|
||||||
extern int interp_exec_p (struct interp *interp);
|
extern int interp_exec_p (struct interp *interp);
|
||||||
extern int interp_exec (struct interp *interp, const char *command);
|
extern struct exception interp_exec (struct interp *interp,
|
||||||
|
const char *command);
|
||||||
extern int interp_quiet_p (struct interp *interp);
|
extern int interp_quiet_p (struct interp *interp);
|
||||||
|
|
||||||
typedef void *(interp_init_ftype) (void);
|
typedef void *(interp_init_ftype) (void);
|
||||||
typedef int (interp_resume_ftype) (void *data);
|
typedef int (interp_resume_ftype) (void *data);
|
||||||
typedef int (interp_suspend_ftype) (void *data);
|
typedef int (interp_suspend_ftype) (void *data);
|
||||||
typedef int (interp_prompt_p_ftype) (void *data);
|
typedef int (interp_prompt_p_ftype) (void *data);
|
||||||
typedef int (interp_exec_ftype) (void *data, const char *command);
|
typedef struct exception (interp_exec_ftype) (void *data, const char *command);
|
||||||
typedef void (interp_command_loop_ftype) (void *data);
|
typedef void (interp_command_loop_ftype) (void *data);
|
||||||
|
|
||||||
struct interp_procs
|
struct interp_procs
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
#include "inferior.h"
|
#include "inferior.h"
|
||||||
#include "ui-out.h"
|
#include "ui-out.h"
|
||||||
#include "top.h"
|
#include "top.h"
|
||||||
|
#include "exceptions.h"
|
||||||
#include "mi-main.h"
|
#include "mi-main.h"
|
||||||
#include "mi-cmds.h"
|
#include "mi-cmds.h"
|
||||||
#include "mi-out.h"
|
#include "mi-out.h"
|
||||||
@ -145,13 +145,14 @@ mi_interpreter_suspend (void *data)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static struct exception
|
||||||
mi_interpreter_exec (void *data, const char *command)
|
mi_interpreter_exec (void *data, const char *command)
|
||||||
{
|
{
|
||||||
|
static struct exception ok;
|
||||||
char *tmp = alloca (strlen (command) + 1);
|
char *tmp = alloca (strlen (command) + 1);
|
||||||
strcpy (tmp, command);
|
strcpy (tmp, command);
|
||||||
mi_execute_command_wrapper (tmp);
|
mi_execute_command_wrapper (tmp);
|
||||||
return 1;
|
return exception_none;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Never display the default gdb prompt in mi case. */
|
/* Never display the default gdb prompt in mi case. */
|
||||||
@ -236,12 +237,15 @@ mi_cmd_interpreter_exec (char *command, char **argv, int argc)
|
|||||||
since that is what the cli expects - before running the command,
|
since that is what the cli expects - before running the command,
|
||||||
and then set it back to 0 when we are done. */
|
and then set it back to 0 when we are done. */
|
||||||
sync_execution = 1;
|
sync_execution = 1;
|
||||||
if (interp_exec (interp_to_use, argv[i]) < 0)
|
{
|
||||||
{
|
struct exception e = interp_exec (interp_to_use, argv[i]);
|
||||||
mi_error_message = error_last_message ();
|
if (e.reason < 0)
|
||||||
result = MI_CMD_ERROR;
|
{
|
||||||
break;
|
mi_error_message = e.message;
|
||||||
}
|
result = MI_CMD_ERROR;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
xfree (buff);
|
xfree (buff);
|
||||||
do_exec_error_cleanups (ALL_CLEANUPS);
|
do_exec_error_cleanups (ALL_CLEANUPS);
|
||||||
sync_execution = 0;
|
sync_execution = 0;
|
||||||
|
@ -106,7 +106,7 @@ tui_display_prompt_p (void *data)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static struct exception
|
||||||
tui_exec (void *data, const char *command_str)
|
tui_exec (void *data, const char *command_str)
|
||||||
{
|
{
|
||||||
internal_error (__FILE__, __LINE__, "tui_exec called");
|
internal_error (__FILE__, __LINE__, "tui_exec called");
|
||||||
|
Loading…
Reference in New Issue
Block a user