This is the mail archive of the
archer@sourceware.org
mailing list for the Archer project.
[python] StdStringPrinter misleading?
- From: ppluzhnikov at google dot com (Paul Pluzhnikov)
- To: archer at sourceware dot org
- Date: Fri, 27 Mar 2009 17:22:08 -0700 (PDT)
- Subject: [python] StdStringPrinter misleading?
Greetings,
std::string could contain embedded NUL characters, and current
StdStringPrinter hides this (not that the raw printing is any better):
$ cat strnull.cc
#include <string>
using namespace std;
int main()
{
char foo[] = "abcd\0ghij";
string s = string(foo, sizeof(foo));
size_t len = s.length();
return len == sizeof(foo) ? 0 : 1;
}
(gdb) b 10
Breakpoint 1 at 0x4003b2: file strnull.cc, line 10.
(gdb) r
Breakpoint 1, main () at strnull.cc:10
10 return len == sizeof(foo) ? 0 : 1;
(gdb) print s
$1 = "abcd"
(gdb) print foo
$2 = "abcd\000ghij"
It would be nice if 'print s' and 'print foo' produced the same output,
though it wasn't clear to me how this could be achieved.
--
Paul Pluzhnikov