General lldb question

Back in the day, I seem to remember that if you asked gdb to print a string value (const char* foo;), it would print the string. Now lldb seems to like to print the address of the string and (oh so very helpfully remind me it's a const char*!!!!!). Thankew.

Anyway. I am dealing with C++ code where the namespace+class names run over 50 characters and so displaying the stack variables are near useless. Life would be tolerable if one could print out the gosh darn string  variables I have in classes and structs _as_strings_.

Now I've gone down the lldb pages via Google, but all I get is about 1000000000 lines of expository and no simple way of printing out a string.

I've tried "expr (int) printf("%s", foo);" to no avail.

I feel rather antiquated and annoyed and have resorted to littering code with printfs an spin cycling Make+Run to poke around in variables.

3 comments

Julia,

By printing you mean using 'p var' command in the LLDB console, or values in Variables view?
Are value renedrers enabled in 'Preferences | Debugger' page?

Could you please also attach a screenshot so we have general idea of the problem with long class names?

0

Yes, the lldb command in question is print.

I have a class with a std::string member. Instances of this class are referenced by another and during debugging I'd like to print out the name:

print bar.baz.theName or even theName.c_str().

I don't  know what majic incantation would convince lldb to do same. lldb docs from the organization's site are a bit of a drag.

Print returns (const char*) 0x12345678, which is annoying. I've tried to printf that from lldb but that throws an exception, so I have been hacking my methods to include a const char * local var for the data I seek, and this is printable from lldb. Same type of data, but it prints as a string.

In addition, the side panel display of the local scope's variables prefix all vars with the type info. I have some templated code and the raw type name runs 50+ chars, making that panel useless examining c++ classes, or even knowing the name of the variable. Eclipse in java does not print out the fully qualified class names the debuggr, it'd be nice if the same held true for the treatment of c++ in appcode.

I'd really love to switch to appcode for this project, as xcode's editors and tab system drive me nuts, but the show stopper is appcode find usages doesn't work. I have files organized in sub dirs, and I noticed someplace else that this might be a known issue affecting find usages.

Lastly, when I add new files under groups (which actually are directories), source is dumped into the main project dir instead of the subdir.

Anyway, love the fact there is an alternate to appcode. good going!

0

Julia,
please file a bug report for the problem with Find usages and attach a sample project, if possible.
As for lldb, I'm afraid, there is little we can do here, since AppCode only uses lldb in client-mode. Try switching to GDB (Preferences | Debugger), it may help in your case.

Anyway, C++ debugging was not in our priority list until recently and we hope to improve it in the upcoming C++ IDE.
Meanwhile, we'd apreciate issue reports and suggestions in our public tracker.

0

Please sign in to leave a comment.