diff options
author | Enrico Granata <granata.enrico@gmail.com> | 2011-07-12 22:56:10 +0000 |
---|---|---|
committer | Enrico Granata <granata.enrico@gmail.com> | 2011-07-12 22:56:10 +0000 |
commit | f4efecd9587a54e331e14b90f53ef9f2bdfcfc93 (patch) | |
tree | dc88ed6dcb21a374f270d88684ca781e7cc49f46 /lldb/source/Core/Debugger.cpp | |
parent | 5d11676eef4727474e6141e390c8fd20a54f1e1a (diff) | |
download | bcm5719-llvm-f4efecd9587a54e331e14b90f53ef9f2bdfcfc93.tar.gz bcm5719-llvm-f4efecd9587a54e331e14b90f53ef9f2bdfcfc93.zip |
smarter summary strings:
- formats %s %char[] %c and %a now work to print 0-terminated c-strings if they are applied to a char* or char[] even without the [] operator (e.g. ${var%s})
- array formats (char[], intN[], ..) now work when applied to an array of a scalar type even without the [] operator (e.g. ${var%int32_t[]})
LLDB will not crash because of endless loop when trying to obtain a summary for an object that has no value and references itself in its summary string
In many cases, a wrong summary string will now display an "<error>" message instead of giving out an empty string
llvm-svn: 135007
Diffstat (limited to 'lldb/source/Core/Debugger.cpp')
-rw-r--r-- | lldb/source/Core/Debugger.cpp | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp index 9b34331e84f..2c36dbb8c66 100644 --- a/lldb/source/Core/Debugger.cpp +++ b/lldb/source/Core/Debugger.cpp @@ -694,6 +694,7 @@ TestPromptFormats (StackFrame *frame) } } +// FIXME this should eventually be replaced by proper use of LLDB logging facilities //#define VERBOSE_FORMATPROMPT_OUTPUT #ifdef VERBOSE_FORMATPROMPT_OUTPUT #define IFERROR_PRINT_IT if (error.Fail()) \ @@ -1090,14 +1091,29 @@ Debugger::FormatPrompt IFERROR_PRINT_IT do_deref_pointer = false; } + + bool is_array = ClangASTContext::IsArrayType(target->GetClangType()); + bool is_pointer = ClangASTContext::IsPointerType(target->GetClangType()); + + if ((is_array || is_pointer) && (!is_array_range) && val_obj_display == ValueObject::eDisplayValue) // this should be wrong, but there are some exceptions + { +#ifdef VERBOSE_FORMATPROMPT_OUTPUT + printf("I am into array || pointer && !range\n"); +#endif //VERBOSE_FORMATPROMPT_OUTPUT + // try to use the special cases + var_success = target->DumpPrintableRepresentation(s,val_obj_display, custom_format); + if (!var_success) + s << "<invalid, please use [] operator>"; +#ifdef VERBOSE_FORMATPROMPT_OUTPUT + printf("outcome was : %s\n", var_success ? "good" : "bad"); +#endif //VERBOSE_FORMATPROMPT_OUTPUT + break; + } if (!is_array_range) var_success = target->DumpPrintableRepresentation(s,val_obj_display, custom_format); else - { - bool is_array = ClangASTContext::IsArrayType(target->GetClangType()); - bool is_pointer = ClangASTContext::IsPointerType(target->GetClangType()); - + { if (!is_array && !is_pointer) break; |