forked from Imagelibrary/binutils-gdb
Add command support for Guile.
* Makefile.in (SUBDIR_GUILE_OBS): Add scm-cmd.o. (SUBDIR_GUILE_SRCS): Add scm-cmd.c. (scm-cmd.o): New rule. * guile/guile-internal.h (gdbscm_gc_xstrdup): Declare. (gdbscm_user_error_p): Declare. (gdbscm_parse_command_name): Declare. (gdbscm_valid_command_class_p): Declare. (gdbscm_initialize_commands): Declare. * guile/guile.c (initialize_gdb_module): Call gdbscm_initialize_commands. * guile/lib/gdb.scm: Export command symbols. * guile/lib/gdb/init.scm (%exception-keys): Add gdb:user-error. (throw-user-error): New function. * guile/scm-cmd.c: New file. * guile/scm-exception.c (user_error_symbol): New static global. (gdbscm_user_error_p): New function. (gdbscm_initialize_exceptions): Set user_error_symbol. * scm-utils.c (gdbscm_gc_xstrdup): New function. testsuite/ * gdb.guile/scm-cmd.c: New file. * gdb.guile/scm-cmd.exp: New file. doc/ * guile.texi (Guile API): Add entry for Commands In Guile. (Basic Guile) <parse-and-eval>: Add reference. (Basic Guile) <string->argv>: Move definition to Commands In Guile. (GDB Scheme Data Types): Mention <gdb:command> object. (Commands In Guile): New node.
This commit is contained in:
@@ -64,6 +64,9 @@ static SCM memory_error_symbol;
|
||||
/* User interrupt, e.g., RETURN_QUIT in struct gdb_exception. */
|
||||
static SCM signal_symbol;
|
||||
|
||||
/* A user error, e.g., bad arg to gdb command. */
|
||||
static SCM user_error_symbol;
|
||||
|
||||
/* Printing the stack is done by first capturing the stack and recording it in
|
||||
a <gdb:exception> object with this key and with the ARGS field set to
|
||||
(cons real-key (cons stack real-args)).
|
||||
@@ -391,6 +394,15 @@ gdbscm_memory_error_p (SCM key)
|
||||
return scm_is_eq (key, memory_error_symbol);
|
||||
}
|
||||
|
||||
/* Return non-zero if KEY is gdb:user-error.
|
||||
Note: This is an excp_matcher_func function. */
|
||||
|
||||
int
|
||||
gdbscm_user_error_p (SCM key)
|
||||
{
|
||||
return scm_is_eq (key, user_error_symbol);
|
||||
}
|
||||
|
||||
/* Wrapper around scm_throw to throw a gdb:exception.
|
||||
This function does not return.
|
||||
This function cannot be called from inside TRY_CATCH. */
|
||||
@@ -663,6 +675,8 @@ gdbscm_initialize_exceptions (void)
|
||||
|
||||
memory_error_symbol = scm_from_latin1_symbol ("gdb:memory-error");
|
||||
|
||||
user_error_symbol = scm_from_latin1_symbol ("gdb:user-error");
|
||||
|
||||
gdbscm_invalid_object_error_symbol
|
||||
= scm_from_latin1_symbol ("gdb:invalid-object-error");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user