Commit Graph

16730 Commits

Author SHA1 Message Date
Pavel Labath 93a582c00a llgs-tests: Add support for "exit" stop-reply packets
Summary:
This makes StopReply class abstract, so that we can represent different
types of stop replies such as StopReplyStop and StopReplyExit (there
should also be a StopReplySignal, but I don't need that right now so I
haven't implemented it yet).

This prepares the ground for a new test I'm writing.

Reviewers: eugene, zturner

Subscribers: lldb-commits

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

llvm-svn: 320820
2017-12-15 15:19:45 +00:00
Pavel Labath 4c2eb8b244 Fix 32-bit builds broken by 320813
cast to size_t to avoid narrowing error.

llvm-svn: 320816
2017-12-15 14:39:12 +00:00
Pavel Labath e2867bc4a0 ObjectFileELF: Add support for compressed sections
Summary:
We use the llvm decompressor to decompress SHF_COMPRESSED sections. This enables
us to read data from debug info sections, which are sometimes compressed,
particuarly in the split-dwarf case.  This functionality is only available if
llvm is compiled with zlib support.

Reviewers: clayborg, zturner

Subscribers: emaste, mgorny, aprantl, lldb-commits

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

llvm-svn: 320813
2017-12-15 14:23:58 +00:00
Pavel Labath 671d3e6318 llgs-tests: Make addition of new tests easier
Summary:
Adding a new test would require one to duplicate a significant part of
the existing test that we have. This attempts to reduce that by moving
some part of that code to the test fixture. The StandardStartupTest
fixture automatically starts up the server and connects it to the
client. I also add a more low-level TestBase fixture, which allows one
to start up the client and server in a custom way (I am going to need
this for the test I am writing).

Reviewers: eugene, zturner

Subscribers: lldb-commits, mgorny

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

llvm-svn: 320809
2017-12-15 13:56:22 +00:00
Davide Italiano 89419f88bc [ExpressionParser] Fix evaluation failures due to mismatch in C++ versions.
Clang recently switched to C++14 (with GNU extensions) as the default
dialect, but LLDB didn't catch up. This causes failures as LLDB still
evaluates ObjectiveC expressions as Objective C++ using C++98 as standard.

There are things not available in C++98, including, e.g. nullptr.
In some cases Objective-C `nil` is defined as `nullptr` so this causes
an evaluation failure. Switch the default to overcome this issue
(actually, currently lldb evaluates both C++11 and C++14 as C++11,
but that seems a larger change and definitely could be re-evaluated
in the future).

No test as this is currently failing on the LLDB bots after the clang
switch (so, de facto, there's a test already for it).

This is a recommit, with a thinko fixed (the code was previously
placed incorrectly).

<rdar://problem/36011995>

llvm-svn: 320778
2017-12-15 00:50:43 +00:00
Davide Italiano 75dfd9a525 [ExpressionParser] Rollback C++98 as the standard for evaluating.
Some ubuntu bots are failing with this patch in, let me unblock
while I investigate.

llvm-svn: 320769
2017-12-15 00:00:17 +00:00
Davide Italiano d416b0b903 [ExpressionParser] Fix evaluation failures due to mismatch in C++ versions.
Clang recently switched to C++14 (with GNU extensions) as the default
dialect, but LLDB didn't catch up. This causes failures as LLDB still
evaluates ObjectiveC expressions as Objective C++ using C++98 as standard.

There are things not available in C++98, including, e.g. nullptr.
In some cases Objective-C `nil` is defined as `nullptr` so this causes
an evaluation failure. Switch the default to overcome this issue
(actually, currently lldb evaluates both C++11 and C++14 as C++11,
but that seems a larger change and definitely could be re-evaluated
in the future).

No test as this is currently failing on the LLDB bots after the clang
switch (so, de facto, there's a test already for it).

<rdar://problem/36011995>

llvm-svn: 320761
2017-12-14 23:11:15 +00:00
Davide Italiano f550ed1abd [ClangASTContext] Remove dead stuff found fixing something else.
llvm-svn: 320759
2017-12-14 23:03:35 +00:00
Pavel Labath f1208e7aef ObjectFile: remove ReadSectionData/MemoryMapSectionData mutual recursion
Summary:
These two functions were calling each other, while handling different
branches of the if(IsInMemory()). This had a reason at some point in the
past, but right now it's just confusing.

I resolve this by removing the MemoryMapSectionData function and
inlining the !IsInMemory branch into ReadSectionData. There isn't
anything mmap-related in this function anyway, as the decision whether
to mmap is handled at a higher level.

This is a preparatory step to make ObjectFileELF be able to decompress
compressed sections (I want to make sure that all calls reading section
data are routed through a single piece of code).

Reviewers: clayborg

Subscribers: emaste, JDevlieghere, lldb-commits

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

llvm-svn: 320705
2017-12-14 14:56:45 +00:00
Pavel Labath 8630d3871d Remove stderr message from GDBRemoteCommunicationServerLLGS
A similar error message is printed again in lldb-gdbserver.cpp, so the
user will see the message twice. Also, this is generic library code, we
shouldn't really be using stderr here.

llvm-svn: 320704
2017-12-14 14:56:29 +00:00
Davide Italiano b32f389c91 [IRExecutionUnit] Initialize uninititialized member variable.
Found by the ubsan build.

<rdar://problem/31106358>

llvm-svn: 320541
2017-12-13 01:41:17 +00:00
Davide Italiano 64c2760ecb [DataEncoder] Replace buggy versions of write functions.
This fixes a previously introduced thinko, now that I have
a better idea of what's going on :)

<rdar://problem/35941757>

llvm-svn: 320540
2017-12-13 01:41:16 +00:00
Petr Hosek eb8301413a [lldb] Set component when invoking add_llvm_install_targets
This is needed to ensure that the distribution and install-distribution
targets work properly.

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

llvm-svn: 320537
2017-12-13 01:14:27 +00:00
Vedant Kumar c8e1c0945a Add an #include to appease an older clang, NFC
Add in a missing #include that AppleClang-900 complains about when
building with -DLLVM_ENABLE_MODULES.

llvm-svn: 320522
2017-12-12 20:19:40 +00:00
Vedant Kumar 08ff404308 Avoid module import in a textual header, NFC
This unbreaks the lldb modules build (-DLLVM_ENABLE_MODULES=On).

llvm-svn: 320456
2017-12-12 03:27:13 +00:00
Davide Italiano 074f858da7 [TestModulesInlineFunctions] This test now passes.
Remove yet another spurious unexpected success.
Ack'ed by Jim Ingham.

Fixes PR25743.

llvm-svn: 320454
2017-12-12 02:52:01 +00:00
Davide Italiano 4b13d8bdf3 [TestCppScope] This test now passes on Darwin.
I tested on x86-64 and Jason on embedded architectures.
This cleans up another couple of reported unexpected successes.

<rdar://problem/28623427>

llvm-svn: 320452
2017-12-12 02:32:49 +00:00
Davide Italiano e8d85eaaa7 [testsuite] Remove even more testing vestiges.
With this one, the number of unexpected successes for the LLDB
test suite when building with clang ToT goes down to 18.

llvm-svn: 320450
2017-12-12 02:10:23 +00:00
Davide Italiano ee710e1d00 Rollback [Testsuite] Rename this file from *m -> *mm.
After discussing this with Jim and Jason, I think my commit was
actually sweeping the issue under the carpet rather than fixing it.
I'll take a closer look between tonight and tomorrow.

llvm-svn: 320447
2017-12-12 01:21:43 +00:00
Davide Italiano 53cff5161c [testsuite] Remove testing failures vestiges.
Some tests are failing on macOS when building with the in-tree
clang, and this is because they're conditional on the version released.
Apple releases using a different versioning number, but as these are
conditional on clang < 7, they fail for clang ToT (which is 6.0).
As a general solution, we actually need either a mapping between
Apple internal release version and public ones.

That said, I discussed this with Fred , and Apple Clang 6.0 seems
to be old enough that we can remove this altogether (which means I
can delay implementing the general purpose solution for a bit).

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

llvm-svn: 320444
2017-12-12 01:14:11 +00:00
Shoaib Meenai ac75523108 [lldb] Switch to add_llvm_install_targets
This adds the install-*-stripped targets to LLDB, which are required for
the install-distribution-stripped option. We also need to create some
install-*-stripped targets manually, which are modeled after their
corresponding install-* targets.

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

llvm-svn: 320443
2017-12-12 00:47:07 +00:00
Davide Italiano ecff6ac373 [test-suite] Un'XFAIL a test that's not failing anymore.
This is the first of a series of commits aiming to improve
overall LLDB's hygiene. Feel free to shout at me in case
I break something.

<rdar://problem/30915340>

llvm-svn: 320425
2017-12-11 21:52:02 +00:00
Davide Italiano 9b8649c88d [Testsuite] Rename this file from *m -> *mm.
Should hopefully bring the bots back.

<rdar://problem/35976115>

llvm-svn: 320422
2017-12-11 21:21:53 +00:00
Pavel Labath e0b61e3c9a dotest.py: Correctly annotate lldbinline tests with debug info categories
This enables one to run all dwo tests with dotest.py --category dwo, or
skip them with --skip-category.

llvm-svn: 320377
2017-12-11 15:28:21 +00:00
Pavel Labath c58a80ff47 Add a StringList constructor to Args class
Host::GetEnvironment returns a StringList, but the interface for
launching a process takes Args. The fact that we use two classes for
representing an environment is not ideal, but for now we should at least
have an easy way to convert between the two.

llvm-svn: 320366
2017-12-11 14:22:30 +00:00
Pavel Labath 293d6c39d3 Fix osx build broken in r320346
llvm-svn: 320349
2017-12-11 11:12:22 +00:00
Pavel Labath 07d6f881e7 Move PseudoTerminal to the lldb_private namespace
lldb_utility doesn't make sense, as it is no longer even living in the
"utility" module.

llvm-svn: 320346
2017-12-11 10:09:14 +00:00
Pavel Labath 390b487994 MainLoop: avoid infinite loop when pty slave gets closed
Summary:
For ptys (at least on Linux), the end-of-file (closing of the slave FD)
is signalled by the POLLHUP flag. We were ignoring this flag, which
meant that when this happened, we would spin in a loop, continuously
calling poll(2) and not making any progress.

This makes sure we treat POLLHUP as a read event (reading will return
0), and we call the registered callback when it happens. This is the
behavior our clients expect (and is consistent with how select(2)
works).

Reviewers: eugene, beanz

Subscribers: lldb-commits

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

llvm-svn: 320345
2017-12-11 09:33:18 +00:00
Davide Italiano 226aab7cdb Revert "[DataEncoder] Replace buggy versions of write functions."
The commit exposes a bunch of failures in the LLDB testsuite that
I need to analyze more carefully. Reverting for now.

llvm-svn: 320341
2017-12-11 05:09:35 +00:00
Davide Italiano dd6d037284 [DarwinLog] Remove other dead code. Found while reading this file.
llvm-svn: 320338
2017-12-10 23:49:23 +00:00
Davide Italiano 1209c4b4e7 [MachException] Garbage collect unused and dead code.
llvm-svn: 320337
2017-12-10 23:33:33 +00:00
Davide Italiano d752d6b4be [DataEncoder] Replace buggy versions of write functions.
They cause an ubsan error when ran through the testsuite (store
to misaligned address is UB). This commit kills two birds with
one stone, as we also remove some code while fixing it.

<rdar://problem/35941757>

llvm-svn: 320335
2017-12-10 22:54:07 +00:00
Jason Molenda aae5b69079 Change uses of strncpy in debugserver to strlcpy
for better safety.

<rdar://problem/32906923> 

llvm-svn: 320242
2017-12-09 03:37:09 +00:00
Jason Molenda 1bfb9f1c0f Change the ordering that we search for kexts and kernels on the local
computer.  When doing kernel debugging, lldb scrapes around a few 
well-known locations to find kexts and kernels.  It builds up two
lists - kexts and kernels with dSYM, and kexts and kernels without dSYMs.
After both lists have failed to provide a file, then we'll call out
to things like the DebugSymbols framework to find a kext/kernel.

This meant that when you had a kext/kernel on the local computer that
did not have debug information, lldb wouldn't consult DebugSymbols etc
once it'd locked on to one of these no-debug-info binaries on the local
computer.

Reorder this so we give DebugSymbols etc a shot at finding a debug-info
file before we use any of the no-debug-info binaries that were found on
the system.

<rdar://problem/34434440> 

llvm-svn: 320241
2017-12-09 03:28:15 +00:00
Jason Molenda 6e78b6bd8e Update PlatformDarwin::GetDeveloperDir to handle the two
most common cases where the Xcode.app bundle puts lldb -
either as a default part of the bundle, or in a toolchain
subdirectory, so the platform subclasses can find files
relative to this directory.

Dropped support for handling the case where the lldb
framework was in /Library/PrivateFrameworks.  I think
this was intended to handle the case where lldb is installed
in / (outside the Xcode.app bundle) - but in that case, we
can look in the raw directory file paths to find anything.

<rdar://problem/35285622> 

llvm-svn: 320240
2017-12-09 03:06:19 +00:00
Vedant Kumar 9c36859b33 [MachException] Avoid alignment UB, NFC
Fix alignment UB in some Mach exception-handling logic.

This lets us build lldb and debugserver with UBSan in trapping mode, and
get further along in the testing process before a trap is encountered.

rdar://35923991

llvm-svn: 320127
2017-12-08 01:09:40 +00:00
Vedant Kumar b773e488c9 Remove extant references to g_message_mutex, NFC
Thanks to Jim Ingham for providing the explanation!

llvm-svn: 320126
2017-12-08 01:09:39 +00:00
Jim Ingham 6c96486962 These tests don't depend on debug info format.
Mark them as such.

llvm-svn: 320077
2017-12-07 19:44:09 +00:00
Vedant Kumar 9df6e0a5ea Disable warnings related to anonymous types in the ObjC plugin
This part of lldb make use of anonymous structs and unions. The usage is
idiomatic and doesn't deserve a warning. Logic in the NSDictionary and NSSet
plugins use anonymous structs in a manner consistent with the relevant Apple
frameworks.

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

llvm-svn: 320071
2017-12-07 18:57:09 +00:00
Davide Italiano e2564051be [SBBreakpointOptionCommon] Give this class an explicit destructor.
llvm-svn: 320067
2017-12-07 18:06:06 +00:00
Davide Italiano c218ee58ac [SBBreakpoint] Outline some functions to prevent to be exported.
They're hidden, so all they cause is a linker warning.

ld: warning: cannot export hidden symbol
lldb::SBBreakpointNameImpl::operator==(lldb::SBBreakpointNameImpl const&) from
tools/lldb/source/API/CMakeFiles/liblldb.dir/SBBreakpointName.cpp.o

llvm-svn: 320066
2017-12-07 18:06:06 +00:00
Davide Italiano e1407c2c13 [Target] Remove commented out code. Found by inspection. NFCI.
llvm-svn: 320060
2017-12-07 17:05:56 +00:00
Pavel Labath 62ef18562b Variable: Fix usage of uninitialised value
Summary:
Variable::GetValuesForVariableExpressionPath was passing an
uninitialised value for the final_task_on_target argument. On my
compiler/optimization level combo, the final_task_on_target happened to
contain "dereference" in some circumstances, which produced hilarious
results. The same is true for other arguments to the
GetValueForExpressionPath call.

The correct behavior here seems to be to just omit the arguments
altogether and let the default behavior take place.

Reviewers: jingham

Subscribers: mehdi_amini, lldb-commits

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

llvm-svn: 320021
2017-12-07 10:38:22 +00:00
Shoaib Meenai 5e8d5ccfe7 [lldb] Use PRIVATE in target_link_libraries
This is a follow-up to r319840. I guess none of the systems I'd tested
on before had LLDB_SYSTEM_LIBS set, which is why I didn't see any local
errors, but I'm surprised none of the bots caught it either.

llvm-svn: 319953
2017-12-06 20:53:03 +00:00
Vedant Kumar 50048ac65e Fix the -Wunused-function warning properly (MachProcess.mm)
r319938 was not NFC, because it got the preprocessor guard wrong. Check
WITH_FBS and WITH_BKS before defining SplitEventData.

llvm-svn: 319943
2017-12-06 19:27:20 +00:00
Vedant Kumar 94d788fa78 Fix const-correctness in RegisterContext methods, NFC
A few methods in RegisterContext classes accept const objects which are
cast to a non-const thread_state_t. Drop const-ness more explicitly
where we mean to do so. This fixes a slew of warnings.

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

llvm-svn: 319939
2017-12-06 19:21:12 +00:00
Vedant Kumar eacb0929e8 Fix an -Wunused-function warning, NFC
llvm-svn: 319938
2017-12-06 19:21:11 +00:00
Vedant Kumar 07d956149b Fix misc -Wcast-qual warnings, NFC
llvm-svn: 319937
2017-12-06 19:21:11 +00:00
Vedant Kumar 606908aab5 Remove no-op function pointer null checks, NFC
Null-checking functions which aren't marked weak_import is a no-op
(the compiler rewrites the check to 'true'), regardless of whether a
library providing its definition is weak-linked. If the deployment
target is greater than the minimum requirement, the availability markup
on APIs does not lower to weak_import.

Remove no-op null checks to clean up the code and silence warnings.

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

llvm-svn: 319936
2017-12-06 19:21:10 +00:00
Vedant Kumar 8465c38b1e Use a static_cast instead of a C cast, NFC
Pointed out by Davide Italiano in post-commit review.

llvm-svn: 319935
2017-12-06 19:21:09 +00:00