Commit Graph

373 Commits

Author SHA1 Message Date
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
Greg Clayton e1cd1be6d6 Switching back to using std::tr1::shared_ptr. We originally switched away
due to RTTI worries since llvm and clang don't use RTTI, but I was able to 
switch back with no issues as far as I can tell. Once the RTTI issue wasn't
an issue, we were looking for a way to properly track weak pointers to objects
to solve some of the threading issues we have been running into which naturally
led us back to std::tr1::weak_ptr. We also wanted the ability to make a shared 
pointer from just a pointer, which is also easily solved using the 
std::tr1::enable_shared_from_this class. 

The main reason for this move back is so we can start properly having weak
references to objects. Currently a lldb_private::Thread class has a refrence
to its parent lldb_private::Process. This doesn't work well when we now hand
out a SBThread object that contains a shared pointer to a lldb_private::Thread
as this SBThread can be held onto by external clients and if they end up
using one of these objects we can easily crash.

So the next task is to start adopting std::tr1::weak_ptr where ever it makes
sense which we can do with lldb_private::Debugger, lldb_private::Target,
lldb_private::Process, lldb_private::Thread, lldb_private::StackFrame, and
many more objects now that they are no longer using intrusive ref counted
pointer objects (you can't do std::tr1::weak_ptr functionality with intrusive
pointers).

llvm-svn: 149207
2012-01-29 20:56:30 +00:00
Jason Molenda b10ebda354 Fix shell commands that do code signing.
llvm-svn: 149171
2012-01-28 04:19:15 +00:00
Greg Clayton 3120dc6261 Bumping Xcode project versions for lldb-109 and debugserver-167.
llvm-svn: 149168
2012-01-28 02:48:10 +00:00
Greg Clayton 9f94975ca6 Xcode codesigning is broken. Work around this by doing code signing in a shell script build phase.
llvm-svn: 149165
2012-01-28 01:40:47 +00:00
Greg Clayton 6b10d5470e Bumped Xcode project versions for lldb-108 and debugserver-166.
llvm-svn: 148613
2012-01-21 01:15:06 +00:00
Jason Molenda 9351402fa4 Bump version number past lldb-107.
llvm-svn: 148380
2012-01-18 05:19:15 +00:00
Greg Clayton 907018f0ad Bumped xcode project versions for lldb-106 and debugserver-165
llvm-svn: 148202
2012-01-14 20:57:34 +00:00
Greg Clayton ae3e9927a5 Bumped Xcode project version for lldb-105 and debugserver-164.
llvm-svn: 148098
2012-01-13 05:54:31 +00:00
Greg Clayton 4d4c988c6a Bumped Xcode project versions for lldb-104 and debugserver-163.
llvm-svn: 148018
2012-01-12 05:29:50 +00:00
Sean Callanan 30ce74f9b4 Updating Xcode project version numbers for lldb-103 and debugserver-162
llvm-svn: 147865
2012-01-10 18:37:32 +00:00
Sean Callanan 8ca9025216 Updating Xcode project version numbers for lldb-102 and debugserver-161
llvm-svn: 147794
2012-01-09 19:41:28 +00:00
Greg Clayton 0f6fb756a1 Bumped Xcode project versions for lldb-101 and debugserver-160.
llvm-svn: 147597
2012-01-05 04:00:49 +00:00
Sean Callanan a0f6401ce9 Updating Xcode project version numbers for lldb-100 and debugserver-159
llvm-svn: 147193
2011-12-22 22:45:54 +00:00
Sean Callanan b952354d58 I accidentally committed some changes to the
Xcode workspace that aren't actually desirable.
Reverted.

llvm-svn: 147097
2011-12-21 21:30:33 +00:00
Sean Callanan 9b5eaa07e9 Updating Xcode project version numbers for lldb-99 and debugserver-158
llvm-svn: 147061
2011-12-21 18:02:24 +00:00
Jason Molenda 0ffc16cef3 Bump version number past lldb-98.
llvm-svn: 147033
2011-12-21 03:14:42 +00:00
Sean Callanan febbd63db1 Tightened Clang against a bug in which RecordDecls
with incomplete definition data were being converted.
Now Clang attempts to complete RecordDecls before
converting them, avoiding a nasty crash.

llvm-svn: 147029
2011-12-21 01:47:05 +00:00
Sean Callanan 9735fc9abd Updating Xcode project version numbers for lldb-97 and debugserver-157
llvm-svn: 146978
2011-12-20 17:39:37 +00:00
Sean Callanan 4b72920796 Updating Xcode project version numbers for LLDB-96
and debugserver-156.

llvm-svn: 146808
2011-12-17 01:43:50 +00:00
Greg Clayton 58c33f8f0b Bumped Xcode project version to lldb-95 and debugserver-155.
llvm-svn: 146643
2011-12-15 05:23:23 +00:00
Greg Clayton 799c7f914c Fixed the Xcode project to correctly not strip anything for Debug and Release builds.
Modified the Xcode project to not strip liblldb-core.a for BuildAndIntegration builds
and to correctly strip only debug symbols from the command line binaries.

llvm-svn: 146462
2011-12-13 01:12:21 +00:00
Jason Molenda d74db47a41 Move the ARM specific arch picker from PlatformRemoteiOS.cpp to
PlatformDarwin.cpp -- call it from both PlatformRemoteiOS.cpp
and the native process PlatformDarwin.cpp when running on an arm
system.

Bump lldb version number to 94.

llvm-svn: 146249
2011-12-09 07:50:50 +00:00
Jason Molenda 42bb552c7e Use the shorter form of the LLDB framework binary path.
llvm-svn: 145982
2011-12-06 22:48:52 +00:00
Jason Molenda 5e2192adb5 Skip over lldb-93.
llvm-svn: 145917
2011-12-06 04:21:20 +00:00
Greg Clayton 2a4c2f7998 Bumped Xcode project version for lldb-92.
llvm-svn: 145814
2011-12-05 17:41:20 +00:00
Sean Callanan 3b107b172d Added ClangExternalASTSourceCommon, a local superclass
for all our external AST sources that lets us associate
arbitrary flags with the types we put into the AST
contexts.  Also added an API on ClangASTContext that
allows access to these flags given only an ASTContext
and a type.

Because we don't have access to RTTI, and because at
some point in the future we might encounter external
AST sources that we didn't make (so they don't subclass
ClangExternalASTSourceCommon) I added a magic number
that we check before doing anything else, so that we
can catch that problem as soon as it appears.

llvm-svn: 145748
2011-12-03 03:15:28 +00:00
Greg Clayton b1a0292240 Bumping Xcode project version for lldb-91.
llvm-svn: 145561
2011-12-01 03:52:18 +00:00
Greg Clayton e54399dbdf Bumped Xcode project versions for lldb-90 and debugserver-154
llvm-svn: 145528
2011-11-30 22:18:41 +00:00
Sean Callanan 09ab4b777c Added support to the Objective-C language runtime
to find Objective-C class types by looking in the
symbol tables for the individual object files.

I did this as follows:

- I added code to SymbolFileSymtab that vends
  Clang types for symbols matching the pattern
  "_OBJC_CLASS_$_NSMyClassName," making them
  appear as Objective-C classes.  This only occurs
  in modules that do not have debug information,
  since otherwise SymbolFileDWARF would be in
  charge of looking up types.

- I made a new SymbolVendor subclass for the
  Apple Objective-C runtime that is in charge of
  making global lookups of Objective-C types.  It
  currently just sends out type lookup requests to
  the appropriate SymbolFiles, but in the future we
  will probably extend it to query the runtime more
  completely.

I also modified a testcase whose behavior is changed
by the fact that we now actually return an Objective-C
type for __NSCFString.

llvm-svn: 145526
2011-11-30 22:11:59 +00:00
Greg Clayton f9d851b2ca Bumped Xcode project versions for lldb-89 and debugserver-153.
llvm-svn: 144911
2011-11-17 17:22:31 +00:00
Greg Clayton 2d8d63a927 Bumped Xcode project version for lldb-88 and debugserver-152.
llvm-svn: 144616
2011-11-15 03:56:34 +00:00
Jim Ingham c8b47586bb Confirm should accept both "Y" and "y" in case somebody confuses the "default answer" indicator for a
directive to enter a capital letter.

llvm-svn: 144562
2011-11-14 20:02:01 +00:00
Greg Clayton 44148b367f Bumped Xcode project version for lldb-86 and debugserver-151
llvm-svn: 144032
2011-11-07 22:50:17 +00:00
Greg Clayton c64b5c7c47 Xcode project changes to install "lldb" into "/usr/bin" and have LLDB.framework
in "/System/Library/PrivateFrameworks", and also have "lldb" in the Xcode.app
and the LLDB.framework in Xcode.app as well.

llvm-svn: 144030
2011-11-07 22:45:39 +00:00
Sean Callanan bfb237bc02 Updated LLVM/Clang to pick up a fix for imports of
C++ vtables, fixing a record layout problem in the
expression parser.

Also fixed various problems with the generation 
and unpacking of llvm.zip given our new better
handling of multiple architectures in the LLVM
build.

(And added a log message that will hopefully catch
record layout problems in the future.)

llvm-svn: 143741
2011-11-04 22:46:46 +00:00
Greg Clayton 9a67c268f8 For "Debug" and "Release" builds, don't build llvm into the $(OBJROOT) since
we often nuke our "build" folder so we can do clean builds. This way if you
are building your own LLVM you won't have to rebuild LLVM when you do remove
your build folder. The new location for the LLVM build is:

lldb/llvm-build

llvm-svn: 143713
2011-11-04 17:36:00 +00:00
Greg Clayton 755c73f1e1 Fixed the LD_DYLIB_INSTALL_NAME to the LLDB.framework.
llvm-svn: 143710
2011-11-04 17:18:16 +00:00
Greg Clayton dce502ede0 Fixed the Xcode project building of LLVM to be a bit more user friendly:
- If you download and build the sources in the Xcode project, x86_64 builds
  by default using the "llvm.zip" checkpointed LLVM.
- If you delete the "lldb/llvm.zip" and the "lldb/llvm" folder, and build the
  Xcode project will download the right LLVM sources and build them from 
  scratch
- If you have a "lldb/llvm" folder already that contains a "lldb/llvm/lib"
  directory, we will use the sources you have placed in the LLDB directory.
  
Python can now be disabled for platforms that don't support it. 

Changed the way the libllvmclang.a files get used. They now all get built into
arch specific directories and never get merged into universal binaries as this
was causing issues where you would have to go and delete the file if you wanted
to build an extra architecture slice.

llvm-svn: 143678
2011-11-04 03:34:56 +00:00
Greg Clayton e59da1688e Bumping Xcode project versions for lldb-85 and debugserver-150.
llvm-svn: 143587
2011-11-02 23:11:17 +00:00
Greg Clayton 93d217889e Bumped Xcode project version to lldb-84 and debugserver-149.
llvm-svn: 143408
2011-11-01 01:10:56 +00:00
Greg Clayton 9d3d6886e6 Fixed some warnings after enabling some stricter warnings in the Xcode project
settings.

Also fixed an issue where we weren't creating anonymous namepaces correctly:
<rdar://problem/10371295>

llvm-svn: 143403
2011-10-31 23:51:19 +00:00
Greg Clayton c05203ba81 Updated the project to use the "DEVELOPER_DIR" build setting that specifies
the path to the /Developer directory, and also bumped the Xcode project version
for lldb-83 and debugserver-148.

llvm-svn: 143269
2011-10-29 01:19:08 +00:00
Greg Clayton e3c3d724c9 Bumping Xcode project version in mainline to match the latest build that was
submitted.

llvm-svn: 143199
2011-10-28 16:41:16 +00:00
Sean Callanan 5e9e1991e9 Added VerifyDecl, a function that, when LLDB is
linked against a debug LLVM, runs a variety of
functions -- currently just one -- that verify
that the Decls we create are valid.

ClangASTContext now calls this verifier whenever
it adds a Decl to a DeclContext, and the verifier
checks that the AccessSpecifier is sane.

llvm-svn: 143000
2011-10-26 01:06:27 +00:00
Greg Clayton 1deb796238 Updated all commands that use a "--format" / "-f" options to use the new
OptionGroupFormat. Updated OptionGroupFormat to be able to also use the
"--size" and "--count" options. Commands that use a OptionGroupFormat instance
can choose which of the options they want by initializing OptionGroupFormat
accordingly. Clients can either get only the "--format", "--format" + "--size",
or "--format" + "--size" + "--count". This is in preparation for upcoming
chnages where there are alternate ways (GDB format specification) to set a
format. 

llvm-svn: 142911
2011-10-25 06:44:01 +00:00
Greg Clayton 607ddc571e Bumped versions for lldb-81 and debugserver-146.
llvm-svn: 142718
2011-10-22 03:38:38 +00:00
Greg Clayton 97fbc34276 Fixed some issues where we might not have one of the new apple accelerator
tables (like the .apple_namespaces) and it would cause us to index DWARF that
didn't need to be indexed.

Updated the MappedHash.h (generic Apple accelerator table) and the DWARF
specific one (HashedNameToDIE.h) to be up to date with the latest and
greatest hash table format.

llvm-svn: 142627
2011-10-20 22:30:33 +00:00
Greg Clayton 81c22f6104 Moved lldb::user_id_t values to be 64 bit. This was going to be needed for
process IDs, and thread IDs, but was mainly needed for for the UserID's for
Types so that DWARF with debug map can work flawlessly. With DWARF in .o files
the type ID was the DIE offset in the DWARF for the .o file which is not
unique across all .o files, so now the SymbolFileDWARFDebugMap class will
make the .o file index part (the high 32 bits) of the unique type identifier
so it can uniquely identify the types.

llvm-svn: 142534
2011-10-19 18:09:39 +00:00
Greg Clayton 5a31471e72 Added the ability to run expressions in any command. Expressions can be
inserted in commands by using backticks:

(lldb) memory read `$rsp-16` `$rsp+16`
(lldb) memory read  -c `(int)strlen(argv[0])` `argv[0]`

The result of the expression will be inserted into the command as a sort of
preprocess stage where this gets done first. We might need to tweak where this
preprocess stage goes, but it is very functional already.

Added ansi color support to the Debugger::FormatPrompt() so you can use things
like "${ansi.fg.blue}" and "${ansi.bold}" many more. This helps in adding 
colors to your prompts without needing to know the ANSI color code strings.

llvm-svn: 141948
2011-10-14 07:41:33 +00:00