Commit Graph

22699 Commits

Author SHA1 Message Date
Jonas Devlieghere
7606a54363 [lldb/Reproducers] Fix/skip passive replay failures in python_api subdir
Fixes or skips tests in the python_api subdirectory that were failing
with passive replay.
2020-05-20 23:23:53 -07:00
Jonas Devlieghere
8723f841aa [lldb/Test] Support arbitrary file extensions in TestPositionalArgs.test
On Windows the line must match:

  Use 'lldb.exe --help' for a complete list of options.
2020-05-20 14:09:19 -07:00
Nico Weber
bc1c3655bf Give microsoftDemangle() an outparam for how many input bytes were consumed.
Demangling Itanium symbols either consumes the whole input or fails,
but Microsoft symbols can be successfully demangled with just some
of the input.

Add an outparam that enables clients to know how much of the input was
consumed, and use this flag to give llvm-undname an opt-in warning
on partially consumed symbols.

Differential Revision: https://reviews.llvm.org/D80173
2020-05-20 16:17:31 -04:00
Jonas Devlieghere
690993a09a [lldb/Reproducers] Add instrumentation to SBEnvironment
This class should've been instrumented when it landed. Whether the class
is "highly mutable" or not doesn't affect that.

With this patch TestSBEnvironment.py now passes when replayed.
2020-05-20 13:02:20 -07:00
Jonas Devlieghere
ce19664d94 [lldb/Driver] Print snippet before exiting with unknown argument.
Print a little snippet before exiting when passed unrecognized
arguments. The goal is twofold:

 - Point users to lldb --help.
 - Make it clear that we exited the debugger.
2020-05-20 12:35:02 -07:00
Haibo Huang
04daba9670 [lldb] Cleans up system_libs
Summary:
Long long ago system_libs was appended to LLDB_SYSTEM_LIBS in
cmake/LLDBDependencies.cmake. After that file was removed, system_libs
is orphaned.

Currently the only user is source/Utility. Move the logic there and
remove system_libs.

Subscribers: mgorny, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D80253
2020-05-20 12:30:08 -07:00
Haibo Huang
780d7d7732 [lldb] Allows customizing libxml2 for darwin
Summary:
This changes allows to disable or use customized libxml2 for lldb.

1. Removes redundant include_directories. The one in LLDBConfig.cmake should be enough.

2. Link to ${LIBXML2_LIBRARIES} if xml2 is enabled.

Subscribers: mgorny, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D80257
2020-05-20 12:27:08 -07:00
Jonas Devlieghere
bfb2783726 [lldb/Reproducers] Make SBStream::Print an API instead of a SWIG extension
This makes it possible to instrument the call for the reproducers. This
fixes TestStructuredDataAPI.py with reproducer replay.

Differential revision: https://reviews.llvm.org/D80312
2020-05-20 10:37:18 -07:00
Jonas Devlieghere
4b17702434 [lldb/Reproducers] Skip another test that uses lldb::FileSP under the hood 2020-05-20 09:49:29 -07:00
Jonas Devlieghere
5b5b81bcdc [lldb/Driver] Error out when encountering unknown arguments
There appears to be consensus in D80165 that this is the desired
behavior and I personally agree.

Differential revision: https://reviews.llvm.org/D80226
2020-05-20 09:40:40 -07:00
Jonas Devlieghere
d57b80e13e [lldb/Reproducers] Support reproducers for PlatformRemoteGDBServer
Add reproducer support to PlatformRemoteGDBServer. The logic is
essentially the same as for ProcessGDBRemote. During capture we record
the GDB packets and during replay we connect to a replay server.

This fixes TestPlatformClient.py when run form a reproducer.

Differential Revision: https://reviews.llvm.org/D80224
2020-05-20 09:18:57 -07:00
Jonas Devlieghere
667be3319d [lldb/Reproducers] Update macosx remote tests for passive replay
Skip tests or part thereof that are not supposed to work with replay.
2020-05-20 09:03:16 -07:00
Raphael Isemann
aa04ce7617 [lldb][NFC] Minor NamespaceMap refactor 2020-05-20 15:29:20 +02:00
Raphael Isemann
587f81f54a Revert "[lldb-server] Reset stop reason of all threads when resuming"
This reverts commit 56de738d18.

This broke the aarch64 bot. Reverting on behalf of jarin.
2020-05-20 13:29:04 +02:00
Dmitri Gribenko
8214eff467 Revert "[lldb/DataFormatter] Check for overflow when finding NSDate epoch"
This reverts commit b783f70a42. This
change had multiple issues which required post-commit fixups, and not
all issues are fixed yet. In particular, the LLDB build bot for ARM is
still broken. There is also an ongoing conversation in the original
phabricator review about whether there is undefined behavior in the
code.
2020-05-20 12:44:19 +02:00
Dmitri Gribenko
0f1195a586 Revert "[lldb/test] Relax NSDate mock test for non-Apple platforms"
This reverts commit fff3a8464d. It is a
follow-up to b783f70a42, which I'm
reverting -- see the explanation in that revert.
2020-05-20 12:44:19 +02:00
Dmitri Gribenko
f67f9e86e8 Revert "[lldb/test] Disable NSDate format check under _WIN32"
This reverts commit e3aa4cd9db. It is a
follow-up to b783f70a42, which I'm
reverting -- see the explanation in that revert.
2020-05-20 12:44:19 +02:00
Dmitri Gribenko
23f29b2fcc Revert "Silence warnings around int/float conversions."
This reverts commit 15ee8a3a58. It is a
follow-up to b783f70a42, which I'm
reverting -- see the explanation in that revert.
2020-05-20 12:44:19 +02:00
Dmitri Gribenko
79fcd35c68 Revert "[lldb/test] Move "DataFormatters/Mock.h" to "Plugins/Language/ObjC/Utilities.h""
This reverts commit 82dbf4aca8. It is a
follow-up to b783f70a42, which I'm
reverting -- see the explanation in that revert.
2020-05-20 12:44:18 +02:00
Raphael Isemann
4bee2afcd7 [lldb][NFC] Modernize TestCPPStaticMethods
Now with LLVM code style and expect_expr for checking. Also some minor changes
to be more similar to the structure we use in other tests.
2020-05-20 12:27:44 +02:00
Emre Kultursay
a9d7b458c0 Use IPv4 for Android connections
Summary:
When adb client connects to adb server, or when lldb connects to
lldb server on Android device, IPv6 does not work (at least on
Windows it does not work).

For Android on Windows, each IPv6 failure (fallback-to-IPv4) wastes
2 seconds, and since this is called 5 times when attaching, LLDB
is wasting 10 seconds. This CL brings a big improvement to attach latency.

Reviewers: labath

Reviewed By: labath

Subscribers: aadsm, clayborg, mgrang, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D79757
2020-05-20 11:32:03 +02:00
Jaroslav Sevcik
56de738d18 [lldb-server] Reset stop reason of all threads when resuming
Summary:
This patch makes the stop reason reset logic similar to MacOS' debugserver, where exceptions are reset for all threads when resuming process for stepping or continuing (see [[ 96f3ea0d21/lldb/tools/debugserver/source/MacOSX/MachThreadList.cpp (L433) | MachThreadList::ProcessWillResume ]] and [[ 96f3ea0d21/lldb/tools/debugserver/source/MacOSX/MachThread.cpp (L363) | MachThread::ThreadWillResume ]]).

Resetting stop reasons on resume fixes problems where LLDB spuriously reports SIGTRAP signal stop reason for deleted breakpoints (both internal and public) and where  LLDB stops on an internal breakpoint while stepping over while a breakpoint is hit in another thread. See [[ https://bugs.llvm.org/show_bug.cgi?id=45642 | PR45642 ]] for details.

Reviewed By: jingham, labath

Differential Revision: https://reviews.llvm.org/D79308
2020-05-20 11:08:34 +02:00
Pavel Labath
2a227b36b0 Revert "Add terminateCommands to lldb-vscode protocol"
This reverts commit a3609b0ec6, because it
makes a number of lldb-vscode tests flaky.
2020-05-20 10:48:29 +02:00
António Afonso
a3609b0ec6 Add terminateCommands to lldb-vscode protocol
Summary: Adding this in line with "stopCommands" and "exitCommands" so that we can run commands at the end of the debugging session.

Reviewers: clayborg, wallace, labath

Reviewed By: clayborg, labath

Subscribers: lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D79726
2020-05-19 16:18:05 -07:00
Vedant Kumar
82dbf4aca8 [lldb/test] Move "DataFormatters/Mock.h" to "Plugins/Language/ObjC/Utilities.h"
This addresses some post-commit review feedback from
https://reviews.llvm.org/D80150 by renaming "Mock.h" to something less
misleading, and keeping logic related to the ObjC plugin separate from
the generic DataFormatters library.
2020-05-19 16:09:42 -07:00
Jonas Devlieghere
c7dddaa89f [lldb/Reproducers] Update GDB remote client tests for passive replay
Tests that check the state of the server don't work when replayed
because the replay server replies to requests.
2020-05-19 13:07:50 -07:00
Jonas Devlieghere
018e5a96ee [lldb/Properties] Move OSPluginReportsAllThreads from Target to Process
This is what Jim wanted originally.

rdar://problem/61236293

Differential revision: https://reviews.llvm.org/D80159
2020-05-19 11:26:39 -07:00
Eric Christopher
15ee8a3a58 Silence warnings around int/float conversions. 2020-05-19 10:56:18 -07:00
Jonas Devlieghere
225f241c84 [lldb/Reproducers] Move connection logic into replay server (NFC)
Move the logic for connecting to the replay server into the replay
server itself, so it can be reused outside of ProcessGDBRemote.
2020-05-19 10:55:35 -07:00
Jonas Devlieghere
2bb16f9412 [lldb/Test] Skip TestPositionalArgs with lldb-repro 2020-05-18 22:59:55 -07:00
Jonas Devlieghere
82093e8fb7 [lldb/Driver] Fix handling on positional arguments
Before the transition to libOption it was possible to specify arguments
for the inferior without -- as long as they didn't start with a dash.

For example, the following invocations should all behave the same:

  $ lldb inferior inferior-arg
  $ lldb inferior -- inferior-arg
  $ lldb -- inferior inferior-arg

This patch fixes that behavior, documents it and adds a test to cover
the different combinations.

Differential revision: https://reviews.llvm.org/D80165
2020-05-18 18:52:18 -07:00
Reid Kleckner
47cc6db928 Re-land [Debug][CodeView] Emit fully qualified names for globals
This reverts commit 525a591f0f.

Fixed an issue with pointers to members based on typedefs. In this case,
LLVM would emit a second UDT. I fixed it by not passing the class type
to getTypeIndex when the base type is not a function type. lowerType
only uses the class type for direct function types. This suggests if we
have a PMF with a function typedef, there may be an issue, but that can
be solved separately.
2020-05-18 17:31:00 -07:00
Vedant Kumar
e3aa4cd9db [lldb/test] Disable NSDate format check under _WIN32
Disable the test which attempts to format an NSDate with a date_value of
0 on _WIN32.

When _WIN32 is defined, GetOSXEpoch returns a date that should be in
2001, but after this is passed through timegm (which, afaict isn't
portable?) the result is a date in 1970:

```
lldb-x64-windows-ninja\llvm-project\lldb\unittests\DataFormatter\MockTests.cpp(39): error:       Expected: *formatDateValue(0)
      Which is: "1970-01-01 00:00:00 Pacific Standard Time"
      To be equal to: "2001-01-01 00:00:00 UTC"
```

http://lab.llvm.org:8011/builders/lldb-aarch64-ubuntu/builds/4520/steps/test/logs/stdio
2020-05-18 16:51:47 -07:00
Vedant Kumar
fff3a8464d [lldb/test] Relax NSDate mock test for non-Apple platforms
On Ubuntu, a formatted date prints as "GMT" instead of "UTC", which is
ok.

http://lab.llvm.org:8011/builders/lldb-aarch64-ubuntu/builds/4520/steps/test/logs/stdio
2020-05-18 16:00:10 -07:00
Vedant Kumar
b783f70a42 [lldb/DataFormatter] Check for overflow when finding NSDate epoch
Summary:
Fixes UBSan-reported issues where the date value inside of an
uninitialized NSDate overflows the 64-bit epoch.

rdar://61774575

Reviewers: JDevlieghere, mib, teemperor

Subscribers: mgorny, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D80150
2020-05-18 13:12:00 -07:00
Jonas Devlieghere
2084330e41 [lldb/Reproducers] Add skipIfReproducer to more tests
Mark more tests as unsupported with reproducers.
2020-05-18 10:13:01 -07:00
Hans Wennborg
525a591f0f Revert 76c5f277f2 "Re-land [Debug][CodeView] Emit fully qualified names for globals"
> Before this patch, S_[L|G][THREAD32|DATA32] records were emitted with a simple name, not the fully qualified name (namespace + class scope).
>
> Differential Revision: https://reviews.llvm.org/D79447

This causes asserts in Chromium builds:

CodeViewDebug.cpp:2997: void llvm::CodeViewDebug::emitDebugInfoForUDTs(const std::vector<std::pair<std::string, const DIType *>> &):
Assertion `OriginalSize == UDTs.size()' failed.

I will follow up on the Phabricator issue.
2020-05-18 11:26:30 +02:00
Med Ismail Bennani
4e9e0488ab [lldb/Commands] Add ability to run shell command on the host.
This patch introduces the `(-h|--host)` option to the `platform shell`
command. It allows the user to run shell commands from the host platform
(always available) without putting lldb in the background.

Since the default behaviour of `platform shell` is to run the command of
the selected platform, having such a choice can be quite handy when
debugging remote targets, for instances.

This patch also introduces a `shell` alias, to improve the command
discoverability and make it more convenient to use for the user.

rdar://62856024

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2020-05-15 22:14:39 +02:00
Med Ismail Bennani
0eba9de71e [lldb/Dataformatter] Add support to CF{Dictionary,Set}Ref types
This patch improves data formatting for CFDictionaryRef and CFSetRef.
It uses the same data-formatter as NSCFDictionaries and NSCFSets introduced
previously but did require some adjustments in Core::ValueObject.

Since the "Ref" types are opaque pointers to the actual CF containers, if the
value object has a synthetic value, lldb will use the opaque pointer's pointee
type to create the new ValueObjectChild needed to dereference the ValueObject.
This allows the "Ref" types to behaves the same as CF containers when used with
the `frame variable` command, the SBAPI or in Xcode's variable inspector.

This patch also adds support for incomplete types in ValueObject.

rdar://53104287

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2020-05-15 22:14:39 +02:00
Alexandre Ganea
76c5f277f2 Re-land [Debug][CodeView] Emit fully qualified names for globals
Before this patch, S_[L|G][THREAD32|DATA32] records were emitted with a simple name, not the fully qualified name (namespace + class scope).

Differential Revision: https://reviews.llvm.org/D79447
2020-05-15 10:37:09 -04:00
Pavel Labath
36b9b1e617 [lldb] Fixup command-disassemble-process.yaml test
Increase the function size to account for the changed threshold in
8b845ac5ed.
2020-05-15 12:35:44 +02:00
Pavel Labath
8b845ac5ed Recommit "[lldb] Don't dissasemble large functions by default"
This recommits f665e80c02 which was reverted in 1cbd1b8f69 for breaking
TestFoundationDisassembly.py. The fix is to use --force in the test to avoid
bailing out on large functions.

I have also doubled the large function limit to 8000 bytes (~~ 2000 insns), as
the foundation library contains a lot of large-ish functions. The intent of this
feature is to prevent accidental disassembling of enormous (multi-megabyte)
"functions", not to get in people's way.

The original commit message follows:

If we have a binary without symbol information (and without
LC_FUNCTION_STARTS, if on a mac), then we have to resort to using
heuristics to determine the function boundaries. However, these don't
always work, and so we can easily end up thinking we have functions
which are several megabytes in size. Attempting to (accidentally)
disassemble these can take a very long time spam the terminal with
thousands of lines of disassembly.

This patch works around that problem by adding a sanity check to the
disassemble command. If we are about to disassemble a function which is
larger than a certain threshold, we will refuse to disassemble such a
function unless the user explicitly specifies the number of instructions
to disassemble, uses start/stop addresses for disassembly, or passes the
(new) --force argument.

The threshold is currently fairly aggressive (4000 bytes ~~ 1000
instructions). If needed, we can increase it, or even make it
configurable.

Differential Revision: https://reviews.llvm.org/D79789
2020-05-15 11:57:48 +02:00
Raphael Isemann
d48ef7cab5 [lldb] Print full Clang diagnostics when the ClangModulesDeclVendor fails to compile a module
Summary:
When the ClangModulesDeclVendor currently fails it just prints very basic and often incomplete diagnostics without any source locations:
```
(lldb) p @import Foundation
error: while importing modules:
'foo/bar.h' file not found
could not build module 'Darwin'
[...]
```
or even just
```
(lldb) p @import Foundation
error: while importing modules:
could not build module 'Darwin'
[...]
```

These diagnostics help neither the user nor us with figuring out what is the reason for the failure.

This patch wires up a full TextDiagnosticPrinter in the ClangModulesDeclVendor and makes
sure we always return the error stream to the user when we fail to compile our modules.

Fixes rdar://63216849

Reviewers: aprantl, jdoerfert

Reviewed By: aprantl

Subscribers: JDevlieghere

Differential Revision: https://reviews.llvm.org/D79947
2020-05-15 10:11:03 +02:00
Gongyu Deng
7c89297cf7 Correct the argument list of command breakpoint read
Summary: Command `breakpoint read` should not accept breakpoint ids as
arguments, and in fact, it is not implemented to deal with breakpoint id
arguments either. So this patch is to correct the argument list of this
command so that the help text won't misguide users.

Reviewers: teemperor, JDevlieghere, jingham

Reviewed By: teemperor, JDevlieghere

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D79722
2020-05-15 09:00:05 +02:00
Jonas Devlieghere
bf02bcffcf [lldb/Test] Modify more tests for API replay
Skip tests or parts thereof that aren't expected to work when run from a
reproducer. Also improve the doc comments in configuration.py to prevent
mistakes in the future.
2020-05-14 17:58:27 -07:00
Jonas Devlieghere
9fde516032 [lldb/Test] Replace assertTrue with more specific checks (NFC)
Use assertEqual(a, b) instead of assertTrue(a == b) etc.
2020-05-14 15:48:48 -07:00
shafik
1cbd1b8f69 Revert "[lldb] Don't dissasemble large functions by default"
This reverts commit f665e80c02.

Reverting because it breaks TestFoundationDisassembly.py
2020-05-14 14:15:51 -07:00
Ryan Mansfield
5144e48c14 [lldb] Update stop info override callback comment.
In D31172 GetStopInfoOverrideCallback was moved and renamed.

Differential revision: https://reviews.llvm.org/D79953
2020-05-14 13:08:56 -07:00
Jonas Devlieghere
2d6f4fec07 [lldb/Test] Skip test using files to synchronize.
Files written by the inferior are not captured by the reproducers and
the inferior doesn't actually run during replay.
2020-05-14 13:08:56 -07:00
Jonas Devlieghere
e7c91e3124 [lldb/Test] Skip remaining 'side_effect' tests with reproducers.
The side_effect Python package bypasses the reproducer instrumentation
and therefore these tests are not expected to replay from a reproducer.
2020-05-14 10:38:56 -07:00