Commit Graph

1299 Commits

Author SHA1 Message Date
Vedant Kumar bee500becb [test] Delete some xfailed lldb-mi tests
This is a first pass at removing some lldb-mi tests which have been
xfailed and unmaintained for a while. We have open PRs for most of these
tests already. I've opened up the following additional PRs:

  llvm.org/PR36739 - lldb-mi driver exits properly
  llvm.org/PR36740 - lldb-mi -gdb-set and -gdb-show
  llvm.org/PR36741 - lldb-mi -symbol-xxx

The motivation here is to address timeout and pexpect-related issues in
the test suite. This was discussed on lldb-dev in the thread: "increase
timeout for tests?".

After this change, the lldb-mi tests seem to be in better health (on
Darwin at least). I consistently get:

$ ./bin/llvm-dotest -p TestMi
===================
Test Result Summary
===================
Test Methods:        101
Reruns:                0
Success:              88
Expected Failure:      0
Failure:               0
Error:                 0
Exceptional Exit:      0
Unexpected Success:    0
Skip:                 13
Timeout:               0
Expected Timeout:      0

llvm-svn: 327552
2018-03-14 18:37:13 +00:00
Jonas Devlieghere 81ccb97024 [test] Disable TestMachCore everywhere except on Darwin
Apparently the parser is wrapped inside ifdef's so the logic isn't
available on non-Darwin platforms.

Should fix build bot failure:
  http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-cmake/builds/20463

llvm-svn: 327512
2018-03-14 14:16:23 +00:00
Jonas Devlieghere 25486b7512 Update selected thread after loading mach core
The OS plugins might have updated the thread list after a core file has
been loaded. The physical thread in the core file may no longer be the
one that should be selected. Hence we should run the thread selection
logic after loading the core.

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

llvm-svn: 327501
2018-03-14 11:50:10 +00:00
Pavel Labath 5a48f95a0f Skip TestWatchedVarHitWhenInScope.py everywhere
The expression-hits tracking logic is not available on any platform. The
reason this tests happens to pass on some platforms is that the test is
written poorly -- it relies on the fact that post-main cleanup code will
write to the stack memory once occupied by the watched variable, but
this is not the case everywhere (e.g. linux glibc does not seem to do
this, but android's bionic library does).

llvm-svn: 327483
2018-03-14 09:13:33 +00:00
Vedant Kumar 48ffd5cc6e [test] Replace some references to Apple-internal bugs
This removes around 10 references to Apple-internal radars. I've filed
fresh bugs on bugs.llvm.org as appropriate for open issues.

llvm-svn: 327463
2018-03-13 23:37:11 +00:00
Jim Ingham ca38766c9c Add a missing return in SBPlatform::IsConnected and test
for the behavior - using the fact that the Host platform
is always present & connected.

llvm-svn: 327448
2018-03-13 21:06:05 +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
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
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 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
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
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 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
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 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
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
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
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
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
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 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
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
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
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 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
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