Commit Graph

1853 Commits

Author SHA1 Message Date
Pavel Labath d50ec8ef5c @skipIfLinux flaky lldb-mi tests
llvm-svn: 358848
2019-04-21 13:02:49 +00:00
Pavel Labath e8687e6ee1 Make TestVSCode_step pass reliably
Summary:
The test was failing occasionally (1% of runs or so), because of
unpredictable timings between the two threads spawned by the test. If
the second thread hit the breakpoint right as we were stepping out of
the function on the first thread, we would still be stuck at the inner
frame when the process stopped.

This would cause errors like:
    File "/home/worker/lldb-x86_64-debian/lldb-x86_64-debian/llvm/tools/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/step/TestVSCode_step.py", line 67, in test_step
      self.assertEqual(x1, x3, 'verify step out variable')
  AssertionError: 2 != 1 : verify step out variable

AFAICT, lldb-vscode is doing the right thing here, and the problem is
that the test is not taking this sequence of events into account. Since
the test is about testing stepping, it does not seem necessary to have
threads in the inferior at all, so I just rewrite the test to execute
the code we're supposed to step through directly on the main thread.

Reviewers: clayborg, jgorbe

Subscribers: jfb, lldb-commits

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

llvm-svn: 358847
2019-04-21 13:02:41 +00:00
Jonas Devlieghere d600e6fa85 [Tests] Split float test into float and doubles
As I was waiting for the test suite to complete at 99% I noticed this
test taking quite a bit of time. Since it's easy to split I just went
ahead and did so.

llvm-svn: 358792
2019-04-19 22:37:55 +00:00
Jim Ingham d42b381445 This test doesn't need to be run for all debug formats.
llvm-svn: 358776
2019-04-19 18:46:56 +00:00
Michal Gorny 36d6bf8841 [lldb] [test] Mark three more tests flakey/xfail on NetBSD
llvm-svn: 358660
2019-04-18 12:31:48 +00:00
Kuba Mracek e5e9a6be6a [lldb] Don't filter variable list when doing a lookup by mangled name in SymbolFileDWARF::FindGlobalVariables
Differential Revision: https://reviews.llvm.org/D60737

llvm-svn: 358629
2019-04-18 00:15:44 +00:00
Pavel Labath 025b9d0f2e Breakpad: Match the new UUID algorithm in minidumps
D59433 and D60501 changed the way UUIDs are computed from minidump
files. This was done to synchronize the U(G)UID representation with the
native tools of given platforms, but it created a mismatch between
minidumps and breakpad files.

This updates the breakpad algorithm to match the one found in minidumps,
and also adds a couple of tests which should fail if these two ever get
out of sync. Incidentally, this means that the module id in the breakpad
files is almost identical to our notion of UUIDs, so the computation
algorithm can be somewhat simplified.

llvm-svn: 358500
2019-04-16 14:51:47 +00:00
Shafik Yaghmour e4b19c9c28 [ASTImporter] Regression test to ensure that we handling importing of anonymous enums correctly
Summary:
https://reviews.llvm.org/D51633 added error handling in the ASTImporter.cpp which uncovered an underlying bug in which we used the wrong name when handling naming conflicts. This could cause a segmentation fault when attempting to cast an int to an enum during expression parsing.

This test should pass once https://reviews.llvm.org/D59665 is committed.

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

llvm-svn: 358462
2019-04-15 23:05:45 +00:00
Pavel Labath 539b7e65b4 Make TestPrintStackTraces deterministic
This test contained an incredibly complicated inferior, but in reality,
all it was testing was that we can backtrace up to main and see main's
arguments.

However, the way this was implemented (setting a breakpoint on a
separate thread) meant that each time the test would run, it would stop
in a different location on the main thread. Most of the time this
location would be deep in some libc function, which meant that the
success of this test depended on our ability to backtrace out of a
random function of the c library that the user happens to have
installed.

This makes the test unpredictable. Backtracing out of a libc function is
an important functionality, but this is not the way to test it. Often it
is not even our fault that we cannot backtrace out because the C library
contains a lot of assembly routines that may not have correct unwind
info associated with them.

For this reason the test has accumulated numerous @expectedFail/Flaky
decorators. In this patch, I replace the inferior with one that does not
depend on libc functions. Instead I create a couple of stack frames of
user code, and have the test verify that. I also simplify the test by
using lldbutil.run_to_source_breakpoint.

llvm-svn: 358266
2019-04-12 08:02:28 +00:00
Aaron Smith 4b0931bc17 [lldb-server] Update tests to use std::thread/mutex for all platforms
Summary:
Some cleanup suggested when bringing up lldb-server on Windows. 
Thanks to Hui Huang for the patch.

Reviewers: zturner, labath, jfb, Hui

Reviewed By: labath

Subscribers: clayborg, dexonsmith, lldb-commits

Tags: #lldb

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

llvm-svn: 358265
2019-04-12 07:48:49 +00:00
Jonas Devlieghere d843da6218 [test] Convert CommandScriptImmediateOutput from pexpect to lit
This converts the CommandScriptImmediateOutput test from a python test
using pexpect to a lit test.

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

llvm-svn: 358180
2019-04-11 15:03:07 +00:00
Pavel Labath 71b88b91f7 Minidump: extend UUID byte-swapping to windows platform
Summary:
D59433 added code to swap bytes UUIDs coming from minidump files, but
only enabled it for apple platforms. Based on my research, I believe
this is the correct thing to do for windows as well, as the natural way
of printing U(G)UIDs on this platforms is to print the first three
components as (4 or 2)-byte integers printed in natural (big-endian)
order. This makes the UUID string coming out of lldb match the strings
produced by other windows tools.

The decision to byte-swap the age field is somewhat arbitrary, because
the age field is usually printed separately from the file GUID (and
often in decimal). However, for our purposes (telling whether two files
are identical), including it in the UUID is correct, and printing it in
big-endian makes it easier to recognize the age value.

This also makes the UUIDs generated here (almost) match up with the
UUIDs computed for breakpad symbol files
(BreakpadRecords.cpp:parseModuleId), which already implemented the
byte-swapping. The "almost" is here because ObjectFileBreakpad does not
swap the age field, but I'll fix that in a follow-up.

There is no UUID support in ObjectFileCOFF at the moment, but ideally
the algorithms used here and in ObjectFileCOFF should be in sync so that
object file matching works correctly.

Reviewers: clayborg, amccarth, markmentovai, asmith

Subscribers: lldb-commits

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

llvm-svn: 358169
2019-04-11 14:14:07 +00:00
Adrian Prantl 3cc634d093 Fix undefined behavior in DWARFASTParser::ParseChildArrayInfo()
PR40827: https://bugs.llvm.org/show_bug.cgi?id=40827
<rdar://problem/48729057>

llvm-svn: 358137
2019-04-10 21:18:44 +00:00
Jonas Devlieghere 6a7412a893 [testsuite] Split Obj-C foundation test
TestObjCMethods2.py was the third-longest running test on Darwin. By
splitting it up, lit can exploit parallelism to reduce the total wall
clock time.

llvm-svn: 358088
2019-04-10 14:30:00 +00:00
Jason Molenda 1724a179e7 Rename Target::GetSharedModule to Target::GetOrCreateModule.
Add a flag to control whether the ModulesDidLoad notification is
called when a module is added.  If the notifications are disabled,
the caller must call ModulesDidLoad after adding all the new modules,
but postponing this notification until they're all batched up can
allow for better efficiency than notifying one-by-one.

Change the name of the ModuleList notifier functions that a subclass
can implement to start with 'Notify' to make it clear what they are.
Add a NotifyModulesRemoved.

Add header documentation for the changed/updated methods.

Added defaulted-value 'notify' argument to ModuleList Append,
AppendIfNeeded, and Remove because callers working with a local
ModuleList don't have an obvious idea of what notify means in this
context.  When the ModuleList is a part of the Target class, the
notify behavior matters.

DynamicLoaderDarwin has been updated so that libraries being
added/removed are correctly batched up before notifications are
sent.  Added the TestModuleLoadedNotifys.py test to run on 
Darwin to test this.

<rdar://problem/48293064> 

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

llvm-svn: 357955
2019-04-08 23:03:02 +00:00
Jonas Devlieghere 9388c4703b [testsuite] Split Objective-C new syntax test
This splits the second longest test into separate test cases. Similar to
what we did for the Objective-C data formatters in r357786.

llvm-svn: 357824
2019-04-05 22:06:53 +00:00
Jonas Devlieghere 944c20c05b [Test] Remove no_debug_info_test decorator from Obj-C data formatters.
As discussed in https://reviews.llvm.org/D60300.

llvm-svn: 357813
2019-04-05 20:37:52 +00:00
Jonas Devlieghere ff75262f70 [testsuite] Split Objective-C data formatter
The testcase for objective-c data formatters is very big as it checks a
bunch of stuff. This is annoying when using the lit test driver, because
it prevents us from running the different cases in parallel. As a
result, it's always one of the last few tests that complete. This patch
splits the test into multiple files that share a common base class. This
way lit can run the different tests in parallel.

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

llvm-svn: 357786
2019-04-05 17:57:40 +00:00
Pavel Labath 546bccf61c TestVCCode_step: replace assertTrue with more specific assertions
When this test fails (flakes) all we get is an error message like "False
is not True". This replaces patterns like assertTrue(a == b) with
assertEqual(a, b), so we get a better error message (and hopefully a
hint as to why the test is flaky).

llvm-svn: 357747
2019-04-05 07:56:26 +00:00
Pavel Labath e090389c4a modify-python-lldb.py: (Re)move __len__ and __iter__ support
Summary:
This patch moves the modify-python-lldb code for adding new functions to
the SBModule class into the SBModule interface file. As this is the last
class using this functionality, I also remove all support for this kind
of modifications from modify-python-lldb.py.

Reviewers: amccarth, clayborg, jingham

Subscribers: zturner, lldb-commits

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

llvm-svn: 357680
2019-04-04 10:13:59 +00:00
Stella Stamenova e51c12430f Un-xfail one of the TestMiniDumpUUID tests on Windows
The test is passing on Windows and the windows bot is failing because of the unexpected pass

llvm-svn: 357641
2019-04-03 21:57:41 +00:00
Jorge Gorbe Moya 060bf99f49 Re-enable most lldb-vscode tests on Linux.
Summary:
After https://reviews.llvm.org/D59828 and https://reviews.llvm.org/D59849,
I believe the problems with these tests hanging have been solved.

I tried enabling all of them on my machine, and got two failures:

- One of them was spawning a child process that lives for 5 seconds, waited
  for 5 seconds to attach to the child, and failed because the child wasn't
  there.

- The other one was a legit failure because shell expansion of arguments doesn't
  work on Linux.

This tests enables all lldb-vscode tests on Linux except for "launch process
with shell expansion of args" (which doesn't work), and fixes the other broken
test by reducing the time it waits before attaching to its child process.

Reviewers: zturner, clayborg

Subscribers: lldb-commits

Tags: #lldb

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

llvm-svn: 357633
2019-04-03 20:43:20 +00:00
Greg Clayton bbc428e93a Attempt #2 to get this patch working. I will watch the build bots carefully today.
Allow partial UUID matching in Minidump core file plug-in

Breakpad had bugs in earlier versions where it would take a 20 byte ELF build ID and put it into the minidump file as a 16 byte PDB70 UUID with an age of zero. This would make it impossible to do postmortem debugging with one of these older minidump files.

This fix allows partial matching of UUIDs. To do this we first try and match with the full UUID value, and then fall back to removing the original directory path from the module specification and we remove the UUID requirement, and then manually do the matching ourselves. This allows scripts to find symbols files using a symbol server, place them all in a directory, use the "setting set target.exec-search-paths" setting to specify the directory, and then load the core file. The Target::GetSharedModule() can then find the correct file without doing any other matching and load it.

Tests were added to cover a partial UUID match where the breakpad file has a 16 byte UUID and the actual file on disk has a 20 byte UUID, both where the first 16 bytes match, and don't match.

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

llvm-svn: 357603
2019-04-03 16:30:44 +00:00
Pavel Labath 4da5a1dbab modify-python-lldb.py: clean up __iter__ and __len__ support
Summary:
Instead of modifying the swig-generated code, just add the appropriate
methods to the interface files in order to get the swig to do the
generation for us.

This is a straight-forward move from the python script to the interface
files. The single class which has nontrivial handling in the script
(SBModule) has been left for a separate patch.

For the cases where I did not find any tests exercising the
iteration/length methods (i.e., no tests failed after I stopped emitting
them), I tried to add basic tests for that functionality.

Reviewers: zturner, jingham, amccarth

Subscribers: jdoerfert, lldb-commits

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

llvm-svn: 357572
2019-04-03 11:48:38 +00:00
Adrian Prantl 1b5310c2df Revert r357504, r357491, r357482 because of bot breakage.
See discussion in https://reviews.llvm.org/D60001.

Revert Clean up windows build bot.
This reverts r357504 (git commit 380c2420ec)
Revert Fix buildbot where paths were not matching up.
This reverts r357491 (git commit 5050586860)
Revert Allow partial UUID matching in Minidump core file plug-in
This reverts r357482 (git commit 838bba9c34)

llvm-svn: 357534
2019-04-02 22:03:22 +00:00
Greg Clayton 380c2420ec Clean up windows build bot.
llvm-svn: 357504
2019-04-02 17:50:08 +00:00
Greg Clayton 5050586860 Fix buildbot where paths were not matching up.
llvm-svn: 357491
2019-04-02 16:36:34 +00:00
Greg Clayton 838bba9c34 Allow partial UUID matching in Minidump core file plug-in
Breakpad had bugs in earlier versions where it would take a 20 byte ELF build ID and put it into the minidump file as a 16 byte PDB70 UUID with an age of zero. This would make it impossible to do postmortem debugging with one of these older minidump files.

This fix allows partial matching of UUIDs. To do this we first try and match with the full UUID value, and then fall back to removing the original directory path from the module specification and we remove the UUID requirement, and then manually do the matching ourselves. This allows scripts to find symbols files using a symbol server, place them all in a directory, use the "setting set target.exec-search-paths" setting to specify the directory, and then load the core file. The Target::GetSharedModule() can then find the correct file without doing any other matching and load it.

Tests were added to cover a partial UUID match where the breakpad file has a 16 byte UUID and the actual file on disk has a 20 byte UUID, both where the first 16 bytes match, and don't match.

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

llvm-svn: 357482
2019-04-02 15:40:54 +00:00
Pavel Labath c5cefa2caf Fix flakyness in TestCommandScriptImmediateOutput
I'm not sure why this surfaced at this particular point, but
TestCommandScriptImmediateOutput (a pexpect test) had a synchronization
issue, where the (lldb) promts it was expecting were getting out of
sync. This happened for two reasons:
- it did not expect the initial (lldb) prompt we print at startup
- launchArgs() returned None, which resulted in an extra "target create
  None" command being issued to lldb (and an extra unhandled prompt
  being printed).

Resolving these two issues seems to fix (or at least, improve) the test.

llvm-svn: 357459
2019-04-02 09:45:40 +00:00
Pavel Labath 821263faa5 Fix llvm_unreachable in TestWriteMemory
The test was hitting llvm_unreachable in
Platform::GetSoftwareBreakpointTrapOpcode because it could not figure
out the architecture of the process. Since that is not the purpose of
the test, I change the test to use an explicit
CreateTargetWithFileAndTargetTriple command to specify it.

llvm-svn: 357456
2019-04-02 08:56:22 +00:00
Pavel Labath 155bc16e7f Simplify TestGdbRemoteRegisterState
While reviewing D56233 it became clear to me that this test can be
simplified. There's no need for a start-stop cycle in the inferior -- we
can start fiddling with its registers as soon as it is launched.

llvm-svn: 357451
2019-04-02 07:47:38 +00:00
Jorge Gorbe Moya 4665aca8ca [lldb-vscode] Add logic to handle EOF when reading from lldb-vscode stdout.
Summary:
This change prevents the lldb-vscode test harness from hanging up waiting for
new messages when the lldb-vscode subprocess crashes.

Now, when an EOF from the subprocess pipe is detected we enqueue a `None` packet
in the received packets list. Then, during the message processing loop, we can
use this `None` packet to tell apart the case where lldb-vscode has terminated
unexpectedly from the normal situation where no pending messages means blocking
and waiting for more data.

I believe this should be enough to fix the issues with these tests hanging on
multiple platforms. Once this lands, I'll prepare and test a separate change
removing the @skipIfLinux annotations.

Reviewers: clayborg, zturner

Subscribers: lldb-commits

Tags: #lldb

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

llvm-svn: 357426
2019-04-01 20:37:22 +00:00
Med Ismail Bennani 62bcf73683 [Process] Fix WriteMemory return value
Summary:
In case of a breakpoint site overlapping with the destination address,
the WriteMemory method reported an incorrect memory size.

Instead of returning the right amount of bytes written, it falls through
the scope and returned 0.

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>

Reviewers: jasonmolenda, friss, jingham

Subscribers: JDevlieghere, davide, lldb-commits, #lldb

Tags: #lldb

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

llvm-svn: 357420
2019-04-01 19:08:47 +00:00
Michal Gorny d8519f4a7d [lldb] [Process/elf-core] Support aarch64 NetBSD core dumps
Include support for NetBSD core dumps from evbarm/aarch64 system,
and matching test cases for them.

Based on earlier work by Kamil Rytarowski.

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

llvm-svn: 357399
2019-04-01 15:08:24 +00:00
Shafik Yaghmour a1f1ff8896 Fix for regression test, since we rely on the formatter for std::vector in the test we need a libc++ category.
See differential https://reviews.llvm.org/D59847 for initial change that this fixes

llvm-svn: 357210
2019-03-28 20:25:57 +00:00
Jim Ingham 43aaafc0e1 Fix the swig typemap for "uint32_t *versions, uint32_t num_versions".
It was making a list of a certain size but not always filling in that
many elements, which would lead to a crash iterating over the list.

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

llvm-svn: 357207
2019-03-28 19:25:54 +00:00
Shafik Yaghmour 0f71a25e98 Regression test to ensure that we handling importing of std::vector of enums correctly
Summary:
https://reviews.llvm.org/D59845 added a fix for the IsStructuralMatch(...) specialization for EnumDecl this test should pass once this fix is committed.

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

llvm-svn: 357188
2019-03-28 17:22:13 +00:00
Jonas Devlieghere f8819bd510 [Platform] Remove Kalimba Platform
This patch removes the Kalimba platform. For more information please
refer to the corresponding thread on the mailing list.

http://lists.llvm.org/pipermail/lldb-dev/2019-March/014921.html

llvm-svn: 357086
2019-03-27 16:23:50 +00:00
Pavel Labath 9f1a7e559c Rename some variables in the std-module tests
They cause failures on some systems due to an unrelated bug (pr35043).
This works around that.

llvm-svn: 357080
2019-03-27 15:52:11 +00:00
Pavel Labath 2ef15d82e9 Reapply minidump changes reverted in r356806
The changes were reverted due to ubsan errors (unaligned accesses). Here
I fix those errors by first copying the data into aligned storage.
Besides fixing alignment issues, this also fixes reading of minidump
strings on big-endian systems.

llvm-svn: 356896
2019-03-25 14:02:16 +00:00
Jonas Devlieghere f261638c10 Revert minidump changes
This reverts the following two commits:

Revert "Extend r356573 (minidump UUID handling) to cover elf build-ids too"
Revert "Fix UUID decoding from minidump files"

Greg's original commit broke the sanitizer bot which has been red for
several days now.

http://green.lab.llvm.org/green/view/LLDB/job/lldb-sanitized/

llvm-svn: 356806
2019-03-22 20:46:46 +00:00
Pavel Labath 3285c0f065 Extend r356573 (minidump UUID handling) to cover elf build-ids too
Breakpad (but not crashpad) will insert an empty (all-zero) build-id
record for modules which do not have a build-id. This tells lldb to
treat such records as empty/invalid uuids.

llvm-svn: 356751
2019-03-22 14:03:59 +00:00
Adrian Prantl 74f0e2cc39 Makefile.rules: Normalize use of trailing slashes in path variables.
llvm-svn: 356711
2019-03-21 20:36:23 +00:00
Serge Guelton 32cffcf1ab Use list comprehension instead of map/filter to prepare Python2/3 compat
Differential Revision: https://reviews.llvm.org/D59579

llvm-svn: 356647
2019-03-21 07:19:09 +00:00
Greg Clayton 621e8b4387 Fix UUID decoding from minidump files
This patch fixes:

UUIDs now don't include the age field from a PDB70 when the age is zero. Prior to this they would incorrectly contain the zero age which stopped us from being able to match up the UUID with real files.
UUIDs for Apple targets get the first 32 bit value and next two 16 bit values swapped. Breakpad incorrectly swaps these values when it creates darwin minidump files, so this must be undone so we can match up symbol files with the minidump modules.
UUIDs that are all zeroes are treated as invalid UUIDs. Breakpad will always save out a UUID, even if one wasn't available. This caused all files that have UUID values of zero to be uniqued to the first module that had a zero UUID. We now don't fill in the UUID if it is all zeroes.
Added tests for PDB70 and ELF build ID based CvRecords.

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

llvm-svn: 356573
2019-03-20 16:50:17 +00:00
Adrian Prantl da8c0e4a3c Improve error handling for Clang module imports.
rdar://problem/48883558

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

llvm-svn: 356462
2019-03-19 15:38:26 +00:00
Pavel Labath 0e5012eac3 Skip TestVSCode_setFunctionBreakpoints on linux
Test hangs under heavy load.

llvm-svn: 356379
2019-03-18 16:04:53 +00:00
Pavel Labath 58e9ef139d Fix TestCommandScriptImmediateOutput for python3
s/iteritems/items

llvm-svn: 356370
2019-03-18 14:13:12 +00:00
Adrian Prantl 2ebbb88960 Implement a better way of not passing the sanitizer environment on to tests.
rdar://problem/48889580

llvm-svn: 356275
2019-03-15 17:22:00 +00:00
Adrian Prantl ac093d61c4 Fix a double-overrelease in the TestDataFormatterObjC test program.
llvm-svn: 356160
2019-03-14 15:58:21 +00:00
Adrian Prantl 23b37bf362 Make sure that a sanitizer LLDB's environment doesn't get passed on
to test binaries.

llvm-svn: 356113
2019-03-14 00:46:15 +00:00
Davide Italiano 9e75a08409 [Python] Fix TestDataFormatterSmartArray to work across python versions.
Python 3 default encoding is utf-8, so taking random bytes and
interpreting them as a string might result in invalid unicode sequences.
As the only thing we care about here is that the formatter shows the
elements of the underyling array, relax the string matching (this is
good enough as all the elements are distinct so they resolve to different
strings).

llvm-svn: 356096
2019-03-13 20:04:34 +00:00
Stella Stamenova 823d9f3cdf [lldbsuite] Un-xfail TestPyObjSynthProvider on Windows
One of Davide's changes yesterday fixed the behavior on Windows, so the test is now passing.

llvm-svn: 356065
2019-03-13 16:53:53 +00:00
Davide Italiano 0b29af0f7c [TestBatchMode] We already log this output to a file.
llvm-svn: 356003
2019-03-13 02:47:51 +00:00
Davide Italiano cd49351212 [testsuite] Remove other traces broken in python 3.
They can be reinstated in case somebody needs to debug
this test in the future.

llvm-svn: 356002
2019-03-13 02:44:32 +00:00
Davide Italiano 796aa0e49a [testsuite] Remove dead code in TestFormats.
llvm-svn: 356000
2019-03-13 01:26:01 +00:00
Davide Italiano a85f662ada [test] Some unicode sequences can't be printed, and Py 3 is more picky.
Given this was under trace, it can just be removed. If somebody
ever needs to debug this testcase again and print the data, they
can add a new statement.

llvm-svn: 355999
2019-03-13 00:48:32 +00:00
Davide Italiano ca715b6ea0 [Python] Fix another batch of python 2/python 3 portability issues.
llvm-svn: 355998
2019-03-13 00:48:29 +00:00
Adrian Prantl 97f51c95db Fix the broken Batch test by passing a custom module cache to the inferior lldb.
llvm-svn: 355991
2019-03-12 22:20:29 +00:00
Adrian Prantl df85147707 Revert "Temporarily add more logging to TestBatchMode"
llvm-svn: 355990
2019-03-12 22:20:26 +00:00
Adrian Prantl 8ef3da494c Temporarily add more logging to TestBatchMode
llvm-svn: 355986
2019-03-12 21:30:50 +00:00
Davide Italiano 2bd995b7e8 [lldb-mi] Make this test more reliable. NFC.
Except that it will probably stop failing on and off on my machine.

llvm-svn: 355968
2019-03-12 20:41:29 +00:00
Jim Ingham 2ca0ebf6b4 Re-enable this test, the underlying bug was fixed and the test now passes.
llvm-svn: 355956
2019-03-12 19:25:29 +00:00
Raphael Isemann 6c0bbfc0c9 Add ability to import std module into expression parser to improve C++ debugging
Summary:
This patch is the MVP version of importing the std module into the expression parser to improve C++ debugging.

What happens in this patch is that we inject a `@import std` into our expression source code. We also
modify our internal Clang instance for parsing this expression to work with modules and debug info
at the same time (which is the main change in terms of LOC). We implicitly build the `std` module on the first use. The
C++ include paths for building are extracted from the debug info, which means that this currently only
works if the program is compiled with `-glldb -fmodules` and uses the std module. The C include paths
are currently specified by LLDB.

I enabled the tests currently only for libc++ and Linux because I could test this locally. I'll enable the tests
for other platforms once this has landed and doesn't break any bots (and I implemented the platform-specific
C include paths for them).

With this patch we can now:
* Build a libc++ as a module and import it into the expression parser.
* Read from the module while also referencing declarations from the debug info. E.g. `std::abs(local_variable)`.

What doesn't work (yet):
* Merging debug info and C++ module declarations. E.g. `std::vector<CustomClass>` doesn't work.
* Pretty much anything that involves the ASTImporter and templated code. As the ASTImporter is used for saving the result declaration, this means that we can't
call yet any function that returns a non-trivial type.
* Use libstdc++ for this, as it requires multiple include paths and Clang only emits one include path per module. Also libstdc++ doesn't support Clang modules without patches.

Reviewers: aprantl, jingham, shafik, friss, davide, serge-sans-paille

Reviewed By: aprantl

Subscribers: labath, mgorny, abidh, jdoerfert, lldb-commits

Tags: #c_modules_in_lldb, #lldb

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

llvm-svn: 355939
2019-03-12 17:09:33 +00:00
Raphael Isemann a946997c24 Correctly look up declarations in inline namespaces
Summary:
This patch marks the inline namespaces from DWARF as inline and also ensures that looking
up declarations now follows the lookup rules for inline namespaces.

Reviewers: aprantl, shafik, serge-sans-paille

Reviewed By: aprantl

Subscribers: eraman, jdoerfert, lldb-commits

Tags: #c_modules_in_lldb, #lldb

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

llvm-svn: 355897
2019-03-12 07:45:04 +00:00
Greg Clayton 0d6f681292 Fix a crasher in StackFrame::GetValueForVariableExpressionPath()
There was a crash that would happen if an IDE would ask for a child of a shared pointer via any SB API call that ends up calling StackFrame::GetValueForVariableExpressionPath(). The previous code expects an error to be set describing why the synthetic child of a type was not able to be found, but we have some synthetic child providers that weren't setting the error and returning an empty value object shared pointer. This fixes that to ensure we don't lose our debug session by crashing, fully tests GetValueForVariableExpressionPath functionality, and ensures we don't crash on GetValueForVariableExpressionPath() in the future.

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

llvm-svn: 355850
2019-03-11 18:16:20 +00:00
Adrian Prantl 5cc2790410 Makefile.rules: Upstream SDKROOT handling code for Darwin.
llvm-svn: 355843
2019-03-11 17:24:10 +00:00
Adrian Prantl f05b42e960 Bring Doxygen comment syntax in sync with LLVM coding style.
This changes '@' prefix to '\'.

llvm-svn: 355841
2019-03-11 17:09:29 +00:00
Michal Gorny b94c24e2ac [lldb] [test] Mark more tests flakey on NetBSD
llvm-svn: 355838
2019-03-11 17:01:31 +00:00
Michal Gorny 3aa36c9a47 [lldb] [test] Mark a few tests flakey on NetBSD
llvm-svn: 355830
2019-03-11 15:46:07 +00:00
Michal Gorny 369a011cee [lldb] [test] Make 2lwp_process_SIGSEGV test more portable
Fix 2lwp_process_SIGSEGV NetBSD core test to terminate inside regular
function rather than libc call, in order to get reproducible backtrace
on different platforms.

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

llvm-svn: 355786
2019-03-10 09:50:36 +00:00
Michal Gorny 377d9dc872 [lldb] [test] Adjust XFAIL list to match buildbot results
Adjust the XFAIL-ing tests to match consistent results from buildbot.
I'm going to work on differences between them and my local results
following this.

llvm-svn: 355774
2019-03-09 12:47:38 +00:00
Frederic Riss 08ae3e0f0b Actually implement the TestQueues.py workaround
The code commited in r355764 didn't do what I want as I typed GetThreadID
instead of GetQueueID. This commit contains a (hopefully) better version
of the workaround.

llvm-svn: 355766
2019-03-09 01:34:44 +00:00
Frederic Riss 65e062655e Try to workaround the TestQueues.py flakyness
This is not a fix, but if I understand enough of the issue, it should
bail out early of the test when in a situation that would result in
a failure down the road.

llvm-svn: 355764
2019-03-09 01:23:47 +00:00
Michal Gorny 942e6c7c9e [lldb] [test] Skip broken NetBSD core test
Apparently the problem is harder than anticipated.  Skip the test for
now to fix buildbots.

llvm-svn: 355750
2019-03-08 22:41:14 +00:00
Michal Gorny 7b374be946 [lldb] [test] Do not check libc function names in NetBSD core test
Fix the NetBSD core test not to verify libc function names in backtrace.
This obviously requires the same libc.so as originally used to produce
the core file, and so it is going to fail everywhere except on my
system.

llvm-svn: 355747
2019-03-08 22:32:35 +00:00
Michal Gorny c12f159788 [lldb] [Process] Add proper support for NetBSD core files with threads
Improve the support for processing NetBSD cores.  Fix reading process
identifier, thread information and associating the terminating signal
with the correct thread.

Includes test cases for single-threaded program receiving SIGSEGV,
and two dual-threaded programs: one where thread receives the signal,
and the other one when the whole process is signalled.

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

llvm-svn: 355736
2019-03-08 21:10:43 +00:00
Frederic Riss 7f3c16c0f3 Add more logging to TestQueues.py
The last round of logging taught us that when the test fails, lldb
is indeed aware of the thread it's failing to associate to a given
queue. Add more logging to try to figure out why the thread and the
queue do not appear related to the Queue APIs.

llvm-svn: 355706
2019-03-08 17:09:13 +00:00
Jason Molenda 988332a54a Add ASAN llvm build directory variants to
get_llvm_bin_dirs().

llvm-svn: 355661
2019-03-08 04:18:21 +00:00
Alex Langford d672e533d5 Fix TestPaths.py on windows
I committed an implementation of GetClangResourceDir on windows but
forgot to update this test. I merged the tests like I intended to, but I
realized that the test was actually failing. After looking into it, it
appears that FileSystem::Resolve was taking the path and setting
the FileSpec's Directory to "/path/to/lldb/lib/clang/" and the File to
"9.0.0" which isn't what we want. So I removed the resolve line from
DefaultComputeClangResourceDir.

llvm-svn: 355648
2019-03-07 22:37:23 +00:00
Frederic Riss 46fac9c4f2 Add logging to TestQueues.py
In an attempt to understand why the test is still failing after r355555,
add some logging.

llvm-svn: 355647
2019-03-07 22:28:01 +00:00
Frederic Riss c525b36b43 Fix TestAppleSimulatorOSType.py with Xcode 10.2
It looks like the simctl tool shipped in Xcode10.2 changed the format of
its json output.

llvm-svn: 355644
2019-03-07 22:12:03 +00:00
Davide Italiano 47a149914d [testsuite] Recommit the TestTerminal directory.
Turns out this is actually testing that editline doesn't
screw up the terminal.

llvm-svn: 355640
2019-03-07 21:33:43 +00:00
Davide Italiano 2f94dcec5a [testsuite] Spring cleaning: this tests `stty`, not `lldb`.
llvm-svn: 355615
2019-03-07 18:05:18 +00:00
Davide Italiano bd53e768d2 [testsuite] Drop characters that can't be decoded, restoring parity with Py2.
Tests that check the output of `memory find` may trip over
unreadable characters, and in Python 3 this is an error.

llvm-svn: 355612
2019-03-07 17:45:53 +00:00
Adrian Prantl 59a94225c9 Relax testcase.
Recent versions of llvm monorepo builds build libc++abi.dylib as libc++abi.1.dylib.
This accespts both variants.

llvm-svn: 355571
2019-03-07 00:34:13 +00:00
Raphael Isemann a4a167fb75 Remove redundant second os.path.join call [NFC]
llvm-svn: 355548
2019-03-06 20:51:28 +00:00
Greg Clayton 6795eb3884 Fix core files for 32 bit architectures that are supported in ProcessELFCore.cpp
Core files need to know the size of the PRSTATUS header so that we can grab the register values that follow it. The code that figure out this size was using a hard coded list of architecture cores instead of relying on 32 or 64 bit for most cores.

The fix here fixes core files for 32 bit ARM. Prior to this the PRSTATUS header size was being returned as zero and the register values were being taken from the first bytes of the PRSTATUS struct (signo, etc).

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

llvm-svn: 355526
2019-03-06 18:04:10 +00:00
Shafik Yaghmour 641d0b8cee Adding test to cover the correct import of SourceLocation pertaining to a built-in during expression parsing
Summary: This tests a fix in the ASTImpoter.cpp to ensure that we import built-in correctly,
see differential: https://reviews.llvm.org/D58743
Once this change is merged this test should pass and should catch regressions in this feature.

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

llvm-svn: 355525
2019-03-06 18:03:54 +00:00
Michal Gorny a2cc148f9f [lldb] [test] Pass appropriate -L&-Wl,-rpath for libc++ on NetBSD
Pass appropriate -L and -Wl,-rpath flags pointing out to the LLVM
library directory on NetBSD.  This is necessary since clang on NetBSD
requires libc++ but it is not installed as part of the system
by default.  For the purpose of running buildbot, we want LLDB to use
just-built libc++.

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

llvm-svn: 355502
2019-03-06 14:03:18 +00:00
Alex Langford 787fe33434 [ExpressionParser] Test GetClangResourceDir
Summary:
I'm doing this because I plan on implementing `ComputeClangResourceDirectory`
on windows so that `GetClangResourceDir` will work.  Additionally, I made
test_paths make sure that the directory member of the returned FileSpec is not
none. This will fail on windows since `ComputeClangResourceDirectory` isn't
implemented yet.

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

llvm-svn: 355463
2019-03-06 00:45:16 +00:00
Stella Stamenova d15f3b188b [lldbsuite, windows] Skip the TestEvents tests on Windows
These tests are flakey on Windows and recently they have started failing AND also hanging the whole suite when they fail.

llvm-svn: 355443
2019-03-05 21:03:36 +00:00
Davide Italiano 70b082e85c Revert "[lldbtest] Check against the correct name for libcxxabi (macOS)."
This passes locally but breaks on the bots. Maybe an SDK difference.
Reverting while I investigate.

llvm-svn: 355415
2019-03-05 17:21:55 +00:00
Yury Delendik 05812b65db [lldb] Disable some of TestJITLoaderGDB.py tests on Windows
The test expect sample executable code be built, but fails on Windows.

Review comment https://reviews.llvm.org/D57689#1418597

Tags: #lldb

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

llvm-svn: 355413
2019-03-05 17:09:26 +00:00
Yury Delendik bc6b225d42 Adds property to force enabling of GDB JIT loader for MacOS
Summary:
Based on https://gist.github.com/thlorenz/30bf0a3f67b1d97b2945#patching-and-rebuilding

The functionality was disabled at 521c2278ab

Reviewers: jingham

Subscribers: lldb-commits

Tags: #lldb

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

llvm-svn: 355402
2019-03-05 14:23:53 +00:00
Davide Italiano 8800d30360 [lldbtest] Check against the correct name for libcxxabi (macOS).
llvm-svn: 355356
2019-03-05 00:47:15 +00:00
Michal Gorny de11105d2e [lldb] [test] Mark failing tests XFAIL on NetBSD
Add a convenience 'expectedFailureNetBSD' decorator and mark all tests
currently failing on NetBSD with it.  Also skip a few tests that hang
the test suite.  This should establish a baseline for the test suite
and get us closer to enabling tests on buildbot.  This will help us
catch regressions while we still have a lot of work to do to get tests
working.

It seems that there are also some flaky tests.  I am going to address
them later on.

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

llvm-svn: 355320
2019-03-04 16:54:06 +00:00
Michal Gorny 8085c1b3c1 [lldb] [lldbtest] Fix getBuildFlags() not to use libstdc++ on NetBSD
Remove the code forcing -stdlib=libstdc++ on NetBSD in getBuildFlags()
method.  NetBSD uses libc++ everywhere else, and using libstdc++ here
causes lang/cpp/dynamic-value to fail to build.

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

llvm-svn: 355273
2019-03-02 16:46:29 +00:00
Jim Ingham b12ac2b689 Pass arguments correctly to the objc object checker on arm64
Traditionally objc had two entry points, objc_msgSend for scalar
return methods, and objc_msgSend_stret for struct return convention
methods.  But on arm64 the second was not needed (since arm64 doesn't
use an argument register for the struct return pointer) so it was removed.

The code that dispatches to the objc object checker when it sees some
flavor of objc_msgSend was not aware of this change so was sending the
wrong arguments to the checker.

<rdar://problem/48315890>

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

llvm-svn: 355026
2019-02-27 20:27:25 +00:00
Pavel Labath d73a67a799 Remove XFAIL-Linux from two asan tests
It turns out these tests actually succeed, if one has a clang with
address sanitizer support enabled (i.e., has enabled the compiler-rt
project). I guess none of the linux lldb devs have done that until now.

llvm-svn: 354976
2019-02-27 14:26:48 +00:00