diff options
| author | Walter Erquinigo <wallace@fb.com> | 2021-06-01 15:34:06 -0700 |
|---|---|---|
| committer | Walter Erquinigo <wallace@fb.com> | 2021-06-17 15:14:47 -0700 |
| commit | bf9f21a28be171dc500cc68b4cb1fcd3fc33f229 (patch) | |
| tree | 15fe415b67514d3e546353eea9ed6b208bcf65ae /lldb/source/API/SBStructuredData.cpp | |
| parent | c1360fd5fced42ea45ce1eacbf1c5e1ed54fcac5 (diff) | |
[trace][intel-pt] Create basic SB API
This adds a basic SB API for creating and stopping traces.
Note: This doesn't add any APIs for inspecting individual instructions. That'd be a more complicated change and it might be better to enhande the dump functionality to output the data in binary format. I'll leave that for a later diff.
This also enhances the existing tests so that they test the same flow using both the command interface and the SB API.
I also did some cleanup of legacy code.
Differential Revision: https://reviews.llvm.org/D103500
Diffstat (limited to 'lldb/source/API/SBStructuredData.cpp')
| -rw-r--r-- | lldb/source/API/SBStructuredData.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lldb/source/API/SBStructuredData.cpp b/lldb/source/API/SBStructuredData.cpp index 9a37749a64d0..97a9eadcaf07 100644 --- a/lldb/source/API/SBStructuredData.cpp +++ b/lldb/source/API/SBStructuredData.cpp @@ -72,10 +72,19 @@ lldb::SBError SBStructuredData::SetFromJSON(lldb::SBStream &stream) { return LLDB_RECORD_RESULT(error); } +lldb::SBError SBStructuredData::SetFromJSON(const char *json) { + LLDB_RECORD_METHOD(lldb::SBError, SBStructuredData, SetFromJSON, + (const char *), json); + lldb::SBStream s; + s.Print(json); + return LLDB_RECORD_RESULT(SetFromJSON(s)); +} + bool SBStructuredData::IsValid() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBStructuredData, IsValid); return this->operator bool(); } + SBStructuredData::operator bool() const { LLDB_RECORD_METHOD_CONST_NO_ARGS(bool, SBStructuredData, operator bool); @@ -207,6 +216,8 @@ template <> void RegisterMethods<SBStructuredData>(Registry &R) { SBStructuredData, operator=,(const lldb::SBStructuredData &)); LLDB_REGISTER_METHOD(lldb::SBError, SBStructuredData, SetFromJSON, (lldb::SBStream &)); + LLDB_REGISTER_METHOD(lldb::SBError, SBStructuredData, SetFromJSON, + (const char *)); LLDB_REGISTER_METHOD_CONST(bool, SBStructuredData, IsValid, ()); LLDB_REGISTER_METHOD_CONST(bool, SBStructuredData, operator bool, ()); LLDB_REGISTER_METHOD(void, SBStructuredData, Clear, ()); |
