diff options
author | Walter Erquinigo <wallace@fb.com> | 2021-06-23 23:03:26 -0700 |
---|---|---|
committer | Walter Erquinigo <wallace@fb.com> | 2021-06-23 23:18:53 -0700 |
commit | f0d06124769f477a26f8fa2589f0ace85419c120 (patch) | |
tree | d972ab90aa46483271f3b88b4ffb610090625c73 /lldb/source/Commands/CommandObjectThread.cpp | |
parent | 533abb7ecf1c0e80429ad7cd850e9720d2b2ae1c (diff) | |
download | llvm-f0d06124769f477a26f8fa2589f0ace85419c120.zip llvm-f0d06124769f477a26f8fa2589f0ace85419c120.tar.gz llvm-f0d06124769f477a26f8fa2589f0ace85419c120.tar.bz2 |
[NFC][trace] remove dead function
The Trace::GetCursorPosition function was never really implemented well and it's being replaced by a more correct TraceCursor object.
Diffstat (limited to 'lldb/source/Commands/CommandObjectThread.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectThread.cpp | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/lldb/source/Commands/CommandObjectThread.cpp b/lldb/source/Commands/CommandObjectThread.cpp index 1d31f11..292f9c6 100644 --- a/lldb/source/Commands/CommandObjectThread.cpp +++ b/lldb/source/Commands/CommandObjectThread.cpp @@ -2086,15 +2086,20 @@ protected: ThreadSP thread_sp = m_exe_ctx.GetProcessPtr()->GetThreadList().FindThreadByID(tid); - size_t count = m_options.m_count; - ssize_t position = m_options.m_position.getValueOr( - trace_sp->GetCursorPosition(*thread_sp)) - - m_consecutive_repetitions * count; - if (position < 0) - result.AppendError("error: no more data"); - else - trace_sp->DumpTraceInstructions(*thread_sp, result.GetOutputStream(), - count, position, m_options.m_raw); + if (llvm::Optional<size_t> insn_count = + trace_sp->GetInstructionCount(*thread_sp)) { + size_t count = m_options.m_count; + ssize_t position = + m_options.m_position.getValueOr((ssize_t)*insn_count - 1) - + m_consecutive_repetitions * count; + if (position < 0) + result.AppendError("error: no more data"); + else + trace_sp->DumpTraceInstructions(*thread_sp, result.GetOutputStream(), + count, position, m_options.m_raw); + } else { + result.AppendError("error: not traced"); + } return true; } |