+2012-05-18 Tom Tromey <tromey@redhat.com>
+
+ * valprint.c (val_print_string): Don't print leading space.
+ * p-valprint.c (pascal_val_print) <TYPE_CODE_PTR>: Optionally
+ print space before string or vtbl.
+ * m2-valprint.c (print_unpacked_pointer): Optionally print space
+ before string.
+ * jv-valprint.c (java_value_print): Print space before string.
+ * go-valprint.c (print_go_string): Print space before string.
+ * f-valprint.c (f_val_print) <TYPE_CODE_PTR>: Optionally print
+ space before string.
+ * c-valprint.c (c_val_print) <TYPE_CODE_PTR>: Optionally print
+ space before string or vtbl.
+ * auxv.c (fprint_target_auxv): Print space after address.
+
2012-05-18 Tom Tromey <tromey@redhat.com>
* printcmd.c (print_address_demangle): Remove special case for 0.
get_user_print_options (&opts);
if (opts.addressprint)
- fprintf_filtered (file, "%s", paddress (target_gdbarch, val));
+ fprintf_filtered (file, "%s ", paddress (target_gdbarch, val));
val_print_string (builtin_type (target_gdbarch)->builtin_char,
NULL, val, -1, file, &opts);
fprintf_filtered (file, "\n");
unresolved_elttype = TYPE_TARGET_TYPE (type);
elttype = check_typedef (unresolved_elttype);
{
+ int want_space;
+
addr = unpack_pointer (type, valaddr + embedded_offset);
print_unpacked_pointer:
+ want_space = 0;
+
if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
{
/* Try to print what function it points to. */
}
if (options->addressprint)
- fputs_filtered (paddress (gdbarch, addr), stream);
+ {
+ fputs_filtered (paddress (gdbarch, addr), stream);
+ want_space = 1;
+ }
/* For a pointer to a textual type, also print the string
pointed to, unless pointer is null. */
options->format)
&& addr != 0)
{
+ if (want_space)
+ fputs_filtered (" ", stream);
i = val_print_string (unresolved_elttype, NULL,
addr, -1,
stream, options);
CORE_ADDR vt_address = unpack_pointer (type,
valaddr
+ embedded_offset);
-
struct minimal_symbol *msymbol =
lookup_minimal_symbol_by_pc (vt_address);
+
if ((msymbol != NULL)
&& (vt_address == SYMBOL_VALUE_ADDRESS (msymbol)))
{
+ if (want_space)
+ fputs_filtered (" ", stream);
fputs_filtered (" <", stream);
fputs_filtered (SYMBOL_PRINT_NAME (msymbol), stream);
fputs_filtered (">", stream);
+ want_space = 1;
}
+
if (vt_address && options->vtblprint)
{
struct value *vt_val;
struct block *block = (struct block *) NULL;
int is_this_fld;
+ if (want_space)
+ fputs_filtered (" ", stream);
+
if (msymbol != NULL)
wsym = lookup_symbol (SYMBOL_LINKAGE_NAME (msymbol),
block, VAR_DOMAIN,
}
else
{
+ int want_space = 0;
+
addr = unpack_pointer (type, valaddr + embedded_offset);
elttype = check_typedef (TYPE_TARGET_TYPE (type));
}
if (options->addressprint && options->format != 's')
- fputs_filtered (paddress (gdbarch, addr), stream);
+ {
+ fputs_filtered (paddress (gdbarch, addr), stream);
+ want_space = 1;
+ }
/* For a pointer to char or unsigned char, also print the string
pointed to, unless pointer is null. */
&& TYPE_CODE (elttype) == TYPE_CODE_INT
&& (options->format == 0 || options->format == 's')
&& addr != 0)
- i = val_print_string (TYPE_TARGET_TYPE (type), NULL, addr, -1,
- stream, options);
+ {
+ if (want_space)
+ fputs_filtered (" ", stream);
+ i = val_print_string (TYPE_TARGET_TYPE (type), NULL, addr, -1,
+ stream, options);
+ }
return;
}
break;
/* TODO(dje): Print address of struct or actual string? */
if (options->addressprint)
- fputs_filtered (paddress (gdbarch, addr), stream);
+ {
+ fputs_filtered (paddress (gdbarch, addr), stream);
+ fputs_filtered (" ", stream);
+ }
if (length < 0)
{
unsigned long count;
struct value *mark;
+ fputs_filtered (" ", stream);
+
mark = value_mark (); /* Remember start of new values. */
data_val = value_struct_elt (&val, NULL, "data", NULL, NULL);
{
struct gdbarch *gdbarch = get_type_arch (type);
struct type *elttype = check_typedef (TYPE_TARGET_TYPE (type));
+ int want_space = 0;
if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
{
}
if (options->addressprint && options->format != 's')
- fputs_filtered (paddress (gdbarch, address), stream);
+ {
+ fputs_filtered (paddress (gdbarch, address), stream);
+ want_space = 1;
+ }
/* For a pointer to char or unsigned char, also print the string
pointed to, unless pointer is null. */
&& TYPE_CODE (elttype) == TYPE_CODE_INT
&& (options->format == 0 || options->format == 's')
&& addr != 0)
- return val_print_string (TYPE_TARGET_TYPE (type), NULL, addr, -1,
- stream, options);
+ {
+ if (want_space)
+ fputs_filtered (" ", stream);
+ return val_print_string (TYPE_TARGET_TYPE (type), NULL, addr, -1,
+ stream, options);
+ }
return 0;
}
struct type *char_type;
LONGEST val;
CORE_ADDR addr;
+ int want_space = 0;
CHECK_TYPEDEF (type);
switch (TYPE_CODE (type))
if (options->addressprint && options->format != 's')
{
fputs_filtered (paddress (gdbarch, addr), stream);
+ want_space = 1;
}
/* For a pointer to char or unsigned char, also print the string
&& (options->format == 0 || options->format == 's')
&& addr != 0)
{
+ if (want_space)
+ fputs_filtered (" ", stream);
/* No wide string yet. */
i = val_print_string (elttype, NULL, addr, -1, stream, options);
}
ULONGEST string_length;
void *buffer;
+ if (want_space)
+ fputs_filtered (" ", stream);
buffer = xmalloc (length_size);
read_memory (addr + length_pos, buffer, length_size);
string_length = extract_unsigned_integer (buffer, length_size,
if ((msymbol != NULL)
&& (vt_address == SYMBOL_VALUE_ADDRESS (msymbol)))
{
- fputs_filtered (" <", stream);
+ if (want_space)
+ fputs_filtered (" ", stream);
+ fputs_filtered ("<", stream);
fputs_filtered (SYMBOL_PRINT_NAME (msymbol), stream);
fputs_filtered (">", stream);
+ want_space = 1;
}
if (vt_address && options->vtblprint)
{
struct block *block = (struct block *) NULL;
int is_this_fld;
+ if (want_space)
+ fputs_filtered (" ", stream);
+
if (msymbol != NULL)
wsym = lookup_symbol (SYMBOL_LINKAGE_NAME (msymbol), block,
VAR_DOMAIN, &is_this_fld);
+2012-05-18 Tom Tromey <tromey@redhat.com>
+
+ * gdb.base/charset.exp (string_display): Update.
+
2012-05-18 Tom Tromey <tromey@redhat.com>
* gdb.mi/mi2-var-display.exp: Update.
proc string_display { var_name set_prefix x_size x_type} {
gdb_test_no_output "set ${var_name} = ${set_prefix}\"Test String\\0with zeroes\"" "Assign ${var_name} with prefix ${set_prefix}"
- gdb_test "x /2${x_size}s ${var_name}" ".* ${x_type}\"Test String\"\[\r\n\]+.* ${x_type}\"with zeroes\"" "Display String ${var_name} with x/${x_size}s"
+ gdb_test "x /2${x_size}s ${var_name}" ".*\t${x_type}\"Test String\"\[\r\n\]+.*\t${x_type}\"with zeroes\"" "Display String ${var_name} with x/${x_size}s"
}
if {$ucs2_ok} {
and then the error message. */
if (errcode == 0 || bytes_read > 0)
{
- if (options->addressprint)
- {
- fputs_filtered (" ", stream);
- }
LA_PRINT_STRING (stream, elttype, buffer, bytes_read / width,
encoding, force_ellipsis, options);
}
{
if (errcode == EIO)
{
- fprintf_filtered (stream, " <Address ");
+ fprintf_filtered (stream, "<Address ");
fputs_filtered (paddress (gdbarch, addr), stream);
fprintf_filtered (stream, " out of bounds>");
}
else
{
- fprintf_filtered (stream, " <Error reading address ");
+ fprintf_filtered (stream, "<Error reading address ");
fputs_filtered (paddress (gdbarch, addr), stream);
fprintf_filtered (stream, ": %s>", safe_strerror (errcode));
}