summaryrefslogtreecommitdiff
path: root/gdb/c-valprint.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2012-05-18 15:29:13 +0000
committerTom Tromey <tromey@redhat.com>2012-05-18 15:29:13 +0000
commitb012acddd87cb89dc4b357adf458511232c58bfe (patch)
tree53fe717d585832ab24bd2e2ec7c786f914d2a86f /gdb/c-valprint.c
parent1d51a733d5f20fe7ad6e89103f50742da2991586 (diff)
* 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.
Diffstat (limited to 'gdb/c-valprint.c')
-rw-r--r--gdb/c-valprint.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c
index 4e32973341..9411890585 100644
--- a/gdb/c-valprint.c
+++ b/gdb/c-valprint.c
@@ -254,9 +254,13 @@ c_val_print (struct type *type, const gdb_byte *valaddr,
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. */
@@ -265,7 +269,10 @@ c_val_print (struct type *type, const gdb_byte *valaddr,
}
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. */
@@ -274,6 +281,8 @@ c_val_print (struct type *type, const gdb_byte *valaddr,
options->format)
&& addr != 0)
{
+ if (want_space)
+ fputs_filtered (" ", stream);
i = val_print_string (unresolved_elttype, NULL,
addr, -1,
stream, options);
@@ -284,16 +293,20 @@ c_val_print (struct type *type, const gdb_byte *valaddr,
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;
@@ -302,6 +315,9 @@ c_val_print (struct type *type, const gdb_byte *valaddr,
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,