aboutsummaryrefslogtreecommitdiff
path: root/gdb/valprint.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/valprint.c')
-rw-r--r--gdb/valprint.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/gdb/valprint.c b/gdb/valprint.c
index b02e9df..32f9ded 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -919,7 +919,8 @@ print_hex_chars (struct ui_file *stream, const gdb_byte *valaddr,
Omit any leading zero chars. */
void
-print_char_chars (struct ui_file *stream, const gdb_byte *valaddr,
+print_char_chars (struct ui_file *stream, struct type *type,
+ const gdb_byte *valaddr,
unsigned len, enum bfd_endian byte_order)
{
const gdb_byte *p;
@@ -932,7 +933,7 @@ print_char_chars (struct ui_file *stream, const gdb_byte *valaddr,
while (p < valaddr + len)
{
- LA_EMIT_CHAR (*p, stream, '\'');
+ LA_EMIT_CHAR (*p, type, stream, '\'');
++p;
}
}
@@ -944,7 +945,7 @@ print_char_chars (struct ui_file *stream, const gdb_byte *valaddr,
while (p >= valaddr)
{
- LA_EMIT_CHAR (*p, stream, '\'');
+ LA_EMIT_CHAR (*p, type, stream, '\'');
--p;
}
}
@@ -1315,7 +1316,8 @@ read_string (CORE_ADDR addr, int len, int width, unsigned int fetchlimit,
whichever is smaller. */
int
-val_print_string (CORE_ADDR addr, int len, int width, struct ui_file *stream,
+val_print_string (struct type *elttype, CORE_ADDR addr, int len,
+ struct ui_file *stream,
const struct value_print_options *options)
{
int force_ellipsis = 0; /* Force ellipsis to be printed if nonzero. */
@@ -1325,6 +1327,7 @@ val_print_string (CORE_ADDR addr, int len, int width, struct ui_file *stream,
int bytes_read;
gdb_byte *buffer = NULL; /* Dynamically growable fetch buffer. */
struct cleanup *old_chain = NULL; /* Top of the old cleanup chain. */
+ int width = TYPE_LENGTH (elttype);
/* First we need to figure out the limit on the number of characters we are
going to attempt to fetch and print. This is actually pretty simple. If
@@ -1378,7 +1381,7 @@ val_print_string (CORE_ADDR addr, int len, int width, struct ui_file *stream,
{
fputs_filtered (" ", stream);
}
- LA_PRINT_STRING (stream, buffer, bytes_read / width, width, force_ellipsis, options);
+ LA_PRINT_STRING (stream, elttype, buffer, bytes_read / width, force_ellipsis, options);
}
if (errcode != 0)