Commit Graph

22916 Commits

Author SHA1 Message Date
Aleksandr Urakov 895529cfd8 [lldb][PDB] Constexpr static member values as AST literals
Summary:
When evaluating an expression referencing a constexpr static member variable, an
error is issued because the PDB does not specify a symbol with an address that
can be relocated against.

Rather than attempt to resolve the variable's value within the IR execution, the
values of all constants can be looked up and incorporated into the AST of the
record type as a literal, mirroring the original compiler AST.

This change applies to DIA and native PDB loaders.

Patch By: jackoalan

Reviewers: aleksandr.urakov, jasonmolenda, zturner, jdoerfert, teemperor

Reviewed By: aleksandr.urakov

Subscribers: sstefan1, lldb-commits, llvm-commits, #lldb

Tags: #lldb, #llvm

Differential Revision: https://reviews.llvm.org/D82160
2020-06-25 11:27:16 +03:00
Jonas Devlieghere 06412dae82 [lldb] Use std::make_unique<> (NFC)
Update the rest of lldb to use std::make_unique<>. I used clang-tidy to
automate this, which probably missed cases that are wrapped in ifdefs.
2020-06-24 17:48:40 -07:00
Davide Italiano 47ac45332e [HostInfoMacOS] Parse correctly the triple for Apple Silicon.
Again, debugging doesn't work on the new platform without this, so
it's implicitly covered by the testsuite.
2020-06-24 16:37:21 -07:00
Davide Italiano 2010444e5e [Apple Silicon] Handle macOS in PlatformDarwin
This makes "target create /bin/ls" properly detect which platform
is needed when running lldb. Covered by many tests in the suite.
2020-06-24 16:35:36 -07:00
Jonas Devlieghere 1c0bbe4341 [lldb/API] Use std::make_unique<> (NFC)
I was holding off on this change until we moved to C++14 as to not have
to convert llvm::make_unique to std::make_unique. That happened a while
ago so here's the first patch for the API which had a bunch of raw
`new`s.
2020-06-24 16:29:30 -07:00
Martin Storsjö 0cd9e59829 [ProcessGDBRemote] Fix a typo in an ifdef from 58de2a3851 2020-06-24 23:49:33 +03:00
Davide Italiano 58de2a3851 [ProcessGDBRemote] Placate the Windows buildbot.
I'm probably going to rewrite this function anyway, but, in
the meanwhile.
2020-06-24 13:23:49 -07:00
Raphael Isemann cad79f73b6 [lldb][NFC] Use expect_expr in TestStructTypes.py 2020-06-24 22:12:17 +02:00
Davide Italiano b4fdddf971 [Apple Silicon] Debugging of process under Rosetta is supported.
Remove this early exit. It's vestigial from the ppc -> Intel transition,
but it doesn't apply anymore.
2020-06-24 12:25:01 -07:00
Davide Italiano fd19ddb8f2 [Apple Silicon] Initial support for Rosetta
Translated processes talk with a different debugserver, shipped with
macOS 11. This patch detects whether a process is translated and
attaches to the correct debugserver implementation.
It's the first patch of a series. Tested on the lldb test suite.

Differential Revision:  https://reviews.llvm.org/D82491
2020-06-24 12:19:21 -07:00
Walter Erquinigo d4ef569577 Disable a flaky lldb-vscode test on aarch64
Summary:
These tests isflaky only on this arch for some reason. It's testing important features and is not flaky on x86_64, so I'll investigate this arm issue separatedly.

A flaky run:
http://lab.llvm.org:8011/builders/lldb-aarch64-ubuntu/builds/5540/steps/test/logs/stdio

Diff that created those tests:
https://reviews.llvm.org/D81978
2020-06-24 11:09:21 -07:00
Walter Erquinigo 8e08422385 Disable flaky lldb-vscode tests on aarch64
Summary:
These two tests are flaky only on this arch for some reason. They are testing important features and are not flaky on x86_64, so I'll investigate this arm issue separatedly.

Some flaky runs:
http://lab.llvm.org:8011/builders/lldb-aarch64-ubuntu/builds/5517/steps/test/logs/stdio
http://lab.llvm.org:8011/builders/lldb-aarch64-ubuntu/builds/5527/steps/test/logs/stdio

Diff that created those tests:
https://reviews.llvm.org/D81978
2020-06-24 08:57:20 -07:00
Pavel Labath 16e17ca16a [lldb] Refactor Scalar::TruncOrExtendTo
The "type" argument to the function is mostly useless -- the only
interesting aspect of it is signedness. Pass signedness directly and
compute the value of bits and signedness fields -- that's exactly
what the single caller of this function does.
2020-06-24 15:58:33 +02:00
Konrad Kleine 4bfa43809f [lldb] fix typo in docs: withing -> within 2020-06-24 05:19:47 -04:00
Jonas Devlieghere 6507bc5621 [lldb/Test] Temporarily disable TestSimulatorPlatform.py 2020-06-23 22:41:01 -07:00
Jonas Devlieghere be494adb30 [lldb/Lua] Fix typo: s/stdout/stderr/
This wasn't caught by the existing test, but will be covered by the
extended test that's part of D82412.
2020-06-23 14:19:03 -07:00
Walter Erquinigo 74ab1da028 Redo of Add terminateCommands to lldb-vscode protocol
Summary:
This redoes https://reviews.llvm.org/D79726 and fixes two things.
- The logic that determines whether to automatically disconnect during the tear down is not very dumb compared to the original implementation. Each test will determine whether to do that or not.
- The terminate commands and terminate event were being sent after the disconnect response was sent to the IDE. That was not good, as VSCode stops the debug session as soon as it receives a disconnect response. Now, the terminate event and terminateEvents are being executed before the disconnect response is sent. This ensures that any connection between the IDE and lldb-vscode is alive while the terminate commands are executed. Besides, it also allows displaying the output of the terminate commands on the debug console, as it's still alive.

Reviewers: clayborg, aadsm, kusmour, labath

Subscribers: lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D81978
2020-06-23 12:51:43 -07:00
Davide Italiano 33ece57241 Generalize TestFormattersBoolRefPtr to work on Apple Silicon. 2020-06-23 12:45:31 -07:00
Davide Italiano 63d597093c [ObjectFileMachO] Check for TARGET_EMBEDDED instead of listing architectures.
Now that Apple Silicon is a thing, we need to generalize the check.
2020-06-23 12:37:45 -07:00
Davide Italiano 3c79212319 [Host] Check for TARGET_OS_EMBEDDED instead of listing architectures.
With the advent of Apple Silicon, checking for the architectures
specifically is not correct anymore. This code is only supposed to
run on embedded devices (iPhones et similia), so mark it accordingly.
2020-06-23 12:27:21 -07:00
Walter Erquinigo 0a9e7d0b6b [vscode] set default values for terminateDebuggee for the disconnect request
Summary:
Recently I've noticed that VSCode sometimes doesn't send the terminateDebuggee flag within the disconnectRequest,
even though lldb-vscode sets the terminateDebuggee capability correctly.
This has been causing that inferiors don't die after the debug session ends, and many users have reported issues because of this.

An easy way to mitigate this is to set better default values for the terminateDebuggee field in the disconnect request.
I'm assuming that for a launch request, the default will be true, and for attach it'll be false.

Reviewers: clayborg, labath, aadsm

Subscribers: lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D81200
2020-06-23 11:47:43 -07:00
Raphael Isemann d13c3e2f88 [lldb][NFC] Add some more tests for edge cases LLDB's builtin formatters
OSType with less than 8 bytes has special code that isn't tested yet.
The same for C-strings that don't have `const char *` type. Also we're now testing
escaping the ASCII escape sequence (\033).
2020-06-23 19:59:46 +02:00
Davide Italiano 2276bb48be [debugserver] Initial support for Apple Silicon.
Set the correct os type in the arch triple when running macOS.
Debugserver currently always assumes macOS == x86_64. This patch
generalizes the support to make sure it works on a different
architecture.

Differential Revision:  https://reviews.llvm.org/D82394
2020-06-23 10:47:16 -07:00
Jonas Devlieghere 6e670e0796 [lldb/Lua] Require Lua 5.3 2020-06-23 09:24:01 -07:00
Jonas Devlieghere fa1b4a96a0 [lldb/Lua] Use the debugger's output and error file for Lua's I/O library.
Add support for changing the stdout and stderr file in Lua's I/O library
and hook it up with the debugger's output and error file respectively
for the interactive Lua interpreter.

https://reviews.llvm.org/D82273
2020-06-23 09:05:51 -07:00
Sander de Smalen 121e585ec8 [AArch64][SVE] ACLE: Add bfloat16 to struct load/stores.
This patch contains:
- Support in LLVM CodeGen for bfloat16 types for ld2/3/4 and st2/3/4.
- New bfloat16 ACLE builtins for svld(2|3|4)[_vnum] and svst(2|3|4)[_vnum]

Reviewers: stuij, efriedma, c-rhodes, fpetrogalli

Reviewed By: fpetrogalli

Tags: #clang, #lldb, #llvm

Differential Revision: https://reviews.llvm.org/D82187
2020-06-23 12:12:35 +01:00
Pavel Labath 5a4d78064e [lldb] Split ClangASTSource::CompleteType
Move the part of the code which is responsible for finding a complete
definition of the type into a separate function (FindCompleteType). This
is split off from D81561, as it's a generally useful cleanup.

No functional change.
2020-06-23 11:47:52 +02:00
Jonas Devlieghere 1728dec255 [lldb/Lua] Recognize "quit" as a way to exit the script interpreter.
Add a way to quit the interactive script interpreter from a shell tests.
Currently, the only way (that I know) to exit the interactive Lua
interpreter is to send a EOF with CTRL-D. I noticed that the embedded
Python script interpreter accepts quit (while the regular python
interpreter doesn't). I've added a special case to the Lua interpreter
to do the same.

Differential revision: https://reviews.llvm.org/D82272
2020-06-22 09:27:12 -07:00
Raphael Isemann 79608371f1 [lldb][NFC] Add more test for builtin formats
Reland 90c1af106a . This changes the char format
tests which were printing the pointer value of the C-string instead of its
contents, so this test failed on other machines. Now they just print the
bytes in a uint128_t.

Original commit description:

The previous tests apparently missed a few code branches in DumpDataExtractor
code. Also renames the 'test_instruction' which had the same name as another
test (and Python therefore ignored the test entirely).
2020-06-22 15:13:41 +02:00
Jonas Devlieghere 6e3faaeb44 [lldb/Lua] Remove redundant variable (NFC) 2020-06-20 23:28:22 -07:00
Jonas Devlieghere e13fca4fac [lldb] Remove unused <iostream> includes (NFC) 2020-06-20 22:38:45 -07:00
Eric Christopher 10b4354136 Temporarily Revert "[lldb][NFC] Add more test for builtin formats"
as it's failing on the debian buildbots:

http://lab.llvm.org:8011/builders/lldb-x86_64-debian/builds/12531

This reverts commit 90c1af106a.
2020-06-20 14:21:42 -07:00
Raphael Isemann 90c1af106a [lldb][NFC] Add more test for builtin formats
The previous tests apparently missed a few code branches in DumpDataExtractor
code. Also renames the 'test_instruction' which had the same name as another
test (and Python therefore ignored the test entirely).
2020-06-20 19:31:40 +02:00
Raphael Isemann ab888262b3 [lldb] Skip TestBuiltinFormats.py on arm for now 2020-06-20 11:22:44 +02:00
Jonas Devlieghere 8027f04a6d [lldb/Test] Disable TestBuiltinFormats.py on Windows
Disable the test to turn the Windows bot green again until Raphael has
time to investigate.
2020-06-19 22:41:29 -07:00
Jonas Devlieghere 7a9a341953 [lldb/Test] Temporarily skip watch simulator in TestSimulatorPlatform.py
The simulator doesn't launch on green-dragon-10.

rdar://problem/64552748
2020-06-19 22:41:29 -07:00
Eric Christopher 2db1d75396 As part of using inclusive language within the llvm project,
migrate away from the use of blacklist and whitelist.
2020-06-19 14:51:04 -07:00
Eric Christopher efb328f674 As part of using inclusive language with the llvm project,
migrate away from the use of blacklist and whitelist.
2020-06-19 14:48:48 -07:00
Raphael Isemann aa7cd42993 [lldb][NFC] Add test for builtin formats 2020-06-19 22:33:02 +02:00
Jonas Devlieghere 827c012297 [lldb] Replace calls to new with std::make_shared<> (NFC) 2020-06-19 11:20:15 -07:00
Raphael Isemann f5eaa2afe2 [lldb] Replace std::isprint/isspace with llvm's locale-independent version
Summary:
LLVM is using its own isPrint/isSpace implementation that doesn't change depending on the current locale. LLDB should do the same
to prevent that internal logic changes depending on the set locale.

Reviewers: JDevlieghere, labath, mib, totally_not_teemperor

Reviewed By: JDevlieghere

Differential Revision: https://reviews.llvm.org/D82175
2020-06-19 19:17:56 +02:00
Raphael Isemann 8340fbb9c7 [lldb] Reactivate Objective-C++ plugin
Summary:
Since commit 7b3ef05a37 the Objective-C++ plugin is dead code.
That commit added Objective-C++ to the list of languages for which `Language::LanguageIsCPlusPlus`
returns true. As the C++ language plugin also uses that method to figure out if it is responsible for a
given language, the C++ plugin since then also became the plugin that we found when looking for
a language plugin for Objective-C++. The only real fallout from that is that the source highlighting
for Objective-C++ files never worked as we always found the C++ plugin which refuses to highlight
files with Objective-C++ extensions.

This patch just adds a special exception for Objective-C++ to the list of languages that are governed
by the C++ plugin. Also adds a test that makes sure that we find the right plugin for all C language
types and that the highlighting for `.mm` (Objective-C++) and `.m` (Objective-C) files works.

I didn't revert 7b3ef05a37 as it does make sense to return
true for Objective-C++ from `Language::LanguageIsCPlusPlus` (e.g., we currently check if we care about
ODR violations by doing `if (Language::LanguageIsCPlusPlus(...))` and this should also work for
Objective-C++).

Fixes rdar://64420183

Reviewers: aprantl

Reviewed By: aprantl

Subscribers: mgorny, abidh, JDevlieghere

Differential Revision: https://reviews.llvm.org/D82109
2020-06-19 19:16:46 +02:00
Raphael Isemann be18df3d23 [lldb] Fix that SIGWINCH crashes IOHandlerEditline when we are not using the editline backend
Summary:
TerminalSizeChanged is called from our SIGWINCH signal handler but the
IOHandlerEditline currently doesn't check if we are actually using the real
editline backend. If we're not using the real editline backend, `m_editline_up`
won't be set and `IOHandlerEditline::TerminalSizeChanged` will access
the empty unique_ptr. In a real use case we don't use the editline backend
when we for example read input from a file. We also create some temporary
IOHandlerEditline's during LLDB startup it seems that are also treated
as non-interactive (apparently to read startup commands).

This patch just adds a nullptr check for`m_editline_up` as we do in the rest of
IOHandlerEditline.

Fixes rdar://problem/63921950

Reviewers: labath, friss

Reviewed By: friss

Subscribers: abidh, JDevlieghere

Differential Revision: https://reviews.llvm.org/D81729
2020-06-19 19:14:16 +02:00
Adrian Prantl 7e825abd57 Repair support for launching ios/tv/watch simulator binaries through platform
and delete a bunch (but not all) redundant code. If you compare the remaining implementations of Platform*Simulator.cpp, there is still an obvious leftover cleanup task.

Specifically, this patch

- removes SDK initialization from dotest (there is equivalent but more
  complete code in Makefile.rules)

- make Platform*Simulator inherit the generic implementation of
  PlatformAppleSimulator (more can be done here)

- simplify the platform logic in Makefile.rules

- replace the custom SDK finding logic in Platform*Simulator with XcodeSDK

- adds a test for each supported simulator

Differential Revision: https://reviews.llvm.org/D81980
2020-06-19 09:42:44 -07:00
Raphael Isemann 6331c7d0be [lldb] Disable complex tests on Windows
The tests fail to compile there:
```
complex/main.c:4:16: error: expected ';' at end of declaration
  float complex complex_float = -1.5f + -2.5f * I;
               ^
               ;
```
2020-06-19 18:40:08 +02:00
Raphael Isemann 85e7e3b1c9 [lldb] Fix TestComplexInt on ARM
On the buildbot long and int have the same size but long and long long don't,
so the bug where we find the first type by size will produce a different error.
Make the test dynamic based on int/long/long long size to fix the bot.
2020-06-19 17:47:16 +02:00
Raphael Isemann 1e8e1ec00c [lldb][NFC] Remove unused DEPTH_INCREMENT in CompilerType.cpp 2020-06-19 16:35:03 +02:00
Raphael Isemann 3e66bd291f [lldb][NFC] Add test for C99 and GCC complex types
LLDB has a lot of code for supporting complex types but we don't have a single
test for it. This adds some basic tests and documents the found bugs.
2020-06-19 16:22:16 +02:00
Derek Schuff c1709e5d90 Set appropriate host defines for building under emscripten
Emscripten has emulations for several headers found on Linux,
including spwan.h and endian.h

Differential Revision: https://reviews.llvm.org/D82121
2020-06-18 17:00:53 -07:00
Eric Christopher 50939c0a67 Add SveBFloat16 to type switch. 2020-06-18 12:39:03 -07:00