dev_null
dev_null

Reputation: 1997

lldb - how to print an object without summary?

Problem: I've created a summary for my object, let's think a trivial boost::intrusive_ptr (I have more complex, so this is just for example )

now if I have:

boost::intrusive_ptr< MyClass >  pobj;

and I type from the console

p pobj

I'll see summary for MyClass.

But what if I want to see it's internal px member - that is pobj.px ?

I know two ways:

I've tried already something like:

frame variable -Y0 $0

but this doesn't work.

I use XCode 4.6.3.

Is there a way to turn off summary ? Probably someone knows if this was cured in XCode 5 or latest lldb ?

Upvotes: 3

Views: 1590

Answers (2)

HolyBlackCat
HolyBlackCat

Reputation: 96002

Instead of p ... do dwim-print -R -- ....

help p reveals that p is an alias for dwim-print --, and then help dwim-print reveals the option -R, which stands for "raw output".

Also, as the other answer says, if you were using fr v ("print all local variables", aka frame variable), that has the same flag: fr -v -R.

Upvotes: 0

Jason Molenda
Jason Molenda

Reputation: 15355

You can see the raw information by using frame variable -R.

(lldb) fr v test
(std::__1::string) test = "hi there"

(lldb) fr v -R test
(std::__1::string) test = {
  __r_ = {
    std::__1::__libcpp_compressed_pair_imp<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__rep, std::__1::allocator<char> > = {
      __first_ = {
         = {
[...]

update: OP clarifies that he's at a value in a convenience variable, e.g. std::string foo () { return std::string("hi there"); }

(lldb) p foo()
(std::string) $0 = "hi there"

and wants to view $0 without any formatting -- and frame variable doesn't have access to the convenience variables so this needs to go through the expression (aka p) command. In this case, the only workaround I know is to temporarily disable the format e.g. type category disable libcxx which is what this person is hoping to avoid doing.

Upvotes: 3

Related Questions