aboutsummaryrefslogtreecommitdiff
path: root/gdb
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
parent1d51a733d5f20fe7ad6e89103f50742da2991586 (diff)
downloadgdb-b012acddd87cb89dc4b357adf458511232c58bfe.zip
gdb-b012acddd87cb89dc4b357adf458511232c58bfe.tar.gz
gdb-b012acddd87cb89dc4b357adf458511232c58bfe.tar.bz2
* 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')
-rw-r--r--gdb/ChangeLog15
-rw-r--r--gdb/auxv.c2
-rw-r--r--gdb/c-valprint.c20
-rw-r--r--gdb/f-valprint.c15
-rw-r--r--gdb/go-valprint.c5
-rw-r--r--gdb/jv-valprint.c2
-rw-r--r--gdb/m2-valprint.c14
-rw-r--r--gdb/p-valprint.c14
-rw-r--r--gdb/testsuite/ChangeLog4
-rw-r--r--gdb/testsuite/gdb.base/charset.exp2
-rw-r--r--gdb/valprint.c8
11 files changed, 83 insertions, 18 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 73e06c2..3793661 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,20 @@
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.
2012-05-18 Tom Tromey <tromey@redhat.com>
diff --git a/gdb/auxv.c b/gdb/auxv.c
index 23d1480..5072085 100644
--- a/gdb/auxv.c
+++ b/gdb/auxv.c
@@ -483,7 +483,7 @@ fprint_target_auxv (struct ui_file *file, struct target_ops *ops)
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");
diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c
index 4e32973..9411890 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,
diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
index 3181356..229bfe3 100644
--- a/gdb/f-valprint.c
+++ b/gdb/f-valprint.c
@@ -310,6 +310,8 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
}
else
{
+ int want_space = 0;
+
addr = unpack_pointer (type, valaddr + embedded_offset);
elttype = check_typedef (TYPE_TARGET_TYPE (type));
@@ -321,7 +323,10 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
}
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. */
@@ -329,8 +334,12 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
&& 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;
diff --git a/gdb/go-valprint.c b/gdb/go-valprint.c
index 3be4927..de52e9b 100644
--- a/gdb/go-valprint.c
+++ b/gdb/go-valprint.c
@@ -64,7 +64,10 @@ print_go_string (struct type *type, const gdb_byte *valaddr,
/* 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)
{
diff --git a/gdb/jv-valprint.c b/gdb/jv-valprint.c
index 9c5c245..d1274dd 100644
--- a/gdb/jv-valprint.c
+++ b/gdb/jv-valprint.c
@@ -231,6 +231,8 @@ java_value_print (struct value *val, struct ui_file *stream,
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);
diff --git a/gdb/m2-valprint.c b/gdb/m2-valprint.c
index 015af3b..ea3f296 100644
--- a/gdb/m2-valprint.c
+++ b/gdb/m2-valprint.c
@@ -195,6 +195,7 @@ print_unpacked_pointer (struct type *type,
{
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)
{
@@ -205,7 +206,10 @@ print_unpacked_pointer (struct type *type,
}
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. */
@@ -214,8 +218,12 @@ print_unpacked_pointer (struct type *type,
&& 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;
}
diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c
index 0a32a22..be28f93 100644
--- a/gdb/p-valprint.c
+++ b/gdb/p-valprint.c
@@ -74,6 +74,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
struct type *char_type;
LONGEST val;
CORE_ADDR addr;
+ int want_space = 0;
CHECK_TYPEDEF (type);
switch (TYPE_CODE (type))
@@ -176,6 +177,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
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
@@ -188,6 +190,8 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
&& (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);
}
@@ -203,6 +207,8 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
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,
@@ -223,9 +229,12 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
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)
{
@@ -235,6 +244,9 @@ pascal_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, &is_this_fld);
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 0aeb2f7..9ef5587 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,9 @@
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.
* gdb.mi/mi-var-display.exp: Update.
* gdb.mi/mi-var-child.exp: Update.
diff --git a/gdb/testsuite/gdb.base/charset.exp b/gdb/testsuite/gdb.base/charset.exp
index 47cf954..27e36d6 100644
--- a/gdb/testsuite/gdb.base/charset.exp
+++ b/gdb/testsuite/gdb.base/charset.exp
@@ -604,7 +604,7 @@ gdb_test "print 'a' == 'a' || 'b' == 'b'" \
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} {
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 507aeb5..6742fc1 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -2351,10 +2351,6 @@ val_print_string (struct type *elttype, const char *encoding,
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);
}
@@ -2363,13 +2359,13 @@ val_print_string (struct type *elttype, const char *encoding,
{
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));
}