Commit Graph

8800 Commits

Author SHA1 Message Date
Oleksiy Vyalov d6a143fcbf Fix ADB client disconnect issues.
http://reviews.llvm.org/D22029

llvm-svn: 274638
2016-07-06 17:02:42 +00:00
Tamas Berghammer dba6503a9b Add oat symbolization support for odex files
Differential revision: http://reviews.llvm.org/D22040

llvm-svn: 274635
2016-07-06 16:40:09 +00:00
Pavel Labath 0c4f01d44b [LLGS] Log more precise errors during inferior launch
Summary:
We are seeing infrequent failures to launch the inferior process on android. The failing call
seems to be execve(). This adds more logging to see the actual error reported by the call.

Reviewers: tberghammer

Subscribers: tberghammer, lldb-commits, danalbert

Differential Revision: http://reviews.llvm.org/D22039

llvm-svn: 274624
2016-07-06 13:18:50 +00:00
Kuba Brecka c359d5ca08 In AddressSanitizer and ThreadSanitizer, let's explicitly set the language of the expression we're evaluating.
llvm-svn: 274621
2016-07-06 11:46:20 +00:00
Tamas Berghammer 9c6c8e9991 Add data formatter for libstdc++ shared_ptr and weak_ptr
Differential revision: http://reviews.llvm.org/D21984

llvm-svn: 274617
2016-07-06 09:50:00 +00:00
Oleksiy Vyalov 58dedd8144 Fix Linux build.
llvm-svn: 274594
2016-07-06 02:20:39 +00:00
Jim Ingham 8b57dcf829 Allows "experimental" settings that will either route to their containing
settings or raise no error if not found.

From time to time it is useful to add some setting to work around or enable
a transitory feature.  We've been reluctant to remove them later because then
we will break folks .lldbinit files.  With this change you can add an "experimental"
node to the settings.  If you later decide you want to keep the option, just move
it to the level that contained the "experimental" setting and it will still be
found.  Or just remove it - setting it will then silently fail and won't halt
the .lldbinit file execution.

llvm-svn: 274593
2016-07-06 01:27:33 +00:00
Greg Clayton ad2b63cbaa Warning about debugging optimized code was not happening without dSYMs. Now it works for DWARF in .o files on Darwin.
I changed "m_is_optimized" in lldb_private::CompileUnit over to be a lldb::LazyBool so that it can be set to eLazyBoolCalculate if it needs to be parsed later. With SymbolFileDWARFDebugMap, we don't actually open the DWARF in the .o files for each compile unit until later, and we can't tell if a compile unit is optimized ahead of time. So to avoid pulling in all .o right away just so we can answer the questions of "is this compile unit optimized" we defer it until a point where we will have the compile unit parsed.

<rdar://problem/26068360> 

llvm-svn: 274585
2016-07-05 23:01:20 +00:00
Sean Callanan 8ba1654d48 Fixed a bug where we report a single type multiple times in namespaces.
Also added a testcase.

<rdar://problem/22786569>

llvm-svn: 274580
2016-07-05 22:06:01 +00:00
Tamas Berghammer c662533d05 Ignore oatdata and oatexec symbols more widely
These are artifical symbols inside android oat files without any value
for the user while causing a significant perfoamce hit inside the
unwinder. We were already ignoring it inside system@framework@boot.oat
bot they have to be ignored in every oat file. Considering that oat
files are only used on android this have no effect on any other
platfrom.

llvm-svn: 274500
2016-07-04 13:31:57 +00:00
Tamas Berghammer 4721a55e4d Fix the libc++ pretty printers for the android NDK
The libc++ shipped with the android NDK is shipped using a different
internal namespace then the upstream libc++ (__ndk1 vs. __1) to avoid
an ODR violation between the platform and the user application. This
change fixes our pretty printers to be able to work with the types
from the android NDK libc++.

Differential revision: http://reviews.llvm.org/D21680

llvm-svn: 274489
2016-07-04 09:13:10 +00:00
Tamas Berghammer 40aac2b8ae Fix ClangASTContext after some clang API changes
llvm-svn: 274488
2016-07-04 09:11:08 +00:00
Greg Clayton c7bb34f6ec Thread local storage was already broken on Linux and the tests were passing because there was a dectorator:
@unittest2.expectedFailure("rdar://7796742")
    
Which was covering up the fact this was failing on linux and hexagon. I added back a decorator so we don't break any build bots.

llvm-svn: 274388
2016-07-01 21:25:20 +00:00
Greg Clayton 0ba05f1835 Revert fix that didn't work. I will need to debug this on linux to figure things out.
llvm-svn: 274377
2016-07-01 18:55:55 +00:00
Greg Clayton a89746907f Try to fix Ubuntu buildbots after I broke thread local variables with 274366.
llvm-svn: 274374
2016-07-01 18:22:01 +00:00
Greg Clayton 63a27afae3 Added support for thread local variables on all Apple OS variants.
We had support that assumed that thread local data for a variable could be determined solely from the module in which the variable exists. While this work for linux, it doesn't work for Apple OSs. The DWARF for thread local variables consists of location opcodes that do something like:

DW_OP_const8u (x)
DW_OP_form_tls_address

or 

DW_OP_const8u (x)
DW_OP_GNU_push_tls_address

The "x" is allowed to be anything that is needed to determine the location of the variable. For Linux "x" is the offset within the TLS data for a given executable (ModuleSP in LLDB). For Apple OS variants, it is the file address of the data structure that contains a pthread key that can be used with pthread_getspecific() and the offset needed. 

This fix passes the "x" along to the thread:

virtual lldb::addr_t
lldb_private::Thread::GetThreadLocalData(const lldb::ModuleSP module, lldb::addr_t tls_file_addr);

Then this is passed along to the DynamicLoader::GetThreadLocalData():

virtual lldb::addr_t
lldb_private::DynamicLoader::GetThreadLocalData(const lldb::ModuleSP module, const lldb::ThreadSP thread, lldb::addr_t tls_file_addr);

This allows each DynamicLoader plug-in do the right thing for the current OS.

The DynamicLoaderMacOSXDYLD was modified to be able to grab the pthread key from the data structure that is in memory and call "void *pthread_getspecific(pthread_key_t key)" to get the value of the thread local storage and it caches it per thread since it never changes.

I had to update the test case to access the thread local data before trying to print it as on Apple OS variants, thread locals are not available unless they have been accessed at least one by the current thread.

I also added a new lldb::ValueType named "eValueTypeVariableThreadLocal" so that we can ask SBValue objects for their ValueType and be able to tell when we have a thread local variable.

<rdar://problem/23308080>

llvm-svn: 274366
2016-07-01 17:17:23 +00:00
Adrian McCarthy 1341d4cde1 Fix for Windows builds.
llvm-svn: 274277
2016-06-30 20:55:50 +00:00
Oleksiy Vyalov 6e181cf341 Improve ADB utilization within Android platform.
http://reviews.llvm.org/D21770

llvm-svn: 274256
2016-06-30 18:10:27 +00:00
Sean Callanan 3696f86188 Removed the redundant "%d errors parsing expression" error. Nobody keeps score.
<rdar://problem/24306284>

llvm-svn: 274254
2016-06-30 18:00:32 +00:00
Enrico Granata 8ea99cd86f Add NSTaggedPointerString to the table of data formatters
Fixes rdar://27002512

llvm-svn: 274164
2016-06-29 21:00:18 +00:00
Enrico Granata dadf7b293d Validate the option index before trying to access an array element using it - OptionArgElement can potentially use negative indices to mean interesting, but non option, states
llvm-svn: 274159
2016-06-29 20:23:03 +00:00
Pavel Labath f17635375a Remove platform plugins from lldb-server
Summary:
This removes the last usage of Platform plugins in lldb-server -- it was used for launching child
processes, where it can be trivially replaced by Host::LaunchProces (as lldb-server is always
running on the host).

Removing platform plugins enables us to remove a lot of other unused code, which was pulled in as
a transitive dependency, and it reduces lldb-server size by 4%--9% (depending on build type and
architecture).

Reviewers: clayborg

Subscribers: tberghammer, danalbert, srhines, lldb-commits

Differential Revision: http://reviews.llvm.org/D20440

llvm-svn: 274125
2016-06-29 13:58:27 +00:00
Greg Clayton d781d2c9b7 64-bit LEB values are not always correctly decoded due to a casting issue, now they are.
<rdar://problem/27002247> 

llvm-svn: 274037
2016-06-28 17:14:18 +00:00
Jim Ingham 1d107725a3 Process::StopForDetachOrDestroy should actually return an error if it can't stop the
process.

<rdar://problem/26990309>

llvm-svn: 274032
2016-06-28 16:35:58 +00:00
Jim Ingham 279b2e889a fixits are apparently called fix-its.
<rdar://problem/26998596>

llvm-svn: 273979
2016-06-28 01:33:03 +00:00
Todd Fiala 3d2c1e6a7c fix invalid assumption about the executable module in Target::Install()
Target::Install() was assuming the module at index 0 was the executable.
This is often true, but not guaranteed to be the case.  The
TestInferiorChanged.py test highlighted this when run against iOS.
After the binary is replaced in the middle of the test, it becomes the
last module in the list.  The rest of the Target::Install() logic then
clobbers the executable file by using whatever happens to be the first
module in the target module list.

This change also marks the TestInferiorChanged.py test as a no-debug-info
test.

llvm-svn: 273960
2016-06-27 23:21:49 +00:00
Jason Molenda 111926de5e Change PlatformDarwinKernel::GetSharedModule to be a little more
explicit in how it adds the kernel binary, to guard against the
case where a kernel corefile might incorrectly include the kernel's
UUID in it (so calling ::GetSharedModule may end up returning the
global module cache's copy of the core file instead of adding the
kerenl binary).

<rdar://problem/26988816> 

llvm-svn: 273954
2016-06-27 22:48:05 +00:00
Omair Javaid 62661473c2 Improve watchpoint error reporting specially for arm/aarch64 targets
Differential revision: http://reviews.llvm.org/D21164

llvm-svn: 273869
2016-06-27 12:35:41 +00:00
Omair Javaid c6dc90ef87 Allow unaligned byte/word selection watchpoints for arm- linux/android targets.
Differential revision: http://reviews.llvm.org/D21516

llvm-svn: 273863
2016-06-27 11:18:23 +00:00
Greg Clayton d7f71add86 Made templates that have Enumeration values as arguments work correctly.
We were checking for integer types only before this. So I added the ability for CompilerType objects to check for integer and enum types.

Then I searched for places that were using the CompilerType::IsIntegerType(...) function. Many of these places also wanted to be checking for enumeration types as well, so I have fixed those places. These are in the ABI plug-ins where we are figuring out which arguments would go in where in regisers/stack when making a function call, or determining where the return value would live. The real fix for this is to use clang to compiler a CGFunctionInfo and then modify the code to be able to take the IR and a calling convention and have the backend answer the questions correctly for us so we don't need to create a really bad copy of the ABI in each plug-in, but that is beyond the scope of this bug fix.

Also added a test case to ensure this doesn't regress in the future.

llvm-svn: 273750
2016-06-24 23:48:00 +00:00
Enrico Granata e1e5ac3117 The Objective-C Class type should not be treated as a potential dynamic type, since it actually doesn't resolve to the type of the class it points to
Fixes rdar://26535584

llvm-svn: 273721
2016-06-24 20:45:08 +00:00
Enrico Granata fbaab6d573 Fix an issue where LLDB would show the key and value of a single entry NSDictionary in the wrong order
Fixes rdar://26478641

llvm-svn: 273695
2016-06-24 17:48:01 +00:00
David Majnemer e2129a3ee9 Silence a -Wc++11-narrowing warning
llvm-svn: 273649
2016-06-24 05:31:23 +00:00
David Majnemer 68303763f4 Update LLDB for r273647
llvm-svn: 273648
2016-06-24 04:39:22 +00:00
Enrico Granata a5d6765cb0 Fix an issue where the @lldb.command marker would not work with the new 5-argument version of the Python command function
This:
a) teaches PythonCallable to look inside a callable object
b) teaches PythonCallable to discover whether a callable method is bound
c) teaches lldb.command to dispatch to either the older 4 argument version or the newer 5 argument version

llvm-svn: 273640
2016-06-24 02:07:15 +00:00
Sean Callanan 5b42f4b8f4 Handle variadic Objective-C methods from DWARF correctly.
<rdar://problem/22039804>

llvm-svn: 273632
2016-06-24 00:24:40 +00:00
Howard Hellyer 2603684372 Add MemoryRegionInfo to SB API
Summary:
This adds new SB API calls and classes to allow a user of the SB API to obtain a full list of memory regions accessible within the process. Adding this to the API makes it possible use the API for tasks like scanning memory for blocks allocated with a header and footer to track down memory leaks, otherwise just inspecting every address is impractical especially for 64 bit processes.

These changes only add the API itself and a base implementation of GetMemoryRegions() to lldb_private::Process::GetMemoryRegions.
I will submit separate patches to fill in lldb_private::Process::GetMemoryRegionInfoList and GetMemoryRegionInfo for individual platforms.

The original discussion about this is here:
http://lists.llvm.org/pipermail/lldb-dev/2016-May/010203.html

Reviewers: clayborg

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D20565

llvm-svn: 273547
2016-06-23 08:35:37 +00:00
Howard Hellyer 89fb6643e9 Test commit to verify access, fix typo.
llvm-svn: 273546
2016-06-23 08:31:22 +00:00
Sagar Thakur 4a716226a5 [LLDB][MIPS] Fix Emulation of Compact branch and ADDIU instructions
Patch by Nitesh Jain.

This patch contains 2 changes:

  - Corrected target address calculation of compact branch instructions to reflect changes in disassembler (http://reviews.llvm.org/D17540).
  - Added emulation for (missing) 'Addiu' instruction.

Reviewers :jaydeep, bhushan, clayborg
Differential: http://reviews.llvm.org/D21064

llvm-svn: 273535
2016-06-23 06:40:37 +00:00
Jason Molenda 17b45390db Revert r273524, it may have been the cause of a linux testbot failure
for TestNamespaceLookup.py; didn't see anything obviously wrong so I'll
need to look at this more closely before re-committing.  (passed OK on
macOS ;)

llvm-svn: 273531
2016-06-23 04:24:16 +00:00
Jason Molenda cb6dae22e2 Do some minor renames of "Mac OS X" to "macOS".
There's uses of "macosx" that will be more tricky to
change, like in triples (e.g. "x86_64-apple-macosx10.11") - 
for now I'm just updating source comments and strings printed 
for humans.

llvm-svn: 273524
2016-06-23 01:18:16 +00:00
Sean Callanan bda7ef84c6 Don't omit `this' from expression args if it couldn't be read, but warn loudly.
<rdar://problem/26935520>

llvm-svn: 273445
2016-06-22 17:32:17 +00:00
Greg Clayton 4c8e782806 Fix the use of lldb::eSymbolContextVariable.
In Address.cpp, we were asking for the lldb::eSymbolContextVariable to be resolved, yet we weren't using the variable. This code gets called when disassembling and can cause the manual creation of all global variables variables which can take minutes. Removing eSymbolContextVariable allows disassembly to not create these long pauses.

In Module.cpp, if someone only specified the lldb::eSymbolContextVariable flag, we would not look into a module's debug info, now we will.

<rdar://problem/26907449>

llvm-svn: 273307
2016-06-21 20:00:36 +00:00
Francis Ricci ea575b9106 Fix typo in eOpenOptionDontFollowSymlinks
Summary: Fix capitalization

Reviewers: labath, sas, clayborg

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D21422

llvm-svn: 273225
2016-06-21 00:03:57 +00:00
Omair Javaid 43507f573d Allow installing watchpoints at less than 8-byte alligned addresses for AArch64 targets
This patch allows LLDB for AArch64 to watch all bytes, words or double words individually on non 8-byte alligned addresses.

This patch also adds tests to verify this functionality.

Differential revision: http://reviews.llvm.org/D21280

llvm-svn: 272916
2016-06-16 16:41:22 +00:00
Luke Drummond 9d4842251c Allow runtimes to execute custom LLVM ModulePasses over the expression IR
During expression evaluation, the ClangExpressionParser preforms a
number of hard-coded fixups on the expression's IR before the module
is assembled and dispatched to be run in a ThreadPlan.

This patch allows the runtimes to register LLVM passes to be run over the
generated IR, that they may perform language or architecture-specfic fixups
or analyses over the generated expression.

This makes expression evaluation for plugins more flexible and allows
language-specific fixes to reside in their own module, rather than
littering the expression evaluator itself with language-specific fixes.

llvm-svn: 272800
2016-06-15 16:19:46 +00:00
Pavel Labath 2a86b555e1 Remove Platform usages from NativeProcessLinux
Summary:
This removes the last usage of the Platform plugin in NPL. It was being
used for determining the architecture of the debugged process. I replace
the call that went through the Platform plugin with a lower level call
on the ObjectFile directly.

Reviewers: tberghammer

Subscribers: uweigand, nitesh.jain, omjavaid, lldb-commits

Differential Revision: http://reviews.llvm.org/D21324

llvm-svn: 272686
2016-06-14 17:30:52 +00:00
Cameron Desrochers 2c00fc41b4 [lldb] Fixed race conditions on private state thread exit
This patch fixes various races between the time the private state thread is signaled to exit and the time it actually exits (during which it no longer responds to events). Previously, this was consistently causing 2-second timeout delays on process detach/stop for us.

This also prevents crashes that were caused by the thread controlling its own owning pointer while the controller was using it (copying the thread wrapper is not enough to mitigate this, since the internal thread object was getting reset anyway). Again, we were seeing this consistently.

Differential Revision: http://reviews.llvm.org/D21296

llvm-svn: 272682
2016-06-14 16:22:45 +00:00
Jason Molenda 27be91ca16 Add support to PlatformRemoteiOS, PlatformRemoteAppleWatch, and
PlatformRemoteAppleTV to check the target.exec-search-paths 
directories for files after looking in the SDK.  An additional
wrinkle is that the remote file path may be something like
".../UIFoundation.framework/UIFoundation" and in 
target.exec-search-paths we will have "UIFoundation.framework".
Looking for just the filename of the path is not sufficient -
we need to also look for it by the parent directories because
this may be a darwin bundle/framework like the UIFoundation
example.

We really need to make a PlatformRemoteAppleDevice and have
PlatformRemoteiOS, PlatformRemoteAppleWatch, and PlatformRemoteAppleTV
inherit from it.  These three classes are 98% identical code.

<rdar://problem/25976619> 

llvm-svn: 272635
2016-06-14 03:49:13 +00:00
Greg Clayton 940f425a43 Add missing #include for linux.
<rdar://problem/25501013>

llvm-svn: 272445
2016-06-10 23:53:06 +00:00