llvm-project/lldb/scripts
Greg Clayton 17a6ad05c1 Removed the "lldb-forward-rtti.h" header file as it was designed to contain
all RTTI types, and since we don't use RTTI anymore since clang and llvm don't
we don't really need this header file. All shared pointer definitions have
been moved into "lldb-forward.h".

Defined std::tr1::weak_ptr definitions for all of the types that inherit from
enable_shared_from_this() in "lldb-forward.h" in preparation for thread
hardening our public API.

The first in the thread hardening check-ins. First we start with SBThread.
We have issues in our lldb::SB API right now where if you have one object
that is being used by two threads we have a race condition. Consider the
following code:

 1    int
 2    SBThread::SomeFunction()
 3    {
 4        int result = -1;
 5        if (m_opaque_sp)
 6        {
 7            result = m_opaque_sp->DoSomething();
 8        }
 9        return result;
10    }

And now this happens:

Thread 1 enters any SBThread function and checks its m_opaque_sp and is about
to execute the code on line 7 but hasn't yet
Thread 2 gets to run and class sb_thread.Clear() which calls m_opaque_sp.clear()
and clears the contents of the shared pointer member
Thread 1 now crashes when it resumes.

The solution is to use std::tr1::weak_ptr. Now the SBThread class contains a
lldb::ThreadWP (weak pointer to our lldb_private::Thread class) and this 
function would look like:

 1    int
 2    SBThread::SomeFunction()
 3    {
 4        int result = -1;
 5        ThreadSP thread_sp(m_opaque_wp.lock());
 6        if (thread_sp)
 7        {
 8            result = m_opaque_sp->DoSomething();
 9        }
10        return result;
11    }

Now we have a solid thread safe API where we get a local copy of our thread
shared pointer from our weak_ptr and then we are guaranteed it can't go away
during our function.

So lldb::SBThread has been thread hardened, more checkins to follow shortly.

llvm-svn: 149218
2012-01-30 02:53:15 +00:00
..
Python Removed an incorrectly added property from SBTarget.i 2012-01-29 07:09:30 +00:00
build-lldb-llvm-clang <rdar://problem/10507811> 2012-01-04 22:56:43 +00:00
build-llvm.pl Updated Clang to take an enhancement to the way 2011-12-16 21:06:35 +00:00
build-swig-wrapper-classes.sh Look for swig in /usr/bin and /usr/local/bin. 2011-03-01 01:39:04 +00:00
buildbot.py Added a buildbot script that automatically checks 2011-10-14 21:43:51 +00:00
checkpoint-llvm.pl Updated LLVM/Clang to pick up a fix for imports of 2011-11-04 22:46:46 +00:00
clang.DebuggerCastResultToId.diff The "desired result type" code in the expression 2011-12-21 22:22:58 +00:00
clang.complete-type-being-converted.diff Tightened Clang against a bug in which RecordDecls 2011-12-21 01:47:05 +00:00
clang.complete-type-being-laid-out.diff Updated Clang to take an enhancement to the way 2011-12-16 21:06:35 +00:00
clang.complete-type-ivar-lookup.diff Fixed a problem in our local Clang's method for 2012-01-05 22:35:40 +00:00
clang.instantiate-complete-type.diff Picked up a new revision of Clang to pull in Objective-C 2011-12-01 04:31:46 +00:00
clang.is-being-completed-from-lexical-storage.diff Updated Clang to take an enhancement to the way 2011-12-16 21:06:35 +00:00
clang.require-complete-type.diff Picked up a new revision of Clang to pull in Objective-C 2011-12-01 04:31:46 +00:00
disasm-gdb-remote.pl If timestamps are enabled when logging GDB remote packets ("log enable -T -f /tmp/packets.log gdb-remote logs") then get the amount of time spent executing each packet and summarize at the end of a dump. Sample timing output looks like: 2012-01-25 21:52:15 +00:00
finish-swig-wrapper-classes.sh Parameterize the shell scripts for creating and copying the python and 2010-06-16 19:26:52 +00:00
generate-vers.pl Update autogen'd LLDB_vers.c. 2011-03-23 02:07:56 +00:00
install-lldb.sh
lldb.swig Removed the "lldb-forward-rtti.h" header file as it was designed to contain 2012-01-30 02:53:15 +00:00
llvm.communicate-triple.diff I have added a new patch to LLVM that makes the 2011-12-17 00:59:49 +00:00
llvm.delete-target-machine.diff Integrated a patch for the MCJIT that inhibits 2012-01-19 23:01:46 +00:00
sed-sources Switched over to using the new lldb::SharingPtr from Howard Hinnant. 2010-06-12 17:45:57 +00:00