Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Uladzislau Rezki <urezki@gmail.com>
To: gdb@sourceware.org
Subject: why so
Date: Sun, 08 Mar 2009 13:12:00 -0000	[thread overview]
Message-ID: <e4957ae10903080612g58504140l77198502fa52ca57@mail.gmail.com> (raw)

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


             reply	other threads:[~2009-03-08 13:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-08 13:12 Uladzislau Rezki [this message]
2009-03-08 17:21 ` Paul Pluzhnikov
2009-03-09  9:24   ` Uladzislau Rezki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e4957ae10903080612g58504140l77198502fa52ca57@mail.gmail.com \
    --to=urezki@gmail.com \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox