Add Guile as an extension language.
* NEWS: Mention Guile scripting.
* Makefile.in (SUBDIR_GUILE_OBS): New variable.
(SUBDIR_GUILE_SRCS, SUBDIR_GUILE_DEPS): New variables
(SUBDIR_GUILE_LDFLAGS, SUBDIR_GUILE_CFLAGS): New variables.
(INTERNAL_CPPFLAGS): Add GUILE_CPPFLAGS.
(CLIBS): Add GUILE_LIBS.
(install-guile): New rule.
(guile.o): New rule.
(scm-arch.o, scm-auto-load.o, scm-block.o): New rules.
(scm-breakpoint.o, scm-disasm.o, scm-exception.o): New rules.
(scm-frame.o, scm-iterator.o, scm-lazy-string.o): New rules.
(scm-math.o, scm-objfile.o, scm-ports.o): New rules.
(scm-pretty-print.o, scm-safe-call.o, scm-gsmob.o): New rules.
(scm-string.o, scm-symbol.o, scm-symtab.o): New rules.
(scm-type.o, scm-utils.o, scm-value.o): New rules.
* configure.ac: New option --with-guile.
* configure: Regenerate.
* config.in: Regenerate.
* auto-load.c: Remove #include "python/python.h". Add #include
"gdb/section-scripts.h".
(source_section_scripts): Handle Guile scripts.
(_initialize_auto_load): Add name of Guile objfile script to
scripts-directory help text.
* breakpoint.c (condition_command): Tweak comment to include Scheme.
* breakpoint.h (gdbscm_breakpoint_object): Add forward decl.
(struct breakpoint): New member scm_bp_object.
* defs.h (enum command_control_type): New value guile_control.
* cli/cli-cmds.c: Remove #include "python/python.h". Add #include
"extension.h".
(show_user): Update comment.
(_initialize_cli_cmds): Update help text for "show user". Update help
text for max-user-call-depth.
* cli/cli-script.c: Remove #include "python/python.h". Add #include
"extension.h".
(multi_line_command_p): Add guile_control.
(print_command_lines): Handle guile_control.
(execute_control_command, recurse_read_control_structure): Ditto.
(process_next_line): Recognize "guile" commands.
* disasm.c (gdb_disassemble_info): Make non-static.
* disasm.h: #include "dis-asm.h".
(struct gdbarch): Add forward decl.
(gdb_disassemble_info): Declare.
* extension.c: #include "guile/guile.h".
(extension_languages): Add guile.
(get_ext_lang_defn): Handle EXT_LANG_GDB.
* extension.h (enum extension_language): New value EXT_LANG_GUILE.
* gdbtypes.c (get_unsigned_type_max): New function.
(get_signed_type_minmax): New function.
* gdbtypes.h (get_unsigned_type_max): Declare.
(get_signed_type_minmax): Declare.
* guile/README: New file.
* guile/guile-internal.h: New file.
* guile/guile.c: New file.
* guile/guile.h: New file.
* guile/scm-arch.c: New file.
* guile/scm-auto-load.c: New file.
* guile/scm-block.c: New file.
* guile/scm-breakpoint.c: New file.
* guile/scm-disasm.c: New file.
* guile/scm-exception.c: New file.
* guile/scm-frame.c: New file.
* guile/scm-gsmob.c: New file.
* guile/scm-iterator.c: New file.
* guile/scm-lazy-string.c: New file.
* guile/scm-math.c: New file.
* guile/scm-objfile.c: New file.
* guile/scm-ports.c: New file.
* guile/scm-pretty-print.c: New file.
* guile/scm-safe-call.c: New file.
* guile/scm-string.c: New file.
* guile/scm-symbol.c: New file.
* guile/scm-symtab.c: New file.
* guile/scm-type.c: New file.
* guile/scm-utils.c: New file.
* guile/scm-value.c: New file.
* guile/lib/gdb.scm: New file.
* guile/lib/gdb/boot.scm: New file.
* guile/lib/gdb/experimental.scm: New file.
* guile/lib/gdb/init.scm: New file.
* guile/lib/gdb/iterator.scm: New file.
* guile/lib/gdb/printing.scm: New file.
* guile/lib/gdb/types.scm: New file.
* data-directory/Makefile.in (GUILE_SRCDIR): New variable.
(VPATH): Add $(GUILE_SRCDIR).
(GUILE_DIR): New variable.
(GUILE_INSTALL_DIR, GUILE_FILES): New variables.
(all): Add stamp-guile dependency.
(stamp-guile): New rule.
(clean-guile, install-guile, uninstall-guile): New rules.
(install-only): Add install-guile dependency.
(uninstall): Add uninstall-guile dependency.
(clean): Add clean-guile dependency.
doc/
* Makefile.in (GDB_DOC_FILES): Add guile.texi.
* gdb.texinfo (Auto-loading): Add set/show auto-load guile-scripts.
(Extending GDB): New menu entries Guile, Multiple Extension Languages.
(Guile docs): Include guile.texi.
(objfile-gdbdotext file): Add objfile-gdb.scm.
(dotdebug_gdb_scripts section): Mention Guile scripts.
(Multiple Extension Languages): New node.
* guile.texi: New file.
testsuite/
* configure.ac (AC_OUTPUT): Add gdb.guile.
* configure: Regenerate.
* lib/gdb-guile.exp: New file.
* lib/gdb.exp (get_target_charset): New function.
* gdb.base/help.exp: Update expected output from "apropos apropos".
* gdb.guile/Makefile.in: New file.
* gdb.guile/guile.exp: New file.
* gdb.guile/scm-arch.c: New file.
* gdb.guile/scm-arch.exp: New file.
* gdb.guile/scm-block.c: New file.
* gdb.guile/scm-block.exp: New file.
* gdb.guile/scm-breakpoint.c: New file.
* gdb.guile/scm-breakpoint.exp: New file.
* gdb.guile/scm-disasm.c: New file.
* gdb.guile/scm-disasm.exp: New file.
* gdb.guile/scm-equal.c: New file.
* gdb.guile/scm-equal.exp: New file.
* gdb.guile/scm-error.exp: New file.
* gdb.guile/scm-error.scm: New file.
* gdb.guile/scm-frame-args.c: New file.
* gdb.guile/scm-frame-args.exp: New file.
* gdb.guile/scm-frame-args.scm: New file.
* gdb.guile/scm-frame-inline.c: New file.
* gdb.guile/scm-frame-inline.exp: New file.
* gdb.guile/scm-frame.c: New file.
* gdb.guile/scm-frame.exp: New file.
* gdb.guile/scm-generics.exp: New file.
* gdb.guile/scm-gsmob.exp: New file.
* gdb.guile/scm-iterator.c: New file.
* gdb.guile/scm-iterator.exp: New file.
* gdb.guile/scm-math.c: New file.
* gdb.guile/scm-math.exp: New file.
* gdb.guile/scm-objfile-script-gdb.in: New file.
* gdb.guile/scm-objfile-script.c: New file.
* gdb.guile/scm-objfile-script.exp: New file.
* gdb.guile/scm-objfile.c: New file.
* gdb.guile/scm-objfile.exp: New file.
* gdb.guile/scm-ports.exp: New file.
* gdb.guile/scm-pretty-print.c: New file.
* gdb.guile/scm-pretty-print.exp: New file.
* gdb.guile/scm-pretty-print.scm: New file.
* gdb.guile/scm-section-script.c: New file.
* gdb.guile/scm-section-script.exp: New file.
* gdb.guile/scm-section-script.scm: New file.
* gdb.guile/scm-symbol.c: New file.
* gdb.guile/scm-symbol.exp: New file.
* gdb.guile/scm-symtab-2.c: New file.
* gdb.guile/scm-symtab.c: New file.
* gdb.guile/scm-symtab.exp: New file.
* gdb.guile/scm-type.c: New file.
* gdb.guile/scm-type.exp: New file.
* gdb.guile/scm-value-cc.cc: New file.
* gdb.guile/scm-value-cc.exp: New file.
* gdb.guile/scm-value.c: New file.
* gdb.guile/scm-value.exp: New file.
* gdb.guile/source2.scm: New file.
* gdb.guile/types-module.cc: New file.
* gdb.guile/types-module.exp: New file.
2014-02-10 03:40:01 +00:00
|
|
|
|
/* GDB/Scheme exception support.
|
|
|
|
|
|
|
|
|
|
Copyright (C) 2014 Free Software Foundation, Inc.
|
|
|
|
|
|
|
|
|
|
This file is part of GDB.
|
|
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
|
|
|
|
|
|
|
|
/* See README file in this directory for implementation notes, coding
|
|
|
|
|
conventions, et.al. */
|
|
|
|
|
|
|
|
|
|
/* Notes:
|
|
|
|
|
|
|
|
|
|
IWBN to support SRFI 34/35. At the moment we follow Guile's own
|
|
|
|
|
exception mechanism.
|
|
|
|
|
|
|
|
|
|
The non-static functions in this file have prefix gdbscm_ and
|
|
|
|
|
not exscm_ on purpose. */
|
|
|
|
|
|
|
|
|
|
#include "defs.h"
|
|
|
|
|
#include <signal.h>
|
|
|
|
|
#include "gdb_assert.h"
|
|
|
|
|
#include "guile-internal.h"
|
|
|
|
|
|
|
|
|
|
/* The <gdb:exception> smob.
|
|
|
|
|
This is used to record and handle Scheme exceptions.
|
|
|
|
|
One important invariant is that <gdb:exception> smobs are never a valid
|
|
|
|
|
result of a function, other than to signify an exception occurred. */
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
/* This always appears first. */
|
|
|
|
|
gdb_smob base;
|
|
|
|
|
|
|
|
|
|
/* The key and args parameters to "throw". */
|
|
|
|
|
SCM key;
|
|
|
|
|
SCM args;
|
|
|
|
|
} exception_smob;
|
|
|
|
|
|
|
|
|
|
static const char exception_smob_name[] = "gdb:exception";
|
|
|
|
|
|
|
|
|
|
/* The tag Guile knows the exception smob by. */
|
|
|
|
|
static scm_t_bits exception_smob_tag;
|
|
|
|
|
|
|
|
|
|
/* A generic error in struct gdb_exception.
|
|
|
|
|
I.e., not RETURN_QUIT and not MEMORY_ERROR. */
|
|
|
|
|
static SCM error_symbol;
|
|
|
|
|
|
|
|
|
|
/* An error occurred accessing inferior memory.
|
|
|
|
|
This is not a Scheme programming error. */
|
|
|
|
|
static SCM memory_error_symbol;
|
|
|
|
|
|
|
|
|
|
/* User interrupt, e.g., RETURN_QUIT in struct gdb_exception. */
|
|
|
|
|
static SCM signal_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)).
|
|
|
|
|
See gdbscm_make_exception_with_stack. */
|
|
|
|
|
static SCM with_stack_error_symbol;
|
|
|
|
|
|
|
|
|
|
/* The key to use for an invalid object exception. An invalid object is one
|
|
|
|
|
where the underlying object has been removed from GDB. */
|
|
|
|
|
SCM gdbscm_invalid_object_error_symbol;
|
|
|
|
|
|
|
|
|
|
/* Values for "guile print-stack" as symbols. */
|
|
|
|
|
static SCM none_symbol;
|
|
|
|
|
static SCM message_symbol;
|
|
|
|
|
static SCM full_symbol;
|
|
|
|
|
|
|
|
|
|
static const char percent_print_exception_message_name[] =
|
|
|
|
|
"%print-exception-message";
|
|
|
|
|
|
|
|
|
|
/* Variable containing %print-exception-message.
|
|
|
|
|
It is not defined until late in initialization, after our init routine
|
|
|
|
|
has run. Cope by looking it up lazily. */
|
|
|
|
|
static SCM percent_print_exception_message_var = SCM_BOOL_F;
|
|
|
|
|
|
|
|
|
|
static const char percent_print_exception_with_stack_name[] =
|
|
|
|
|
"%print-exception-with-stack";
|
|
|
|
|
|
|
|
|
|
/* Variable containing %print-exception-with-stack.
|
|
|
|
|
It is not defined until late in initialization, after our init routine
|
|
|
|
|
has run. Cope by looking it up lazily. */
|
|
|
|
|
static SCM percent_print_exception_with_stack_var = SCM_BOOL_F;
|
|
|
|
|
|
|
|
|
|
/* Counter to keep track of the number of times we create a <gdb:exception>
|
|
|
|
|
object, for performance monitoring purposes. */
|
|
|
|
|
static unsigned long gdbscm_exception_count = 0;
|
|
|
|
|
|
|
|
|
|
/* Administrivia for exception smobs. */
|
|
|
|
|
|
|
|
|
|
/* The smob "print" function for <gdb:exception>. */
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
exscm_print_exception_smob (SCM self, SCM port, scm_print_state *pstate)
|
|
|
|
|
{
|
|
|
|
|
exception_smob *e_smob = (exception_smob *) SCM_SMOB_DATA (self);
|
|
|
|
|
|
|
|
|
|
gdbscm_printf (port, "#<%s ", exception_smob_name);
|
|
|
|
|
scm_write (e_smob->key, port);
|
|
|
|
|
scm_puts (" ", port);
|
|
|
|
|
scm_write (e_smob->args, port);
|
|
|
|
|
scm_puts (">", port);
|
|
|
|
|
|
|
|
|
|
scm_remember_upto_here_1 (self);
|
|
|
|
|
|
|
|
|
|
/* Non-zero means success. */
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* (make-exception key args) -> <gdb:exception> */
|
|
|
|
|
|
|
|
|
|
SCM
|
|
|
|
|
gdbscm_make_exception (SCM key, SCM args)
|
|
|
|
|
{
|
|
|
|
|
exception_smob *e_smob = (exception_smob *)
|
|
|
|
|
scm_gc_malloc (sizeof (exception_smob), exception_smob_name);
|
|
|
|
|
SCM smob;
|
|
|
|
|
|
|
|
|
|
e_smob->key = key;
|
|
|
|
|
e_smob->args = args;
|
|
|
|
|
smob = scm_new_smob (exception_smob_tag, (scm_t_bits) e_smob);
|
|
|
|
|
gdbscm_init_gsmob (&e_smob->base);
|
|
|
|
|
|
|
|
|
|
++gdbscm_exception_count;
|
|
|
|
|
|
|
|
|
|
return smob;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return non-zero if SCM is a <gdb:exception> object. */
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
gdbscm_is_exception (SCM scm)
|
|
|
|
|
{
|
|
|
|
|
return SCM_SMOB_PREDICATE (exception_smob_tag, scm);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* (exception? scm) -> boolean */
|
|
|
|
|
|
|
|
|
|
static SCM
|
|
|
|
|
gdbscm_exception_p (SCM scm)
|
|
|
|
|
{
|
|
|
|
|
return scm_from_bool (gdbscm_is_exception (scm));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* (exception-key <gdb:exception>) -> key */
|
|
|
|
|
|
|
|
|
|
SCM
|
|
|
|
|
gdbscm_exception_key (SCM self)
|
|
|
|
|
{
|
|
|
|
|
exception_smob *e_smob;
|
|
|
|
|
|
|
|
|
|
SCM_ASSERT_TYPE (gdbscm_is_exception (self), self, SCM_ARG1, FUNC_NAME,
|
|
|
|
|
"gdb:exception");
|
|
|
|
|
|
|
|
|
|
e_smob = (exception_smob *) SCM_SMOB_DATA (self);
|
|
|
|
|
return e_smob->key;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* (exception-args <gdb:exception>) -> arg-list */
|
|
|
|
|
|
|
|
|
|
SCM
|
|
|
|
|
gdbscm_exception_args (SCM self)
|
|
|
|
|
{
|
|
|
|
|
exception_smob *e_smob;
|
|
|
|
|
|
|
|
|
|
SCM_ASSERT_TYPE (gdbscm_is_exception (self), self, SCM_ARG1, FUNC_NAME,
|
|
|
|
|
"gdb:exception");
|
|
|
|
|
|
|
|
|
|
e_smob = (exception_smob *) SCM_SMOB_DATA (self);
|
|
|
|
|
return e_smob->args;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Wrap an exception in a <gdb:exception> object that includes STACK.
|
|
|
|
|
gdbscm_print_exception_with_stack knows how to unwrap it. */
|
|
|
|
|
|
|
|
|
|
SCM
|
|
|
|
|
gdbscm_make_exception_with_stack (SCM key, SCM args, SCM stack)
|
|
|
|
|
{
|
|
|
|
|
return gdbscm_make_exception (with_stack_error_symbol,
|
|
|
|
|
scm_cons (key, scm_cons (stack, args)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Version of scm_error_scm that creates a gdb:exception object that can later
|
|
|
|
|
be passed to gdbscm_throw.
|
|
|
|
|
KEY is a symbol denoting the kind of error.
|
|
|
|
|
SUBR is either #f or a string marking the function in which the error
|
|
|
|
|
occurred.
|
|
|
|
|
MESSAGE is either #f or the error message string. It may contain ~a and ~s
|
|
|
|
|
modifiers, provided by ARGS.
|
|
|
|
|
ARGS is a list of args to MESSAGE.
|
|
|
|
|
DATA is an arbitrary object, its value depends on KEY. The value to pass
|
|
|
|
|
here is a bit underspecified by Guile. */
|
|
|
|
|
|
|
|
|
|
SCM
|
|
|
|
|
gdbscm_make_error_scm (SCM key, SCM subr, SCM message, SCM args, SCM data)
|
|
|
|
|
{
|
|
|
|
|
return gdbscm_make_exception (key, scm_list_4 (subr, message, args, data));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Version of scm_error that creates a gdb:exception object that can later
|
|
|
|
|
be passed to gdbscm_throw.
|
|
|
|
|
See gdbscm_make_error_scm for a description of the arguments. */
|
|
|
|
|
|
|
|
|
|
SCM
|
|
|
|
|
gdbscm_make_error (SCM key, const char *subr, const char *message,
|
|
|
|
|
SCM args, SCM data)
|
|
|
|
|
{
|
|
|
|
|
return gdbscm_make_error_scm
|
|
|
|
|
(key,
|
|
|
|
|
subr == NULL ? SCM_BOOL_F : scm_from_latin1_string (subr),
|
|
|
|
|
message == NULL ? SCM_BOOL_F : scm_from_latin1_string (message),
|
|
|
|
|
args, data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Version of SCM_ASSERT_TYPE/scm_wrong_type_arg_msg that creates a
|
|
|
|
|
gdb:exception object that can later be passed to gdbscm_throw. */
|
|
|
|
|
|
|
|
|
|
SCM
|
|
|
|
|
gdbscm_make_type_error (const char *subr, int arg_pos, SCM bad_value,
|
|
|
|
|
const char *expected_type)
|
|
|
|
|
{
|
|
|
|
|
char *msg;
|
|
|
|
|
SCM result;
|
|
|
|
|
|
|
|
|
|
if (arg_pos > 0)
|
|
|
|
|
{
|
|
|
|
|
if (expected_type != NULL)
|
|
|
|
|
{
|
|
|
|
|
msg = xstrprintf (_("Wrong type argument in position %d"
|
|
|
|
|
" (expecting %s): ~S"),
|
|
|
|
|
arg_pos, expected_type);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
msg = xstrprintf (_("Wrong type argument in position %d: ~S"),
|
|
|
|
|
arg_pos);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (expected_type != NULL)
|
|
|
|
|
{
|
|
|
|
|
msg = xstrprintf (_("Wrong type argument (expecting %s): ~S"),
|
|
|
|
|
expected_type);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
msg = xstrprintf (_("Wrong type argument: ~S"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result = gdbscm_make_error (scm_arg_type_key, subr, msg,
|
|
|
|
|
scm_list_1 (bad_value), scm_list_1 (bad_value));
|
|
|
|
|
xfree (msg);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* A variant of gdbscm_make_type_error for non-type argument errors.
|
|
|
|
|
ERROR_PREFIX and ERROR are combined to build the error message.
|
|
|
|
|
Care needs to be taken so that the i18n composed form is still
|
|
|
|
|
reasonable, but no one is going to translate these anyway so we don't
|
|
|
|
|
worry too much.
|
|
|
|
|
ERROR_PREFIX may be NULL, ERROR may not be NULL. */
|
|
|
|
|
|
|
|
|
|
static SCM
|
|
|
|
|
gdbscm_make_arg_error (SCM key, const char *subr, int arg_pos, SCM bad_value,
|
|
|
|
|
const char *error_prefix, const char *error)
|
|
|
|
|
{
|
|
|
|
|
char *msg;
|
|
|
|
|
SCM result;
|
|
|
|
|
|
|
|
|
|
if (error_prefix != NULL)
|
|
|
|
|
{
|
|
|
|
|
if (arg_pos > 0)
|
|
|
|
|
{
|
|
|
|
|
msg = xstrprintf (_("%s %s in position %d: ~S"),
|
|
|
|
|
error_prefix, error, arg_pos);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
msg = xstrprintf (_("%s %s: ~S"), error_prefix, error);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (arg_pos > 0)
|
|
|
|
|
msg = xstrprintf (_("%s in position %d: ~S"), error, arg_pos);
|
|
|
|
|
else
|
|
|
|
|
msg = xstrprintf (_("%s: ~S"), error);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result = gdbscm_make_error (key, subr, msg,
|
|
|
|
|
scm_list_1 (bad_value), scm_list_1 (bad_value));
|
|
|
|
|
xfree (msg);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Make an invalid-object error <gdb:exception> object.
|
|
|
|
|
OBJECT is the name of the kind of object that is invalid. */
|
|
|
|
|
|
|
|
|
|
SCM
|
|
|
|
|
gdbscm_make_invalid_object_error (const char *subr, int arg_pos, SCM bad_value,
|
|
|
|
|
const char *object)
|
|
|
|
|
{
|
|
|
|
|
return gdbscm_make_arg_error (gdbscm_invalid_object_error_symbol,
|
|
|
|
|
subr, arg_pos, bad_value,
|
|
|
|
|
_("Invalid object:"), object);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Throw an invalid-object error.
|
|
|
|
|
OBJECT is the name of the kind of object that is invalid. */
|
|
|
|
|
|
2014-05-21 18:52:51 +00:00
|
|
|
|
void
|
Add Guile as an extension language.
* NEWS: Mention Guile scripting.
* Makefile.in (SUBDIR_GUILE_OBS): New variable.
(SUBDIR_GUILE_SRCS, SUBDIR_GUILE_DEPS): New variables
(SUBDIR_GUILE_LDFLAGS, SUBDIR_GUILE_CFLAGS): New variables.
(INTERNAL_CPPFLAGS): Add GUILE_CPPFLAGS.
(CLIBS): Add GUILE_LIBS.
(install-guile): New rule.
(guile.o): New rule.
(scm-arch.o, scm-auto-load.o, scm-block.o): New rules.
(scm-breakpoint.o, scm-disasm.o, scm-exception.o): New rules.
(scm-frame.o, scm-iterator.o, scm-lazy-string.o): New rules.
(scm-math.o, scm-objfile.o, scm-ports.o): New rules.
(scm-pretty-print.o, scm-safe-call.o, scm-gsmob.o): New rules.
(scm-string.o, scm-symbol.o, scm-symtab.o): New rules.
(scm-type.o, scm-utils.o, scm-value.o): New rules.
* configure.ac: New option --with-guile.
* configure: Regenerate.
* config.in: Regenerate.
* auto-load.c: Remove #include "python/python.h". Add #include
"gdb/section-scripts.h".
(source_section_scripts): Handle Guile scripts.
(_initialize_auto_load): Add name of Guile objfile script to
scripts-directory help text.
* breakpoint.c (condition_command): Tweak comment to include Scheme.
* breakpoint.h (gdbscm_breakpoint_object): Add forward decl.
(struct breakpoint): New member scm_bp_object.
* defs.h (enum command_control_type): New value guile_control.
* cli/cli-cmds.c: Remove #include "python/python.h". Add #include
"extension.h".
(show_user): Update comment.
(_initialize_cli_cmds): Update help text for "show user". Update help
text for max-user-call-depth.
* cli/cli-script.c: Remove #include "python/python.h". Add #include
"extension.h".
(multi_line_command_p): Add guile_control.
(print_command_lines): Handle guile_control.
(execute_control_command, recurse_read_control_structure): Ditto.
(process_next_line): Recognize "guile" commands.
* disasm.c (gdb_disassemble_info): Make non-static.
* disasm.h: #include "dis-asm.h".
(struct gdbarch): Add forward decl.
(gdb_disassemble_info): Declare.
* extension.c: #include "guile/guile.h".
(extension_languages): Add guile.
(get_ext_lang_defn): Handle EXT_LANG_GDB.
* extension.h (enum extension_language): New value EXT_LANG_GUILE.
* gdbtypes.c (get_unsigned_type_max): New function.
(get_signed_type_minmax): New function.
* gdbtypes.h (get_unsigned_type_max): Declare.
(get_signed_type_minmax): Declare.
* guile/README: New file.
* guile/guile-internal.h: New file.
* guile/guile.c: New file.
* guile/guile.h: New file.
* guile/scm-arch.c: New file.
* guile/scm-auto-load.c: New file.
* guile/scm-block.c: New file.
* guile/scm-breakpoint.c: New file.
* guile/scm-disasm.c: New file.
* guile/scm-exception.c: New file.
* guile/scm-frame.c: New file.
* guile/scm-gsmob.c: New file.
* guile/scm-iterator.c: New file.
* guile/scm-lazy-string.c: New file.
* guile/scm-math.c: New file.
* guile/scm-objfile.c: New file.
* guile/scm-ports.c: New file.
* guile/scm-pretty-print.c: New file.
* guile/scm-safe-call.c: New file.
* guile/scm-string.c: New file.
* guile/scm-symbol.c: New file.
* guile/scm-symtab.c: New file.
* guile/scm-type.c: New file.
* guile/scm-utils.c: New file.
* guile/scm-value.c: New file.
* guile/lib/gdb.scm: New file.
* guile/lib/gdb/boot.scm: New file.
* guile/lib/gdb/experimental.scm: New file.
* guile/lib/gdb/init.scm: New file.
* guile/lib/gdb/iterator.scm: New file.
* guile/lib/gdb/printing.scm: New file.
* guile/lib/gdb/types.scm: New file.
* data-directory/Makefile.in (GUILE_SRCDIR): New variable.
(VPATH): Add $(GUILE_SRCDIR).
(GUILE_DIR): New variable.
(GUILE_INSTALL_DIR, GUILE_FILES): New variables.
(all): Add stamp-guile dependency.
(stamp-guile): New rule.
(clean-guile, install-guile, uninstall-guile): New rules.
(install-only): Add install-guile dependency.
(uninstall): Add uninstall-guile dependency.
(clean): Add clean-guile dependency.
doc/
* Makefile.in (GDB_DOC_FILES): Add guile.texi.
* gdb.texinfo (Auto-loading): Add set/show auto-load guile-scripts.
(Extending GDB): New menu entries Guile, Multiple Extension Languages.
(Guile docs): Include guile.texi.
(objfile-gdbdotext file): Add objfile-gdb.scm.
(dotdebug_gdb_scripts section): Mention Guile scripts.
(Multiple Extension Languages): New node.
* guile.texi: New file.
testsuite/
* configure.ac (AC_OUTPUT): Add gdb.guile.
* configure: Regenerate.
* lib/gdb-guile.exp: New file.
* lib/gdb.exp (get_target_charset): New function.
* gdb.base/help.exp: Update expected output from "apropos apropos".
* gdb.guile/Makefile.in: New file.
* gdb.guile/guile.exp: New file.
* gdb.guile/scm-arch.c: New file.
* gdb.guile/scm-arch.exp: New file.
* gdb.guile/scm-block.c: New file.
* gdb.guile/scm-block.exp: New file.
* gdb.guile/scm-breakpoint.c: New file.
* gdb.guile/scm-breakpoint.exp: New file.
* gdb.guile/scm-disasm.c: New file.
* gdb.guile/scm-disasm.exp: New file.
* gdb.guile/scm-equal.c: New file.
* gdb.guile/scm-equal.exp: New file.
* gdb.guile/scm-error.exp: New file.
* gdb.guile/scm-error.scm: New file.
* gdb.guile/scm-frame-args.c: New file.
* gdb.guile/scm-frame-args.exp: New file.
* gdb.guile/scm-frame-args.scm: New file.
* gdb.guile/scm-frame-inline.c: New file.
* gdb.guile/scm-frame-inline.exp: New file.
* gdb.guile/scm-frame.c: New file.
* gdb.guile/scm-frame.exp: New file.
* gdb.guile/scm-generics.exp: New file.
* gdb.guile/scm-gsmob.exp: New file.
* gdb.guile/scm-iterator.c: New file.
* gdb.guile/scm-iterator.exp: New file.
* gdb.guile/scm-math.c: New file.
* gdb.guile/scm-math.exp: New file.
* gdb.guile/scm-objfile-script-gdb.in: New file.
* gdb.guile/scm-objfile-script.c: New file.
* gdb.guile/scm-objfile-script.exp: New file.
* gdb.guile/scm-objfile.c: New file.
* gdb.guile/scm-objfile.exp: New file.
* gdb.guile/scm-ports.exp: New file.
* gdb.guile/scm-pretty-print.c: New file.
* gdb.guile/scm-pretty-print.exp: New file.
* gdb.guile/scm-pretty-print.scm: New file.
* gdb.guile/scm-section-script.c: New file.
* gdb.guile/scm-section-script.exp: New file.
* gdb.guile/scm-section-script.scm: New file.
* gdb.guile/scm-symbol.c: New file.
* gdb.guile/scm-symbol.exp: New file.
* gdb.guile/scm-symtab-2.c: New file.
* gdb.guile/scm-symtab.c: New file.
* gdb.guile/scm-symtab.exp: New file.
* gdb.guile/scm-type.c: New file.
* gdb.guile/scm-type.exp: New file.
* gdb.guile/scm-value-cc.cc: New file.
* gdb.guile/scm-value-cc.exp: New file.
* gdb.guile/scm-value.c: New file.
* gdb.guile/scm-value.exp: New file.
* gdb.guile/source2.scm: New file.
* gdb.guile/types-module.cc: New file.
* gdb.guile/types-module.exp: New file.
2014-02-10 03:40:01 +00:00
|
|
|
|
gdbscm_invalid_object_error (const char *subr, int arg_pos, SCM bad_value,
|
|
|
|
|
const char *object)
|
|
|
|
|
{
|
|
|
|
|
SCM exception
|
|
|
|
|
= gdbscm_make_invalid_object_error (subr, arg_pos, bad_value, object);
|
|
|
|
|
|
|
|
|
|
gdbscm_throw (exception);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Make an out-of-range error <gdb:exception> object. */
|
|
|
|
|
|
|
|
|
|
SCM
|
|
|
|
|
gdbscm_make_out_of_range_error (const char *subr, int arg_pos, SCM bad_value,
|
|
|
|
|
const char *error)
|
|
|
|
|
{
|
|
|
|
|
return gdbscm_make_arg_error (scm_out_of_range_key,
|
|
|
|
|
subr, arg_pos, bad_value,
|
|
|
|
|
_("Out of range:"), error);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Throw an out-of-range error.
|
|
|
|
|
This is the standard Guile out-of-range exception. */
|
|
|
|
|
|
2014-05-21 18:52:51 +00:00
|
|
|
|
void
|
Add Guile as an extension language.
* NEWS: Mention Guile scripting.
* Makefile.in (SUBDIR_GUILE_OBS): New variable.
(SUBDIR_GUILE_SRCS, SUBDIR_GUILE_DEPS): New variables
(SUBDIR_GUILE_LDFLAGS, SUBDIR_GUILE_CFLAGS): New variables.
(INTERNAL_CPPFLAGS): Add GUILE_CPPFLAGS.
(CLIBS): Add GUILE_LIBS.
(install-guile): New rule.
(guile.o): New rule.
(scm-arch.o, scm-auto-load.o, scm-block.o): New rules.
(scm-breakpoint.o, scm-disasm.o, scm-exception.o): New rules.
(scm-frame.o, scm-iterator.o, scm-lazy-string.o): New rules.
(scm-math.o, scm-objfile.o, scm-ports.o): New rules.
(scm-pretty-print.o, scm-safe-call.o, scm-gsmob.o): New rules.
(scm-string.o, scm-symbol.o, scm-symtab.o): New rules.
(scm-type.o, scm-utils.o, scm-value.o): New rules.
* configure.ac: New option --with-guile.
* configure: Regenerate.
* config.in: Regenerate.
* auto-load.c: Remove #include "python/python.h". Add #include
"gdb/section-scripts.h".
(source_section_scripts): Handle Guile scripts.
(_initialize_auto_load): Add name of Guile objfile script to
scripts-directory help text.
* breakpoint.c (condition_command): Tweak comment to include Scheme.
* breakpoint.h (gdbscm_breakpoint_object): Add forward decl.
(struct breakpoint): New member scm_bp_object.
* defs.h (enum command_control_type): New value guile_control.
* cli/cli-cmds.c: Remove #include "python/python.h". Add #include
"extension.h".
(show_user): Update comment.
(_initialize_cli_cmds): Update help text for "show user". Update help
text for max-user-call-depth.
* cli/cli-script.c: Remove #include "python/python.h". Add #include
"extension.h".
(multi_line_command_p): Add guile_control.
(print_command_lines): Handle guile_control.
(execute_control_command, recurse_read_control_structure): Ditto.
(process_next_line): Recognize "guile" commands.
* disasm.c (gdb_disassemble_info): Make non-static.
* disasm.h: #include "dis-asm.h".
(struct gdbarch): Add forward decl.
(gdb_disassemble_info): Declare.
* extension.c: #include "guile/guile.h".
(extension_languages): Add guile.
(get_ext_lang_defn): Handle EXT_LANG_GDB.
* extension.h (enum extension_language): New value EXT_LANG_GUILE.
* gdbtypes.c (get_unsigned_type_max): New function.
(get_signed_type_minmax): New function.
* gdbtypes.h (get_unsigned_type_max): Declare.
(get_signed_type_minmax): Declare.
* guile/README: New file.
* guile/guile-internal.h: New file.
* guile/guile.c: New file.
* guile/guile.h: New file.
* guile/scm-arch.c: New file.
* guile/scm-auto-load.c: New file.
* guile/scm-block.c: New file.
* guile/scm-breakpoint.c: New file.
* guile/scm-disasm.c: New file.
* guile/scm-exception.c: New file.
* guile/scm-frame.c: New file.
* guile/scm-gsmob.c: New file.
* guile/scm-iterator.c: New file.
* guile/scm-lazy-string.c: New file.
* guile/scm-math.c: New file.
* guile/scm-objfile.c: New file.
* guile/scm-ports.c: New file.
* guile/scm-pretty-print.c: New file.
* guile/scm-safe-call.c: New file.
* guile/scm-string.c: New file.
* guile/scm-symbol.c: New file.
* guile/scm-symtab.c: New file.
* guile/scm-type.c: New file.
* guile/scm-utils.c: New file.
* guile/scm-value.c: New file.
* guile/lib/gdb.scm: New file.
* guile/lib/gdb/boot.scm: New file.
* guile/lib/gdb/experimental.scm: New file.
* guile/lib/gdb/init.scm: New file.
* guile/lib/gdb/iterator.scm: New file.
* guile/lib/gdb/printing.scm: New file.
* guile/lib/gdb/types.scm: New file.
* data-directory/Makefile.in (GUILE_SRCDIR): New variable.
(VPATH): Add $(GUILE_SRCDIR).
(GUILE_DIR): New variable.
(GUILE_INSTALL_DIR, GUILE_FILES): New variables.
(all): Add stamp-guile dependency.
(stamp-guile): New rule.
(clean-guile, install-guile, uninstall-guile): New rules.
(install-only): Add install-guile dependency.
(uninstall): Add uninstall-guile dependency.
(clean): Add clean-guile dependency.
doc/
* Makefile.in (GDB_DOC_FILES): Add guile.texi.
* gdb.texinfo (Auto-loading): Add set/show auto-load guile-scripts.
(Extending GDB): New menu entries Guile, Multiple Extension Languages.
(Guile docs): Include guile.texi.
(objfile-gdbdotext file): Add objfile-gdb.scm.
(dotdebug_gdb_scripts section): Mention Guile scripts.
(Multiple Extension Languages): New node.
* guile.texi: New file.
testsuite/
* configure.ac (AC_OUTPUT): Add gdb.guile.
* configure: Regenerate.
* lib/gdb-guile.exp: New file.
* lib/gdb.exp (get_target_charset): New function.
* gdb.base/help.exp: Update expected output from "apropos apropos".
* gdb.guile/Makefile.in: New file.
* gdb.guile/guile.exp: New file.
* gdb.guile/scm-arch.c: New file.
* gdb.guile/scm-arch.exp: New file.
* gdb.guile/scm-block.c: New file.
* gdb.guile/scm-block.exp: New file.
* gdb.guile/scm-breakpoint.c: New file.
* gdb.guile/scm-breakpoint.exp: New file.
* gdb.guile/scm-disasm.c: New file.
* gdb.guile/scm-disasm.exp: New file.
* gdb.guile/scm-equal.c: New file.
* gdb.guile/scm-equal.exp: New file.
* gdb.guile/scm-error.exp: New file.
* gdb.guile/scm-error.scm: New file.
* gdb.guile/scm-frame-args.c: New file.
* gdb.guile/scm-frame-args.exp: New file.
* gdb.guile/scm-frame-args.scm: New file.
* gdb.guile/scm-frame-inline.c: New file.
* gdb.guile/scm-frame-inline.exp: New file.
* gdb.guile/scm-frame.c: New file.
* gdb.guile/scm-frame.exp: New file.
* gdb.guile/scm-generics.exp: New file.
* gdb.guile/scm-gsmob.exp: New file.
* gdb.guile/scm-iterator.c: New file.
* gdb.guile/scm-iterator.exp: New file.
* gdb.guile/scm-math.c: New file.
* gdb.guile/scm-math.exp: New file.
* gdb.guile/scm-objfile-script-gdb.in: New file.
* gdb.guile/scm-objfile-script.c: New file.
* gdb.guile/scm-objfile-script.exp: New file.
* gdb.guile/scm-objfile.c: New file.
* gdb.guile/scm-objfile.exp: New file.
* gdb.guile/scm-ports.exp: New file.
* gdb.guile/scm-pretty-print.c: New file.
* gdb.guile/scm-pretty-print.exp: New file.
* gdb.guile/scm-pretty-print.scm: New file.
* gdb.guile/scm-section-script.c: New file.
* gdb.guile/scm-section-script.exp: New file.
* gdb.guile/scm-section-script.scm: New file.
* gdb.guile/scm-symbol.c: New file.
* gdb.guile/scm-symbol.exp: New file.
* gdb.guile/scm-symtab-2.c: New file.
* gdb.guile/scm-symtab.c: New file.
* gdb.guile/scm-symtab.exp: New file.
* gdb.guile/scm-type.c: New file.
* gdb.guile/scm-type.exp: New file.
* gdb.guile/scm-value-cc.cc: New file.
* gdb.guile/scm-value-cc.exp: New file.
* gdb.guile/scm-value.c: New file.
* gdb.guile/scm-value.exp: New file.
* gdb.guile/source2.scm: New file.
* gdb.guile/types-module.cc: New file.
* gdb.guile/types-module.exp: New file.
2014-02-10 03:40:01 +00:00
|
|
|
|
gdbscm_out_of_range_error (const char *subr, int arg_pos, SCM bad_value,
|
|
|
|
|
const char *error)
|
|
|
|
|
{
|
|
|
|
|
SCM exception
|
|
|
|
|
= gdbscm_make_out_of_range_error (subr, arg_pos, bad_value, error);
|
|
|
|
|
|
|
|
|
|
gdbscm_throw (exception);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Make a misc-error <gdb:exception> object. */
|
|
|
|
|
|
|
|
|
|
SCM
|
|
|
|
|
gdbscm_make_misc_error (const char *subr, int arg_pos, SCM bad_value,
|
|
|
|
|
const char *error)
|
|
|
|
|
{
|
|
|
|
|
return gdbscm_make_arg_error (scm_misc_error_key,
|
|
|
|
|
subr, arg_pos, bad_value, NULL, error);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return a <gdb:exception> object for gdb:memory-error. */
|
|
|
|
|
|
|
|
|
|
SCM
|
|
|
|
|
gdbscm_make_memory_error (const char *subr, const char *msg, SCM args)
|
|
|
|
|
{
|
|
|
|
|
return gdbscm_make_error (memory_error_symbol, subr, msg, args,
|
|
|
|
|
SCM_EOL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Throw a gdb:memory-error exception. */
|
|
|
|
|
|
2014-05-21 18:52:51 +00:00
|
|
|
|
void
|
Add Guile as an extension language.
* NEWS: Mention Guile scripting.
* Makefile.in (SUBDIR_GUILE_OBS): New variable.
(SUBDIR_GUILE_SRCS, SUBDIR_GUILE_DEPS): New variables
(SUBDIR_GUILE_LDFLAGS, SUBDIR_GUILE_CFLAGS): New variables.
(INTERNAL_CPPFLAGS): Add GUILE_CPPFLAGS.
(CLIBS): Add GUILE_LIBS.
(install-guile): New rule.
(guile.o): New rule.
(scm-arch.o, scm-auto-load.o, scm-block.o): New rules.
(scm-breakpoint.o, scm-disasm.o, scm-exception.o): New rules.
(scm-frame.o, scm-iterator.o, scm-lazy-string.o): New rules.
(scm-math.o, scm-objfile.o, scm-ports.o): New rules.
(scm-pretty-print.o, scm-safe-call.o, scm-gsmob.o): New rules.
(scm-string.o, scm-symbol.o, scm-symtab.o): New rules.
(scm-type.o, scm-utils.o, scm-value.o): New rules.
* configure.ac: New option --with-guile.
* configure: Regenerate.
* config.in: Regenerate.
* auto-load.c: Remove #include "python/python.h". Add #include
"gdb/section-scripts.h".
(source_section_scripts): Handle Guile scripts.
(_initialize_auto_load): Add name of Guile objfile script to
scripts-directory help text.
* breakpoint.c (condition_command): Tweak comment to include Scheme.
* breakpoint.h (gdbscm_breakpoint_object): Add forward decl.
(struct breakpoint): New member scm_bp_object.
* defs.h (enum command_control_type): New value guile_control.
* cli/cli-cmds.c: Remove #include "python/python.h". Add #include
"extension.h".
(show_user): Update comment.
(_initialize_cli_cmds): Update help text for "show user". Update help
text for max-user-call-depth.
* cli/cli-script.c: Remove #include "python/python.h". Add #include
"extension.h".
(multi_line_command_p): Add guile_control.
(print_command_lines): Handle guile_control.
(execute_control_command, recurse_read_control_structure): Ditto.
(process_next_line): Recognize "guile" commands.
* disasm.c (gdb_disassemble_info): Make non-static.
* disasm.h: #include "dis-asm.h".
(struct gdbarch): Add forward decl.
(gdb_disassemble_info): Declare.
* extension.c: #include "guile/guile.h".
(extension_languages): Add guile.
(get_ext_lang_defn): Handle EXT_LANG_GDB.
* extension.h (enum extension_language): New value EXT_LANG_GUILE.
* gdbtypes.c (get_unsigned_type_max): New function.
(get_signed_type_minmax): New function.
* gdbtypes.h (get_unsigned_type_max): Declare.
(get_signed_type_minmax): Declare.
* guile/README: New file.
* guile/guile-internal.h: New file.
* guile/guile.c: New file.
* guile/guile.h: New file.
* guile/scm-arch.c: New file.
* guile/scm-auto-load.c: New file.
* guile/scm-block.c: New file.
* guile/scm-breakpoint.c: New file.
* guile/scm-disasm.c: New file.
* guile/scm-exception.c: New file.
* guile/scm-frame.c: New file.
* guile/scm-gsmob.c: New file.
* guile/scm-iterator.c: New file.
* guile/scm-lazy-string.c: New file.
* guile/scm-math.c: New file.
* guile/scm-objfile.c: New file.
* guile/scm-ports.c: New file.
* guile/scm-pretty-print.c: New file.
* guile/scm-safe-call.c: New file.
* guile/scm-string.c: New file.
* guile/scm-symbol.c: New file.
* guile/scm-symtab.c: New file.
* guile/scm-type.c: New file.
* guile/scm-utils.c: New file.
* guile/scm-value.c: New file.
* guile/lib/gdb.scm: New file.
* guile/lib/gdb/boot.scm: New file.
* guile/lib/gdb/experimental.scm: New file.
* guile/lib/gdb/init.scm: New file.
* guile/lib/gdb/iterator.scm: New file.
* guile/lib/gdb/printing.scm: New file.
* guile/lib/gdb/types.scm: New file.
* data-directory/Makefile.in (GUILE_SRCDIR): New variable.
(VPATH): Add $(GUILE_SRCDIR).
(GUILE_DIR): New variable.
(GUILE_INSTALL_DIR, GUILE_FILES): New variables.
(all): Add stamp-guile dependency.
(stamp-guile): New rule.
(clean-guile, install-guile, uninstall-guile): New rules.
(install-only): Add install-guile dependency.
(uninstall): Add uninstall-guile dependency.
(clean): Add clean-guile dependency.
doc/
* Makefile.in (GDB_DOC_FILES): Add guile.texi.
* gdb.texinfo (Auto-loading): Add set/show auto-load guile-scripts.
(Extending GDB): New menu entries Guile, Multiple Extension Languages.
(Guile docs): Include guile.texi.
(objfile-gdbdotext file): Add objfile-gdb.scm.
(dotdebug_gdb_scripts section): Mention Guile scripts.
(Multiple Extension Languages): New node.
* guile.texi: New file.
testsuite/
* configure.ac (AC_OUTPUT): Add gdb.guile.
* configure: Regenerate.
* lib/gdb-guile.exp: New file.
* lib/gdb.exp (get_target_charset): New function.
* gdb.base/help.exp: Update expected output from "apropos apropos".
* gdb.guile/Makefile.in: New file.
* gdb.guile/guile.exp: New file.
* gdb.guile/scm-arch.c: New file.
* gdb.guile/scm-arch.exp: New file.
* gdb.guile/scm-block.c: New file.
* gdb.guile/scm-block.exp: New file.
* gdb.guile/scm-breakpoint.c: New file.
* gdb.guile/scm-breakpoint.exp: New file.
* gdb.guile/scm-disasm.c: New file.
* gdb.guile/scm-disasm.exp: New file.
* gdb.guile/scm-equal.c: New file.
* gdb.guile/scm-equal.exp: New file.
* gdb.guile/scm-error.exp: New file.
* gdb.guile/scm-error.scm: New file.
* gdb.guile/scm-frame-args.c: New file.
* gdb.guile/scm-frame-args.exp: New file.
* gdb.guile/scm-frame-args.scm: New file.
* gdb.guile/scm-frame-inline.c: New file.
* gdb.guile/scm-frame-inline.exp: New file.
* gdb.guile/scm-frame.c: New file.
* gdb.guile/scm-frame.exp: New file.
* gdb.guile/scm-generics.exp: New file.
* gdb.guile/scm-gsmob.exp: New file.
* gdb.guile/scm-iterator.c: New file.
* gdb.guile/scm-iterator.exp: New file.
* gdb.guile/scm-math.c: New file.
* gdb.guile/scm-math.exp: New file.
* gdb.guile/scm-objfile-script-gdb.in: New file.
* gdb.guile/scm-objfile-script.c: New file.
* gdb.guile/scm-objfile-script.exp: New file.
* gdb.guile/scm-objfile.c: New file.
* gdb.guile/scm-objfile.exp: New file.
* gdb.guile/scm-ports.exp: New file.
* gdb.guile/scm-pretty-print.c: New file.
* gdb.guile/scm-pretty-print.exp: New file.
* gdb.guile/scm-pretty-print.scm: New file.
* gdb.guile/scm-section-script.c: New file.
* gdb.guile/scm-section-script.exp: New file.
* gdb.guile/scm-section-script.scm: New file.
* gdb.guile/scm-symbol.c: New file.
* gdb.guile/scm-symbol.exp: New file.
* gdb.guile/scm-symtab-2.c: New file.
* gdb.guile/scm-symtab.c: New file.
* gdb.guile/scm-symtab.exp: New file.
* gdb.guile/scm-type.c: New file.
* gdb.guile/scm-type.exp: New file.
* gdb.guile/scm-value-cc.cc: New file.
* gdb.guile/scm-value-cc.exp: New file.
* gdb.guile/scm-value.c: New file.
* gdb.guile/scm-value.exp: New file.
* gdb.guile/source2.scm: New file.
* gdb.guile/types-module.cc: New file.
* gdb.guile/types-module.exp: New file.
2014-02-10 03:40:01 +00:00
|
|
|
|
gdbscm_memory_error (const char *subr, const char *msg, SCM args)
|
|
|
|
|
{
|
|
|
|
|
SCM exception = gdbscm_make_memory_error (subr, msg, args);
|
|
|
|
|
|
|
|
|
|
gdbscm_throw (exception);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return non-zero if KEY is gdb:memory-error.
|
|
|
|
|
Note: This is an excp_matcher_func function. */
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
gdbscm_memory_error_p (SCM key)
|
|
|
|
|
{
|
|
|
|
|
return scm_is_eq (key, memory_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. */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
gdbscm_throw (SCM exception)
|
|
|
|
|
{
|
|
|
|
|
scm_throw (gdbscm_exception_key (exception),
|
|
|
|
|
gdbscm_exception_args (exception));
|
|
|
|
|
gdb_assert_not_reached ("scm_throw returned");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Convert a GDB exception to a <gdb:exception> object. */
|
|
|
|
|
|
|
|
|
|
SCM
|
|
|
|
|
gdbscm_scm_from_gdb_exception (struct gdb_exception exception)
|
|
|
|
|
{
|
|
|
|
|
SCM key;
|
|
|
|
|
|
|
|
|
|
if (exception.reason == RETURN_QUIT)
|
|
|
|
|
{
|
|
|
|
|
/* Handle this specially to be consistent with top-repl.scm. */
|
|
|
|
|
return gdbscm_make_error (signal_symbol, NULL, _("User interrupt"),
|
|
|
|
|
SCM_EOL, scm_list_1 (scm_from_int (SIGINT)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (exception.error == MEMORY_ERROR)
|
|
|
|
|
key = memory_error_symbol;
|
|
|
|
|
else
|
|
|
|
|
key = error_symbol;
|
|
|
|
|
|
|
|
|
|
return gdbscm_make_error (key, NULL, "~A",
|
|
|
|
|
scm_list_1 (gdbscm_scm_from_c_string
|
|
|
|
|
(exception.message)),
|
|
|
|
|
SCM_BOOL_F);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Convert a GDB exception to the appropriate Scheme exception and throw it.
|
|
|
|
|
This function does not return. */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
gdbscm_throw_gdb_exception (struct gdb_exception exception)
|
|
|
|
|
{
|
|
|
|
|
gdbscm_throw (gdbscm_scm_from_gdb_exception (exception));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Print the error message portion of an exception.
|
|
|
|
|
If PORT is #f, use the standard error port.
|
|
|
|
|
KEY cannot be gdb:with-stack.
|
|
|
|
|
|
|
|
|
|
Basically this function is just a wrapper around calling
|
|
|
|
|
%print-exception-message. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gdbscm_print_exception_message (SCM port, SCM frame, SCM key, SCM args)
|
|
|
|
|
{
|
|
|
|
|
SCM printer, status;
|
|
|
|
|
|
|
|
|
|
if (gdbscm_is_false (port))
|
|
|
|
|
port = scm_current_error_port ();
|
|
|
|
|
|
|
|
|
|
gdb_assert (!scm_is_eq (key, with_stack_error_symbol));
|
|
|
|
|
|
|
|
|
|
/* This does not use scm_print_exception because we tweak the output a bit.
|
|
|
|
|
Compare Guile's print-exception with our %print-exception-message for
|
|
|
|
|
details. */
|
|
|
|
|
if (gdbscm_is_false (percent_print_exception_message_var))
|
|
|
|
|
{
|
|
|
|
|
percent_print_exception_message_var
|
|
|
|
|
= scm_c_private_variable (gdbscm_init_module_name,
|
|
|
|
|
percent_print_exception_message_name);
|
|
|
|
|
/* If we can't find %print-exception-message, there's a problem on the
|
|
|
|
|
Scheme side. Don't kill GDB, just flag an error and leave it at
|
|
|
|
|
that. */
|
|
|
|
|
if (gdbscm_is_false (percent_print_exception_message_var))
|
|
|
|
|
{
|
|
|
|
|
gdbscm_printf (port, _("Error in Scheme exception printing,"
|
|
|
|
|
" can't find %s.\n"),
|
|
|
|
|
percent_print_exception_message_name);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
printer = scm_variable_ref (percent_print_exception_message_var);
|
|
|
|
|
|
|
|
|
|
status = gdbscm_safe_call_4 (printer, port, frame, key, args, NULL);
|
|
|
|
|
|
|
|
|
|
/* If that failed still tell the user something.
|
|
|
|
|
But don't use the exception printing machinery! */
|
|
|
|
|
if (gdbscm_is_exception (status))
|
|
|
|
|
{
|
|
|
|
|
gdbscm_printf (port, _("Error in Scheme exception printing:\n"));
|
|
|
|
|
scm_display (status, port);
|
|
|
|
|
scm_newline (port);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Print the description of exception KEY, ARGS to PORT, according to the
|
|
|
|
|
setting of "set guile print-stack".
|
|
|
|
|
If PORT is #f, use the standard error port.
|
|
|
|
|
If STACK is #f, never print the stack, regardless of whether printing it
|
|
|
|
|
is enabled. If STACK is #t, then print it if it is contained in ARGS
|
|
|
|
|
(i.e., KEY is gdb:with-stack). Otherwise STACK is the result of calling
|
|
|
|
|
scm_make_stack (which will be ignored in favor of the stack in ARGS if
|
|
|
|
|
KEY is gdb:with-stack).
|
|
|
|
|
KEY, ARGS are the standard arguments to scm_throw, et.al.
|
|
|
|
|
|
|
|
|
|
Basically this function is just a wrapper around calling
|
|
|
|
|
%print-exception-with-args. */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
gdbscm_print_exception_with_stack (SCM port, SCM stack, SCM key, SCM args)
|
|
|
|
|
{
|
|
|
|
|
SCM printer, status;
|
|
|
|
|
|
|
|
|
|
if (gdbscm_is_false (port))
|
|
|
|
|
port = scm_current_error_port ();
|
|
|
|
|
|
|
|
|
|
if (gdbscm_is_false (percent_print_exception_with_stack_var))
|
|
|
|
|
{
|
|
|
|
|
percent_print_exception_with_stack_var
|
|
|
|
|
= scm_c_private_variable (gdbscm_init_module_name,
|
|
|
|
|
percent_print_exception_with_stack_name);
|
|
|
|
|
/* If we can't find %print-exception-with-args, there's a problem on the
|
|
|
|
|
Scheme side. Don't kill GDB, just flag an error and leave it at
|
|
|
|
|
that. */
|
|
|
|
|
if (gdbscm_is_false (percent_print_exception_with_stack_var))
|
|
|
|
|
{
|
|
|
|
|
gdbscm_printf (port, _("Error in Scheme exception printing,"
|
|
|
|
|
" can't find %s.\n"),
|
|
|
|
|
percent_print_exception_with_stack_name);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
printer = scm_variable_ref (percent_print_exception_with_stack_var);
|
|
|
|
|
|
|
|
|
|
status = gdbscm_safe_call_4 (printer, port, stack, key, args, NULL);
|
|
|
|
|
|
|
|
|
|
/* If that failed still tell the user something.
|
|
|
|
|
But don't use the exception printing machinery! */
|
|
|
|
|
if (gdbscm_is_exception (status))
|
|
|
|
|
{
|
|
|
|
|
gdbscm_printf (port, _("Error in Scheme exception printing:\n"));
|
|
|
|
|
scm_display (status, port);
|
|
|
|
|
scm_newline (port);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Print EXCEPTION, a <gdb:exception> object, to PORT.
|
|
|
|
|
If PORT is #f, use the standard error port. */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
gdbscm_print_gdb_exception (SCM port, SCM exception)
|
|
|
|
|
{
|
|
|
|
|
gdb_assert (gdbscm_is_exception (exception));
|
|
|
|
|
|
|
|
|
|
gdbscm_print_exception_with_stack (port, SCM_BOOL_T,
|
|
|
|
|
gdbscm_exception_key (exception),
|
|
|
|
|
gdbscm_exception_args (exception));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return a string description of <gdb:exception> EXCEPTION.
|
|
|
|
|
If EXCEPTION is a gdb:with-stack exception, unwrap it, a backtrace
|
|
|
|
|
is never returned as part of the result.
|
|
|
|
|
|
|
|
|
|
Space for the result is malloc'd, the caller must free. */
|
|
|
|
|
|
|
|
|
|
char *
|
|
|
|
|
gdbscm_exception_message_to_string (SCM exception)
|
|
|
|
|
{
|
|
|
|
|
SCM port = scm_open_output_string ();
|
|
|
|
|
SCM key, args;
|
|
|
|
|
char *result;
|
|
|
|
|
|
|
|
|
|
gdb_assert (gdbscm_is_exception (exception));
|
|
|
|
|
|
|
|
|
|
key = gdbscm_exception_key (exception);
|
|
|
|
|
args = gdbscm_exception_args (exception);
|
|
|
|
|
|
|
|
|
|
if (scm_is_eq (key, with_stack_error_symbol)
|
|
|
|
|
/* Don't crash on a badly generated gdb:with-stack exception. */
|
|
|
|
|
&& scm_is_pair (args)
|
|
|
|
|
&& scm_is_pair (scm_cdr (args)))
|
|
|
|
|
{
|
|
|
|
|
key = scm_car (args);
|
|
|
|
|
args = scm_cddr (args);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gdbscm_print_exception_message (port, SCM_BOOL_F, key, args);
|
|
|
|
|
result = gdbscm_scm_to_c_string (scm_get_output_string (port));
|
|
|
|
|
scm_close_port (port);
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return the value of the "guile print-stack" option as one of:
|
|
|
|
|
'none, 'message, 'full. */
|
|
|
|
|
|
|
|
|
|
static SCM
|
|
|
|
|
gdbscm_percent_exception_print_style (void)
|
|
|
|
|
{
|
|
|
|
|
if (gdbscm_print_excp == gdbscm_print_excp_none)
|
|
|
|
|
return none_symbol;
|
|
|
|
|
if (gdbscm_print_excp == gdbscm_print_excp_message)
|
|
|
|
|
return message_symbol;
|
|
|
|
|
if (gdbscm_print_excp == gdbscm_print_excp_full)
|
|
|
|
|
return full_symbol;
|
|
|
|
|
gdb_assert_not_reached ("bad value for \"guile print-stack\"");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return the current <gdb:exception> counter.
|
|
|
|
|
This is for debugging purposes. */
|
|
|
|
|
|
|
|
|
|
static SCM
|
|
|
|
|
gdbscm_percent_exception_count (void)
|
|
|
|
|
{
|
|
|
|
|
return scm_from_ulong (gdbscm_exception_count);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Initialize the Scheme exception support. */
|
|
|
|
|
|
|
|
|
|
static const scheme_function exception_functions[] =
|
|
|
|
|
{
|
|
|
|
|
{ "make-exception", 2, 0, 0, gdbscm_make_exception,
|
|
|
|
|
"\
|
|
|
|
|
Create a <gdb:exception> object.\n\
|
|
|
|
|
\n\
|
|
|
|
|
Arguments: key args\n\
|
|
|
|
|
These are the standard key,args arguments of \"throw\"." },
|
|
|
|
|
|
|
|
|
|
{ "exception?", 1, 0, 0, gdbscm_exception_p,
|
|
|
|
|
"\
|
|
|
|
|
Return #t if the object is a <gdb:exception> object." },
|
|
|
|
|
|
|
|
|
|
{ "exception-key", 1, 0, 0, gdbscm_exception_key,
|
|
|
|
|
"\
|
|
|
|
|
Return the exception's key." },
|
|
|
|
|
|
|
|
|
|
{ "exception-args", 1, 0, 0, gdbscm_exception_args,
|
|
|
|
|
"\
|
|
|
|
|
Return the exception's arg list." },
|
|
|
|
|
|
|
|
|
|
END_FUNCTIONS
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static const scheme_function private_exception_functions[] =
|
|
|
|
|
{
|
|
|
|
|
{ "%exception-print-style", 0, 0, 0, gdbscm_percent_exception_print_style,
|
|
|
|
|
"\
|
|
|
|
|
Return the value of the \"guile print-stack\" option." },
|
|
|
|
|
|
|
|
|
|
{ "%exception-count", 0, 0, 0, gdbscm_percent_exception_count,
|
|
|
|
|
"\
|
|
|
|
|
Return a count of the number of <gdb:exception> objects created.\n\
|
|
|
|
|
This is for debugging purposes." },
|
|
|
|
|
|
|
|
|
|
END_FUNCTIONS
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
gdbscm_initialize_exceptions (void)
|
|
|
|
|
{
|
|
|
|
|
exception_smob_tag = gdbscm_make_smob_type (exception_smob_name,
|
|
|
|
|
sizeof (exception_smob));
|
|
|
|
|
scm_set_smob_print (exception_smob_tag, exscm_print_exception_smob);
|
|
|
|
|
|
|
|
|
|
gdbscm_define_functions (exception_functions, 1);
|
|
|
|
|
gdbscm_define_functions (private_exception_functions, 0);
|
|
|
|
|
|
|
|
|
|
error_symbol = scm_from_latin1_symbol ("gdb:error");
|
|
|
|
|
|
|
|
|
|
memory_error_symbol = scm_from_latin1_symbol ("gdb:memory-error");
|
|
|
|
|
|
|
|
|
|
gdbscm_invalid_object_error_symbol
|
|
|
|
|
= scm_from_latin1_symbol ("gdb:invalid-object-error");
|
|
|
|
|
|
|
|
|
|
with_stack_error_symbol = scm_from_latin1_symbol ("gdb:with-stack");
|
|
|
|
|
|
|
|
|
|
/* The text of this symbol is taken from Guile's top-repl.scm. */
|
|
|
|
|
signal_symbol = scm_from_latin1_symbol ("signal");
|
|
|
|
|
|
|
|
|
|
none_symbol = scm_from_latin1_symbol ("none");
|
|
|
|
|
message_symbol = scm_from_latin1_symbol ("message");
|
|
|
|
|
full_symbol = scm_from_latin1_symbol ("full");
|
|
|
|
|
}
|