This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] Fix PR pascal/2283
- From: "Pierre Muller" <muller at ics dot u-strasbg dot fr>
- To: <gdb-patches at sourceware dot org>
- Cc: "'Jonas Maebe'" <jonas at freepascal dot org>
- Date: Wed, 26 Sep 2007 14:25:38 +0200
- Subject: [PATCH] Fix PR pascal/2283
This patch fixes the display of char arrays
for pascal language as reported by Jonas Maebe
in the GDB bugs database.
ChangeLog entry:
2007-09-26 Pierre Muller <muller@ics.u-strasbg.fr>
* Fix PR pascal/2283
p-valprint.c (pascal_val_print): correct
current language check.
Also print array of char as strings.
$ cvs diff -up p-valprint.c
Index: p-valprint.c
===================================================================
RCS file: /cvs/src/src/gdb/p-valprint.c,v
retrieving revision 1.51
diff -u -p -r1.51 p-valprint.c
--- p-valprint.c 7 Sep 2007 12:34:55 -0000 1.51
+++ p-valprint.c 26 Sep 2007 12:14:19 -0000
@@ -87,7 +87,7 @@ pascal_val_print (struct type *type, con
/* For an array of chars, print with string syntax. */
if (eltlen == 1
&& ((TYPE_CODE (elttype) == TYPE_CODE_INT)
- || ((current_language->la_language == language_m2)
+ || ((current_language->la_language == language_pascal)
&& (TYPE_CODE (elttype) == TYPE_CODE_CHAR)))
&& (format == 0 || format == 's'))
{
@@ -170,7 +170,8 @@ pascal_val_print (struct type *type, con
/* 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_INT
+ || TYPE_CODE(elttype) == TYPE_CODE_CHAR)
&& (format == 0 || format == 's')
&& addr != 0)
{
Pierre Muller
Chargé de recherches
Institut Charles Sadron
6, rue Boussingault
F 67083 Strasbourg Cedex
Tél.?: +(33)3-88-41-40-07
Email?: pierre.muller@ics.u-strasbg.fr