{
param_smob *p_smob = (param_smob *) get_cmd_context (c);
SCM self, result, exception;
{
param_smob *p_smob = (param_smob *) get_cmd_context (c);
SCM self, result, exception;
if (!scm_is_string (result))
error (_("Result of %s set-func is not a string."), p_smob->name);
if (!scm_is_string (result))
error (_("Result of %s set-func is not a string."), p_smob->name);
if (msg == NULL)
{
gdbscm_print_gdb_exception (SCM_BOOL_F, exception);
error (_("Error converting show text to host string."));
}
if (msg == NULL)
{
gdbscm_print_gdb_exception (SCM_BOOL_F, exception);
error (_("Error converting show text to host string."));
}
- if (*msg != '\0')
- fprintf_filtered (gdb_stdout, "%s\n", msg);
- do_cleanups (cleanups);
+ if (*msg.get () != '\0')
+ fprintf_filtered (gdb_stdout, "%s\n", msg.get ());
{
param_smob *p_smob = (param_smob *) get_cmd_context (c);
SCM value_scm, self, result, exception;
{
param_smob *p_smob = (param_smob *) get_cmd_context (c);
SCM value_scm, self, result, exception;
if (msg == NULL)
{
gdbscm_print_gdb_exception (SCM_BOOL_F, exception);
error (_("Error converting show text to host string."));
}
if (msg == NULL)
{
gdbscm_print_gdb_exception (SCM_BOOL_F, exception);
error (_("Error converting show text to host string."));
}
- cleanups = make_cleanup (xfree, msg);
- fprintf_filtered (file, "%s\n", msg);
- do_cleanups (cleanups);
+ fprintf_filtered (file, "%s\n", msg.get ());
add_setshow_generic (enum var_types param_type, enum command_class cmd_class,
char *cmd_name, param_smob *self,
char *set_doc, char *show_doc, char *help_doc,
add_setshow_generic (enum var_types param_type, enum command_class cmd_class,
char *cmd_name, param_smob *self,
char *set_doc, char *show_doc, char *help_doc,
show_value_ftype *show_func,
struct cmd_list_element **set_list,
struct cmd_list_element **show_list,
show_value_ftype *show_func,
struct cmd_list_element **set_list,
struct cmd_list_element **show_list,
set_doc, show_doc, help_doc,
set_func, show_func,
set_list, show_list);
set_doc, show_doc, help_doc,
set_func, show_func,
set_list, show_list);
- enum_values = xmalloc ((size + 1) * sizeof (char *));
- memset (enum_values, 0, (size + 1) * sizeof (char *));
+ enum_values = XCNEWVEC (char *, size + 1);
freeargv (enum_values);
SCM_ASSERT_TYPE (0, value, arg_pos, func_name, _("string"));
}
freeargv (enum_values);
SCM_ASSERT_TYPE (0, value, arg_pos, func_name, _("string"));
}
- enum_values[i] = gdbscm_scm_to_host_string (value, NULL, &exception);
+ enum_values[i] = gdbscm_scm_to_host_string (value, NULL,
+ &exception).release ();
- string = gdbscm_scm_to_host_string (value, NULL, &exception);
+ gdb::unique_xmalloc_ptr<char> string
+ = gdbscm_scm_to_host_string (value, NULL, &exception);
SCM exception;
SCM_ASSERT_TYPE (scm_is_string (value), value, arg_pos, func_name,
_("string"));
SCM exception;
SCM_ASSERT_TYPE (scm_is_string (value), value, arg_pos, func_name,
_("string"));
- str = gdbscm_scm_to_host_string (value, NULL, &exception);
+ gdb::unique_xmalloc_ptr<char> str
+ = gdbscm_scm_to_host_string (value, NULL, &exception);
if (enumeration[i] == NULL)
{
gdbscm_out_of_range_error (func_name, arg_pos, value,
if (enumeration[i] == NULL)
{
gdbscm_out_of_range_error (func_name, arg_pos, value,
case var_boolean:
SCM_ASSERT_TYPE (gdbscm_is_bool (value), value, arg_pos, func_name,
_("boolean"));
case var_boolean:
SCM_ASSERT_TYPE (gdbscm_is_bool (value), value, arg_pos, func_name,
_("boolean"));
/* These are all stored in GC space so that we don't have to worry about
freeing them if we throw an exception. */
p_smob->name = name;
/* These are all stored in GC space so that we don't have to worry about
freeing them if we throw an exception. */
p_smob->name = name;
- pascm_set_param_value_x (param_type, &p_smob->value, enum_list,
+ pascm_set_param_value_x (p_smob->type, &p_smob->value, enum_list,
= pascm_get_param_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
char *cmd_name;
struct cmd_list_element **set_list, **show_list;
= pascm_get_param_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
char *cmd_name;
struct cmd_list_element **set_list, **show_list;
if (pascm_is_valid (p_smob))
scm_misc_error (FUNC_NAME, _("parameter is already registered"), SCM_EOL);
if (pascm_is_valid (p_smob))
scm_misc_error (FUNC_NAME, _("parameter is already registered"), SCM_EOL);
{
add_setshow_generic (p_smob->type, p_smob->cmd_class,
p_smob->cmd_name, p_smob,
{
add_setshow_generic (p_smob->type, p_smob->cmd_class,
p_smob->cmd_name, p_smob,
- name = gdbscm_scm_to_host_string (self, NULL, &except_scm);
+ gdb::unique_xmalloc_ptr<char> name
+ = gdbscm_scm_to_host_string (self, NULL, &except_scm);
- newarg = concat ("show ", name, (char *) NULL);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ newarg = concat ("show ", name.get (), (char *) NULL);
+ try
{
found = lookup_cmd_composition (newarg, &alias, &prefix, &cmd);
}
{
found = lookup_cmd_composition (newarg, &alias, &prefix, &cmd);
}
- { "make-parameter", 1, 0, 1, gdbscm_make_parameter,
+ { "make-parameter", 1, 0, 1, as_a_scm_t_subr (gdbscm_make_parameter),
show-doc: The \"doc string\" when showing the parameter.\n\
initial-value: The initial value of the parameter." },
show-doc: The \"doc string\" when showing the parameter.\n\
initial-value: The initial value of the parameter." },
- { "register-parameter!", 1, 0, 0, gdbscm_register_parameter_x,
+ { "register-parameter!", 1, 0, 0,
+ as_a_scm_t_subr (gdbscm_register_parameter_x),
- { "parameter?", 1, 0, 0, gdbscm_parameter_p,
+ { "parameter?", 1, 0, 0, as_a_scm_t_subr (gdbscm_parameter_p),
- { "parameter-value", 1, 0, 0, gdbscm_parameter_value,
+ { "parameter-value", 1, 0, 0, as_a_scm_t_subr (gdbscm_parameter_value),
"\
Return the value of a <gdb:parameter> object\n\
or any gdb parameter if param is a string naming the parameter." },
"\
Return the value of a <gdb:parameter> object\n\
or any gdb parameter if param is a string naming the parameter." },
- { "set-parameter-value!", 2, 0, 0, gdbscm_set_parameter_value_x,
+ { "set-parameter-value!", 2, 0, 0,
+ as_a_scm_t_subr (gdbscm_set_parameter_value_x),