If you step INTO func2 - and then use the "finish" command to step back out again, lldb will show you the return value from the function you stepped out of. For instance:
(lldb) br s -n func2
Breakpoint 2: where = step-into`func2() + 18 at step-into.cpp:12, address = 0x0000000100000d62
(lldb) c
Process 29307 resuming
Process 29307 stopped
* thread #1: tid = 0x300436, function: func2() , stop reason = breakpoint 2.1
frame #0: 0x0000000100000d62 step-into`func2() at step-into.cpp:12
9 std::string
10 func2()
11 {
-> 12 return std::string("some string");
13 }
14
15 int
Okay, now you are stopped in the function, so when you finish
out lldb will collect the return value and show it in the thread printing:
(lldb) fin
Process 29307 stopped
Process 29333 stopped
* thread #1: tid = 0x300e94, 0x0000000100000def step-into`main + 31 at step-into.cpp:18, queue = 'com.apple.main-thread', stop reason = step out
Return value: (std::__1::basic_string, std::__1::allocator >) $0 = "some string"
frame #0: 0x0000000100000def step-into`main at step-into.cpp:18
15 int
16 main ()
17 {
-> 18 func(func2());
19 return 0;
20 }
or if you have a customized 'thread-format' that doesn't have the return value in it, you can get at it through the SB API's:
(lldb) script print lldb.thread.GetStopReturnValue()
(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) $0 = "some string"
If you are using Xcode, it will also add an item to the top of the locals view showing the return value of the function you just stepped out of.