diff options
author | Richard Mitton <richard@codersnotes.com> | 2013-09-12 02:20:34 +0000 |
---|---|---|
committer | Richard Mitton <richard@codersnotes.com> | 2013-09-12 02:20:34 +0000 |
commit | f86248d9ba1909392211968400ea97bd06da04c6 (patch) | |
tree | b736518b47f1be3be3c3d89530f1e753ce38e9fc /lldb/source/API/SBThread.cpp | |
parent | 50c003b5774247b12655f439be959d23ee356614 (diff) | |
download | bcm5719-llvm-f86248d9ba1909392211968400ea97bd06da04c6.tar.gz bcm5719-llvm-f86248d9ba1909392211968400ea97bd06da04c6.zip |
Added a 'jump' command, similar to GDBs.
This allows the PC to be directly changed to a different line.
It's similar to the example python script in examples/python/jump.py, except implemented as a builtin.
Also this version will track the current function correctly even if the target line resolves to multiple addresses. (e.g. debugging a templated function)
llvm-svn: 190572
Diffstat (limited to 'lldb/source/API/SBThread.cpp')
-rw-r--r-- | lldb/source/API/SBThread.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/lldb/source/API/SBThread.cpp b/lldb/source/API/SBThread.cpp index 2752620c9ba..ceaaa34b2bb 100644 --- a/lldb/source/API/SBThread.cpp +++ b/lldb/source/API/SBThread.cpp @@ -910,6 +910,31 @@ SBThread::StepOverUntil (lldb::SBFrame &sb_frame, } SBError +SBThread::JumpToLine (lldb::SBFileSpec &file_spec, uint32_t line) +{ + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); + SBError sb_error; + + Mutex::Locker api_locker; + ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker); + + if (log) + log->Printf ("SBThread(%p)::JumpToLine (file+line = %s:%u)", exe_ctx.GetThreadPtr(), file_spec->GetPath().c_str(), line); + + if (!exe_ctx.HasThreadScope()) + { + sb_error.SetErrorString("this SBThread object is invalid"); + return sb_error; + } + + Thread *thread = exe_ctx.GetThreadPtr(); + + Error err = thread->JumpToLine (file_spec.get(), line, true); + sb_error.SetError (err); + return sb_error; +} + +SBError SBThread::ReturnFromFrame (SBFrame &frame, SBValue &return_value) { SBError sb_error; |