Commit Graph

1630 Commits

Author SHA1 Message Date
Jason Molenda ee7593fbff Add a Reserve method to RangeVector and RangeDataVector. Have the
DWARFCallFrameInfo method which returns a RangeVector pre-size the
vector based on the number of entries it will be adding insted of
growing the vector as items are added.

llvm-svn: 177773
2013-03-22 22:43:14 +00:00
Sean Callanan 6b200d0b3e Modified the way we report fields of records.
Clang requires them to have complete types, but
we were previously only completing them if they
were of tag or Objective-C object types.

I have implemented a method on the ASTImporter
whose job is to complete a type.  It handles not
only the cases mentioned above, but also array
and atomic types.

<rdar://problem/13446777>

llvm-svn: 177672
2013-03-21 22:15:41 +00:00
Jason Molenda 5635f77a99 Add a new method GetFunctionAddressAndSizeVector to DWARFCallFrameInfo.
This returns a vector of <file address, size> entries for all of
the functions in the module that have an eh_frame FDE.

Update ObjectFileMachO to use the eh_frame FDE function addresses if
the LC_FUNCTION_STARTS section is missing, to fill in the start 
addresses of any symbols that have been stripped from the binary.

Generally speaking, lldb works best if it knows the actual start
address of every function in a module - it's especially important
for unwinding, where lldb inspects the instructions in the prologue
of the function.  In a stripped binary, it is deprived of this
information and it reduces the quality of our unwinds and saved
register retrieval.  

Other ObjectFile users may want to use the function addresses from 
DWARFCallFrameInfo to fill in any stripped symbols like ObjectFileMachO
does already.
<rdar://problem/13365659> 

llvm-svn: 177624
2013-03-21 03:36:01 +00:00
Greg Clayton bd180cb623 Fixed the ValidOffsetForDataOfSize() to use simpler logic. Fixed DataExtractor::BytesLeft() to return the correct value.
llvm-svn: 177616
2013-03-21 00:29:45 +00:00
Jason Molenda 7430382970 Change DWARFCallFrameInfo from using a vector of AddressRanges to
track the EH FDEs for the functions in a module to using a
RangeDataVector, a more light-weight data structure that only refers
to File addresses.  Makes the initial FDE scan about 3x faster, uses
less memory.
<rdar://problem/13465650> 

llvm-svn: 177585
2013-03-20 21:57:42 +00:00
Enrico Granata bdbda93f35 Cleanup to the ObjC runtime to remove the now useless ClassDescriptor_Invalid
llvm-svn: 177558
2013-03-20 19:04:28 +00:00
Sean Callanan 2c04735630 Updated the IRExecutionUnit to keep local copies
of the data it writes down into the process even
if the process doesn't exist.  This will allow
the IR interpreter to access static data allocated
on the expression's behalf.

Also cleaned up object ownership in the
IRExecutionUnit so that allocations are created
into the allocations vector.  This avoids needless
data copies.

<rdar://problem/13424594>

llvm-svn: 177456
2013-03-19 23:03:21 +00:00
Enrico Granata 92373533a5 The formatters for std::shared_ptr, std::weak_ptr, std::list, std::vector and std::map as provided by libc++ are now written in C++ instead of Python
std::deque is still in Python but is much less commonly used

llvm-svn: 177454
2013-03-19 22:58:48 +00:00
Enrico Granata 6d37cc6501 This checkin removes the last Cocoa formatters that were implemented in Python and reimplements them in C++. The Python Cocoa formatters are not shipped as part of LLDB anymore, but still exist in the source repository for user reference. Python formatters still exist for STL classes and users can still define their own Python formatters
llvm-svn: 177366
2013-03-19 00:27:22 +00:00
Greg Clayton 9585fbfc67 <rdar://problem/13443931>
Fixed a crasher in the SourceManager where it wasn't checking the m_target member variable for NULL.

In doing this fix, I hardened this class to have weak pointers to the debugger and target in case they do go away. I also changed SBSourceManager to hold onto weak pointers to the debugger and target so they don't keep objects alive by holding a strong reference to them.

llvm-svn: 177365
2013-03-19 00:20:55 +00:00
Sean Callanan 8dfb68e039 Refactored the expression parser so that the IR
and the JITted code are managed by a standalone
class that handles memory management itself.

I have removed RecordingMemoryManager and
ProcessDataAllocator, which filled similar roles
and had confusing ownership, with a common class
called IRExecutionUnit.  The IRExecutionUnit
manages all allocations ever made for an expression
and frees them when it goes away.  It also contains
the code generator and can vend the Module for an
expression to other clases.

The end goal here is to make the output of the
expression parser re-usable; that is, to avoid
re-parsing when re-parsing isn't necessary.

I've also cleaned up some code and used weak pointers
in more places.  Please let me know if you see any
leaks; I checked myself as well but I might have
missed a case.

llvm-svn: 177364
2013-03-19 00:10:07 +00:00
Enrico Granata 9f71ad4fa8 C++ formatters for NSTimeZone and for CFBitVector
llvm-svn: 177219
2013-03-16 01:50:07 +00:00
Enrico Granata 6a92511a08 NS(Mutable)IndexSet formatter moves from Python to C++
llvm-svn: 177217
2013-03-16 01:18:00 +00:00
Enrico Granata 50b5ee5023 Converting more data formatters to C++ - NSBundle, CFBinaryHeap, NSMachPort and NSNotification
llvm-svn: 177213
2013-03-16 00:50:25 +00:00
Greg Clayton 6482d2305e <rdar://problem/13194155>
Variables view out of sync with lldb in Xcode is now fixed. Depending on what happened stack frames could get out of date and a stale shared pointer (one that is no longer a current frame in a thread) could end up being used. 

Now we don't store a weak_ptr to a frame in the ExecutionContextRef class, we just store its stack ID and we always regrab the frame from the thread by stack ID.

llvm-svn: 177208
2013-03-15 23:54:07 +00:00
Enrico Granata 559008649b Porting the Objective-C Class data type’s summary from Python to C++
llvm-svn: 177172
2013-03-15 18:55:30 +00:00
Enrico Granata f68f732746 Moving CFBag and NSBundle summaries from Python to C++
Temporarily disabled non-code-running summaries for CF*Dictionary and NSCountedSet

llvm-svn: 177171
2013-03-15 18:44:08 +00:00
Greg Clayton 4a89501f82 <rdar://problem/12537646>
lldb remembers not-found source file, setting target.source-map doesn't make it re-check for it. Now this is fixed. Each time the source path remappings get updated, the modification ID in the PathMappingList gets bumped and then we know the re-check for sources.

llvm-svn: 177125
2013-03-14 22:52:17 +00:00
Greg Clayton faac111870 <rdar://problem/13421412>
Many "byte size" members and variables were using a mixture of uint32_t and size_t. Switching over to using uint64_t everywhere.

llvm-svn: 177091
2013-03-14 18:31:44 +00:00
Greg Clayton e4ca515ae1 <rdar://problem/13404189>
Made the "--reverse" option to "source list" also be able to use the "--count". This helps us implement support for regexp source list command:

(lldb) l -10

Which gets turned into:

(lldb) source list --reverse --count 10

Also simplified the code that is used to track showing more source from the last file and line.

llvm-svn: 176961
2013-03-13 18:25:49 +00:00
Jim Ingham 17d023f6ac Add a target setting (target.use-fast-stepping) to control using the "run to next branch" stepping algorithm.
llvm-svn: 176958
2013-03-13 17:58:04 +00:00
Jim Ingham 0c61dee1b9 The step by running from branch to branch pretty much works with this checkin (at least for x86_64) but is still
turned off, it needs more qualification.  If you want to play with it, change the initialization of m_use_fast_step
to true.

llvm-svn: 176923
2013-03-13 01:56:41 +00:00
Jim Ingham 32ce20c5ee DoesBranch needs to compute the instruction if it isn't already done.
Handle the "alternate_isa" correctly.

llvm-svn: 176922
2013-03-13 01:55:16 +00:00
Jim Ingham d19444c48b More cleanup, remove an untrue comment.
llvm-svn: 176921
2013-03-13 01:53:26 +00:00
Greg Clayton a4f4223853 Buildbot was failing to build. I guess classes declared in implementation files are treated differently on various compilers causing a "friend class Foo;" to fail for forward declared classes in global namespace.
llvm-svn: 176823
2013-03-11 20:02:03 +00:00
Greg Clayton bff7825a57 <rdar://problem/13372857>
Fixed the exception breakpoints to always use a file filter to make setting exception breakpoint efficient.

llvm-svn: 176821
2013-03-11 18:42:51 +00:00
Sean Callanan 8106d8082c Added very lightweight, statically-allocated
counters for a variety of metrics associated
with expression parsing.  This should give some
idea of how much work the expression parser is
doing on Clang's behalf, and help with hopefully
reducing that load over time.

<rdar://problem/13210748> Audit type search/import for expressions

llvm-svn: 176714
2013-03-08 20:04:57 +00:00
Greg Clayton 1bbcc03455 <rdar://problem/13374267>
Fixed error where objective C methods with selectors names starting with ".cxx_" where causing errors for ARC built binaries.

llvm-svn: 176683
2013-03-08 02:42:06 +00:00
Greg Clayton c4ffd66f06 <rdar://problem/13119621>
Make dynamic type detection faster by using the AST metadata to help out and allow us not to complete types when we don't need to.

After running "purge" on a MacOSX system, the Xcode variables view now populates more than 3x faster with this fix.

llvm-svn: 176676
2013-03-08 01:37:30 +00:00
Jason Molenda 7a1559c239 Add recognition of two more armv7 variants, armv7m and armv7em.
<rdar://problem/13361372> 

llvm-svn: 176674
2013-03-08 01:20:17 +00:00
Sean Callanan 3d27e6603a Updated Apple LLDB version to lldb-300.99.0. Also
updated the build system to support the new Apple
LLDB versioning scheme.

llvm-svn: 176662
2013-03-07 22:29:06 +00:00
Greg Clayton 30820f0685 <rdar://problem/13184855>
Spaces in "settings set" value strings no longer cause setting failures.

llvm-svn: 176532
2013-03-05 23:52:49 +00:00
Greg Clayton 9422dd64f8 <rdar://problem/13338643>
DWARF with .o files now uses 40-60% less memory!

Big fixes include:
- Change line table internal representation to contain "file addresses". Since each line table is owned by a compile unit that is owned by a module, it makes address translation into lldb_private::Address easy to do when needed.
- Removed linked address members/methods from lldb_private::Section and lldb_private::Address
- lldb_private::LineTable can now relink itself using a FileRangeMap to make it easier to re-link line tables in the future
- Added ObjectFile::ClearSymtab() so that we can get rid of the object file symbol tables after we parse them once since they are not needed and kept memory allocated for no reason
- Moved the m_sections_ap (std::auto_ptr to section list) and m_symtab_ap (std::auto_ptr to the lldb_private::Symtab) out of each of the ObjectFile subclasses and put it into lldb_private::ObjectFile.
- Changed how the debug map is parsed and stored to be able to:
    - Lazily parse the debug map for each object file
    - not require the address map for a .o file until debug information is linked for a .o file

llvm-svn: 176454
2013-03-04 21:46:16 +00:00
Jim Ingham 0f063ba6b4 Convert from the C-based LLVM Disassembler shim to the full MC Disassembler API's.
Calculate "can branch" using the MC API's rather than our hand-rolled regex'es.
As extra credit, allow setting the disassembly flavor for x86 based architectures to intel or att.

<rdar://problem/11319574>
<rdar://problem/9329275>

llvm-svn: 176392
2013-03-02 00:26:47 +00:00
Jim Ingham 0943792a65 Move m_destroy_in_process to Process (from ProcessKDP) since it is generally useful,
and use it to keep from doing the OS Plugin UpdateThreadList while destroying, since
if that does anything that requires the API lock it may deadlock against whoever is
running the Process::Destroy.

<rdar://problem/13308627>

llvm-svn: 176375
2013-03-01 20:04:25 +00:00
Greg Clayton 8571963a7c Fixed a case where the result of std::string's c_str() method was being called on a local variable and returned as a const char * incorrectly. We used to cache the thread names for threads in the current host process, but we shoudn't be caching that as the names can change over time, so now a std::string is returned from Host::GetThreadName().
llvm-svn: 176217
2013-02-27 22:51:58 +00:00
Matt Kopec 00049b8b96 Add GNU indirect function support in expressions for Linux.
llvm-svn: 176206
2013-02-27 20:13:38 +00:00
Greg Clayton fac989114f <rdar://problem/13289157>
Set the exception breakpoints more efficiently by specifying two module basenames as module filters for Apple vendor targets.

llvm-svn: 176063
2013-02-26 00:21:38 +00:00
Greg Clayton 72310355ff <rdar://problem/13265297>
StackFrame assumes m_sc is additive, but m_sc can lose its target. So now the SymbolContext::Clear() method takes a bool that indicates if the target should be cleared. Modified all existing code to properly set the bool argument.

llvm-svn: 175953
2013-02-23 04:12:47 +00:00
Enrico Granata d2f16e2c2d <rdar://problem/13265017>
The notion of Crossref command has long been forgotten, and there is nothing using CommandObjectCrossref in the current LLDB codebase
However, this was causing a conflict with process plugins and command aliases ending up in an infinite loop under situations such as:
(lldb) command alias monitor process plugin packet monitor
(lldb) process att -n Calendar
Process 28709 stopped
Executable module set to "/Applications/Calendar.app/Contents/MacOS/Calendar".
Architecture set to: x86_64-apple-macosx.
(lldb) command alias monitor process plugin packet monitor

This fixes the loop (and consequent crash) by disposing of Crossref commands and related code

llvm-svn: 175831
2013-02-21 23:57:25 +00:00
Enrico Granata ea2bc0fb1f <rdar://problem/4529976>
Adding data formatters for iterators for std::map and std::vector (both libc++ and libstdcpp)
This does not include reverse iterators since they are both trickier (due to requirements the standard imposes on them) and much less useful

llvm-svn: 175787
2013-02-21 19:57:10 +00:00
Jim Ingham dff9587640 Add some documentation on how HandleCommand work.
llvm-svn: 175717
2013-02-21 03:17:20 +00:00
Enrico Granata 9d6f7037ba Fixing a potential crasher where a synthetic value could return itself as its static value
llvm-svn: 175574
2013-02-19 23:23:41 +00:00
Enrico Granata 4c5b3f7df6 ValueObjectSynthetic could be wrapping a ValueObjectDynamic. In that case, we want to report that the ValueObject is dynamic since synthetic values are supposed to be just their parent with different children
llvm-svn: 175563
2013-02-19 22:03:00 +00:00
Enrico Granata 9f02e0912d <rdar://problem/12529957>
Synthetic children provider for NSSet

llvm-svn: 175468
2013-02-18 23:16:23 +00:00
Greg Clayton e3e3feea3c Added a host call to get the number of CPUs. It should work on all POSIX unixes, linux and Windows.
llvm-svn: 175405
2013-02-17 20:46:30 +00:00
Enrico Granata f615b80d08 NSSet formatter is now C++ code
Split some NS* formatters in their own source files
Refactored a utility function for the C++ formatters to use
Fixed the skip-summary test case to be explicit about requiring libstdc++ for operation

llvm-svn: 175323
2013-02-15 23:38:37 +00:00
Greg Clayton 79978fc0fc Added missing include.
llvm-svn: 175279
2013-02-15 17:44:31 +00:00
Jim Ingham 299c0c1c09 A little cleanup. {Disable/Enable}Breakpoint actually disables/enables BreakpointSites not breakpoints, it is confusing
to have it not named appropriately.  Also in StopInfoMachException, we aren't testing for software or not software, just
whether the thing is a breakpoint we set.  So don't use "software"...

llvm-svn: 175241
2013-02-15 02:06:30 +00:00
Greg Clayton 399107a936 Centralized the expression prefixes that are used for both expressions and utility functions.
llvm-svn: 175108
2013-02-13 23:57:48 +00:00