Commit Graph

16324 Commits

Author SHA1 Message Date
Zachary Turner ac43c1bb87 Don't access Python objects while not holding the GIL.
Patch by Tatyana Krasnukha
Differential Revision: https://reviews.llvm.org/D34942

llvm-svn: 307512
2017-07-09 23:32:15 +00:00
Kuba Mracek e21b03daea Update message that Main Thread Checker produces.
llvm-svn: 307464
2017-07-08 05:18:19 +00:00
Jason Molenda f62080451c The x86 instruction unwinder can be asked to disassemble non-instruction
blocks of memory, and if the final bytes of that block look like a long
x86 instruction, it can cause the llvm disassembler to read past the end
of the buffer.  Use the maximum allowed instruction length that we pass
to the llvm disassembler as a way to limit this to the size of the buffer.

An example of how to trigger this is when lldb does a function call, it
puts a breakpoint on the beginning of main() and uses that as the return
address from the function call.  When we stop at that location, lldb may
try to find the first frame up the stack.  Because this is on the first
instruction of a function, it will get the word-size value at the stack
pointer and assume that this was the caller's pc value.  But this is random
stack memory and could point to anything - an object in memory, something
in the data section, whatever.  And if we have a symbol for that thing,
we'll try to disassemble it.

This was leading to infrequent crashes in customer scenarios; figured out
what was happening with address sanitizer.

<rdar://problem/30463256> 

llvm-svn: 307454
2017-07-08 00:12:15 +00:00
Pavel Labath daf42491e6 Disable TestGoASTContext
it fails with go 1.8 and we don't seem to have a maintainer of that
functionality.

llvm-svn: 307391
2017-07-07 11:02:28 +00:00
Pavel Labath 96e600fcf5 Add a NativeProcessProtocol Factory class
Summary:
This replaces the static functions used for creating
NativeProcessProtocol instances with a factory pattern, and modernizes
the interface of the new class in the process -- I use llvm::Expected
instead of the Status+value combo. I also move some of the common code
(like the Delegate registration into the base class). The new
arrangement has multiple benefits:
- it removes the NativeProcess*** dependency from Process/gdb-remote
  (which for example means that liblldb no longer pulls in this code).
- it enables unit testing of the GDBRemoteCommunicationServerLLGS class
  (by providing a mock Native Process).
- serves as another example on how to use the llvm::Expected class (I
  couldn't get rid of the Initialize-type functions completely here
  because of the use of shared_from_this, but that's the next thing on
  my list here)

Tests still pass on Linux and I've made sure NetBSD compiles after this.

Reviewers: zturner, eugene, krytarowski

Subscribers: srhines, lldb-commits, mgorny

Differential Revision: https://reviews.llvm.org/D33778

llvm-svn: 307390
2017-07-07 11:02:19 +00:00
Tim Hammerquist 85ca1df472 Fix Xcode project file for gtest schemes.
<rdar://problem/33066993>

llvm-svn: 307335
2017-07-06 23:25:35 +00:00
David L. Jones d4053fb2ec Change remaining references to lit.util.capture to use subprocess.check_output.
Summary:
The capture() function was removed in r306625. This should fix PGO breakages
reported by Michael Zolotukhin.

Reviewers: mzolotukhin

Subscribers: sanjoy, llvm-commits

Differential Revision: https://reviews.llvm.org/D35088

llvm-svn: 307320
2017-07-06 21:46:47 +00:00
Jim Ingham 19c28eee46 Working through testcases, converting to run_to_source_breakpoint.
llvm-svn: 307287
2017-07-06 18:06:25 +00:00
Pavel Labath 21fb07b715 Fix a copy-paste error in r307161
llvm-svn: 307253
2017-07-06 11:43:25 +00:00
Pavel Labath 0fa8396165 Revert "Android.rules: build x86 tests with -mstackrealign"
Starting with android ndk r15, clang much more tests are affected by the
-mstackrealign bugl (now nearly all functions are affected, and not just
the ones requiring 16-byte alignment). Due to their numbers, Xfailing
all of them is not a viable option, so we will just have to declare this
configuration unsupported, and wait until ndk ships a clang version that
has this bug fixed.

llvm-svn: 307252
2017-07-06 11:43:20 +00:00
Jim Ingham a15e7f296b Add a lldbutils routine that gathers up the boiler-plate
to make a target, set a source regex breakpoint, run to 
the breakpoint and find the thread that hit the breakpoint.

Start the process of replacing the boiler plate with this
routine.

llvm-svn: 307234
2017-07-06 02:18:16 +00:00
Tim Hammerquist 42a96a286c add googlemock include dir to lldb-gtest Xcode target
Add the googlemock include directory from LLVM to CFLAGS arguments in
Xcode's lldb-gtest.

<rdar://problem/33066993>

llvm-svn: 307228
2017-07-06 00:08:54 +00:00
Kuba Mracek c40ca13519 [lldb] Add a testcase for MainThreadCheckerRuntime plugin
This adds a simple testcase for MainThreadCheckerRuntime. The tool (Main Thread Checker) is only available on Darwin, so the test also detects the presence of libMainThreadChecker.dylib and is skipped if the tool is not available.

llvm-svn: 307170
2017-07-05 16:29:36 +00:00
Pavel Labath ef7aff507b Fix assorted compiler warnings (mismatched signedness and printf specifiers)
llvm-svn: 307161
2017-07-05 14:54:46 +00:00
Pavel Labath d37c946991 Fix "process load" on new android targets
Summary:
On older android targets, we needed a dlopen rename workaround to get
"process load" working. Since API 26 this is not required as the targets
have a proper libdl so with the function names one would expect.

To make this work I've had to remove the const qualifier from the
GetLibdlFunctionDeclarations function (as now the declarations can
depend on the connected target). Since I was already modifying the
prototype (and the lower levels were already converted to StringRef) I
took the oportunity to convert this function as well.

llvm-svn: 307160
2017-07-05 14:54:41 +00:00
Pavel Labath 11b16c8110 Update lldb architecture docs
Summary:
Due to recent refactors, the descriptions of various modules were wildly
out of date. With this patch, I am not trying to legislate anything,
I am merely documenting the current state of affairs.

I am also deleting one copy of the architecture docs. AFAIK, this one is
not referenced from the web page.

Reviewers: zturner, jingham

Subscribers: lldb-commits

Differential Revision: https://reviews.llvm.org/D34872

llvm-svn: 307072
2017-07-04 12:29:34 +00:00
Pavel Labath 88c6534877 Fix some warnings in ProcessorTraceTest.cpp
llvm-svn: 307071
2017-07-04 12:29:30 +00:00
Ravitheja Addepally f4ffae91cb Fixing warnings for unused variables and copy ellision
Summary:
The std::move was preventing copy ellision when compiled with
clang, the patch fixes the warning along with rearranging code
to remove unused variables warnings on Linux machines with
older perf_event interface.

Reviewers: labath, ted

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D34946

llvm-svn: 307030
2017-07-03 15:07:36 +00:00
Pavel Labath 9bf0e0362f Fix typo/unbreak windows build broken by r307009
llvm-svn: 307018
2017-07-03 11:01:49 +00:00
Pavel Labath c1a6b128c7 Use llvm::sys::RetryAfterSignal instead of a manual while errno!=EINTR loop
Reviewers: zturner, eugene, krytarowski

Subscribers: emaste, mgorny, lldb-commits

Differential Revision: https://reviews.llvm.org/D33831

llvm-svn: 307009
2017-07-03 09:25:55 +00:00
Pavel Labath f1fb38b746 Remove dead Core/StreamFile includes
llvm-svn: 306817
2017-06-30 11:31:13 +00:00
Pavel Labath cc78ea6985 Fix a cmake typo to unbreak windows unit tests
llvm-svn: 306802
2017-06-30 07:54:35 +00:00
Sean Callanan 48bccc9448 [Data formatters] Make NSSetM support both old- and new-style representation
NSSetM has two in-memory representations depending on what Foundation version is in use.
This patch separates the two.

rdar://33057292

Differential Revision: https://reviews.llvm.org/D34821

llvm-svn: 306773
2017-06-30 00:39:17 +00:00
Tim Hammerquist 0a94072e4d Fix some type-based warnings
llvm-svn: 306765
2017-06-29 23:33:40 +00:00
Jason Molenda d2d4c8db45 Update default cpu subtype for armv7 processes to armv7k, the most
likely cpu subtype at this point.

llvm-svn: 306752
2017-06-29 22:50:53 +00:00
Jim Ingham 804eb1fbab Timer.{h,cpp} moved, find them again in the project file.
llvm-svn: 306725
2017-06-29 18:54:40 +00:00
Pavel Labath ef9fc29d4e Speculative fix for windows build broken by r306668
llvm-svn: 306693
2017-06-29 16:15:42 +00:00
Pavel Labath 480907248e Fix Mac build for the Timer move
llvm-svn: 306686
2017-06-29 15:24:38 +00:00
Pavel Labath 217a763bb2 Android.rules: build x86 tests with -mstackrealign
All android builds systems have switched to -mstackrealign for building
x86 binaries, so follow their cue with our mini build system.

This presently breaks just one test (TestReturnValue), and this is due
to a compiler bug, which has already been fixed in clang, but it hasn't
made it yet into the official NDK compiler. While I'm touching that
test, I also remove an android-specific XFAIL, which is not relevant
anymore.

llvm-svn: 306683
2017-06-29 14:32:23 +00:00
Pavel Labath 38d0632e6a Move Timer and TraceOptions from Core to Utility
Summary:
The classes have no dependencies, and they are used both by lldb and
lldb-server, so it makes sense for them to live in the lowest layers.

Reviewers: zturner, jingham

Subscribers: emaste, mgorny, lldb-commits

Differential Revision: https://reviews.llvm.org/D34746

llvm-svn: 306682
2017-06-29 14:32:17 +00:00
Pavel Labath 0e44cff13b Make scripts/analyze-project-deps.py executable
llvm-svn: 306669
2017-06-29 13:02:15 +00:00
Pavel Labath 7ed3e22f00 [unittests] Add a helper function for getting an input file
Summary:
Fetching an input file required about five lines of code, and this was
repeated in multiple unit tests, with slight variations. Add a helper
function for doing that into the lldbUtilityMocks module (which I rename
to lldbUtilityHelpers to commemorate the fact it includes more than
mocks)

Reviewers: zturner, eugene

Subscribers: emaste, mgorny, lldb-commits

Differential Revision: https://reviews.llvm.org/D34683

llvm-svn: 306668
2017-06-29 13:02:11 +00:00
Pavel Labath 8996346bba [UnwindAssembly/x86] Add support for "lea imm(%ebp), %esp" pattern
Summary:
The instruction pattern:
and $-16, %esp
sub $imm, %esp
...
lea imm(%ebp), %esp

appears when the compiler is realigning the stack (for example in
main(), or almost everywhere with -mstackrealign switch). The "and"
instruction is very difficult to model, but that's not necessary, as
these frames are always %ebp-based (the compiler also needs a way to
restore the original %esp). Therefore the plans we were generating for
these function were almost correct already. The only place we were doing
it wrong were the last instructions of the epilogue (usually just
"ret"), where we had to revert to %esp-based unwinding, as the %ebp had
been popped already.

This was wrong because our "distance of esp from cfa" counter had picked
up the "sub" instruction (and incremented the counter) but it had not
seen that the register was reset by the "lea" instruction.

This patch fixes that shortcoming, and adds a test for handling
functions like this.

I have not been able to tickle the compiler into producing a 64-bit
function with this pattern, but I don't see a reason why it couldn't
produce it, if it chose to, so I add a x86_64 test as well.

Reviewers: jasonmolenda, tberghammer

Subscribers: lldb-commits

Differential Revision: https://reviews.llvm.org/D34750

llvm-svn: 306666
2017-06-29 12:40:13 +00:00
Jason Molenda 7f5bd34b18 Fix two places in RegisterContextLLDB::InitializeNonZerothFrame where
I'm not running the saved pc through FixCodeAddress as soon as I should.

<rdar://problem/30686307> 

llvm-svn: 306634
2017-06-29 03:02:24 +00:00
Jason Molenda 43294c9f48 Change the ABI class to have a weak pointer to its Process;
some methods in the ABI need a Process to do their work.
Instead of passing it in as a one-off argument to those
methods, this patch puts it in the base class and the methods
can retrieve if it needed.

Note that ABI's are sometimes built without a Process 
(e.g. SBTarget::GetStackRedZoneSize) so it's entirely
possible that the process weak pointer will not be
able to reconsistitue into a strong pointer.

<rdar://problem/32526754> 

llvm-svn: 306633
2017-06-29 02:57:03 +00:00
Sean Callanan 5a5c14ab94 Added a project for the unified IR interpreter.
llvm-svn: 306611
2017-06-28 22:51:16 +00:00
Pavel Labath 3f2a08183f [DWARFCallFrameInfo] Add Type enum to differentiate eh/debug_frame sections
Summary:
instead of using a boolean to differentiate between the two section
types, use an enum to make the intent clearer.

I also remove the RegisterKind argument from the constructor, as this
can be deduced from the Type argument.

Reviewers: clayborg, jasonmolenda

Subscribers: lldb-commits

Differential Revision: https://reviews.llvm.org/D34681

llvm-svn: 306521
2017-06-28 09:09:19 +00:00
Ravitheja Addepally 2f797585b5 Linux unit tests should only run on
Linux based systems.

llvm-svn: 306520
2017-06-28 09:01:17 +00:00
Ravitheja Addepally 99e376956d Implementation of Intel(R) Processor Trace support for Linux
Summary:
This patch implements support for Intel(R) Processor Trace
in lldb server. The changes have support for
starting/stopping and reading the trace data. The code
is only available on Linux versions where the perf
attributes for aux buffers are available.

The patch also consists of Unit tests for testing the
core buffer reading function.

Reviewers: lldb-commits, labath, clayborg, zturner, tberghammer

Reviewed By: labath, clayborg

Subscribers: mgorny

Differential Revision: https://reviews.llvm.org/D33674

llvm-svn: 306516
2017-06-28 07:58:31 +00:00
Kuba Mracek ad3d174674 Upstream the 'eInstrumentationRuntimeTypeSwiftRuntimeReporting' value of the 'eInstrumentationRuntimeType' enum from the swift-lldb project (to avoid potential clashes).
llvm-svn: 306469
2017-06-27 21:39:15 +00:00
Sean Callanan 5805d9e9ac [build system] If there's an OVERRIDE, don't guess the current SCM.
This makes automatic checkout work even in situations where the
current repository can't be determined, such as in the case of a 
Git tag.

llvm-svn: 306460
2017-06-27 20:35:53 +00:00
Jim Ingham 3f91be52c3 Fix up the Xcode project:
1) Renaming the InstrumentationRuntime directory & file names
2) Bunch of stuff moved from Core to Utility
3) Deleted a bunch of files records for files that have gone away

llvm-svn: 306445
2017-06-27 18:48:32 +00:00
Pavel Labath 7396ee923e Fix windows build for the Connection move
llvm-svn: 306400
2017-06-27 11:45:32 +00:00
Pavel Labath cdda23eb7c Add debug_frame section support
Summary:
This is a beefed-up version of D33504, which adds support for dwarf 4
debug_frame section format.

The main difference here is that the decision whether to use eh_frame or
debug_frame is done on a per-function basis instead of per-object file.
This is necessary because one module can contain both sections (for
example, the start files added by the linker will typically pull in
eh_frame), but we want to be able to access both, for maximum
information.

I also add unit test for parsing various CFI formats (eh_frame,
debug_frame v3 and debug_frame v4).

Reviewers: jasonmolenda, clayborg

Subscribers: mgorny, aprantl, abidh, lldb-commits, tatyana-krasnukha

Differential Revision: https://reviews.llvm.org/D34613

llvm-svn: 306397
2017-06-27 11:16:26 +00:00
Pavel Labath f2a8bccf85 Move StructuredData from Core to Utility
Summary:
It had a dependency on StringConvert and file reading code, which is not
in Utility. I've replaced that code by equivalent llvm operations.

I've added a unit test to demonstrate that parsing a file still works.

Reviewers: zturner, jingham

Subscribers: kubamracek, mgorny, lldb-commits

Differential Revision: https://reviews.llvm.org/D34625

llvm-svn: 306394
2017-06-27 10:45:31 +00:00
Pavel Labath 4ccd99541b Move Connection and IOObject interfaces to Utility module
Summary:
These interfaces have no dependencies, so it makes sense for them to be
in the lowest level modules, to make sure that other parts of the
codebase can use them without introducing loops.

The only exception here is the Connection::CreateDefaultConnection
method, which I've moved to Host, as it instantiates concrete
implementations, and that's where the implementations live.

Reviewers: jingham, zturner

Subscribers: lldb-commits, mgorny

Differential Revision: https://reviews.llvm.org/D34400

llvm-svn: 306391
2017-06-27 10:33:14 +00:00
Pavel Labath 2a1c09fee9 Shorten sanitizer plugin names
Summary:
The new UndefinedBehaviorSanitizer plugin was breaking file path length
limits, because it's (fairly long name) appears multiple times in the
path. Cmake ends up putting the object file at path
tools/lldb/source/Plugins/InstrumentationRuntime/UndefinedBehaviorSanitizer/CMakeFiles/lldbPluginInstrumentationRuntimeUndefinedBehaviorSanitizer.dir/UndefinedBehaviorSanitizerRuntime.cpp.obj
which is 191 characters long and very dangerously close to the 260
character path limit on windows systems (also, just the include line for
that file was breaking the 80 character line limit).

This renames the sanitizer plugins to use shorter names (asan, ubsan,
tsan). I think this will still be quite understandable to everyone as
those are the names everyone uses to refer to them anyway.

Reviewers: zturner, kubamracek, jingham

Subscribers: lldb-commits, mgorny

Differential Revision: https://reviews.llvm.org/D34553

llvm-svn: 306278
2017-06-26 08:13:22 +00:00
Zachary Turner aaea8ee628 Fix LLDB build.
This was broken due to directly including windows.h, which
caused a problem when someone in LLVM called std::min in a header
file.  LLDB has a windows.h include to work around this, but it
wasn't being used in these two files.

llvm-svn: 306186
2017-06-23 23:55:32 +00:00
Sean Callanan f40da17288 Updated the NSArray and NSDictionary formatters to support new storage formats.
Also un-xfailed a testcase that was affected by this.  Thanks to Jason Molenda for the patch.

<rdar://problem/32827216>

llvm-svn: 306180
2017-06-23 23:15:03 +00:00
Mehdi Amini d16a6e32fb Fix typo: using && instead of & when evaluating a mask
Summary: Reported by coverity, I don't know how to provide a test.

Reviewers: zturner

Subscribers: lldb-commits, emaste

Differential Revision: https://reviews.llvm.org/D34550

llvm-svn: 306134
2017-06-23 18:20:13 +00:00