Commit Graph

2448 Commits

Author SHA1 Message Date
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
Jan Kratochvil 420a518068 [lldb] [testsuite] TestGdbRemoteLibrariesSvr4Support: Fix symlinked builddir
When I have symlinked builddir on Fedora 31 x86_64 I get:

	FAIL: test_libraries_svr4_libs_present (TestGdbRemoteLibrariesSvr4Support.TestGdbRemoteLibrariesSvr4Support)
	----------------------------------------------------------------------
	...
	  File "lldb/packages/Python/lldbsuite/test/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.py", line 106, in
	libraries_svr4_libs_present
	    self.assertIn(self.getBuildDir() + "/" + lib, libraries_svr4_names)
	AssertionError:
	'/home/jkratoch/redhat/llvm-monorepo-clangassertsymlink/lldb-test-build.noindex/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.test_libraries_svr4_libs_present/libsvr4lib_a.so' not found in ['/home/jkratoch/redhat/llvm-monorepo/lldb/packages/Python/lldbsuite/test/tools/lldb-server/libraries-svr4/linux-vdso.so.1', '/quad/home/jkratoch/redhat/llvm-monorepo-clangassertsymlink/lldb-test-build.noindex/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.test_libraries_svr4_libs_present/libsvr4lib_a.so', '/quad/home/jkratoch/redhat/llvm-monorepo-clangassertsymlink/lldb-test-build.noindex/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.test_libraries_svr4_libs_present/libsvr4lib_b".so', '/usr/lib64/libdl-2.30.so', '/usr/lib64/libstdc++.so.6.0.27', '/usr/lib64/libm-2.30.so', '/usr/lib64/libgcc_s-9-20190827.so.1', '/usr/lib64/libc-2.30.so', '/usr/lib64/ld-2.30.so']
	Config=x86_64-/quad/home/jkratoch/redhat/llvm-monorepo-clangassertsymlink/bin/clang-11
	----------------------------------------------------------------------

Differential Revision: https://reviews.llvm.org/D74295
2020-02-09 14:49:38 +01:00
Jim Ingham d62a343db2 Add a test for adding and removing Listeners from a BroadcasterManager.
Reid found a bug in removing Listeners from a BroadcasterManager:

https://reviews.llvm.org/D74010

The bug didn't affect the case where there was only one Listener
signed up for a BroadcasterManager, which was all the extant test
case tests.  The driver also only uses one listener (the debugger)
for everything, so neither the test nor anything you do with lldb
command line would have triggered the bug.

This adds a couple more tests using more listeners, and adding and
removing them in a different way, which triggers a separate code path.
2020-02-07 17:54:25 -08:00
Jordan Rupprecht 25675d4eaa [lldb][test][NFC] Create a separate LLDB_TEST_SRC var to allow moving tests.
Summary:
This creates a separate LLDB_TEST_SRC var to match the existing LLDB_TEST var. LLDB_TEST points to the test framework, LLDB_TEST_SRC points to the tests themselves.

The var points to the same place, but a future patch will move the tree + update var.

Reviewers: labath, JDevlieghere

Reviewed By: labath

Subscribers: merge_guards_bot, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D71150
2020-02-07 15:18:36 -08:00
Med Ismail Bennani 96054a1857 [lldb/test] Prevent TestFrameRecognizer.py to fail because of internal recognizers (NFC)
By clearing the recognizers before starting the test, we ensure that the
recognizers that get initialized when lldb starts won't alter the
expected results of this test (i.e. recognizer index).

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2020-02-07 17:35:29 +01:00
Raphael Isemann 0082f1e0cc [lldb] Improve error message when running static initializers in an expression fails 2020-02-07 13:46:28 +01:00
Raphael Isemann 68cc9f80a6 [lldb] Remove all 'clean' targets from test Makefiles
Summary:
To my knowledge we don't actually use or need these rules. And if we need them then
there is probably a better way to implement this than having all these random regexes.

Reviewers: labath, JDevlieghere

Reviewed By: labath, JDevlieghere

Subscribers: jingham, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D74126
2020-02-07 11:24:52 +01:00
Med Ismail Bennani 7ebe9cc4fc [lldb/Target] Add Assert StackFrame Recognizer
When a thread stops, this checks depending on the platform if the top frame is
an abort stack frame. If so, it looks for an assert stack frame in the upper
frames and set it as the most relavant frame when found.

To do so, the StackFrameRecognizer class holds a "Most Relevant Frame" and a
"cooked" stop reason description. When the thread is about to stop, it checks
if the current frame is recognized, and if so, it fetches the recognized frame's
attributes and applies them.

rdar://58528686

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2020-02-06 18:27:48 +01:00
Raphael Isemann 7603778922 [lldb][NFC] Move call-overidden-method test to lang/cpp/ folder 2020-02-06 14:36:09 +01:00
Raphael Isemann 0ea20ebf2d [lldb] Add test for calling const functions 2020-02-06 14:28:06 +01:00
Pavel Labath 40efa65de8 Revert "[LLDB] Add DynamicLoaderWasmDYLD plugin for WebAssembly debugging"
This patch has a couple of outstanding issues. The test is not python3
compatible, and it also seems to fail with python2 (at least under some
circumstances) due to an overambitious assertion.

This reverts the patch as well as subsequent fixup attempts:
014ea93376,
f5f70d1c8f.
4697e701b8.
5c15e8e682.
3ec28da6d6.
2020-02-05 16:22:19 -08:00
Pavel Labath 014ea93376 [lldb] Remove "print xml" from TestWasm.py
It's not py3 compatible, and the test should not be printing this to stdout
(unless in --trace mode) anyway.
2020-02-05 16:09:34 -08:00
Pavel Labath 98b273c893 Revert "[lldb/Target] Add Assert StackFrame Recognizer"
This reverts commit 2b7f32892b because of test
failures due to dangling pointers.
2020-02-05 15:51:38 -08:00
Derek Schuff f5f70d1c8f Add missing directory from 3ec28da6
Also revert 4697e701b8, restoring the original patch from
https://reviews.llvm.org/D72751
2020-02-05 15:49:48 -08:00
Jonas Devlieghere 4697e701b8 Partially revert "[LLDB] Add DynamicLoaderWasmDYLD plugin for WebAssembly debugging"
This temporarily and partially reverts 3ec28da6d6 because it's missing
a directory.
2020-02-05 15:32:54 -08:00
Paolo Severini 3ec28da6d6 [LLDB] Add DynamicLoaderWasmDYLD plugin for WebAssembly debugging
Add a dynamic loader plug-in class for WebAssembly modules.

Differential Revision: https://reviews.llvm.org/D72751
2020-02-05 14:49:36 -08:00
Michał Górny dcab9736f0 [lldb] [test] Pass LLVM_LIBS_DIR from CMake for linking liblldb
Pass the correct library directory from CMake to dotest.py when linking
liblldb, instead of trying to reconstruct the path from executable path.
This fixes link failures on platforms having non-null
LLVM_LIBDIR_SUFFIX.

Differential Revision: https://reviews.llvm.org/D73767
2020-02-05 18:33:25 +01:00
Med Ismail Bennani 2b7f32892b [lldb/Target] Add Assert StackFrame Recognizer
When a thread stops, this checks depending on the platform if the top frame is
an abort stack frame. If so, it looks for an assert stack frame in the upper
frames and set it as the most relavant frame when found.

To do so, the StackFrameRecognizer class holds a "Most Relevant Frame" and a
"cooked" stop reason description. When the thread is about to stop, it checks
if the current frame is recognized, and if so, it fetches the recognized frame's
attributes and applies them.

rdar://58528686

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2020-02-05 17:49:13 +01:00
Raphael Isemann 706256b6d3 [lldb] Revert some change in data-formatter-objc/main.m that broke TestDataFormatterObjCNSDate.py
Changing the date2 to an timezone independent value broke the test as the data formatters
uses the current time zone for the summary (so changing it to a time zone independent value
would again break the test in some time zones). We anyway just care about this for date2
which will be printed in a timezone-independent summary.
2020-02-05 14:08:57 +01:00
Raphael Isemann 8d8bd0d654 [lldb] Make TestDataFormatterObjCCF.py pass outside California
Summary:
This test creates its dates with `NSDate dateWithNaturalLanguageString` which is deprecated and uses the current time zone of the machine to
interpret the input string. This causes that the created NSDate has a different value depending on the locale of the machine
and we hardcoded the value for California's time zone (PST) but the data formatter gives out the GMT value as a string.

This just replaces the use with the timezone-independent dateWithTimeIntervalSince1970 (which we also use in the rest of the test)
to make this pass independently of the time zone of the machine running the test.

Reviewers: mib

Reviewed By: mib

Subscribers: lldb-commits, JDevlieghere

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D74038
2020-02-05 13:24:06 +01:00
Raphael Isemann 5ff4f881a7 [lldb] Ignore type sugar in TypeSystemClang::GetPointerType
Summary:
Currently having a typedef for ObjC types is breaking member access in LLDB:
```
typedef NSString Str;
NSString *s; s.length; // OK
Str *s; s.length; // Causes: member reference base type 'Str *' (aka 'NSString *') is not a structure or union
```

This works for NSString as there the type building from `NSString` -> `NSString *` will correctly
build a ObjCObjectPointerType (which is necessary to make member access with a dot possible),
but for the typedef the `Str` -> `Str *` conversion will produce an incorrect PointerType. The reason
for this is that our check in TypeSystemClang::GetPointerType is not desugaring the base type,
which causes that `Str` is not recognised as a type to a `ObjCInterface` as the check only sees the
typedef sugar that was put around it. This causes that we fall back to constructing a PointerType
instead which does not allow member access with the dot operator.

This patch just changes the check to look at the desugared type instead.

Fixes rdar://17525603

Reviewers: shafik, mib

Reviewed By: mib

Subscribers: mib, JDevlieghere, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D73952
2020-02-05 11:44:40 +01:00
Adrian McCarthy fb0d2d455f Fix after c25938d
My refactor caused some changes in error reporting that TestAddDsymCommand.py
was checking, so this restores some of the changes to preserve the old
behavior and to un-xfail the affected test.

Differential Revision: https://reviews.llvm.org/D74001
2020-02-04 16:37:22 -08:00
Vedant Kumar 047c041277 [lldb/test] Skip TestBasicEntryValuesX86_64 due to llvm.org/PR44774 2020-02-04 10:43:50 -08:00
Jonas Devlieghere 904d54de9b [lldb/Test] Sort substr for TestDataFormatterStdMap.py (2/2) 2020-02-03 20:59:21 -08:00
Jonas Devlieghere 0c16a22a2e [lldb/Test] Fix substr order in asan & ubsan tests 2020-02-03 20:57:57 -08:00
Jonas Devlieghere 4c05019dc0 [lldb/Test] Fix typo in TestDataFormatterStdMap.py 2020-02-03 20:44:53 -08:00
Jonas Devlieghere 70cea38ff7 [lldb/Test] Sort substr for TestDataFormatterStdMap.py 2020-02-03 20:35:43 -08:00