This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
why so
- From: Uladzislau Rezki <urezki at gmail dot com>
- To: gdb at sourceware dot org
- Date: Sun, 8 Mar 2009 15:12:35 +0200
- Subject: why so
Hello gdb list,
I am stuck with debugging C++ application that uses STL.
So, i have a simple code:
#include <iostream>
static int
test(std::string s)
{
std::cout << s << std::endl;
return 0;
}
int main(int argc, char **argv)
{
std::string a = "hello";
test(a);
return 0;
}
while debugging *test* function, i try to print s variable and
i see following stauff, thought i expect to see "hello":
(gdb) print s.c_str()
$2 = 0xbf9486d8 "\024pR\b"
gdb version is:
demon >>> gdb -v
GNU gdb 6.8-debian
Copyright (C) 2008 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 "i486-linux-gnu".
demon >>>
thanks in advance.
--
Uladzislau Rezki