summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core/Debugger.cpp
diff options
context:
space:
mode:
authorEnrico Granata <egranata@apple.com>2012-05-08 21:49:57 +0000
committerEnrico Granata <egranata@apple.com>2012-05-08 21:49:57 +0000
commita777dc2abe4525b34a0e9d6433b41ea9728b27a2 (patch)
tree00053fd31f78442d475ae5e73849528ab838f81f /lldb/source/Core/Debugger.cpp
parentf534e91882d71423b63814cb8a2384ec02507fa9 (diff)
downloadbcm5719-llvm-a777dc2abe4525b34a0e9d6433b41ea9728b27a2.tar.gz
bcm5719-llvm-a777dc2abe4525b34a0e9d6433b41ea9728b27a2.zip
<rdar://problem/11338654> Fixing a bug where having a summary for a bitfield without a format specified would in certain cases crash LLDB - This has also led to refactoring the by-type accessors for the data formatter subsystem. These now belong in our internal layer, and are just invoked by the public API stratum
llvm-svn: 156429
Diffstat (limited to 'lldb/source/Core/Debugger.cpp')
-rw-r--r--lldb/source/Core/Debugger.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index 9a7a3f57620..250486a3aed 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -16,6 +16,7 @@
#include "lldb/lldb-private.h"
#include "lldb/Core/ConnectionFileDescriptor.h"
+#include "lldb/Core/DataVisualization.h"
#include "lldb/Core/FormatManager.h"
#include "lldb/Core/InputReader.h"
#include "lldb/Core/RegisterValue.h"
@@ -1215,6 +1216,7 @@ Debugger::FormatPrompt
const char* first_unparsed;
bool was_plain_var = false;
bool was_var_format = false;
+ bool was_var_indexed = false;
if (!valobj) break;
// simplest case ${var}, just print valobj's value
@@ -1241,7 +1243,8 @@ Debugger::FormatPrompt
// this is ${var.something} or multiple .something nested
else if (::strncmp (var_name_begin, "var", strlen("var")) == 0)
{
-
+ if (::strncmp(var_name_begin, "var[", strlen("var[")) == 0)
+ was_var_indexed = true;
const char* percent_position;
ScanFormatDescriptor (var_name_begin,
var_name_end,
@@ -1318,6 +1321,20 @@ Debugger::FormatPrompt
do_deref_pointer = false;
}
+ // <rdar://problem/11338654>
+ // we do not want to use the summary for a bitfield of type T:n
+ // if we were originally dealing with just a T - that would get
+ // us into an endless recursion
+ if (target->IsBitfield() && was_var_indexed)
+ {
+ // TODO: check for a (T:n)-specific summary - we should still obey that
+ StreamString bitfield_name;
+ bitfield_name.Printf("%s:%d", target->GetTypeName().AsCString(), target->GetBitfieldBitSize());
+ lldb::TypeNameSpecifierImplSP type_sp(new TypeNameSpecifierImpl(bitfield_name.GetData(),false));
+ if (!DataVisualization::GetSummaryForType(type_sp))
+ val_obj_display = ValueObject::eValueObjectRepresentationStyleValue;
+ }
+
// TODO use flags for these
bool is_array = ClangASTContext::IsArrayType(target->GetClangType());
bool is_pointer = ClangASTContext::IsPointerType(target->GetClangType());
OpenPOWER on IntegriCloud