Commit Graph

2474 Commits

Author SHA1 Message Date
Walter Erquinigo acfee72a05 Another attempt of D77452 - da0e91fee6
[intel-pt] Improve the way the test determines whether to run

- Now I'm creating a default value for the new test parameter
- I fixed a small mistake in the skipping logic of the test

... I forgot to clear the cmake cache when testing my diff
2020-04-15 17:52:36 -07:00
Walter Erquinigo f17a85cf36 Revert "[intel-pt] Improve the way the test determines whether to run"
This reverts commit da0e91fee6.

There's a failure in
http://lab.llvm.org:8011/builders/lldb-x86_64-debian/builds/8584
caused by a missing python object.
2020-04-15 16:35:29 -07:00
Walter Erquinigo da0e91fee6 [intel-pt] Improve the way the test determines whether to run
Summary:
@labath raised a concern on the way I was skipping this test. I think that was
fair and I found a better way.
Now I'm skipping if the CMAKE flag LLDB_BUILD_INTEL_PT is false.
I added an enabled_plugins entry in the dotest configuration, which gets
set by lit or lldb-dotest. The only available plugin right now is
'intel-pt', but I imagine it will be useful in the future for other
kinds of plugins that get determined at configuration time. I didn't
want to add a new argument option --enable-intel-pt or something or the
sort, as it wouldn't be useful for other cases.

Reviewers: labath, clayborg

Subscribers: lldb-commits, labath

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D77452
2020-04-15 16:03:31 -07:00
Jonas Devlieghere fc41013893 [lldb/Reproducers] Capture reproducers from the API test suite.
Make it possible to capture reproducers from the API test suite. Given
the symmetry between capture and replay, this patch also adds the
necessary code for replay. For now this is a NO-OP until the
corresponding reproducer instrumentation changes land.

For more info please refer to the RFC on lldb-dev:
http://lists.llvm.org/pipermail/lldb-dev/2020-April/016100.html

Differential revision: https://reviews.llvm.org/D77588
2020-04-14 09:24:23 -07:00
Pavel Labath e0dbd02513 [lldb/test] Make TestLoadUnload compatible with windows
Summary:
This patch introduces a header "dylib.h" which can be used in tests to
handle shared libraries semi-portably. The shared library APIs on
windows and posix systems look very different, but their underlying
functionality is relatively similar, so the mapping is not difficult.

It also introduces two new macros to wrap the functinality necessary to
export/import function across the dll boundary on windows. Previously we
had the LLDB_TEST_API macro for this purpose, which automagically
changed meaning depending on whether we were building the shared library
or the executable. While convenient for simple cases, this approach was
not sufficient for the more complicated setups where one deals with
multiple shared libraries.

Lastly it rewrites TestLoadUnload, to make use of the new APIs. The
trickiest aspect there is the handling of DYLD_LIBRARY_PATH on macos --
previously setting this variable was not needed as the test used
@executable_path-relative dlopens, but the new generic api does not
support that. Other systems do not support such dlopens either so the
test already contained support for setting the appropriate path
variable, and this patch just makes that logic more generic. In doesn't
seem that the purpose of this test was to exercise @executable_path
imports, so this should not be a problem.

These changes are sufficient to make some of the TestLoadUnload tests
pass on windows. Two other tests will start to pass once D77287 lands.

Reviewers: amccarth, jingham, JDevlieghere, compnerd

Subscribers: lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D77662
2020-04-14 11:10:59 +02:00
Jonas Devlieghere b0bdaf9ba2 [lldb/Python] Add lldbconfig module to make the lldb module configurable
Using the approach suggested by Pavel in D77588, this patch introduces a
new lldbconfig module that lives next to the lldb module. It makes it
possible to make the lldb module configurable before importing it. More
specifically it makes it possible to delay initializing the debugger,
which is needed for testing the reproducer.

Differential revision: https://reviews.llvm.org/D77661
2020-04-08 15:59:24 -07:00
Walter Erquinigo e796c77b26 [lldb-vscode] Correctly return source mapped breakpoints for setBreakpoints request
Summary:
When using source maps for a breakpoint, in order to find the actual source that breakpoint has resolved, we
need to use a query similar to what CommandObjectSource::DumpLinesInSymbolContexts does, which is the logic
used by the CLI to display the source line at a given breakpoint. That's necessary because from a breakpoint
location you only have an address, which points to the original source location, not the source mapped one.

in the setBreakpoints request handler, we haven't been doing such query and we were returning the original
source location, which was breaking the UX of VSCode, as many breakpoints were being set but not displayed
in the source file next to each line. Besides, clicking the source path of a breakpoint in the breakpoints
view in the debug tab was not working for this case, as VSCode was trying to open a non-existent file, thus
showing an error to the user.

Ideally, we should do the query mentioned above to find the actual source location to respond to the IDE,
however, that query is expensive and users can have an arbitrary number of breakpoints set. As a simpler fix,
the request sent by VSCode already contains the full source path, which exists because the user set it from
the IDE itself, so we can simply reuse it instead of querying from the SB API.

I wrote a test for this, and found out that I had to move SetSourceMapFromArguments after RunInitCommands in
lldb-vscode.cpp, because an init command used in all tests is `settings clear -all`, which would clear the
source map unless specified after initCommands. And in any case, I think it makes sense to have initCommands
run before anything the debugger would do.

Reviewers: clayborg, kusmour, labath, aadsm

Subscribers: lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D76968
2020-04-08 09:52:59 -07:00
Kazuaki Ishizaki e9264b746b [lldb] NFC: Fix trivial typo in comments, documents, and messages
Differential Revision: https://reviews.llvm.org/D77460
2020-04-07 01:06:16 +09:00
Raphael Isemann 15f34ff2d8 [lldb] Allow expect_expr without a running target
Summary:
If we don't have a current frame then we can still run many expressions
as long as we have an active target. With this patch `expect_expr` directly
calls the target's EvaluateExpression function when there is no current frame.

Reviewers: labath

Reviewed By: labath

Subscribers: JDevlieghere

Differential Revision: https://reviews.llvm.org/D77197
2020-04-01 09:39:24 +02:00
Tatyana Krasnukha 2bfe2b878a [lldb][testsuite] Check that process is launched successfully in inline tests 2020-03-26 15:05:30 +03:00
Tatyana Krasnukha ccf1c30cde [lldb][testsuite] Add lldb-server category 2020-03-26 15:05:30 +03:00
Walter Erquinigo c85bf7cfa8 Revert "[lldb-vscode] Add inheritEnvironment option"
This reverts commit 4ec6ebabfc.
2020-03-20 19:24:51 -07:00
Hector Diaz 4ec6ebabfc [lldb-vscode] Add inheritEnvironment option
Summary:
If no custom launching is used, lldb-vscode launches a program with an empty environment by default. In some scenarios, the user might want to simply use the same environment as the IDE to have a set of working environment variables (e.g. PATH wouldn't be empty). In fact, most DAPs in VSCode have this behavior by default. In other cases the user definitely needs to set their custom environment, which is already supported. To make the first case easier for the user (e.g. not having to copy the PATH to the launch.json every time they want to debug simple programs that rely on PATH), a new option is now offered. inheritEnvironment will launch the program copying its own environment, and it's just a boolean flag.

{F11347695}

Reviewers: clayborg, aadsm, diazhector98, kusmour

Subscribers: labath, JDevlieghere, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D74636
2020-03-20 18:51:25 -07:00
Konrad Kleine 44361782e2 [lldb] fix typo in comment for lldbtest.py 2020-03-19 10:08:11 -04:00
Djordje Todorovic d9b9621009 Reland D73534: [DebugInfo] Enable the debug entry values feature by default
The issue that was causing the build failures was fixed with the D76164.
2020-03-19 13:57:30 +01:00
Med Ismail Bennani db31e2e1e6
[lldb/Target] Support more than 2 symbols in StackFrameRecognizer
This patch changes the way the StackFrame Recognizers match a certain
frame.

Until now, recognizers could be registered with a function
name but also an alternate symbol.
This change is motivated by a test failure for the Assert frame
recognizer on Linux. Depending the version of the libc, the abort
function (triggered by an assertion), could have more than two
signatures (i.e. `raise`, `__GI_raise` and `gsignal`).

Instead of only checking the default symbol name and the alternate one,
lldb will iterate over a list of symbols to match against.

rdar://60386577

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2020-03-18 14:15:58 +01:00
Nico Weber f82b32a51e Revert "Reland "[DebugInfo] Enable the debug entry values feature by default""
This reverts commit 5aa5c943f7.
Causes clang to assert, see
https://bugs.chromium.org/p/chromium/issues/detail?id=1061533#c4
for a repro.
2020-03-13 15:37:44 -04:00
Adrian Prantl 57da8f720c Add support for XFAILing a test based on a setting.
This is analogous to the skipping mechanism introduced in
https://reviews.llvm.org/D75864
2020-03-12 19:26:24 -07:00
Adrian Prantl a9682ccb7e Convert settings list into a tuple so it can be matched by the decorator. 2020-03-12 17:51:15 -07:00
Raphael Isemann af7fc8c1bb [lldb] Remove unused and too strict error_msg parameter from expect_expr
Directly matching the error message is nearly never useful. We can re-add
error-checking once we have a plan to properly implement this.
2020-03-13 00:45:43 +01:00
Tatyana Krasnukha df90a15b1a [lldb] Clear all settings during a test's setUp
Global properties are shared between debugger instances and
if a test doesn't clear changes in settings it made,
this leads to side effects in other tests.

Differential Revision: https://reviews.llvm.org/D75537
2020-03-12 16:30:26 +03:00
Adrian Prantl 0396aa4c05 Add a decorator option to skip tests based on a default setting.
This patch allows skipping a test based on a default setting, which is
useful when running the testsuite in different "modes" based on a
default setting. This is a feature I need for the Swift testsuite, but
I think it's generally useful.

Differential Revision: https://reviews.llvm.org/D75864
2020-03-11 10:00:36 -07:00
Pavel Labath 6b37c476a2 [lldb] Improve test failure messages in vscode tests
A couple of tests sporadically fail on these assertions, but the error
messages do not give a clue as to what has actually happened.

Improve them so that we can better understand what is going wrong.
2020-03-10 14:32:45 +01:00
Djordje Todorovic 5aa5c943f7 Reland "[DebugInfo] Enable the debug entry values feature by default"
Differential Revision: https://reviews.llvm.org/D73534
2020-03-10 09:15:06 +01:00
Muhammad Omair Javaid 2b6ad82f8d [lldb/test] Fix arch arm for 32-bit armv7l/armv8l
This patch forces architecture "arm" if underlying os reports core
armv7l or armv8l. On linux systems 32 bit sysroot running on 64bit
AArch64 hardware reports armv7l or armv8l which is essently arm
32bit mode. This fixes 5 testcases on 32bit arm.
2020-03-09 20:32:18 +05:00
Adrian Prantl 3ed02340ea Increase default timeout in lldbutil.expect_state_changes() 2020-03-06 10:00:47 -08:00
Tatyana Krasnukha a31130f6fc [lldb][testsuite] Create a SBDebugger instance for each test
Some tests set settings and don't clean them up, this leads to side effects in other tests.
The patch removes a global debugger instance with a per-test debugger to avoid such effects.

From what I see, lldb.DBG was needed to determine the platform before a test is run,
lldb.selected_platform is used for this purpose now. Though, this required adding a new function
to the SBPlatform interface.

Differential Revision: https://reviews.llvm.org/D74903
2020-03-05 10:12:54 +03:00
Raphael Isemann c131dfefe2 [lldb] Disable auto fix-its when evaluating expressions in the test suite
Summary:
Currently the test suite runs with enabled automatically applied Clang fix-its for expressions.
This is causing that sometimes incorrect expressions in tests are still evaluated even though they
are actually incorrect. Let's disable this feature in the test suite so that we know when expressions
are wrong and leave the fix-it testing to the dedicated tests for that feature.

Also updates the `lang/cpp/operators/` test as it seems Clang needs the `struct` keywords
before C and would otherwise fail without fixits.

Reviewers: jingham, JDevlieghere, shafik

Reviewed By: JDevlieghere, shafik

Subscribers: shafik, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D74957
2020-02-24 09:31:11 +01:00
Muhammad Omair Javaid af64b31959 Add target.xml support for qXfer request.
Summary:
Requesting registers one by one takes a while in our project.
We want to get rid of it by using target.xml.

Reviewers: jarin, labath, omjavaid

Reviewed By: labath, omjavaid

Subscribers: omjavaid, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D74217
2020-02-20 23:03:54 +05:00
Djordje Todorovic 2f215cf36a Revert "Reland "[DebugInfo] Enable the debug entry values feature by default""
This reverts commit rGfaff707db82d.
A failure found on an ARM 2-stage buildbot.
The investigation is needed.
2020-02-20 14:41:39 +01:00
Djordje Todorovic faff707db8 Reland "[DebugInfo] Enable the debug entry values feature by default"
Differential Revision: https://reviews.llvm.org/D73534
2020-02-19 11:12:26 +01:00
Raphael Isemann 785df61680 [lldb] Let TypeSystemClang::GetDisplayTypeName remove anonymous and inline namespaces.
Summary:
Currently when printing data types we include implicit scopes such as inline namespaces or anonymous namespaces.
This leads to command output like this (for `std::set<X>` with X being in an anonymous namespace):

```
(lldb) print my_set
(std::__1::set<(anonymous namespace)::X, std::__1::less<(anonymous namespace)::X>, std::__1::allocator<(anonymous namespace)::X> >) $0 = size=0 {}
```

This patch removes all the implicit scopes when printing type names in TypeSystemClang::GetDisplayTypeName
so that our output now looks like this:

```
(lldb) print my_set
(std::set<X, std::less<X>, std::allocator<X> >) $0 = size=0 {}
```

As previously GetDisplayTypeName and GetTypeName had the same output we actually often used the
two as if they are the same method (they were in fact using the same implementation), so this patch also
fixes the places where we actually want the display type name and not the actual type name.

Note that this doesn't touch the `GetTypeName` class that for example the data formatters use, so this patch
is only changes the way we display types to the user. The full type name can also still be found when passing
'-R' to see the raw output of a variable in case someone is somehow interested in that.

Partly fixes rdar://problem/59292534

Reviewers: shafik, jingham

Reviewed By: shafik

Subscribers: christof, JDevlieghere, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D74478
2020-02-19 10:30:11 +01:00
Djordje Todorovic 2bf44d11cb Revert "Reland "[DebugInfo] Enable the debug entry values feature by default""
This reverts commit rGa82d3e8a6e67.
2020-02-18 16:38:11 +01:00
Djordje Todorovic a82d3e8a6e Reland "[DebugInfo] Enable the debug entry values feature by default"
This patch enables the debug entry values feature.

  - Remove the (CC1) experimental -femit-debug-entry-values option
  - Enable it for x86, arm and aarch64 targets
  - Resolve the test failures
  - Leave the llc experimental option for targets that do not
    support the CallSiteInfo yet

Differential Revision: https://reviews.llvm.org/D73534
2020-02-18 14:41:08 +01:00
Muhammad Omair Javaid fdc122e4ed Revert "[lldb/lldb-server] Add target.xml support for qXfer request."
This patch cause floating point registers to fail on LLDB aarch64-linux
buildbot.

http://lab.llvm.org:8011/builders/lldb-aarch64-ubuntu/builds/1713

This reverts commit aedc196101.
2020-02-18 10:16:52 +05:00
Levon Ter-Grigoryan aedc196101 [lldb/lldb-server] Add target.xml support for qXfer request.
Summary:
Synthesize target.xml in lldb-server to avoid a long chain of
qRegisterInfo packets, which can be slow over low-latency links.

Reviewers: jarin, labath

Reviewed By: labath

Subscribers: lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D74217
2020-02-17 12:05:28 +01:00
Raphael Isemann a57ad008b4 [lldb] Print result when expect_expr unexpectedly succeeds 2020-02-14 12:57:10 +01:00
Pavel Labath 07211d951d [lldb/dotest] Remove the "exclusive test subdir" concept
Summary:
This was added in 2018 (r339929), when we were still using the
hand-rolled test runner.

It does not seem to be relevant anymore. In fact as far as I can tell,
it's a big no-op now as the exclusive_test_subdir variable is never set.

Reviewers: vsk, JDevlieghere

Subscribers: lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D74551
2020-02-14 10:24:12 +01:00
Greg Clayton 7202d1c2f6 Fix lldb-vscode logging and enable logging for all lldb-vscode tests.
Summary:
This patch fixes logging to log incoming packets which was removed during a refactor.

We also enable logging to a "vscode.txt" file for each lldb-vscode test by creating the log file in the build artifacts directory for each test. This allows users to see the packets for their tests if needed and the log file is in a directory that will be removed after tests have been run.

Reviewers: labath, aadsm, serhiy.redko, jankratochvil, xiaobai, wallace

Subscribers: lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D74566
2020-02-13 09:58:30 -08:00
Greg Clayton 9cb227f561 Stop emitting a breakpoint for each location in a breakpoint when responding to breakpoint commands.
Summary: The VS Code DAP expects on response for each breakpoint that was requested. If we responsd with multiple entries for one breakpoint the VS Code UI gets out of date. Currently the VS code DAP doesn't handle one breakpoint with multiple locations. If this ever gets fixed we can modify our code.

Reviewers: labath

Subscribers: lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D73665
2020-02-13 08:23:19 -08:00
Pavel Labath 91e0c258c2 [lldb] Fix lldb-dotest
to account for the new location of test files from 99451b445.
2020-02-13 14:31:08 +01:00
Djordje Todorovic 97ed706a96 Revert "[DebugInfo] Enable the debug entry values feature by default"
This reverts commit rG9f6ff07f8a39.

Found a test failure on clang-with-thin-lto-ubuntu buildbot.
2020-02-12 11:59:04 +01:00
Djordje Todorovic 9f6ff07f8a [DebugInfo] Enable the debug entry values feature by default
This patch enables the debug entry values feature.

  - Remove the (CC1) experimental -femit-debug-entry-values option
  - Enable it for x86, arm and aarch64 targets
  - Resolve the test failures
  - Leave the llc experimental option for targets that do not
    support the CallSiteInfo yet

Differential Revision: https://reviews.llvm.org/D73534
2020-02-12 10:25:14 +01:00
Jordan Rupprecht 99451b4453 [lldb][test] Remove symlink for API tests.
Summary: Moves lldbsuite tests to lldb/test/API.

This is a largely mechanical change, moved with the following steps:

```
rm lldb/test/API/testcases
mkdir -p lldb/test/API/{test_runner/test,tools/lldb-{server,vscode}}
mv lldb/packages/Python/lldbsuite/test/test_runner/test lldb/test/API/test_runner
for d in $(find lldb/packages/Python/lldbsuite/test/* -maxdepth 0 -type d | egrep -v "make|plugins|test_runner|tools"); do mv $d lldb/test/API; done
for d in $(find lldb/packages/Python/lldbsuite/test/tools/lldb-vscode -maxdepth 1 -mindepth 1 | grep -v ".py"); do mv $d lldb/test/API/tools/lldb-vscode; done
for d in $(find lldb/packages/Python/lldbsuite/test/tools/lldb-server -maxdepth 1 -mindepth 1 | egrep -v "gdbremote_testcase.py|lldbgdbserverutils.py|socket_packet_pump.py"); do mv $d lldb/test/API/tools/lldb-server; done
```

lldb/packages/Python/lldbsuite/__init__.py and lldb/test/API/lit.cfg.py were also updated with the new directory structure.

Reviewers: labath, JDevlieghere

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D71151
2020-02-11 10:03:53 -08:00
Raphael Isemann e8e7cf810c [lldb][NFC] Remove the CppVirtualMadness test
We now have a virtual-functions test and a multiple-inheritance test that
are testing the same functionality (and more) using the newer test functions which
we have in LLDB these days. These tests should also be less flaky and
less dependent on other unrelated LLDB functionality.
2020-02-11 14:09:58 +01:00
Raphael Isemann 65ac68ec34 [lldb] Add test for multiple inheritance 2020-02-11 13:31:34 +01:00
Raphael Isemann 6909c2e88d [lldb] Add test for calling overloaded virtual functions 2020-02-11 11:36:26 +01:00
Raphael Isemann 70fb447ca0 [lldb] Add test for C++ constructor calls from the expression evaluator 2020-02-11 10:47:42 +01:00
Davide Italiano b7bd35a8f1 [TestKernVerStrLCNOTE] Check the *right* architecture. 2020-02-10 15:17:52 -08:00
Raphael Isemann ea2af727a5 [lldb] Refactored TestCallOverriddenMethod.py to general virtual function test
This actually tests all the different situations in which we can call virtual
functions. This removes also all skipIfs as the first skipIf for Linux is
apparently fixed and the second skipIf was just failing due to the constructor
call (which should be its own test and not be tested here).
2020-02-10 09:40:40 +01:00