forked from OSchip/llvm-project
Add a non-code-running data formatter for __NSCFBoolean
llvm-svn: 279446
This commit is contained in:
parent
87173f108a
commit
2094e44f9b
|
@ -30,6 +30,8 @@
|
||||||
#include "lldb/Target/Process.h"
|
#include "lldb/Target/Process.h"
|
||||||
#include "lldb/Utility/ProcessStructReader.h"
|
#include "lldb/Utility/ProcessStructReader.h"
|
||||||
|
|
||||||
|
#include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h"
|
||||||
|
|
||||||
#include "NSString.h"
|
#include "NSString.h"
|
||||||
|
|
||||||
using namespace lldb;
|
using namespace lldb;
|
||||||
|
@ -466,6 +468,9 @@ lldb_private::formatters::NSNumberSummaryProvider (ValueObject& valobj, Stream&
|
||||||
if (!class_name || !*class_name)
|
if (!class_name || !*class_name)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (!strcmp(class_name, "__NSCFBoolean"))
|
||||||
|
return ObjCBooleanSummaryProvider(valobj, stream, options);
|
||||||
|
|
||||||
if (!strcmp(class_name,"NSNumber") || !strcmp(class_name,"__NSCFNumber"))
|
if (!strcmp(class_name,"NSNumber") || !strcmp(class_name,"__NSCFNumber"))
|
||||||
{
|
{
|
||||||
uint64_t value = 0;
|
uint64_t value = 0;
|
||||||
|
@ -889,6 +894,37 @@ lldb_private::formatters::ObjCBOOLSummaryProvider (ValueObject& valobj, Stream&
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
lldb_private::formatters::ObjCBooleanSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options)
|
||||||
|
{
|
||||||
|
lldb::addr_t valobj_ptr_value = valobj.GetValueAsUnsigned(LLDB_INVALID_ADDRESS);
|
||||||
|
if (valobj_ptr_value == LLDB_INVALID_ADDRESS)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
ProcessSP process_sp(valobj.GetProcessSP());
|
||||||
|
if (!process_sp)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (AppleObjCRuntime *objc_runtime = (AppleObjCRuntime*)process_sp->GetObjCLanguageRuntime())
|
||||||
|
{
|
||||||
|
lldb::addr_t cf_true = LLDB_INVALID_ADDRESS,
|
||||||
|
cf_false = LLDB_INVALID_ADDRESS;
|
||||||
|
objc_runtime->GetValuesForGlobalCFBooleans(cf_true, cf_false);
|
||||||
|
if (valobj_ptr_value == cf_true)
|
||||||
|
{
|
||||||
|
stream.PutCString("YES");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (valobj_ptr_value == cf_false)
|
||||||
|
{
|
||||||
|
stream.PutCString("NO");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
template <bool is_sel_ptr>
|
template <bool is_sel_ptr>
|
||||||
bool
|
bool
|
||||||
lldb_private::formatters::ObjCSELSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options)
|
lldb_private::formatters::ObjCSELSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options)
|
||||||
|
|
|
@ -68,6 +68,9 @@ namespace lldb_private {
|
||||||
bool
|
bool
|
||||||
ObjCBOOLSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
|
ObjCBOOLSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
|
||||||
|
|
||||||
|
bool
|
||||||
|
ObjCBooleanSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
|
||||||
|
|
||||||
template <bool is_sel_ptr>
|
template <bool is_sel_ptr>
|
||||||
bool
|
bool
|
||||||
ObjCSELSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
|
ObjCSELSummaryProvider (ValueObject& valobj, Stream& stream, const TypeSummaryOptions& options);
|
||||||
|
|
Loading…
Reference in New Issue