Commit Graph

16730 Commits

Author SHA1 Message Date
Jason Molenda 5584cc48c7 Update xcode project file to build new ppc64le files.
llvm-svn: 318500
2017-11-17 01:55:50 +00:00
Jim Ingham e28a93deff Recognize another magic token sent in the LaunchInfo's EventData.
<rdar://problem/32505028>

llvm-svn: 318496
2017-11-17 01:22:34 +00:00
Jim Ingham 9347b68629 "source list -a" was calling DisplaySourceLinesWithNumbers incorrectly.
The parameters were just passed in the wrong order.

<rdar://problem/35150446>

llvm-svn: 318495
2017-11-17 01:19:59 +00:00
Greg Clayton 84a7333a61 Fixed up to use a class for the commands, renamed the commands and added a way to just dump the compile unit full paths and optionally their support files with the new "dump-files"command.
llvm-svn: 318424
2017-11-16 17:14:48 +00:00
Pavel Labath fd2c8d6572 Implement core dump debugging for PPC64le
Summary: Implement core dump debugging for PPC64le.

Reviewers: labath

Reviewed By: labath

Subscribers: JDevlieghere, krytarowski, clayborg, labath, lbianc, nemanjai, gut, anajuliapc, mgorny, kbarton, lldb-commits

Differential Revision: https://reviews.llvm.org/D39681
Patch by Alexandre Yukio Yamashita <alexandre.yamashita@eldorado.org.br>

llvm-svn: 318399
2017-11-16 13:38:57 +00:00
Jason Molenda 4f34614beb Fix alignment of arm64 fpu register context structure
so it has the same padding as the kernel's definition
which is written in terms of uint128_t.  Original patch
by Ryan Mansfield.

<rdar://problem/35468499> 

llvm-svn: 318357
2017-11-16 00:50:29 +00:00
Davide Italiano c12c0c5467 [POSIX] Replace assert with llvm_unreachable(). NFCI.
llvm-svn: 318348
2017-11-15 23:39:41 +00:00
Jason Molenda fd6647ecb6 Roll back r318260 because it is causing the windows bot to
break.  The alignas(__uint128_t) is not recognized with MSVC
it looks like.  Zachary, is there a similar type on windows?
I suppose I can go with alignas(16) here but I'd prefer to
specify the type alignment that I want & let the ABI dictate
how much padding is required.

llvm-svn: 318262
2017-11-15 03:41:47 +00:00
Jason Molenda 1f88f4c3bc Two small fixes to handle arm64 fpu register contexts in
a Mach-O file load command correctly, patch by Ryan
Mansfield.

<rdar://problem/35468499> 

llvm-svn: 318260
2017-11-15 03:18:24 +00:00
Jason Molenda 5882359128 Update xcode project file to track ArchSpec.cpp
move and LibCxxBitset.cpp addition.

llvm-svn: 318218
2017-11-14 23:15:35 +00:00
Don Hinton f031e48f45 Add check for self-assignment. NFC
Differential Revision: https://reviews.llvm.org/D39578

llvm-svn: 318164
2017-11-14 18:19:41 +00:00
Pavel Labath 5269875ef9 Add a data formatter for libc++ std::bitset
Reviewers: jingham, EricWF

Subscribers: mgorny, lldb-commits

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

llvm-svn: 318145
2017-11-14 11:15:03 +00:00
Stephane Sezer aaa41ae08e Reformat a comment. NFC.
llvm-svn: 318079
2017-11-13 20:13:25 +00:00
Pavel Labath 2da1b5970c Fix netbsd, freebsd and osx builds for ArchSpec move
llvm-svn: 318052
2017-11-13 16:47:37 +00:00
Pavel Labath 5f19b90783 Move ArchSpec to the Utility module
The rationale here is that ArchSpec is used throughout the codebase,
including in places which should not depend on the rest of the code in
the Core module.

This commit touches many files, but most of it is just renaming of
 #include lines. In a couple of cases, I removed the #include ArchSpec
line altogether, as the file was not using it. In one or two places,
this necessitated adding other #includes like lldb-private-defines.h.

llvm-svn: 318048
2017-11-13 16:16:33 +00:00
Pavel Labath 4ebb64b95f Remove last Host usage from ArchSpec
Summary:
In D39387, I was quick to jump to conclusion that ArchSpec has no
external dependencies. It turns there still was one call to
HostInfo::GetArchitecture left -- for implementing the "systemArch32"
architecture and friends.

Since GetAugmentedArchSpec is the place we handle these "incomplete"
triples that don't specify os or vendor and "systemArch" looks very much
like an incomplete triple, I move its handling there.

After this ArchSpec *really* does not have external dependencies, and
I'll move it to the Utility module as a follow-up.

Reviewers: zturner, clayborg, jingham

Subscribers: lldb-commits

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

llvm-svn: 318046
2017-11-13 15:57:20 +00:00
Pavel Labath 769b21eaf2 CompilerType: Add ability to retrieve an integral template argument
Summary:
Despite it's name, GetTemplateArgument was only really working for Type
template arguments. This adds the ability to retrieve integral arguments
as well (which I've needed for the std::bitset data formatter).

I've done this by splitting the function into three pieces. The idea is
that one first calls GetTemplateArgumentKind (first function) to
determine the what kind of a parameter this is. Based on that, one can
then use specialized functions to retrieve the correct value. Currently,
I only implement two of these: GetTypeTemplateArgument and
GetIntegralTemplateArgument.

Reviewers: jingham, clayborg

Subscribers: lldb-commits

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

llvm-svn: 318040
2017-11-13 14:26:21 +00:00
Pavel Labath d739636ccf Revert "[lldb] Use OrcMCJITReplacement rather than MCJIT as the underlying JIT for LLDB"
This commit really did not introduce any functional changes (for most
people) but it turns out it's not for the reason we thought it was.

The reason wasn't that Orc is a perfect drop-in replacement for MCJIT,
but it was because we were never using Orc in the first place, as it was
not initialized.

Orc's initialization relies on a global constructor in the LLVMOrcJIT.a.
Since this archive does not expose any symbols referenced from other
object files, it does not get linked into liblldb when linking against
llvm components statically. However, in an LLVM_LINK_LLVM_DYLIB=On
build, LLVMOrcJit.a is linked into libLLVM.so using --whole-archive, so
the global constructor does end up firing.

The result of using Orc jit is pr34194, where lldb fails to evaluate
even very simple expressions. This bug can be reproduced in
non-LLVM_LINK_LLVM_DYLIB builds by making sure Orc jit is linked into
liblldb, for example by #including
llvm/ExecutionEngine/OrcMCJITReplacement.h in IRExecutionUnit.cpp (and
adding OrcJIT as a dependency to the relevant CMakeLists.txt file). The
bug reproduces (at least) on linux and osx.

The root cause of the bug seems to be related to relocation processing.
It seems Orc processes relocations earlier than the system it is
replacing. This means the relocation processing happens before we have
had a chance to remap section load addresses to reflect their address in
the target process memory, so they end up pointing to locations in the
lldb's address space instead.

I am not sure whether this is a bug in Orc jit, or in how we are using
it from lldb, but in any case it is preventing us from using Orc right
now. Reverting this fixes LLVM_LINK_LLVM_DYLIB build, and makes it clear
that we are in fact *not* using Orc, and we never really were.

This reverts commit r279327.

llvm-svn: 318039
2017-11-13 14:03:17 +00:00
Greg Clayton 61eaf8f163 Added a way to dump the full paths to all source files in a module that has debug info.
llvm-svn: 317945
2017-11-10 22:39:07 +00:00
Alexander Shaposhnikov 7fd4a2c477 [lldb] Remove unused method declaration
FindCompleteObjCDefinitionType is not used anywhere and there is no implementation of it, only a declaration.

Test plan: make check-lldb

Differential revision: https://reviews.llvm.org/D39884

llvm-svn: 317919
2017-11-10 19:40:53 +00:00
Pavel Labath d37349f380 Clean up NativeRegisterContext
Summary:
This commit removes the concrete_frame_idx member from
NativeRegisterContext and related functions, which was always set to
zero and never used.

I also change the native thread class to store a NativeRegisterContext
as a unique_ptr (documenting the ownership) and make sure it is always
initialized (most of the code was already blindly dereferencing the
register context pointer, assuming it would always be present -- this
makes its treatment consistent).

Reviewers: eugene, clayborg, krytarowski

Subscribers: aemerson, sdardis, nemanjai, javed.absar, arichardson, kristof.beyls, kbarton, uweigand, alexandreyy, lldb-commits

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

llvm-svn: 317881
2017-11-10 11:05:49 +00:00
Pavel Labath 1ebc85f86f llgs-tests: Replace the "log+return false" pattern with llvm::Error
Summary:
These tests used to log the error message and return plain bool mainly
because at the time they we written, we did not have a nice way to
assert on llvm::Error values. That is no longer true, so replace this
pattern with a more idiomatic approach.

As a part of this patch, I also move the formatting of
GDBRemoteCommunication::PacketResult values out of the test code, as
that can be useful elsewhere.

Reviewers: zturner, eugene

Subscribers: mgorny, lldb-commits

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

llvm-svn: 317795
2017-11-09 15:45:09 +00:00
Pavel Labath 0ccb256dae Add a unit test for ClangASTContext template arguments handling
I am planning to make changes to this piece of code, so I wrote this
test to add more coverage to it first.

llvm-svn: 317792
2017-11-09 15:06:31 +00:00
Pavel Labath 578a425890 Simplify NativeProcessProtocol::GetArchitecture/GetByteOrder
Summary:
These functions used to return bool to signify whether they were able to
retrieve the data. This is redundant because the ArchSpec and ByteOrder
already have their own "invalid" states, *and* because both of the
current implementations (linux, netbsd) can always provide a valid
result.

This allows us to simplify bits of the code handling these values.

Reviewers: eugene, krytarowski

Subscribers: javed.absar, lldb-commits

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

llvm-svn: 317779
2017-11-09 10:43:16 +00:00
Pavel Labath d9f6f5f44d Xfail TestConcurrentTwoWatchpointsOneSignal on arm
r317561 exposed an interesting bug (pr35228) in handling of simultaneous
watchpoint hits. Disabling the test until we can get that fixed.

llvm-svn: 317683
2017-11-08 11:51:49 +00:00
Pavel Labath d2aab749d1 Log: delimit thread name in log message
The thread name was not followed by a space, which meant it was glued to
the log message. I also align the name as we do that with other log
fields. I align it to 16 chars instead of llvm::max_thread_name(), as
that can be 64 on darwin, which is rather long. If anybody feels
differently about that, we can change it.

llvm-svn: 317679
2017-11-08 10:48:54 +00:00
Pavel Labath 042c752691 Make TestTopLevelExprs more robust in face of linker GC
Summary:
This test was failing in various configurations on linux in a fairly
unpredictible way. The success depended on whether the c++ abi library
was linked in statically or not and how well was the linker able to
strip parts of it. This introduces additional code to the "dummmy" test
executable, which ensures that all parts of the library needed to
evaluate the expressions are always present.

Reviewers: clayborg

Subscribers: srhines, tatyana-krasnukha, davide, lldb-commits

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

llvm-svn: 317678
2017-11-08 10:48:50 +00:00
Pavel Labath 4c0461f8ce Update tuple/list/deque data formatters to work with newest libc++
Summary:
A couple of members of these data structures have been renamed in recent
months. This makes sure they still work with the latest libc++ version.

Reviewers: jingham, EricWF

Subscribers: lldb-commits

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

llvm-svn: 317624
2017-11-07 22:17:29 +00:00
Tamas Berghammer cf6bf4c4ba Fix an issue in r317563 causing a clang assert
llvm-svn: 317574
2017-11-07 13:43:55 +00:00
Tamas Berghammer 5976583a30 Support scoped enums in the DWARF AST parser
Subscribers: JDevlieghere

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

llvm-svn: 317563
2017-11-07 10:39:22 +00:00
Pavel Labath 888cc5d50b test: Clean up finalize_build_dictionary
We only support API>=16 now, so we don't need to check the API level of
the android device.

llvm-svn: 317562
2017-11-07 10:36:42 +00:00
Pavel Labath 881fe8ecb2 "Fix" concurrent events test for arm
Summary:
The test incremented an atomic varible to trigger the watchpoint event.
On arm64 this compiled to a ldaxr/stlxr loop, with the watchpoint being
triggered in the middle of the loop. Hitting the watchpoint resets the
exclusive monitor, and forces the process to loop one more time, hitting
the watchpoint again, etc.

While it would be nice if the debugger was able to resume from this
situation, this is not trivial, and is not what this test is about.
Therefore, I propose to change this to a simple store to a normal
variable (which should still trip the watchpoint everywhere, but without
atomic loops) and file a bug to investigate the possibilities of
handling the watchpoints in atomic loops in a more reasonable way.

Reviewers: clayborg

Subscribers: aemerson, kristof.beyls, lldb-commits

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

llvm-svn: 317561
2017-11-07 10:36:36 +00:00
Stephane Sezer d20106b5ec Disable tests in lang/c/shared_lib on Windows
Summary: These fail because `-fPIC` is not supported on Windows.

Reviewers: zturner, jingham, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits

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

llvm-svn: 317529
2017-11-07 00:14:40 +00:00
Stephane Sezer 972d513a5c Add a dependency from check-lldb on lld
Summary:
This is required when using the in-tree clang for building tests,
because -fuse-ld=lld is used by default.

Subscribers: mgorny

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

llvm-svn: 317501
2017-11-06 19:25:33 +00:00
Pavel Labath a68e048233 Extend android xfail in TestTopLevelExprs
The test fails on API level 19 as well. I'm going to assume that it
fails on every API level below 23.

llvm-svn: 317474
2017-11-06 12:34:27 +00:00
Tamas Berghammer 7cb7df2bbf Improve the posix core file triple detection
Summary:
Posix core files sometime don't contain enough information to correctly
detect the OS. If that is the case we should use the OS from the target
instead as it will contain usable information in more cases and if the
target and the core contain different OS-es then we are already in a
pretty bad state so moving from an unknown OS to a known (but possibly
incorrect) OS will do no harm.

We already had similar code in place for MIPS. This change tries to make
it more generic by using ArchSpec::MergeFrom and extends it to all
architectures but some MIPS specific issue prevent us from getting rid
of special casing MIPS.

Reviewers: clayborg, nitesh.jain

Subscribers: aemerson, sdardis, arichardson, kristof.beyls, lldb-commits

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

llvm-svn: 317411
2017-11-04 18:25:51 +00:00
Pavel Labath a964012cd2 Remove ProcessGdbRemote::m_flags
The member is completely unused. Discussed on lldb-dev.

llvm-svn: 317377
2017-11-03 22:12:50 +00:00
Pavel Labath e6a661053d Add float/vector registers for ppc64le
Summary: Add read and write functions for VSX, VMX and float registers and fix watchpoint size

Reviewers: clayborg

Reviewed By: clayborg

Subscribers: eugene, labath, clayborg, nemanjai, kbarton, JDevlieghere, anajuliapc, gut, lbianc, lldb-commits

Differential Revision: https://reviews.llvm.org/D39487
Patch by: Alexandre Yukio Yamashita <alexandre.yamashita@eldorado.org.br>

llvm-svn: 317329
2017-11-03 15:22:36 +00:00
Don Hinton a6a2910e3d Add type to FileSpec::PathSyntax enum.
Summary:
Add type to FileSpec::PathSyntax enum to decrease size for
FileSpec on systems with 32 bit pointers.

Thanks to @zturner for pointing this out.

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

llvm-svn: 317327
2017-11-03 14:59:36 +00:00
Pavel Labath 6cf1aa5f5f Xfail test_stack_info_in_minidump test
The test has been failing since we enabled the i386 ABI plugin on
windows. See pr35193 for details.

llvm-svn: 317326
2017-11-03 14:42:37 +00:00
Pavel Labath 09bdfb32ef Fix classifications on two concurrent event tests
I have classified one as a watchpoint test even though it wasn't and
vice versa. Fix that.

llvm-svn: 317319
2017-11-03 12:13:22 +00:00
Pavel Labath 64b6e5af13 Remove getCategories mechanism of specifying test categories
Summary:
This mechanism was mostly redundant with the file-based .categories
mechanism, and it was interfering with it, as any test which implemented
a getCategories method would not inherit the filesystem categories.

This patch removes it. The existing categories are preserved either by
adding a .categories file, or using the @add_test_categories decorator.

Reviewers: jingham, clayborg, zturner

Subscribers: lldb-commits

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

llvm-svn: 317277
2017-11-02 22:13:09 +00:00
Pavel Labath 03304427a9 Remove android watchpoint xfails
Now that the wathpoint tests have their own category, we can easily skip
them on devices which don't have watchpoint support. Therefore, we don't
need an android xfail on each of these tests.

llvm-svn: 317276
2017-11-02 22:12:55 +00:00
Pavel Labath eac00c3be6 Fix some warnings found by ToT clang
These fall into two categories:
- unused variables
- (uint8_t *)NULL + X -- changed to reinterpret_cast(X)

llvm-svn: 317270
2017-11-02 21:35:26 +00:00
Stephane Sezer 7a0c218bae Run clang-format on lldb.cpp
llvm-svn: 317219
2017-11-02 16:56:52 +00:00
Stephane Sezer b55c8b1f16 Use LLVM version string
Summary:
macOS builds of LLDB use the bundle version from
`tools/driver/lldb-Info.plist`. That file hasn't been updated since the 4.0
release so the version we print provides no value. I also think that even if it
were up to date, that number has no meaning and displaying the version from the
LLVM tree is more valuable.

I know that Apple folks have some form of override for the clang version to
match the Xcode version, so it'd make sense for them to do the same for LLDB.

Reviewers: clayborg

Subscribers: lldb-commits

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

llvm-svn: 317218
2017-11-02 16:56:19 +00:00
Jason Molenda 2350272187 Revert r317182 for https://reviews.llvm.org/D39128
we're still failing on android.  I'll ask Larry to 
ask Pavel for any tips he might be able to give.

llvm-svn: 317183
2017-11-02 03:17:07 +00:00
Jason Molenda edc2def4a6 Commit Lawrence D'Anna's patch to change
SetOututFileHandle to work with IOBase.

I did make one change after checking with Larry --
I renamed SBDebugger::Flush to FlushDebuggerOutputHandles
and added a short docstring to the .i file to make it
a little clearer under which context programs may need
to use this API.

Differential Revision: https://reviews.llvm.org/D39128
<rdar://problem/34870417> 

llvm-svn: 317182
2017-11-02 02:43:27 +00:00
Jason Molenda 9e27b70a07 Ahhhh roll back that commit, I didn't see that Lawrence had filed
a separate phabracator with the revised change.  This was his
first atttempt which broke on the bots the second time too.

llvm-svn: 317181
2017-11-02 02:33:59 +00:00
Jason Molenda c139a402b2 Commit Lawrence D'Anna's patch to change
SetOututFileHandle to work with IOBase.

I did make one change after checking with Larry --
I renamed SBDebugger::Flush to FlushDebuggerOutputHandles
and added a short docstring to the .i file to make it
a little clearer under which context programs may need
to use this API.

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

llvm-svn: 317180
2017-11-02 02:02:56 +00:00
Davide Italiano 43252d5390 [Core] Comparison for unsigned >= 0 is redundant. NFCI.
llvm-svn: 317145
2017-11-01 23:49:23 +00:00
Davide Italiano 014ef593aa [XML] Simplify lambda removing unused capture. NFCI.
llvm-svn: 317144
2017-11-01 23:48:07 +00:00
Davide Italiano 8e353b90c7 [Interpreter] Remove unused variable usage. NFCI.
llvm-svn: 317143
2017-11-01 23:46:21 +00:00
Pavel Labath cf82cc3d54 dotest: consistently call finalize_build_dictionary in debug info variants
dwarf&dwo versions were doing it, but gmodules and dsym weren't. All
this function does right now is pass OS=Android to make when targeting
android. This enables us to run dotest without manually passing --env
OS=Android.

llvm-svn: 317130
2017-11-01 22:01:03 +00:00
Jason Molenda 813c5f21dd add LibCxxTuple.cpp, LibCxxQueue.cpp to xcode project file.
llvm-svn: 317129
2017-11-01 21:55:35 +00:00
Pavel Labath e0d51846f2 Add data formatter for libc++ std::queue
Summary:
std::queue is just a fancy wrapper around another container, so all we
need to do is to delegate to the it.

Reviewers: jingham, EricWF

Subscribers: srhines, mgorny, lldb-commits, eugene

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

llvm-svn: 317099
2017-11-01 15:52:08 +00:00
Pavel Labath 333739d0e2 Add data formatter for libc++ std::tuple
Reviewers: jingham, EricWF

Subscribers: srhines, eugene, lldb-commits, mgorny

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

llvm-svn: 317095
2017-11-01 15:19:52 +00:00
Pavel Labath b38c02047a Remove uint32_t assignment operator from Status
Summary:
It is not presently used, and it's quite dangerous to use -- it assumes the
integer is an osx kern_return_t, but very few of the integers we have lying
around are mach kernel error codes. The error can still be used to a
mach error using a slightly longer (but more explicit) syntax.

Reviewers: jingham

Subscribers: lldb-commits

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

llvm-svn: 317093
2017-11-01 15:00:58 +00:00
Jason Molenda 6418bff2f3 Remove Sean Callanan from the CODE_OWNERS, he won't have time
to participate in lldb going forward.  Jim Ingham is adopting
the areas he was responsible for.

llvm-svn: 317067
2017-11-01 01:38:42 +00:00
Jim Ingham dccb1db1af Modernize the example cmdtemplate.py.
This version relies on a newer and more convenient way
to use a class to implement a command.  It has been in place
since early 2015, so it should be pretty safe to use.

llvm-svn: 317043
2017-10-31 22:38:24 +00:00
Pavel Labath 22e71a030e Add a "watchpoint" test category and annotate tests appropriately
Most of the watchpoint tests are organized into subtrees, so we can use the
file-based .categories approach to annotate them. The exception are the
concurrent_events tests, which needed to be annotated on a per-test basis.

The motivation behind this is to provide an easy way to disable watchpoint
tests on systems where the watchpoint functionality is not present/unreliable.

llvm-svn: 317004
2017-10-31 15:27:19 +00:00
Pavel Labath f753bfeeec Fix LLVM_LINK_LLVM_DYLIB build (pr35053)
Summary:
r316368 broke this build when it introduced a reference to a pthread
function to the Utility module. This caused cmake to generate an
incorrect link line (wrong order of libs) because it did not see the
dependency from Utility to the system libraries. Instead these libraries
were being manually added to each final target.

This changes moves the dependency management from the individual targets
to the lldbUtility module, which is consistent with how llvm does it.
The final targets will pick up these libraries as they will be a part of
the link interface of the module.

Technically, some of these dependencies could go into the host module,
as that's where most of the os-specific code is, but I did not try to
investigate which ones.

Reviewers: zturner, sylvestre.ledru

Subscribers: lldb-commits, mgorny

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

llvm-svn: 316997
2017-10-31 13:23:19 +00:00
Pavel Labath aee3e26c72 Increase AdbClient read timeout
The previous value was not sufficient for Pixel 2 phones. One would have
hoped that the newer phones are faster, but that does not seem to be the
case here.

llvm-svn: 316993
2017-10-31 12:27:46 +00:00
Pavel Labath 89ac0c7d32 Add data formatter for libc++'s forward_list
Summary:
This adds a data formatter for the implementation of forward_list in
libc++. I've refactored the existing std::list data formatter a bit to
enable more sharing of code (mainly the loop detection stuff).

Reviewers: jingham, EricWF

Subscribers: srhines, eugene, lldb-commits

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

llvm-svn: 316992
2017-10-31 12:27:43 +00:00
Pavel Labath e443564291 Fix mac build broken in r316987
Forgot one occurence of ArchSpec::SetTriple in mac-specific code.

llvm-svn: 316990
2017-10-31 11:48:33 +00:00
Pavel Labath 7263f1bda6 Invert ArchSpec<->Platform dependency
Summary:
ArchSpec::SetTriple was taking a Platform as an argument, and used it to
fill in missing pieces of the specified triple. I invert the dependency
by moving this code to other classes. For this purpose, I've created
three new functions.
- HostInfo::GetAugmentedArchSpec: fills in the triple using the host
  platform (this used to be implemented by passing a null platform
  pointer). By putting this code in the Host module, we can provide a
  way to anyone who does not have a platform instance (lldb-server) an
  easy way to get Host data.
- Platform::GetAugmentedArchSpec: if you have a platform instance, you
  can call this to let it fill in the triple.
- static Platform::GetAugmentedArchSpec: implements the "if platform ==
  0 then use_host() else use_platform()" part.

Reviewers: zturner, jingham, clayborg

Subscribers: mgorny, javed.absar, lldb-commits

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

llvm-svn: 316987
2017-10-31 10:56:03 +00:00
Pavel Labath 7344790005 Android.rules: build with "unified android headers"
Unified headers will be the only way to build applications in NDK r16,
and it also works with NDK r15.

This also bumps the minimum supported android version to 16.

llvm-svn: 316985
2017-10-31 10:33:03 +00:00
Pavel Labath 64325c51ad Split makefile for TestTopLevelExprs
this test was using a single makefile to build two executables. This
setup, although not supported by Makefile.rules, happened to
work in most configurations, except when building with the android ndk
r16.

Here I move the building of the second executable to a separate
makefile, which is the solution other tests use for multiple targets.

llvm-svn: 316982
2017-10-31 10:01:30 +00:00
Jim Ingham 205e5f656b Remove a stray space.
llvm-svn: 316954
2017-10-30 20:44:45 +00:00
Pavel Labath f93591b0be Fix windows build broken in r316915
I accidentally left a linux-specific include in generic code.

llvm-svn: 316919
2017-10-30 16:21:18 +00:00
Pavel Labath 3703310834 MainLoop: work around an android libc bug
Versions of android before kitkat implemented pselect non-atomically,
which caused flakyness, as we were relying on it atomically setting the
signal mask to implement waiting for signals.

This patch implements a direct call to the the pselect kernel syscall,
which does not suffer from this problem. The code itself is not very
pretty, but fortunately the uglyness is contained in the
android version of the MainLoop::RunImpl::Poll function.

llvm-svn: 316915
2017-10-30 16:00:13 +00:00
Davide Italiano 4ab13cda81 [CMake] Build clang as dependency when using in-tree clang for tests.
Discussed with Zachary Turner and Pavel Labath on lldb-dev.
Let's hope this doesn't break anything :)

llvm-svn: 316800
2017-10-27 21:22:57 +00:00
Pavel Labath c51ad4834c Add specific ppc64le hardware watchpoint handler
Summary: Add hardware watchpoint funcionality for ppc64le

Reviewers: clayborg, zturner

Reviewed By: clayborg

Subscribers: eugene, clayborg, zturner, lbianc, gut, nemanjai, alexandreyy, kbarton, lldb-commits

Differential Revision: https://reviews.llvm.org/D38897
Patch by Ana Julia Caetano <ana.caetano@eldorado.org.br>

llvm-svn: 316772
2017-10-27 17:02:32 +00:00
Pavel Labath ae7dd12a30 Fix a use-after-free in lldb-server
UriParser::Parse is returning a StringRef pointing the the parsed
string, but we were calling it with a temporary string. Change this to a
local variable to make sure the string persists as long as we need it.

llvm-svn: 316740
2017-10-27 04:53:24 +00:00
Pavel Labath 7e17fc5e09 Default to using in-tree clang for building test executables
Summary:
Using the in-tree clang should be the default test configuration as that
is the one compiler that we can be sure everyone has (better
reproducibility of test results). Also, it should hopefully reduce the
impact of pr35040.

This also reduces the number of settings which control the compiler
used. LLDB_TEST_C_COMPILER is used for C files and
LLDB_TEST_CXX_COMPILER for C++ files. Both of the settings default to
the in-tree clang.

Reviewers: zturner

Subscribers: mgorny, davide, lldb-commits

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

llvm-svn: 316728
2017-10-27 02:24:04 +00:00
Jason Molenda 6908fdb0eb Add Arm Architecture plugin to the xcode project file.
llvm-svn: 316727
2017-10-27 02:21:55 +00:00
Pavel Labath 86cf0856ae Fix TestMinidump for r316673
The test was asserting that we can only find one frame in the minidump.
Now that we have the default unwind plan from the ABI plugin, we are
able to find 5 more frames using the frame pointer chaining. Correct the
expectation in the test.

llvm-svn: 316688
2017-10-26 19:08:34 +00:00
Stephane Sezer 4ffbeeba92 Allow SysV-i386 ABI on everything other than Apple targets
Summary:
This matches other SysV ABIs that are different on Apple and non-Apple targets,
like `ABISysV_arm.cpp` for instance.

Reviewers: clayborg, emaste

Subscribers: aemerson, kristof.beyls, lldb-commits

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

llvm-svn: 316673
2017-10-26 17:04:20 +00:00
Pavel Labath 8c80a377ba Makefile.rules: move CFLAGS_EXTRAS to the end of compile line
This makes sure that any options specified there override generic
compiler options.

This fixes TestBreakpointIt.py

llvm-svn: 316629
2017-10-25 23:56:17 +00:00
Pavel Labath 13e37d4d0a Move StopInfoOverride callback to the new architecture plugin
This creates a new Architecture plugin and moves the stop info override
callback to this place. The motivation for this is to remove complex
dependencies from the ArchSpec class because it is used in a lot of
places that (should) know nothing about Process instances and StopInfo
objects.

I also add a test for the functionality covered by the override
callback.

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

llvm-svn: 316609
2017-10-25 21:05:31 +00:00
Pavel Labath c2400fc0d5 Move testcases/arm_emulation to testcases/arm/emulation
This creates space for addidional arm-specific tests. I will be adding
one of those in a follow-up commit.

llvm-svn: 316608
2017-10-25 21:05:10 +00:00
Stephane Sezer 22701b2f59 Fix a compile warning on linux
Can't cast directly between a pointer to function and a pointer to
object.

llvm-svn: 316533
2017-10-24 23:46:00 +00:00
Stephane Sezer 7b6e8ef64b Allow ObjectFilePECOFF to initialize with ARM binaries.
Summary: This is required to start debugging WinPhone ARM targets.

Reviewers: compnerd, zturner, omjavaid

Reviewed By: compnerd

Subscribers: jasonmolenda, aemerson, rengolin, lldb-commits

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

llvm-svn: 316532
2017-10-24 23:40:59 +00:00
Davide Italiano c677268721 [FreeBSD] Remove more dead code. NFCI.
llvm-svn: 316530
2017-10-24 23:31:53 +00:00
Davide Italiano 4a6dc65fcd [ExpressionParser] Garbage-collect dead code. NFCI.
llvm-svn: 316529
2017-10-24 23:29:01 +00:00
Stephane Sezer 562962f213 Remove some unused function calls from ClangUserExpression.cpp
llvm-svn: 316527
2017-10-24 23:01:33 +00:00
Stephane Sezer 30fa7e2182 Remove some dead code from ClangExpressionDeclMap.cpp
llvm-svn: 316526
2017-10-24 22:56:05 +00:00
Pavel Labath e3f6eb1a74 Revert "[lldbtests] Handle errors instead of crashing."
The commit breaks the case where you specify just a filename to the
compiler. Previously, it would look up the compiler in your path, now it
complains that the compiler is not found. One of the lldb buildbots is
depending on this. It seems like a nice feature to have, as it means
less typing and being able to avoid hard-coding the system compiler path
in the bot config.

This reverts commit r316393.

llvm-svn: 316451
2017-10-24 16:07:50 +00:00
Davide Italiano 252d7bdc67 [lldbtests] Handle errors instead of crashing.
If you pass an invalid compiler/debugger path on the cmdline to `dotest.py`  this is what you get.

  Traceback (most recent call last):
  [...]
    File "dotest.py", line 7, in <module>
      lldbsuite.test.run_suite()
  [...]

And with the patch applied:

  /home/davide/work/build-lldb/bin/clandasfasg is not a valid path, exiting

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

llvm-svn: 316393
2017-10-23 23:17:53 +00:00
Pavel Labath f877a0820c Use ipv4 localhost address in lldb-server tests
Since the ipv6 patch, we've experienced occasional flakyness in
lldb-server tests. This was due to the fact that lldb-server was trying
to listen on both v4 and v6 localhost sockets (and consider it a success
if at least one of them succeeded), while the test framework was only
trying to connect to the v4 one.

This change makes sure lldb-server only listens on the v4 socket.

llvm-svn: 316391
2017-10-23 23:15:37 +00:00
Davide Italiano dde92e58e4 [Symbol] Remove dead code. NFCI.
llvm-svn: 316390
2017-10-23 23:14:17 +00:00
Pavel Labath d813309e03 Logging: Disable logging after fork()
Summary:
We had a bug where if we had forked (in the ProcessLauncherPosixFork)
while another thread was writing a log message, we would deadlock. This
happened because the fork child inherited the locked log rwmutex, which
would never get unlocked. This meant the child got stuck trying to
disable all log channels.

The bug existed for a while but only started being apparent after
D37930, which started using ThreadLauncher (which uses logging) instead
of std::thread (which does not) for launching TaskPool threads.

The fix is to use pthread_atfork to disable logging in the forked child.

Reviewers: zturner, eugene, clayborg

Subscribers: lldb-commits

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

llvm-svn: 316368
2017-10-23 19:41:17 +00:00
Davide Italiano 9e03e17df1 [lldbtest] Simplify removing an unneeded else. NFCI.
llvm-svn: 316355
2017-10-23 17:51:22 +00:00
Pavel Labath 7b9b30ab56 lldb-server tests: Propagate environment variables (pr34192)
Summary:
Without this, the launching of the test inferior may fail if it depends
on some component of the environment (most likely LD_LIBRARY_PATH). This
makes sure we propagate the environment variable to the inferior
process.

Reviewers: eugene

Subscribers: lldb-commits

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

llvm-svn: 316244
2017-10-20 22:39:18 +00:00
Pavel Labath 6858988df3 Revert "Logging: Make sure logging machinery is in a consistent state after forking"
The pthread_atfork trick breaks on android, because
pthread_rwlock_unlock detects that it is not the same thread which
locked the lock. This means that the subsequent lock attempt will still
deadlock (only this time it happens deterministically instead of at
random). Reverting to find a better solution.

This reverts commit r316173.

llvm-svn: 316231
2017-10-20 19:44:53 +00:00
Pavel Labath 6c3c02a3bd Logging: Make sure logging machinery is in a consistent state after forking
Summary:
We had a bug where if we had forked (in the ProcessLauncherPosixFork)
while another thread was writing a log message, we would deadlock. This
happened because the fork child inherited the locked log rwmutex, which
would never get unlocked. This meant the child got stuck trying to
disable all log channels.

The bug existed for a while but only started being apparent after
D37930, which started using ThreadLauncher (which uses logging) instead
of std::thread (which does not) for launching TaskPool threads.

The fix is to use pthread_atfork to make sure noone is writing a log
message while we are forking.

Reviewers: zturner, eugene, clayborg

Subscribers: lldb-commits

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

llvm-svn: 316173
2017-10-19 17:40:51 +00:00
Pavel Labath 02af0af011 lldb-server tests: Fix undefined behavior
We were creating a StringRef pointing to a temporary string. Problem manifested
itself when running the test on osx.

llvm-svn: 316106
2017-10-18 18:52:16 +00:00
Pavel Labath 9344e45cd3 Silence some "implicit conversion of string literal" warnings
llvm-svn: 316038
2017-10-17 21:52:29 +00:00
Pavel Labath c596e9088f lldb-server tests: Add support for testing debugserver
Summary:
This adds support for running the lldb-server test suite (currently consisting
of only one test) against the debugserver. Currently, the choice which binary
to test is based on the host system. This will need to be replaced by something
more elaborate if/when lldb-server starts supporting debugging on darwin.

I need to make a couple of tweaks to the test client to work with debugserver:
- debugserver has different command-line arguments - launching code adjusted to
  handle that
- debugserver sends duplicate "medata" fields in the stop reply packet -
  adjusted stop-reply parsing code to handle that
- debugserver replies to the k packet instead of just dropping the connection -
  stopping code adjusted, although we should probably consider aligning the
  behavior of the two stubs in this case

Reviewers: jmajors, beanz

Subscribers: srhines, mgorny, lldb-commits

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

llvm-svn: 316010
2017-10-17 16:28:28 +00:00
Pavel Labath a5be48b3e0 Remove shared_pointer from NativeThreadProtocol
Summary:
The NativeThread class is useless without the containing process (and in
some places it is already assuming the process is always around). This
makes it clear that the NativeProcessProtocol is the object owning the
threads, and makes the destruction order deterministic (first threads,
then process). The NativeProcess is the only thing holding a thread
unique_ptr, and methods that used to hand out thread shared pointers now
return raw pointers or references.

Reviewers: krytarowski, eugene

Subscribers: lldb-commits

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

llvm-svn: 316007
2017-10-17 15:52:16 +00:00
Jason Molenda ef96986a1f Reverting r315966 - it caused a build failure on an ubuntu x android bot.
llvm-svn: 315967
2017-10-17 03:13:39 +00:00
Jason Molenda 695a1f6e6c Committing this for Larry D'Anna:
This patch adds support for passing an arbitrary python stream
(anything inheriting from IOBase) to SetOutputFileHandle or
SetErrorFileHandle.

Differential revision: https://reviews.llvm.org/D38829
<rdar://problem/34870417> 

llvm-svn: 315966
2017-10-17 03:03:44 +00:00
Jim Ingham 8bebdff49e The save_crashlog command was still looking at lldb.target and
lldb.process.  That hasn't worked for a long time.  Convert it
to the form that takes an SBExecutionContext and use that instead.

llvm-svn: 315549
2017-10-12 02:21:41 +00:00
Ted Woodward 66060cf1f9 Add cases for new type DependentAddressSpace, added in r314649
llvm-svn: 315524
2017-10-11 22:42:21 +00:00
Ted Woodward 2ecfd62938 Remove default case from switch.
Add case to handle new event lldb::eBreakpointEventTypeAutoContinueChanged.

llvm-svn: 315496
2017-10-11 19:38:35 +00:00
Petr Pavlu dbd7c338a0 Fix dumping of characters with non-standard sizes
* Prevent dumping of characters in DumpDataExtractor() with
  item_byte_size bigger than 8 bytes. This case is not supported by the
  code and results in a crash because the code calls
  DataExtractor::GetMaxU64Bitfield() -> GetMaxU64() that asserts for
  byte size > 8 bytes.
* Teach DataExtractor::GetMaxU64(), GetMaxU32(), GetMaxS64() and
  GetMaxU64_unchecked() how to handle byte sizes that are not a multiple
  of 2. This allows DumpDataExtractor() to dump characters and booleans
  with item_byte_size in the interval of [1, 8] bytes. Values that are
  not a multiple of 2 would previously result in a crash because they
  were not handled by GetMaxU64().

llvm-svn: 315444
2017-10-11 08:48:18 +00:00
Alexander Shaposhnikov 64b4bcfa05 [lldb] Enable using out-of-tree dwps
Previously LLDB required the DWP file 
to be located next to the executable file.
This diff uses the helper function 
Symbols::LocateExecutableSymbolFile to search for 
DWP files in the standard locations for debug symbols.

Test plan:

Build a toy test example:
main.cpp
clang -gsplit-dwarf -g -O0 main.cpp -o main.exe
llvm-dwp -e main.exe -o main.exe.dwp
mkdir -p debug_symbols
mv main.exe.dwp debug_symbols/main.exe.dwp

Run lldb:
lldb
settings set target.debug-file-search-paths ./debug_symbols
file ./main.exe
br set --name f
run

Check that debugging works:
setting breakpoints, printing local variables.

Differential revision: https://reviews.llvm.org/D38568

llvm-svn: 315387
2017-10-10 23:28:34 +00:00
Peter Collingbourne 0dfdb44797 Support: Have directory_iterator::status() return FindFirstFileEx/FindNextFile results on Windows.
This allows clients to avoid an unnecessary fs::status() call on each
directory entry. Because the information returned by FindFirstFileEx
is a subset of the information returned by a regular status() call,
I needed to extract a base class from file_status that contains only
that information.

On my machine, this reduces the time required to enumerate a ThinLTO
cache directory containing 520k files from almost 4 minutes to less
than 2 seconds.

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

llvm-svn: 315378
2017-10-10 22:19:46 +00:00
Stephane Sezer 7c6d1c3171 Update ABISysV_arm64::RegisterIsVolatile to accept registers prefixed with r
Summary:
While the specification says that the 64bit registers are prefixed with
`x`, it seems that many people still use `r`. Until recently, we had been using
the `r` prefix instead of the `x` prefix in ds2. This caused lldb to fail during
unwinding. I think it's reasonable to check for a register prefixed with `r`,
since some people still choose to use `r`.

Reviewers: sas, fjricci, clayborg

Reviewed By: sas, clayborg

Subscribers: aemerson, javed.absar, kristof.beyls

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

Change by Alex Langford <apl@fb.com>

llvm-svn: 315221
2017-10-09 17:49:32 +00:00
Davide Italiano b06e8fa223 [DWARFDIE] Rewrite `operator !=` using `operator ==`. NFCI.
llvm-svn: 315200
2017-10-09 00:18:45 +00:00
Davide Italiano 54bb5ea21a [SymbolFile/DWARF] Simplify two functions. NFCI.
llvm-svn: 315199
2017-10-09 00:11:49 +00:00
Jason Molenda c1b1655871 Remove the input file specification from the
"Prepare Swig Bindings" shell script phase; it
wasn't the actual input file and could lead
to incorrect dependency analysis by the build
system.
<rdar://problem/34751196> 

llvm-svn: 315135
2017-10-07 00:13:10 +00:00
Jason Molenda ba0f4339a7 Specify the input & output results of the "Prepare Swig Bindings"
shell script phase to aid build systems.
<rdar://problem/34751196> 

llvm-svn: 315123
2017-10-06 22:43:42 +00:00
Chris Bieneman cc59060063 [CMake] Add LLDB_INCLUDE_TESTS variable
This behaves like the other *_INCLUDE_TESTS variables in CMake and is tied to LLVM_INCLUDE_TESTS so that if you're building in-tree and not building the LLVM tests, you also won't build the LLDB tests.

llvm-svn: 315120
2017-10-06 22:21:36 +00:00
Leonard Mosescu 17ffd39ed8 Implement interactive command interruption
The core of this change is the new CommandInterpreter::m_command_state,
which models the state transitions for interactive commands, including
an "interrupted" state transition.

In general, command interruption requires cooperation from the code
executing the command, which needs to poll for interruption requests
through CommandInterpreter::WasInterrupted().

CommandInterpreter::PrintCommandOutput() implements an optionally
interruptible printing of the command output, which for large outputs 
was likely the longest blocking part.
(ex. target modules dump symtab on a complex binary could take 10+ minutes)

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

llvm-svn: 315037
2017-10-05 23:41:28 +00:00
Eugene Zemtsov aae0a752c5 Enable breakpoints and read/write GPRs for ppc64le
Add support for ppc64le to create breakpoints and read/write
general purpose registers.
Other features for ppc64le and functions to read/write
other registers are being implemented.

Patch by Alexandre Yukio Yamashita (alexandreyy)
Differential Revision: https://reviews.llvm.org/D38323

llvm-svn: 315008
2017-10-05 19:44:05 +00:00
Jim Ingham f539174f9a Work around a bug in the C++ expression parser.
When the expression parser does name resolution for local
variables in C++ closures it doesn't give the local name
priority over other global symbols of the same name.  heap.py
uses "info" which is a fairly common name, and so the commands
in it fail.  This is a workaround, just use lldb_info not info.

<rdar://problem/34026140>

llvm-svn: 314959
2017-10-05 01:00:29 +00:00
Jim Ingham a6976269bd Another silly little thing you can do with Python commands.
Sometimes you want to step along and print a local each time as you go.
You can do that with stop hooks, but that's a little heavy-weight.  This
is a sketch of a command that steps and then does "frame variable" on all
its arguments.

llvm-svn: 314958
2017-10-05 00:49:49 +00:00
Leonard Mosescu 63ed8c6c2e LLDB cmake fix: define LLDB_CONFIGURATION_xxx based on the build type
Neither LLDB_CONFIGURATION_DEBUG nor LLDB_CONFIGURATION_RELEASE were ever set in the CMake LLDB project.

Also cleaned up a questionable #ifdef in SharingPtr.h, removing all the references to LLDB_CONFIGURATION_BUILD_AND_INTEGRATION in the process.

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

llvm-svn: 314929
2017-10-04 20:23:56 +00:00
Tim Hammerquist a6db41675c cmake + xcode: prevent gtests from using includes from project root
Summary:
At present, several gtests in the lldb open source codebase are using
#include statements rooted at $(SOURCE_ROOT)/${LLDB_PROJECT_ROOT}.

This patch cleans up this directory/include structure for both CMake and
Xcode build systems.

rdar://problem/33835795

Reviewers: zturner, jingham, beanz

Reviewed By: beanz

Subscribers: emaste, lldb-commits, mgorny

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

llvm-svn: 314849
2017-10-03 21:20:18 +00:00
Alexander Shaposhnikov 56138de385 [lldb] Fix initialization of m_debug_cu_index_map
SymbolFileDWARFDwp contains m_debug_cu_index_map which was previously 
initialized incorrectly: before m_debug_cu_index.parse 
is called m_debug_cu_index is empty, thus 
the map was not actually getting populated properly. 
This diff moves this step into a private helper method
and calls it after m_debug_cu_index.parse inside SymbolFileDWARFDwp::Create.

Test plan:

Build a toy test example 
main.cpp
clang -gsplit-dwarf -g -O0 main.cpp -o main.exe
llvm-dwp -e main.exe -o main.exe.dwp
Build LLDB with ENABLE_DEBUG_PRINTF set.
Run: lldb -- ./main.exe
Check that the indexes are now correct 
(before this change they were empty)
Check that debugging works 
(setting breakpoints, printing local variables (this was not working before))

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

llvm-svn: 314832
2017-10-03 19:56:21 +00:00
Jason Molenda a7e7d90d9f Move install_name_tool to a separate make target.
llvm-svn: 314731
2017-10-02 22:11:22 +00:00
Ed Maste d13f691f41 Improve FreeBSD kernel debugging
FreeBSD kernel modules are actually relocatable (.o) ELF files and this
previously caused some issues for LLDB. This change addresses these when
using lldb to symbolicate FreeBSD kernel backtraces. 

The major problems:

- Relocations were not being applied to the DWARF debug info despite
  there being code to do this. Several issues prevented it from working:

  - Relocations are computed at the same time as the symbol table, but
    in the case of split debug files, symbol table parsing always
    redirects to the primary object file, meaning that relocations would
    never be applied in the debug file.

  - There's actually no guarantee that the symbol table has been parsed
    yet when trying to parse debug information.

  - When actually applying relocations, it will segfault because the
    object files are not mapped with MAP_PRIVATE and PROT_WRITE.

- LLDB returned invalid results when performing ordinary address-to-
  symbol resolution. It turned out that the addresses specified in the
  section headers were all 0, so LLDB believed all the sections had
  overlapping "file addresses" and would sometimes return a symbol from
  the wrong section.

Patch by Brian Koropoff

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

llvm-svn: 314672
2017-10-02 14:35:07 +00:00
Davide Italiano 54fcf82454 [lldb-mi] Fix a thinko in my previous commit.
Hopefully this should unbreak the Android buildbot.

llvm-svn: 314606
2017-09-30 21:52:31 +00:00
Davide Italiano d4e450aca2 [lldb-mi] Add a default case to placate GCC with -Werror.
llvm-svn: 314604
2017-09-30 21:30:41 +00:00
Davide Italiano fe34df5951 [ExpressionParser] Prefer isa<> to dyn_cast<>. NFCI.
The result type is unused anyway.

llvm-svn: 314602
2017-09-30 21:16:56 +00:00
Eugene Zemtsov 74e94836e7 Fix Android remote debugging tests running on Windows
Use make based OS check, instad of relying on shell.

llvm-svn: 314488
2017-09-29 03:25:25 +00:00
Eugene Zemtsov a9d928c396 Fix compilation error
llvm-svn: 314487
2017-09-29 03:15:08 +00:00
Sean Callanan 68e4423917 [Expression parser] Setting to enable use of ExternalASTMerger
This setting can be enabled like this at the target level:

(lldb) settings set target.experimental.use-modern-type-lookup true

This causes several new behaviors in the Clang expression parser:

- It completely disables use of ClangASTImporter.  None are created
  at all, and all users of it are now conditionalized on its
  presence.

- It instead constructs a per-expression ExternalASTMerger, which
  exists inside Clang and contains much of the type completion
  logic that hitherto lived in ExternalASTSource,
  ClangExpressionDeclMap, and ClangASTImporter.

- The expression parser uses this Merger as a backend for copying
  and completing types.

- It also constructs a persistent ExternalASTMerger which is
  connected to the Target's persistent AST context.

This is a major chunk of LLDB functionality moved into Clang.  It
can be tested in two ways:

1. For an individual debug session, enable the setting before
   running a target.

2. For the testsuite, change the option to be default-true.  This
   is done in Target.cpp's g_experimental_properties.  The
   testsuite is not yet clean with this, so I have not committed
   that switch.

I have filed a Bugzilla for extending the testsuite to allow
custom settings for all tests:
  https://bugs.llvm.org/show_bug.cgi?id=34771

I have also filed a Bugzilla for fixing the remaining testsuite
failures with this setting enabled:
  https://bugs.llvm.org/show_bug.cgi?id=34772

llvm-svn: 314458
2017-09-28 20:20:25 +00:00
Stephane Sezer 2ca6c3da63 Add a few missing newlines in lldb-server messages
Reviewers: fjricci, clayborg

Subscribers: lldb-commits

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

llvm-svn: 314455
2017-09-28 19:49:00 +00:00
Jim Ingham 8c9ecc5010 Revert patch r313904, as it breaks "command source" and in
particular causes lldb to die on startup if you have a ~/.lldbinit file.

I filed:

https://bugs.llvm.org/show_bug.cgi?id=34758

to cover fixing the bug.

llvm-svn: 314371
2017-09-28 01:39:07 +00:00
Jason Molenda bfee0a506f Change build-llvm.py and build-lldb-llvm-clang's patching mechanisms to
assume git-style diffs.  Committing for Francis Ricci.

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

llvm-svn: 314366
2017-09-27 23:44:54 +00:00
Jason Molenda 11ff56c958 Add support for running the lldb testsuite against an apple watch
running watchos.  These tests cannot run on normal customer devices,
but I hope to some day have a public facing bot running against a
device.

llvm-svn: 314355
2017-09-27 22:12:54 +00:00
Jason Molenda 300fd45326 Update the Objective-C runtime interface code to handle objc objects
whose isa is an index instead of a pointer.  Currently, this type
of isa encoding is only used on watchos.
<rdar://problem/34675497> 

llvm-svn: 314343
2017-09-27 20:56:32 +00:00
Jason Molenda 1d23cb4e7e Update ABIMacOSX_arm::PrepareTrivialCall to correctly align the
stack pointer for apple's armv7 ABI.  When in a frameless function
or in a prologue/epilogue where sp wasn't properly aligned, we could
try to make function calls with an unaligned sp; the expression
would crash.

llvm-svn: 314265
2017-09-27 02:49:18 +00:00
Sean Callanan 1b3c43b6dd [Expression Parser] Inhibit global lookups for symbols in the IR dynamic checks
The IR dynamic checks are self-contained functions whose job is to

- verify that pointers referenced in an expression are valid at runtime; and
- verify that selectors sent to Objective-C objects by an expression are
  actually supported by that object.

These dynamic checks forward-declare all the functions they use and should not
require any external debug information. The way they ensure this is by marking
all the names they use with a dollar sign ($). The expression parser recognizes
such symbols and perform no lookups for them.

This patch fixes three issues surrounding the use of the dollar sign:

- to fix a MIPS issue, the name of the pointer checker was changed from
  starting with $ to starting with _$, but this was not properly ignored; and
- the Objective-C object checker used a temporary variable that did not start
  with $.
- the Objective-C object checker used an externally-defined struct (struct
  objc_selector) but didn't need to.

The patch also implements some cleanup in the area:

- it reformats the string containing the Objective-C object checker,
  which was mangled horribly when the code was transformed to a uniform width
  of 80 columns, and
- it factors out the logic for ignoring global $-symbols into common code
  shared between ClangASTSource and ClangExpressionDeclMap.

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

llvm-svn: 314225
2017-09-26 17:25:34 +00:00
Jason Molenda ce9606dd4f Remove the details of the libstdc++ implementation that were
in TestDataFormatterSkipSummary.py - I'm building this test
with the default c++ library.

Skip TestMTCSimple.py when running for i386.

llvm-svn: 314155
2017-09-25 21:23:37 +00:00
Jason Molenda 8652b249e6 Initial patchset to get the testsuite running against armv7 and arm64 iOS devices.
Normal customer devices won't be able to run these tests, we're hoping to get
a public facing bot set up at some point.  Both devices pass the testsuite without
any errors or failures.

I have seen some instability with the armv7 test runs, I may submit additional patches
to address this.  arm64 looks good.

I'll be watching the bots for the rest of today; if any problems are introduced by
this patch I'll revert it - if anyone sees a problem with their bot that I don't
see, please do the same.  I know it's a rather large patch.

One change I had to make specifically for iOS devices was that debugserver can't 
create files.  There were several tests that launch the inferior process redirecting
its output to a file, then they retrieve the file.  They were not trying to test
file redirection in these tests, so I rewrote those to write their output to a file
directly.

llvm-svn: 314132
2017-09-25 18:19:39 +00:00
Eugene Zemtsov 3015341d45 Use socketpair on all Unix platforms
Using TCP sockets is insecure against local attackers, and possibly
against remote attackers too (some vulnerabilities may allow tricking a
browser to make a request to localhost). Use socketpair (which is immune
to such attacks) on all Unix platforms.

Patch by Demi Marie Obenour < demiobenour@gmail.com >

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

llvm-svn: 314127
2017-09-25 17:41:16 +00:00
Chris Bieneman 9568a5102e Revert "Initial patchset to get the testsuite running against armv7 and arm64 iOS devices. Normal customer devices won't be able to run these devices, we're hoping to get a public facing bot set up at some point. Both devices pass the testsuite without any errors or failures."
This patch has been causing LLDB test failures on ObjC tests. A test log
may still be available here:

http://lab.llvm.org:8080/green/view/LLDB/job/lldb/1650/

This reverts commit r314038.

llvm-svn: 314122
2017-09-25 17:31:40 +00:00
Stephane Sezer 85317f23df Implement trampoline step-through for Windows-x86.
Summary:
This is required to be able to step through calls to external functions
that are not properly marked with __declspec(dllimport). When a call
like this is emitted, the linker will inject a trampoline to produce an
indirect call through the IAT.

Reviewers: zturner, jingham

Reviewed By: jingham

Subscribers: sas, jingham, lldb-commits

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

llvm-svn: 314045
2017-09-22 23:41:41 +00:00
Jason Molenda 0187a8f6f9 Initial patchset to get the testsuite running against armv7 and arm64 iOS devices.
Normal customer devices won't be able to run these devices, we're hoping to get
a public facing bot set up at some point.  Both devices pass the testsuite without
any errors or failures.

I have seen some instability with the armv7 test runs, I may submit additional patches
to address this.  arm64 looks good.

I'll be watching the bots for the rest of today; if any problems are introduced by
this patch I'll revert it - if anyone sees a problem with their bot that I don't
see, please do the same.  I know it's a rather large patch.

One change I had to make specifically for iOS devices was that debugserver can't 
create files.  There were several tests that launch the inferior process redirecting
its output to a file, then they retrieve the file.  They were not trying to test
file redirection in these tests, so I rewrote those to write their output to a file
directly.

llvm-svn: 314038
2017-09-22 22:34:53 +00:00
Jason Molenda 2d5d71c061 Revert this patch; I was emailing with Eugene and they have some other changes going
in today and don't want the two changes to confuse the situation with the build bots.
I'll commit tomorrow once they're known good.

llvm-svn: 313934
2017-09-21 23:02:56 +00:00
Jason Molenda 182a8083c1 Initial patchset to get the testsuite running against armv7 and arm64 iOS devices.
Normal customer devices won't be able to run these devices, we're hoping to get
a public facing bot set up at some point.

There will be some smaller follow-on patches.  The changes to tools/lldb-server are
verbose and I'm not thrilled with having to skip all of these tests manually.
There are a few places where I'm making the assumption that "armv7", "armv7k", "arm64"
means it's an ios device, and I need to review & clean these up with an OS check
as well.  (Android will show up as "arm" and "aarch64" so by pure luck they shouldn't
cause problems, but it's not an assumption I want to rely on).

I'll be watching the bots for the rest of today; if any problems are introduced by
this patch I'll revert it - if anyone sees a problem with their bot that I don't
see, please do the same.  I know it's a rather large patch.

One change I had to make specifically for iOS devices was that debugserver can't 
create files.  There were several tests that launch the inferior process redirecting
its output to a file, then they retrieve the file.  They were not trying to test
file redirection in these tests, so I rewrote those to write their output to a file
directly.

llvm-svn: 313932
2017-09-21 23:00:19 +00:00
Adrian McCarthy 977996d25b [LLDB] Implement interactive command interruption
The core of this change is the new CommandInterpreter::m_command_state, which
models the state transitions for interactive commands, including an
"interrupted" state transition.

In general, command interruption requires cooperation from the code executing
the command, which needs to poll for interruption requests through
CommandInterpreter::WasInterrupted().

CommandInterpreter::PrintCommandOutput() implements an optionally
interruptible printing of the command output, which for large outputs was
likely the longest blocking part.  (ex. target modules dump symtab on a
complex binary could take 10+ minutes)

patch by lemo

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

llvm-svn: 313904
2017-09-21 19:36:52 +00:00
Ted Woodward 4355c7c562 Fix warning caused by new clang::BuiltinType::Float16 added in r312794
llvm-svn: 313799
2017-09-20 19:16:53 +00:00
Adrian McCarthy 6c84ffbf5f Fix the SIGINT handlers
1. Fix a data race (g_interrupt_sent flag usage was not thread safe, signals
can be handled on arbitrary threads)

2. exit() is not signal-safe, replaced it with the signal-safe equivalent
_exit()

(This differs from the patch on Phabrictor because I had to add
`#include <atomic>` to get the definition of `std::atomic_flag`.)

patch by lemo

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

llvm-svn: 313785
2017-09-20 18:09:39 +00:00
Eugene Zemtsov e768daad6e Signal polling is supported with pselect (re-land r313704 without a Windows breakage)
Older Android API levels don't have ppoll, but LLDB works just fine,
since on Android it always uses pselect anyway.

llvm-svn: 313726
2017-09-20 06:56:46 +00:00
Eugene Zemtsov b207d12456 Rollback r313704 because of the Windows build break
llvm-svn: 313707
2017-09-20 01:57:59 +00:00
Eugene Zemtsov 4ce010e775 Signal polling is supported with pselect
Older Android API levels don't have ppoll, but LLDB works just fine,
since on Android it always uses pselect anyway.

llvm-svn: 313704
2017-09-20 00:39:04 +00:00