summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/tools/lldb/source/API/SBValue.cpp
diff options
context:
space:
mode:
authoremaste <emaste@FreeBSD.org>2014-07-23 19:35:02 +0000
committeremaste <emaste@FreeBSD.org>2014-07-23 19:35:02 +0000
commitaa794b38fedea0f2e99519975acab0b289714b41 (patch)
treed542e0aa192601387eab969343acfada413521e6 /contrib/llvm/tools/lldb/source/API/SBValue.cpp
parent35d9abcb8d9ec0494bd89b56ca40aa22b6206e54 (diff)
downloadFreeBSD-src-aa794b38fedea0f2e99519975acab0b289714b41.zip
FreeBSD-src-aa794b38fedea0f2e99519975acab0b289714b41.tar.gz
MFC r262528: Update LLDB snapshot to upstream r202189
Highlights include (upstream revs in parens): - Improvements to the remote GDB protocol client (r196610, r197579, r197857, r200072, and others) - Bug fixes for big-endian targets (r196808) - Initial support for libdispatch (GCD) queues in the debuggee (r197190) - Add "step-avoid-libraries" setting (r199943) - IO subsystem improvements (including initial work on a curses gui) (r200263) - Support hardware watchpoints on FreeBSD (r201706) - Improved unwinding through hand-written assembly functions (r201839) - Handle DW_TAG_unspecified_parameters for variadic functions (r202061) - Fix Ctrl+C interrupting a running inferior process (r202086, r202154) - Various bug fixes for memory leaks, LLDB segfaults, the C++ demangler, ELF core files, DWARF debug info, and others. Sponsored by: DARPA, AFRL
Diffstat (limited to 'contrib/llvm/tools/lldb/source/API/SBValue.cpp')
-rw-r--r--contrib/llvm/tools/lldb/source/API/SBValue.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/contrib/llvm/tools/lldb/source/API/SBValue.cpp b/contrib/llvm/tools/lldb/source/API/SBValue.cpp
index 51b6790..4bd0183 100644
--- a/contrib/llvm/tools/lldb/source/API/SBValue.cpp
+++ b/contrib/llvm/tools/lldb/source/API/SBValue.cpp
@@ -96,7 +96,24 @@ public:
bool
IsValid ()
{
- return m_valobj_sp.get() != NULL;
+ if (m_valobj_sp.get() == NULL)
+ return false;
+ else
+ {
+ // FIXME: This check is necessary but not sufficient. We for sure don't want to touch SBValues whose owning
+ // targets have gone away. This check is a little weak in that it enforces that restriction when you call
+ // IsValid, but since IsValid doesn't lock the target, you have no guarantee that the SBValue won't go
+ // invalid after you call this...
+ // Also, an SBValue could depend on data from one of the modules in the target, and those could go away
+ // independently of the target, for instance if a module is unloaded. But right now, neither SBValues
+ // nor ValueObjects know which modules they depend on. So I have no good way to make that check without
+ // tracking that in all the ValueObject subclasses.
+ TargetSP target_sp = m_valobj_sp->GetTargetSP();
+ if (target_sp && target_sp->IsValid())
+ return true;
+ else
+ return false;
+ }
}
lldb::ValueObjectSP
@@ -120,6 +137,8 @@ public:
Target *target = value_sp->GetTargetSP().get();
if (target)
api_locker.Lock(target->GetAPIMutex());
+ else
+ return ValueObjectSP();
ProcessSP process_sp(value_sp->GetProcessSP());
if (process_sp && !stop_locker.TryLock (&process_sp->GetRunLock()))
@@ -276,7 +295,7 @@ SBValue::IsValid ()
// If this function ever changes to anything that does more than just
// check if the opaque shared pointer is non NULL, then we need to update
// all "if (m_opaque_sp)" code in this file.
- return m_opaque_sp.get() != NULL && m_opaque_sp->GetRootSP().get() != NULL;
+ return m_opaque_sp.get() != NULL && m_opaque_sp->IsValid() && m_opaque_sp->GetRootSP().get() != NULL;
}
void
OpenPOWER on IntegriCloud