Commit Graph

5063 Commits

Author SHA1 Message Date
Jonas Devlieghere cc68799056 [lldb] Stop unsetting LLDB_DEBUGSERVER_PATH from TestLaunchProcessPosixSpawn
We no longer need this after Pavel's change to automatically find debug
servers to test. (3ca7b2d)
2021-04-19 12:28:22 -07:00
Jonas Devlieghere a7712091ea [lldb] Update breakpoint_function_callback.test for different error message
Adjust for the Lua error message printed by Lua 5.4.3.
2021-04-19 12:23:23 -07:00
Caroline Tice 3dc24bc31e [LLDB] Re-land: Use path relative to binary for finding .dwo files.
DWARF allows .dwo file paths to be relative rather than absolute. When
they are relative, DWARF uses DW_AT_comp_dir to find the .dwo
file. DW_AT_comp_dir can also be relative, making the entire search
patch for the .dwo file relative. In this case, LLDB currently
searches relative to its current working directory, i.e. the directory
from which the debugger was launched. This is not right, as the
compiler, which generated the relative paths, can have no idea where
the debugger will be launched. The correct thing is to search relative
to the location of the executable binary. That is what this patch
does.

Differential Revision: https://reviews.llvm.org/D97786
2021-04-16 11:12:39 -07:00
Caroline Tice 042668d092 Revert "[LLDB] Use path relative to binary for finding .dwo files."
This reverts commit b241f3cb29.

Test case is breaking windows builder.
2021-04-15 17:17:44 -07:00
Caroline Tice b241f3cb29 [LLDB] Use path relative to binary for finding .dwo files.
DWARF allows .dwo file paths to be relative rather than absolute. When
they are relative, DWARF uses DW_AT_comp_dir to find the .dwo
file. DW_AT_comp_dir can also be relative, making the entire search
patch for the .dwo file relative. In this case, LLDB currently
searches relative to its current working directory, i.e. the directory
from which the debugger was launched. This is not right, as the
compiler, which generated the relative paths, can have no idea where
the debugger will be launched. The correct thing is to search relative
to the location of the executable binary. That is what this patch
does.

Differential Revision: https://reviews.llvm.org/D97786
2021-04-15 14:43:47 -07:00
Jonas Devlieghere a749bd7639 [lldb] Add addressing_bits to KNOWN_HOST_INFO_KEYS and sort the list
This fixes TestGdbRemoteHostInfo on Apple Silicon.
2021-04-14 14:15:17 -07:00
Pavel Labath ded660495f [lldb/test] Remove the "expect_captures" feature of lldb-server tests
This functionality is used exactly once, and it is trivial to implement
it differently (capture into two distinct variables, and compare for
equality afterwards).
2021-04-14 21:08:55 +02:00
David Spickett 6cdc2239db [lldb][AArch64] Simplify MTE memory region test
By checking for cpu and toolchain features ahead
of time we don't need the custom return codes.

Reviewed By: omjavaid

Differential Revision: https://reviews.llvm.org/D97684
2021-04-14 11:50:45 +01:00
Jonas Devlieghere accb095512 [lldb] Disable TestClangModulesUpdate.py because it's flaky
The test is failing intermittently on GreenDragon.

rdar://76540904
2021-04-13 20:37:17 -07:00
Pavel Labath 872b1da6ad [lldb/test] s/add_no_ack_remote_stream/do_handshake
These two functions are doing the same thing, only one of them is
sending the packets immediately and the other "queues" them to be sent
later. The first one is better as in case of errors, the backtrace will
point straight to the place that caused them.

Modify the first method to avoid duplication, and ten standardize on it.
2021-04-13 17:10:32 +02:00
David Spickett 29a4d7813c [lldb][AArch64] Only run MTE memory region test if we have MTE
This test is flakey because it tries to read the proc/smaps
file of the first lldb-server process it finds. This process
can finish before we finish doing that.

http://lab.llvm.org:8011/#/builders/96/builds/6634/steps/6/logs/stdio

For now limit this to MTE targets which basically means
QEMU via lldb-dotest, which doesn't have this issue.

I'll fix the race condition shortly.
2021-04-13 15:40:38 +01:00
Pavel Labath 14b9f320fe [lldb] Remote @debugserver_test from TestAppleSimulatorOSType
The annotation is now (since the introduction of @apple_simulator_test)
redundant, and the test could theoretically run on lldb-server too (if
it supported darwin hosts).
2021-04-13 16:09:50 +02:00
David Spickett f152472af5 [lldb] Require x86 for various NativePDB, Breakpad and Minidump tests
These tests fail if you build without the x86 llvm backend.
Either because they use an x86 triple or try to backtrace which
requires some x86 knowledge to see all frames.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D100194
2021-04-13 12:51:48 +00:00
Michał Górny c8d18cba4e Reland "[lldb] [Process] Watch for fork/vfork notifications" for Linux
Big thanks to Pavel Labath for figuring out my mistake.

Differential Revision: https://reviews.llvm.org/D98822
2021-04-13 14:38:31 +02:00
Michał Górny 7da3b44d67 Reland "[lldb] [Process] Watch for fork/vfork notifications" for NetBSD
Differential Revision: https://reviews.llvm.org/D98822
2021-04-13 14:35:44 +02:00
Michał Górny 63d7564105 Reland "[lldb] [Process] Watch for fork/vfork notifications" for FreeBSD
The original commit was reverted because of the problems it introduced
on Linux.  However, FreeBSD should not be affected, so restore that part
and we will address Linux separately.

While at it, remove the dbreg hack as the underlying issue has been
fixed in the FreeBSD kernel and the problem is unlikely to happen
in real life use anyway.

Differential Revision: https://reviews.llvm.org/D98822
2021-04-13 13:19:42 +02:00
Pavel Labath 121cff78a8 Revert "[lldb] [Process] Watch for fork/vfork notifications" and associated followups
This commit has caused the following tests to be flaky:
TestThreadSpecificBpPlusCondition.py
TestExitDuringExpression.py

The exact cause is not known yet, but since both tests deal with
threads, my guess is it has something to do with the tracking of
creation of new threads (which the commit touches upon).

This reverts the following commits:
d01bff8cbd,
ba62ebc48e,
e761b6b4c5,
a345419ee0.
2021-04-13 11:03:06 +02:00
David Spickett a1f3187ca8 [lldb] Require x86 for unwind no-return test
The core file used is built for i386 so we
need the x86 backend to be able to load it.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D100195
2021-04-13 08:51:04 +00:00
David Spickett 96c82166b6 [lldb][Arm/AArch64] Add basic disassemble tests for Arm/AArch64
Previously the test would fail if you built on Arm/AArch64
but did not have the x86 llvm backend enabled.

Reviewed By: omjavaid

Differential Revision: https://reviews.llvm.org/D100192
2021-04-13 08:49:48 +00:00
David Spickett 8a64d80a95 [lldb] Require x86 backend for a bunch of DWARF tests
By moving them into a folder with a local lit config
requiring x86. All these tests use x86 target triples.

There are two tests that require target-x86_64 because
they run program files (instead of just needing the backend).
Those are moved to the x86 folder also but their REQUIRES are
unchanged.

Reviewed By: JDevlieghere

Differential Revision: https://reviews.llvm.org/D100193
2021-04-13 08:47:41 +00:00
Jonas Devlieghere 7dbb4274ef [lldb] Fix replaying TestMemoryRead.py from reproducer
Remap the external file to the one embedded in the reproducer.
2021-04-12 21:10:09 -07:00
Jonas Devlieghere 30f591c386 [lldb] Disable TestLaunchProcessPosixSpawn.py with reproducers 2021-04-12 18:32:10 -07:00
Jonas Devlieghere ba62ebc48e [lldb] Disable Shell/Subporcess with reproducers 2021-04-12 13:08:14 -07:00
Raphael Isemann 34c697c85e [lldb] Don't recursively load types of static member variables in the DWARF AST parser
When LLDB's DWARF parser is parsing the member DIEs of a struct/class it
currently fully resolves the types of static member variables in a class before
adding the respective `VarDecl` to the record.

For record types fully resolving the type will also parse the member DIEs of the
respective class. The other way of resolving is just 'forward' resolving the type
which will try to load only the minimum amount of information about the type
(for records that would only be the name/kind of the type). Usually we always
resolve types on-demand so it's rarely useful to speculatively fully resolve
them on the first use.

This patch changes makes that we only 'forward' resolve the types of static
members. This solves the fact that LLDB unnecessarily loads debug information
to parse the type if it's maybe not needed later and it also avoids a crash where
the parsed type might in turn reference the surrounding class that is currently
being parsed.

The new test case demonstrates the crash that might happen. The crash happens
with the following steps:

1. We parse class `ToLayout` and it's members.

2. We parse the static class member and fully resolve its type
(`DependsOnParam2<ToLayout>`).

3. That type has a non-static class member `DependsOnParam1<ToLayout>` for which
LLDB will try to calculate the size.

4. The layout (and size)`DependsOnParam1<ToLayout>` turns depends on the
`ToLayout` size/layout.

5. Clang will calculate the record layout/size for `ToLayout` even though we are
currently parsing it and it's missing it's non-static member.

The created is missing the offset for the yet unparsed non-static member. If we
later try to get the offset we end up hitting different asserts. Most common is
the one in `TypeSystemClang::DumpValue` where it checks that the record layout
has offsets for the current FieldDecl.

```
        assert(field_idx < record_layout.getFieldCount());
```

Fixed rdar://67910011

Reviewed By: shafik

Differential Revision: https://reviews.llvm.org/D100180
2021-04-12 14:37:07 +02:00
Muhammad Omair Javaid 428b17ce70 [LLDB] Fix buildbots breakage due to TestGuessLanguage.py
Fix LLDB buidbot breakage due to D99250.

Differential Revision: https://reviews.llvm.org/D99250
2021-04-12 15:10:46 +05:00
Alexander Belyaev 39ae25fb8c [lldb] Update object.test after 'nosync' inference was enabled.
https://reviews.llvm.org/D99769
2021-04-09 10:04:15 +02:00
Jonas Devlieghere e761b6b4c5 [lldb] (Temporarily) disable vfork-follow-parent-wp.test on Darwin
The test is failing on GreenDragon. Pinged Michał in D98822.
2021-04-08 15:05:27 -07:00
Michał Górny d01bff8cbd [lldb] [test] Skip clone() tests on Linux/aarch64 2021-04-08 20:03:45 +02:00
Michał Górny a345419ee0 [lldb] [Process] Watch for fork/vfork notifications
Watch for fork(2)/vfork(2) (also fork/vfork-style clone(2) on Linux)
notifications and explicitly detach the forked child process, and add
initial tests for these cases.  The code covers FreeBSD, Linux
and NetBSD process plugins.  There is no new user-visible functionality
provided -- this change lays foundations over subsequent work on fork
support.

Differential Revision: https://reviews.llvm.org/D98822
2021-04-08 18:49:50 +02:00
Pavel Labath 1e511bb1be [lldb] Re-skip TestVSCode_launch
The test is flaky (sleeps didn't help).
2021-04-08 16:31:18 +02:00
Michał Górny b601c67192 [lldb] [client] Support for multiprocess extension
Add a minimal support for the multiprocess extension in gdb-remote
client.  It accepts PIDs as part of thread-ids, and rejects PIDs that
do not match the current inferior.

Differential Revision: https://reviews.llvm.org/D99603
2021-04-08 13:45:07 +02:00
Jason Molenda d9773c1b4e Reorg firmware corefile tests; add test for OS plugin loading
A little cleanup to how these firmware corefile tests are done; add
a test that loads a dSYM that loads an OS plugin, and confirm that
the OS plugin's threads are created.
2021-04-08 01:45:25 -07:00
Shafik Yaghmour 79ac5bbb96 [LLDB] Clarifying the documentation for variable formatting wrt to qualifiers and adding a test that demonstrates this
When looking up user specified formatters qualifiers are removed from types before matching,
I have added a clarifying example to the document and added an example to a relevant test to demonstrate this behavior.

Differential Revision: https://reviews.llvm.org/D99827
2021-04-07 14:29:12 -07:00
Jordan Rupprecht f49a4440d3 [lldb][Editline] Fix crash when navigating through empty command history.
An empty history entry can happen by entering the expression evaluator an immediately hitting enter:

```
$ lldb
(lldb) e
Enter expressions, then terminate with an empty line to evaluate:
  1:  <hit enter>
```

The next time the user enters the expression evaluator, if they hit the up arrow to load the previous expression, lldb crashes. This patch treats empty history sessions as a single expression of zero length, instead of an empty list of expressions.

Fixes http://llvm.org/PR49845.

Differential Revision: https://reviews.llvm.org/D100048
2021-04-07 10:48:47 -07:00
Jonas Devlieghere 710651c61d [lldb] Fix bug where memory read --outfile is not truncating the file
The memory read --outfile command should truncate the output when unless
--append-outfile. Fix the bug and add a test.

rdar://76062318

Differential revision: https://reviews.llvm.org/D99890
2021-04-06 09:16:28 -07:00
Jim Ingham be0ced03ba Revert "Revert "Add support for fetching signed values from tagged pointers.""
This reverts commit 602ab188a7.

The patch replicated an lldbassert for a certain type of NSNumber for tagged
pointers.  This really shouldn't be an assert since we don't do anything wrong
with these numbers, we just don't print a summary.  So this patch changed the
lldbassert to a log message in reverting the revert.
2021-04-05 18:18:26 -07:00
Dave Lee d1a1798e51 [lldb] Replace unneeded use of Foundation with ObjectiveC in tests (NFC)
When referencing `NSObject`, it's enough to import `objc/NSObject.h`. Importing `Foundation` is unnecessary in these cases.

Differential Revision: https://reviews.llvm.org/D99867
2021-04-04 20:04:41 -07:00
Dave Lee 10ed479d73 [lldb] Import ObjectiveC module instead of Foundation in test
Use `@import ObjectiveC` instead of `@import Foundation`, as the former is all
that's needed, and results in fewer clang modules being built.

This results in the following clang modules *not* being built for this test.

ApplicationServices
CFNetwork
ColorSync
CoreFoundation
CoreGraphics
CoreServices
CoreText
DiskArbitration
Dispatch
Foundation
IOKit
ImageIO
Security
XPC
_Builtin_intrinsics
launch
libkern
os_object
os_workgroup

Differential Revision: https://reviews.llvm.org/D99859
2021-04-04 20:04:26 -07:00
Jason Molenda 602ab188a7 Revert "Add support for fetching signed values from tagged pointers."
This reverts commit 4d9039c8dc.

This is causing the greendragon bots to fail most of the time when
running TestNSDictionarySynthetic.py.  Reverting until Jim has a chance
to look at this on Monday.  Running the commands from that test from
the command line, it fails 10-13% of the time on my desktop.

This is a revert of Jim's changes in https://reviews.llvm.org/D99694
2021-04-04 01:47:35 -07:00
Muhammad Omair Javaid d302e33b97 [LLDB] Sleep for 5 second TestVSCode_launch test_progress_events
This increases sleep time to 5 seconds as the test still fails
intermittently. If failure persists then we will disable/fix the
test.
2021-04-03 03:04:37 +05:00
Muhammad Omair Javaid 455973162c [LLDB] Skip TestLoadUsingLazyBind.py on arm/linux 2021-04-02 15:54:48 +05:00
Jason Molenda 78a1412845 Handle all standalone combinations of LC_NOTEs w/ & w/o addr & uuid
Fill out ProcessMachCore::DoLoadCore to handle LC_NOTE hints with
a UUID or with a UUID+address, and load the binary at the specified
offset correctly.  Add tests for all four combinations.  Change
DynamicLoaderStatic to not re-set a Section's load address in the
Target if it's already been specified.

Differential Revision: https://reviews.llvm.org/D99571
rdar://51490545
2021-04-01 18:59:36 -07:00
Greg Clayton 2d733923b8 Fix "image lookup --address" Summary results for inline functions.
Inline callstacks were being incorrectly displayed in the results of "image lookup --address". The deepest frame wasn't displaying the line table line entry, it was always showing the inline information's call file and line on the previous frame. This is now fixed and has tests to make sure it doesn't regress.

Differential Revision: https://reviews.llvm.org/D98761
2021-04-01 11:36:26 -07:00
Jim Ingham 4d9039c8dc Add support for fetching signed values from tagged pointers.
The ObjC runtime offers both signed & unsigned tagged pointer value
accessors to tagged pointer providers, but lldb's tagged pointer
code only implemented the unsigned one.  This patch adds an
emulation of the signed one.

The motivation for doing this is that NSNumbers use the signed
accessor (they are always signed) and we need to follow that in our
summary provider or we will get incorrect values for negative
NSNumbers.

The data-formatter-objc test file had NSNumber examples (along with lots of other
goodies) but the NSNumber values weren't tested.  So I also added
checks for those values to the test.

I also did a quick audit of the other types in that main.m file, and
it looks like pretty much all the other values are either intermediates
or are tested.

Differential Revision: https://reviews.llvm.org/D99694
2021-04-01 10:59:25 -07:00
Stella Stamenova 802c5ce364 [lldb] Un-XFAIL TestAutoInstallMainExecutable on Windows 2021-04-01 08:46:23 -07:00
Pavel Labath bad5ee15ea [lldb] Make TestLoadUsingLazyBind work on linux
and probably other posix oses. Use extra_images to ensure
LD_LIBRARY_PATH is set correctly.

Also take the opportunity to remove hand-rolled library extension
management code in favor of the existing one.
2021-04-01 14:49:42 +02:00
Pavel Labath 48e3da1351 [lldb] Rewrite TestAutoInstallMainExecutable logic
The test uses debug info from one binary to debug a different one. This
does not work on macos, and its pure luck that it works elsewhere (the
variable that it inspects happens to have the same address in both).

The purpose of this test is to verify that lldb has not overwritten the
target executable. That can be more easily achieved by checking the exit
code of the binary, so change the test to do that.

Also remove the llgs_test decorator, as it's preventing the test from
running on macos. All the test needs is the platform functionality of
lldb-server, which is available everywhere.
2021-04-01 14:20:20 +02:00
Michał Górny fcea4181bb [lldb] [test] Mark lldb-server multiprocess tests as LLGS cat 2021-04-01 14:17:47 +02:00
Muhammad Omair Javaid b468f0e165 [LLDB] Fix sync issue in TestVSCode_launch.test_progress_events
This fixes flakiness in TestVSCode_launch.test_progress_events
vscode.progress_events some times failed to populate in time for
follow up iterations.

Adding a minor delay before the the for the loop fixes the issue.

Reviewed By: clayborg

Differential Revision: https://reviews.llvm.org/D99497
2021-04-01 14:16:54 +05:00
Muhammad Omair Javaid dd2a63e1ee Revert "Revert "[LLDB] Arm64/Linux test case for MTE and Pointer Authentication regset""
This reverts commit feb6f2c78f.
2021-04-01 14:10:14 +05:00