Commit Graph

4998 Commits

Author SHA1 Message Date
Raphael Isemann 69e7b74578 [lldb][NFC] Add a test case for Objective-C properties with conflicting names
This is an LLDB test for the ASTImporter crash that got fixed in D99077.
The test is using Clang modules for the properties as it seems the conflicting
names are not actually correctly handled when generating debug information
(only the first property is emitted and the second one is ignored in the current
clang ToT).
2021-03-29 12:33:07 +02:00
Raphael Isemann 3c95bdf9fa [lldb] Don't search for system specific strings in assert.test
Commit 6bc1e69de2 changed the search string
to also check for the generated strings that surround the plain assert:

    Assertion `false && "lldb-test assert"' failed
                                         ^^^^^^^^^

This causes the test to fail on setups where the generated assert message
looks different. E.g., on macOS the generated message looks like this:

    Assertion failed: (false && "lldb_assert failed"), function lldb_assert

This reverts the old behaviour of just checking for the actual string we
have inside LLDB.
2021-03-29 10:46:14 +02:00
Jan Kratochvil 6bc1e69de2 [lldb] Fix Error/assert.test regression with symbols
LLDB on Linux built with symbols is showing this error.
Without symbols it still PASSes:
  lldb-test: .../lldb/source/Utility/LLDBAssert.cpp:29: void lldb_private::lldb_assert(bool, const char *, const char *, const char *, unsigned int): Assertion `false && "lldb_assert failed"' failed.

With symbols it FAILs:
  lldb-test: .../lldb/tools/lldb-test/lldb-test.cpp:1086: int opts::assert::lldb_assert(lldb_private::Debugger &): Assertion `false && "lldb-test assert"' failed.

Differential Revision: https://reviews.llvm.org/D99462
2021-03-29 08:16:43 +02:00
Jonas Devlieghere 7f76c70d85 [lldb] Fix capitalization in CMake status message
s/LLDB Tests/LLDB tests/
2021-03-27 21:39:39 -07:00
Jonas Devlieghere 38edd23b8c [lldb] Fix TestAppleSimulatorOSType for older watchOS SDKs
Older watchOS SDKs *only* support i386 so we can't use x86_64/arm64
unconditionally.
2021-03-26 20:28:42 -07:00
Jonas Devlieghere df0f9e0447 [lldb] Stop using i386 for the watchOS simulator
This keeps breaking on my machine. It's time to move on.
2021-03-26 17:09:45 -07:00
Pavel Labath 5c3aed98af [lldb] Skip TestVSCode_launch.test_progress_events on linux
It's flaky everywhere, not just arm.
2021-03-26 17:26:44 +01:00
Pavel Labath 21589d0766 [lldb] XFAIL TestGdbRemote_vContThreads on macos
It seems debugserver does not implement these packets.
2021-03-26 17:26:44 +01:00
Pavel Labath 22e2d117d3 [lldb] Really fix dwarf5-debug_line-file-index.s
It's not enough the change the comment -- one has to actually change the
constant before it. :/
2021-03-26 17:26:44 +01:00
Muhammad Omair Javaid 73cf85e527 [LLDB] Skip TestVSCode_disconnect.test_launch arm/linux
TestVSCode_disconnect.test_launch hangs in tear down and times out
Arm linux. I am marking it skipped for the buildbot while looking
into failure.
2021-03-26 15:54:42 +05:00
Muhammad Omair Javaid c3152536fd [LLDB] Skip TestVSCode_launch.test_progress_events arm/linux
TestVSCode_launch.test_progress_events is mysteriously failing on arm
linux. I am marking it skipped for the buildbot while looking into
failure.
2021-03-26 04:38:31 +05:00
Raphael Isemann d90b1230ea [lldb] Fix TestVSCode.test_progress_events on Linux due to vdso
This currently fails when we get the module for `[vdso]` which doesn't have
any parsing event associated with it as it's just created from memory.
2021-03-25 10:48:58 +01:00
Med Ismail Bennani fad34da7fd Revert "[lldb/Plugins] Add ScriptedProcess Process Plugin"
Reverting commit b09d44b6ae, since it breaks
the windows bots: https://lab.llvm.org/buildbot/#/builders/83/builds/4993

It seems to crash the `TestIRMemoryMapWindows.test` test.
2021-03-24 21:31:16 +01:00
Greg Clayton e122877f10 Add a progress class that can track long running operations in LLDB.
LLDB can often appear deadlocked to users that use IDEs when it is indexing DWARF, or parsing symbol tables. These long running operations can make a debug session appear to be doing nothing even though a lot of work is going on inside LLDB. This patch adds a public API to allow clients to listen to debugger events that report progress and will allow UI to create an activity window or display that can show users what is going on and keep them informed of expensive operations that are going on inside LLDB.

Differential Revision: https://reviews.llvm.org/D97739
2021-03-24 12:58:13 -07:00
Jim Ingham 3fd7d0d281 Disable the tests except on Darwin.
The commit passes the tests on Darwin.  The failure on linux shows
that this change was not sufficient to get this setting to work on linux,
but the behavior is the same as before the patch & test, and it caused
no new failures.

So marking the tests as Darwin only till someone can debug the Linux
issue.
2021-03-24 12:19:18 -07:00
Jim Ingham c8faa8c266 Make the stop-on-sharedlibrary-events setting work.
The StopInfoBreakpoint::PerformAction was overriding the synchronous
breakpoint's ShouldStop report.  Fix that and add a test.

This fixes two bugs in the original submission:
1) Actually generate both dylibs by including the second one in the Makefile
2) Don't ask synchronous callbacks for their opinion on whether to stop
   in the async context, that info is taken care of by recording the m_should_stop
   on entry to PerformAction.

Differential Revision: https://reviews.llvm.org/D98914
2021-03-24 11:15:11 -07:00
Med Ismail Bennani b09d44b6ae [lldb/Plugins] Add ScriptedProcess Process Plugin
This patch introduces Scripted Processes to lldb.

The goal, here, is to be able to attach in the debugger to fake processes
that are backed by script files (in Python, Lua, Swift, etc ...) and
inspect them statically.

Scripted Processes can be used in cooperative multithreading environments
like the XNU Kernel or other real-time operating systems, but it can
also help us improve the debugger testing infrastructure by writting
synthetic tests that simulates hard-to-reproduce process/thread states.

Although ScriptedProcess is not feature-complete at the moment, it has
basic execution capabilities and will improve in the following patches.

rdar://65508855

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2021-03-24 19:10:58 +01:00
David Zarzycki 952bc6c92e Revert "[lldb/Plugins] Add ScriptedProcess Process Plugin"
This reverts commit dd391e1ef7.

This patch causes 17 LLDB test regressions on Fedora 33 (x86-64).
2021-03-24 07:07:22 -04:00
Raphael Isemann c68a645acb [lldb] Add llgs_test decorator back to TestAutoInstallMainExecutable
This got removed in 68bb51acd5 and this enabled
the test on macOS (where it just causes lldb-server to crash). Re-adding the
decorator to get the tests passing again.
2021-03-24 10:36:01 +01:00
Med Ismail Bennani dd391e1ef7 [lldb/Plugins] Add ScriptedProcess Process Plugin
This patch introduces Scripted Processes to lldb.

The goal, here, is to be able to attach in the debugger to fake processes
that are backed by script files (in Python, Lua, Swift, etc ...) and
inspect them statically.

Scripted Processes can be used in cooperative multithreading environments
like the XNU Kernel or other real-time operating systems, but it can
also help us improve the debugger testing infrastructure by writting
synthetic tests that simulates hard-to-reproduce process/thread states.

Although ScriptedProcess is not feature-complete at the moment, it has
basic execution capabilities and will improve in the following patches.

rdar://65508855

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2021-03-23 18:24:47 +01:00
Med Ismail Bennani f3176f5fed [lldb/bindings] Add Python ScriptedProcess base class to lldb module
In order to facilitate the writting of Scripted Processes, this patch
introduces a `ScriptedProcess` python base class in the lldb module.

The base class holds the python interface with all the - abstract -
methods that need to be implemented by the inherited class but also some
methods that can be overwritten.

This patch also provides an example of a Scripted Process with the
`MyScriptedProcess` class.

rdar://65508855

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2021-03-23 18:24:47 +01:00
Jonas Devlieghere eb26afbafe Re-land "[lldb] Make the API, Shell and Unit tests independent lit test suites"
The commit got reverted because the tests were being run twice because
of the overlapping test_exec_root. Pavel has since fixed that in
8248dd91d7.
2021-03-22 14:36:43 -07:00
Jonas Devlieghere 683590a203 [lldb] config.test_exec_root is set by lit.cfg.py
Don't configure `test_exec_root` in lit.site.cfg.py. It always gets
overwritten by lit.cfg.py based on `lldb_obj_root`.
2021-03-22 14:36:43 -07:00
Pavel Labath d9643af119 [lldb] Re-disable dwarf5-debug_line-file-index.s
The fix in 10d54e2f did not work.
2021-03-22 16:29:06 +01:00
Pavel Labath 10d54e2f8d [lldb] Attempt to fix dwarf5-debug_line-file-index.s
The file contained bogus input - the DIE list was not properly
terminated. This should not cause a crash, but it seems it was crashing
at least on linux arm and x86 windows.
2021-03-22 15:27:25 +01:00
Pavel Labath 8248dd91d7 [lldb] Fix test_exec_root of API tests
lit has grown a feature where it stores the runtimes of all tests.
Normally, these times should be stored in the build directory, but
because our API tests have set test_exec_root to point to the source
tree, it has ended up polluting our checkout and led to the
.lit_test_times.txt being committed to the repository.

Delete this file, and adjust the exec root of API tests. I've also
needed to adjust the root of Shell tests, in order to avoid the two
overlapping.
2021-03-22 15:15:48 +01:00
Muhammad Omair Javaid 89aab750b0 [LLDB] XFAIL dwarf5-debug_line-file-index.s on arm-linux
Tests dwarf5-debug_line-file-index.s fails on arm-linux-gnueabihf.
Bug # 49678 has been filed against it.
2021-03-22 17:06:53 +05:00
Kim-Anh Tran 68dafe40a6 [lldb] Use CompileUnit::ResolveSymbolContext in SymbolFileDWARF
SymbolFileDWARF::ResolveSymbolContext is currently unaware that in DWARF5 the primary file is specified at file index 0. As a result it misses to correctly resolve the symbol context for the primary file when DWARF5 debug data is used and the primary file is only specified at index 0.

This change makes use of CompileUnit::ResolveSymbolContext to resolve the symbol context. The ResolveSymbolContext in CompileUnit has been previously already updated to reflect changes in DWARF5
and contains a more readable version. It can resolve more, but will also do a bit more work than
SymbolFileDWARF::ResolveSymbolContext (getting the Module, and going through SymbolFileDWARF::ResolveSymbolContextForAddress), however, it's mostly directed by $resolve_scope
what will be resolved, and ensures that code is easier to maintain if there's only one path.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D98619
2021-03-22 08:44:16 +01:00
Jonas Devlieghere e76b86642f Revert "[lldb] Make the API, Shell and Unit tests independent lit test suites"
This reverts commit 6c52d4fd4c.
2021-03-19 17:57:26 -07:00
Vedant Kumar 4bd2bfb6ec [lldb/PlatformPOSIX] Change LoadImage default to RTLD_LAZY (reapply)
In general, it seems like the debugger should allow programs to load & run with
libraries as far as possible, instead of defaulting to being super-picky about
unavailable symbols.

This is critical on macOS/Darwin, as libswiftCore.dylib may 1) export a version
symbol using @available markup and then 2) expect that other exported APIs are
only dynamically used once the version symbol is checked. We can't open a
version of the library built with a bleeding-edge SDK on an older OS without
RTLD_LAXY (or pervasive/expensive @available markup added to dyld APIs).

This was previously committed as cb8c1ee269 and reverted due to
unknown failures on the Linux bots. This version adds additional asserts
to check that the shared objects are where we expect them & that calling
f1() from libt1 produces the expected value. The Linux failure is
tracked by https://bugs.llvm.org/show_bug.cgi?id=49656.

See: https://lists.llvm.org/pipermail/lldb-dev/2021-March/016796.html

Differential Revision: https://reviews.llvm.org/D98879
2021-03-19 16:06:00 -07:00
Vedant Kumar d8d5ef2e9d Revert "[lldb/PlatformPOSIX] Change LoadImage default to RTLD_LAZY"
This reverts commit cb8c1ee269. The test
is failing on Debian for unknown reasons.

https://lab.llvm.org/buildbot/#/builders/68/builds/8990
2021-03-19 15:26:16 -07:00
Vedant Kumar cb8c1ee269 [lldb/PlatformPOSIX] Change LoadImage default to RTLD_LAZY
In general, it seems like the debugger should allow programs to load & run with
libraries as far as possible, instead of defaulting to being super-picky about
unavailable symbols.

This is critical on macOS/Darwin, as libswiftCore.dylib may 1) export a version
symbol using @available markup and then 2) expect that other exported APIs are
only dynamically used once the version symbol is checked. We can't open a
version of the library built with a bleeding-edge SDK on an older OS without
RTLD_LAXY (or pervasive/expensive @available markup added to dyld APIs).

See: https://lists.llvm.org/pipermail/lldb-dev/2021-March/016796.html

Differential Revision: https://reviews.llvm.org/D98879
2021-03-19 15:13:43 -07:00
Jonas Devlieghere cdac60107d [lldb] Update assert.test to be less strict
Be less strict when checking for the assert substring.
2021-03-19 14:31:56 -07:00
Jonas Devlieghere e089b5e9e1 [lldb] Call os_log_fault on lldb_assert
Call `os_log_fault` when an lldb assert fails. We piggyback off
`LLVM_SUPPORT_XCODE_SIGNPOSTS`, which also depends on `os_log`, to avoid
having to introduce another CMake check and corresponding define.

This patch also adds a small test using lldb-test that verifies we abort
with a "regular" assertion when asserts are enabled.

Differential revision: https://reviews.llvm.org/D98987
2021-03-19 14:23:50 -07:00
Jim Ingham 9d081a7ffe Revert "Make the stop-on-sharedlibrary-events setting work."
This reverts commit 9406d43138.

I messed up a test, and when I got it right it was failing.  The changed logic
doesn't work quite right (now the async callback called at sync time is
forcing us to stop.  I need to be a little more careful about that.
2021-03-19 12:38:41 -07:00
Jim Ingham e8e07b3a5e Revert "Skip all the tests for Windows."
This reverts commit a8d62fc8ff.
2021-03-19 12:38:23 -07:00
Jim Ingham a8d62fc8ff Skip all the tests for Windows. 2021-03-19 12:05:16 -07:00
Jim Ingham 9406d43138 Make the stop-on-sharedlibrary-events setting work.
We weren't taking into account the "m_should_stop" setting that the
synchronous breakpoint callback had already set when we did PerformAction
in the StopInfoBreakpoint.  So we didn't obey its instructions when it
told us to stop.  Fixed that and added some tests both for when we
just have the setting, and when we have the setting AND other breakpoints
at the shared library load notification breakpoint address.

Differential Revision: https://reviews.llvm.org/D98914
2021-03-19 12:02:16 -07:00
Jonas Devlieghere 6c52d4fd4c [lldb] Make the API, Shell and Unit tests independent lit test suites
Make the API, Shell and Unit tests independent lit test suites. This
allows us to specify different dependencies and skip rebuilding all the
unit test (which is particularly expensive) when running check-lldb-api
or check-lldb-shell.

This does not change the autogenerated targets such as
check-lldb-shell-driver or the top level check-lldb target, which all
continue to work as before.

Differential revision: https://reviews.llvm.org/D98842
2021-03-19 11:13:46 -07:00
Muhammad Omair Javaid 7dd76cccca [LLDB] Skip TestExitDuringExpression on aarch64/linux buildbot
TestExitDuringExpression test_exit_before_one_thread_unwind fails
sporadically on both Arm and AArch64 linux buildbots.
This seems like a thread timing issue. I am marking it skip for now.
2021-03-19 15:30:10 +05:00
Jim Ingham 71c4da83b6 Don't assume that stepping out of a function will land on the next line.
For instance, some recent clang emits this code on x86_64:

    0x100002b99 <+57>: callq  0x100002b40               ; step_out_of_here at main.cpp:11
->  0x100002b9e <+62>: xorl   %eax, %eax
    0x100002ba0 <+64>: popq   %rbp
    0x100002ba1 <+65>: retq

and the "xorl %eax, %eax" is attributed to the same line as the callq.  Since
step out is supposed to stop just on returning from the function, you can't guarantee
it will end up on the next line.  I changed the test to check that we were either
on the call line or on the next line, since either would be right depending on the
debug information.
2021-03-18 17:44:17 -07:00
Jonas Devlieghere 36335fe753 [lldb] Move Apple simulators test targets under API
Move the Apple simulators test targets as they only matter for the API
tests.

Differential revision: https://reviews.llvm.org/D98880
2021-03-18 13:55:37 -07:00
Pavel Labath 0c208d1f42 [lldb] Fix flakyness in TestGdbRemote_vContThreads
The cause is the non-async-signal-safety printf function (et al.). If
the test managed to interrupt the process and inject a signal before the
printf("@started") call returned (but after it has actually written the
output), that string could end up being printed twice (presumably,
because the function did not manage the clear the userspace buffer, and
so the print call in the signal handler would print it once again).

This patch fixes the issue by replacing the printf call in the signal
handler with a sprintf+write combo, which should not suffer from that
problem (though I wouldn't go as far as to call it async signal safe).
2021-03-18 20:41:55 +01:00
Pavel Labath 68bb51acd5 [lldb] Fix TestAutoInstallMainExecutable.py
Fix the test to account for recent test infrastructure changes, and make
it run locally to increase the chances of it continuing to work in the
future.
2021-03-18 15:20:44 +01:00
Michał Górny 76c8a016a1 [lldb] [test] Skip vCont tests on Windows 2021-03-17 19:22:58 +01:00
Michał Górny 9cf21da776 [lldb] [test] Fix TestGdbRemote_vContThreads.py logic
The TestGdbRemote_vContThreads.py were introduced to test NetBSD process
plugin's capability of sending per-thread and per-process signals.
However, at some point the tests started failing.  From retrospective,
it is possible that they were relying on some bug in the plugin's
original signal handling.

Fix the tests not to expect the process to terminate after receiving
the signals.  Instead, scan for output indicating that the signals were
received and match thread IDs in it.  Enable 'signal to all threads'
test everywhere as it works fine on Linux.  Add a new test for vCont
packet without specific thread IDs.  Introduce a helper function
to cover the common part of tests.

While this does not fix all the problems on NetBSD, it enables a subset
of the tests on other systems.  I am planning to add more tests
to the group while implementing multiprocess extension for vCont.

Differential Revision: https://reviews.llvm.org/D98749
2021-03-17 17:30:28 +01:00
Walter Erquinigo b5657d1fbf Fix 34885bffdf
It failed https://lab.llvm.org/buildbot/#/builders/17/builds/5262 and
the fix is simply to relax a regex expression in a test.
2021-03-15 16:36:32 -07:00
Walter Erquinigo 34885bffdf [lldb-vscode] Handle request_evaluate's context attribute
Summary:
The request "evaluate" supports a "context" attribute, which is sent by VSCode. The attribute is defined here https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Evaluate

The "clipboard" context is not yet supported by lldb-vscode, so we can forget about it for now. The 'repl' (i.e. Debug Console) and 'watch' (i.e. Watch Expression) contexts must use the expression parser in case the frame's variable path is not enough, as the user expects these expressions to never fail. On the other hand, the 'hover' expression is invoked whenever the user hovers on any keyword on the UI and the user is fine with the expression not being fully resolved, as they know that the 'repl' case is the fallback they can rely on.

Given that the 'hover' expression is invoked many many times without the user noticing it due to it being triggered by the mouse, I'm making it use only the frame's variable path functionality and not the expression parser. This should speed up tremendously the responsiveness of a debug session when the user only sets source breakpoints and inspect local variables, as the entire debug info is not needed to be parsed.

Regarding tests, I've tried to be as comprehensive as possible considering a multi-file project. Fortunately, the results from the "hover" case are enough most of the times.

Differential Revision: https://reviews.llvm.org/D98656
2021-03-15 15:09:23 -07:00
Muhammad Omair Javaid 0df28acffb [LLDB] Skip TestExitDuringExpression on arm/linux buildbot
TestExitDuringExpression test_exit_before_one_thread_unwind fails
sporadically on arm/linux. This seems like a thread timing issue.
I am marking it skip for now.
2021-03-15 16:03:06 +05:00
Pavel Labath 463863fffe [lldb] Move PlatformPOSIX::ConnectToWaitingProcesses to RemoteAwarePlatform
The functionality is not posix specific. Also force the usage of the
gdb-remote process plugin in the gdb platform class.

This is not sufficient to make TestPlatformConnect pass on windows (it
seems it suffers from module loading issues, unrelated to this test),
but it at least makes it shut down correctly, so I change the skip to an
xfail.
2021-03-14 22:43:52 +01:00