This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
Re: pascal/2283: Copy/paste error in print_variable_at_address regarding printing pchars
- From: Jonas Maebe <jonas at freepascal dot org>
- To: nobody at sources dot redhat dot com
- Cc: gdb-prs at sources dot redhat dot com,
- Date: 3 Jul 2007 21:48:01 -0000
- Subject: Re: pascal/2283: Copy/paste error in print_variable_at_address regarding printing pchars
- Reply-to: Jonas Maebe <jonas at freepascal dot org>
The following reply was made to PR pascal/2283; it has been noted by GNATS.
From: Jonas Maebe <jonas@freepascal.org>
To: gdb-gnats@sources.redhat.com
Cc:
Subject: Re: pascal/2283: Copy/paste error in print_variable_at_address regarding printing pchars
Date: Tue, 3 Jul 2007 23:40:41 +0200
Sorry, I added the wrong patch: the supplied patch fixes printing an
"array of char" as string (it's ok to apply that one too though,
since it's trivial and about a similar issues).
Here is the (also pretty trivial) patch for fixing the printing of
pointers to chars as strings:
Index: p-valprint.c
===================================================================
RCS file: /cvs/src/src/gdb/p-valprint.c,v
retrieving revision 1.49
diff -u -r1.49 p-valprint.c
--- p-valprint.c 13 Jun 2007 17:30:01 -0000 1.49
+++ p-valprint.c 3 Jul 2007 21:38:56 -0000
@@ -172,7 +172,8 @@
/* 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)
{