Commit Graph

14928 Commits

Author SHA1 Message Date
Enrico Granata 2094e44f9b Add a non-code-running data formatter for __NSCFBoolean
llvm-svn: 279446
2016-08-22 18:07:52 +00:00
Todd Fiala be1d3a0b0e added Xcode lldb-gtest-for-debugging target
The lldb-gtest target is for CI and runs the tests as
part of the build phase.  It does not support debugging
the gtests from Xcode, though, due to the run happening
during the build phase.

This change adds a lldb-gtest-for-debugging target that
can be used to debug gtests.

llvm-svn: 279354
2016-08-20 00:54:03 +00:00
Enrico Granata 3630a287a6 Add logic to the ObjC runtime in LLDB to extract the pointer values of the two singleton (pairtons?) instances of __NSCFBoolean that represent true and false
This is useful because that knowledge will in turn allow no-code-running formatting of boolean NSNumbers; but that's a commit that will have to wait Monday..

llvm-svn: 279353
2016-08-20 00:48:11 +00:00
Jim Ingham 27f4a94e0a Remove a test that depends on knowing all compiler's register allocation schemes.
This test was using a condition that would compare a variable against the register that would hold
it.  It was failing with clang on arm64 because clang put the variable on the stack.

This is not a supportable way to write tests.

llvm-svn: 279345
2016-08-19 22:58:26 +00:00
Lang Hames 6377aa1cb1 [lldb] Use OrcMCJITReplacement rather than MCJIT as the underlying JIT for LLDB
expression evaluation.

OrcMCJITReplacement is a reimplementation of MCJIT using ORC components, and
provides an easy upgrade path to ORC for existing MCJIT clients. There should be
no functional changes resulting from this switch.

llvm-svn: 279327
2016-08-19 21:27:16 +00:00
Vedant Kumar e62b54ed2a Revert "[lldb][cmake] Remove libclang as an lldbBase dependency (NFCI)"
This reverts commit r279296. Including LLDBDependencies breaks the
netbsd lldb bot because it exposes LLDB_USED_LIBS, which causes
lldb_link_common_libs to run to completion in unintended sites, which
results in a malformed call to target_link_libraries.

  http://lab.llvm.org:8011/builders/lldb-amd64-ninja-netbsd7/builds/5989

Thanks to Chris Bieneman for figuring this out!

llvm-svn: 279322
2016-08-19 21:00:40 +00:00
Kate Stone b03a71eea8 Reverted premature changes to .clang-format
llvm-svn: 279316
2016-08-19 20:46:37 +00:00
Kate Stone 41de9a9791 Moved #include for lldb-python.h to a distinct group with a reminder comment
declaring that it must be first.  Failure to do so results in build failures
on macOS due to subtle header conflicts.

llvm-svn: 279315
2016-08-19 20:44:07 +00:00
Vedant Kumar 181f924beb [lldb][cmake] Remove libclang as an lldbBase dependency (NFCI)
It's pulling in all kinds of things it doesn't need (e.g, clang-tidy!).

Eliminating this dependency removes 1056 dependencies from the
'CommandObjectFrame.cpp.o' target and 454 dependencies from the 'lldb'
target. On my machine, this shaves 7 minutes off of a clean build of
lldb.

Thanks to Zachary Turner for pointing out some issues with an earlier
version of this patch!

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

llvm-svn: 279296
2016-08-19 18:41:50 +00:00
Pavel Labath 69dac575d3 Fix 32-bit builds after r279232
GetByteSize() of a DataBuffer returns a uint64_t (it probably shouldn't), which isn't implicitly
convertible to size_t.

llvm-svn: 279238
2016-08-19 13:14:13 +00:00
Dimitar Vlahovski d909f9551c Fixing a Darwing test thats failing on windows
The pexpect import should be make after the skip-if-not-darwin part
because pexpect is not available on Windows

llvm-svn: 279234
2016-08-19 12:44:53 +00:00
Pavel Labath b42b48e051 Remove the last manually constructed packet from gdb-remote register context + small refactor
Summary:
The tricky part here was that the exisiting implementation of WriteAllRegisters was expecting
hex-encoded data (as that was what the first implementation I replaced was using, but here we had
binary data to begin with. I thought the read/write register functions would be more useful if
they handled the hex-encoding themselves (all the other client functions provide the responses in
a more-or-less digested form). The read functions return a DataBuffer, so they can allocate as
much memory as they need to, while the write functions functions take an llvm::ArrayRef, as that
can be constructed from pretty much anything.

Reviewers: clayborg

Subscribers: lldb-commits

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

llvm-svn: 279232
2016-08-19 12:31:49 +00:00
Todd Fiala 1bdbebed1c add all missing gtest tests to the Xcode lldb-gtest target
Exclusions:
ModuleCacheTest: https://llvm.org/bugs/show_bug.cgi?id=29045
SymbolFilePDBTests: https://llvm.org/bugs/show_bug.cgi?id=29046

llvm-svn: 279208
2016-08-19 05:26:40 +00:00
Todd Fiala d6c7036e42 fixup macOS gtest running
Needed to explicitly turn off RTTI (since lldb-core builds
with -fno-rtti) and specify -DGTEST_HAVE_RTTI=0.

llvm-svn: 279205
2016-08-19 04:55:12 +00:00
Todd Fiala 49178e5efe fix broken gdb-remote gtest
This change adds the Process/gdb-remote gtests to the Xcode
build.  It also adds a virtual method impl to the continuation
delegate that I added with the StructuredDataPlugin change.

llvm-svn: 279203
2016-08-19 04:38:44 +00:00
Todd Fiala 759300192a Add StructuredData plugin type; showcase with new DarwinLog feature
Take 2, with missing cmake line fixed.  Build tested on
Ubuntu 14.04 with clang-3.6.

See docs/structured_data/StructuredDataPlugins.md for details.

differential review: https://reviews.llvm.org/D22976

reviewers: clayborg, jingham
llvm-svn: 279202
2016-08-19 04:21:48 +00:00
Todd Fiala a07e4a8352 Revert "Add StructuredData plugin type; showcase with new DarwinLog feature"
This reverts commit 1d885845d1451e7b232f53fba2e36be67aadabd8.

llvm-svn: 279200
2016-08-19 03:03:58 +00:00
Todd Fiala aef7de8492 Add StructuredData plugin type; showcase with new DarwinLog feature
See docs/structured_data/StructuredDataPlugins.md for details.

differential review: https://reviews.llvm.org/D22976

reviewers: clayborg, jingham
llvm-svn: 279198
2016-08-19 02:52:07 +00:00
Sean Callanan 799a3fc60b Fixed a problem where we failed to get the size of an Objective-C type.
<rdar://problem/27897056>

llvm-svn: 279098
2016-08-18 17:45:50 +00:00
Pavel Labath 83082a0337 gdb-remote: Remove manual locking from GetShlibInfoAddr
The function can simply call the non-NoLock version of the SendPacket function and let it do the
locking.

llvm-svn: 279070
2016-08-18 14:33:55 +00:00
Pavel Labath 27402d2a12 Move QSyncThreadState packet generation to the gdb-remote client
llvm-svn: 279057
2016-08-18 12:32:41 +00:00
Pavel Labath 4b6f9591d3 gdb-remote: Centralize thread specific packet handling
Summary:
Before this, each function had a copy of the code which handled appending of the thread suffix to
the packet (or using $Hg instead). I have moved that code into a single function and made
everyone else use that. The function takes the partial packet as a StreamString rvalue reference,
to avoid a copy and to remind the users that the packet will have undeterminate contents after
the call.

This also fixes the incorrect formatting of the QRestoreRegisterState packet in case thread
suffix is not supported.

Reviewers: clayborg

Subscribers: lldb-commits

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

llvm-svn: 279040
2016-08-18 08:30:03 +00:00
Pavel Labath c233995b1e Fix tests for the gdb-remote memory read packets
Part of TestGDBRemoteMemoryRead has been disabled since r259379 because it was incompatible with
python3. This changes the test to use the lldb-server test framework, which is a more appropriate
method of testing raw stub behaviour anyway (and should avoid the whole python 3 issue).

llvm-svn: 279039
2016-08-18 08:21:42 +00:00
Pavel Labath 9361c439e8 Fix parsing of complicated C++ names
Summary:
CPlusPlusLanguage::MethodName was not correctly parsing templated functions whose demangled name
included the return type -- the space before the function name was included in the "context" and
the context itself was not terminated correctly due to a misuse of the substr function (second
argument is length, not the end position). Fix that and add a regression test.

Reviewers: clayborg

Subscribers: lldb-commits

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

llvm-svn: 279038
2016-08-18 08:21:38 +00:00
Omair Javaid a6583c5d89 Correct makefile.rules to use arm/aarch64 target specific AR and OBJCOPY
Differential revision: https://reviews.llvm.org/D20386

llvm-svn: 278947
2016-08-17 16:45:34 +00:00
Pavel Labath 8e8e5061b8 Fix unittests on windows after r278915
Apparently clang will happily capture a const variable in a lambda without it being specified in
the capture clause. MSVC does not like that.

llvm-svn: 278925
2016-08-17 12:00:19 +00:00
Pavel Labath 2f430a1938 Remove cmake legacy code
Summary: Cmake 2.8 support is gone and not coming back. We can remove a bit of legacy code now.

Reviewers: zturner

Subscribers: lldb-commits

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

llvm-svn: 278924
2016-08-17 11:55:50 +00:00
Pavel Labath 3cc2f11f90 Fix unittest compilation error in r278915
llvm-svn: 278918
2016-08-17 09:17:08 +00:00
Pavel Labath d43ae376d4 Remove manual packet construction from GDBRemoteRegisterContext::SetPrimordialRegister
llvm-svn: 278916
2016-08-17 09:12:21 +00:00
Pavel Labath 56d7262b69 Move packet construction from GDBRemoteRegisterContext go the communication class
Summary:
When saving/restoring registers the GDBRemoteRegisterContext class was manually constructing
the register save/restore packets. This creates appropriate helper functions in
GDBRemoteCommunicationClient, and switches the class to use those. It also removes what a
duplicate packet send in some of those functions, a thing that I can only attribute to a bad
merge artefact.

I also add a test framework for testing gdb-remote client functionality and add tests for the new
functions I introduced. I'd like to be able to test the register context changes in isolation as
well, but currently there doesn't seem to be a way to reasonably construct a standalone register
context object, so we'll have to rely on the end-to-end tests to verify that.

Reviewers: clayborg

Subscribers: lldb-commits

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

llvm-svn: 278915
2016-08-17 08:53:31 +00:00
Jason Molenda 0dace2d3a1 Fix the RangeMapVector::FindEntryThatContainsOrFollows method to
back up the iterator, as long as it still contains the address.
std::lower_bound will point us to the entry after the one we
are really interested in, leading to problems with backtracing
in corefiles.

<rdar://problem/27823549> 

llvm-svn: 278901
2016-08-17 03:56:04 +00:00
Pavel Labath 5a123c4e37 Remove GetThreadSuffixSupported from GDBRemoteCommunication **base** class
Despite its comment, the function is only used in the Client class, and its presence was merely
complicating mock implementation in unit tests.

llvm-svn: 278785
2016-08-16 09:36:29 +00:00
Saleem Abdulrasool 5cf8e59763 Symbol: add missing item in covered switch
RenderScript was missing from the covered switch.  Add it to avoid a warning of
the missing entry.  NFC.

llvm-svn: 278774
2016-08-16 04:12:36 +00:00
Pavel Labath 1ac2b20d25 Fix expression evaluation with operator new
Summary:
referencing a user-defined operator new was triggering an assert in clang because we were
registering the function name as string "operator new", instead of using the special operator
enum, which clang has for this purpose. Method operators already had code to handle this, and now
I extend this to cover free standing operator functions as well. Test included.

Reviewers: spyffe

Subscribers: sivachandra, paulherman, lldb-commits

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

llvm-svn: 278670
2016-08-15 14:32:32 +00:00
Pavel Labath 8749089c8c Fix a race in Broadcaster/Listener interaction
Summary:
The following problem was occuring:
- broadcaster B had two listeners: L1 and L2 (thread T1)
- (T1) B has started to broadcast an event, it has locked a shared_ptr to L1 (in
  ListenerIterator())
- on another thread T2 the penultimate reference to L1 was destroyed (the transient object in B is
  now the last reference)
- (T2) the last reference to L2 was destroyed as well
- (T1) B has finished broadcasting the event to L1 and destroyed the last shared_ptr
- (T1) this triggered the destructor, which called into B->RemoveListener()
- (T1) all pointers in the m_listeners list were now stale, so RemoveListener emptied the list
- (T1) Eventually control returned to the ListenerIterator() for doing broadcasting, which was
  still in the middle of iterating through the list
- (T1) Only now, it was holding onto a dangling iterator. BOOM.

I fix this issue by making sure nothing can interfere with the
iterate-and-remove-expired-pointers loop, by moving this logic into a single function, which
first locks (or clears) the whole list and then returns the list of valid and locked Listeners
for further processing. Instead of std::list I use an llvm::SmallVector which should hopefully
offset the fact that we create a copy of the list for the common case where we have only a few
listeners (no heap allocations).

A slight difference in behaviour is that now RemoveListener does not remove an element from the
list -- it only sets it's mask to 0, which means it will be removed during the next iteration of
GetListeners(). This is purely an implementation detail and it should not be externally
noticable.

I was not able to reproduce this bug reliably without inserting sleep statements into the code,
so I do not add a test for it. Instead, I add some unit tests for the functions that I do modify.

Reviewers: clayborg, jingham

Subscribers: tberghammer, lldb-commits

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

llvm-svn: 278664
2016-08-15 09:53:08 +00:00
Pavel Labath b3d1290c44 Fixup r278524 for non-apple targets
The commit started passing a nullptr port into GDBRemoteCommunication::StartDebugserverProcess.
The function was mostly handling the null value correctly, but it one case it did not check it's
value before assigning to it. Fix that.

llvm-svn: 278662
2016-08-15 09:17:13 +00:00
Ed Maste 0767b40e25 elf-core: set powerpc vector byte order correctly
It was being set to the fp reg set's byte order due to an apparent
copy-and-pasteo.                                                   

llvm-svn: 278625
2016-08-14 11:30:11 +00:00
Todd Fiala af32ccb195 fix lldb-gtest target of Xcode build
Change r278527 was filtering out too many libraries.
The Xcode lldb-gtest target depends on linking libgtest*.a,
but those were not being included.  This caused the lldb-gtest
linkage step to fail to find a main entry point that is present
in the filtered out libs.

This change restores the libgtest* libraries to the link list
by whitelisting them in the filter.

llvm-svn: 278552
2016-08-12 19:27:05 +00:00
Zachary Turner b6958a888e Disable TestThreadSpecificBpPlusCondition on Windows.
Test frequently times out stalling the test runner.

llvm-svn: 278529
2016-08-12 17:15:38 +00:00
Todd Fiala 1dc065b659 Link LLDB only against libclang and libLLVM .a files to fix macOS build
The Xcode macOS build of LLDB is currently broken after
https://reviews.llvm.org/D23232 landed, see
http://lab.llvm.org:8080/green/job/lldb_build_test/20014/console,
because we’re trying to link against all .a files found in the
llvm-build/lib directory. Let’s be more specific in what we link
against. This patch applies a regexp to only use “libclang.*”,
“libLLVM.*” and not “libclang_rt.*” static archives.

Change by Kuba Mracek (formerly Kuba Brecka)

See review here:
https://reviews.llvm.org/D23444

Reviewers: tfiala, compnerd
llvm-svn: 278527
2016-08-12 17:01:19 +00:00
Zachary Turner bd22bf26cb Fix build on Windows.
llvm-svn: 278526
2016-08-12 16:52:31 +00:00
Greg Clayton c6c420fca1 Switch over to using socketpair for local debugserver connections as they are twice as fast as TCP sockets (on macOS at least).
This change opens a socket pair and passes the second socket pair file descriptor down to the debugserver binary using a new option: "--fd=N" where N is the file descriptor. This file descriptor gets passed via posix_spawn() so that there is no need to do any bind/listen or bind/accept calls and eliminates the hanshake unix socket that is used to pass the result of the actual port that ends up being used so it can save time on launch as well as being faster.

This is currently only enabled on __APPLE__ builds. Other OSs should try modifying the #define from ProcessGDBRemote.cpp but the first person will need to port the --fd option over to lldb-server. Any OSs that enable USE_SOCKETPAIR_FOR_LOCAL_CONNECTION in their native builds can use the socket pair stuff. The #define is Apple only right now, but looks like:

#if defined (__APPLE__)
#define USE_SOCKETPAIR_FOR_LOCAL_CONNECTION 1
#endif

<rdar://problem/27814880> 

llvm-svn: 278524
2016-08-12 16:46:18 +00:00
Tamas Berghammer 3785393def Skip 2 android test what is broken because of debuggerd
debuggerd is a crash reporting system on android what installs some
signal handler for SEGV to print a backtrace in the log. Its behavior
breaks tests where the test tries to continue after a SEGV so we skip
them as this behavior isn't required on android anyway.

llvm-svn: 278510
2016-08-12 14:17:05 +00:00
Pavel Labath fdb2d99eaf Fix-up r278299 for windows
FD_SETSIZE on windows limits the number of file descriptors, rather than their individual
magnitude (the underlying implementation uses an array rather than a bitset). This meant that the
assert in the SelectHelper was incorrect, and failing all the time. Fix that.

I am not sure whether this should be #ifdef MSVC, or #ifdef WINDOWS, but my feeling is that a
more posix-conforming implementation on windows would choose the bitset implementation, so I'm
sticking with the former.

llvm-svn: 278500
2016-08-12 11:20:21 +00:00
Pavel Labath 709269153f XFAIL TestNamespaceDefinitions on gcc-4.8 and below
llvm-svn: 278491
2016-08-12 09:52:14 +00:00
Pavel Labath b491ef4317 Make TestCallStopAndContinue clang-format-resilient
llvm-svn: 278490
2016-08-12 09:39:22 +00:00
Todd Fiala e1cfbc7942 Decoupled Options from CommandInterpreter.
Options used to store a reference to the CommandInterpreter instance
in the base Options class.  This made it impossible to parse options
independent of a CommandInterpreter.

This change removes the reference from the base class.  Instead, it
modifies the options-parsing-related methods to take an
ExecutionContext pointer, which the options may inspect if they need
to do so.

Closes https://reviews.llvm.org/D23416
Reviewers: clayborg, jingham

llvm-svn: 278440
2016-08-11 23:51:28 +00:00
Zachary Turner fd34ba53e3 Modify coding conventions to mention include ordering.
llvm-svn: 278373
2016-08-11 18:10:40 +00:00
Vedant Kumar 1c23c14808 [InstrumentationRuntime] Refactor the API (Part 2/N) (NFCI)
Factor out some common logic used to find the runtime library in a list
of modules.

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

llvm-svn: 278368
2016-08-11 17:28:37 +00:00
Vedant Kumar a4fa2e299a [InstrumentationRuntime] Refactor the API (Part 1/N) (NFCI)
Adapters for instrumentation runtimes have to do two basic things:

  1) Load a runtime library.
  2) Install breakpoints in that library.

This logic is duplicated in the adapters for asan and tsan. Factor it
out and document bits of it to make it easier to add new adapters.

I tested this with check-lldb, and double-checked
testcases/functionalities/{a,t}san.

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

llvm-svn: 278367
2016-08-11 17:28:33 +00:00