I'm trying to debug a C++ program. I'm on macOS, using CLion IDE, clang compiler, LLDB. I stop the program at a breakpoint (marked with >>):
UnicodeString unicodeFromFile(const std::string &file) {
std::ifstream input(file, std::ios::binary);
cout << "open? " << input.is_open() << endl;
>> std::vector<char> bytes(...);
I want to run po input.is_open(). LLDB reports:
(lldb) po input.is_open()
error: expression failed to parse:
error: <user expression 0>:1:7: call to member function 'is_open' is ambiguous
input.is_open()
~~~~~~^~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/include/c++/v1/fstream:1169:10: candidate function
bool is_open() const;
^
But it's obviously not ambiguous, since the previous line of code calls it without problem. And it's error message is only listing one function.
Previous to this, I had a different problem where it couldn't find the symbol at all. But I used the advice here, which got me to this point. That answer says to add this to to ~/.lldbinit:
settings set target.import-std-module true
My previous errors looked like:
(lldb) po input.is_open()
error: expression failed to parse:
error: Couldn't lookup symbols:
__ZNKSt3__114basic_ifstreamIcNS_11char_traitsIcEEE7is_openEv