summaryrefslogtreecommitdiffstats
path: root/source/Target/StackFrame.cpp
diff options
context:
space:
mode:
authoremaste <emaste@FreeBSD.org>2015-02-06 21:38:51 +0000
committeremaste <emaste@FreeBSD.org>2015-02-06 21:38:51 +0000
commit0c2019f4ca6b2dc6d710f6bb16a0e3ed10271531 (patch)
tree09bc83f73246ee3c7a779605cd0122093d2a8a19 /source/Target/StackFrame.cpp
parent01ee1789d6aa7294e5966a97f8d29387f6f81699 (diff)
downloadFreeBSD-src-0c2019f4ca6b2dc6d710f6bb16a0e3ed10271531.zip
FreeBSD-src-0c2019f4ca6b2dc6d710f6bb16a0e3ed10271531.tar.gz
Import LLDB as of upstream SVN r225923 (git 2b588ecd)
This corresponds with the branchpoint for the 3.6 release. A number of files not required for the FreeBSD build have been removed. Sponsored by: DARPA, AFRL
Diffstat (limited to 'source/Target/StackFrame.cpp')
-rw-r--r--source/Target/StackFrame.cpp55
1 files changed, 49 insertions, 6 deletions
diff --git a/source/Target/StackFrame.cpp b/source/Target/StackFrame.cpp
index e497b17..c46db4c 100644
--- a/source/Target/StackFrame.cpp
+++ b/source/Target/StackFrame.cpp
@@ -70,7 +70,8 @@ StackFrame::StackFrame (const ThreadSP &thread_sp,
m_is_history_frame (is_history_frame),
m_variable_list_sp (),
m_variable_list_value_objects (),
- m_disassembly ()
+ m_disassembly (),
+ m_mutex (Mutex::eMutexTypeRecursive)
{
// If we don't have a CFA value, use the frame index for our StackID so that recursive
// functions properly aren't confused with one another on a history stack.
@@ -109,7 +110,8 @@ StackFrame::StackFrame (const ThreadSP &thread_sp,
m_is_history_frame (false),
m_variable_list_sp (),
m_variable_list_value_objects (),
- m_disassembly ()
+ m_disassembly (),
+ m_mutex (Mutex::eMutexTypeRecursive)
{
if (sc_ptr != NULL)
{
@@ -148,7 +150,8 @@ StackFrame::StackFrame (const ThreadSP &thread_sp,
m_is_history_frame (false),
m_variable_list_sp (),
m_variable_list_value_objects (),
- m_disassembly ()
+ m_disassembly (),
+ m_mutex (Mutex::eMutexTypeRecursive)
{
if (sc_ptr != NULL)
{
@@ -189,6 +192,7 @@ StackFrame::~StackFrame()
StackID&
StackFrame::GetStackID()
{
+ Mutex::Locker locker(m_mutex);
// Make sure we have resolved the StackID object's symbol context scope if
// we already haven't looked it up.
@@ -235,6 +239,7 @@ StackFrame::GetFrameIndex () const
void
StackFrame::SetSymbolContextScope (SymbolContextScope *symbol_scope)
{
+ Mutex::Locker locker(m_mutex);
m_flags.Set (RESOLVED_FRAME_ID_SYMBOL_SCOPE);
m_id.SetSymbolContextScope (symbol_scope);
}
@@ -242,6 +247,7 @@ StackFrame::SetSymbolContextScope (SymbolContextScope *symbol_scope)
const Address&
StackFrame::GetFrameCodeAddress()
{
+ Mutex::Locker locker(m_mutex);
if (m_flags.IsClear(RESOLVED_FRAME_CODE_ADDR) && !m_frame_code_addr.IsSectionOffset())
{
m_flags.Set (RESOLVED_FRAME_CODE_ADDR);
@@ -272,6 +278,7 @@ StackFrame::GetFrameCodeAddress()
bool
StackFrame::ChangePC (addr_t pc)
{
+ Mutex::Locker locker(m_mutex);
// We can't change the pc value of a history stack frame - it is immutable.
if (m_is_history_frame)
return false;
@@ -287,6 +294,7 @@ StackFrame::ChangePC (addr_t pc)
const char *
StackFrame::Disassemble ()
{
+ Mutex::Locker locker(m_mutex);
if (m_disassembly.GetSize() == 0)
{
ExecutionContext exe_ctx (shared_from_this());
@@ -346,6 +354,7 @@ StackFrame::GetFrameBlock ()
const SymbolContext&
StackFrame::GetSymbolContext (uint32_t resolve_scope)
{
+ Mutex::Locker locker(m_mutex);
// Copy our internal symbol context into "sc".
if ((m_flags.Get() & resolve_scope) != resolve_scope)
{
@@ -375,7 +384,31 @@ StackFrame::GetSymbolContext (uint32_t resolve_scope)
{
addr_t offset = lookup_addr.GetOffset();
if (offset > 0)
+ {
lookup_addr.SetOffset(offset - 1);
+
+ }
+ else
+ {
+ // lookup_addr is the start of a section. We need
+ // do the math on the actual load address and re-compute
+ // the section. We're working with a 'noreturn' function
+ // at the end of a section.
+ ThreadSP thread_sp (GetThread());
+ if (thread_sp)
+ {
+ TargetSP target_sp (thread_sp->CalculateTarget());
+ if (target_sp)
+ {
+ addr_t addr_minus_one = lookup_addr.GetLoadAddress(target_sp.get()) - 1;
+ lookup_addr.SetLoadAddress (addr_minus_one, target_sp.get());
+ }
+ else
+ {
+ lookup_addr.SetOffset(offset - 1);
+ }
+ }
+ }
}
@@ -504,6 +537,7 @@ StackFrame::GetSymbolContext (uint32_t resolve_scope)
VariableList *
StackFrame::GetVariableList (bool get_file_globals)
{
+ Mutex::Locker locker(m_mutex);
if (m_flags.IsClear(RESOLVED_VARIABLES))
{
m_flags.Set(RESOLVED_VARIABLES);
@@ -544,6 +578,7 @@ StackFrame::GetVariableList (bool get_file_globals)
VariableListSP
StackFrame::GetInScopeVariableList (bool get_file_globals)
{
+ Mutex::Locker locker(m_mutex);
// We can't fetch variable information for a history stack frame.
if (m_is_history_frame)
return VariableListSP();
@@ -680,8 +715,8 @@ StackFrame::GetValueForVariableExpressionPath (const char *var_expr_cstr,
// Make sure we aren't trying to deref an objective
// C ivar if this is not allowed
const uint32_t pointer_type_flags = valobj_sp->GetClangType().GetTypeInfo (NULL);
- if ((pointer_type_flags & ClangASTType::eTypeIsObjC) &&
- (pointer_type_flags & ClangASTType::eTypeIsPointer))
+ if ((pointer_type_flags & eTypeIsObjC) &&
+ (pointer_type_flags & eTypeIsPointer))
{
// This was an objective C object pointer and
// it was requested we skip any fragile ivars
@@ -1142,6 +1177,7 @@ StackFrame::GetValueForVariableExpressionPath (const char *var_expr_cstr,
bool
StackFrame::GetFrameBaseValue (Scalar &frame_base, Error *error_ptr)
{
+ Mutex::Locker locker(m_mutex);
if (m_cfa_is_valid == false)
{
m_frame_base_error.SetErrorString("No frame base available for this historical stack frame.");
@@ -1191,6 +1227,7 @@ StackFrame::GetFrameBaseValue (Scalar &frame_base, Error *error_ptr)
RegisterContextSP
StackFrame::GetRegisterContext ()
{
+ Mutex::Locker locker(m_mutex);
if (!m_reg_context_sp)
{
ThreadSP thread_sp (GetThread());
@@ -1211,6 +1248,7 @@ StackFrame::HasDebugInformation ()
ValueObjectSP
StackFrame::GetValueObjectForFrameVariable (const VariableSP &variable_sp, DynamicValueType use_dynamic)
{
+ Mutex::Locker locker(m_mutex);
ValueObjectSP valobj_sp;
if (m_is_history_frame)
{
@@ -1246,6 +1284,7 @@ StackFrame::GetValueObjectForFrameVariable (const VariableSP &variable_sp, Dynam
ValueObjectSP
StackFrame::TrackGlobalVariable (const VariableSP &variable_sp, DynamicValueType use_dynamic)
{
+ Mutex::Locker locker(m_mutex);
if (m_is_history_frame)
return ValueObjectSP();
@@ -1365,17 +1404,20 @@ StackFrame::Dump (Stream *strm, bool show_frame_index, bool show_fullpaths)
GetSymbolContext(eSymbolContextEverything);
const bool show_module = true;
const bool show_inline = true;
+ const bool show_function_arguments = true;
m_sc.DumpStopContext (strm,
exe_ctx.GetBestExecutionContextScope(),
GetFrameCodeAddress(),
show_fullpaths,
show_module,
- show_inline);
+ show_inline,
+ show_function_arguments);
}
void
StackFrame::UpdateCurrentFrameFromPreviousFrame (StackFrame &prev_frame)
{
+ Mutex::Locker locker(m_mutex);
assert (GetStackID() == prev_frame.GetStackID()); // TODO: remove this after some testing
m_variable_list_sp = prev_frame.m_variable_list_sp;
m_variable_list_value_objects.Swap (prev_frame.m_variable_list_value_objects);
@@ -1387,6 +1429,7 @@ StackFrame::UpdateCurrentFrameFromPreviousFrame (StackFrame &prev_frame)
void
StackFrame::UpdatePreviousFrameFromCurrentFrame (StackFrame &curr_frame)
{
+ Mutex::Locker locker(m_mutex);
assert (GetStackID() == curr_frame.GetStackID()); // TODO: remove this after some testing
m_id.SetPC (curr_frame.m_id.GetPC()); // Update the Stack ID PC value
assert (GetThread() == curr_frame.GetThread());
OpenPOWER on IntegriCloud