diff options
author | Jakob Johnson <johnsonjakob99@gmail.com> | 2022-08-01 07:34:47 -0700 |
---|---|---|
committer | Jakob Johnson <johnsonjakob99@gmail.com> | 2022-08-01 13:53:53 -0700 |
commit | 3bec33b16db11c67d43bda134520a2132ff606c9 (patch) | |
tree | c18d06b703167c8098baf948a18e738a27be4d1d /lldb/source/Commands/CommandObjectThread.cpp | |
parent | e07a8155f5168fdaff9346152d7805a47cb49405 (diff) | |
download | llvm-3bec33b16db11c67d43bda134520a2132ff606c9.zip llvm-3bec33b16db11c67d43bda134520a2132ff606c9.tar.gz llvm-3bec33b16db11c67d43bda134520a2132ff606c9.tar.bz2 |
[trace] Replace TraceCursorUP with TraceCursorSP
The use of `std::unique_ptr` with `TraceCursor` adds unnecessary complexity to adding `SBTraceCursor` bindings
Specifically, since `TraceCursor` is an abstract class there's no clean
way to provide "deep clone" semantics for `TraceCursorUP` short of
creating a pure virtual `clone()` method (afaict).
After discussing with @wallace, we decided there is no strong reason to
favor wrapping `TraceCursor` with `std::unique_ptr` over `std::shared_ptr`, thus this diff
replaces all usages of `std::unique_ptr<TraceCursor>` with `std::shared_ptr<TraceCursor>`.
This sets the stage for future diffs to introduce `SBTraceCursor`
bindings in a more clean fashion.
Test Plan:
Differential Revision: https://reviews.llvm.org/D130925
Diffstat (limited to 'lldb/source/Commands/CommandObjectThread.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectThread.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lldb/source/Commands/CommandObjectThread.cpp b/lldb/source/Commands/CommandObjectThread.cpp index fe0cb09..9aa128a 100644 --- a/lldb/source/Commands/CommandObjectThread.cpp +++ b/lldb/source/Commands/CommandObjectThread.cpp @@ -2269,17 +2269,17 @@ protected: m_options.m_dumper_options.id = m_last_id; } - llvm::Expected<TraceCursorUP> cursor_or_error = + llvm::Expected<TraceCursorSP> cursor_or_error = m_exe_ctx.GetTargetSP()->GetTrace()->CreateNewCursor(*thread_sp); if (!cursor_or_error) { result.AppendError(llvm::toString(cursor_or_error.takeError())); return false; } - TraceCursorUP &cursor_up = *cursor_or_error; + TraceCursorSP &cursor_sp = *cursor_or_error; if (m_options.m_dumper_options.id && - !cursor_up->HasId(*m_options.m_dumper_options.id)) { + !cursor_sp->HasId(*m_options.m_dumper_options.id)) { result.AppendError("invalid instruction id\n"); return false; } @@ -2295,10 +2295,10 @@ protected: // We need to stop processing data when we already ran out of instructions // in a previous command. We can fake this by setting the cursor past the // end of the trace. - cursor_up->Seek(1, TraceCursor::SeekType::End); + cursor_sp->Seek(1, TraceCursor::SeekType::End); } - TraceDumper dumper(std::move(cursor_up), + TraceDumper dumper(std::move(cursor_sp), out_file ? *out_file : result.GetOutputStream(), m_options.m_dumper_options); |