This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug python/10633] New: std::string pretty printer should respect 'print elements' limit
- From: "ppluzhnikov at google dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: 12 Sep 2009 00:37:09 -0000
- Subject: [Bug python/10633] New: std::string pretty printer should respect 'print elements' limit
- Reply-to: sourceware-bugzilla at sourceware dot org
There is inconsistency between e.g. std::vector and std::string pretty
printers: the former respects 'print elements' limit, the latter doesn't.
Example:
--- cut ---
#include <string>
#include <vector>
using namespace std;
int main()
{
// 01234567890123456789012
const char *const cs = "Mary had a little lamb.";
vector<int> v;
string s;
for (int i = 0; i < 10; ++i)
{
v.push_back(i);
s += cs;
}
return 0; // break here
}
--- cut ---
g++ -g -o long-str long-str.cc
gdb64-cvs -nx long-str
GNU gdb (GDB) 6.8.50.20090911-cvs
Copyright (C) 2009 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 /home/ppluzhnikov/src/tmp/long-str...done.
(gdb) b 17
Breakpoint 1 at 0x4008d6: file long-str.cc, line 17.
(gdb) run
Starting program: /home/ppluzhnikov/src/tmp/long-str
Breakpoint 1, main () at long-str.cc:17
17 return 0; // break here
## This is fresh svn sync of the latest pretty printers as of 5 minutes ago:
(gdb) py sys.path.insert(0, '/home/ppluzhnikov/Archive/gcc-svn/libstdc++-v3/python')
(gdb) py from libstdcxx.v6.printers import register_libstdcxx_printers
(gdb) py register_libstdcxx_printers (None)
(gdb) set print elem 5
(gdb) print v
$1 = std::vector of length 10, capacity 16 = {0, 1, 2, 3, 4...}
(gdb) print cs
$2 = 0x40138e "Mary "...
(gdb) print s
$3 =
"Mary had a little lamb.Mary had a little lamb.Mary had a little lamb.Mary
had a little lamb.Mary had a little lamb.Mary had a little lamb.Mary had a
little lamb.Mary had a little lamb.Mary had a little lamb.Mary had a little lamb."
(gdb) q
Note how 'print elem 5' applies to both vector and 'const char *cs',
but the string is printed "in full".
--
Summary: std::string pretty printer should respect 'print
elements' limit
Product: gdb
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: python
AssignedTo: unassigned at sourceware dot org
ReportedBy: ppluzhnikov at google dot com
CC: gdb-prs at sourceware dot org
GCC build triplet: x86_64-unknown-linux-gnu
GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu
http://sourceware.org/bugzilla/show_bug.cgi?id=10633
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.