Commit Graph

388 Commits

Author SHA1 Message Date
Greg Clayton e72dfb321c <rdar://problem/10103468>
I started work on being able to add symbol files after a debug session
had started with a new "target symfile add" command and quickly ran into
problems with stale Address objects in breakpoint locations that had 
lldb_private::Section pointers into modules that had been removed or 
replaced. This also let to grabbing stale modules from those sections. 
So I needed to thread harded the Address, Section and related objects.

To do this I modified the ModuleChild class to now require a ModuleSP
on initialization so that a weak reference can created. I also changed
all places that were handing out "Section *" to have them hand out SectionSP.
All ObjectFile, SymbolFile and SymbolVendors were inheriting from ModuleChild
so all of the find plug-in, static creation function and constructors now
require ModuleSP references instead of Module *. 

Address objects now have weak references to their sections which can
safely go stale when a module gets destructed. 

This checkin doesn't complete the "target symfile add" command, but it
does get us a lot clioser to being able to do such things without a high
risk of crashing or memory corruption.

llvm-svn: 151336
2012-02-24 01:59:29 +00:00
Jason Molenda 052a62c7fe Bumping version to lldb-116.
llvm-svn: 151293
2012-02-23 22:34:01 +00:00
Greg Clayton a9f40ad80a For stepping performance I added the ability to outlaw all memory accesseses
to the __PAGEZERO segment on darwin. The dynamic loader now correctly doesn't
slide __PAGEZERO and it also registers it as an invalid region of memory. This
allows us to not make any memory requests from the local or remote debug session
for any addresses in this region. Stepping performance can improve when uninitialized
local variables that point to locations in __PAGEZERO are attempted to be read 
from memory as we won't even make the memory read or write request.

llvm-svn: 151128
2012-02-22 04:37:26 +00:00
Jason Molenda 1f1a950a7f Install lldb tool into /usr/local/bin if sdk==iphoneos.
llvm-svn: 151085
2012-02-21 21:32:04 +00:00
Jason Molenda cf7e2dc09a Patch Enrico's changes from r150558 on 2012-02-14 to build even if Python
is not available (LLDB_DISABLE_PYTHON is defined).

Change build-swig-Python.sh to emit an empty LLDBPythonWrap.cpp file if 
this build is LLDB_DISABLE_PYTHON.

Change the "Copy to Xcode.app" shell script phase in the lldb.xcodeproj
to only do this copying for Mac native builds.

llvm-svn: 151035
2012-02-21 05:33:55 +00:00
Jim Ingham 228063cd21 Add a logging mode that takes a callback and flush'es to that callback.
Also add SB API's to set this callback, and to enable the log channels.

llvm-svn: 151018
2012-02-21 02:23:08 +00:00
Johnny Chen 9b44acd86b Fix compile error for DisassemblerLLVMC.cpp.
Patch by Dmitry Vyukov <dvyukov@google.com>.

Also add the relevant files to the Xcode project.

llvm-svn: 150991
2012-02-20 22:05:34 +00:00
Greg Clayton d9e416c0ea The second part in thread hardening the internals of LLDB where we make
the lldb_private::StackFrame objects hold onto a weak pointer to the thread
object. The lldb_private::StackFrame objects the the most volatile objects
we have as when we are doing single stepping, frames can often get lost or
thrown away, only to be re-created as another object that still refers to the
same frame. We have another bug tracking that. But we need to be able to 
have frames no longer be able to get the thread when they are not part of
a thread anymore, and this is the first step (this fix makes that possible
but doesn't implement it yet).

Also changed lldb_private::ExecutionContextScope to return shared pointers to
all objects in the execution context to further thread harden the internals.

llvm-svn: 150871
2012-02-18 05:35:26 +00:00
Enrico Granata 400d1f44d1 reverting unwanted changes to scheme files with previous commit
llvm-svn: 150785
2012-02-17 03:20:23 +00:00
Enrico Granata 864e3e8413 Adding formatters for several useful Objective-C/Cocoa data types. The new categories are not enabled at startup, but can be manually activated if desired.
Adding new API calls to SBValue to be able to retrieve the associated formatters
Some refactoring to FormatNavigator::Get() in order to shrink its size down to more manageable terms (a future, massive, refactoring effort will still be needed)
Test cases added for the above

llvm-svn: 150784
2012-02-17 03:18:30 +00:00
Enrico Granata 061858ce61 <rdar://problem/10062621>
New public API for handling formatters: creating, deleting, modifying categories, and formatters, and managing type/formatter association.
This provides SB classes for each of the main object types involved in providing formatter support:
 SBTypeCategory
 SBTypeFilter
 SBTypeFormat
 SBTypeSummary
 SBTypeSynthetic
plus, an SBTypeNameSpecifier class that is used on the public API layer to abstract the notion that formatters can be applied to plain type-names as well as to regular expressions
For naming consistency, this patch also renames a lot of formatters-related classes.
Plus, the changes in how flags are handled that started with summaries is now extended to other classes as well. A new enum (lldb::eTypeOption) is meant to support this on the public side.
The patch also adds several new calls to the formatter infrastructure that are used to implement by-index accessing and several other design changes required to accommodate the new API layer.
An architectural change is introduced in that backing objects for formatters now become writable. On the public API layer, CoW is implemented to prevent unwanted propagation of changes.
Lastly, there are some modifications in how the "default" category is constructed and managed in relation to other categories.

llvm-svn: 150558
2012-02-15 02:34:21 +00:00
Jason Molenda 0fdb104bed Bump version number up to 115.
llvm-svn: 150421
2012-02-13 22:27:56 +00:00
Greg Clayton c3776bf288 First pass at mach-o core file support is in. It currently works for x86_64
user space programs. The core file support is implemented by making a process
plug-in that will dress up the threads and stack frames by using the core file
memory. 

Added many default implementations for the lldb_private::Process functions so
that plug-ins like the ProcessMachCore don't need to override many many 
functions only to have to return an error.

Added new virtual functions to the ObjectFile class for extracting the frozen
thread states that might be stored in object files. The default implementations
return no thread information, but any platforms that support core files that
contain frozen thread states (like mach-o) can make a module using the core
file and then extract the information. The object files can enumerate the 
threads and also provide the register state for each thread. Since each object
file knows how the thread registers are stored, they are responsible for 
creating a suitable register context that can be used by the core file threads.

Changed the process CreateInstace callbacks to return a shared pointer and
to also take an "const FileSpec *core_file" parameter to allow for core file
support. This will also allow for lldb_private::Process subclasses to be made
that could load crash logs. This should be possible on darwin where the crash
logs contain all of the stack frames for all of the threads, yet the crash
logs only contain the registers for the crashed thrad. It should also allow
some variables to be viewed for the thread that crashed.

llvm-svn: 150154
2012-02-09 06:16:32 +00:00
Jason Molenda c56a4ea178 Version bump to 113.
llvm-svn: 150063
2012-02-08 07:31:16 +00:00
Greg Clayton 3c2e3ae490 Almost have templatized functions working (templatized classes are already
working, but not functions). I need to check on a few things to make sure 
I am registering everything correctly in the right order and in the right
contexts.

llvm-svn: 149858
2012-02-06 06:42:51 +00:00
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