summaryrefslogtreecommitdiff
path: root/gdb/p-valprint.c
diff options
context:
space:
mode:
authorPierre Muller <muller@ics.u-strasbg.fr>2009-02-10 00:12:57 +0000
committerPierre Muller <muller@ics.u-strasbg.fr>2009-02-10 00:12:57 +0000
commit3466f1a4bb94676a9305361bfd61e667315bff79 (patch)
tree5478f099ee3b3f0412a715d11f0e3f89817e9ece /gdb/p-valprint.c
parentc953f5544c9e1769eaea18ef4326de7b872dd10f (diff)
downloadgdb-3466f1a4bb94676a9305361bfd61e667315bff79.tar.gz
2009-02-10 Pierre Muller <muller@ics.u-strasbg.fr>
* p-lang.c (is_pascal_string_type): Fix comment. Determine exact size of char elements for GPC strings. (pascal_printstr): Handle char width of 2 or 4. * p-valprint.c (pascal_val_print): Handle char of width 2 or 4.
Diffstat (limited to 'gdb/p-valprint.c')
-rw-r--r--gdb/p-valprint.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c
index 9b1b7ffac8c..27ae619a14b 100644
--- a/gdb/p-valprint.c
+++ b/gdb/p-valprint.c
@@ -79,7 +79,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
print_spaces_filtered (2 + 2 * recurse, stream);
}
/* For an array of chars, print with string syntax. */
- if (eltlen == 1
+ if ((eltlen == 1 || eltlen == 2 || eltlen == 4)
&& ((TYPE_CODE (elttype) == TYPE_CODE_INT)
|| ((current_language->la_language == language_pascal)
&& (TYPE_CODE (elttype) == TYPE_CODE_CHAR)))
@@ -93,14 +93,15 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
/* Look for a NULL char. */
for (temp_len = 0;
- (valaddr + embedded_offset)[temp_len]
+ extract_unsigned_integer (valaddr + embedded_offset +
+ temp_len * eltlen, eltlen)
&& temp_len < len && temp_len < options->print_max;
temp_len++);
len = temp_len;
}
- LA_PRINT_STRING (stream, valaddr + embedded_offset, len, 1, 0,
- options);
+ LA_PRINT_STRING (stream, valaddr + embedded_offset, len,
+ eltlen, 0, options);
i = len;
}
else
@@ -165,14 +166,17 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr,
/* For a pointer to char or unsigned char, also print the string
pointed to, unless pointer is null. */
- if (TYPE_LENGTH (elttype) == 1
- && (TYPE_CODE (elttype) == TYPE_CODE_INT
- || TYPE_CODE(elttype) == TYPE_CODE_CHAR)
+ if (((TYPE_LENGTH (elttype) == 1
+ && (TYPE_CODE (elttype) == TYPE_CODE_INT
+ || TYPE_CODE (elttype) == TYPE_CODE_CHAR))
+ || ((TYPE_LENGTH (elttype) == 2 || TYPE_LENGTH (elttype) == 4)
+ && TYPE_CODE (elttype) == TYPE_CODE_CHAR))
&& (options->format == 0 || options->format == 's')
&& addr != 0)
{
/* no wide string yet */
- i = val_print_string (addr, -1, 1, stream, options);
+ i = val_print_string (addr, -1, TYPE_LENGTH (elttype), stream,
+ options);
}
/* also for pointers to pascal strings */
/* Note: this is Free Pascal specific: