[Bug 25205] New: std::string has no value

Bug ID 25205
Summary std::string has no value
Product lldb
Version unspecified
Hardware PC
OS Linux
Status NEW
Severity normal
Priority P
Component All Bugs
Assignee lldb-dev@lists.llvm.org
Reporter berykubik@gmail.com
CC llvm-bugs@lists.llvm.org
Classification Unclassified

Created attachment 15088 [details]
C++ source with test program

std::string variables have value "None" when I access them using the Python
scripting API. They only have one child, which also has a value of None. Is
there another way to get the string value, or am I doing something wrong? I
could probably print the string into the terminal and get the result from the
command interpreter, but it would be nice to access the string directly.

I've attached a simple C++ program that demonstrates this.

I'm using LLDB 3.8 compiled from trunk. The program was compiled using clang++
with libc++ (I also tried g++ and -fstandalone-debug switch with similar

import lldb
import os

debugger = lldb.SBDebugger.Create()
target = debugger.CreateTarget("./test")
target.BreakpointCreateByLocation("test.cpp", 7)
process = target.LaunchSimple([], [], os.getcwd())

thread = process.GetSelectedThread()
frame = thread.GetSelectedFrame()
for var in frame.vars:
    if var.name == "a":
        print(var.value) # None


Jim Ingham changed bug 25205

What Removed Added
CC jingham@apple.com
Resolution INVALID

Comment # 1 on bug 25205 from Jim Ingham

std::string is a structure.  Structures don't have a value.  They have children
- the structure fields - and perhaps a summary and/or synthetic children.  

Note that for a std::string the actual children are the fields of the internal
implementation, which isn't all that helpful.  What you probably want to show
is the summary of the string, which is the user-friendly presentation that the
lldb "data formatters" cook up for you.