diff options
author | Chris Lattner <sabre@nondot.org> | 2010-06-08 16:52:24 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-06-08 16:52:24 +0000 |
commit | 30fdc8d841c9d24ac5f3d452b6ece84ee0ac991c (patch) | |
tree | f70013106f6a461a14abcd71c65f48a95a2979a6 /lldb/source/Target/ExecutionContext.cpp | |
parent | 312c4c799da215b337f790fda330f70c4aa757cf (diff) | |
download | bcm5719-llvm-30fdc8d841c9d24ac5f3d452b6ece84ee0ac991c.tar.gz bcm5719-llvm-30fdc8d841c9d24ac5f3d452b6ece84ee0ac991c.zip |
Initial checkin of lldb code from internal Apple repo.
llvm-svn: 105619
Diffstat (limited to 'lldb/source/Target/ExecutionContext.cpp')
-rw-r--r-- | lldb/source/Target/ExecutionContext.cpp | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/lldb/source/Target/ExecutionContext.cpp b/lldb/source/Target/ExecutionContext.cpp new file mode 100644 index 00000000000..e79f8c243ef --- /dev/null +++ b/lldb/source/Target/ExecutionContext.cpp @@ -0,0 +1,107 @@ +//===-- ExecutionContext.cpp ------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// + +// +//===----------------------------------------------------------------------===// + + +#include "lldb/Target/ExecutionContext.h" +#include "lldb/Target/ExecutionContextScope.h" +#include "lldb/Target/StackFrame.h" +#include "lldb/Target/Process.h" +#include "lldb/Target/Target.h" +#include "lldb/Target/Thread.h" + +using namespace lldb_private; + +ExecutionContext::ExecutionContext() : + target (NULL), + process (NULL), + thread (NULL), + frame (NULL) +{ +} + +ExecutionContext::ExecutionContext (Target* t, bool fill_current_process_thread_frame) : + target (t), + process (NULL), + thread (NULL), + frame (NULL) +{ + if (t && fill_current_process_thread_frame) + { + process = t->GetProcessSP().get(); + if (process) + { + thread = process->GetThreadList().GetCurrentThread().get(); + if (thread) + frame = thread->GetCurrentFrame().get(); + } + } +} + +ExecutionContext::ExecutionContext(Process* p, Thread *t, StackFrame *f) : + target (p ? &p->GetTarget() : NULL), + process (p), + thread (t), + frame (f) +{ +} + +ExecutionContext::ExecutionContext (ExecutionContextScope *exe_scope_ptr) +{ + if (exe_scope_ptr) + exe_scope_ptr->Calculate (*this); + else + { + target = NULL; + process = NULL; + thread = NULL; + frame = NULL; + } +} + +ExecutionContext::ExecutionContext (ExecutionContextScope &exe_scope_ref) +{ + exe_scope_ref.Calculate (*this); +} + +void +ExecutionContext::Clear() +{ + target = NULL; + process = NULL; + thread = NULL; + frame = NULL; +} + + +RegisterContext * +ExecutionContext::GetRegisterContext () const +{ + if (frame) + return frame->GetRegisterContext(); + else if (thread) + return thread->GetRegisterContext(); + return NULL; +} + +ExecutionContextScope * +ExecutionContext::GetBestExecutionContextScope () const +{ + if (frame) + return frame; + if (thread) + return thread; + if (process) + return process; + return target; +} |