Commit Graph

25016 Commits

Author SHA1 Message Date
Jonas Devlieghere c64d1855b9 [lldb] Include arm64 in affected_by_radar_34562999
The same issue impacts arm64, both on-device and on Apple Silicon.
2021-08-17 19:45:45 -07:00
Jonas Devlieghere a452ca471c [lldb] Extend isAArch64 to arm64 and arm64e
This fixes TestMemoryTag on Apple Silicon.
2021-08-17 19:45:45 -07:00
Omar Emara b26e1efc42 [LLDB][GUI] Add Breakpoints window
This patch adds a breakpoints window that lists all breakpoints and
breakpoints locations. The window is implemented as a tree, where the
first level is the breakpoints and the second level is breakpoints
locations.

The tree delegate was hardcoded to only draw when there is a process,
which is not necessary for breakpoints, so the relevant logic was
abstracted in the TreeDelegateShouldDraw method.

Reviewed By: clayborg

Differential Revision: https://reviews.llvm.org/D107386
2021-08-17 17:38:16 -07:00
Omar Emara 79e950a29e [LLDB][GUI] Refactor form drawing using subsurfaces
This patch adds a new method SubSurface to the Surface class. The method
returns another surface that is a subset of this surface. This is
important to further abstract away drawing from the ncurses objects. For
instance, fields could previously be drawn on subpads only but can now
be drawn on any surface. This is needed to create the file search
dialogs and similar functionalities.

There is an opportunity to refactor window drawing in general using
surfaces, but we shall consider this separately later.

Differential Revision: https://reviews.llvm.org/D107761
2021-08-17 16:54:41 -07:00
Shafik Yaghmour 0479afb3d6 [LLDB] Fix off by one logging placeholders in ClangASTSource::layoutRecordType()
D72391 Added some additional information to the logging but in this case instead of using
placeholder 2 and 3 they used 3 and 4.
2021-08-17 16:47:46 -07:00
Jan Kratochvil e21a21a977 [lldb] Fix#2 of DW_AT_ranges DW_FORM_sec_offset not using DW_AT_rnglists_base (used by GCC)
Fix D98289 so that it works even for 2nd..nth compilation unit
(.debug_rnglists).

Reviewed By: dblaikie, ikudrin

Differential Revision: https://reviews.llvm.org/D106466
2021-08-17 22:19:16 +02:00
Raphael Isemann fc5495c351 [lldb] Make TestAArch64AdrpAdd depend on the AArch64 target
LLDB is using LLVM's target-specific disassembler which is only available when
the respective LLVM target has been enabled in the build config.

This patch just skips the test if there is no arm64 target (and its
disassembler) available in the current build config.

Reviewed By: jasonmolenda

Differential Revision: https://reviews.llvm.org/D108145
2021-08-17 13:47:22 +02:00
Fangrui Song 5a95ff2bfc [lldb] Fix -Wunused-but-set-variable 2021-08-16 16:41:17 -07:00
Jason Molenda aa575ed918 Ah, fix formatting, I didn't notice lldb-instr's code
additions were unusually formatted.
2021-08-16 13:46:54 -07:00
Jason Molenda 65bc8ba1a2 Correctly update reproducer hooks for SB API I added
In 9ea6dd5cfa /
https://reviews.llvm.org/D88387 where I added skinny corefile
creation, I added new SB API and tried to manually update the hooks
for the reproducers. I missed a spot, and I should have used
lldb-instr to update the instrumentation automatically.
2021-08-16 13:41:18 -07:00
Raphael Isemann cf521e78df [lldb] Add tests for TypeSystemMap::GetTypeSystemForLanguage
Regression tests for D108088 .

Reviewed By: mib

Differential Revision: https://reviews.llvm.org/D108121
2021-08-16 18:00:01 +02:00
Dimitry Andric 5033f0793f [lldb] Avoid unhandled Error in TypeSystemMap::GetTypeSystemForLanguage
When assertions are turned off, the `llvm::Error` value created at the
start of this function is overwritten using the move-assignment
operator, but the success value is never checked. Whenever a TypeSystem
cannot be found or created, this can lead to lldb core dumping with:

    Program aborted due to an unhandled Error:
    Error value was Success. (Note: Success values must still be checked prior to being destroyed).

Fix this by not creating a `llvm::Error` value in advance, and directly
returning the result of `llvm::make_error` instead, whenever an error is
encountered.

See also: <https://bugs.freebsd.org/253881> and
<https://bugs.freebsd.org/257829>.

Reviewed By: teemperor

Differential Revision: https://reviews.llvm.org/D108088
2021-08-16 17:34:42 +02:00
Manoj Gupta 1f7b25ea76 [lldb] skip host build for lldb_tblgen with LLDB_TABLEGEN_EXE set
When cross compiling lldb-server, do not create a host build
for building lldb-tblgeb when LLDB_TABLEGEN_EXE is already
provided. This avoids an expensive and time-consuming build step
if lldb-tblgen was already built previously for host.

Reviewed By: JDevlieghere

Differential Revision: https://reviews.llvm.org/D108053
2021-08-13 14:18:03 -07:00
Jason Molenda 7150b56208 Symbolicate aarch64 adrp+add pc-relative addr in disass
On aarch64 a two instruction sequence is used to calculate a
pc-relative address, add some state to the DisassemblerLLVMC
symbolicator so it can track the necessary data across the
two instructions and compute the address being calculated.

Differential Revision: https://reviews.llvm.org/D107213
rdar://49119253
2021-08-12 14:44:17 -07:00
Walter Erquinigo ef28c78350 [tests] [trace] Add a more comprehensive test for `thread trace export ctf` command
Follow up on https://reviews.llvm.org/D105741

- Add new test that exhaustively checks the output file's content
- Fix typos in documentation and other minor fixes

Reviewed By: wallace

Original Author: jj10306

Differential Revision: https://reviews.llvm.org/D107674
2021-08-11 20:50:10 -07:00
Jason Molenda 7ce739a878 Update gdbremote_testcase.py to allow new k-v pair in qMemoryRegionInfo 2021-08-11 17:34:52 -07:00
Jason Molenda 2b30fc2ff3 Fix two bugs with stack corefiles patch, restrict test built debugserver
These two tests, TestSkinnyCorefile.py and TestStackCorefile.py,
require a new debugserver on darwin systems to run correctly; for now,
skip them if the system debugserver is in use.  There's no easy way to
test if the debugserver being used supports either of these memory
region info features. For end users, the fallback will be a full
corefile and that's not the worst thing, but for the tests it is a
problem.
2021-08-11 17:19:31 -07:00
Jonas Devlieghere f899445307 [lldb] Fix TestFormattersBoolRefPtr on AS
BOOL is bool instead of signed char on ARM. See
https://reviews.llvm.org/D93421#inline-874116 for details.
2021-08-11 14:55:39 -07:00
Jonas Devlieghere 9f4b130def [lldb] Replace assertTrue(foo in bar) with assertIn(foo, bar)
The benefit of using assertIn is an improved error message when the
assertion fails:

  AssertionError: False is not True

becomes

  AssertionError: 'have ints 5 20 20 5' not found in '""'
2021-08-11 14:40:21 -07:00
Jonas Devlieghere 3f96438c20 [lldb] Skip TestConcurrent.* watchpoint tests for Darwin on ARM
All TestConcurrent.* tests that involve watchpoints are broken on
ARM-based Darwin platforms, including Apple Silicon.

rdar://81811539
2021-08-11 14:26:31 -07:00
Jonas Devlieghere b97afc9dc0 [lldb] Update MemoryRegionInfo ctors in unit tests 2021-08-11 14:13:41 -07:00
Jonas Devlieghere 767496d19c [lldb] Skip TestStepOverWatchpoint on AS
Include macosx in the list of operating systems for which this is broken
on arm64.

rdar://34027183
2021-08-11 13:43:12 -07:00
Jason Molenda 8c31efeed6 Add the ability to process save-core stack-memory-only corefiles
Add a field to the qMemoryRegionInfo packet where the remote stub
can describe the type of memory -- heap, stack.  Keep track of
memory regions that are stack memory in lldb.  Add a new "--style
stack" to process save-core to request that only stack memory be
included in the corefile.

Differential Revision: https://reviews.llvm.org/D107625
2021-08-11 13:37:31 -07:00
Raphael Isemann b2c262cfb1 [lldb][NFC] Define DWARFDIE::children out-of-line instead of using template magic
As pointed out by David in D103172 (thanks!)

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D106743
2021-08-11 19:19:41 +02:00
Med Ismail Bennani be556d5131 [lldb/Commands] Fix heap-use-after-free error in CommandObjectProcess
This patch should fix the use-after-free error that was brought up by
the LLDB ASAN Green Dragon bot.

This is caused because the `StringRef` object was acquired too early
before being use and by the underlying memory was modified which caused
it to point to null memory.

Fetching back the string reference close to its usage location should
fix the issue.

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2021-08-11 17:03:20 +01:00
Raphael Isemann b136290bc4 [lldb][docs] Remove index entry to removed StructuredDataPlugins
This page was removed in b2e25572d2
2021-08-11 13:47:04 +02:00
Raphael Isemann f6748b24d4 [lldb][NFC] Fix small format error in TestCppVirtualFunctions 2021-08-11 12:26:56 +02:00
Raphael Isemann 7377997134 [lldb] Rework 'lldb' substitution workaround in dwarf5-lazy-dwo.c
This test is specifying the lldb log channel via `ll""db` which only really works
because the command parser ends up parsing that as `lldb`. Just putting the
channel name in quotes is enough to avoid the lldb command substitution and
doesn't rely on this weird parser behaviour.
2021-08-11 12:12:25 +02:00
Christopher Di Bella c874dd5362 [llvm][clang][NFC] updates inline licence info
Some files still contained the old University of Illinois Open Source
Licence header. This patch replaces that with the Apache 2 with LLVM
Exception licence.

Differential Revision: https://reviews.llvm.org/D107528
2021-08-11 02:48:53 +00:00
Jan Kratochvil f3932b9a0b [nfc] [lldb] Assertions for D106270 - [DWARF5] Fix offset check when using .debug_names
Skeleton vs. DWO units mismatch has been fixed in D106270. As they both
have type DWARFUnit it is a bit difficult to debug. So it is better to
make it safe against future changes.

Reviewed By: kimanh, clayborg

Differential Revision: https://reviews.llvm.org/D107659
2021-08-10 20:43:24 +02:00
Raphael Isemann 2db8461a94 [lldb][NFC] Fix inversed documentation of Process::GetID/SetID 2021-08-10 16:15:57 +02:00
Raphael Isemann 9900af52f6 [lldb][NFC] Add a FIXME for NameSearchContext::AddFunDecl's missing addDecl 2021-08-10 16:14:27 +02:00
Raphael Isemann 57bf5c8659 [lldb] Add a test for user-defined objc_copyRealizedClassList_nolock
LLDB evaluates some utility expression to update the Objective-C class list that
ends up calling function such as `free` or `objc_copyRealizedClassList_nolock`.
This adds a test that just tries to define our own bogus version of
`objc_copyRealizedClassList_nolock`. It just tests that LLDB doesn't crash as we
currently don't have a way to tell LLDB to look for the function in a specific
library.

Reviewed By: JDevlieghere

Differential Revision: https://reviews.llvm.org/D107778
2021-08-10 14:54:42 +02:00
Raphael Isemann 499489064b [lldb] Add a test for potentially conflicting names for the Objective-C class update utility expression
We recently had an issue where a user declared a `Class::free` function which
then got picked up by accident by the expression evaluator when calling
`::free`. This was due to a too lax filter in the DWARFIndex (which was fixed by
https://reviews.llvm.org/D73191 ). This broke the Objective-C utility expression
that is trying to update the Objective-C class list (which is calling `:;free`).

This adds a regression test for situations where we have a bunch of functions
defined that share the name of the global functions that this utility function
calls. None of them are actually conflicting with the global functions we are
trying to call (they are all in namespaces, objects or classes).

Reviewed By: JDevlieghere

Differential Revision: https://reviews.llvm.org/D107776
2021-08-10 14:42:06 +02:00
Michał Górny 614c7d0387 [lldb] [cmake] Add LLVM_LIT_ARGS override support for standalone builds
Add a LLVM_LIT_ARGS cached variable in order to make it possible
to override lit arguments when doing standalone builds.  Without that,
the user variable is ignored and the default options are always used.

Based on a similar solution found in clang.

Differential Revision: https://reviews.llvm.org/D107700
2021-08-09 23:36:01 +02:00
Michał Górny 15cacab73f [lldb] [test] Skip Expr/nodefaultlib.cpp test if LD_PRELOAD Is used
Some LD_PRELOAD-ed libraries tend to interact badly with --nodefaultlib,
particularly Gentoo sandbox.  Do not run this test if LD_PRELOAD is
present in the running environment.

Differential Revision: https://reviews.llvm.org/D107701
2021-08-09 21:35:11 +02:00
Michał Górny 27b238af16 [lldb] [test] Skip all vFile tests on Windows 2021-08-09 19:38:05 +02:00
Michał Górny 816aa9a5d7 Revert "[lldb] [test] Mark new vFile tests as XFAIL on Windows"
This reverts commit 0dc57a66a0.
2021-08-09 19:38:05 +02:00
Michał Górny 4c830b5f35 Revert "[lldb] [test] Use Windows-friendly modes in vFile O_CREAT tests"
This reverts commit 116b112bbf.
2021-08-09 19:38:05 +02:00
Raphael Isemann 3240000546 [lldb][NFC] Remove never read member variable IOHandler::m_editing
The last read access to this variable was removed in 2015 in
4446487d71 .
2021-08-09 18:05:53 +02:00
Michał Górny 52d89d26aa [lldb] [test] Mark vFile tests as LLGS-specific 2021-08-09 17:43:37 +02:00
Robin Giese 875a16bcfc [lldb] Fix break introduced in 14735ca
The `File::OpenOptions` were renamed; this fixes up a callsite that breaks for
macOS builds. (See
14735cab65)

Differential Revision: https://reviews.llvm.org/D107767
2021-08-09 17:34:57 +02:00
Michał Górny 116b112bbf [lldb] [test] Use Windows-friendly modes in vFile O_CREAT tests 2021-08-09 15:43:08 +02:00
Michał Górny 0dc57a66a0 [lldb] [test] Mark new vFile tests as XFAIL on Windows 2021-08-09 15:43:08 +02:00
Michał Górny d6bf9dcbd5 [lldb] [test] Fix TestGdbRemotePlatformFile with non-022 umask 2021-08-09 14:12:06 +02:00
Kim-Anh Tran 0dda542531 [DWARF5] Fix offset check when using .debug_names
When going through the CU entries in the name index,
make sure to compare the name entry's CU
offset against the skeleton CU's offset.

Previously there would be a mismatch, since the
wrong offset was compared, and thus no suitable
entry was found.

Reviewed By: jankratochvil

Differential Revision: https://reviews.llvm.org/D106270
2021-08-09 13:15:14 +02:00
Michał Górny 9929cfbcd5 [lldb] [gdb-remote] Use hexadecimal numbers in vFile packats for GDB compliance
Use hexadecimal numbers rather than decimal in various vFile packets
in order to fix compatibility with gdbserver.  This also changes the few
custom LLDB packets -- while technically they do not have to be changed,
it is easier to use the same syntax consistently across LLDB.

Differential Revision: https://reviews.llvm.org/D107475
2021-08-09 12:07:33 +02:00
Michał Górny 8bbef4f9af [lldb] [gdb-remote] Sync vFile:open mode constants with GDB
Sync the mode constants used to drive vFile:open requests with these
used by GDB and defined for the gdb remote protocol.  This makes it
possible to use 'platform file open' after connecting to gdbremote
server (and to some degree to operate on the open file modulo other
incompatibilities).

Differential Revision: https://reviews.llvm.org/D106985
2021-08-09 12:07:18 +02:00
Michał Górny 14735cab65 [lldb] [gdb-remote] Add eOpenOptionReadWrite for future gdb compat
Modify OpenOptions enum to open the future path into synchronizing
vFile:open bits with GDB.  Currently, LLDB and GDB use different flag
models effectively making it impossible to match bits.  Notably, LLDB
uses two bits to indicate read and write status, and uses union of both
for read/write.  GDB uses a value of 0 for read-only, 1 for write-only
and 2 for read/write.

In order to future-proof the code for the GDB variant:

1. Add a distinct eOpenOptionReadWrite constant to be used instead
   of (eOpenOptionRead | eOpenOptionWrite) when R/W access is required.

2. Rename eOpenOptionRead and eOpenOptionWrite to eOpenOptionReadOnly
   and eOpenOptionWriteOnly respectively, to make it clear that they
   do not mean to be combined and require update to all call sites.

3. Use the intersection of all three flags when matching against
   the three possible values.

This commit does not change the actual bits used by LLDB.

Differential Revision: https://reviews.llvm.org/D106984
2021-08-09 12:06:59 +02:00
Muhammad Omair Javaid 8813bc02b4 [LLDB] Skip random fails on Arm/AArch64 Linux buildbot
Following tests fail on Arm/AArch64 randomly with timeouts:

TestMultilineNavigation.py
TestBatchMode.py
TestUnicode.py
TestGdbRemote_vContThreads.py

I am marking them as skipped until we find a away make to pass reliably.
2021-08-09 13:53:48 +05:00