public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "muller at ics dot u-strasbg dot fr" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug pascal/11492] Patch to print (pascal) arrays of integer right
Date: Tue, 13 Apr 2010 09:24:00 -0000	[thread overview]
Message-ID: <20100413092408.3909.qmail@sourceware.org> (raw)
In-Reply-To: <20100412195759.11492.joost@cnoc.nl>


------- Additional Comments From muller at ics dot u-strasbg dot fr  2010-04-13 09:24 -------
I agree with your bug report but not with the proposed patch,
instead I propose this:

  The main difference is the the use of /s print format
modifier will force the printing as a string, regardless of the
element type.
 
  Please tell me if this patch is OK for you also.

Pierre Muller
Pascal language maintainer of GDB.

Index: p-valprint.c
===================================================================
RCS file: /cvs/src/src/gdb/p-valprint.c,v
retrieving revision 1.68
diff -u -p -r1.68 p-valprint.c
--- p-valprint.c        9 Mar 2010 08:30:54 -0000       1.68
+++ p-valprint.c        13 Apr 2010 09:19:55 -0000
@@ -80,12 +80,13 @@ pascal_val_print (struct type *type, con
            {
              print_spaces_filtered (2 + 2 * recurse, stream);
            }
-         /* For an array of chars, print with string syntax.  */
-         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)))
-             && (options->format == 0 || options->format == 's'))
+         /* If 's' format is used, try to print out as string.
+            If no format is given, print as string if element type
+            is of TYPE_CODE_CHAR and element size is 1,2 or 4.  */
+         if (options->format == 's'
+             || ((eltlen == 1 || eltlen == 2 || eltlen == 4)
+                 && TYPE_CODE (elttype) == TYPE_CODE_CHAR
+                 && options->format == 0))
            {
              /* If requested, look for the first null char and only print
                 elements up to it.  */

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|7.1                         |7.2


http://sourceware.org/bugzilla/show_bug.cgi?id=11492

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


  parent reply	other threads:[~2010-04-13  9:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-12 19:58 [Bug pascal/11492] New: " joost at cnoc dot nl
2010-04-12 22:37 ` [Bug pascal/11492] " sergiodj at redhat dot com
2010-04-13  7:53 ` joost at cnoc dot nl
2010-04-13  8:16 ` muller at ics dot u-strasbg dot fr
2010-04-13  9:24 ` muller at ics dot u-strasbg dot fr [this message]
2010-04-13 10:43 ` joost at cnoc dot nl
2010-05-08 15:20 ` muller at ics dot u-strasbg dot fr
2010-05-12 12:47 ` muller at ics dot u-strasbg dot fr
2010-05-15 20:47 ` jan dot kratochvil at redhat dot com
     [not found] <bug-11492-4717@http.sourceware.org/bugzilla/>
2014-09-12 22:01 ` sergiodj at redhat dot com
2015-04-21 20:41 ` muller at sourceware dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100413092408.3909.qmail@sourceware.org \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).