/* gdb commands implemented in Python
- Copyright (C) 2008-2019 Free Software Foundation, Inc.
+ Copyright (C) 2008-2020 Free Software Foundation, Inc.
This file is part of GDB.
gdbpy_ref<cmdpy_object> cmd ((cmdpy_object *) context);
cmd->command = NULL;
- /* We allocated the name, doc string, and perhaps the prefix
- name. */
- xfree ((char *) self->name);
- xfree ((char *) self->doc);
+ /* We may have allocated the prefix name. */
xfree ((char *) self->prefixname);
}
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);
/* There appears to be no API to set this. */
cmd->func = cmdpy_function;
cmd->destroyer = cmdpy_destroyer;
+ cmd->doc_allocated = 1;
+ cmd->name_allocated = 1;
obj->command = cmd;
set_cmd_context (cmd, self_ref.release ());
set_cmd_completer_handle_brkchars (cmd,
cmdpy_completer_handle_brkchars);
}
- catch (const gdb_exception_RETURN_MASK_ALL &except)
+ catch (const gdb_exception &except)
{
xfree (cmd_name);
xfree (docstring);