Commit Graph

14668 Commits

Author SHA1 Message Date
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
Todd Fiala 367635d94a Set TERM env var for Xcode gtests
Not sure what changed, but something outside our code
is failing one of the EditLine gtests on OS X CI (and
locally) before the gtest ever gets to run.  This fails
the first EditLine gtest.

This change exports the TERM as "vt100" before running
the lldb-gtest binary, fixing the issue.

llvm-svn: 272844
2016-06-15 21:31:02 +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
Tim Hammerquist 16afcddb55 Add results.xml for macOS lldb unittests
http://reviews.llvm.org/D21211

If gtest tests of lldb fail, there are no test results for Jenkins to
consume. This will make the results of the gtest failure available to
Jenkins.

This is to address the failure visible in:
http://lab.llvm.org:8080/green/job/lldb_build_test/19196/

llvm-svn: 272751
2016-06-15 03:53:21 +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
Greg Clayton 88f86b60ca On MacOSX, the threads can appear out of order at times depending on the order in which the kernel returns thread IDs to debugserver. To avoid thread lists changing order between stops, ProcessGDBRemote now makes sure the thread list stays sorted by thread index ID.
<rdar://problem/25501013> 

llvm-svn: 272444
2016-06-10 23:23:34 +00:00
Greg Clayton 9e3ee13a1c Fixed C++ template integer parameter types to work correctly when the integer type is signed.
Prior to this we would display the typename for "TestObj<-1>" as "TestObj<4294967295>" when we showed the type. Expression parsing could also fail because we would fail to find the mangled name when evaluating expressions.

The issue was we were losing the signed'ness of the template integer parameter in DWARFASTParserClang.cpp.

<rdar://problem/25577041>

llvm-svn: 272434
2016-06-10 20:56:09 +00:00
Greg Clayton 6c42aa777e Fixed a few places that were building a regex from an identifier without escaping the identifier text.
<rdar://problem/26090553> 

llvm-svn: 272423
2016-06-10 20:09:33 +00:00
Jim Ingham b2e7d28ed6 SBThread also had some places where it got the ExecutionContext w/o
taking the API lock.

llvm-svn: 272407
2016-06-10 17:22:26 +00:00
Jim Ingham c481c7eeb4 Make all the SBFrame API's take the target lock.
For some reason, the conversion to taking the target lock when acquiring
the ExecutionContext was only done for some of the functions here. That was
allowing lock inversion in some complex uses.

<rdar://problem/26705635>

llvm-svn: 272354
2016-06-10 00:37:44 +00:00
Greg Clayton 4e26dd34a0 Fix "frame variable" to show all variables defined in functions and any contained lexical blocks, even if they are static variables.
For code like:

int g_global = 234;
int g_static = 345;
int main(int argc, char **argv)
{                     
    int a = 22333;
    static int g_int = 123;
    return g_global + g_static + g_int + a;
}


If we stop at the "return" statement, we expect to see "argc", "argv", "a" and "g_int" when we type "frame variable" since "g_int" is a locally defined static variable, but we don't expect to see "g_global" or "g_static" unless we add the -g option to "frame variable".

llvm-svn: 272348
2016-06-09 23:56:12 +00:00
Pavel Labath b519f9fa61 Enable some tests on linux
This enables a couple of tests which have been shown to run reliably on the
linux x86 buildbot. If you see a failure after this commit, feel free to add
the xfail back, but please make it as specific as possible (i.e., try to make
it not cover i386/x86_64 with clang-3.5, clang-3.9 or gcc-4.9).

llvm-svn: 272326
2016-06-09 22:39:36 +00:00
Greg Clayton 60adaf5394 Fixed an issue in the ProcessMachCore where segments are not always contiguous in mach-o core files. We have core files that have segments like:
Address    Size       File off   File size
           ---------- ---------- ---------- ----------
LC_SEGMENT 0x000f6000 0x00001000 0x1d509ee8 0x00001000 --- ---   0 0x00000000 __TEXT
LC_SEGMENT 0x0f600000 0x00100000 0x1d50aee8 0x00100000 --- ---   0 0x00000000 __TEXT
LC_SEGMENT 0x000f7000 0x00001000 0x1d60aee8 0x00001000 --- ---   0 0x00000000 __TEXT

Any if the user executes the following command:

(lldb) mem read 0xf6ff0

We would attempt to read 32 bytes from 0xf6ff0 but would only get 16 unless we loop through consecutive memory ranges that are contiguous in the address space, but not in the file data.   
                          
This fixes the ProcessMachCore::DoReadMemory() to do the right thing.

<rdar://problem/19729287> 

llvm-svn: 272322
2016-06-09 22:26:49 +00:00
Sean Callanan b37674dca0 Fixed a problem in IRMemoryMap where the flag to zero out memory was ignored.
llvm-svn: 272320
2016-06-09 22:22:40 +00:00
Sean Callanan f3df7e86b4 Updated the FindSpace() algorithm to avoid the 0 page when it's unsafe.
Previously we eliminated the randomized scheme for finding memory when the
underlying process cannot allocate memory, and replaced it with an algorithm
that starts the allocations at 00x.

This was more determinstic, but runs into problems on embedded targets where the
pages near 0x0 are in fact interesting memory.  To deal with those cases, this
patch does two things:

- It makes the default fallback be an address that is less likely than 0x0 to
  contain interesting information.

- Before falling back to this, it adds an algorithm that consults the
  GetMemoryRegionInfo() API to see if it can find an unmapped area.

This should eliminate the randomness (and unpredictable memory accesseas) of the
previous scheme while making expressions more likely to return correct results.

<rdar://problem/25545573>

llvm-svn: 272301
2016-06-09 20:22:25 +00:00
Greg Clayton 3efb6b290b Fix a no newline at end of file warning.
llvm-svn: 272284
2016-06-09 18:06:09 +00:00
Greg Clayton 00b385e3a5 Some core files on MacOSX don't have permissions setup correctly on the LC_SEGMENT load commands. Assume read + execute if the permissions are not set.
<rdar://problem/26720522> 

llvm-svn: 272281
2016-06-09 17:52:02 +00:00
Greg Clayton 3385fa08bf Since our expression parser needs to locate areas of memory that are not in use when you have a process that can't JIT code, like core file debugging, the core file process plug-ins should be able to override the Process::GetMemoryRegionInfo(...) function.
In order to make this happen, I have added permissions to sections so that we can know what the permissions are for a given section, and modified both core file plug-ins to override Process::GetMemoryRegionInfo() and answer things correctly.

llvm-svn: 272276
2016-06-09 16:34:06 +00:00
Jim Ingham 19e88c1ff6 Add a test for the failure described by pr28055. Mark it as xfail.
llvm-svn: 272189
2016-06-08 19:06:00 +00:00
Jim Ingham 203451742f Revive the error message from "process load" and SBProcess::LoadImage.
IsPointedCString has problems with ValueObjects of type eTypeHostAddress.  We should
figure out the right thing to do in that case, but the test is silly here because we're
reading a type we've defined, so we know it is a const char *, and if the memory is good, 
we won't be able to read any characters, when we do ReadPointedString.

<rdar://problem/26612812>

llvm-svn: 272087
2016-06-08 01:29:21 +00:00
Greg Clayton 32c940de37 Now that there are no cycles that cause leaks in the disassembler/instruction classes, we can get rid of the FIXME lines that were working around this issue.
<rdar://problem/26684190>

llvm-svn: 272071
2016-06-07 23:19:00 +00:00