Commit Graph

17178 Commits

Author SHA1 Message Date
Davide Italiano d5bbaa6688 [ExpressionParser] Fix crash when evaluating invalid expresssions.
Typical example, illformed comparisons (operator== where LHS and
RHS are not compatible). If a symbol matched `operator==` in any
of the object files lldb inserted a generic function declaration
in the ASTContext on which Sema operates. Maintaining the AST
context invariants is fairly tricky and sometimes resulted in
crashes inside clang (or assertions hit).

The real reason why this feature exists in the first place is
that of allowing users to do something like:
(lldb) call printf("patatino")

even if the debug informations for printf() is not available.
Eventually, we might reconsider this feature in its
entirety, but for now we can't remove it as it would break
a bunch of users. Instead, try to limit it to non-C++ symbols,
where getting the invariants right is hopefully easier.

Now you can't do in lldb anymore
(lldb) call _Zsomethingsomething(1,2,3)

but that doesn't seem to be such a big loss.

<rdar://problem/35645893>

llvm-svn: 327356
2018-03-13 01:40:00 +00:00
Davide Italiano 65c3ccc65a [lit] `llvm-mc` is now a dependency to run tests.
llvm-svn: 327350
2018-03-12 23:42:37 +00:00
Jim Ingham 08581263dc Re-add change for https://reviews.llvm.org/D42582 with added directories.
llvm-svn: 327331
2018-03-12 21:17:04 +00:00
Adrian Prantl 1cc1c5f298 Introduce a setting to disable Spotlight while running the test suite
This is a more principled approach to disabling Spotlight .dSYM
lookups while running the testsuite, most importantly it also works
for the LIT-based tests, which I overlooked in my initial fix
(renaming the test build dir to lldb-tests.noindex).

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

llvm-svn: 327330
2018-03-12 20:52:36 +00:00
Vedant Kumar d1faa56f3d Revert "Improve prologue handling to support functions with multiple entry points."
This reverts commit r327318. It breaks the Xcode and CMake Darwin
builders:

clang: error: no such file or directory:
'.../source/Plugins/Architecture/PPC64/ArchitecturePPC64.cpp'
clang: error: no input files

More details are in https://reviews.llvm.org/D42582.

llvm-svn: 327327
2018-03-12 20:35:33 +00:00
Jim Ingham 467b50057a Improve prologue handling to support functions with multiple entry points.
https://reviews.llvm.org/D42582

Patch from Leandro Lupori.

llvm-svn: 327318
2018-03-12 19:21:59 +00:00
Mandeep Singh Grang 4ccea6230b [lldb] Unbreak lldb builds due to r327219
Summary:
r327219 adds wrappers to sort which shuffle the container before sorting.
This causes lldb bots to break as the call to sort is now ambiguous:
http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-buildserver/builds/20725/steps/ninja%20build%20local/logs/stdio

So we need use llvm::sort instead of sort to avoid ambiguity with std::sort.

Note: This patch is just to unbreak the bots. I plan to have subsequent patches which will convert all
calls to std::sort to llvm::sort.

Reviewers: RKSimon, k8stone, jingham, labath, zturner

Subscribers: andreadb, lldb-commits

Tags: #lldb

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

llvm-svn: 327224
2018-03-10 21:13:55 +00:00
Adrian Prantl 3cd29bcfe2 Rename clang.modules-cache-path to symbols.clang-modules-cache-path
I want to extend the properties on ModuleList to also contain other
more general settings and renaming the settings category to symbols
seems to be the least bad of choices.

llvm-svn: 327193
2018-03-10 01:11:25 +00:00
Aaron Smith dee18b82c2 [SymbolFilePDB] Keep searching until the file name is found for the pdb compiland
Reviewers: zturner, rnk, lldb-commits

Reviewed By: zturner

Subscribers: llvm-commits

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

llvm-svn: 327162
2018-03-09 18:50:19 +00:00
Pavel Labath ef624fecdd Make TestCompletion work on windows
The test I added in r327110 is failing on windows because of "import
pexpect". However, this import is no longer necessary as these tests
don't use pexpect anymore.

In fact, it seems that all TestCompletion tests are passing on windows
after this, so I enable all of them.

llvm-svn: 327133
2018-03-09 14:32:16 +00:00
Pavel Labath 3ef4eebc27 [elf] Remove one copy of the section merging code
Summary:
Besides being superfluous, this double merging was actually wrong and
causing some sections to be added twice. The reason for that was that
the code assumes section IDs are unique in the section list, but this is
only true if all sections in the list come from the same object file.

Reviewers: fjricci, jankratochvil

Subscribers: emaste, lldb-commits, arichardson

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

llvm-svn: 327123
2018-03-09 12:30:09 +00:00
Pavel Labath 5f56fca4e1 Move option parsing out of the Args class
Summary:
The args class is used in plenty of places (a lot of them in the lower lldb
layers) for representing a list of arguments, and most of these places don't
care about option parsing. Moving the option parsing out of the class removes
the largest external dependency (there are a couple more, but these are in
static functions), and brings us closer to being able to move it to the
Utility module).

The new home for these functions is the Options class, which was already used
as an argument to the parse calls, so this just inverts the dependency between
the two.

The functions are themselves are mainly just copied -- the biggest functional
change I've made to them is to avoid modifying the input Args argument (getopt
likes to permute the argument vector), as it was weird to have another class
reorder the entries in Args class. So now the functions don't modify the input
arguments, and (for those where it makes sense) return a new Args vector
instead. I've also made the addition of a "fake arg0" (required for getopt
compatibility) an implementation detail rather than a part of interface.

While doing that I noticed that ParseForCompletion function was recording the
option indexes in the shuffled vector, but then the consumer was looking up the
entries in the unshuffled one. This manifested itself as us not being able to
complete "watchpoint set variable foo --" (because getopt would move "foo" to
the end). Surprisingly all other completions (e.g. "watchpoint set variable foo
--w") were not affected by this. However, I couldn't find a comprehensive test
for command argument completion, so I consolidated the existing tests and added
a bunch of new ones.

Reviewers: davide, jingham, zturner

Subscribers: lldb-commits

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

llvm-svn: 327110
2018-03-09 10:39:40 +00:00
Jason Molenda 250524f7ed I added CFLAGS etc to one part of the project file I should not have.
llvm-svn: 327097
2018-03-09 01:43:18 +00:00
Jason Molenda 4b7ea1f33c More cleanups of debugserver project file and the libpmenergy/libpmsample
stuff.  Activate it when an internal SDK is selected.  Update the name of
the LDFLAGS to match the rest of the settings.  Update the default arch for 
ios builds.

llvm-svn: 327095
2018-03-09 01:37:37 +00:00
Vedant Kumar e96dc75339 [test] Skip a test which sporadically fails in its dsym variant
There is a mailing list discussion re: r325927 about why this test fails
in the dsym variant. I've marked it skipped for now, until the issue is
resolved.

llvm-svn: 327089
2018-03-09 00:34:43 +00:00
Jason Molenda fc7321197e Remove unneeded per-arch sdk specifications from debugserver xcode project file.
llvm-svn: 327088
2018-03-09 00:32:56 +00:00
Jason Molenda c13a14ac26 Remove the explicit dependency on libpmenergy and libpmsample.
llvm-svn: 327087
2018-03-09 00:28:51 +00:00
Jason Molenda a608510b13 Fixed two more sdk inconsistencies with the pmenergy stuff.
llvm-svn: 327085
2018-03-09 00:23:29 +00:00
Jason Molenda 917f5b9944 Three little cleanups in the debugserver xcode project file.
1. Link against libpmenergy and pmsample unconditionally.  It is available on 
macOS 10.10 ("Yosemite") and newer.  We're already linking against libcompression
unconditionally which is only available on macOS 10.11 & newer.

2. Change a few "sdk=macosx.internal"'s to sdk=macosx.

3. Clean up a few places where libcompression was being enabled inconsistently.


Note: the -DLLDB_ENERGY define is only set when building against the macosx.internal
SDK; it includes a header file that is not public.  We link against the dylibs
unconditionally for simplicity.

llvm-svn: 327084
2018-03-09 00:17:22 +00:00
Vedant Kumar 45ae11cd80 [test] Skip a test when using an out-of-tree debugserver
The test "test_fp_special_purpose_register_read" in TestRegisters.py
fails on Darwin machines configured to use an out-of-tree debugserver.

The error message is: 'register read ftag' returns expected result, got
'ftag = 0x80'. This indicates that the debugserver in use is too old.

This commit introduces a decorator which can be used to skip tests which
rely on having a just-built debugserver. This resolves the issue:

$ ./bin/llvm-dotest -p TestRegisters.py -v
  1 out of 617 test suites processed - TestRegisters.py
  Test Methods:          7
  Success:               6
  Skip:                  1
...

llvm-svn: 327052
2018-03-08 19:46:39 +00:00
Pavel Labath b312b13960 Fix std unique pointer pretty-printer for new stl versions
Summary: The unique pointer layout was changed in libstdc++ 6.0.23.

Reviewers: labath, clayborg

Reviewed By: labath, clayborg

Subscribers: luporl, lbianc, lldb-commits

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

llvm-svn: 327017
2018-03-08 16:03:09 +00:00
Pavel Labath 6bf2a8ea70 Install lldb's SB headers (pr36630)
These were removed in r309021 in what looks like an accidentally
committed change. This brings them back.

I also rename the header component to lldb-headers (instead of
lldb_headers) to match the llvm style and add a special
install-lldb-headers target, which installs just the headers.

llvm-svn: 327016
2018-03-08 15:52:46 +00:00
Pavel Labath b9923f049e [LLDB][PPC64] Fix single step and LldbGdbServer tests
Summary:
On PPC64, the tested functions were being entered through their local entry point, while the tests expected the program to stop at the function start address, that, for PPC64, corresponds to the global entry point.

To fix the issue, the test program was modified to call the functions to be tested through function pointers, which, on PPC64, force the calls through the global entry point, while not affecting the test on other platforms.

Reviewers: clayborg, labath

Reviewed By: labath

Subscribers: alexandreyy, lbianc

Differential Revision: https://reviews.llvm.org/D43768
Patch by Leandro Lupori <leandro.lupori@gmail.com>.

llvm-svn: 327013
2018-03-08 15:41:13 +00:00
Davide Italiano c0311fe19b [lldbtestsuite] llvm-objcopy is now required to run the lit tests.
There's now a test using llvm-objcopy in lit/.
This doesn't fail on the bot(s) because `llvm-objcopy` is probably
already available there, but if you get a fresh checkout and run
`ninja check-lldb` you'll observe the failure as it's not tracking
the dependency correctly. This fixes the problem on my machine,
and probably everywhere else.

llvm-svn: 326919
2018-03-07 18:06:12 +00:00
Aaron Smith 2a989f36ca [SymbolFilePDB] Add missing Char16 and Char32 types in a few places
Reviewers: zturner, rnk, lldb-commits

Subscribers: clayborg, llvm-commits

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

llvm-svn: 326875
2018-03-07 05:43:05 +00:00
Aaron Smith f76fe6825c [SymbolFilePDB] Minor cleanup
Summary:
 - Remove unused code

- Adding `break` statement conditionally

- Ignore empty strings in FindTypeByName

Reviewers: zturner, rnk, lldb-commits

Reviewed By: zturner

Subscribers: llvm-commits

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

llvm-svn: 326870
2018-03-07 03:16:50 +00:00
Aaron Smith a0db2eb096 [SymbolFilePDB] Add support for CVR pointer type qualifier
Summary:
- Complete element type of PDBSymbolTypeArray.

- Add a test to check types of multi-dimensional array and pointers with CVR.

Reviewers: zturner, rnk, lldb-commits

Reviewed By: zturner

Subscribers: llvm-commits

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

llvm-svn: 326859
2018-03-07 00:39:25 +00:00
Aaron Smith 7abdf2d24f [SymbolFilePDB] Get line number for PDBSymbolTypeEnum
Reviewers: zturner, lldb-commits, rnk

Reviewed By: zturner

Subscribers: llvm-commits

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

llvm-svn: 326858
2018-03-07 00:35:27 +00:00
Jason Molenda 702895989a the thread id is easier to read in base16.
llvm-svn: 326849
2018-03-06 23:33:02 +00:00
Adrian Prantl bff272faa9 Add test for lldb-mi interpreter
Test that "lldb-mi --interpreter" can interpret "target list" CLI command.

Patch by Alex Polyakov!

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

llvm-svn: 326847
2018-03-06 23:25:04 +00:00
Pavel Labath 96979ceecb Rewrite TestTargetSymbolsBuildidCase to be more focused
Summary:
The test was failing in remote debugging scenario with windows as a host
as cmd.exe is not able to parse the complicated shell commands in the
Makefile.

The test seemed like a perfect candidate for a more focused testing
approach, so I have rewritten in on top of lldb-test's module-sections
functionality. The slight gotcha there was that the
Module::GetSectionList does not include the sections from the symbol
file until someone manually calls Module::GetSymbolVendor. Normally,
this is not an issue, because someone will have initialized the symbol
vendor by the time anyone starts looking at the sections. However, when
all one this is dump the section list, we run into this problem.

I've tried making this behavior more automatic, but it turns out it's
not that easy, so for now, I just manually initialize the Symbol Vendor
before dumping out the sections in lldb-test.

Reviewers: jankratochvil

Subscribers: lldb-commits

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

llvm-svn: 326805
2018-03-06 15:56:20 +00:00
Pavel Labath b417eeaeb5 ObjectFileMachO: split CreateSections mega-function into more manageable chunks
Summary:
In an effort to understand the function's operation, I've split it into logical
pieces. Parsing of a single segment is moved to a separate function (and the
parsing state that is carried from one segment to another is explicitly
captured in the SegmentParsingContext object). I've also extracted some pieces
of code which were already standalone (validation of the segment load command,
determining the section type, determining segment permissions) into
separate functions.

Parsing of a single section within the segment should probably also be a
separate function, but I've left that for a separate patch.

This patch is intended to be NFC.

Reviewers: clayborg, davide

Subscribers: lldb-commits

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

llvm-svn: 326791
2018-03-06 13:53:26 +00:00
Pavel Labath 408b0f53b4 HostThreadPosix::Cancel: remove android-specific implementation
Noone is calling this function on android, so we can just use the
generic llvm_unreachable "implementation".

llvm-svn: 326777
2018-03-06 12:46:05 +00:00
Pavel Labath 5e5dd70674 [LLDB][PPC64] Fixed issues with expedited registers
Summary:
- reg_nums were missing the end marker entry
- marked FP test to be skipped for ppc64

Reviewers: labath, clayborg

Reviewed By: labath, clayborg

Subscribers: alexandreyy, lbianc, nemanjai, kbarton

Differential Revision: https://reviews.llvm.org/D43767
Patch by Leandro Lupori <leandro.lupori@gmail.com>

llvm-svn: 326775
2018-03-06 11:54:41 +00:00
Jason Molenda a1bd9508e0 Upstreaming avx512 register support in debugserver. These changes
were originally written by Chris Bieneman, they've undergone a
number of changes since then.

Also including the debugserver bridgeos support, another arm
environment that runs Darwin akin to ios.  These codepaths are
activated when running in a bridgeos environment which we're not
set up to test today.

There's additional (small) lldb changes to handle bridgeos binaries
that still need to be merged up.

Tested on a darwin system with avx512 hardware and without.

<rdar://problem/36424951> 

llvm-svn: 326756
2018-03-06 00:27:41 +00:00
Adrian Prantl 39e54cb7b7 LLDBStandalone.cmake: set path to llvm-lit inside of llvm build dir
llvm-svn: 326754
2018-03-05 23:57:46 +00:00
Adrian Prantl 39c71a7bcb Fix the install location of LLDBWrapPython.cpp when building
LLDB.framework to point to the build directory where it is expected by
the top-level CMakeLists.txt.

This should be a no-op in any other configurations.

rdar://problem/38005302

llvm-svn: 326743
2018-03-05 21:08:42 +00:00
Vedant Kumar 2ddfe5c9c3 [test] Skip pexpect-based lldb-mi tests on Darwin
These tests fail with a relatively frequently on Darwin machines with
errors such as:

  File ".../lldb/third_party/Python/module/pexpect-2.4/pexpect.py", line 1444, in expect_loop
    raise EOF(str(e) + '\n' + str(self))
EOF: End Of File (EOF) in read_nonblocking(). Empty string style platform.

The unpredictable failures make these tests noisy.

rdar://37046976

llvm-svn: 326739
2018-03-05 20:16:52 +00:00
Raphael Isemann 1fe3ee18b4 Including <functional> for std::bind
Differential Revision: https://reviews.llvm.org/D44099

llvm-svn: 326727
2018-03-05 17:54:23 +00:00
Jonas Devlieghere a52cb80db6 [test] Add dotest wrapper
This adds a wrapper around dotest, similar to llvm-lit in llvm. The
wrapper is created in the binary directory, next to LLDB and allows you
to invoke dotest without having to pass any of the configuration
arguments yourself. I think this could also be useful for re-running a
particular test case when it fails, as an alternative to "Command
Invoked".

The motivation for this is that I'd like to replace the driver part of
dotest with lit. As a first step, I'd like to have lit invoke dotest,
which would just run the complete test suite, completely identical to
what the CMake target does today. Once this is in place, we can have lit
run dotest for the different test directories, and ultimately once per
python file. Along the way we can strip out driver functionality from
dotest where appropriate.

https://reviews.llvm.org/D44002

llvm-svn: 326687
2018-03-05 10:03:44 +00:00
Pavel Labath cdf7a9f16d llgs-tests: use the auto-parsing form of SendMessage for sending the continue packets
llvm-svn: 326671
2018-03-04 02:12:18 +00:00
Pavel Labath f90054dd90 ObjectFileMachO: use early return to remove one nesting level from CreateSections()
NFCI

llvm-svn: 326667
2018-03-03 22:07:47 +00:00
Adrian Prantl f318ddc93e Mark ObjC testcase as skipUnlessDarwin and fix a typo in test function.
llvm-svn: 326640
2018-03-02 23:57:09 +00:00
Adrian Prantl beb6025361 Don't compile testcase with clang modules enabled.
It isn't actually necessary for what we are testing here and should
fix the test on the Linux bots.

llvm-svn: 326634
2018-03-02 23:15:04 +00:00
Adrian Prantl 235354be57 Make the clang module cache setting available without a target
It turns out that setting the clang module cache after LLDB has a
Target can be too late. In particular, the Swift language plugin needs
to know the setting without having access to a Target. This patch
moves the setting into the *LLDB* module cache, where it is a global
setting that is available before any Target is created and more
importantly, is shared between all Targets.

rdar://problem/37944432

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

llvm-svn: 326628
2018-03-02 22:42:44 +00:00
Jonas Devlieghere 3a9d431386 [testsuite] Remove workaround for categories and inline tests.
Adding categories to inline tests does not work because the attribute
is set at the function level. For methods, this means it applies to all
instances of that particular class. While this is what we want in most
cases, it's not for inline tests, where different instances correspond
to different tests.

With the workaround in place, assigning a category to one test resulted
in the category applied to *all* inline tests.

This patch removes the workaround and throws an exception with an
informative error message, to prevent this from happening in the future.

llvm-svn: 326552
2018-03-02 10:38:11 +00:00
Pavel Labath 4c693a894f Speed up TestWatchpointMultipleThreads
Summary:
The inferior was sleeping before doing any interesting work. I remove that
to make the test faster.

While looking at the purpose of the test (to check that watchpoints are
propagated to all existing threads - r140757) I noticed that the test has
diverged from the original intention and now it creates the threads *after* the
watchpoint is set (this probably happened during the std::thread refactor).
After some discussion, we decided both scenarios make sense, so I modify the
test to test both.

The watchpoint propagation functionality is not really debug info depenent, so
I also stop replication of this test. This brings the test's time from ~108s
down to 4s.

Reviewers: davide, jingham

Subscribers: aprantl, lldb-commits

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

llvm-svn: 326514
2018-03-02 00:17:05 +00:00
Pavel Labath e1463ef4d3 Make TestDynamicValueSameBase gcc-compatible
gcc will say that the type of "this" is "T * const", clang "T *".
Compare the unqualified type names to erase the difference between the
two, as the constness is not a part of this test.

FWIW, I think that the gcc behavior makes more sense here.

llvm-svn: 326449
2018-03-01 16:56:28 +00:00
Tatyana Krasnukha 0a6b8b6630 Make Finalize tolerant of empty register sets.
llvm-svn: 326437
2018-03-01 14:36:42 +00:00
Vedant Kumar a32e84133a [test] Restore cleanup behavior in TestQuoting.py
Before the change to compile tests out-of-tree, the cleanup classmethod
in TestQuoting.py would remove a temp file. After the change it threw an
exception due to a malformed call to getBuildArtifact().

Bring back the old behavior.

llvm-svn: 326414
2018-03-01 03:03:38 +00:00
Jim Ingham 06292869cd We were getting the wrong dynamic type if there were two classes with the same basename.
There's a bug in FindTypes, it ignores the exact flag if you pass a name that doesn't begin with
:: and pass eTypeClassAny for the type.

In this case we always know that the name we get from the vtable name is absolute so we can
work around the bug by prepending the "::".  This doesn't fix the FindTypes bug.

<rdar://problem/38010986>

llvm-svn: 326412
2018-03-01 02:44:34 +00:00
Jason Molenda f50299fb87 Add another entitlement that we need for debugserver.
<rdar://problem/29855293> 

llvm-svn: 326399
2018-03-01 01:04:07 +00:00
Jim Ingham 1584f9eddd Fix up the gtest targets for changes in the UnwindAssembly tests.
llvm-svn: 326378
2018-02-28 22:41:11 +00:00
Han Ming Ong 4142369204 Add ability to collect memory limit.
Reviewer: Jason Molenda

<rdar://problem/37686560>

llvm-svn: 326374
2018-02-28 22:18:45 +00:00
Pavel Labath 2b2d728c7b Adapt some tests to work with PPC64le architecture
Summary: Merge branch 'master' into adaptPPC64tests

Reviewers: clayborg, alexandreyy, labath

Reviewed By: clayborg, alexandreyy

Subscribers: luporl, lbianc, alexandreyy, lldb-commits

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

llvm-svn: 326369
2018-02-28 20:57:26 +00:00
Pavel Labath ec03d7e3ba Revert "[lldb] Use vFlash commands when writing to target's flash memory regions"
This reverts commit r326261 as it introduces inconsistencies in the
handling of load addresses for ObjectFileELF -- some parts of the class
use physical addresses, and some use virtual. This has manifested itself
as us not being able to set the load address of the vdso "module" on
android.

llvm-svn: 326367
2018-02-28 20:42:29 +00:00
Jason Molenda 27fe9364f8 Add EmulateInstructionPPC64.cpp to xcode project file.
llvm-svn: 326302
2018-02-28 04:11:37 +00:00
Pavel Labath 9bdd03f7da Fix lldbinline tests for remote targets
r326140 exposed the fact that we are not actually running inline tests on
remote targets. The tests fail to launch the inferior in the first place
because they passed an invalid working directory to the launch function.

This should fix that.

llvm-svn: 326264
2018-02-27 22:45:49 +00:00
Pavel Labath 029fb69372 [lldb] Use vFlash commands when writing to target's flash memory regions
Summary:
When writing an object file over gdb-remote, use the vFlashErase, vFlashWrite, and vFlashDone commands if the write address is in a flash memory region.  A bare metal target may have this kind of setup.

- Update ObjectFileELF to set load addresses using physical addresses.  A typical case may be a data section with a physical address in ROM and a virtual address in RAM, which should be loaded to the ROM address.
- Add support for querying the target's qXfer:memory-map, which contains information about flash memory regions, leveraging MemoryRegionInfo data structures with minor modifications
- Update ProcessGDBRemote to use vFlash commands in DoWriteMemory when the target address is in a flash region

Original discussion at http://lists.llvm.org/pipermail/lldb-dev/2018-January/013093.html

Reviewers: clayborg, labath

Reviewed By: labath

Subscribers: arichardson, emaste, mgorny, lldb-commits

Differential Revision: https://reviews.llvm.org/D42145
Patch by Owen Shaw <llvm@owenpshaw.net>

llvm-svn: 326261
2018-02-27 22:14:33 +00:00
Pavel Labath a535a7a2a0 [LLDB] Initial version of PPC64 InstEmulation
Summary: Supports common prologue/epilogue instructions.

Reviewers: clayborg, labath

Reviewed By: clayborg, labath

Subscribers: davide, anajuliapc, alexandreyy, lbianc, nemanjai, mgorny, kbarton

Differential Revision: https://reviews.llvm.org/D43345
Author: Leandro Lupori <leandro.lupori@gmail.com>

llvm-svn: 326224
2018-02-27 18:42:46 +00:00
Pavel Labath b2f9bb9e54 Move TestGdbRemoteExitCode next to the other llgs tests
This test contained a copy of the inferior used by most of llgs test.
This was done to enable better paralelization, but now it's irrelevant.

llvm-svn: 326218
2018-02-27 18:07:53 +00:00
Han Ming Ong 28efd27fe2 Removed accidentally committed code from previous commit.
llvm-svn: 326214
2018-02-27 18:02:15 +00:00
Han Ming Ong 83d178de9f Got rid of weak imports of libpenergy and libpsample because we are already requiring a modern macOS (at least 10.11)
Reviewer: Jason Molenda
llvm-svn: 326213
2018-02-27 17:53:38 +00:00
Ed Maste 883b6ee70a Mark test_*int*_t_dwarf as failing on FreeBSD
Further investigation required; tests will be enabled on the buildbot
worker soon. Marking failing tests for now in order to start with a
green buildbot while investigation takes place.

This is a recommit of r326134, with the required import added.

llvm.org/pr36527

llvm-svn: 326166
2018-02-27 02:54:17 +00:00
Pavel Labath de872a697a Move "concurrent events" tests back into one folder
These tests all test very similar things, and use the same inferior.
They were only placed in separate folders to achieve better
paralelization. Now that we paralelize at a file level, this is no
longer relevant, and we can put them together again.

llvm-svn: 326159
2018-02-27 02:01:30 +00:00
Adrian Prantl 87a000dae3 Add a sanity check for inline testcases.
When writing an inline test, there is no way to make sure that any of
the inline commands are actually executed, so this patch adds a sanity
check that at least one breakpoint was hit. This avoids a test with no
breakpoints being hit passing.

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

llvm-svn: 326140
2018-02-26 22:40:20 +00:00
Ed Maste 6ebb0792b0 Revert r326134 due to broken buildbot
llvm-svn: 326139
2018-02-26 22:36:41 +00:00
Ed Maste 24f9794d78 Mark test_*int*_t_dwarf as failing on FreeBSD
Further investigation required; tests will be enabled on the buildbot
worker soon. Marking failing tests for now in order to start with a
green buildbot while investigation takes place.

llvm.org/pr36527

llvm-svn: 326134
2018-02-26 22:12:24 +00:00
Adrian McCarthy 00cc735a6f Partial fix for TestConflictingSymbol.py on Windows
Without this fix, the test ERRORs because the link of the inferior fails. This
patch adds the LLDB_TEST_API macro where needed and uses the new -2 magic
value for num_expected_locations to account for lazy-loading of module symbols
on Windows.

With this fix, the test itself still fails:  conflicting_symbol isn't in the
debug info nor the export table, and Windows binaries don't have an equivalent
of the ELF .symtab.  We need to understand why the test works to keep the
symbol out of the debug info.  In the mean time, having the test fail at this
point is a better indication of the remaining problem than a build error.

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

llvm-svn: 326130
2018-02-26 21:22:39 +00:00
Pavel Labath 7c94582f90 Add "lldb-test breakpoint" command and convert the case-sensitivity test to use it
Summary:
The command takes two input arguments: a module to use as a debug target
and a file containing a list of commands. The command will execute each
of the breakpoint commands in the file and dump the breakpoint state
after each one.

The commands are expected to be breakpoint set/remove/etc. commands, but
I explicitly allow any lldb command here, so you can do things like
change setting which impact breakpoint resolution, etc. There is also a
"-persistent" flag, which causes lldb-test to *not* automatically clear
the breakpoint list after each command. Right now I don't use it, but
the idea behind it was that it could be used to test more complex
combinations of breakpoint commands (set+modify, set+disable, etc.).

Right now the command prints out only the basic breakpoint state, but
more information can be easily added there.  To enable easy matching of
the "at least one breakpoint location found" state, the command
explicitly prints out the string "At least one breakpoint location.".

To enable testing of breakpoints set with an absolute paths, I add the
ability to perform rudimentary substitutions on the commands: right now
the string %p is replaced by the directory which contains the command
file (so, under normal circumstances, this will perform the same
substitution as lit would do for %p).

I use this command to rewrite the TestBreakpointCaseSensitivity test --
the test was checking about a dozen breakpoint commands, but it was
launching a new process for each one, so it took about 90 seconds to
run. The new test takes about 0.3 seconds for me, which is approximately
a 300x speedup.

Reviewers: davide, zturner, jingham

Subscribers: luporl, lldb-commits

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

llvm-svn: 326112
2018-02-26 18:50:16 +00:00
Adrian McCarthy 69d7434745 Fix tabs/spaces indentation problem in TestUnicodeSymbols.py
Differential Revision: https://reviews.llvm.org/D43705

llvm-svn: 326095
2018-02-26 15:53:31 +00:00
Jonas Devlieghere 560ce2c70f Re-land: "[Support] Replace HashString with djbHash."
This patch removes the HashString function from StringExtraces and
replaces its uses with calls to djbHash from DJB.h.

This change is *almost* NFC. While the algorithm is identical, the
djbHash implementation in StringExtras used 0 as its default seed while
the implementation in DJB uses 5381. The latter has been shown to result
in less collisions and improved avalanching and is used by the DWARF
accelerator tables.

Because some test were implicitly relying on the hash order, I've
reverted to using zero as a seed for the following two files:

  lld/include/lld/Core/SymbolTable.h
  llvm/lib/Support/StringMap.cpp

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

llvm-svn: 326091
2018-02-26 15:16:42 +00:00
Jonas Devlieghere 370bf3ef49 Revert "[Support] Replace HashString with djbHash."
It looks like some of our tests depend on the ordering of hashed values.
I'm reverting my changes while I try to reproduce and fix this locally.

Failing builds:

  lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/18388
  lab.llvm.org:8011/builders/clang-cmake-x86_64-sde-avx512-linux/builds/6743
  lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/15607

llvm-svn: 326082
2018-02-26 12:05:18 +00:00
Jonas Devlieghere b9ad175935 [Support] Replace HashString with djbHash.
This removes the HashString function from StringExtraces and replaces
its uses with calls to djbHash from DJB.h

This is *almost* NFC. While the algorithm is identical, the djbHash
implementation in StringExtras used 0 as its seed while the
implementation in DJB uses 5381. The latter has been shown to result in
less collisions and improved avalanching.

https://reviews.llvm.org/D43615
(cherry picked from commit 77f7f965bc9499a9ae768a296ca5a1f7347d1d2c)

llvm-svn: 326081
2018-02-26 11:30:13 +00:00
Vedant Kumar d4e2dabbbb Delete dead code in MachVMMemory.cpp, NFC
This addresses a compiler warning.

llvm-svn: 326002
2018-02-24 00:17:05 +00:00
Vedant Kumar f6769ae176 [unittests] Disable lldb-server tests if an external debug server is in use
The lldb-server unit tests don't test the right thing when the debug
server in use is copied from somewhere else. This can lead to spurious
test failures.

Disable these unit tests when an external debug server is in use.

Fixes llvm.org/PR36494.

llvm-svn: 326001
2018-02-24 00:17:04 +00:00
Vedant Kumar c79333413a Fix a compiler warning in ModuleCacheTest.cpp, NFC
llvm-svn: 325974
2018-02-23 23:18:27 +00:00
Vedant Kumar ebc6bc8188 [Utility] Simplify and generalize the CleanUp helper, NFC
Removing the template arguments and most of the mutating methods from
CleanUp makes it easier to understand and reuse.

In its present state, CleanUp would be too cumbersome to adapt to cases
where multiple objects need to be released. Take for example this change
in swift-lldb:

  https://github.com/apple/swift-lldb/pull/334/files#diff-6f474df750f75c8ba675f2a8408a5629R219

This change is simple to express with the new CleanUp, but not so simple
with the old version.

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

llvm-svn: 325964
2018-02-23 22:08:38 +00:00
Jim Ingham e8b072d9e4 Fix breakpoint thread name conditionals after breakpoint options refactor.
PR36435

llvm-svn: 325958
2018-02-23 21:10:42 +00:00
Pavel Labath b39fca958d Replace HashStringUsingDJB with llvm::djbHash
Summary:
The llvm function is equivalent to this one. Where possible I tried to
replace const char* with llvm::StringRef to avoid extra strlen
computations. In most places, I was able to track the c string back to
the ConstString it was created from.

I also create a test that verifies we are able to lookup names with
unicode characters, as a bug in the llvm compiler (it accidentally used
a different hash function) meant this was not working until recently.

This also removes the unused ExportTable class.

Reviewers: aprantl, davide

Subscribers: JDevlieghere, lldb-commits

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

llvm-svn: 325927
2018-02-23 17:49:26 +00:00
Frederic Riss 0fda3a8721 Fix TestMultithreaded when there's no debugserver specified
r325858 was bogus and would error out with a KeyError when --server
was not passed to dotest.py.

llvm-svn: 325862
2018-02-23 05:29:27 +00:00
Frederic Riss 0fd6a530a0 Fix TestUbsanBasic
Summary:
Potentially due to the recent testuite refactorings, this test now reports
a full absolute path but expect just the filename. For some reason this
test is skipped on GreenDragon so we've never seen the issue.

Reviewers: vsk

Subscribers: kubamracek, lldb-commits

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

llvm-svn: 325859
2018-02-23 05:03:10 +00:00
Frederic Riss 8492f2081d Fix TestMultithreaded when specifying an alternative debugserver.
Summary:
This test launches a helper that uses the debugserver. The environment
variable sepcifying the debug server wasn't passed to this helper, thus
it was using the default one.

Subscribers: lldb-commits

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

llvm-svn: 325858
2018-02-23 05:03:09 +00:00
Ed Maste 7129ae39bd remove FreeBSD xfail from lit TestCallStdStringFunction
This test is consistently reporting unexpected pass for me, and the
expectedFailure decorator was removed from the legacy test in r310626.
Apply the same change to the lit version of this test.

Will investigate further if this fails once the new buildbot is running
tests.

llvm.org/pr17807

llvm-svn: 325856
2018-02-23 02:50:07 +00:00
Davide Italiano f2ff789e99 [testsuite] Throw away test/debug_info/apple_types.
This test was only testing that clang produced the correct informations
for __apple accelerated tables. So, it's a clang test. Also, it
doesn't require any debugger intervention, the object file can
be analyzed statically with a dumper. Also, the input program
was highly verbose (unnecessarily).

r325850 commits a clang test instead, so it's time to retire this.

llvm-svn: 325851
2018-02-23 01:33:20 +00:00
Vedant Kumar 1c3b05ad79 Delete some unused #includes of CleanUp.h, NFC
llvm-svn: 325847
2018-02-23 00:29:40 +00:00
Vedant Kumar 6d2b435d80 [ObjC] Fix the NSConcreteData formatter and test it
The length field of an NSConcreteData lives one word past the start of
the object, not two.

llvm-svn: 325841
2018-02-22 23:48:21 +00:00
Adrian McCarthy 7de450033b Fix TestMoveNearest on Windows
The header file for the DLL tried to declare inline functions and a local
function as dllexport which broke the compile and link.  Removing the bad
declarations solves the problem, and the test passes on Windows now.

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

llvm-svn: 325836
2018-02-22 22:47:47 +00:00
Adrian McCarthy 3db5d7e124 Fix TestSBData.py on Windows
Ensure that the test data is an array of bytes rather than a string that gets
encoded differently between Python 2 and Python 3.

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

llvm-svn: 325835
2018-02-22 22:47:14 +00:00
Pavel Labath a3952ea70b [LLDB][PPC64] Fixed next blocked forever at same line
Summary:
The PC corresponding to the breakpoint was being calculated wrongly,
which was causing LLDB to never go past the first breakpoint, when
there was a second one adjacent to it.

Reviewers: clayborg, labath

Reviewed By: clayborg, labath

Subscribers: anajuliapc, alexandreyy, lbianc

Differential Revision: https://reviews.llvm.org/D43344
Patch by Leandro Lupori <leandro.lupori@gmail.com>.

llvm-svn: 325728
2018-02-21 21:56:18 +00:00
Davide Italiano fb92f4e4c4 [testsuite] Run lit tests as part of `check-lldb`.
Also, fix a missing dependency, as lit requires llvm-config
to run. This is becoming more and more important as we
write more FileCheck style tests.

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

llvm-svn: 325719
2018-02-21 21:10:44 +00:00
Davide Italiano feb4b896b6 [testsuite/decorators] Get rid of some `expectFlakey` variants.
These seem to be pretty much dead.

llvm-svn: 325708
2018-02-21 19:18:49 +00:00
Adrian McCarthy 25727a458c Fix TestBreakpointInGlobalConstructor for Windows
Summary:
This test was failing on Windows because it expected the breakpoint in the
dynamic library to be resolved before the process is launched.  Since the DLL
isn't loaded until the process is launched this didn't work.

The fix creates a special value (-2) for num_expected_locations that ignores
the actual number of breakpoint locations found.

Reviewers: jasonmolenda

Subscribers: sanjoy, lldb-commits

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

llvm-svn: 325704
2018-02-21 18:08:23 +00:00
Pavel Labath 44499631a8 Fix remote tests broken by r325690
The patch added an extra argument to the append_to_process_working_directory
function. I have somehow missed updating this test, and it did not show up
because the code was only run in remote mode.

llvm-svn: 325702
2018-02-21 17:55:22 +00:00
Pavel Labath 9391d98e7b llgs-tests: Fix r325511 for debugserver
Debugserver sends the thread-pcs field with leading zeroes omitted. Teach
parseRegisterValue to pad these as necessary.

llvm-svn: 325701
2018-02-21 17:38:38 +00:00
Pavel Labath f3a9ab07aa Fix a couple of more tests to not create files in the source tree
Summary:
These were not being flaky, but they're still making the tree dirty.

These tests were using lldbutil.append_to_process_working_directory to
derive the file path so I fix them by modifying the function to return
the build directory for local tests.

Technically, now the path returned by this function does not point to
the process working directory for local tests, but I think it makes
sense to keep the function name, as I think we should move towards
launching the process in the build directory (and I intend to change
this for the handful of inferiors that actually care about their PWD,
for example because they need to create files there).

Reviewers: davide, aprantl

Subscribers: lldb-commits

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

llvm-svn: 325690
2018-02-21 15:33:53 +00:00
Frederic Riss 9c4db3bc2b Fix TestAppleTypesIsProduced after r324226
This test was accessing self.debug_info, which doesn't exist anymore. For
some reason the macOS bots are skipping this test because they think the
compiler is not clang. We'll look into this separately.

llvm-svn: 325666
2018-02-21 06:20:03 +00:00
Aaron Smith 07482d32e7 [lit] Update how clang and other binaries are found in per-configuration directories
Summary:
This is modeled after the clang and llvm lit tests.

Several properties have CMAKE_CFG_INTDIR as part of the path - this works correctly when the cmake generator only supports one configuration which is known at configuration time, but it does not work correctly when the cmake generator supports multiple configurations (for example, VS). 

For VS, CMAKE_CFG_INTDIR ends up set as $Configuration and then it is never updated correctly. Instead, the lit configuration can use a property that can be overwritten at run time. AddLLVM does that for several properties (such as LLVM_TOOLS_DIR). 

This change is also removing properties from the lit/CMakeLists.txt that are actually set during the call to configure_lit_site_cfg

Reviewers: zturner, lldb-commits

Reviewed By: zturner

Subscribers: llvm-commits, labath, stella.stamenova, mgorny, hintonda

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

llvm-svn: 325652
2018-02-21 00:05:51 +00:00
Pavel Labath a9f8b0d1a9 Avoid dirtying the source tree in breakpoint command tests
Summary:
The paralelization patch exposed a bunch of cases where we were still
touching the source tree (as these tests were now stepping on each
others toes and being flaky).

This patch removes such issues from breakpoint command tests. Since the
only reason they were creating files was to indirectly test whether the
breakpoint commands got executed (and plumbing the full build tree path
to all places that needed it would be messy) I decided to modify the
tests to check for a different side effect instead: modification of a
global variable. This also makes the code simpler as checking the value
of the global variable is easier, and there is nothing to clean up.

As the tests aren't really doing anything debug-info related, I took the
opportunity to also mark them as NO_DEBUG_INFO_TESTCASEs.

Reviewers: jingham, aprantl

Subscribers: lldb-commits

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

llvm-svn: 325570
2018-02-20 10:24:37 +00:00
Jonas Devlieghere 65d2d5bad4 Handle typeof() expressions
Before this patch, LLDB was not able to evaluate expressions that
resulted in a value with a typeof- or decltype-type. This patch fixes
that.

Before:
  (lldb) p int i; __typeof__(i) j = 1; j
  (typeof (i)) $0 =

After:
  (lldb) p int i; __typeof__(i) j = 1; j
  (typeof (i)) $0 = 1

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

rdar://37461520

llvm-svn: 325568
2018-02-20 10:15:08 +00:00
Pavel Labath 37a35d3395 Two more dosep-paralellization fallout fixes
The first issue is about the flaky test rerun logic. This was grouping
tests by subdir and passing them into walk_and_invoke in the incorrect
form. This part can be just deleted as its not needed anymore.

The second problem (which I noticed while investigating the first one)
was that the "-p" switch was not working in multiprocessing mode. This
happened because we were returning None from process_file instead of a
tuple full of empty values for tests that did not match the -p regex.

Both of these would be caught earlier if python was a more strongly
typed language. :/

llvm-svn: 325519
2018-02-19 17:23:13 +00:00
Pavel Labath 9a9556f07d Fix TestStopReplyContainsThreadPcs on 32-bit x86 (pr36013)
Summary:
The issue was that we were parsing the registers into 64-bit integers
and the calling swapByteOrder without regard for the actual size of the
register. This switches the test to use the RegisterValue class which
tracks the register size, and knows how to initialize itself from a
piece of memory (so we don't need to swap byte order ourselves).

Reviewers: eugene, davide

Subscribers: lldb-commits

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

llvm-svn: 325511
2018-02-19 15:42:48 +00:00
Pavel Labath f1389e9201 Add SBDebugger::GetBuildConfiguration and use it to skip an XML test
Summary:
This adds a SBDebugger::GetBuildConfiguration static function, which
returns a SBStructuredData describing the the build parameters of
liblldb. Right now, it just contains one entry: whether we were built
with XML support.

I use the new functionality to skip a test which requires XML support,
but concievably the new function could be useful to other liblldb
clients as well (making sure the library supports the feature they are
about to use).

Reviewers: zturner, jingham, clayborg, davide

Subscribers: lldb-commits

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

llvm-svn: 325504
2018-02-19 15:06:28 +00:00
Pavel Labath d6f903f05c Make gdb-client tests generate binaries in the build tree
These were missed in the great refactor because they were added
concurrently with it. Since we started running tests in a more parallel
fashion they started to be flaky. This should fix it.

Now that we are no longer polluting the source tree, I also delete the
bit of custom cleanup code specific to these tests.

llvm-svn: 325495
2018-02-19 13:53:12 +00:00
Don Hinton b308571916 Add DEBUGSERVER_PATH to the cache so it'll be available for tests.
This fixed a problem caused by r325442.

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

llvm-svn: 325452
2018-02-17 23:06:15 +00:00
Don Hinton d8a6b90e83 [cmake] Fix LLDB_CODESIGN_IDENTITY logic.
Summary:
Consolidate LLDB_CODESIGN_IDENTITY logic in one place and use
SKIP_DEBUGSERVER, which can be set independently, to control
codesigning targets.

Currently, running cmake the first time in a clean directory, without
passing -DLLDB_CODESIGN_IDENTITY='', fails.  However, subsequent runs
succeed.  That's because LLDB_CODESIGN_IDENTITY gets added to the
CACHE after the initial test.  To fix that, the default value must be
set before it's tested.

Here's the error produced on the first run:

CMake Error at tools/lldb/tools/debugserver/source/CMakeLists.txt:215 (add_custom_command):
  No TARGET 'debugserver' has been created in this directory.

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

llvm-svn: 325442
2018-02-17 19:17:21 +00:00
Pavel Labath 1c7211d754 Shorten socket names in TestPlatformProcessConnect
The test was generating long unix socket names, and the addition of a
new folder in the previous patch pushed it over the limit (although
linux has a fairly generous limit for path names, this does not apply to
unix sockets).

Modify the test to use a shorter name instead.

llvm-svn: 325340
2018-02-16 12:57:35 +00:00
Jonas Devlieghere 1a584e898b Re-enable lang/objc/modules/TestObjCModules
The reason this test was disabled is no longer relevant. However, it
didn't turn into an unexpected success because of a syntax error in the
test itself. This commit fixes that and re-enables the test.

llvm-svn: 325339
2018-02-16 12:33:10 +00:00
Pavel Labath e627d1653e Fix paralelization of remote tests
Since we now can run multiple tests from the same directory at once, we
need to include the test name in the remote test directory instead.

I'm not sure if the test_number in the remote path is necessary anymore
(or even if it was ever necessary), but I choose to leave it in for now.

llvm-svn: 325334
2018-02-16 11:39:38 +00:00
Pavel Labath 686b27b55a [lldb][PPC64] Fixed vector and struct return value
Summary:
The PowerPC64 ABI plugin was modified to:

- properly handle vector type return values
- implement support for struct/class return values

A refactoring in the code that handles return values was also performed, to make it possible to handle structs without repeating (when possible) code that handles its fields.

There was also an issue with CreateInstance(), that only created an instance in the first time it was called and then cached it in a static var. When restarting a process under LLDB's control, the ABI's process weak pointer would become null, and using it would result in a segmentation fault. This issue became more evident after the latest changes to PPC64 plugin, that now uses the process pointer to get the target byte order, making LLDB to seg fault when restarting a program. This was fixed by making CreateInstance() to always create a new ABI instance.

All of LLDB's ReturnValue tests are passing for PPC64le now. It should work for PPC64be too, although this was not tested.

Reviewers: labath, clayborg

Reviewed By: labath

Subscribers: lbianc, anajuliapc, llvm-commits, alexandreyy, nemanjai, kbarton

Differential Revision: https://reviews.llvm.org/D42468
Patch by Leandro Lupori <leandro.lupori@gmail.com>.

llvm-svn: 325324
2018-02-16 09:29:41 +00:00
Pavel Labath 42a1619262 [dosep] Run tests in a more parallel fashion
Summary:
Due to in-tree builds, we were parallelizing the tests at the directory
level. Now that the tests are built out-of-tree, we can remove this
limitation and paralelize at file level instead.

This decreases test suite time by about 10% for me, which is not
world-shattering, but it makes the code slightly simpler and will also
allow us to merge tests which were artificially spread over multiple
folders (TestConcurrentEvents...) to work-around this limitation.

To make this work, I've also needed to include the test file name in the
build directory name, as just the test method name is not unique enough
(plenty of tests have a test method called "test" or similar).

While doing this, I've found a couple of tests that are taking waaay longer then
they ought to (TestBreakpointCaseSensitivity -- 90 seconds), which I plan to
look into in the future.

Reviewers: aprantl

Subscribers: lldb-commits

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

llvm-svn: 325322
2018-02-16 09:21:11 +00:00
Pavel Labath 23c0cce597 @skipIfRemote TestTargetXMLArch
The test does not actually connect to any remote targets.

llvm-svn: 325250
2018-02-15 15:24:32 +00:00
Adrian McCarthy 1e368d1558 Supply missing break in case statement.
Summary:
All the tests pass without hitting the situation mentioned in the FIXME, so,
per Aaron Smith's suggestion, this case will now return unconditionally.

Subscribers: sanjoy, mgorny, JDevlieghere

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

llvm-svn: 325188
2018-02-14 23:16:36 +00:00
Pavel Labath ec303134ef Remove vestigial remnants of the test crash info hook
llvm-svn: 325137
2018-02-14 16:08:26 +00:00
Vedant Kumar 361b5e1169 [cmake] Darwin: Copy in the system debugserver if needed
This makes the built debugger functional on Darwin when compiling
without code signing (as documented in docs/code-signing.txt).

llvm-svn: 325068
2018-02-13 23:05:46 +00:00
Jim Ingham 78ffed02d8 Remove the pubnames support from the Xcode project.
llvm-svn: 324930
2018-02-12 20:25:37 +00:00
Adrian McCarthy fbfdd53ad1 Remove dead code for handling DWARF pubnames
Summary:
LLDB doesn't use this code, the code has no tests, and the code does suspicious
things like hashing pointers to strings instead of the strings themselves.

Subscribers: sanjoy, mgorny, JDevlieghere

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

llvm-svn: 324925
2018-02-12 19:19:04 +00:00
Davide Italiano 1ecd449814 [testsuite] Reintroduce test to check leaking.
It wasn't python leaking, it was lldb. Thanks to Pavel for the
explanation. Pointy-hat to me.

llvm-svn: 324919
2018-02-12 18:06:34 +00:00
Pavel Labath ca4eddee0d Skip TestTargetXMLArch on non-darwin OSs
This test uses XML packets, but libxml is an optional dependency of
lldb, and this test fails if it is not present.

I'm leaving this enabled on mac, as thats the only platform that's
likely to have libxml always available, but ideally we should have a way
to skip this based on build configuration. I'll see if I can whip
something like that up soon, but for the time being, this unblocks the
buildbots.

llvm-svn: 324870
2018-02-12 09:46:06 +00:00
Jason Molenda 0df8935c23 Looks like this fails when built i386 on linux bots, possible target
arch incompat with spec in file so it's rejected and the test fails.
will look into this later, will be a test case issue not a test issue;
test case may only be valid when lldb is built for/running on an x86_64
system.

llvm-svn: 324795
2018-02-10 01:57:33 +00:00
Jason Molenda 62f395e32e Add test case for x86_64 architecture recognition in the
target.xml packet if it is included.

llvm-svn: 324792
2018-02-10 01:13:34 +00:00
Adrian Prantl 95a0f39e35 Make LLDB's clang module cache path customizable
This patch makes LLDB's clang module cache path customizable via
settings set target.clang-modules-cache-path <path> and uses it in the
LLDB testsuite to reuse the same location inside the build directory
for LLDB and clang.

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

llvm-svn: 324775
2018-02-09 22:08:26 +00:00
Davide Italiano fc58346bf0 [lldb-mi] This test now passes consistently, unXFAIL it.
llvm-svn: 324768
2018-02-09 19:35:07 +00:00
Davide Italiano 5cd92ead72 [Testsuite] Remove leak tests, it's not useful anymore.
This only worked on MacOS, which now ships a newer version of
python without this bug. As such, we don't leak the fd, and
this test is not needed anymore (as it also hardcoded the python
version in the check).

llvm-svn: 324743
2018-02-09 16:06:39 +00:00
Pavel Labath 4d4d63ee18 Fix some warnings in SymbolFilePDB.cpp
llvm-svn: 324730
2018-02-09 11:37:01 +00:00
Pavel Labath a1181312ea llgs-test: Parse and store register info recieved from lldb-server
Summary:
Right now the test client is not parsing register values correctly,
which is manifesting itself in one test failing on 32-bit architectures
(pr36013). This parses the information from the qRegisterInfo packets
and stores it in the client, which will enable fixing the parsing in a
follow up commit.

I am also adding a new templated SendMessage overload, which enables one
to send a message get a parsed response in a single call.

Reviewers: eugene, davide

Subscribers: lldb-commits

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

llvm-svn: 324722
2018-02-09 09:40:03 +00:00
Aaron Smith 7ac1c78062 [SymbolFilePDB] Add support for function symbols
Summary:
This is combination of following changes,

- Resolve function symbols in PDB symbol file. `lldb-test symbols` will display information about function symbols.

- Implement SymbolFilePDB::FindFunctions methods. On lldb console, searching function symbol by name and by regular expression are both available.

- Create lldb type for PDBSymbolFunc.

- Add tests to check whether functions with the same name but from different sources can be resolved correctly.

Reviewers: zturner, lldb-commits

Reviewed By: zturner

Subscribers: amccarth, labath, llvm-commits

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

llvm-svn: 324707
2018-02-09 05:31:28 +00:00
Aaron Smith b38799c105 Recognize MSVC style mangling in CPlusPlusLanguage::IsCPPMangledName
Reviewers: zturner, lldb-commits, labath

Reviewed By: zturner

Subscribers: jingham, labath, davide, llvm-commits

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

llvm-svn: 324672
2018-02-08 23:11:56 +00:00
Aaron Smith 30d7309f6d Only throw -fPIC when building a shared library
Summary:
Update makefiles to specify -fPIC in Makefile.rules and only throw -fPIC when building a shared library. This change is necessary to allow building the lldb tests on Windows where -fPIC is not a valid option. 

Update a few places to Python 3.x syntax


Reviewers: zturner, lldb-commits

Reviewed By: zturner

Subscribers: stella.stamenova, labath, llvm-commits

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

llvm-svn: 324671
2018-02-08 23:10:29 +00:00
Adrian Prantl 244cccfce8 Rewrite testcase to not depend on Foundation implementation details.
TODO: Add a separate testcase testing *only* Foundation implementation details!

<rdar://problem/37252738>

llvm-svn: 324655
2018-02-08 21:52:28 +00:00
Pavel Labath 014e4654d4 Rewrite the flaky test_restart_bug test in a more deterministic way
Summary:
The test was trying to reproduce a bug in handling of two concurrent
events, which was impossible to do reliably in a black-box style test.
In practice, this meant the test was only ever failing on remote
targets, as these were slow enough to trigger this.

Fortunately, we now have the ability to mock the server side of the
connection, which means we can simulate the failure deterministically,
so I rewrite the test to use the new gdb-client framework.

I've needed to add a couple of new packets to the mock server to be able
to do this. Instead of trying to guess how a "typical" gdb-client test
will want to handle this, I throw an exception in the implementation to
force the user to override them (the packets are only sent if the test
explicitly performs some action which will trigger them, so a basic test
which e.g. does not need the "continue" functionality will not need to
implement them).

Reviewers: owenpshaw

Subscribers: srhines, lldb-commits

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

llvm-svn: 324590
2018-02-08 10:37:23 +00:00
Aaron Smith d80372c45e [docs] Update docs for cmake options LLDB_TEST_C_COMPILER and LLDB_TEST_CXX_COMPILER
Summary:
LLDB_TEST_COMPILER is not a valid option for CMake for LLDB. There are instead two properties LLDB_TEST_C_COMPILER and LLDB_TEST_CXX_COMPILER. Update the documents accordingly to reflect the correct information.


Reviewers: zturner, lldb-commits

Subscribers: llvm-commits

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

llvm-svn: 324564
2018-02-08 05:11:17 +00:00
Eugene Zemtsov 4c17d95bea Deactivate TestTargetSymbolsBuildidCase if host is windows
Makefile has unix magic and thus not working on windows.

llvm-svn: 324558
2018-02-08 03:05:47 +00:00
Aaron Smith 35cdfe2d1d Add CMAKE_CFG_INTDIR as part of the include path for the default test compiler.
Summary:
This is a small change towards running the LLDB unit tests on Windows (still WIP).

Builds that use make do not point to specific configurations. However, builds with multiple configurations such as Visual Studio on Windows need the configuration (release/debug/etc) as part of the path so the binaries produced by clang are placed in the correct directory for the configuration.

Reviewers: zturner, lldb-commits, labath

Reviewed By: labath

Subscribers: labath, mgorny, hintonda, llvm-commits

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

llvm-svn: 324555
2018-02-08 02:13:48 +00:00
Jim Ingham 9c82180d3a Remove an errant ^S
(still can't get over those Emacs habits...)

llvm-svn: 324509
2018-02-07 20:09:13 +00:00
Jonas Devlieghere ea6fbd92d8 [test] Don't drop existing categories for methods.
The change in r324488 dropped the existing category attribute in for
instance methods. This patch corrects that.

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

llvm-svn: 324492
2018-02-07 17:34:46 +00:00
Jonas Devlieghere 466396592d [test] Enable setting category for inline tests.
Inlined tests have a test function that is actually an instance method,
which requires a slightly different approach when it comes to setting
the category attribute. The attribute must be set on the actual
function, rather than on a particular instance.

llvm-svn: 324488
2018-02-07 16:10:59 +00:00
Pavel Labath 986b39b61f Remove function DW_DSC_value_to_name
It is unused, and the underlying llvm function has been removed as well.

llvm-svn: 324472
2018-02-07 11:13:21 +00:00
Jason Molenda fd443e9b6c lldb running on an ios device is using the _dyld_get_all_image_infos()
SPI call to to find its own shared cache's UUID.  On newer sytems we 
need to use the a new SPI which will return the UUID directly.

<rdar://problem/36625871> 

llvm-svn: 324437
2018-02-07 01:28:29 +00:00
Adrian Prantl f5ffbdbde0 Remove obsolete file
llvm-svn: 324400
2018-02-06 21:04:06 +00:00
Adrian Prantl dc797c0b55 Pass --build-dir to dotest in the Xcode project
llvm-svn: 324396
2018-02-06 20:48:35 +00:00
Eugene Zemtsov 9e916e5e0e More correct handling of error cases C++ name parser
Now incorrect type argument that looks like T<A><B> doesn't
cause an assert, but just a parsing error.

Bug: 36224
Differential Revision: https://reviews.llvm.org/D42939

llvm-svn: 324380
2018-02-06 19:04:12 +00:00
Adrian Prantl 332351d9b9 Build each testcase variant in its own subdirectory and remove the srcdir lock file
This patch creates a <test>.dwarf, <test>.dwo, etc., build directory for each testcase variant.
Most importantly, this eliminates the need for the per-test lock file in the source directory.

Tests that are marked as NO_DEBUG_INFO_TESTCASE and build with
buildDefault() are built in a <test>.default build directory.

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

llvm-svn: 324368
2018-02-06 18:22:51 +00:00
Davide Italiano d9a97a20c0 [testsuite] Skip a flakey test.
llvm-svn: 324293
2018-02-05 23:51:57 +00:00
Eugene Zemtsov 40ddcb8133 Disable test_restart_bug failing on Android
llvm-svn: 324288
2018-02-05 23:31:58 +00:00
Jason Molenda 8c0d106f5d Fix the cputype comparison in GDBRemoteCommunicationServerCommon::Handle_qHostInfo
to use Mach-O cpu types instead of the ArchSpec enum value, and handle the case
of bridgeos.

llvm-svn: 324287
2018-02-05 23:10:51 +00:00
Adrian Prantl 74bd5eb067 CMake: fix build directory name in clean rule
llvm-svn: 324281
2018-02-05 22:35:46 +00:00
Davide Italiano e3693a3e50 [lang/Objc] UNXFAIL a test. Nullability has been implemented in clang.
(a while ago).

<rdar://problem/20416388>

llvm-svn: 324280
2018-02-05 22:31:59 +00:00
Jan Kratochvil 50397237d9 refactor: DWARFCompileUnit::Producer -> DWARFProducer
Differential revision: https://reviews.llvm.org/D42891

llvm-svn: 324275
2018-02-05 21:50:01 +00:00
Pavel Labath bca95f8acc Add a comment explaining how the input for GetModuleSpecifications_EarlySectionHeaders was generated
Davide pointed out this would be useful if the file ever needs to be
regenerated (and I certainly agree).

I also replace the test binary with a slightly smaller one -- I intended
to do this in the original commit, but I forgot to add it to the patch
as I was juggling several things at the same time.

llvm-svn: 324256
2018-02-05 18:03:02 +00:00
Pavel Labath 4f0331251f Fix parsing of object files with "early" section headers
ObjectFileELF::GetModuleSpecifications contained a lot of tip-toing code
which was trying to avoid loading the full object file into memory. It
did this by trying to load data only up to the offset if was accessing.
However, in practice this was useless, as 99% of object files we
encounter have section headers at the end, so we would load the whole
file as soon as we start parsing the section headers.

In fact, this would break as soon as we encounter a file which does
*not* have section headers at the end (yaml2obj produces these), as the
access to .strtab (which we need to get the section names) was not
guarded by this offset check.

As this strategy was completely ineffective anyway, I do not attempt to
proliferate it further by guarding the .strtab accesses. Instead I just
lead the full file as soon as we are reasonably sure that we are indeed
processing an elf file.

If we really care about the load size here, we would need to reimplement
this to just load the bits of the object file we need, instead of
loading everything from the start of the object file to the given
offset. However, given that the OS will do this for us for free when
using mmap, I think think this is really necessary.

For testing this I check a (tiny) SO file instead of yaml2obj-ing it
because the fact that they come out first is an implementation detail of
yaml2obj that can change in the future.

llvm-svn: 324254
2018-02-05 17:25:40 +00:00
Kamil Rytarowski eb175a00ab Sync PlatformNetBSD.cpp with Linux
Summary:
Various changes in logging from log->Printf() to generic LLDB_LOG().

Sponsored by <The NetBSD Foundation>

Reviewers: labath, joerg

Reviewed By: labath

Subscribers: llvm-commits, lldb-commits

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

llvm-svn: 324251
2018-02-05 17:12:23 +00:00
Pavel Labath bcf201a843 Skip TestTargetSymbolsSepDebugSymlink on remote targets
Currently, our behavior when installing symlinks on the remote target is
broken (pr36237).

llvm-svn: 324236
2018-02-05 14:07:44 +00:00
Kamil Rytarowski 8a4bf06ba9 Fix a crash in *NetBSD::Factory::Launch
Summary:
We cannot call process_up->SetState() inside
the NativeProcessNetBSD::Factory::Launch
function because it triggers a NULL pointer
deference.

The generic code for launching a process in:
GDBRemoteCommunicationServerLLGS::LaunchProcess
sets the m_debugged_process_up pointer after
a successful call to  m_process_factory.Launch().
If we attempt to call process_up->SetState()
inside a platform specific Launch function we
end up dereferencing a NULL pointer in
NativeProcessProtocol::GetCurrentThreadID().

Use the proper call process_up->SetState(,false)
that sets notify_delegates to false.

Sponsored by <The NetBSD Foundation>

Reviewers: labath, joerg

Reviewed By: labath

Subscribers: lldb-commits

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

llvm-svn: 324234
2018-02-05 13:16:22 +00:00
Pavel Labath 5bc157443e TestLinuxCore -- add a check for thread name
We've had a bug (fixed by https://reviews.llvm.org/D42828) where the
thread name was being read incorrectly. Add a test for this behavior.

llvm-svn: 324230
2018-02-05 12:34:09 +00:00
Jonas Devlieghere f176aa1c75 [test] Un-XFAIL TestRaise.RaiseTestCase.test_restart_bug
This test was marked as an expected failure because of PR20231 but it
seems to consistently result in an unexpected success across the bots.
Let's try to re-enable this test again.

llvm-svn: 324227
2018-02-05 11:39:04 +00:00
Pavel Labath 55790fb7f8 [dotest] make debug info variant accessible in setUp()
Summary:
This changes the way we store the debug info variant to make it
available earlier in the test bringup: instead of it being set by the
test wrapper method, it is set as a *property* of the wrapper method.

This way, we can inspect it as soon as self.testMethodName is
initialized. The retrieval is implemented by a new function
TestBase.getDebugInfo(), and all that's necessary to make it work is to
change self.debug_info into self.getDebugInfo().

While searching for debug_info occurences i noticed that TestLogging is
being replicated for no good reason, so I removed the replication there.

Reviewers: aprantl, jingham

Subscribers: eraman, JDevlieghere, lldb-commits

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

llvm-svn: 324226
2018-02-05 11:30:46 +00:00
Jan Kratochvil 401df58064 Resolve binary symlinks before finding its separate .debug file
I have found LLDB cannot find separate debug info of Fedora /usr/bin/gdb.
It is because:

lrwxrwxrwx 1 root root       14 Jan 25 20:41 /usr/bin/gdb -> ../libexec/gdb*
-rwxr-xr-x 1 root root 10180296 Jan 25 20:41 /usr/libexec/gdb*
ls: cannot access '/usr/lib/debug/usr/bin/gdb-8.0.1-35.fc27.x86_64.debug': No such file or directory
-r--r--r-- 1 root root 29200464 Jan 25 20:41 /usr/lib/debug/usr/libexec/gdb-8.0.1-35.fc27.x86_64.debug

FYI that -8.0.1-35.fc27.x86_64.debug may look confusing, it was always just
.debug before.
Why is /usr/bin/gdb a symlink is offtopic for this bugreport, Fedora has it so
for some reasons.

It is always safest to look at the .debug file only after resolving all
symlinks on the binary file.

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

llvm-svn: 324224
2018-02-05 10:50:38 +00:00
Jan Kratochvil 4fc027105a Fix upper->lower case for /usr/lib/debug/.build-id/**.debug
I have found the lookup by build-id
(when lookup by /usr/lib/debug/path/name/exec.debug failed) does not work as
LLDB tries the build-id hex string in uppercase but Fedora uses lowercase.

xubuntu-16.10 also uses lowercase during my test:
/usr/lib/debug/.build-id/6c/61f3566329f43d03f812ae7057e9e7391b5ff6.debug

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

llvm-svn: 324222
2018-02-05 10:46:56 +00:00
Jason Molenda 35eb6c856a Turn off the deprecated ALWAYS_SEARCH_USER_PATHS feature
in debugserver.  This is already set this way in the lldb
project files but not in debugserver.  Updating for
consistency.

llvm-svn: 324158
2018-02-03 00:37:46 +00:00
Jason Molenda 37713073d6 Fix a copy of a fixed length, possibly non-nul terminated, string
into a std::string so we don't run off the end of the array when
there is no nul byte in ProcessElfCore::parseLinuxNotes.  
Found with ASAN testing.

<rdar://problem/37134319> 

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

llvm-svn: 324156
2018-02-02 22:48:45 +00:00
Jim Ingham 40207d5064 Add the ability to restrict the breakpoint to a module
for run_to_{source,name}_breakpoint.

llvm-svn: 324119
2018-02-02 18:39:25 +00:00
Adrian Prantl 34769d80dd Use an alternative approach to prevent Spotlight from indexing the build directory.
llvm-svn: 324115
2018-02-02 18:32:29 +00:00
Adrian Prantl e885768640 Create a marker for Spotlight to never index $BUILD_DIR.
LLDB queries Spotlight to locate .dSYM bundles based on the UUID
embedded in a binary, and because the UUID is a hash of filename and
.text section, there *will* be conflicts inside $BUILD_DIR.

This should fix the broken green dragon bots.

llvm-svn: 324019
2018-02-01 22:18:02 +00:00
Han Ming Ong 017edbddeb Make use of physical footprint as memory measurement.
Remove obsolete measurements.

This check in requires at least 10.11

Reviewed: Jason Molenda, Jim Ingham

<rdar://problem/37047106> Xcode Memory gauge should show the jetsam ledger footprint rather than anonymous

llvm-svn: 324013
2018-02-01 21:46:40 +00:00
Jim Ingham 0423fcac39 Added lldbutil.run_to_name_breakpoint and use it in one test.
Using the "run_to_{source,name}_breakpoint will allow us to remove
a lot of boiler-plate from the testsuite.  We mostly use source
breakpoints, but some tests use by name ones so this was needed.

llvm-svn: 324010
2018-02-01 21:35:50 +00:00
Jim Ingham 1765028d3c Remove unused Args variable, and #include of Args.h. NFC.
llvm-svn: 324008
2018-02-01 21:31:14 +00:00
Pavel Labath 7ae53e8c70 Extend windows->android XFAIL on TestLoadUnload
This fails regardless of the android architecture or compiler used. The
important bit is the mismatch in path separators.

llvm-svn: 323974
2018-02-01 15:35:55 +00:00
Pavel Labath 71ad71e530 mock_gdb_server: rectify ack handling code
The mock server was sending acks back in response to spurious acks from
the client, but the client was not prepared to handle these. Most of the
time this would work because the only time the client was sending
unsolicited acks is after the initial connection, and there reply-ack
would get ignored in the "flush all packets from the server" loop which
came after the ack. However, this loop had only a 10ms delay, and
sometimes this was not enough to catch the reply (which meant the
connection got out of sync, and test failed).

Since this behavior not consistent with how lldb-server handles this
situation (it just ignores the ack), I fix the mock server to do the
same.

llvm-svn: 323953
2018-02-01 11:29:06 +00:00
Adrian Prantl 7faa9dac84 replace os.mkdirs with lldbutil.mkdir_p (NFC)
llvm-svn: 323917
2018-01-31 21:39:00 +00:00
Pavel Labath f53288d596 Fix TestMixedDwarfBinary.py
As of yesterday, tests need to use self.getBuildArtifact() to get the
built executable.

llvm-svn: 323884
2018-01-31 16:23:24 +00:00
Davide Italiano 98f0021dd3 [lldb] Enable debugging of binaries with mixed (splitted/regular) dwarf
This recommits the patch, now that I verified that the bot instability
is due to something else. Sorry for the noise.

llvm-svn: 323879
2018-01-31 15:17:47 +00:00
Pavel Labath 73d8778437 Fix TestTargetSymbolsAddCommand makefile
We started passing the "all" target to make, which rendered the
"localall" trick in this Makefile inoperable.

I implement the strip step differently, and also reformat the Makefile.

llvm-svn: 323855
2018-01-31 09:14:12 +00:00
Davide Italiano 910f0a06c9 Revert "[lldb] Enable debugging of binaries with mixed (splitted/regular) dwarf"
It might have caused some instability on the bots.

llvm-svn: 323845
2018-01-31 04:13:37 +00:00
Alexander Shaposhnikov 2aea8f9787 [lldb] Enable debugging of binaries with mixed (splitted/regular) dwarf
Initialize the default value of SymbolFileDWARF uuid with 
the appropriately shifted DW_INVALID_OFFSET constant.
This change fixes the collision in the computation of DIE uid 
(inside DIERef::GetUID) and incorrect CompileUnit lookup
(because of the misleading cu_offset value).

Test plan: make check-lldb

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

llvm-svn: 323832
2018-01-30 23:45:20 +00:00
Adrian Prantl dbdda6a1e7 Enforce that NO_DEBUG_INFO_TESTCASEs build using buildDefault().
This is a prerequisite for building each test variant in its own subdirectory.

llvm-svn: 323830
2018-01-30 23:15:49 +00:00
Vedant Kumar e2fbd7035d XUnit Formatter: Handle UTF-8 decode errors on invalid XML
Strings which contain garbage data can trigger an exception in the XUnit
plugin at the UTF-8 decode step because the decode is strict. Use a lax
mode to avoid an exception.

See: https://ci.swift.org/job/oss-lldb-incremental-osx/780
llvm-svn: 323817
2018-01-30 21:16:42 +00:00
Vedant Kumar 61a29ded5d PR25934: Skip EventAPITestCase. It still SEGV's on Darwin.
See: https://ci.swift.org/job/swift-lldb-PR-osx/39

llvm.org/PR25934

llvm-svn: 323809
2018-01-30 19:49:05 +00:00
Adrian Prantl ee2d2bfbcd Add more diagnostics to help diagnose flaky test
llvm-svn: 323808
2018-01-30 19:40:09 +00:00
Jim Ingham 34b58a0ae4 Rewrite this test not to use pexpect.
llvm-svn: 323805
2018-01-30 18:43:31 +00:00
Adrian Prantl 5ec76fe720 Compile the LLDB tests out-of-tree.
This patch is the result of a discussion on lldb-dev, see
http://lists.llvm.org/pipermail/lldb-dev/2018-January/013111.html for
background.

For each test (should be eventually: each test configuration) a
separate build directory is created and we execute

  make VPATH=$srcdir/path/to/test -C $builddir/path/to/test -f $srcdir/path/to/test/Makefile -I $srcdir/path/to/test

In order to make this work all LLDB tests need to be updated to find
the executable in the test build directory, since CWD still points at
the test's source directory, which is a requirement for unittest2.

Although we have done extensive testing, I'm expecting that this first
attempt will break a few bots. Please DO NOT HESITATE TO REVERT this
patch in order to get the bots green again. We will likely have to
iterate on this some more.

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

llvm-svn: 323803
2018-01-30 18:29:16 +00:00
Adrian Prantl 43a68f1f03 Enforce that tests building with buildDefault set NO_DEBUG_INFO_TESTCASE
and fix resulting errors. This is a prerequisite for building each
test variant in its own build directory.

llvm-svn: 323789
2018-01-30 17:02:42 +00:00
Pavel Labath 26fa1f2be3 One more TestGDBRemoteClient/windows fix
We also need to be .EXE-aware when searching for the clang binary.

llvm-svn: 323763
2018-01-30 14:33:54 +00:00
Pavel Labath c561a6a920 Add LLDB_LOG_ERROR macro
Summary:
The difference between this and regular LLDB_LOG is that this one clears
the error object unconditionally.  This was inspired by the
ObjectFileELF bug (r322664), where the error object was being cleared
only if logging was enabled.

Reviewers: davide, zturner, jingham, clayborg

Subscribers: lldb-commits, emaste

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

llvm-svn: 323753
2018-01-30 12:19:34 +00:00
Pavel Labath 06f442c384 Fix TestGDBRemoteClient on windows
The logic was incorrect because on windows, we need to look for
yaml2obj.EXE. I implement the search in terms of
distutils.spawn.find_executable, which should handle the platform
differences for us.

llvm-svn: 323744
2018-01-30 10:41:46 +00:00
Pavel Labath af379085ef Skip TestWithModuleDebugging on i386 linux (pr36146)
It fails due to an assertion (if these are enabled).

llvm-svn: 323736
2018-01-30 09:39:22 +00:00
Vedant Kumar ba9838783a dotest: Apply --skip-categories to debug info categories
llvm-svn: 323723
2018-01-30 03:36:00 +00:00
Davide Italiano b0edeb90ab [test-suite] UNXfail several tests that now pass locally.
Another step towards enabling unexpected successes as failures
by default.

llvm-svn: 323707
2018-01-29 23:24:50 +00:00
Michal Gorny c061175fcd [Host] Respect LLVM_LIBDIR_SUFFIX when looking for LLDB plugins on Linux
Fix the Linux plugin lookup path to include appropriate libdir suffix
for the system. To accomplish this, store the value of
LLVM_LIBDIR_SUFFIX in lldb/Host/Config.h as LLDB_LIBDIR_SUFFIX,
and use this variable when defining the plugin path.

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

llvm-svn: 323673
2018-01-29 18:25:06 +00:00
Kirill Bobyrev de6fad6935 [lldb] Silence signed <-> unsigned integer comparison warning
`num_args` is unsigned integer, declared as below:

```
uint32_t num_args = arg_enum->getChildCount();
```

Comparison with the signed `arg_idx` produces a warning when compiled with
-Wsign-compare flag, this patch addresses this simple issue without affecting
any functionality.

Reviewers: davide, asmith
Subscribers: lldb-commits
Differential Revision: https://reviews.llvm.org/D42620

llvm-svn: 323645
2018-01-29 12:59:07 +00:00
Pavel Labath 02d4e50e9d Fix NetBsd build broken by r323637
llvm-svn: 323639
2018-01-29 11:10:21 +00:00
Pavel Labath 36e82208c7 Remove ObjectFile usage from HostLinux::GetProcessInfo
Summary:
The ObjectFile class was used to determine the architecture of a running
process by inspecting it's main executable. There were two issues with
this:
- it's in the wrong layer
- the call can be very expensive (it can end up computing the crc of the
  whole file).

Since the process is running on the host, ideally we would be able to
just query the data straight from the OS like darwin does, but there
doesn't seem to be a reasonable way to do that. So, this fixes the
layering issue by using the llvm object library to inspect the file.
Since we know the process is already running on the host, we just need
to peek at a few bytes of the elf header to determine whether it's 32-
or 64-bit (which should make this faster as well).

Pretty much the same logic was implemented in
NativeProcessProtocol::ResolveProcessArchitecture, so I delete this
logic and replace calls with GetProcessInfo.

Reviewers: eugene, krytarowski

Subscribers: mgorny, hintonda, lldb-commits

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

llvm-svn: 323637
2018-01-29 10:46:00 +00:00
Pavel Labath 1902ffd9a4 [lldb] Generic base for testing gdb-remote behavior
Summary:
Adds new utilities that make it easier to write test cases for lldb acting as a client over a gdb-remote connection.

- A GDBRemoteTestBase class that starts a mock GDB server and provides an easy way to check client packets
- A MockGDBServer that, via MockGDBServerResponder, can be made to issue server responses that test client behavior.
- Utility functions for handling common data encoding/decoding
- Utility functions for creating dummy targets from YAML files

----

Split from the review at https://reviews.llvm.org/D42145, which was a new feature that necessitated the new testing capabilities.

Reviewers: clayborg, labath

Reviewed By: clayborg, labath

Subscribers: hintonda, davide, jingham, krytarowski, mgorny, lldb-commits

Differential Revision: https://reviews.llvm.org/D42195
Patch by Owen Shaw <llvm@owenpshaw.net>

llvm-svn: 323636
2018-01-29 10:02:40 +00:00
Jan Kratochvil 6492caab1d Remove unused class declarations
Simplification by removing excessive DWARFCompileUnit references for D40466 .

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

llvm-svn: 323586
2018-01-27 14:35:33 +00:00
Davide Italiano 643b2b9e26 [lldbtestsuite] Don't crash on `None` input for is_exe().
Now the function returns `False`, and the caller can take the
appropriate action (in this case, for --executable, reporting
that the file doesn't exist).

llvm-svn: 323566
2018-01-26 21:46:10 +00:00
Pavel Labath 61e07bb481 gmodules XFAIL two more tests that only fail for android (pr36109)
llvm-svn: 323537
2018-01-26 16:05:46 +00:00
Pavel Labath e8524e0ca2 Fix linux fallout from c++ gmodules enable
TestLibcxxListLoop - fails because the evil "define private public"
  trick does not work with gmodules. The purpose of the test is not to
  test debug info parsing so I just mark it as no_debug_info_testcase.
  In the long term it may be interesting to write a mock std::list which
  will allow us to test bad inputs to data formatters more easily.
TestGModules - seems to be a genuine bug. Filed pr36107 and xfailed.

llvm-svn: 323520
2018-01-26 11:40:59 +00:00
Vedant Kumar c2ca1261a2 [test] Fix a test that never compiled under -fmodules
This test #include's stdio.h, which, on at least two bots results in a
module import of MacTypes.h (due to weird SDK layering issues), which
causes the test to fail to compile.

Just don't #include stdio.h, as it's not needed for the test.

llvm-svn: 323467
2018-01-25 21:20:29 +00:00
Vedant Kumar 801362f067 Use test-specific module caches to avoid stale header conflicts
Stale global module caches cause problems for the bots. The modules
become invalid when clang headers are updated by version control, and
tests which use these modules fail to compile, e.g:

  fatal error: file '.../__stddef_max_align_t.h' has been modified since the module file '/var/.../Darwin.pcm' was built
  note: please rebuild precompiled header '/var/.../Darwin.pcm'

Eventually we should transition to having just a single module cache to speed
tests up. This patch should be just enough to fix the spurious bot failures due
to stale caches.

rdar://36479805, also related to llvm.org/PR36048

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

llvm-svn: 323450
2018-01-25 18:01:27 +00:00
Saleem Abdulrasool be86661c6f www: update lldb architecture doc
ArchSpec was moved from Core to Utility, so I modified the docs to
reflect that.

Patch by Alex Langford <apl@fb.com>!

llvm-svn: 323363
2018-01-24 19:00:08 +00:00