Files
llvm/lldb/source/Target/ExecutionContext.cpp
Greg Clayton 644247c1dc Added "target variable" command that allows introspection of global
variables prior to running your binary. Zero filled sections now get
section data correctly filled with zeroes when Target::ReadMemory
reads from the object file section data.

Added new option groups and option values for file lists. I still need
to hook up all of the options to "target variable" to allow more complete
introspection by file and shlib.

Added the ability for ValueObjectVariable objects to be created with
only the target as the execution context. This allows them to be read
from the object files through Target::ReadMemory(...). 

Added a "virtual Module * GetModule()" function to the ValueObject
class. By default it will look to the parent variable object and
return its module. The module is needed when we have global variables
that have file addresses (virtual addresses that are specific to
module object files) and in turn allows global variables to be displayed
prior to running.

Removed all of the unused proxy object support that bit rotted in 
lldb_private::Value.

Replaced a lot of places that used "FileSpec::Compare (lhs, rhs) == 0" code
with the more efficient "FileSpec::Equal (lhs, rhs)".

Improved logging in GDB remote plug-in.

llvm-svn: 134579
2011-07-07 01:59:51 +00:00

112 lines
2.4 KiB
C++

//===-- 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().GetSelectedThread().get();
if (thread)
frame = thread->GetSelectedFrame().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->CalculateExecutionContext (*this);
else
{
target = NULL;
process = NULL;
thread = NULL;
frame = NULL;
}
}
ExecutionContext::ExecutionContext (ExecutionContextScope &exe_scope_ref)
{
exe_scope_ref.CalculateExecutionContext (*this);
}
void
ExecutionContext::Clear()
{
target = NULL;
process = NULL;
thread = NULL;
frame = NULL;
}
RegisterContext *
ExecutionContext::GetRegisterContext () const
{
if (frame)
return frame->GetRegisterContext().get();
else if (thread)
return thread->GetRegisterContext().get();
return NULL;
}
ExecutionContextScope *
ExecutionContext::GetBestExecutionContextScope () const
{
if (frame)
return frame;
if (thread)
return thread;
if (process)
return process;
return target;
}
Process *
ExecutionContext::GetProcess () const
{
if (process)
return process;
if (target)
return target->GetProcessSP().get();
return NULL;
}