}
static void
-set_command (char *exp, int from_tty)
+set_command (const char *exp, int from_tty)
{
expression_up expr = parse_expression (exp);
evaluate_expression (expr.get ());
}
+/* Temporary non-const version of set_command. */
+
+static void
+non_const_set_command (char *exp, int from_tty)
+{
+ set_command (exp, from_tty);
+}
+
static void
info_symbol_command (char *arg, int from_tty)
{
= lookup_minimal_symbol_by_pc_section (sect_addr, osect).minsym))
{
const char *obj_name, *mapped, *sec_name, *msym_name;
- char *loc_string;
+ const char *loc_string;
struct cleanup *old_chain;
matches = 1;
/* Don't print the offset if it is zero.
We assume there's no need to handle i18n of "sym + offset". */
+ std::string string_holder;
if (offset)
- loc_string = xstrprintf ("%s + %u", msym_name, offset);
+ {
+ string_holder = string_printf ("%s + %u", msym_name, offset);
+ loc_string = string_holder.c_str ();
+ }
else
- loc_string = xstrprintf ("%s", msym_name);
-
- /* Use a cleanup to free loc_string in case the user quits
- a pagination request inside printf_filtered. */
- old_chain = make_cleanup (xfree, loc_string);
+ loc_string = msym_name;
gdb_assert (osect->objfile && objfile_name (osect->objfile));
obj_name = objfile_name (osect->objfile);
else
printf_filtered (_("%s in section %s\n"),
loc_string, sec_name);
-
- do_cleanups (old_chain);
}
}
if (matches == 0)
x_command (char *exp, int from_tty)
{
struct format_data fmt;
- struct cleanup *old_chain;
struct value *val;
fmt.format = last_format ? last_format : 'x';
int dfp_len = 16;
gdb_byte dec[16];
struct type *dfp_type = NULL;
- char decstr[MAX_DECIMAL_STRING];
/* Points to the end of the string so that we can go back
and check for DFP length modifiers. */
dfp_ptr = (gdb_byte *) value_contents (dfp_value);
- decimal_to_string (dfp_ptr, dfp_len, byte_order, decstr);
-
- /* Print the DFP value. */
- fprintf_filtered (stream, "%s", decstr);
+ /* Convert the value to a string and print it. */
+ std::string str = decimal_to_string (dfp_ptr, dfp_len, byte_order);
+ fputs_filtered (str.c_str (), stream);
#endif
}
You can see these environment settings with the \"show\" command."),
&setlist, "set ", 1, &cmdlist);
if (dbx_commands)
- add_com ("assign", class_vars, set_command, _("\
+ add_com ("assign", class_vars, non_const_set_command, _("\
Evaluate expression EXP and assign result to variable VAR, using assignment\n\
syntax appropriate for the current language (VAR = EXP or VAR := EXP for\n\
example). VAR may be a debugger \"convenience\" variable (names starting\n\