Commit Graph

24966 Commits

Author SHA1 Message Date
Jonas Devlieghere 47a889c668 [lldb] Move Objective-C constants into ObjCConstants.h
Move Objective-C constants into ObjCConstants.h and share them between
Cocoa and AppleObjCTypeEncodingParser.

Differential revision: https://reviews.llvm.org/D107679
2021-08-07 16:04:52 -07:00
Jonas Devlieghere 9d5e95d094 Re-land "[lldb] Upstream support for Foundation constant classes"
Upstream support for NSConstantArray, NSConstantIntegerNumber,
NSConstant{Float,Double}Number and NSConstantDictionary.

We would've upstreamed this earlier but testing it requires
-fno-constant-nsnumber-literals, -fno-constant-nsarray-literals and
-fno-constant-nsdictionary-literals which haven't been upstreamed yet.
As a temporary workaround use the system compiler (xcrun clang) for the
constant variant of the tests.

I'm just upstreaming this. The patch and the tests were all authored by
Fred Riss.

Differential revision: https://reviews.llvm.org/D107660
2021-08-06 17:24:47 -07:00
Sterling Augustine 4e5af6ef48 Revert "[lldb] Upstream support for Foundation constant classes"
This reverts commit 34d78b6a67.

This breaks build bots witha  missing file:
/home/worker/2.0.1/lldb-x86_64-debian/llvm-project/lldb/source/Plugins/Language/ObjC/Cocoa.cpp:10:10: fatal error: 'objc/runtime.h' file not found
2021-08-06 16:56:59 -07:00
Jim Ingham bfeb281fbd Use LC_DYLD_EXPORTS_TRIE to locate the dyld trie structure if present
The pointer to the dyld trie data structure which lldb needs to parse to get
"trampoline kinds" on Darwin used to be a field in the LC_DYLD_INFO load command. A
new load command was added recently dedicated to this purpose: LC_DYLD_EXPORTS_TRIE.
The format of the trie did not change, however. So all we have to do is use the new
command if present. The commands are supposed to be mutually exclusive, so I added
an lldb_assert to warn if they are not.

Differential Revision: https://reviews.llvm.org/D107673
2021-08-06 16:38:34 -07:00
Jonas Devlieghere 34d78b6a67 [lldb] Upstream support for Foundation constant classes
Upstream support for NSConstantArray, NSConstantIntegerNumber,
NSConstant{Float,Double}Number and NSConstantDictionary.

We would've upstreamed this earlier but testing it requires
-fno-constant-nsnumber-literals, -fno-constant-nsarray-literals and
-fno-constant-nsdictionary-literals which haven't been upstreamed yet.
As a temporary workaround use the system compiler (xcrun clang) for the
constant variant of the tests.

I'm just upstreaming this. The patch and the tests were all authored by
Fred Riss.

Differential revision: https://reviews.llvm.org/D107660
2021-08-06 16:08:48 -07:00
Jim Ingham f362b05d0d Add a "current" token to the ThreadID option to break set/modify.
This provides a convenient way to limit a breakpoint
to the current thread when setting it from the command line w/o
having to figure out what the current thread is.

Differential Revision: https://reviews.llvm.org/D107015
2021-08-06 15:29:55 -07:00
Fred Riss 9ed7416aaf [lldb] Try harder to find the __NSCFBoolean addresses
It looks like recent CoreFoundation builds strip the non-public symbol
that we were looking for to find the 2 boolean "classes". The public
symbol is of course there, and it contains the address of the private
one. If we don't find the private symbol directly, go through a memory
read at the public symbol's location instead.
2021-08-06 13:04:29 -07:00
Jonas Devlieghere 825a08f898 [lldb] Fix TestFunctionStarts.py on AS
The tests strips the binary which invalidates the code signature. Skip
code signing for this test.
2021-08-06 09:03:01 -07:00
Jason Molenda 4d3d182c1d Revert "[LLDB][GUI] Refactor form drawing using subsurfaces"
Temporarily revert this patch to unbreak the bots/builds
until we can understand what was intended; is_pad() call
isn't defined.

This reverts commit 2b89f40a41.
2021-08-05 19:27:55 -07:00
Omar Emara 2b89f40a41 [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.

Reviewed By: clayborg

Differential Revision: https://reviews.llvm.org/D107182
2021-08-05 16:51:14 -07:00
Nico Weber e71fdc1acf [lldb] Stop referencing "host_lib" in cmake files
It hasn't had an effect since https://reviews.llvm.org/rG7b968969db.

No behavior change.

Differential Revision: https://reviews.llvm.org/D107446
2021-08-05 22:18:37 +02:00
Nico Weber 11565320fd [lldb] Remove a few unused .exports files
They used to be referenced from the .xcodeproj files, but those are long gone.

No behavior change.

Differential Revision: https://reviews.llvm.org/D107444
2021-08-05 22:17:00 +02:00
Jonas Devlieghere a46bcc60e5 [lldb] Refactor IRExecutionUnit::FindInSymbols (NFC)
This patch refactors IRExecutionUnit::FindInSymbols. It eliminates a few
potential pitfalls and tries to be more explicit about the state carried
between symbol resolution attempts.

Differential revision: https://reviews.llvm.org/D107206
2021-08-05 10:18:14 -07:00
Jonas Devlieghere c020be17ce [lldb] Use a struct to pass function search options to Module::FindFunction
Rather than passing two booleans around, which is especially error prone
with them being next to each other, use a struct with named fields
instead.

Differential revision: https://reviews.llvm.org/D107295
2021-08-05 10:18:14 -07:00
Neal Sidhwaney 55fd6f292f Revert "D106035: Remove conditional compilation for WCHAR support in libedit"
This reverts commit 7529f0e3e1.
2021-08-05 02:55:10 -07:00
Neal Sidhwaney 7529f0e3e1 D106035: Remove conditional compilation for WCHAR support in libedit
This change moves to using narrow character types and libedit APIs in
Editline, because those are the same types that the rest of LLVM/LLDB
uses, and it's generally considered better practice to use UTF-8
encoded in char than it is to use wider characters. However, for
character input, the change leaves in using a wchar to enable input of
multi-byte characters.

Differential Revision: https://reviews.llvm.org/D106035
2021-08-05 00:29:54 -07:00
Jan Kratochvil 14f443030c [nfc] [lldb] Prevent needless copies of DataExtractor
lldb_private::DataExtractor contains DataBufferSP m_data_sp which is
relatively expensive to copy (due to multi-threading locking).

llvm::DataExtractor does not have this problem as it uses StringRef
instead.

The copy constructor is explicit as otherwise it is easy to make
unintended modification of a local copy instead of a caller's instance
(D107470 but that is llvm::DataExtractor).

Reviewed By: clayborg

Differential Revision: https://reviews.llvm.org/D107485
2021-08-04 20:35:53 +02:00
Muhammad Omair Javaid f2128abec2 [LLDB] Skip flaky tests on Arm/AArch64 Linux bots
Following LLDB tests fail randomly on LLDB Arm/AArch64 Linux buildbots.
We still not have a reliable solution for these tests to pass
consistently. I am marking them skipped for now.

TestBreakpointCallbackCommandSource.py
TestIOHandlerResize.py
TestEditline.py
TestGuiViewLarge.py
TestGuiExpandThreadsTree.py
TestGuiBreakpoints.py
2021-08-04 16:57:36 +05:00
Jaroslav Sevcik f968bd77bb Reland "[lldb/DWARF] Only match mangled name in full-name function lookup (with accelerators)"
Summary:

In the spirit of https://reviews.llvm.org/D70846, we only return functions with
matching mangled name from Apple/DebugNamesDWARFIndex::GetFunction if
eFunctionNameTypeFull is requested.

This speeds up lookup in the presence of large amount of class methods of the
same name (a typical examples would be constructors of templates with many
instantiations or overloaded operators).

Reviewers: labath, teemperor

Reviewed By: labath, teemperor

Subscribers: aprantl, arphaman, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D73191
2021-08-04 12:50:13 +02:00
Kim-Anh Tran 0092dbcd80 [lldb] Fix lookup of .debug_loclists with split-dwarf
This patch fixes the lookup of locations in
.debug_loclists, if they are split in a .dwp file.

Mainly, we need to consider the cu index offsets.

Reviewed By: jankratochvil

Differential Revision: https://reviews.llvm.org/D107161
2021-08-04 11:36:44 +02:00
Raphael Isemann e4977f9cb5 [lldb] Partly revert "Allow range-based for loops over DWARFDIE's children"
As pointed out in D107434 by Walter, D103172 also changed two for loops that
were actually not just iterating over some DIEs but also using the iteration
variable later on for some other things. This patch reverts the respective
faulty parts of D103172.
2021-08-04 11:05:08 +02:00
Jeffrey Tan b9139acb85 Fix expression evaluation result expansion in lldb-vscode
VScode now sends a "scopes" DAP request immediately after any expression evaluation.
This scopes request would clear and invalidate any non-scoped expandable variables in g_vsc.variables, causing later "variables" request to return empty result.
The symptom is that any expandable variables in VScode watch window/debug console UI to return empty content.

This diff fixes this issue by only clearing the expandable variables at process continue time. To achieve this, we have to repopulate all scoped variables
during context switch for each "scopes" request without clearing global expandable variables.
So the PR puts the scoped variables into its own locals/globals/registers; and all expandable variables into separate "expandableVariables" list.
Also, instead of using the variable index for "variableReference", it generates a new variableReference id each time as the key of "expandableVariables".

As a further new feature, this PR adds a new "expandablePermanentVariables" which has the lifetime of debug session. Any expandable variables from debug console
are added into this list. This enables users to snapshot expanable old variable in debug console and compare with new variables if desire.

Reviewed By: clayborg

Differential Revision: https://reviews.llvm.org/D105166
2021-08-03 15:24:44 -07:00
Nico Weber bf3383501f [lldb] Get rid of HAVE_SYS_TYPES_H
LLVM includes this header unconditionally on all platforms
(including Windows), so this define should no longer be necessary.

No behavior change.

Differential Revision: https://reviews.llvm.org/D107338
2021-08-03 22:14:56 +02:00
Nico Weber 4367cbab4c [lldb] Move comment about noindex next to line it refers to
The comment was originally added in 34769d80d. Then D44526
removed the flag added there (but kept the comment), and then
D66966 reintroduced a .noindex dir (which D68606 and then 33fca97880
moved around a bit).

No behavior change.

Differential Revision: https://reviews.llvm.org/D107341
2021-08-03 22:14:12 +02:00
Alex Langford d2b2ab4e1c [lldb] Further constrain a test that fails without python enabled
The test relies on the python embedded interpreter being available and
fails otherwise.
2021-08-03 11:50:36 -07:00
Eric Leese 437e37dd55 [nfc] [lldb] Support moving support files instead of copy
Split from D100299.

Reviewed By: jankratochvil

Differential Revision: https://reviews.llvm.org/D107165
2021-08-02 21:43:34 +02:00
Eric Leese ea9706626c [test] [lldb] Use filename instead of index in test
In some environments this test could fail if start.S has its own DWARF
CompileUnit or similar are included before the DWARF CompileUnit for the
file.

This change makes the test independent of the index of the compile unit,
instead checking the filename.

Reviewed By: herhut, jankratochvil

Differential Revision: https://reviews.llvm.org/D107300
2021-08-02 21:12:57 +02:00
Nico Weber 82dc463bb3 [lldb] Get rid of HAVE_SIGACTION
The .cpp file uses SIGNAL_POLLING_UNSUPPORTED to guard the call
to sigaction, so use it in the .h file too. (LLVM also calls
sigaction without a guard on non-Windows.)

No behavior change.

Differential Revision: https://reviews.llvm.org/D107255
2021-08-02 20:11:35 +02:00
Muhammad Omair Javaid 97c6ef4ea6 [LLDB] Change pexpect timeout to 30 to 60
Test dependent on pexpect fail randomly with timeouts on Arm/AArch64 Linux
buildbots. I am setting pexpect timeout from 30 to 60.

I will revert this back if this doesnt improve random failures.
2021-08-02 06:34:11 +05:00
Muhammad Omair Javaid a94fbb25de Revert "Revert "[LLDB][GUI] Expand selected thread tree item by default""
This reverts commit fd18f0e84c.

I reverted this change to see its effect on failing GUI tests on LLDB
Arm/AArch64 Linux buildbots. I could not find any evidence against this
particular change so reverting it back.

Differential Revision: https://reviews.llvm.org/D100243
2021-08-02 05:29:32 +05:00
Muhammad Omair Javaid 8f30db8794 [LLDB] Skip random failing tests on Arm/AArch64 Linux bots
Following tests have been failing randomly on LLDB Arm and AArch64 Linux
builtbots:

TestMultilineNavigation.py
TestMultilineCompletion.py
TestIOHandlerCompletion.py
TestGuiBasic.py

I have increased allocated CPU resources to these bots but it has not
improved situation to an acceptable level. This patch marks them as
skipped on Arm/AArch64 for now.
2021-08-02 05:24:05 +05:00
Dave Lee 41d0b20cc9 [lldb] Avoid moving ThreadPlanSP from plans vector
Change `ThreadPlanStack::PopPlan` and `::DiscardPlan` to not do the following:

1. Move the last plan, leaving a moved `ThreadPlanSP` in the plans vector
2. Operate on the last plan
3. Pop the last plan off the plans vector

This leaves a period of time where the last element in the plans vector has been moved. I am not sure what, if any, guarantees there are when doing this, but it seems like it would/could leave a null `ThreadPlanSP` in the container. There are asserts in place to prevent empty/null `ThreadPlanSP` instances from being pushed on to the stack, and so this could break that invariant during multithreaded access to the thread plan stack.

An open question is whether this use of `std::move` was the result of a measure performance problem.

Differential Revision: https://reviews.llvm.org/D106171
2021-08-01 10:40:04 -07:00
Jan Kratochvil 6ef6616e07 [nfc] [lldb] Removed unused DWARFDebugInfo::GetDIEForDIEOffset
Its last use was removed by D63428.
2021-08-01 00:38:01 +02:00
Eric Leese fb09f365ae [lldb] [DWARF-5] Be lazier about loading .dwo files
This change makes sure that DwarfUnit does not load a .dwo file until
necessary. I also take advantage of DWARF 5's guarantee that the first
support file is also the primary file to make it possible to create
a compile unit without loading the .dwo file.

Testcases now require Linux as it is needed for -gsplit-dwarf.

Review By: jankratochvil, dblaikie

Differential Revision: https://reviews.llvm.org/D100299
2021-07-31 10:45:31 +02:00
Stella Stamenova dfb6f7b015 Revert "[lldb] [DWARF-5] Be lazier about loading .dwo files"
This reverts commit 8dfd6cae9b.

This change broke the windows lldb bot:
https://lab.llvm.org/buildbot/#/builders/83/builds/8842
2021-07-30 18:33:13 -07:00
Eric Leese 8dfd6cae9b [lldb] [DWARF-5] Be lazier about loading .dwo files
This change makes sure that DwarfUnit does not load a .dwo file until
necessary. I also take advantage of DWARF 5's guarantee that the first
support file is also the primary file to make it possible to create
a compile unit without loading the .dwo file.

Review By: jankratochvil, dblaikie

Differential Revision: https://reviews.llvm.org/D100299
2021-07-30 23:17:06 +02:00
Jonas Devlieghere 7ad854c41e [lldb] Fix remote macOS debugging on Apple Silicon
Update ARMGetSupportedArchitectureAtIndex to consider remote macOS
debugging. Currently, it defaults to an iOS triple when IsHost() returns
false. This fixes TestPlatformSDK.py on Apple Silicon.

Differential revision: https://reviews.llvm.org/D107179
2021-07-30 13:14:10 -07:00
Jonas Devlieghere fe23f0c73a [lldb] Always codesign binaries on macOS
Always codesign binaries on macOS. Apple Silicon has stricter
codesigning requirements, for example requiring macCatalyst binaries to
be signed. Ad-hoc sign everything like we do for other Darwin platforms.
2021-07-30 11:19:40 -07:00
Walter Erquinigo c9308cc219 [nfc] improve a simple call
@jingham correctly pointed out that this call can be simplified. So
let's better do it.
2021-07-30 10:55:48 -07:00
Jan Kratochvil d0e6d946b6 Revert "[lldb] [DWARF-5] Be lazier about loading .dwo files"
This reverts commit e7b8ba103a.

It broke 32-bit ARM - lldb-arm-ubuntu, reported by omjavaid:
  https://lab.llvm.org/buildbot/#/builders/17/builds/9595
2021-07-30 14:54:27 +02:00
Eric Leese e7b8ba103a [lldb] [DWARF-5] Be lazier about loading .dwo files
This change makes sure that DwarfUnit does not load a .dwo file until
necessary. I also take advantage of DWARF 5's guarantee that the first
support file is also the primary file to make it possible to create
a compile unit without loading the .dwo file.

Review By: jankratochvil, dblaikie

Differential Revision: https://reviews.llvm.org/D100299
2021-07-30 13:34:51 +02:00
David Spickett 98b5659b53 [lldb][AArch64] Mark mismatched tags in tag read output
The "memory tag read" command will now tell you
when the allocation tag read does not match the logical
tag.

(lldb) memory tag read mte_buf+(8*16) mte_buf+(8*16)+48
Logical tag: 0x9
Allocation tags:
[0xfffff7ff7080, 0xfffff7ff7090): 0x8 (mismatch)
[0xfffff7ff7090, 0xfffff7ff70a0): 0x9
[0xfffff7ff70a0, 0xfffff7ff70b0): 0xa (mismatch)

The logical tag will be taken from the start address
so the end could have a different tag. You could for example
read from ptr_to_array_1 to ptr_to_array_2. Where the latter
is tagged differently to prevent buffer overflow.

The existing command will read 1 granule if you leave
off the end address. So you can also use it as a quick way
to check a single location.

(lldb) memory tag read mte_buf
Logical tag: 0x9
Allocation tags:
[0xfffff7ff7000, 0xfffff7ff7010): 0x0 (mismatch)

This avoids the need for a seperate "memory tag check" command.

Reviewed By: omjavaid

Differential Revision: https://reviews.llvm.org/D106880
2021-07-30 11:47:58 +01:00
David Spickett 555cd03193 [lldb] Correct format of qMemTags type field
The type field is a signed integer.
(https://sourceware.org/gdb/current/onlinedocs/gdb/General-Query-Packets.html)

However it's not packed in the packet in the way
you might think. For example the type -1 should be:
qMemTags:<addr>,<len>:ffffffff
Instead of:
qMemTags:<addr>,<len>:-1

This change makes lldb-server's parsing more strict
and adds more tests to check that we handle negative types
correctly in lldb and lldb-server.

We only support one tag type value at this point,
for AArch64 MTE, which is positive. So this doesn't change
any of those interactions. It just brings us in line with GDB.

Also check that the test target has MTE. Previously
we just checked that we were AArch64 with a toolchain
that supports MTE.

Finally, update the tag type check for QMemTags to use
the same conversion steps that qMemTags now does.
Using static_cast can invoke UB and though we do do a limit
check to avoid this, I think it's clearer with the new method.

Reviewed By: omjavaid

Differential Revision: https://reviews.llvm.org/D104914
2021-07-30 11:06:57 +01:00
Muhammad Omair Javaid fd18f0e84c Revert "[LLDB][GUI] Expand selected thread tree item by default"
This reverts commit fed25ddc1c.

There has been sporadic failures in LLDB AArch64/Arm 32 buildbots since
this commit. I am temporarily reverting it see if it fixes the issue.

Differential Revision: https://reviews.llvm.org/D100243
2021-07-30 13:40:05 +05:00
Anastasia Stulova 577220e898 [OpenCL] Add std flag aliases clc++1.0 and CLC++1.0
Renamed language standard from openclcpp to openclcpp10.
Added new std values i.e. '-cl-std=clc++1.0' and
'-cl-std=CLC++1.0'.

Patch by Topotuna (Justas Janickas)!

Differential Revision: https://reviews.llvm.org/D106266
2021-07-30 09:19:26 +01:00
Walter Erquinigo 5839976976 [nfc][trace] use formatv instead of the old Printf
It was suggested in https://reviews.llvm.org/D105741 and it makes sense.
2021-07-29 19:04:59 -07:00
Walter Erquinigo 0a68443bd0 [source map] fix relative path breakpoints
https://reviews.llvm.org/D45592 added a nice feature to be able to specify a breakpoint by a relative path. E.g. passing foo.cpp or bar/foo.cpp or zaz/bar/foo.cpp is fine. However, https://reviews.llvm.org/D68671 by mistake disabled the test that ensured this functionality works. With time, someone made a small mistake and fully broke the functionality.

So, I'm making a very simple fix and the test passes.

Differential Revision: https://reviews.llvm.org/D107126
2021-07-29 18:36:06 -07:00
Adrian Prantl 648844fd69 Make testcase more robust against codegen changes 2021-07-29 16:23:13 -07:00
Adrian Prantl 0fd813cf19 Fix typo 2021-07-29 16:23:13 -07:00
Adrian Prantl 26ba774f68 Simplify testcase to use v instead of p (NFC) 2021-07-29 15:15:00 -07:00