long dummy;
struct ui_file *stb;
struct cleanup *old_chain;
- char *thevalue = NULL;
+ gdb_byte *thevalue = NULL;
struct value_print_options opts;
+ int len = 0;
if (value == NULL)
return NULL;
char *hint;
struct value *replacement;
int string_print = 0;
+ PyObject *output = NULL;
hint = gdbpy_get_display_hint (value_formatter);
if (hint)
xfree (hint);
}
- thevalue = apply_varobj_pretty_printer (value_formatter,
- &replacement);
+ output = apply_varobj_pretty_printer (value_formatter,
+ &replacement);
+ if (output)
+ {
+ PyObject *py_str = python_string_to_target_python_string (output);
+ if (py_str)
+ {
+ char *s = PyString_AsString (py_str);
+ len = PyString_Size (py_str);
+ thevalue = xmemdup (s, len + 1, len + 1);
+ Py_DECREF (py_str);
+ }
+ Py_DECREF (output);
+ }
if (thevalue && !string_print)
{
do_cleanups (back_to);
struct gdbarch *gdbarch = get_type_arch (value_type (value));
make_cleanup (xfree, thevalue);
LA_PRINT_STRING (stb, builtin_type (gdbarch)->builtin_char,
- (gdb_byte *) thevalue, strlen (thevalue),
- 0, &opts);
+ thevalue, len, 0, &opts);
}
else
common_val_print (value, stb, 0, &opts, current_language);