Commit Graph

3986 Commits

Author SHA1 Message Date
Enrico Granata 360cc3188d Implementing the notion of externally-acquirable ScriptInterpreter lock
With this notion, if parties outside the ScriptInterpreter itself need to acquire a lock on script APIs, they can do so by a pattern like this:

{
auto lock = interpeter->AcquireInterpreterLock();
// do whatever you need to do...
} // lock will automatically be released here

This might be useful for classes that use the Python convenience objects (e.g. PythonDictionary) to ensure they keep the underlying interpreter in a safe and controlled condition while they call through the C API functions
Of course, the ScriptInterpreter still manages its internal locking correctly when necessary :-)

llvm-svn: 178189
2013-03-27 22:38:11 +00:00
Ashok Thirumurthi 762fbd0f95 test commit
- modified a comment

llvm-svn: 178178
2013-03-27 21:09:30 +00:00
Jim Ingham 551262d7c0 Fix a typo in help string.
llvm-svn: 178154
2013-03-27 17:36:54 +00:00
Sean Callanan 44bc657efe Fixed a problem where inline assembly errors caused
LLDB to crash.

<rdar://problem/13497915>

llvm-svn: 178115
2013-03-27 03:09:55 +00:00
Greg Clayton d00294483e Don't use a "uintptr_t" for the metadata key, use a "void *". This removes all of the casts that were being used and cleans the code up a bit. Also added the ability to dump the metadata.
llvm-svn: 178113
2013-03-27 01:48:02 +00:00
Enrico Granata b65b3030b6 <rdar://problem/13339196>
The algorithm to access an item in a __NSArrayM was not reacting properly to deletions
The fix is to use a smarter formula that accounts for items shifting and the resulting notion of offsets in the table

llvm-svn: 178076
2013-03-26 21:44:13 +00:00
Enrico Granata 3f617d25d6 <rdar://problem/13246939>
Make format uint64_t[] actually work as designed

llvm-svn: 178072
2013-03-26 21:13:57 +00:00
Greg Clayton 365fe21947 Add a way to dump a ClangASTType to stdout for debugging purposes.
llvm-svn: 178071
2013-03-26 21:01:37 +00:00
Greg Clayton 00ec049050 Clean up logging a bit to not log when a command pipe is opened when “lldb object” logging is on.
llvm-svn: 178068
2013-03-26 20:53:56 +00:00
Enrico Granata 7c0788b2d9 Data formatters cleanup:
- Making an error message more consistent
- Ensuring the element size is not zero before using it in a modulus
- Properly using target settings to cap the std::list element count
- Removing spurious element size calculations that were unused
- Removing spurious capping in std::map

llvm-svn: 178057
2013-03-26 18:55:08 +00:00
Greg Clayton bb1beaa220 Don't crash when we have an element size of zero.
llvm-svn: 178056
2013-03-26 18:42:13 +00:00
Jim Ingham a89be91f2e That wasn't a typo, if the short letter option is from a non-obvious source, I capitolize it in the help as an aid to memory.
llvm-svn: 178052
2013-03-26 18:29:03 +00:00
Enrico Granata 9fb5ab558b Our commands that end up displaying a ValueObject as part of their workflow use OptionGroupValueObjectDisplay as their currency for deciding the final representation
ValueObjects themselves use DumpValueObjectOptions as the currency for the same purpose

The code to convert between these two units was replicated (to varying degrees of correctness) in several spots in the code
This checkin provides one and only one (and hopefully correct :-) entry point for this conversion

llvm-svn: 178044
2013-03-26 18:04:53 +00:00
Sean Callanan bce7c77d85 Fixed a typo.
llvm-svn: 178039
2013-03-26 17:45:02 +00:00
Greg Clayton a9a7d9d5da <rdar://problem/13502196>
We have the tag when figuring out the fully qualified name, append a suitable name for other types of tags when no name is available.

llvm-svn: 177966
2013-03-26 01:51:59 +00:00
Greg Clayton 855958caef <rdar://problem/13502196>
Functions in "(anonymous namespace)" was causing LLDB to crash when trying to complete a type and it would also cause functions arguments to appear in wrong place in frame display when showing function arguments.

llvm-svn: 177965
2013-03-26 01:45:43 +00:00
Enrico Granata 2f59302ce8 <rdar://problem/13221060>
Make register read and write accept $<regname> as valid.
This allows:
(lldb) reg read rbx
     rbx = 0x0000000000000000
(lldb) reg read $rbx
     rbx = 0x0000000000000000
(lldb) reg write $rbx 1
(lldb) reg read $rbx
     rbx = 0x0000000000000001

to function correctly

It is not done at the RegisterContext level because we should keep the internal API clean of this user-friendly behavior and name registers appropriately.
If this ends up being needed in more places we can reconsider.

llvm-svn: 177961
2013-03-26 01:27:04 +00:00
Greg Clayton 4d8ad55c78 Modified patch from Prabhat Verma to enable loading core files through the SBTarget API.
llvm-svn: 177932
2013-03-25 22:40:51 +00:00
Greg Clayton 5088c48686 <rdar://problem/13498879>
C String summary is emitting "<invalid usage of pointer value as object>" for bad pointers. Now it doesn't emit anything.

llvm-svn: 177913
2013-03-25 21:06:13 +00:00
Han Ming Ong fbd8de83db <rdar://problem/13404009>
Only get the attach_info's user ID if the supplied user info is invalid.

llvm-svn: 177900
2013-03-25 20:11:18 +00:00
Enrico Granata c2a58d73ce <rdar://problem/13365424>
Ensure that option -Y also works for expression as it does for frame variable
Also, if the user passes an explicit format specifier when printing a variable, override the summary's decision to hide the value.

This is required for scenarios like this to work:
(lldb) p/x c
(Class) $0 = 0x0000000100adb7f8 NSObject

Previously this would say:
(lldb) p/x c
(Class) $0 = NSObject

ignoring the explicit format specifier

llvm-svn: 177893
2013-03-25 19:46:48 +00:00
Sean Callanan eb7b27dab5 Fixed a potential crash if layout for a structure
went wrong and we tried to get layout information
that wasn't there.

<rdar://problem/13490170>

llvm-svn: 177880
2013-03-25 18:27:07 +00:00
Jason Molenda fc306d3987 Set the correct byte size for complex integer (-fI) memory reads.
<rdar://problem/12281172> 

llvm-svn: 177814
2013-03-23 05:16:54 +00:00
Enrico Granata 9d71afe8cf And then again only compute the more expensive piece of data if need be :-)
llvm-svn: 177812
2013-03-23 01:44:59 +00:00
Enrico Granata 123c39c02b Invert two condition checks to evaluate them in cheapest-to-more-expensive order
llvm-svn: 177810
2013-03-23 01:44:23 +00:00
Enrico Granata 852cce7c1f <rdar://problem/13315663>
commands of the form 
frame variable -f c-string foo
where foo is an arbitrary pointer (e.g. void*) now do the right thing, i.e. they deref the pointer and try to get a c-string at the pointed address instead of dumping the pointer bytes as a string. the old behavior is used as a fallback if things don’t go well

llvm-svn: 177799
2013-03-23 01:12:38 +00:00
Sean Callanan 719a4d5d83 If there are multiple uses of an Objective-C
class symbol in the same expression, handle all
of them instead of just the first one.

<rdar://problem/13440133>

llvm-svn: 177794
2013-03-23 01:01:16 +00:00
Greg Clayton b9d8890bd9 Only get the script interpreter if we find scripting resources in the symbol file. This helps us avoid initializing python when it isn't needed.
llvm-svn: 177793
2013-03-23 00:50:58 +00:00
Greg Clayton 96b68669eb Don't need to resolve the .o file path.
llvm-svn: 177792
2013-03-23 00:50:06 +00:00
Jason Molenda 1de00ef60a Fix a little fallout from the changes in r174757 where we would
skip every other float/double/long double as we extracted data
from a buffer.
<rdar://problem/13485062>

llvm-svn: 177779
2013-03-23 00:04:02 +00:00
Jason Molenda c1946cd8e1 Don't bother calling Reserve on the vector unless we have entries to be added.
llvm-svn: 177776
2013-03-22 23:42:09 +00:00
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
Jim Ingham ce9a1341f2 Change the AppleObjCTrampolineHandler to always run all threads when resolving the target of an ObjC method call.
Add a StopOthers method to AppleThreadPlanStepThroughObjCTrampoline, don't rely on the setting in the ThreadPlanToCallFunction, since that
gets pushed too late to determine which threads will continue.

<rdar://problem/13447638>

llvm-svn: 177691
2013-03-22 01:28:17 +00:00
Jason Molenda 584ce2f349 Don't try to read the eh_frame section out of a dSYM.
It won't have one and it isn't needed.

llvm-svn: 177688
2013-03-22 00:38:45 +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
Jim Ingham a00790447e If we stopped but no threads had a reason for stopping, we should tell the user about it rather than continuing.
<rdar://problem/13273125> Astris thread status replies for single-core device confuse lldb; lldb resumes execution on attaching

llvm-svn: 177670
2013-03-21 21:46:56 +00:00
Jim Ingham 3d0ffd10aa Remove some commented out code.
llvm-svn: 177668
2013-03-21 21:44:20 +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
Matt Kopec 58c0b96d11 Add Linux support for reading/writing extended register sets.
Patch by Ashok Thirumurthi.

llvm-svn: 177568
2013-03-20 20:34:35 +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
Andy Gibbs caf4116c40 Update source/DataFormatters/CMakeLists.txt to reflect actual source files.
llvm-svn: 177511
2013-03-20 10:30:02 +00:00
Andy Gibbs 27f065af2c Update source/Expression/CMakeLists.txt to reflect actual source files.
llvm-svn: 177503
2013-03-20 09:34:46 +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
Sean Callanan 9be9d172bf Fixed handling of function pointers in the IR
interpreter.  They now have correct values, even
when the process is not running.

llvm-svn: 177372
2013-03-19 01:45:02 +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