/* GDB commands implemented in Scheme.
- Copyright (C) 2008-2018 Free Software Foundation, Inc.
+ Copyright (C) 2008-2019 Free Software Foundation, Inc.
This file is part of GDB.
static SCM
gdbscm_dont_repeat (SCM self)
{
- /* We currently don't need anything from SELF, but still verify it. */
- command_smob *c_smob
- = cmdscm_get_valid_command_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
+ /* We currently don't need anything from SELF, but still verify it.
+ Call for side effects. */
+ cmdscm_get_valid_command_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
dont_repeat ();
itself. */
if (gdbscm_user_error_p (gdbscm_exception_key (result)))
{
- char *msg = gdbscm_exception_message_to_string (result);
+ gdb::unique_xmalloc_ptr<char> msg
+ = gdbscm_exception_message_to_string (result);
- make_cleanup (xfree, msg);
- error ("%s", msg);
+ error ("%s", msg.get ());
}
else
{
}
gdb::unique_xmalloc_ptr<char> item
- (gdbscm_scm_to_string (completion, NULL, host_charset (), 1,
- &except_scm));
+ = gdbscm_scm_to_string (completion, NULL, host_charset (), 1,
+ &except_scm);
if (item == NULL)
{
/* Inform the user, but otherwise ignore the entire result. */
lastchar = i;
/* Find first character of the final word. */
- for (; i > 0 && (isalnum (name[i - 1])
- || name[i - 1] == '-'
- || name[i - 1] == '_');
- --i)
+ for (; i > 0 && valid_cmd_char_p (name[i - 1]); --i)
;
result = (char *) xmalloc (lastchar - i + 2);
memcpy (result, &name[i], lastchar - i + 1);
c_smob->cmd_name = gdbscm_gc_xstrdup (cmd_name);
xfree (cmd_name);
- TRY
+ gdbscm_gdb_exception exc {};
+ try
{
if (c_smob->is_prefix)
{
c_smob->doc, cmd_list);
}
}
- CATCH (except, RETURN_MASK_ALL)
+ catch (const gdb_exception &except)
{
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ exc = unpack (except);
}
- END_CATCH
+ GDBSCM_HANDLE_GDB_EXCEPTION (exc);
/* Note: At this point the command exists in gdb.
So no more errors after this point. */