* [PATCH] Fix PR pascal/2283
@ 2007-09-26 12:25 Pierre Muller
2007-09-26 13:49 ` Eli Zaretskii
0 siblings, 1 reply; 6+ messages in thread
From: Pierre Muller @ 2007-09-26 12:25 UTC (permalink / raw)
To: gdb-patches; +Cc: 'Jonas Maebe'
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
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] Fix PR pascal/2283
2007-09-26 12:25 [PATCH] Fix PR pascal/2283 Pierre Muller
@ 2007-09-26 13:49 ` Eli Zaretskii
2007-09-26 14:02 ` Jonas Maebe
0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2007-09-26 13:49 UTC (permalink / raw)
To: Pierre Muller; +Cc: gdb-patches, jonas
> From: "Pierre Muller" <muller@ics.u-strasbg.fr>
> Cc: "'Jonas Maebe'" <jonas@freepascal.org>
> Date: Wed, 26 Sep 2007 14:25:38 +0200
>
> - || ((current_language->la_language == language_m2)
> + || ((current_language->la_language == language_pascal)
Why is it TRT to remove Modula-2 here?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Fix PR pascal/2283
2007-09-26 13:49 ` Eli Zaretskii
@ 2007-09-26 14:02 ` Jonas Maebe
2007-09-26 14:08 ` Eli Zaretskii
0 siblings, 1 reply; 6+ messages in thread
From: Jonas Maebe @ 2007-09-26 14:02 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Pierre Muller, gdb-patches
On 26 Sep 2007, at 15:49, Eli Zaretskii wrote:
>> From: "Pierre Muller" <muller@ics.u-strasbg.fr>
>> Cc: "'Jonas Maebe'" <jonas@freepascal.org>
>> Date: Wed, 26 Sep 2007 14:25:38 +0200
>>
>> - || ((current_language->la_language == language_m2)
>> + || ((current_language->la_language == language_pascal)
>
> Why is it TRT to remove Modula-2 here?
Because the that code resides in pascal_val_print() in p-valprint.c,
and not in m2_val_print() in m2-valprint.c (the former was based on
the latter, and the leftover language_m2 was simply a copy/paste
error afaics).
In fact, I have no idea why that code (in both the Pascal and
Modula-2 cases) even checks the current language, as those routines
are obviously language-specific. Maybe the Modula-2 code originally
came from a generic routine, and the check was never removed (and
then copied over to the Pascal version when that one was written)?
Jonas
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Fix PR pascal/2283
2007-09-26 14:02 ` Jonas Maebe
@ 2007-09-26 14:08 ` Eli Zaretskii
2007-09-26 14:12 ` Jonas Maebe
2007-09-26 14:26 ` Pierre Muller
0 siblings, 2 replies; 6+ messages in thread
From: Eli Zaretskii @ 2007-09-26 14:08 UTC (permalink / raw)
To: Jonas Maebe; +Cc: muller, gdb-patches
> Cc: "Pierre Muller" <muller@ics.u-strasbg.fr>,
> gdb-patches@sourceware.org
> From: Jonas Maebe <jonas@freepascal.org>
> Date: Wed, 26 Sep 2007 16:03:13 +0200
>
> In fact, I have no idea why that code (in both the Pascal and
> Modula-2 cases) even checks the current language, as those routines
> are obviously language-specific.
Exactly! If this code is Pascal-specific, you shouldn't be checking
the language at all.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Fix PR pascal/2283
2007-09-26 14:08 ` Eli Zaretskii
@ 2007-09-26 14:12 ` Jonas Maebe
2007-09-26 14:26 ` Pierre Muller
1 sibling, 0 replies; 6+ messages in thread
From: Jonas Maebe @ 2007-09-26 14:12 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: muller, gdb-patches
On 26 Sep 2007, at 16:07, Eli Zaretskii wrote:
>> Cc: "Pierre Muller" <muller@ics.u-strasbg.fr>,
>> gdb-patches@sourceware.org
>> From: Jonas Maebe <jonas@freepascal.org>
>> Date: Wed, 26 Sep 2007 16:03:13 +0200
>>
>> In fact, I have no idea why that code (in both the Pascal and
>> Modula-2 cases) even checks the current language, as those routines
>> are obviously language-specific.
>
> Exactly! If this code is Pascal-specific, you shouldn't be checking
> the language at all.
In that case, the Modula-2 version shouldn't either. But I'm far too
unfamiliar with the gdb source base to be able to assess whether it
is in fact correct and safe to remove those checks.
Jonas
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH] Fix PR pascal/2283
2007-09-26 14:08 ` Eli Zaretskii
2007-09-26 14:12 ` Jonas Maebe
@ 2007-09-26 14:26 ` Pierre Muller
1 sibling, 0 replies; 6+ messages in thread
From: Pierre Muller @ 2007-09-26 14:26 UTC (permalink / raw)
To: 'Eli Zaretskii', 'Jonas Maebe'; +Cc: gdb-patches
I think that the idea is that these functions
are exported and might be used by
other similar languages, but that this tiny
part is really specific and should not be
used in the case it is called by some
other language code.
c_val_print is used in several other
language specific XXX-lang.c files.
If pascal_val_print gets used
one day by some other language, the
behavior would be different for pascal and for XXX language.
But I agree that this is all pretty
hypothetical for now.
Should we remove it altogether?
It seems that it is the only location
inside pascal specific code
where such a test is performed.
There are three references to
another language (language_cplus)
inside p-valprint, but this is because
pascal code has no demangler and the C++
demangler is used there.
Pierre
> -----Original Message-----
> From: gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] On Behalf Of Eli Zaretskii
> Sent: Wednesday, September 26, 2007 4:08 PM
> To: Jonas Maebe
> Cc: muller@ics.u-strasbg.fr; gdb-patches@sourceware.org
> Subject: Re: [PATCH] Fix PR pascal/2283
>
> > Cc: "Pierre Muller" <muller@ics.u-strasbg.fr>,
> > gdb-patches@sourceware.org
> > From: Jonas Maebe <jonas@freepascal.org>
> > Date: Wed, 26 Sep 2007 16:03:13 +0200
> >
> > In fact, I have no idea why that code (in both the Pascal and
> > Modula-2 cases) even checks the current language, as those routines
> > are obviously language-specific.
>
> Exactly! If this code is Pascal-specific, you shouldn't be checking
> the language at all.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-09-26 14:26 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-26 12:25 [PATCH] Fix PR pascal/2283 Pierre Muller
2007-09-26 13:49 ` Eli Zaretskii
2007-09-26 14:02 ` Jonas Maebe
2007-09-26 14:08 ` Eli Zaretskii
2007-09-26 14:12 ` Jonas Maebe
2007-09-26 14:26 ` Pierre Muller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox