Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* why so
@ 2009-03-08 13:12 Uladzislau Rezki
  2009-03-08 17:21 ` Paul Pluzhnikov
  0 siblings, 1 reply; 3+ messages in thread
From: Uladzislau Rezki @ 2009-03-08 13:12 UTC (permalink / raw)
  To: gdb

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


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

end of thread, other threads:[~2009-03-09  9:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-08 13:12 why so Uladzislau Rezki
2009-03-08 17:21 ` Paul Pluzhnikov
2009-03-09  9:24   ` Uladzislau Rezki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox