• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: printing std::string in lldb
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: printing std::string in lldb


  • Subject: Re: printing std::string in lldb
  • From: Allen Ding <email@hidden>
  • Date: Fri, 24 Jun 2011 14:29:05 +0800

"po" is used for Objective-C objects.

s[0] does not return an Objective-C object, operator[] returns a const char&.

Neither does s.c_str(), c_str() returns a const char *.

Try "p s[0]" and "p s.c_str()" instead.

On Jun 24, 2011, at 1:57 PM, Dmitry Markman wrote:

Hi 
I'm trying to print std::string in lldb

here is a simple program:

#include <iostream>

int main (int argc, const char * argv[])
{

    std::string s("Hello, World!");
    std::cout << s << std::endl;
    return 0;
}


I set Xcode 4 project to use LLVM 2 compiler and set executable to use lldb

I set breakpoint at the line return 0


lldb stopped, but when I'm trying to evaluate _expression_ (in console):

po s[0]
or
po s.c_str()

lldb errors out:
Error [IRForTarget]: Call to a function '_ZNSt18basic_string<char>ixEm' that is not present in the target
error: _expression_ can't be interpreted or run
 for s[0]

Error [IRForTarget]: Call to a function '_ZNSt18basic_string<char>5c_strEv' that is not present in the target
error: _expression_ can't be interpreted or run

for c_str()

so what I'm doing wrong?

thanks





Dmitry Markman
Do not post admin requests to the list. They will be ignored. Xcode-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: printing std::string in lldb
      • From: Dmitry Markman <email@hidden>
References: 
 >printing std::string in lldb (From: Dmitry Markman <email@hidden>)

  • Prev by Date: printing std::string in lldb
  • Next by Date: Re: Alternate Development Environments?
  • Previous by thread: printing std::string in lldb
  • Next by thread: Re: printing std::string in lldb
  • Index(es):
    • Date
    • Thread