summaryrefslogtreecommitdiffstats
path: root/lldb/source/DataFormatters
diff options
context:
space:
mode:
authorEnrico Granata <egranata@apple.com>2015-09-04 00:33:51 +0000
committerEnrico Granata <egranata@apple.com>2015-09-04 00:33:51 +0000
commit419d79189f56a4d819f7e958a7ea695efaef9875 (patch)
treedadbea9cf2f24f50366ca359b9b935f4b0014008 /lldb/source/DataFormatters
parentf9cdea9d7466617ee772e9d9b19707e391763870 (diff)
downloadbcm5719-llvm-419d79189f56a4d819f7e958a7ea695efaef9875.tar.gz
bcm5719-llvm-419d79189f56a4d819f7e958a7ea695efaef9875.zip
Nuke CXXFormatterFunctions.cpp - split the contents of it across different files, so that things are better organized along the C++/ObjC line
This is preparatory work for moving these formatters into language categories llvm-svn: 246827
Diffstat (limited to 'lldb/source/DataFormatters')
-rw-r--r--lldb/source/DataFormatters/CF.cpp3
-rw-r--r--lldb/source/DataFormatters/CMakeLists.txt2
-rw-r--r--lldb/source/DataFormatters/CXXFormatterFunctions.cpp266
-rw-r--r--lldb/source/DataFormatters/CXXFunctionPointer.cpp63
-rw-r--r--lldb/source/DataFormatters/Cocoa.cpp16
-rw-r--r--lldb/source/DataFormatters/CoreMedia.cpp2
-rw-r--r--lldb/source/DataFormatters/CxxStringTypes.cpp7
-rw-r--r--lldb/source/DataFormatters/FormatManager.cpp11
-rw-r--r--lldb/source/DataFormatters/FormattersHelpers.cpp177
-rw-r--r--lldb/source/DataFormatters/LibCxx.cpp8
-rw-r--r--lldb/source/DataFormatters/LibCxxInitializerList.cpp3
-rw-r--r--lldb/source/DataFormatters/LibCxxList.cpp3
-rw-r--r--lldb/source/DataFormatters/LibCxxMap.cpp3
-rw-r--r--lldb/source/DataFormatters/LibCxxUnorderedMap.cpp3
-rw-r--r--lldb/source/DataFormatters/LibCxxVector.cpp3
-rw-r--r--lldb/source/DataFormatters/LibStdcpp.cpp47
-rw-r--r--lldb/source/DataFormatters/NSArray.cpp3
-rw-r--r--lldb/source/DataFormatters/NSDictionary.cpp3
-rw-r--r--lldb/source/DataFormatters/NSIndexPath.cpp3
-rw-r--r--lldb/source/DataFormatters/NSSet.cpp3
-rw-r--r--lldb/source/DataFormatters/VectorType.cpp2
21 files changed, 331 insertions, 300 deletions
diff --git a/lldb/source/DataFormatters/CF.cpp b/lldb/source/DataFormatters/CF.cpp
index 6ab9013268b..719d15e9405 100644
--- a/lldb/source/DataFormatters/CF.cpp
+++ b/lldb/source/DataFormatters/CF.cpp
@@ -7,13 +7,14 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/DataFormatters/CXXFormatterFunctions.h"
+#include "lldb/DataFormatters/CF.h"
#include "lldb/Core/DataBufferHeap.h"
#include "lldb/Core/Error.h"
#include "lldb/Core/Stream.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/Core/ValueObjectConstResult.h"
+#include "lldb/DataFormatters/FormattersHelpers.h"
#include "lldb/Host/Endian.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Target/ObjCLanguageRuntime.h"
diff --git a/lldb/source/DataFormatters/CMakeLists.txt b/lldb/source/DataFormatters/CMakeLists.txt
index 98efaeed062..3a1e0f042a2 100644
--- a/lldb/source/DataFormatters/CMakeLists.txt
+++ b/lldb/source/DataFormatters/CMakeLists.txt
@@ -2,7 +2,7 @@ add_lldb_library(lldbDataFormatters
CF.cpp
Cocoa.cpp
CoreMedia.cpp
- CXXFormatterFunctions.cpp
+ CXXFunctionPointer.cpp
CxxStringTypes.cpp
DataVisualization.cpp
FormatCache.cpp
diff --git a/lldb/source/DataFormatters/CXXFormatterFunctions.cpp b/lldb/source/DataFormatters/CXXFormatterFunctions.cpp
deleted file mode 100644
index 90f554beee0..00000000000
--- a/lldb/source/DataFormatters/CXXFormatterFunctions.cpp
+++ /dev/null
@@ -1,266 +0,0 @@
-//===-- CXXFormatterFunctions.cpp---------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "lldb/DataFormatters/CXXFormatterFunctions.h"
-#include "lldb/DataFormatters/StringPrinter.h"
-#include "lldb/DataFormatters/TypeSummary.h"
-
-#include "llvm/Support/ConvertUTF.h"
-
-#include "lldb/Core/DataBufferHeap.h"
-#include "lldb/Core/Error.h"
-#include "lldb/Core/Stream.h"
-#include "lldb/Core/ValueObject.h"
-#include "lldb/Core/ValueObjectConstResult.h"
-#include "lldb/Host/Endian.h"
-#include "lldb/Symbol/ClangASTContext.h"
-#include "lldb/Target/SectionLoadList.h"
-#include "lldb/Target/Target.h"
-#include "lldb/Target/Thread.h"
-
-#include "lldb/Utility/ProcessStructReader.h"
-
-#include <algorithm>
-
-#if __ANDROID_NDK__
-#include <sys/types.h>
-#endif
-
-#include "lldb/Host/Time.h"
-
-using namespace lldb;
-using namespace lldb_private;
-using namespace lldb_private::formatters;
-
-StackFrame*
-lldb_private::formatters::GetViableFrame (ExecutionContext exe_ctx)
-{
- StackFrame* frame = exe_ctx.GetFramePtr();
- if (frame)
- return frame;
-
- Process* process = exe_ctx.GetProcessPtr();
- if (!process)
- return nullptr;
-
- ThreadSP thread_sp(process->GetThreadList().GetSelectedThread());
- if (thread_sp)
- return thread_sp->GetSelectedFrame().get();
- return nullptr;
-}
-
-bool
-lldb_private::formatters::ExtractValueFromObjCExpression (ValueObject &valobj,
- const char* target_type,
- const char* selector,
- uint64_t &value)
-{
- if (!target_type || !*target_type)
- return false;
- if (!selector || !*selector)
- return false;
- StreamString expr;
- expr.Printf("(%s)[(id)0x%" PRIx64 " %s]",target_type,valobj.GetPointerValue(),selector);
- ExecutionContext exe_ctx (valobj.GetExecutionContextRef());
- lldb::ValueObjectSP result_sp;
- Target* target = exe_ctx.GetTargetPtr();
- StackFrame* stack_frame = GetViableFrame(exe_ctx);
- if (!target || !stack_frame)
- return false;
-
- EvaluateExpressionOptions options;
- options.SetCoerceToId(false);
- options.SetUnwindOnError(true);
- options.SetKeepInMemory(true);
-
- target->EvaluateExpression(expr.GetData(),
- stack_frame,
- result_sp,
- options);
- if (!result_sp)
- return false;
- value = result_sp->GetValueAsUnsigned(0);
- return true;
-}
-
-bool
-lldb_private::formatters::ExtractSummaryFromObjCExpression (ValueObject &valobj,
- const char* target_type,
- const char* selector,
- Stream &stream)
-{
- if (!target_type || !*target_type)
- return false;
- if (!selector || !*selector)
- return false;
- StreamString expr;
- expr.Printf("(%s)[(id)0x%" PRIx64 " %s]",target_type,valobj.GetPointerValue(),selector);
- ExecutionContext exe_ctx (valobj.GetExecutionContextRef());
- lldb::ValueObjectSP result_sp;
- Target* target = exe_ctx.GetTargetPtr();
- StackFrame* stack_frame = GetViableFrame(exe_ctx);
- if (!target || !stack_frame)
- return false;
-
- EvaluateExpressionOptions options;
- options.SetCoerceToId(false);
- options.SetUnwindOnError(true);
- options.SetKeepInMemory(true);
- options.SetUseDynamic(lldb::eDynamicCanRunTarget);
-
- target->EvaluateExpression(expr.GetData(),
- stack_frame,
- result_sp,
- options);
- if (!result_sp)
- return false;
- stream.Printf("%s",result_sp->GetSummaryAsCString());
- return true;
-}
-
-lldb::ValueObjectSP
-lldb_private::formatters::CallSelectorOnObject (ValueObject &valobj,
- const char* return_type,
- const char* selector,
- uint64_t index)
-{
- lldb::ValueObjectSP valobj_sp;
- if (!return_type || !*return_type)
- return valobj_sp;
- if (!selector || !*selector)
- return valobj_sp;
- StreamString expr_path_stream;
- valobj.GetExpressionPath(expr_path_stream, false);
- StreamString expr;
- expr.Printf("(%s)[%s %s:%" PRId64 "]",return_type,expr_path_stream.GetData(),selector,index);
- ExecutionContext exe_ctx (valobj.GetExecutionContextRef());
- lldb::ValueObjectSP result_sp;
- Target* target = exe_ctx.GetTargetPtr();
- StackFrame* stack_frame = GetViableFrame(exe_ctx);
- if (!target || !stack_frame)
- return valobj_sp;
-
- EvaluateExpressionOptions options;
- options.SetCoerceToId(false);
- options.SetUnwindOnError(true);
- options.SetKeepInMemory(true);
- options.SetUseDynamic(lldb::eDynamicCanRunTarget);
-
- target->EvaluateExpression(expr.GetData(),
- stack_frame,
- valobj_sp,
- options);
- return valobj_sp;
-}
-
-lldb::ValueObjectSP
-lldb_private::formatters::CallSelectorOnObject (ValueObject &valobj,
- const char* return_type,
- const char* selector,
- const char* key)
-{
- lldb::ValueObjectSP valobj_sp;
- if (!return_type || !*return_type)
- return valobj_sp;
- if (!selector || !*selector)
- return valobj_sp;
- if (!key || !*key)
- return valobj_sp;
- StreamString expr_path_stream;
- valobj.GetExpressionPath(expr_path_stream, false);
- StreamString expr;
- expr.Printf("(%s)[%s %s:%s]",return_type,expr_path_stream.GetData(),selector,key);
- ExecutionContext exe_ctx (valobj.GetExecutionContextRef());
- lldb::ValueObjectSP result_sp;
- Target* target = exe_ctx.GetTargetPtr();
- StackFrame* stack_frame = GetViableFrame(exe_ctx);
- if (!target || !stack_frame)
- return valobj_sp;
-
- EvaluateExpressionOptions options;
- options.SetCoerceToId(false);
- options.SetUnwindOnError(true);
- options.SetKeepInMemory(true);
- options.SetUseDynamic(lldb::eDynamicCanRunTarget);
-
- target->EvaluateExpression(expr.GetData(),
- stack_frame,
- valobj_sp,
- options);
- return valobj_sp;
-}
-
-bool
-lldb_private::formatters::FunctionPointerSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options)
-{
- std::string destination;
- StreamString sstr;
- AddressType func_ptr_address_type = eAddressTypeInvalid;
- addr_t func_ptr_address = valobj.GetPointerValue (&func_ptr_address_type);
- if (func_ptr_address != 0 && func_ptr_address != LLDB_INVALID_ADDRESS)
- {
- switch (func_ptr_address_type)
- {
- case eAddressTypeInvalid:
- case eAddressTypeFile:
- case eAddressTypeHost:
- break;
-
- case eAddressTypeLoad:
- {
- ExecutionContext exe_ctx (valobj.GetExecutionContextRef());
-
- Address so_addr;
- Target *target = exe_ctx.GetTargetPtr();
- if (target && target->GetSectionLoadList().IsEmpty() == false)
- {
- if (target->GetSectionLoadList().ResolveLoadAddress(func_ptr_address, so_addr))
- {
- so_addr.Dump (&sstr,
- exe_ctx.GetBestExecutionContextScope(),
- Address::DumpStyleResolvedDescription,
- Address::DumpStyleSectionNameOffset);
- }
- }
- }
- break;
- }
- }
- if (sstr.GetSize() > 0)
- {
- stream.Printf("(%s)", sstr.GetData());
- return true;
- }
- else
- return false;
-}
-
-bool
-lldb_private::formatters::RuntimeSpecificDescriptionSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options)
-{
- stream.Printf("%s",valobj.GetObjectDescription());
- return true;
-}
-
-size_t
-lldb_private::formatters::ExtractIndexFromString (const char* item_name)
-{
- if (!item_name || !*item_name)
- return UINT32_MAX;
- if (*item_name != '[')
- return UINT32_MAX;
- item_name++;
- char* endptr = NULL;
- unsigned long int idx = ::strtoul(item_name, &endptr, 0);
- if (idx == 0 && endptr == item_name)
- return UINT32_MAX;
- if (idx == ULONG_MAX)
- return UINT32_MAX;
- return idx;
-}
diff --git a/lldb/source/DataFormatters/CXXFunctionPointer.cpp b/lldb/source/DataFormatters/CXXFunctionPointer.cpp
new file mode 100644
index 00000000000..82a301bb8f5
--- /dev/null
+++ b/lldb/source/DataFormatters/CXXFunctionPointer.cpp
@@ -0,0 +1,63 @@
+//===-- CXXFormatterFunctions.cpp---------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/DataFormatters/CXXFunctionPointer.h"
+#include "lldb/Target/SectionLoadList.h"
+#include "lldb/Target/Target.h"
+
+#include <string>
+
+using namespace lldb;
+using namespace lldb_private;
+using namespace lldb_private::formatters;
+
+bool
+lldb_private::formatters::CXXFunctionPointerSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options)
+{
+ std::string destination;
+ StreamString sstr;
+ AddressType func_ptr_address_type = eAddressTypeInvalid;
+ addr_t func_ptr_address = valobj.GetPointerValue (&func_ptr_address_type);
+ if (func_ptr_address != 0 && func_ptr_address != LLDB_INVALID_ADDRESS)
+ {
+ switch (func_ptr_address_type)
+ {
+ case eAddressTypeInvalid:
+ case eAddressTypeFile:
+ case eAddressTypeHost:
+ break;
+
+ case eAddressTypeLoad:
+ {
+ ExecutionContext exe_ctx (valobj.GetExecutionContextRef());
+
+ Address so_addr;
+ Target *target = exe_ctx.GetTargetPtr();
+ if (target && target->GetSectionLoadList().IsEmpty() == false)
+ {
+ if (target->GetSectionLoadList().ResolveLoadAddress(func_ptr_address, so_addr))
+ {
+ so_addr.Dump (&sstr,
+ exe_ctx.GetBestExecutionContextScope(),
+ Address::DumpStyleResolvedDescription,
+ Address::DumpStyleSectionNameOffset);
+ }
+ }
+ }
+ break;
+ }
+ }
+ if (sstr.GetSize() > 0)
+ {
+ stream.Printf("(%s)", sstr.GetData());
+ return true;
+ }
+ else
+ return false;
+}
diff --git a/lldb/source/DataFormatters/Cocoa.cpp b/lldb/source/DataFormatters/Cocoa.cpp
index 6c55f5b8a61..d89c3e35469 100644
--- a/lldb/source/DataFormatters/Cocoa.cpp
+++ b/lldb/source/DataFormatters/Cocoa.cpp
@@ -7,20 +7,21 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/DataFormatters/CXXFormatterFunctions.h"
-#include "lldb/DataFormatters/StringPrinter.h"
-#include "lldb/DataFormatters/TypeSummary.h"
+#include "lldb/DataFormatters/Cocoa.h"
#include "lldb/Core/DataBufferHeap.h"
#include "lldb/Core/Error.h"
#include "lldb/Core/Stream.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/Core/ValueObjectConstResult.h"
+#include "lldb/DataFormatters/FormattersHelpers.h"
+#include "lldb/DataFormatters/StringPrinter.h"
+#include "lldb/DataFormatters/TypeSummary.h"
#include "lldb/Host/Endian.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Target/ObjCLanguageRuntime.h"
#include "lldb/Target/Target.h"
-
+#include "lldb/Target/Process.h"
#include "lldb/Utility/ProcessStructReader.h"
using namespace lldb;
@@ -1129,6 +1130,13 @@ lldb_private::formatters::GetOSXEpoch ()
return epoch;
}
+bool
+lldb_private::formatters::RuntimeSpecificDescriptionSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options)
+{
+ stream.Printf("%s",valobj.GetObjectDescription());
+ return true;
+}
+
template bool
lldb_private::formatters::NSDataSummaryProvider<true> (ValueObject&, Stream&, const TypeSummaryOptions&) ;
diff --git a/lldb/source/DataFormatters/CoreMedia.cpp b/lldb/source/DataFormatters/CoreMedia.cpp
index 9fb7779db2d..c2fe8e82128 100644
--- a/lldb/source/DataFormatters/CoreMedia.cpp
+++ b/lldb/source/DataFormatters/CoreMedia.cpp
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/DataFormatters/CXXFormatterFunctions.h"
+#include "lldb/DataFormatters/CoreMedia.h"
#include "lldb/Core/Flags.h"
#include "lldb/Symbol/ClangASTContext.h"
diff --git a/lldb/source/DataFormatters/CxxStringTypes.cpp b/lldb/source/DataFormatters/CxxStringTypes.cpp
index f7764ea4394..d709d5efa13 100644
--- a/lldb/source/DataFormatters/CxxStringTypes.cpp
+++ b/lldb/source/DataFormatters/CxxStringTypes.cpp
@@ -7,9 +7,7 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/DataFormatters/CXXFormatterFunctions.h"
-#include "lldb/DataFormatters/StringPrinter.h"
-#include "lldb/DataFormatters/TypeSummary.h"
+#include "lldb/DataFormatters/CxxStringTypes.h"
#include "llvm/Support/ConvertUTF.h"
@@ -18,12 +16,13 @@
#include "lldb/Core/Stream.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/Core/ValueObjectConstResult.h"
+#include "lldb/DataFormatters/StringPrinter.h"
+#include "lldb/DataFormatters/TypeSummary.h"
#include "lldb/Host/Endian.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Target/SectionLoadList.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/Thread.h"
-
#include "lldb/Utility/ProcessStructReader.h"
#include <algorithm>
diff --git a/lldb/source/DataFormatters/FormatManager.cpp b/lldb/source/DataFormatters/FormatManager.cpp
index 08b7f6d87c3..e0b8fb3f40c 100644
--- a/lldb/source/DataFormatters/FormatManager.cpp
+++ b/lldb/source/DataFormatters/FormatManager.cpp
@@ -15,7 +15,14 @@
// Project includes
#include "lldb/Core/Debugger.h"
-#include "lldb/DataFormatters/CXXFormatterFunctions.h"
+#include "lldb/DataFormatters/CF.h"
+#include "lldb/DataFormatters/Cocoa.h"
+#include "lldb/DataFormatters/CoreMedia.h"
+#include "lldb/DataFormatters/CXXFunctionPointer.h"
+#include "lldb/DataFormatters/CxxStringTypes.h"
+#include "lldb/DataFormatters/LibCxx.h"
+#include "lldb/DataFormatters/LibStdcpp.h"
+#include "lldb/DataFormatters/VectorType.h"
#include "lldb/DataFormatters/FormattersHelpers.h"
#include "lldb/DataFormatters/LanguageCategory.h"
#include "lldb/Target/ExecutionContext.h"
@@ -1635,7 +1642,7 @@ FormatManager::LoadHardcodedFormatters()
[](lldb_private::ValueObject& valobj,
lldb::DynamicValueType,
FormatManager&) -> TypeSummaryImpl::SharedPointer {
- static CXXFunctionSummaryFormat::SharedPointer formatter_sp(new CXXFunctionSummaryFormat(TypeSummaryImpl::Flags(), lldb_private::formatters::FunctionPointerSummaryProvider, "Function pointer summary provider"));
+ static CXXFunctionSummaryFormat::SharedPointer formatter_sp(new CXXFunctionSummaryFormat(TypeSummaryImpl::Flags(), lldb_private::formatters::CXXFunctionPointerSummaryProvider, "Function pointer summary provider"));
if (valobj.GetCompilerType().IsFunctionPointerType())
{
return formatter_sp;
diff --git a/lldb/source/DataFormatters/FormattersHelpers.cpp b/lldb/source/DataFormatters/FormattersHelpers.cpp
index cbded9da963..ba5f6c04f78 100644
--- a/lldb/source/DataFormatters/FormattersHelpers.cpp
+++ b/lldb/source/DataFormatters/FormattersHelpers.cpp
@@ -18,6 +18,8 @@
#include "lldb/Core/ConstString.h"
#include "lldb/Core/RegularExpression.h"
+#include "lldb/Target/StackFrame.h"
+#include "lldb/Target/Thread.h"
using namespace lldb;
using namespace lldb_private;
@@ -118,3 +120,178 @@ lldb_private::formatters::AddFilter (TypeCategoryImpl::SharedPointer category_s
category_sp->GetTypeFiltersContainer()->Add(type_name,filter_sp);
}
#endif
+
+StackFrame*
+lldb_private::formatters::GetViableFrame (ExecutionContext exe_ctx)
+{
+ StackFrame* frame = exe_ctx.GetFramePtr();
+ if (frame)
+ return frame;
+
+ Process* process = exe_ctx.GetProcessPtr();
+ if (!process)
+ return nullptr;
+
+ ThreadSP thread_sp(process->GetThreadList().GetSelectedThread());
+ if (thread_sp)
+ return thread_sp->GetSelectedFrame().get();
+ return nullptr;
+}
+
+bool
+lldb_private::formatters::ExtractValueFromObjCExpression (ValueObject &valobj,
+ const char* target_type,
+ const char* selector,
+ uint64_t &value)
+{
+ if (!target_type || !*target_type)
+ return false;
+ if (!selector || !*selector)
+ return false;
+ StreamString expr;
+ expr.Printf("(%s)[(id)0x%" PRIx64 " %s]",target_type,valobj.GetPointerValue(),selector);
+ ExecutionContext exe_ctx (valobj.GetExecutionContextRef());
+ lldb::ValueObjectSP result_sp;
+ Target* target = exe_ctx.GetTargetPtr();
+ StackFrame* stack_frame = GetViableFrame(exe_ctx);
+ if (!target || !stack_frame)
+ return false;
+
+ EvaluateExpressionOptions options;
+ options.SetCoerceToId(false);
+ options.SetUnwindOnError(true);
+ options.SetKeepInMemory(true);
+
+ target->EvaluateExpression(expr.GetData(),
+ stack_frame,
+ result_sp,
+ options);
+ if (!result_sp)
+ return false;
+ value = result_sp->GetValueAsUnsigned(0);
+ return true;
+}
+
+bool
+lldb_private::formatters::ExtractSummaryFromObjCExpression (ValueObject &valobj,
+ const char* target_type,
+ const char* selector,
+ Stream &stream)
+{
+ if (!target_type || !*target_type)
+ return false;
+ if (!selector || !*selector)
+ return false;
+ StreamString expr;
+ expr.Printf("(%s)[(id)0x%" PRIx64 " %s]",target_type,valobj.GetPointerValue(),selector);
+ ExecutionContext exe_ctx (valobj.GetExecutionContextRef());
+ lldb::ValueObjectSP result_sp;
+ Target* target = exe_ctx.GetTargetPtr();
+ StackFrame* stack_frame = GetViableFrame(exe_ctx);
+ if (!target || !stack_frame)
+ return false;
+
+ EvaluateExpressionOptions options;
+ options.SetCoerceToId(false);
+ options.SetUnwindOnError(true);
+ options.SetKeepInMemory(true);
+ options.SetUseDynamic(lldb::eDynamicCanRunTarget);
+
+ target->EvaluateExpression(expr.GetData(),
+ stack_frame,
+ result_sp,
+ options);
+ if (!result_sp)
+ return false;
+ stream.Printf("%s",result_sp->GetSummaryAsCString());
+ return true;
+}
+
+lldb::ValueObjectSP
+lldb_private::formatters::CallSelectorOnObject (ValueObject &valobj,
+ const char* return_type,
+ const char* selector,
+ uint64_t index)
+{
+ lldb::ValueObjectSP valobj_sp;
+ if (!return_type || !*return_type)
+ return valobj_sp;
+ if (!selector || !*selector)
+ return valobj_sp;
+ StreamString expr_path_stream;
+ valobj.GetExpressionPath(expr_path_stream, false);
+ StreamString expr;
+ expr.Printf("(%s)[%s %s:%" PRId64 "]",return_type,expr_path_stream.GetData(),selector,index);
+ ExecutionContext exe_ctx (valobj.GetExecutionContextRef());
+ lldb::ValueObjectSP result_sp;
+ Target* target = exe_ctx.GetTargetPtr();
+ StackFrame* stack_frame = GetViableFrame(exe_ctx);
+ if (!target || !stack_frame)
+ return valobj_sp;
+
+ EvaluateExpressionOptions options;
+ options.SetCoerceToId(false);
+ options.SetUnwindOnError(true);
+ options.SetKeepInMemory(true);
+ options.SetUseDynamic(lldb::eDynamicCanRunTarget);
+
+ target->EvaluateExpression(expr.GetData(),
+ stack_frame,
+ valobj_sp,
+ options);
+ return valobj_sp;
+}
+
+lldb::ValueObjectSP
+lldb_private::formatters::CallSelectorOnObject (ValueObject &valobj,
+ const char* return_type,
+ const char* selector,
+ const char* key)
+{
+ lldb::ValueObjectSP valobj_sp;
+ if (!return_type || !*return_type)
+ return valobj_sp;
+ if (!selector || !*selector)
+ return valobj_sp;
+ if (!key || !*key)
+ return valobj_sp;
+ StreamString expr_path_stream;
+ valobj.GetExpressionPath(expr_path_stream, false);
+ StreamString expr;
+ expr.Printf("(%s)[%s %s:%s]",return_type,expr_path_stream.GetData(),selector,key);
+ ExecutionContext exe_ctx (valobj.GetExecutionContextRef());
+ lldb::ValueObjectSP result_sp;
+ Target* target = exe_ctx.GetTargetPtr();
+ StackFrame* stack_frame = GetViableFrame(exe_ctx);
+ if (!target || !stack_frame)
+ return valobj_sp;
+
+ EvaluateExpressionOptions options;
+ options.SetCoerceToId(false);
+ options.SetUnwindOnError(true);
+ options.SetKeepInMemory(true);
+ options.SetUseDynamic(lldb::eDynamicCanRunTarget);
+
+ target->EvaluateExpression(expr.GetData(),
+ stack_frame,
+ valobj_sp,
+ options);
+ return valobj_sp;
+}
+
+size_t
+lldb_private::formatters::ExtractIndexFromString (const char* item_name)
+{
+ if (!item_name || !*item_name)
+ return UINT32_MAX;
+ if (*item_name != '[')
+ return UINT32_MAX;
+ item_name++;
+ char* endptr = NULL;
+ unsigned long int idx = ::strtoul(item_name, &endptr, 0);
+ if (idx == 0 && endptr == item_name)
+ return UINT32_MAX;
+ if (idx == ULONG_MAX)
+ return UINT32_MAX;
+ return idx;
+}
diff --git a/lldb/source/DataFormatters/LibCxx.cpp b/lldb/source/DataFormatters/LibCxx.cpp
index 329f8286a97..298d124280f 100644
--- a/lldb/source/DataFormatters/LibCxx.cpp
+++ b/lldb/source/DataFormatters/LibCxx.cpp
@@ -7,9 +7,7 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/DataFormatters/CXXFormatterFunctions.h"
-#include "lldb/DataFormatters/StringPrinter.h"
-#include "lldb/DataFormatters/TypeSummary.h"
+#include "lldb/DataFormatters/LibCxx.h"
#include "lldb/Core/DataBufferHeap.h"
#include "lldb/Core/Debugger.h"
@@ -18,6 +16,10 @@
#include "lldb/Core/Stream.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/Core/ValueObjectConstResult.h"
+#include "lldb/DataFormatters/FormattersHelpers.h"
+#include "lldb/DataFormatters/StringPrinter.h"
+#include "lldb/DataFormatters/TypeSummary.h"
+#include "lldb/DataFormatters/VectorIterator.h"
#include "lldb/Host/Endian.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Target/Target.h"
diff --git a/lldb/source/DataFormatters/LibCxxInitializerList.cpp b/lldb/source/DataFormatters/LibCxxInitializerList.cpp
index 652771e2466..87f8a3d0bdd 100644
--- a/lldb/source/DataFormatters/LibCxxInitializerList.cpp
+++ b/lldb/source/DataFormatters/LibCxxInitializerList.cpp
@@ -7,10 +7,11 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/DataFormatters/CXXFormatterFunctions.h"
+#include "lldb/DataFormatters/LibCxx.h"
#include "lldb/Core/ConstString.h"
#include "lldb/Core/ValueObject.h"
+#include "lldb/DataFormatters/FormattersHelpers.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/lldb/source/DataFormatters/LibCxxList.cpp b/lldb/source/DataFormatters/LibCxxList.cpp
index 9cf05e13060..9a8b70d1ebc 100644
--- a/lldb/source/DataFormatters/LibCxxList.cpp
+++ b/lldb/source/DataFormatters/LibCxxList.cpp
@@ -7,13 +7,14 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/DataFormatters/CXXFormatterFunctions.h"
+#include "lldb/DataFormatters/LibCxx.h"
#include "lldb/Core/DataBufferHeap.h"
#include "lldb/Core/Error.h"
#include "lldb/Core/Stream.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/Core/ValueObjectConstResult.h"
+#include "lldb/DataFormatters/FormattersHelpers.h"
#include "lldb/Host/Endian.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Target/Target.h"
diff --git a/lldb/source/DataFormatters/LibCxxMap.cpp b/lldb/source/DataFormatters/LibCxxMap.cpp
index 51a4a4f8104..a59a6f59e6f 100644
--- a/lldb/source/DataFormatters/LibCxxMap.cpp
+++ b/lldb/source/DataFormatters/LibCxxMap.cpp
@@ -7,13 +7,14 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/DataFormatters/CXXFormatterFunctions.h"
+#include "lldb/DataFormatters/LibCxx.h"
#include "lldb/Core/DataBufferHeap.h"
#include "lldb/Core/Error.h"
#include "lldb/Core/Stream.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/Core/ValueObjectConstResult.h"
+#include "lldb/DataFormatters/FormattersHelpers.h"
#include "lldb/Host/Endian.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Target/Target.h"
diff --git a/lldb/source/DataFormatters/LibCxxUnorderedMap.cpp b/lldb/source/DataFormatters/LibCxxUnorderedMap.cpp
index 4c35fedc0cc..1d8a9af153b 100644
--- a/lldb/source/DataFormatters/LibCxxUnorderedMap.cpp
+++ b/lldb/source/DataFormatters/LibCxxUnorderedMap.cpp
@@ -7,13 +7,14 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/DataFormatters/CXXFormatterFunctions.h"
+#include "lldb/DataFormatters/LibCxx.h"
#include "lldb/Core/DataBufferHeap.h"
#include "lldb/Core/Error.h"
#include "lldb/Core/Stream.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/Core/ValueObjectConstResult.h"
+#include "lldb/DataFormatters/FormattersHelpers.h"
#include "lldb/Host/Endian.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Target/Target.h"
diff --git a/lldb/source/DataFormatters/LibCxxVector.cpp b/lldb/source/DataFormatters/LibCxxVector.cpp
index 735cbf5d1e9..1e14fff6008 100644
--- a/lldb/source/DataFormatters/LibCxxVector.cpp
+++ b/lldb/source/DataFormatters/LibCxxVector.cpp
@@ -7,10 +7,11 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/DataFormatters/CXXFormatterFunctions.h"
+#include "lldb/DataFormatters/LibCxx.h"
#include "lldb/Core/ConstString.h"
#include "lldb/Core/ValueObject.h"
+#include "lldb/DataFormatters/FormattersHelpers.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/lldb/source/DataFormatters/LibStdcpp.cpp b/lldb/source/DataFormatters/LibStdcpp.cpp
index 33447af5328..73f9594e7fb 100644
--- a/lldb/source/DataFormatters/LibStdcpp.cpp
+++ b/lldb/source/DataFormatters/LibStdcpp.cpp
@@ -7,13 +7,14 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/DataFormatters/CXXFormatterFunctions.h"
+#include "lldb/DataFormatters/LibStdcpp.h"
#include "lldb/Core/DataBufferHeap.h"
#include "lldb/Core/Error.h"
#include "lldb/Core/Stream.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/Core/ValueObjectConstResult.h"
+#include "lldb/DataFormatters/VectorIterator.h"
#include "lldb/Host/Endian.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Target/Target.h"
@@ -22,6 +23,36 @@ using namespace lldb;
using namespace lldb_private;
using namespace lldb_private::formatters;
+class LibstdcppMapIteratorSyntheticFrontEnd : public SyntheticChildrenFrontEnd
+{
+public:
+ LibstdcppMapIteratorSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp);
+
+ size_t
+ CalculateNumChildren() override;
+
+ lldb::ValueObjectSP
+ GetChildAtIndex(size_t idx) override;
+
+ bool
+ Update() override;
+
+ bool
+ MightHaveChildren() override;
+
+ size_t
+ GetIndexOfChildWithName (const ConstString &name) override;
+
+ ~LibstdcppMapIteratorSyntheticFrontEnd() override;
+
+private:
+ ExecutionContextRef m_exe_ctx_ref;
+ lldb::addr_t m_pair_address;
+ CompilerType m_pair_type;
+ EvaluateExpressionOptions m_options;
+ lldb::ValueObjectSP m_pair_sp;
+};
+
/*
(std::_Rb_tree_iterator<std::pair<const int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >) ibeg = {
(_Base_ptr) _M_node = 0x0000000100103910 {
@@ -33,7 +64,7 @@ using namespace lldb_private::formatters;
}
*/
-lldb_private::formatters::LibstdcppMapIteratorSyntheticFrontEnd::LibstdcppMapIteratorSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp) :
+LibstdcppMapIteratorSyntheticFrontEnd::LibstdcppMapIteratorSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp) :
SyntheticChildrenFrontEnd(*valobj_sp.get()),
m_exe_ctx_ref(),
m_pair_address(0),
@@ -50,7 +81,7 @@ lldb_private::formatters::LibstdcppMapIteratorSyntheticFrontEnd::LibstdcppMapIte
}
bool
-lldb_private::formatters::LibstdcppMapIteratorSyntheticFrontEnd::Update()
+LibstdcppMapIteratorSyntheticFrontEnd::Update()
{
ValueObjectSP valobj_sp = m_backend.GetSP();
if (!valobj_sp)
@@ -93,13 +124,13 @@ lldb_private::formatters::LibstdcppMapIteratorSyntheticFrontEnd::Update()
}
size_t
-lldb_private::formatters::LibstdcppMapIteratorSyntheticFrontEnd::CalculateNumChildren ()
+LibstdcppMapIteratorSyntheticFrontEnd::CalculateNumChildren ()
{
return 2;
}
lldb::ValueObjectSP
-lldb_private::formatters::LibstdcppMapIteratorSyntheticFrontEnd::GetChildAtIndex (size_t idx)
+LibstdcppMapIteratorSyntheticFrontEnd::GetChildAtIndex (size_t idx)
{
if (m_pair_address != 0 && m_pair_type)
{
@@ -112,13 +143,13 @@ lldb_private::formatters::LibstdcppMapIteratorSyntheticFrontEnd::GetChildAtIndex
}
bool
-lldb_private::formatters::LibstdcppMapIteratorSyntheticFrontEnd::MightHaveChildren ()
+LibstdcppMapIteratorSyntheticFrontEnd::MightHaveChildren ()
{
return true;
}
size_t
-lldb_private::formatters::LibstdcppMapIteratorSyntheticFrontEnd::GetIndexOfChildWithName (const ConstString &name)
+LibstdcppMapIteratorSyntheticFrontEnd::GetIndexOfChildWithName (const ConstString &name)
{
if (name == ConstString("first"))
return 0;
@@ -127,7 +158,7 @@ lldb_private::formatters::LibstdcppMapIteratorSyntheticFrontEnd::GetIndexOfChild
return UINT32_MAX;
}
-lldb_private::formatters::LibstdcppMapIteratorSyntheticFrontEnd::~LibstdcppMapIteratorSyntheticFrontEnd ()
+LibstdcppMapIteratorSyntheticFrontEnd::~LibstdcppMapIteratorSyntheticFrontEnd ()
{}
SyntheticChildrenFrontEnd*
diff --git a/lldb/source/DataFormatters/NSArray.cpp b/lldb/source/DataFormatters/NSArray.cpp
index aed1e2ca60f..0bf340b1338 100644
--- a/lldb/source/DataFormatters/NSArray.cpp
+++ b/lldb/source/DataFormatters/NSArray.cpp
@@ -7,13 +7,14 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/DataFormatters/CXXFormatterFunctions.h"
+#include "lldb/DataFormatters/Cocoa.h"
#include "lldb/Core/DataBufferHeap.h"
#include "lldb/Core/Error.h"
#include "lldb/Core/Stream.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/Core/ValueObjectConstResult.h"
+#include "lldb/DataFormatters/FormattersHelpers.h"
#include "lldb/Host/Endian.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Target/ObjCLanguageRuntime.h"
diff --git a/lldb/source/DataFormatters/NSDictionary.cpp b/lldb/source/DataFormatters/NSDictionary.cpp
index 15f05ab49c3..0de0cbdc96a 100644
--- a/lldb/source/DataFormatters/NSDictionary.cpp
+++ b/lldb/source/DataFormatters/NSDictionary.cpp
@@ -7,13 +7,14 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/DataFormatters/CXXFormatterFunctions.h"
+#include "lldb/DataFormatters/Cocoa.h"
#include "lldb/Core/DataBufferHeap.h"
#include "lldb/Core/Error.h"
#include "lldb/Core/Stream.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/Core/ValueObjectConstResult.h"
+#include "lldb/DataFormatters/FormattersHelpers.h"
#include "lldb/Host/Endian.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Target/ObjCLanguageRuntime.h"
diff --git a/lldb/source/DataFormatters/NSIndexPath.cpp b/lldb/source/DataFormatters/NSIndexPath.cpp
index 0908487310e..a09cbcc3476 100644
--- a/lldb/source/DataFormatters/NSIndexPath.cpp
+++ b/lldb/source/DataFormatters/NSIndexPath.cpp
@@ -7,10 +7,11 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/DataFormatters/CXXFormatterFunctions.h"
+#include "lldb/DataFormatters/Cocoa.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/Core/ValueObjectConstResult.h"
+#include "lldb/DataFormatters/FormattersHelpers.h"
#include "lldb/DataFormatters/TypeSynthetic.h"
#include "lldb/Target/ObjCLanguageRuntime.h"
#include "lldb/Target/Process.h"
diff --git a/lldb/source/DataFormatters/NSSet.cpp b/lldb/source/DataFormatters/NSSet.cpp
index 77e33490ced..ea33a6a3c03 100644
--- a/lldb/source/DataFormatters/NSSet.cpp
+++ b/lldb/source/DataFormatters/NSSet.cpp
@@ -7,13 +7,14 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/DataFormatters/CXXFormatterFunctions.h"
+#include "lldb/DataFormatters/Cocoa.h"
#include "lldb/Core/DataBufferHeap.h"
#include "lldb/Core/Error.h"
#include "lldb/Core/Stream.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/Core/ValueObjectConstResult.h"
+#include "lldb/DataFormatters/FormattersHelpers.h"
#include "lldb/Host/Endian.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Target/ObjCLanguageRuntime.h"
diff --git a/lldb/source/DataFormatters/VectorType.cpp b/lldb/source/DataFormatters/VectorType.cpp
index 02e2b95232d..183893ac264 100644
--- a/lldb/source/DataFormatters/VectorType.cpp
+++ b/lldb/source/DataFormatters/VectorType.cpp
@@ -10,7 +10,7 @@
#include "lldb/DataFormatters/VectorType.h"
#include "lldb/Core/ValueObject.h"
-#include "lldb/DataFormatters/CXXFormatterFunctions.h"
+#include "lldb/DataFormatters/FormattersHelpers.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/CompilerType.h"
OpenPOWER on IntegriCloud