summaryrefslogtreecommitdiffstats
path: root/lldb
diff options
context:
space:
mode:
authorEnrico Granata <egranata@apple.com>2014-09-06 01:30:04 +0000
committerEnrico Granata <egranata@apple.com>2014-09-06 01:30:04 +0000
commitedc44140947e4e3721e2a44e527b8b538451271d (patch)
tree394993f8fa69d4253ab7df24d586f9a139a63939 /lldb
parent728894340f2a95eef5330b60410fb2abb158137b (diff)
downloadbcm5719-llvm-edc44140947e4e3721e2a44e527b8b538451271d.tar.gz
bcm5719-llvm-edc44140947e4e3721e2a44e527b8b538451271d.zip
Expose the ability to retrieve the result of a type validator via the SB API. To keep it simple, do not expose the pair, but just return a NULL string for success, and a non-NULL string for error; If we were to decide to expose the pair, we would need an SBTypeValidatorResult, which is fine, but it should come as part of exposing type validators through the SB API rather than as a one-off thing. So, KISS for now
llvm-svn: 217299
Diffstat (limited to 'lldb')
-rw-r--r--lldb/include/lldb/API/SBValue.h3
-rw-r--r--lldb/scripts/Python/interface/SBValue.i3
-rw-r--r--lldb/source/API/SBValue.cpp30
3 files changed, 36 insertions, 0 deletions
diff --git a/lldb/include/lldb/API/SBValue.h b/lldb/include/lldb/API/SBValue.h
index 93b869ba9c5..2d415c1808f 100644
--- a/lldb/include/lldb/API/SBValue.h
+++ b/lldb/include/lldb/API/SBValue.h
@@ -93,6 +93,9 @@ public:
const char *
GetObjectDescription ();
+ const char *
+ GetTypeValidatorResult ();
+
lldb::SBValue
GetDynamicValue (lldb::DynamicValueType use_dynamic);
diff --git a/lldb/scripts/Python/interface/SBValue.i b/lldb/scripts/Python/interface/SBValue.i
index 281782b5a1a..15b39fd8630 100644
--- a/lldb/scripts/Python/interface/SBValue.i
+++ b/lldb/scripts/Python/interface/SBValue.i
@@ -123,6 +123,9 @@ public:
const char *
GetObjectDescription ();
+
+ const char *
+ GetTypeValidatorResult ();
lldb::SBValue
GetDynamicValue (lldb::DynamicValueType use_dynamic);
diff --git a/lldb/source/API/SBValue.cpp b/lldb/source/API/SBValue.cpp
index 3a9621b1e3b..d22f611516c 100644
--- a/lldb/source/API/SBValue.cpp
+++ b/lldb/source/API/SBValue.cpp
@@ -543,6 +543,36 @@ SBValue::GetObjectDescription ()
return cstr;
}
+const char *
+SBValue::GetTypeValidatorResult ()
+{
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ const char *cstr = NULL;
+ ValueLocker locker;
+ lldb::ValueObjectSP value_sp(GetSP(locker));
+ if (value_sp)
+ {
+ const auto& validation(value_sp->GetValidationStatus());
+ if (TypeValidatorResult::Failure == validation.first)
+ {
+ if (validation.second.empty())
+ cstr = "unknown error";
+ else
+ cstr = validation.second.c_str();
+ }
+ }
+ if (log)
+ {
+ if (cstr)
+ log->Printf ("SBValue(%p)::GetTypeValidatorResult() => \"%s\"",
+ static_cast<void*>(value_sp.get()), cstr);
+ else
+ log->Printf ("SBValue(%p)::GetTypeValidatorResult() => NULL",
+ static_cast<void*>(value_sp.get()));
+ }
+ return cstr;
+}
+
SBType
SBValue::GetType()
{
OpenPOWER on IntegriCloud