public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/14288] New: comma+space printed too late in string dump after a repeat count
@ 2012-06-24 13:12 johannes.sixt at gmail dot com
  2012-11-10 20:19 ` [Bug gdb/14288] " cvs-commit at gcc dot gnu.org
  2012-11-10 20:22 ` keiths at redhat dot com
  0 siblings, 2 replies; 3+ messages in thread
From: johannes.sixt at gmail dot com @ 2012-06-24 13:12 UTC (permalink / raw)
  To: gdb-prs

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

             Bug #: 14288
           Summary: comma+space printed too late in string dump after a
                    repeat count
           Product: gdb
           Version: 7.4
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
        AssignedTo: unassigned@sourceware.org
        ReportedBy: johannes.sixt@gmail.com
    Classification: Unclassified


tmp:1011> gdb741 a.out
GNU gdb (GDB) 7.4.1
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /tmp/a.out...done.
(gdb) l
1       void main()
2       {
3               char s[] = "abbbbbbbbbbbbbbbbbbbb"
4                       "\240\240\240\240\240\240\240\240"
5                       "\240\240\240\240\240\240\240\240c";
6       }
(gdb) break 6
Breakpoint 1 at 0x400531: file gdb-string-dump.c, line 6.
(gdb) run
Starting program: /tmp/a.out 

Breakpoint 1, main () at gdb-string-dump.c:6
6       }
(gdb) info locals
s = "a", 'b' <repeats 20 times>"\240,
\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240c"
(gdb) 

Notice that the comma+space that usually follows after the repeat count
was printed only after the first byte of the remaining string was dumped.
This is clearly wrong because it gives a false impression of the contents
of the string.

A minor point is that the subsequent string could have been printed as

   '\240' <repeats 16 times>

Just in case it matters:

tmp:1014> echo $LANG
POSIX

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug gdb/14288] comma+space printed too late in string dump after a repeat count
  2012-06-24 13:12 [Bug gdb/14288] New: comma+space printed too late in string dump after a repeat count johannes.sixt at gmail dot com
@ 2012-11-10 20:19 ` cvs-commit at gcc dot gnu.org
  2012-11-10 20:22 ` keiths at redhat dot com
  1 sibling, 0 replies; 3+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2012-11-10 20:19 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> 2012-11-10 20:19:05 UTC ---
CVSROOT:    /cvs/src
Module name:    src
Changes by:    kseitz@sourceware.org    2012-11-10 20:19:01

Modified files:
    gdb            : ChangeLog c-valprint.c valprint.c 
    gdb/testsuite  : ChangeLog 
    gdb/testsuite/gdb.base: printcmds.c printcmds.exp wchar.c 
                            wchar.exp 

Log message:
    PR gdb/14288
    * c-valprint.c (c_val_print): For character arrays
    with "print null" option on, print ellipses if
    the output is truncated and the next character is not \000.
    * valprint.c (MAX_WCHARS): Define.
    (WCHAR_BUFLEN): Likewise.
    (WCHAR_BUFLEN_MAX): Likewise.
    (struct converted_character): New structure.
    (count_next_character): New function.
    (print_converted_chars_to_obstack): New function.
    (generic_printstr): Rewrite using count_next_character
    and print_converted_chars_to_obstack.

    * gdb.base/printcmds.c: Add invalid_XXX globals
    for repeated byte tests.
    * gdb.base/printcmds.exp (test_repeat_bytes): New procedure.
    * gdb.base/wchar.c (main): Add and construct a wchar_t
    array with repeated characters.
    * gdb.base/wchar.exp: Add repeated character tests.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.14812&r2=1.14813
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/c-valprint.c.diff?cvsroot=src&r1=1.98&r2=1.99
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/valprint.c.diff?cvsroot=src&r1=1.129&r2=1.130
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/ChangeLog.diff?cvsroot=src&r1=1.3450&r2=1.3451
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.base/printcmds.c.diff?cvsroot=src&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.base/printcmds.exp.diff?cvsroot=src&r1=1.46&r2=1.47
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.base/wchar.c.diff?cvsroot=src&r1=1.2&r2=1.3
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.base/wchar.exp.diff?cvsroot=src&r1=1.2&r2=1.3

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug gdb/14288] comma+space printed too late in string dump after a repeat count
  2012-06-24 13:12 [Bug gdb/14288] New: comma+space printed too late in string dump after a repeat count johannes.sixt at gmail dot com
  2012-11-10 20:19 ` [Bug gdb/14288] " cvs-commit at gcc dot gnu.org
@ 2012-11-10 20:22 ` keiths at redhat dot com
  1 sibling, 0 replies; 3+ messages in thread
From: keiths at redhat dot com @ 2012-11-10 20:22 UTC (permalink / raw)
  To: gdb-prs

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

Keith Seitz <keiths at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |keiths at redhat dot com
         Resolution|                            |FIXED
         AssignedTo|unassigned at sourceware    |keiths at redhat dot com
                   |dot org                     |
   Target Milestone|---                         |7.6

--- Comment #2 from Keith Seitz <keiths at redhat dot com> 2012-11-10 20:22:31 UTC ---
I have committed a patch to address this problem.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-11-10 20:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-24 13:12 [Bug gdb/14288] New: comma+space printed too late in string dump after a repeat count johannes.sixt at gmail dot com
2012-11-10 20:19 ` [Bug gdb/14288] " cvs-commit at gcc dot gnu.org
2012-11-10 20:22 ` keiths at redhat dot com

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).