+2019-04-25 Tom Tromey <tromey@adacore.com>
+
+ * guile/scm-exception.c (gdbscm_scm_from_gdb_exception)
+ (gdbscm_throw_gdb_exception): Take a gdbscm_gdb_exception.
+ * guile/scm-block.c, guile/scm-breakpoint.c, guile/scm-cmd.c,
+ guile/scm-disasm.c, guile/scm-frame.c, guile/scm-lazy-string.c,
+ guile/scm-math.c, guile/scm-param.c, guile/scm-ports.c,
+ guile/scm-symbol.c, guile/scm-symtab.c, guile/scm-type.c,
+ guile/scm-value.c: Use unpack.
+ * guile/guile-internal.h (gdbscm_scm_from_gdb_exception): Take a
+ gdbscm_gdb_exception.
+ (gdbscm_throw_gdb_exception): Likewise.
+ (struct gdbscm_gdb_exception): New.
+ (unpack): New function.
+ (gdbscm_wrap): Use unpack.
+
2019-04-25 Tom Tromey <tromey@adacore.com>
* event-top.c (gdb_rl_callback_read_char_wrapper_noexcept)
extern void gdbscm_throw (SCM exception) ATTRIBUTE_NORETURN;
-extern SCM gdbscm_scm_from_gdb_exception (struct gdb_exception exception);
+struct gdbscm_gdb_exception;
+extern SCM gdbscm_scm_from_gdb_exception
+ (const gdbscm_gdb_exception &exception);
-extern void gdbscm_throw_gdb_exception (struct gdb_exception exception)
+extern void gdbscm_throw_gdb_exception (gdbscm_gdb_exception exception)
ATTRIBUTE_NORETURN;
extern void gdbscm_print_exception_with_stack (SCM port, SCM stack,
with a TRY/CATCH, because the dtors won't otherwise be run when a
Guile exceptions is thrown. */
+/* This is a destructor-less clone of gdb_exception. */
+
+struct gdbscm_gdb_exception
+{
+ enum return_reason reason;
+ enum errors error;
+ /* The message is xmalloc'd. */
+ char *message;
+};
+
+/* Return a gdbscm_gdb_exception representing EXC. */
+
+inline gdbscm_gdb_exception
+unpack (const gdb_exception &exc)
+{
+ gdbscm_gdb_exception result;
+ result.reason = exc.reason;
+ result.error = exc.error;
+ if (exc.message == nullptr)
+ result.message = nullptr;
+ else
+ result.message = xstrdup (exc.message->c_str ());
+ /* The message should be NULL iff the reason is zero. */
+ gdb_assert ((result.reason == 0) == (result.message == nullptr));
+ return result;
+}
+
/* Use this after a TRY/CATCH to throw the appropriate Scheme
exception if a GDB error occurred. */
gdbscm_wrap (Function &&func, Args &&... args)
{
SCM result = SCM_BOOL_F;
+ gdbscm_gdb_exception exc {};
try
{
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
+
if (gdbscm_is_exception (result))
gdbscm_throw (result);
gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, NULL, "U", pc_scm, &pc);
+ gdbscm_gdb_exception exc {};
try
{
cust = find_pc_compunit_symtab (pc);
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
if (cust == NULL || COMPUNIT_OBJFILE (cust) == NULL)
{
gdbscm_out_of_range_error (FUNC_NAME, SCM_ARG1, pc_scm,
{
breakpoint_smob *bp_smob
= bpscm_get_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- struct gdb_exception except;
+ gdbscm_gdb_exception except {};
const char *location, *copy;
/* We only support registering breakpoints created with make-breakpoint. */
}
catch (const gdb_exception &ex)
{
- except = ex;
+ except = unpack (ex);
}
/* Ensure this gets reset, even if there's an error. */
breakpoint_smob *bp_smob
= bpscm_get_valid_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
+ gdbscm_gdb_exception exc {};
try
{
delete_breakpoint (bp_smob->bp);
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
return SCM_UNSPECIFIED;
}
SCM_ASSERT_TYPE (gdbscm_is_bool (newvalue), newvalue, SCM_ARG2, FUNC_NAME,
_("boolean"));
+ gdbscm_gdb_exception exc {};
try
{
if (gdbscm_is_true (newvalue))
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
return SCM_UNSPECIFIED;
}
SCM_ASSERT_TYPE (gdbscm_is_bool (newvalue), newvalue, SCM_ARG2, FUNC_NAME,
_("boolean"));
+ gdbscm_gdb_exception exc {};
try
{
breakpoint_set_silent (bp_smob->bp, gdbscm_is_true (newvalue));
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
return SCM_UNSPECIFIED;
}
if (value < 0)
value = 0;
+ gdbscm_gdb_exception exc {};
try
{
set_ignore_count (bp_smob->number, (int) value, 0);
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
return SCM_UNSPECIFIED;
}
{
id = scm_to_long (newvalue);
+ gdbscm_gdb_exception exc {};
try
{
valid_id = valid_task_id (id);
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
if (! valid_id)
{
gdbscm_out_of_range_error (FUNC_NAME, SCM_ARG2, newvalue,
else
SCM_ASSERT_TYPE (0, newvalue, SCM_ARG2, FUNC_NAME, _("integer or #f"));
+ gdbscm_gdb_exception exc {};
try
{
breakpoint_set_task (bp_smob->bp, id);
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
return SCM_UNSPECIFIED;
}
string_file buf;
current_uiout->redirect (&buf);
+ gdbscm_gdb_exception exc {};
try
{
print_command_lines (current_uiout, breakpoint_commands (bp), 0);
}
catch (const gdb_exception &except)
{
- current_uiout->redirect (NULL);
- gdbscm_throw_gdb_exception (except);
+ exc = unpack (except);
}
current_uiout->redirect (NULL);
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
result = gdbscm_scm_from_c_string (buf.c_str ());
return result;
c_smob->cmd_name = gdbscm_gc_xstrdup (cmd_name);
xfree (cmd_name);
+ gdbscm_gdb_exception exc {};
try
{
if (c_smob->is_prefix)
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
/* Note: At this point the command exists in gdb.
So no more errors after this point. */
int insn_len = 0;
string_file buf;
+ gdbscm_gdb_exception exc {};
try
{
if (using_port)
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
result = scm_cons (dascm_make_insn (pc, buf.c_str (), insn_len),
result);
/* Convert a GDB exception to a <gdb:exception> object. */
SCM
-gdbscm_scm_from_gdb_exception (struct gdb_exception exception)
+gdbscm_scm_from_gdb_exception (const gdbscm_gdb_exception &exception)
{
SCM key;
return gdbscm_make_error (key, NULL, "~A",
scm_list_1 (gdbscm_scm_from_c_string
- (exception.what ())),
+ (exception.message)),
SCM_BOOL_F);
}
This function does not return. */
void
-gdbscm_throw_gdb_exception (struct gdb_exception exception)
+gdbscm_throw_gdb_exception (gdbscm_gdb_exception exception)
{
- gdbscm_throw (gdbscm_scm_from_gdb_exception (exception));
+ SCM scm_exception = gdbscm_scm_from_gdb_exception (exception);
+ xfree (exception.message);
+ gdbscm_throw (scm_exception);
}
/* Print the error message portion of an exception.
}
catch (const gdb_exception &except)
{
- return gdbscm_scm_from_gdb_exception (except);
+ return gdbscm_scm_from_gdb_exception (unpack (except));
}
f_scm = frscm_make_frame_smob ();
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
+ gdbscm_gdb_exception exc {};
try
{
frame = frscm_frame_smob_to_frame (f_smob);
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
return scm_from_bool (frame != NULL);
}
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
+ gdbscm_gdb_exception exc {};
try
{
frame = frscm_frame_smob_to_frame (f_smob);
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
if (frame == NULL)
{
gdbscm_invalid_object_error (FUNC_NAME, SCM_ARG1, self,
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
+ gdbscm_gdb_exception exc {};
try
{
frame = frscm_frame_smob_to_frame (f_smob);
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
if (frame == NULL)
{
gdbscm_invalid_object_error (FUNC_NAME, SCM_ARG1, self,
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
+ gdbscm_gdb_exception exc {};
try
{
frame = frscm_frame_smob_to_frame (f_smob);
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
if (frame == NULL)
{
gdbscm_invalid_object_error (FUNC_NAME, SCM_ARG1, self,
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
+ gdbscm_gdb_exception exc {};
try
{
frame = frscm_frame_smob_to_frame (f_smob);
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
if (frame == NULL)
{
gdbscm_invalid_object_error (FUNC_NAME, SCM_ARG1, self,
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
+ gdbscm_gdb_exception exc {};
try
{
frame = frscm_frame_smob_to_frame (f_smob);
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
if (frame == NULL)
{
gdbscm_invalid_object_error (FUNC_NAME, SCM_ARG1, self,
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
+ gdbscm_gdb_exception exc {};
try
{
frame = frscm_frame_smob_to_frame (f_smob);
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
if (frame == NULL)
{
gdbscm_invalid_object_error (FUNC_NAME, SCM_ARG1, self,
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
+ gdbscm_gdb_exception exc {};
try
{
frame = frscm_frame_smob_to_frame (f_smob);
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
if (frame == NULL)
{
gdbscm_invalid_object_error (FUNC_NAME, SCM_ARG1, self,
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
+ gdbscm_gdb_exception exc {};
try
{
frame = frscm_frame_smob_to_frame (f_smob);
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
if (frame == NULL)
{
gdbscm_invalid_object_error (FUNC_NAME, SCM_ARG1, self,
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
+ gdbscm_gdb_exception exc {};
try
{
frame = frscm_frame_smob_to_frame (f_smob);
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
if (frame == NULL)
{
gdbscm_invalid_object_error (FUNC_NAME, SCM_ARG1, self,
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
+ gdbscm_gdb_exception exc {};
try
{
frame = frscm_frame_smob_to_frame (f_smob);
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
if (frame == NULL)
{
gdbscm_invalid_object_error (FUNC_NAME, SCM_ARG1, self,
gdbscm_parse_function_args (FUNC_NAME, SCM_ARG2, NULL, "s",
register_scm, ®ister_str);
- struct gdb_exception except;
+ gdbscm_gdb_exception except {};
try
{
}
catch (const gdb_exception &ex)
{
- except = ex;
+ except = unpack (ex);
}
xfree (register_str);
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
+ gdbscm_gdb_exception exc {};
try
{
frame = frscm_frame_smob_to_frame (f_smob);
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
if (frame == NULL)
{
gdbscm_invalid_object_error (FUNC_NAME, SCM_ARG1, self,
}
else if (scm_is_string (symbol_scm))
{
- struct gdb_exception except;
+ gdbscm_gdb_exception except {};
if (! SCM_UNBNDP (block_scm))
{
}
catch (const gdb_exception &ex)
{
- except = ex;
+ except = unpack (ex);
}
}
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
return vlscm_scm_from_value (value);
}
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
+ gdbscm_gdb_exception exc {};
try
{
frame = frscm_frame_smob_to_frame (f_smob);
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
if (frame == NULL)
{
gdbscm_invalid_object_error (FUNC_NAME, SCM_ARG1, self,
{
struct frame_info *frame = NULL;
+ gdbscm_gdb_exception exc {};
try
{
frame = get_current_frame ();
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
return frscm_scm_from_frame_unsafe (frame, current_inferior ());
}
{
struct frame_info *frame = NULL;
+ gdbscm_gdb_exception exc {};
try
{
frame = get_selected_frame (_("No frame is currently selected"));
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
return frscm_scm_from_frame_unsafe (frame, current_inferior ());
}
}
catch (const gdb_exception &except)
{
- *except_scmp = gdbscm_scm_from_gdb_exception (except);
+ *except_scmp = gdbscm_scm_from_gdb_exception (unpack (except));
return NULL;
}
}
catch (const gdb_exception &except)
{
- except_scm = gdbscm_scm_from_gdb_exception (except);
+ except_scm = gdbscm_scm_from_gdb_exception (unpack (except));
}
if (gdbscm_is_true (except_scm))
_("parameter exists, \"show\" command is already defined"));
}
+ gdbscm_gdb_exception exc {};
try
{
add_setshow_generic (p_smob->type, p_smob->cmd_class,
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
/* Note: At this point the parameter exists in gdb.
So no more errors after this point. */
struct cmd_list_element *alias, *prefix, *cmd;
char *newarg;
int found = -1;
- struct gdb_exception except;
+ gdbscm_gdb_exception except {};
gdb::unique_xmalloc_ptr<char> name
= gdbscm_scm_to_host_string (self, NULL, &except_scm);
}
catch (const gdb_exception &ex)
{
- except = ex;
+ except = unpack (ex);
}
xfree (newarg);
if (scm_is_eq (port, input_port_scm))
return;
+ gdbscm_gdb_exception exc {};
try
{
if (scm_is_eq (port, error_port_scm))
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
}
/* Flush gdb's stdout or stderr. */
struct symbol *symbol = s_smob->symbol;
int result = 0;
+ gdbscm_gdb_exception exc {};
try
{
result = symbol_read_needs_frame (symbol);
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
return scm_from_bool (result);
}
_("cannot get the value of a typedef"));
}
+ gdbscm_gdb_exception exc {};
try
{
if (f_smob != NULL)
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
return vlscm_scm_from_value (value);
}
\f
{
struct frame_info *selected_frame;
+ gdbscm_gdb_exception exc {};
try
{
selected_frame = get_selected_frame (_("no frame selected"));
catch (const gdb_exception &ex)
{
xfree (name);
- GDBSCM_HANDLE_GDB_EXCEPTION (ex);
+ exc = unpack (ex);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
}
- struct gdb_exception except;
+ gdbscm_gdb_exception except {};
try
{
symbol = lookup_symbol (name, block, (domain_enum) domain,
}
catch (const gdb_exception &ex)
{
- except = ex;
+ except = unpack (ex);
}
xfree (name);
int domain_arg_pos = -1;
int domain = VAR_DOMAIN;
struct symbol *symbol = NULL;
- struct gdb_exception except;
+ gdbscm_gdb_exception except {};
gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, keywords, "s#i",
name_scm, &name, rest,
}
catch (const gdb_exception &ex)
{
- except = ex;
+ except = unpack (ex);
}
xfree (name);
gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, NULL, "U", pc_scm, &pc_ull);
+ gdbscm_gdb_exception exc {};
try
{
CORE_ADDR pc = (CORE_ADDR) pc_ull;
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
return stscm_scm_from_sal (sal);
}
\f
static std::string
tyscm_type_name (struct type *type)
{
+ SCM excp;
try
{
string_file stb;
}
catch (const gdb_exception &except)
{
- SCM excp = gdbscm_scm_from_gdb_exception (except);
- gdbscm_throw (excp);
+ excp = gdbscm_scm_from_gdb_exception (unpack (except));
}
- gdb_assert_not_reached ("no way to get here");
+ gdbscm_throw (excp);
}
\f
/* Administrivia for type smobs. */
type1 = type1_smob->type;
type2 = type2_smob->type;
+ gdbscm_gdb_exception exc {};
try
{
result = types_deeply_equal (type1, type2);
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
return scm_from_bool (result);
}
= tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct type *type = t_smob->type;
+ gdbscm_gdb_exception exc {};
try
{
type = check_typedef (type);
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
return tyscm_scm_from_type (type);
}
for (;;)
{
+ gdbscm_gdb_exception exc {};
try
{
type = check_typedef (type);
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
if (TYPE_CODE (type) != TYPE_CODE_PTR
&& TYPE_CODE (type) != TYPE_CODE_REF)
break;
_("Array length must not be negative"));
}
+ gdbscm_gdb_exception exc {};
try
{
array = lookup_array_range_type (type, n1, n2);
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
return tyscm_scm_from_type (array);
}
= tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct type *type = t_smob->type;
+ gdbscm_gdb_exception exc {};
try
{
type = lookup_pointer_type (type);
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
return tyscm_scm_from_type (type);
}
= tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct type *type = t_smob->type;
+ gdbscm_gdb_exception exc {};
try
{
type = lookup_lvalue_reference_type (type);
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
return tyscm_scm_from_type (type);
}
= tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct type *type = t_smob->type;
+ gdbscm_gdb_exception exc {};
try
{
type = make_cv_type (1, 0, type, NULL);
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
return tyscm_scm_from_type (type);
}
= tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct type *type = t_smob->type;
+ gdbscm_gdb_exception exc {};
try
{
type = make_cv_type (0, 1, type, NULL);
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
return tyscm_scm_from_type (type);
}
= tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct type *type = t_smob->type;
+ gdbscm_gdb_exception exc {};
try
{
type = make_cv_type (0, 0, type, NULL);
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
return tyscm_scm_from_type (type);
}
\f
instead of writingp. */
opts.raw = !!pstate->writingp;
+ gdbscm_gdb_exception exc {};
try
{
string_file stb;
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
if (pstate->writingp)
scm_puts (">", port);
const value_smob *v2_smob = (value_smob *) SCM_SMOB_DATA (v2);
int result = 0;
+ gdbscm_gdb_exception exc {};
try
{
result = value_equal (v1_smob->value, v2_smob->value);
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
return scm_from_bool (result);
}
if (! SCM_UNBNDP (v_smob->dynamic_type))
return v_smob->dynamic_type;
+ gdbscm_gdb_exception exc {};
try
{
scoped_value_mark free_values;
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
if (type == NULL)
v_smob->dynamic_type = gdbscm_value_type (self);
else
long args_count;
struct value **vargs = NULL;
+ gdbscm_gdb_exception exc {};
try
{
ftype = check_typedef (value_type (function));
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
SCM_ASSERT_TYPE (TYPE_CODE (ftype) == TYPE_CODE_FUNC, self,
SCM_ARG1, FUNC_NAME,
_("function (value of TYPE_CODE_FUNC)"));
type = value_type (value);
+ gdbscm_gdb_exception exc {};
try
{
type = check_typedef (type);
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
bv = scm_c_make_bytevector (length);
memcpy (SCM_BYTEVECTOR_CONTENTS (bv), contents, length);
type = value_type (value);
+ gdbscm_gdb_exception exc {};
try
{
type = check_typedef (type);
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
SCM_ASSERT_TYPE (is_intlike (type, 1), self, SCM_ARG1, FUNC_NAME,
_("integer-like gdb value"));
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
return scm_from_bool (l != 0);
}
type = value_type (value);
+ gdbscm_gdb_exception exc {};
try
{
type = check_typedef (type);
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
SCM_ASSERT_TYPE (is_intlike (type, 1), self, SCM_ARG1, FUNC_NAME,
_("integer-like gdb value"));
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
if (TYPE_UNSIGNED (type))
return gdbscm_scm_from_ulongest (l);
else
type = value_type (value);
+ gdbscm_gdb_exception exc {};
try
{
type = check_typedef (type);
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
SCM_ASSERT_TYPE (is_intlike (type, 0) || TYPE_CODE (type) == TYPE_CODE_FLT,
self, SCM_ARG1, FUNC_NAME, _("number"));
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
/* TODO: Is there a better way to check if the value fits? */
if (!value_equal (value, check))
gdbscm_out_of_range_error (FUNC_NAME, SCM_ARG1, self,
/* We don't assume anything about the result of scm_port_conversion_strategy.
From this point on, if errors is not 'errors, use 'substitute. */
+ gdbscm_gdb_exception exc {};
try
{
gdb::unique_xmalloc_ptr<gdb_byte> buffer;
catch (const gdb_exception &except)
{
xfree (encoding);
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
/* If errors is "error", scm_from_stringn may throw a Scheme exception.
Make sure we don't leak. This is done via scm_dynwind_begin, et.al. */
char *encoding = NULL;
int length = -1;
SCM result = SCM_BOOL_F; /* -Wall */
- struct gdb_exception except;
+ gdbscm_gdb_exception except {};
/* The sequencing here, as everywhere else, is important.
We can't have existing cleanups when a Scheme exception is thrown. */
}
catch (const gdb_exception &ex)
{
- except = ex;
+ except = unpack (ex);
}
xfree (encoding);
string_file stb;
+ gdbscm_gdb_exception exc {};
try
{
common_val_print (value, &stb, 0, &opts, current_language);
}
catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
/* Use SCM_FAILED_CONVERSION_QUESTION_MARK to ensure this doesn't
throw an error if the encoding fails.
IWBN to use scm_take_locale_string here, but we'd have to temporarily