Commit Graph

14691 Commits

Author SHA1 Message Date
Greg Clayton 591ff8376b Fixed thread local storage test case to run normally with no expected fail for Darwin, always skip on windows, and expected fail for all other OSs while mentioning the new bug I filed to track fixing TLS variables: https://llvm.org/bugs/show_bug.cgi?id=28392
llvm-svn: 274393
2016-07-01 22:33:13 +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
Francis Ricci 7f9fbec3e8 Skip TestDisassembleRawData when remote
Summary:
As this test will create a new target, it will cause all following tests
to fail when running in platform mode, if the new target does not match
the existing architecture (for example, x86 vs x86_64).

Reviewers: zturner, spyffe, clayborg

Subscribers: lldb-commits

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

llvm-svn: 274364
2016-07-01 16:47:44 +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
Omair Javaid fbfc7170fe Correct watchpoint size test failure on certain devices
I overlooked the possibility of certain targets translating increment statement into a read and write.
In this case we replace increment statement with an assignment.

llvm-svn: 274215
2016-06-30 07:09:46 +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
Sagar Thakur 067b6edc1f [LLDB][MIPS] Check if libatomic needs to be specified explicitly
Patch by Nitesh Jain.

Summary : The problem appears while linking liblldb.so. The class Address contain atomic variable m_offset. The loading and storing of variable is access via atomic_load_8 and atomic_store_8 functions. Some target fail to implicitly link libatomic, which cause undefine reference to atomic_store_8/atomic_load_8. This patch uses http://reviews.llvm.org/D20896 to check if libatomic need to be explicitly link.

Reviewed by labath.
Differential: D20464

llvm-svn: 274121
2016-06-29 12:30:18 +00:00
Pavel Labath 7cbd742e3b XFAIL tests which fail with gcc on linux
llvm-svn: 274116
2016-06-29 10:16:14 +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
Greg Clayton 296f166aa3 Fixup the "shadow" example command to use the function that takes an execution context now that the @lldb.command decorator does the right thing for the command function that takes 5 arguments.
A few fixes:
- Check the process state to make sure it is stopped
- Grab the frame from the "exe_ctx" so this will work during breakpoint callbacks
- Print out the SBDeclaration objects of the variables that shadow each other so we can see the source locations of which variable declarations are shodowing each other.

llvm-svn: 273963
2016-06-28 00:06:35 +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
Greg Clayton 4d32eb6939 Add .i files for SBMemoryRegionInfo and SBMemoryRegionInfoList and also hook up the new calls in SBProcess that give out SBMemoryRegionInfo and SBMemoryRegionInfoList objects.
Also make sure the right headers and .i files are included so SWIG can hook everything up.

llvm-svn: 273749
2016-06-24 23:40:35 +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
Francis Ricci a8a044c194 Don't run TestImageListMultiArchitecture during remote test suite
Reviewers: zturner, clayborg, tfiala

Subscribers: sas, lldb-commits

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

llvm-svn: 273720
2016-06-24 20:44:23 +00:00
Sean Callanan 2e6d2d4820 Added a test case for bitfield ivars. It currently fails.
<rdar://problem/17990991>

llvm-svn: 273718
2016-06-24 20:41:18 +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
Sean Callanan c17cb815ac Don't run the top-level expression test case with -gmodules.
<rdar://problem/26563587>

llvm-svn: 273622
2016-06-23 22:18:08 +00:00
Greg Clayton fe9d1ee9e4 Added a new python example which installs a command called "shadow".
This shows how to grab individual blocks from stack frames and get only the variables from those blocks. It then will iterate over all of the parent blocks and look for shadowed variables.

llvm-svn: 273604
2016-06-23 19:54:32 +00:00
Todd Fiala 31ae3c5ade fix Xcode build for r273547
llvm-svn: 273582
2016-06-23 16:54:39 +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
Todd Fiala 1770355d76 add code coverage support to Xcode build
This change adds a new Xcode variable, LLDB_ENABLE_COVERAGE.
If set to 1, then the Xcode build will produce a clang
coverage-style build of LLDB.  This can be done with a commandline
invocation such as:

xcodebuild -scheme desktop -configuration Debug build LLDB_ENABLE_COVERAGE=1

Alternatively, the variable can be locally modified from within Xcode
and built with the Xcode IDE.

llvm-svn: 273332
2016-06-21 23:06:20 +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
Greg Clayton 05b094e0ae Fix the "Release" build on MacOSX for debugserver. Extra bad include paths were making things not build due to header file issues with stdio.h.
llvm-svn: 273306
2016-06-21 19:57:58 +00:00
Jason Molenda 7039ae9d25 Change the "debugserver-mini" target (a version of debugserver
which doesn't like against all the extra UI frameworks on ios)
so it now generates a binary called "debugserver-nonui" and puts
it in /usr/local/bin instead of /Developer/usr/bin.

Add some cruft to RNBDefs.h to get the version number (provided
by Xcode at build time) with either the name "debugserver" or
"debugserver_nonui" as appropriate.

Add the "debugserver-mini" target to the top level "ios" target
in lldb xcode project file, so this nonui debugserver will be
built along with the normal lldb / debugserver.

<rdar://problem/24730789> 

llvm-svn: 273236
2016-06-21 03:39:39 +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
Sean Callanan d3e2d97229 Test that lldb calls the right 'printf' even when a 'printf' method exists.
This test is currently failing.  We have a bug for it, as noted.

llvm-svn: 273211
2016-06-20 23:01:11 +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
Todd Fiala 85bc3f83f4 xfail TestWithModuleDebugging.py on macOS
Tracked by:
https://llvm.org/bugs/show_bug.cgi?id=28156

llvm-svn: 272902
2016-06-16 15:22:49 +00:00