Commit Graph

25531 Commits

Author SHA1 Message Date
Med Ismail Bennani 8dbbe3356b Revert "[lldb] [Host/ConnectionFileDescriptor] Refactor to improve code reuse"
This reverts commit e1acadb61d.
2021-10-27 23:57:33 +02:00
Jonas Devlieghere 8bac9e3686 [lldb] Fixup code addresses in the Objective-C language runtime
Upstream the calls to ABI::FixCodeAddress in the Objective-C language
runtime.

Differential revision: https://reviews.llvm.org/D112662
2021-10-27 14:48:03 -07:00
Danil Stefaniuc 3eb9e6536a [formatters] Add a libstdcpp formatter for set and unify tests across stdlibs
This diff adds a data formatter for libstdcpp's set. Besides, it unifies the tests for set for libcxx and libstdcpp for maintainability.

Reviewed By: wallace

Differential Revision: https://reviews.llvm.org/D112537
2021-10-27 11:55:11 -07:00
Raphael Isemann 9d7006c4ae [lldb][NFC] Move a declaration in DWARFASTParserClang to its first use. 2021-10-27 17:46:50 +02:00
Nico Weber 99f5f0a2b7 fix comment typos to cycle bots 2021-10-27 09:43:42 -04:00
Michał Górny d03b04f211 [lldb] [docs] Remove obsolete recommonmark use
The recommonmark package is no longer required since all the documents
have been converted to .rst.  Remove the related support code from
docs/conf.py.

Differential Revision: https://reviews.llvm.org/D112612
2021-10-27 13:45:05 +02:00
Pavel Labath 560221ac7f [lldb] Modernize TestVLA.py
Use expect_expr/var_path instead of regular expect and substring checks
2021-10-27 12:47:56 +02:00
Michał Górny e1acadb61d [lldb] [Host/ConnectionFileDescriptor] Refactor to improve code reuse
Refactor ConnectionFileDescriptor to improve code reuse for different
types of sockets.  Unify method naming.

While at it, remove some (now-)dead code from Socket.

Differential Revision: https://reviews.llvm.org/D112495
2021-10-27 12:45:52 +02:00
Pavel Labath f5158ca48c Modernize Platform::GetOSKernelDescription 2021-10-27 10:46:47 +02:00
Pavel Labath 49481b5380 Remove ConstString from Language, LanguageRuntime, SystemRuntime and SymbolFile plugin names 2021-10-27 08:25:44 +02:00
Greg Clayton 2887d9fd86 Add new key/value pairs to the module statistics for "statistics dump".
The new key/value pairs that are added to each module's stats are:
"debugInfoByteSize": The size in bytes of debug info for each module.
"debugInfoIndexTime": The time in seconds that it took to index the debug info.
"debugInfoParseTime": The time in seconds that debug info had to be parsed.

At the top level we add up all of the debug info size, parse time and index time with the following keys:
"totalDebugInfoByteSize": The size in bytes of all debug info in all modules.
"totalDebugInfoIndexTime": The time in seconds that it took to index all debug info if it was indexed for all modules.
"totalDebugInfoParseTime": The time in seconds that debug info was parsed for all modules.

Differential Revision: https://reviews.llvm.org/D112501
2021-10-26 15:09:31 -07:00
Danil Stefaniuc 566bfbb740 [formatters] Add a libstdcpp formatter for bitset and unify tests across stdlibs
This diff adds a data formatter for libstdcpp's bitset. Besides, it unifies the tests for bitset for libcxx and libstdcpp for maintainability.

Reviewed By: wallace

Differential Revision: https://reviews.llvm.org/D112180
2021-10-26 14:49:50 -07:00
Michał Górny 801cf36a23 [lldb] [unittests] Fix TcpListen() call in RNBSocketTest 2021-10-26 21:08:03 +02:00
Michał Górny 4373f3595f [lldb] [Host] Move port predicate-related logic to gdb-remote
Remove the port predicate from Socket and ConnectionFileDescriptor,
and move it to gdb-remote.  It is specifically relevant to the threading
used inside gdb-remote and with the new port callback API, we can
reliably move it there.  While at it, switch from the custom Predicate
to std::promise/std::future.

Differential Revision: https://reviews.llvm.org/D112357
2021-10-26 13:53:08 +02:00
Michał Górny 58d28b931f [lldb] [lldb-gdbserver] Unify listen/connect code to use ConnectionFileDescriptor
Unify the listen and connect code inside lldb-server to use
ConnectionFileDescriptor uniformly rather than a mix of it and Acceptor.
This involves:

- adding a function to map legacy values of host:port parameter
  (including legacy server URLs) into CFD-style URLs

- adding a callback to return "local socket id" (i.e. UNIX socket path
  or TCP port number) between listen() and accept() calls in CFD

- adding a "unix-abstract-accept" scheme to CFD

As an additional advantage, this permits lldb-server to accept any URL
known to CFD including the new serial:// scheme.  Effectively,
lldb-server can now listen on the serial port.  Tests for connecting
over a pty are added to test that.

Differential Revision: https://reviews.llvm.org/D111964
2021-10-26 13:06:19 +02:00
Pavel Labath 93c7ed8c3f [lldb] Fix PlatformAppleSimulator for a458ef4f 2021-10-26 13:03:47 +02:00
Michał Górny f279e50fd0 [lldb] [Communication] Add a WriteAll() method that resumes writing
Add a Communication::WriteAll() that resumes Write() if the initial call
did not write all data.  Use it in GDBRemoteCommunication when sending
packets in order to fix handling partial writes (i.e. just resume/retry
them rather than erring out).  This fixes LLDB failures when writing
large packets to a pty.

Differential Revision: https://reviews.llvm.org/D112169
2021-10-26 12:45:45 +02:00
Pavel Labath 0a39a9c2cb Modernize and simplify HostInfo::GetOSKernelDescription
Replace bool+by-ref argument with llvm::Optional, and move the common
implementation into HostInfoPOSIX. Based on my (simple) experiment,
the uname and the sysctl approach return the same value on MacOS, so
there's no need for a mac-specific implementation of this functionality.

Differential Revision: https://reviews.llvm.org/D112457
2021-10-26 11:17:02 +02:00
Pavel Labath a458ef4f73 [lldb] Remove ConstString from Platform plugin names 2021-10-26 10:04:35 +02:00
Pavel Labath b69564d94d [lldb/DWARF] Move a declaration closer to its use
Adresses post-commit feedback on D112310.
2021-10-26 09:58:10 +02:00
Muhammad Omair Javaid 4c8ea90b25 [LLDB] Fix LLDB buildbots break due to --image-base
LLDB build were failing due to following two test failures:
lldb-shell :: ObjectFile/ELF/basic-info.yaml
lldb-shell :: SymbolFile/DWARF/x86/debug-types-address-ranges.s

There were caused by commit 6506907a0a
2021-10-26 12:07:16 +05:00
Jonas Devlieghere b1bb1d4c46 [lldb] Skip tests for target var without a proc on both arm64 & arm64e
LLDB needs to be taught about chained fixups.

<rdar://problem/37773624>
2021-10-25 20:45:38 -07:00
Dave Lee 65dae8b2f2 [lldb] Configure CMake policy CMP0116 for standalone builds
Using CMake >=3.20 results in many warnings about this new policy. This change silences the warnings by explicitly declaring use of the "OLD" behavior.

This applies D101083 to LLDBStandalone.cmake.

Differential Revision: https://reviews.llvm.org/D112497
2021-10-25 16:29:36 -07:00
Greg Clayton c571988e9d Add modules stats into the "statistics dump" command.
The new module stats adds the ability to measure the time it takes to parse and index the symbol tables for each module, and reports modules statistics in the output of "statistics dump" along with the path, UUID and triple of the module. The time it takes to parse and index the symbol tables are also aggregated into new top level key/value pairs at the target level.

Differential Revision: https://reviews.llvm.org/D112279
2021-10-25 11:50:02 -07:00
Michał Górny 1bd258fd4e [lldb] [DynamicRegisterInfo] Remove AddRegister() and make Finalize() protected
Now that AddRegister() is no longer used, remove it.  While at it,
we can also make Finalize() protected as all supported API methods
call it internally.

Differential Revision: https://reviews.llvm.org/D111498
2021-10-25 20:05:30 +02:00
Michał Górny 26c584f4f1 [lldb] [gdb-remote] Remove HardcodeARMRegisters() hack
HardcodeARMRegisters() is a hack that was supposed to be used "until
we can get an updated debugserver down on the devices".  Since it was
introduced back in 2012, there is a good chance that the debugserver
has been updated at least once since then.  Removing this code makes
transition to the new DynamicRegisterInfo API easier.

Differential Revision: https://reviews.llvm.org/D111491
2021-10-25 20:05:29 +02:00
Raphael Isemann 974c2f5e22 [lldb] Modernize and expand TestCppBitfields
* clang-format test source.
* Removed the dead setup code.
* Using expect_expr etc. instead of raw expect.
* Slightly expanded with tests for vtable pointers (which mostly just crash atm.)
* Removed some other minor test guideline problems.
2021-10-25 18:19:26 +02:00
Pavel Labath a53978c95c [lldb] Remove a trailing \0 from the result of HostInfoMacOSX::GetOSBuildString
This has been in there since forever, but only started to matter once
40e4ac3e changed how we print the string.
2021-10-25 17:33:06 +02:00
Michał Górny 9d63b90b59 [lldb] [Host/ConnectionFileDescriptor] Do not use non-blocking mode
Disable non-blocking mode that's enabled only for file:// and serial://
protocols.  All read operations should be going through the select(2)
in ConnectionFileDescriptor::BytesAvaliable, which effectively erases
(non-)blocking mode differences in reading.  We do want to perform
writes in the blocking mode.

Differential Revision: https://reviews.llvm.org/D112442
2021-10-25 16:24:00 +02:00
Pavel Labath 40e4ac3e5b [lldb] Modernize Platform::GetOSBuildString 2021-10-25 15:58:58 +02:00
Raphael Isemann 025f6ca7c4 [lldb] Modernize TestBitfields
This just does the usual modernizations such as using new test functions where
possible, clang-formatting the source, avoiding manual process setup,
assert improvements (` assertTrue(a == b) -> assertEqual(a, b)`).

This doesn't add any new test cases but removes some dependence on unrelated
features where possible (e.g., structs declared in functions, using the standard
library to printf stuff or initialize objects).
2021-10-25 13:11:39 +02:00
Raphael Isemann a24b2b6aa0 [lldb] Also print index of child when ValueCheck fails
Makes the test failure reason more obvious in cases where we have unnamed fields
or large records.
2021-10-25 13:03:56 +02:00
Raphael Isemann 309fccdac9 [lldb][NFC] Use llvm::Optional to refer to Optional
clang::Optional is just an alias used within Clang.
2021-10-25 11:37:15 +02:00
Pavel Labath 1397c56d7a Fix windows build for 6fa1b4ff4 2021-10-25 11:12:39 +02:00
Michał Górny 0e5a4147e5 [lldb] [Utility/UriParser] Return results as 'struct URI'
Return results of URI parsing as 'struct URI' instead of assigning them
via output parameters.

Differential Revision: https://reviews.llvm.org/D112314
2021-10-25 10:58:21 +02:00
Michał Górny 21bb808eb4 [lldb] Support serial port parity checking
Differential Revision: https://reviews.llvm.org/D112365
2021-10-25 10:51:46 +02:00
Pavel Labath 6fa1b4ff4b Remove ConstString from DynamicLoader, JITLoader and Instruction plugin names 2021-10-25 10:32:35 +02:00
Pavel Labath c1055f0919 [lldb/DWARF] Don't create lldb_private::Functions for gc'ed DW_TAG_subprograms
Front-load the first_valid_code_address check, so that we avoid creating
the function object (instead of simply refusing to use it in queries).

Differential Revision: https://reviews.llvm.org/D112310
2021-10-25 10:32:35 +02:00
Kazu Hirata 4bd46501c3 Use llvm::any_of and llvm::none_of (NFC) 2021-10-24 17:35:33 -07:00
Kazu Hirata 7cc8fa2dd2 Use llvm::is_contained (NFC) 2021-10-24 09:32:57 -07:00
Kazu Hirata 4ba9d9c84f Use StringRef::contains (NFC) 2021-10-23 20:41:46 -07:00
Kazu Hirata d8e4170b0a Ensure newlines at the end of files (NFC) 2021-10-23 08:45:29 -07:00
Martin Storsjö ea9e9d61b5 [lldb] [Host/SerialPort] Fix build with GCC 7 2021-10-23 12:52:55 +03:00
Michał Górny ff56d80eaa [lldb] [Host/FreeBSD] Remove unused variable (NFC) 2021-10-23 11:38:35 +02:00
Jason Molenda e4235bdf26 Fix locals naming in DNBArchMachARM64::GetGPRState for 32-bit builds
The local variables names used for logging when built on armv7k
weren't unique, resulting in build error.

rdar://84274006
2021-10-22 13:24:25 -07:00
Med Ismail Bennani 42e4959253 [lldb/Formatters] Remove space from vector type string summaries (NFCI)
This patch changes the string summaries for vector types by removing the
space between the type and the bracket, conforming to 277623f4d5.

This should also fix TestCompactVectors failure.

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2021-10-22 21:18:54 +02:00
Jonas Devlieghere 0f12cf7eba [lldb] Pass the target triple when determining the DWARF version
When targeting iOS, the default dwarf version is 2 and not 4. Currently,
the test suite does not pick up on that because it invokes the test
compiler without a target triple. This patch fixes that and now
correctly skips tests that have a dwarf version specified in a skipIf
decorator.

rdar://84530477

Differential revision: https://reviews.llvm.org/D112325
2021-10-22 10:13:24 -07:00
Pavel Labath f37463b2ee [lldb] Another build fix for 8b8070e23
This particular usage was guarded by !__linux__, so it broke everywhere
else. It should probably be replaced by something else.
2021-10-22 15:29:38 +02:00
Michał Górny ff569ed030 [lldb] [Utility/UriParser] Replace port==-1 with llvm::None
Use llvm::Optional<uint16_t> instead of int for port number
in UriParser::Parse(), and use llvm::None to indicate missing port
instead of a magic value of -1.

Differential Revision: https://reviews.llvm.org/D112309
2021-10-22 14:39:18 +02:00
Pavel Labath 43f8845dd3 [lldb] Fix build errors from 8b8070e23
I missed windows and openbsd.
2021-10-22 14:28:52 +02:00
Pavel Labath 8b8070e234 Host::GetOSBuildString 2021-10-22 12:59:58 +02:00
Michał Górny 66e06cc8cb [llvm] [ADT] Update llvm::Split() per Pavel Labath's suggestions
Optimize the iterator comparison logic to compare Current.data()
pointers.  Use std::tie for assignments from std::pair.  Replace
the custom class with a function returning iterator_range.

Differential Revision: https://reviews.llvm.org/D110535
2021-10-22 12:27:46 +02:00
Pavel Labath b5e9f83ea4 [lldb] Remove ConstString from ABI, Architecture and Disassembler plugin names 2021-10-22 10:29:19 +02:00
Raphael Isemann 71cfce8320 [lldb] Fix TestCompressedVectors after array type name change
aee4925507 turns array names such as `int [1]`
into `int[1]` (without the space). This probably breaks some user formatters,
but let's first get this test running while this is being discussed.
2021-10-22 10:15:53 +02:00
Jonas Devlieghere 08f4b56fb9 [lldb] Include unistd.h for sleep in profile_vrs_detach 2021-10-21 17:32:15 -07:00
Jonas Devlieghere 09b95b9dc9 [lldb] Always set the minimum OS version in the Darwin builder 2021-10-21 17:03:06 -07:00
Greg Clayton 910838f07d Fix buildbots after https://reviews.llvm.org/D111686 2021-10-21 14:21:36 -07:00
David Blaikie 64f002c6d3 Follow-up fixes for aee4925507 2021-10-21 13:00:56 -07:00
Greg Clayton d7b338537c Modify "statistics dump" to dump JSON.
This patch is a smaller version of a previous patch https://reviews.llvm.org/D110804.

This patch modifies the output of "statistics dump" to be able to get stats from the current target. It adds 3 new stats as well. The output of "statistics dump" is now emitted as JSON so that it can be used to track performance and statistics and the output could be used to populate a database that tracks performance. Sample output looks like:

(lldb) statistics dump
{
  "expressionEvaluation": {
    "failures": 0,
    "successes": 0
  },
  "firstStopTime": 0.34164492800000001,
  "frameVariable": {
    "failures": 0,
    "successes": 0
  },
  "launchOrAttachTime": 0.31969605400000001,
  "targetCreateTime": 0.0040863039999999998
}

The top level keys are:

"expressionEvaluation" which replaces the previous stats that were emitted as plain text. This dictionary contains the success and fail counts.
"frameVariable" which replaces the previous stats for "frame variable" that were emitted as plain text. This dictionary contains the success and fail counts.
"targetCreateTime" contains the number of seconds it took to create the target and load dependent libraries (if they were enabled) and also will contain symbol preloading times if that setting is enabled.
"launchOrAttachTime" is the time it takes from when the launch/attach is initiated to when the first private stop occurs.
"firstStopTime" is the time in seconds that it takes to stop at the first stop that is presented to the user via the LLDB interface. This value will only have meaning if you set a known breakpoint or stop location in your code that you want to measure as a performance test.

This diff is also meant as a place to discuess what we want out of the "statistics dump" command before adding more funcionality. It is also meant to clean up the previous code that was storting statistics in a vector of numbers within the lldb_private::Target class.

Differential Revision: https://reviews.llvm.org/D111686
2021-10-21 12:14:21 -07:00
David Blaikie d723ad5bcf Enable libc++ in the build for libcxx initializerlist pretty printers
Differential Revision: https://reviews.llvm.org/D112163
2021-10-21 11:35:59 -07:00
David Blaikie aee4925507 Recommit: Compress formatting of array type names (int [4] -> int[4])
Based on post-commit review discussion on
2bd8493847 with Richard Smith.

Other uses of forcing HasEmptyPlaceHolder to false seem OK to me -
they're all around pointer/reference types where the pointer/reference
token will appear at the rightmost side of the left side of the type
name, so they make nested types (eg: the "int" in "int *") behave as
though there is a non-empty placeholder (because the "*" is essentially
the placeholder as far as the "int" is concerned).

This was originally committed in 277623f4d5

Reverted in f9ad1d1c77 due to breakages
outside of clang - lldb seems to have some strange/strong dependence on
"char [N]" versus "char[N]" when printing strings (not due to that name
appearing in DWARF, but probably due to using clang to stringify type
names) that'll need to be addressed, plus a few other odds and ends in
other subprojects (clang-tools-extra, compiler-rt, etc).
2021-10-21 11:34:43 -07:00
Pavel Labath 6c88086ba8 [lldb] Fix a thinko in 2ace1e57
An empty plugin name means we should try everything.

Picked up by the windows bot.
2021-10-21 14:05:49 +02:00
Benjamin Kramer 39724158d3 [lldb] Silence -Wpessimizing-move warning
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:3635:10: error: moving a local object in a return statement prevents copy elision [-Werror,-Wpessimizing-move]
  return std::move(merged);
         ^
2021-10-21 12:59:00 +02:00
Pavel Labath 2ace1e5753 [lldb] Remove ConstString from GetPluginNameStatic of some plugins
This patch deals with ObjectFile, ObjectContainer and OperatingSystem
plugins. I'll convert the other types in separate patches.

In order to enable piecemeal conversion, I am leaving some ConstStrings
in the lowest PluginManager layers. I'll convert those as the last step.

Differential Revision: https://reviews.llvm.org/D112061
2021-10-21 12:58:45 +02:00
Jaroslav Sevcik 5a3556aa55 [lldb] Add omitted abstract formal parameters in DWARF symbol files
This patch fixes a problem introduced by clang change
https://reviews.llvm.org/D95617 and described by
https://bugs.llvm.org/show_bug.cgi?id=50076#c6, where inlined functions
omit unused parameters both in the stack trace and in `frame var`
command. With this patch, the parameters are listed correctly in the
stack trace and in `frame var` command.

Specifically, we parse formal parameters from the abstract version of
inlined functions and use those formal parameters if they are missing
from the concrete version.

Differential Revision: https://reviews.llvm.org/D110571
2021-10-21 12:33:42 +02:00
Michał Górny b8c3683d46 [lldb] [Host/SerialPort] Add std::moves for better compatibility 2021-10-21 11:08:05 +02:00
Michał Górny cbe7898447 [lldb] [Host/Terminal] Add missing #ifdef for baudRateToConst() 2021-10-21 11:00:17 +02:00
Michał Górny 4745e41783 [lldb] [unittest] Disable SetParity() tests on Linux entirely
Attempting to enable PARENB causes tcsetattr() to fail on the Debian
and Ubuntu buildbots, so let's skip these tests on Linux entirely.
2021-10-21 10:55:02 +02:00
Michał Górny 4a7b4beac7 [lldb] Add serial:// protocol for connecting to serial port
Add a new serial:// protocol along with SerialPort that provides a new
API to open serial ports.  The URL consists of serial device path
followed by URL-style options, e.g.:

    serial:///dev/ttyS0?baud=115200&parity=even

If no options are provided, the serial port is only set to raw mode
and the other attributes remain unchanged.  Attributes provided via
options are modified to the specified values.  Upon closing the serial
port, its original attributes are restored.

Differential Revision: https://reviews.llvm.org/D111355
2021-10-21 10:46:45 +02:00
Michał Górny 92fb574c9f [lldb] [Host] Add setters for common teletype properties to Terminal
Add setters for common teletype properties to the Terminal class:

- SetRaw() to enable common raw mode options

- SetBaudRate() to set the baud rate

- SetStopBits() to select the number of stop bits

- SetParity() to control parity bit in the output

- SetHardwareControlFlow() to enable or disable hardware control flow
  (if supported)

Differential Revision: https://reviews.llvm.org/D111030
2021-10-21 10:33:38 +02:00
Raphael Isemann 46fb5d5ddf [lldb][NFC] clang-format CPlusPlusLanguage.cpp 2021-10-21 10:01:18 +02:00
Daniel Jalkut d531e5cf58 [LLDB] [NFC] Typo fix in usage text for "type filter" command
When you invoke "help type filter" the resulting help shows:

Syntax: type synthetic [<sub-command-options>]

This patch fixes the help so it says "type filter" instead of "type synthetic".

patch by: "Daniel Jalkut <jalkut@red-sweater.com>"

Reviewed By: teemperor

Differential Revision: https://reviews.llvm.org/D112199
2021-10-21 12:22:52 +05:30
Jonas Devlieghere 207998c242 [lldb] Remove variable "any" which is set but not used 2021-10-20 12:08:35 -07:00
Michał Górny f290efc326 [lldb] [ABI/X86] Support combining xmm* and ymm*h regs into ymm*
gdbserver does not expose combined ymm* registers but rather XSAVE-style
split xmm* and ymm*h portions.  Extend value_regs to support combining
multiple registers and use it to create user-friendly ymm* registers
that are combined from split xmm* and ymm*h portions.

Differential Revision: https://reviews.llvm.org/D108937
2021-10-20 15:06:45 +02:00
Michał Górny 99277a81f8 [lldb] [Process/Utility] Fix value_regs/invalidate_regs for ARM
Fix incorrect values for value_regs, and incomplete values for
invalidate_regs in RegisterInfos_arm.  The value_regs entry needs
to list only one base (i.e. larger) register that needs to be read
to get the value for this register, while invalidate_regs needs to list
all other registers (including pseudo-register) whose values would
change when this register is written to.

7a8ba4ffbe fixed a similar problem
for ARM64.

Differential Revision: https://reviews.llvm.org/D112066
2021-10-20 15:06:45 +02:00
Michał Górny 192331b890 [lldb] [Process/Linux] Support arbitrarily-sized FPR writes on ARM
Support arbitrarily-sized FPR writes on ARM in order to fix writing qN
registers directly.  Currently, writing them works only by accident
due to value_regs splitting them into smaller writes via dN and sN
registers.

Differential Revision: https://reviews.llvm.org/D112131
2021-10-20 15:06:44 +02:00
Michał Górny 6561c074c0 [lldb] [Process/Utility] Define qN regs on ARM via helper macro
Add a FPU_QREG macro to define qN registers.  This is a piece-wise
attempt of reconstructing D112066 with the goal of figuring out which
part of the larger change breaks the buildbot.

Differential Revision: https://reviews.llvm.org/D112066
2021-10-20 13:08:17 +02:00
Raphael Isemann 956df6fa62 [lldb] Improve assert message in TestCPPAccelerator
`log` is just some IO object that gets printed as `<_io.TextIOWrapper = filename`
but the intention here was to print the actual found log contents.
2021-10-20 12:04:28 +02:00
Pavel Labath 551d118805 [lldb/test] Remove quote/unquote steps from the make invocations
None of the commands we run really rely on shell features. Running them
with shell=False, simplifies the code as there is no need for elaborate
quoting.

Differential Revision: https://reviews.llvm.org/D111990
2021-10-20 11:35:28 +02:00
Pavel Labath ffbff6c511 [lldb/DWARF] Ignore debug info pointing to the low addresses
specifically, ignore addresses that point before the first code section.

This resurrects D87172 with several notable changes:
- it fixes a bug where the early exits in InitializeObject left
  m_first_code_address "initialized" to LLDB_INVALID_ADDRESS (0xfff..f),
  which caused _everything_ to be ignored.
- it extends the line table fix to function parsing as well, where it
  replaces a similar check which was checking the executable permissions
  of the section. This was insufficient because some
  position-independent elf executables can have an executable segment
  mapped at file address zero. (What makes this fix different is that it
  checks for the executable-ness of the sections contained within that
  segment, and those will not be at address zero.)
- It uses a different test case, with an elf file with near-zero
  addresses, and checks for both line table and function parsing.

Differential Revision: https://reviews.llvm.org/D112058
2021-10-20 11:19:30 +02:00
Shafik Yaghmour 320f65ee65 [LLDB][NFC] Remove parameter names from forward declarations from hand written expressions used in heap.py part 2
heap.py has a lot of large hand written expressions and each name in the
expression will be looked up by clang during expression parsing. For
function parameters this will be in Sema::ActOnParamDeclarator(...) in order to
catch redeclarations of parameters. The names are not needed and we have seen
some rare cases where since we don't have symbols we end up in
SymbolContext::FindBestGlobalDataSymbol(...) which may conflict with other global
symbols.

There may be a way to make this lookup smarter to avoid these cases but it is
not clear how well tested this path is and how much work it would be to fix it.
So we will go with this fix while we investigate more.

This is a second try at getting all the cases we care about.

Ref: rdar://78265641
2021-10-19 16:52:36 -07:00
Vedant Kumar 5e004b03f7 [lldb/test] Update test/API/functionalities/load_lazy to macOS 12
In macOS 12, dyld switched to using chained fixups. As a result, all symbols
are bound at launch and there are no lazy pointers any more. Since we wish to
import/dlopen() a dylib with missing symbols, we need to use a weak import.
This applies to all macOS 12-aligned OS releases, e.g. iOS 15, etc.

rdar://81295101

Differential Revision: https://reviews.llvm.org/D112034
2021-10-19 13:25:14 -07:00
Lawrence D'Anna 8ac5a6641f [lldb] improve the help strings for gdb-remote and kdp-remote
The help string can be more helpful by explaining these are
aliases for 'process connect'

Reviewed By: JDevlieghere

Differential Revision: https://reviews.llvm.org/D111965
2021-10-19 13:08:21 -07:00
Jim Ingham a66798cd67 Remove unneeded variable num_found. 2021-10-19 09:57:07 -07:00
Jonas Devlieghere 1529738b66 [debugserver] Fix BUILDING_FOR_ARM64_OSX
Check for TARGET_CPU_ARM64 (ARM instructions for 64-bit mode) rather
than TARGET_CPU_ARM (instructions for 32-bit mode).
2021-10-19 09:55:53 -07:00
Michał Górny b492b0be95 [lldb] [Process/Utility] Define dN regs on ARM via helper macro
Use FPU_REG macro to define dN registers, removing the wrong value_regs
while at it.  This is a piece-wise attempt of reconstructing D112066
with the goal of figuring out which part of the larger change breaks
the buildbot.

Differential Revision: https://reviews.llvm.org/D112066
2021-10-19 17:06:03 +02:00
Michał Górny 28e0c34216 [lldb] [Process/Utility] Define sN regs on ARM via helper macro
This is a piece-wise attempt of reconstructing D112066 with the goal
of figuring out which part of the larger change breaks the buildbot.

Differential Revision: https://reviews.llvm.org/D112066
2021-10-19 15:51:47 +02:00
Michał Górny 5cd28f71b1 [lldb] [Process/Utility] clang-format RegisterInfos_arm.h 2021-10-19 15:51:47 +02:00
Michał Górny 7df912c65d Revert "[lldb] [Process/Utility] Fix value_regs/invalidate_regs for ARM"
This reverts commit 1c2c67b46b.
Something's still wrong.
2021-10-19 15:33:39 +02:00
Michał Górny 1c2c67b46b [lldb] [Process/Utility] Fix value_regs/invalidate_regs for ARM
Fix incorrect values for value_regs, and incomplete values for
invalidate_regs in RegisterInfos_arm.  The value_regs entry needs
to list only one base (i.e. larger) register that needs to be read
to get the value for this register, while invalidate_regs needs to list
all other registers (including pseudo-register) whose values would
change when this register is written to.

While at it, introduce helper macros for the definitions.

7a8ba4ffbe fixed a similar problem
for ARM64.

Differential Revision: https://reviews.llvm.org/D112066
2021-10-19 14:47:46 +02:00
Michał Górny c6d7f248bd [lldb] [ABI/X86] Refactor ABIX86::AugmentRegisterInfo()
Refactor ABIX86::AugmentRegisterInfo() and helper functions for better
readability.  This also fixes listing eax & co. as potential subregs
on 32-bit systems.

Differential Revision: https://reviews.llvm.org/D108937
2021-10-19 13:36:38 +02:00
Michał Górny 39f2b05963 [lldb] [Host] Make Terminal methods return llvm::Error
Differential Revision: https://reviews.llvm.org/D111890
2021-10-19 13:31:03 +02:00
Raphael Isemann 7dfb139554 [lldb] Adjust udt-layout.test after MS mangling change
The demangled name no longer contains the redundant name since D111715.
2021-10-19 12:43:24 +02:00
Michał Górny ee11612ee1 Revert "[lldb] [ABI/X86] Support combining xmm* and ymm*h regs into ymm*"
This reverts commit 5352ea4a72.  It seems
to have broken the arm buildbot.
2021-10-19 12:31:25 +02:00
Pavel Labath 8bac18be0e [lldb] Reduce code duplication around inferior building
We had two sets of build<flavour> methods, whose bodies were largely
identical. This makes any kind of modification in their vicinity
repetitive and error-prone.

Replace each set with a single method taking an optional debug_info
parameter.

Differential Revision: https://reviews.llvm.org/D111989
2021-10-19 12:09:41 +02:00
Raphael Isemann 9a57d1e526 [lldb] Allow dumping the state of all scratch TypeSystems
This adds the `target dump typesystem'`command which dumps the TypeSystem of the
target itself (aka the 'scratch TypeSystem'). This is similar to `target modules
dump ast` which dumps the AST of lldb::Modules associated with a selected
target.

Unlike `target modules dump ast`, the new command is not a subcommand of `target
modules dump` as it's not touching the modules of a target at all. Also unlike
`target modules dump ast` I tried to keep the implementation language-neutral,
so this patch moves our Clang `Dump` to the `TypeSystem` interface so it will
also dump the state of any future/downstream scratch TypeSystems (e.g., Swift).
That's also why the command just refers to a 'typesystem' instead of an 'ast'
(which is only how Clang is necessarily modelling the internal TypeSystem
state).

The main motivation for this patch is that I need to write some tests that check
for duplicates in the ScratchTypeSystemClang of a target. There is currently no
way to check for this at the moment (beside measuring memory consumption of
course). It's probably also useful for debugging LLDB itself.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D111936
2021-10-19 12:05:14 +02:00
Lasse Folger 134e1817f6 [lldb] change name demangling to be consistent between windows and linx
When printing names in lldb on windows these names contain the full type information while on linux only the name is contained.

This change introduces a flag in the Microsoft demangler to control if the type information should be included.
With the flag enabled demangled name contains only the qualified name, e.g:
without flag -> with flag
int (*array2d)[10] -> array2d
int (*abc::array2d)[10] -> abc::array2d
const int *x -> x

For globals there is a second inconsistency which is not yet addressed by this change. On linux globals (in global namespace) are prefixed with :: while on windows they are not.

Reviewed By: teemperor, rnk

Differential Revision: https://reviews.llvm.org/D111715
2021-10-19 12:04:37 +02:00
Raphael Isemann cfaa5c344d [lldb] Filter duplicates in Target::GetScratchTypeSystems
`Target::GetScratchTypeSystems` returns the list of scratch TypeSystems. The
current implementation is iterating over all LanguageType values and retrieves
the respective TypeSystem for each LanguageType.

All C/C++/Obj-C LanguageTypes are however mapped to the same
ScratchTypeSystemClang instance, so the current implementation adds this single
TypeSystem instance several times to the list of TypeSystems (once for every
LanguageType that we support).

The only observable effect of this is that `SBTarget.FindTypes` for builtin
types currently queries the ScratchTypeSystemClang several times (and also adds
the same result several times).

Reviewed By: bulbazord, labath

Differential Revision: https://reviews.llvm.org/D111931
2021-10-19 11:49:47 +02:00
Michał Górny 5352ea4a72 [lldb] [ABI/X86] Support combining xmm* and ymm*h regs into ymm*
gdbserver does not expose combined ymm* registers but rather XSAVE-style
split xmm* and ymm*h portions.  Extend value_regs to support combining
multiple registers and use it to create user-friendly ymm* registers
that are combined from split xmm* and ymm*h portions.

Differential Revision: https://reviews.llvm.org/D108937
2021-10-19 10:31:07 +02:00
Jonas Devlieghere 957a5e9874 [lldb] Fix nullptr dereference in AppleObjCRuntimeV2
Fix a potential nullptr dereference in AppleObjCRuntimeV2 by checking
the result of GetClassInfoUtilityFunction and returning a failure if
it's null.

The DynamicClassInfoExtractor was already doign the right thing, but the
SharedCacheClassInfoExtractor was missing this check.
2021-10-18 23:30:31 -07:00
Jim Ingham f24532ae91 Follow-on to fix a test from c5011aed9c.
I need to set a fake default platform for the UnitTest test to run on other
systems.
2021-10-18 16:53:32 -07:00
Jim Ingham c5011aed9c Add a "command container" hierarchy to allow users to add container nodes.
The point is to allow users with a related set of script based commands
to organize their commands in a hierarchy in the command set, rather than
having to have only top-level commands.

Differential Revision: https://reviews.llvm.org/D110298
2021-10-18 15:29:24 -07:00
Michał Górny a229a4aa64 [lldb] [lldb-server] Refactor ConnectToRemote()
Refactor ConnectToRemote() to improve readability and make future
changes easier:

1. Replace static buffers with std::string.
2. When handling errors, prefer reporting the actual error over dumb
   'connection status is not success'.
3. Move host/port parsing directly into reverse_connection condition
   that is its only user, and simplify it to make its purpose (verifying
   that a valid port is provided) clear.
4. Use llvm::errs() and llvm::outs() instead of fprintf().

Differential Revision: https://reviews.llvm.org/D111963
2021-10-18 22:05:01 +02:00
Michał Górny 62293e7d33 Revert "[lldb] [lldb-server] Refactor ConnectToRemote()"
This reverts commit d8bc7e40ce.  I've
linked the wrong Differential Revision.
2021-10-18 22:04:36 +02:00
Jim Ingham 1ff367dbb0 Fix Linux error in TestBreakInLoadedDylib.py.
Adding the to be loaded dylib to the extra images causes the breakpoint
to be found in the image added to the target on Linux (though not on
Darwin).  So adjust the test for this difference.
2021-10-18 11:30:31 -07:00
Jim Ingham 9a2e9c5db6 Add tests for the other variants of BreakpointCreateBySourceRegex.
I added some tests for the case where the breakpoints take immediately
to the extant test case, and made a new test case for when the source
regex breakpoint will be set in a dlopen-ed library.

I also noticed when doing this that "lldbutil.run_to_source_breakpoint
can't handle the case where the breakpoint will be in a dlopen-ed
library, since it requires the breakpoint to have at least 1 location
before run.  I fixed that by adding a parameter to say whether a
before run location is expected.

Differential Revision: https://reviews.llvm.org/D111920
2021-10-18 10:59:04 -07:00
Kazu Hirata 8568ca789e Use llvm::erase_if (NFC) 2021-10-18 09:33:42 -07:00
Raphael Isemann 366fb53948 [lldb] Fix missing dependency on libc++ from LLDB test suite on non-Darwin platforms
Right now we only set a dependency on libc++ when the host is Darwin, which
means that libc++ in the build directory is in some undefined state when running
the test suite (it can be fully built, out-of-date or missing). Depending on
whether we have a system libc++ (which LLDB also supports running the libc++
tests against), the outcome is that we sometimes skip the libc++ tests or we run
the tests against a mix of ToT-libc++/system-libc++ (e.g., we compile against
the ToT-libc++ headers and link against the system libc++ library).

This can be demonstrated via `export LIT_FILTER=TestDataFormatterLibcxxSet ninja
check-lldb-api` (or any other libc++ test) and then gradually building parts of
libc++ in the same build (which will slowly change the test behaviour from
`UNSUPPORTED` to various failures to passing depending on how much of libcxx is
built at test time).

Note that this effectively re-enables the (unintentionally) disabled libc++
formatter tests on Linux. Don't revert this if it breaks a libc++ LLDB test,
instead please @skipIf decorate the failing test (as it was probably already
failing before this commit).

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D111981
2021-10-18 15:59:34 +02:00
Pavel Labath 1ef6bd9b1b [lldb] Delete TestStandardUnwind
It's been broken (not failing, but not testing anything either) for
quite some time now, and nobody noticed. It also (by design) tests
stepping through libc code, which makes it completely non-hermetic.

It's not worth reviving such a test.
2021-10-18 15:22:10 +02:00
Pavel Labath b37efed957 [lldb] Fix PDB/compilands.test for a3939e1 2021-10-18 14:11:47 +02:00
Michał Górny d8bc7e40ce [lldb] [lldb-server] Refactor ConnectToRemote()
Refactor ConnectToRemote() to improve readability and make future
changes easier:

1. Replace static buffers with std::string.
2. When handling errors, prefer reporting the actual error over dumb
   'connection status is not success'.
3. Move host/port parsing directly into reverse_connection condition
   that is its only user, and simplify it to make its purpose (verifying
   that a valid port is provided) clear.
4. Use llvm::errs() and llvm::outs() instead of fprintf().

Differential Revision: https://reviews.llvm.org/D11196
2021-10-18 12:17:43 +02:00
Lasse Folger ee691fbc3d [lldb][NFC] clang format change
clang format on some demangling files

Reviewed By: teemperor

Differential Revision: https://reviews.llvm.org/D111934
2021-10-18 12:00:32 +02:00
Pavel Labath d914aa4ead [lldb] Fix SymbolFilePDBTests for a3939e1 2021-10-18 11:59:01 +02:00
Michał Górny 239b4d62b6 [lldb] [Utility] Remove Status::WasInterrupted() along with its only use
Remove Status::WasInterrupted() that checks whether the underlying error
code matches EINTR.  ProcessGDBRemote::ConnectToDebugserver() is its
only call site, and it does not seem correct there.  After all, EINTR
is precisely when we want to retry, not stop retrying.  Furthermore,
it should not really matter since we should be catching EINTR
immediately via llvm::sys::RetryAfterSignal() but that's another story.

Differential Revision: https://reviews.llvm.org/D111908
2021-10-18 10:50:25 +02:00
Pavel Labath a3939e159f [lldb] Return StringRef from PluginInterface::GetPluginName
There is no reason why this function should be returning a ConstString.

While modifying these files, I also fixed several instances where
GetPluginName and GetPluginNameStatic were returning different strings.

I am not changing the return type of GetPluginNameStatic in this patch, as that
would necessitate additional changes, and this patch is big enough as it is.

Differential Revision: https://reviews.llvm.org/D111877
2021-10-18 10:14:42 +02:00
Jonas Devlieghere c900b0a6d5 [lldb] Skip target variable test on AS 2021-10-17 19:12:24 -07:00
Raphael Isemann 60b96aa65e [lldb] Split ParseSingleMember into Obj-C property and normal member/ivar parsing code.
Right now DWARFASTParserClang::ParseSingleMember has two parts: One part parses
Objective-C properties and the other part parses C/C++ members/Objective-C
ivars. These parts are pretty much independent of each other (with one
historical exception, see below) and in practice they parse DIEs with different
tags/attributes: `DW_TAG_APPLE_property` and `DW_TAG_member`.

I don't see a good reason for keeping the different parsing code intertwined in
a single function, so instead split out the Objective-C property parser into its
own function.

Note that 90% of this commit is just unindenting nearly all of
`ParseSingleMember` which was inside a `if (tag == DW_TAG_member)` block. I.e.,
think of the old `ParseSingleMember` function as: The rest is just moving the
property parsing code into its own function and I added the ReportError
implementation in case we fail to resolve the property type (which before was
just a silent failure).

```
lang=c++
void DWARFASTParserClang::ParseSingleMember(...) {
  [...]
  if (tag == DW_TAG_member) {
    [...] // This huge block got unindented in this patch as the `if` above is gone.
  }
  if (property) {
    [...] // This is the property parsing code that is now its own function.
  }
}
```

There is one exception to the rule that the parsers are independent. Before 2012
Objective-C properties were encoded as `DW_TAG_member` with
`DW_AT_APPLE_property*` attributes describing the property. In 2012 this has
changed in a series of commits (see for example
c0449635b3 which updates the docs) so that
`DW_TAG_APPLE_property` is now used for properties. With the old format we first
created an ivar and afterwards used the `DW_AT_APPLE_property*` attributes to
create the respective property, but there doesn't seem to be any way to create
such debug info with any clang from the last 9 years. So this is technically not
NFC in case some finds debug info from that time and tries to use properties.

Reviewed By: aprantl

Differential Revision: https://reviews.llvm.org/D111632
2021-10-16 14:20:04 +02:00
Lawrence D'\''Anna 4594f81165 Fix Xcode project for debugserver
It seems StringConvert.cpp was moved, and the Xcode project file
wasn't updated.

Reviewed By: JDevlieghere

Differential Revision: https://reviews.llvm.org/D111910
2021-10-15 15:08:06 -07:00
Raphael Isemann ff4c98c055 [lldb] Harden TestCompletion against new settings in 'target.process'
This test starts failing when people add a setting starting with
`target.process.t` which of course can easily happen. Make it a bit more
resistant by only requiring that `target.process.thr` has a unique completion.
2021-10-15 18:50:21 +02:00
Raphael Isemann 03a8e70a19 [lldb] Add test for struct merging in scratch ASTContext 2021-10-15 17:20:03 +02:00
Michał Górny 1583c41d07 [lldb] [test] Add TestGDBServerTargetXML tests for x86 duplicate subregs 2021-10-15 16:04:16 +02:00
Michał Górny e7418906f5 [lldb] [test] Simplify X86 TestGDBServerTargetXML logic to match AArch64 2021-10-15 14:15:50 +02:00
Michał Górny f70f9620d9 [lldb] [ABI/AArch64] Do not add subregs if some of them are present
Fix a bug introduced while refactoring ABIAArch64::AugmentRegisterInfo()
that caused subregisters to be added even if they were already present.
Instead, abort immediately if at least one subregister is found
(following ABIX86).  While at it, add a test for that.

Differential Revision: https://reviews.llvm.org/D111881
2021-10-15 14:08:37 +02:00
Michał Górny 2712d18148 [lldb] [ABI/X86] Add pseudo-registers if missing
Differential Revision: https://reviews.llvm.org/D108831
2021-10-15 12:55:03 +02:00
Michał Górny 0d1705a9d6 [lldb] [DynamicRegisterInfo] Support value_regs with offset
Support specifying an offset for value_regs[0], and add the offset
to the computed derived register offset.  This makes it possible to
e.g. create the "ah" register on x86.

Differential Revision: https://reviews.llvm.org/D111489
2021-10-15 12:55:02 +02:00
Pavel Labath bc9b106a57 [lldb] Fix an include in HostTest.cpp
The previous include was too broad, and its better if the host tests do
not depend on non-host libraries.
2021-10-15 11:10:38 +02:00
Jason Molenda 35d710148b Use Module's FileSpec for limiting binaries to set dyld breakpoint in
When DynamicLoaderMacOS::SetNotificationBreakpoint sets the breakpoint
for new binaries being loaded/unloaded, it limits the scope of that
breakpoint to just dyld, so we don't re-evaluate the breakpoint for
every new binary loaded.  I wrote this to get the module's ObjectFile
FileSpec in an earlier change, but this is not correct.  If lldb
is debugging a remote system, and it had to read dyld out of memory
from the remote system, it will have no FileSpec on the lldb debugger
host.  We need to grab the Module's FileSpec, which in this case is
actually falling back to the PlatformFileSpec, the binary path on the
target system.

rdar://84199646
2021-10-14 23:58:23 -07:00
Shao-Ce SUN 7c704c0f53 [NFC] fix a typo 2021-10-15 14:51:49 +08:00
Raphael Isemann 482c53fa0d [lldb] Move ~Platform to source file
The called destructors of the members require the includes that are only
in the source file.
2021-10-14 21:36:46 +02:00
Raphael Isemann e632e900ac [lldb] Remove logging from Platform::~Platform
Platform instances are stored in a function-local static list. However, the
logging code involves locking a function-local static mutex. This only works on
some implementations where the Log mutex is by accident destroyed *after* the
Platform list is destroyed.

This fixes randomly failing tests due to `recursive_mutex lock failed: Invalid
argument`.

Reviewed By: kastiglione

Differential Revision: https://reviews.llvm.org/D111816
2021-10-14 20:42:45 +02:00
Raphael Isemann 78e17e23aa [lldb] Rewrite TestDiamond and document some bugs. 2021-10-14 20:32:07 +02:00
Dave Lee 722a2fb7f9 [lldb] Fix 'frame diagnose' docstring typo 2021-10-14 08:32:20 -07:00
Pavel Labath fa639eda65 [lldb] Fix TestStackCorefile.py for ca0ce99fc8 2021-10-14 10:38:48 +02:00
Martin Storsjö 7106f58856 [lldb] Make the thread_local g_global_boundary accessed from a single file
This makes the compiler generated code for accessing the thread local
variable much simpler (no need for wrapper functions and weak pointers
to potential init functions), and can avoid toolchain bugs regarding how
to access TLS variables.

In particular, this fixes LLDB when built with current GCC/binutils for
MinGW, see https://github.com/msys2/MINGW-packages/issues/8868.

Differential Revision: https://reviews.llvm.org/D111779
2021-10-14 11:17:20 +03:00
Pavel Labath ca0ce99fc8 [lldb] Print embedded nuls in char arrays (PR44649)
When we know the bounds of the array, print any embedded nuls instead of
treating them as terminators. An exception to this rule is made for the
nul character at the very end of the string. We don't print that, as
otherwise 99% of the strings would end in \0. This way the strings
usually come out the same as how the user typed it into the compiler
(char foo[] = "with\0nuls"). It also matches how they come out in gdb.

This resolves a FIXME left from D111399, and leaves another FIXME for dealing
with nul characters in "escape-non-printables=false" mode. In this mode the
characters cause the entire summary string to be terminated prematurely.

Differential Revision: https://reviews.llvm.org/D111634
2021-10-14 09:50:40 +02:00
Stella Stamenova 58917054c2 [lldb] Skip several lldb tests that are flaky on Windows
These tests fail every 10 or so runs on Windows causing both local failures as well as buildbot failures.

Differential Revision: https://reviews.llvm.org/D111659
2021-10-13 09:46:41 -07:00
Raphael Isemann 4019699fa5 [lldb] Add a test for CRTP 2021-10-13 17:15:02 +02:00
Raphael Isemann 0648b3c026 [lldb][NFC] for-range loop when iterating over delayed_properties 2021-10-13 15:27:23 +02:00
Raphael Isemann 7103753733 [lldb][NFC] Split out DW_TAG_inheritance parsing into own function
Just moving that block inside DWARFASTParserClang::ParseChildMembers into
its own function. Also early-exiting instead of a large if when
num_attributes is 0.
2021-10-13 13:14:57 +02:00
Fangrui Song 1b81581fee [lldb][test] Remove Intel MPX tests
Intel MPX failed to gain wide adoption and has been deprecated for a while.
GCC 9.1 removed Intel MPX support. Linux kernel removed MPX in 2019.
glibc 2.35 will remove the support.
2021-10-12 16:16:58 -07:00
Siger Yang 67f94e5a97 [lldb/lua] Supplement Lua bindings for lldb module
Add necessary typemaps for Lua bindings, together with some other files.

Signed-off-by: Siger Yang <sigeryeung@gmail.com>

Reviewed By: tammela

Differential Revision: https://reviews.llvm.org/D108090
2021-10-12 22:10:21 +08:00
Siger Yang 6de63b3ba5 [lldb/lua] Force Lua version to be 5.3
Due to CMake cache, find_package in FindLuaAndSwig.cmake
will be ignored. This commit adds EXACT and REQUIRED flags
to it and removes find_package in Lua ScriptInterpreter.

Signed-off-by: Siger Yang <sigeryeung@gmail.com>

Reviewed By: tammela, JDevlieghere

Differential Revision: https://reviews.llvm.org/D108515
2021-10-12 21:34:15 +08:00
Michał Górny bda5fe8f0c [lldb] [gdb-remote] Fix displaying i387_ext & vec regs with gdbserver
Adjust the encoding and format applied to i387_ext and vec* type
registers from gdbserver to match lldb-server.  Both types are now
displayed as vector of uint8 instead of float and integer formats used
before.  Additionally, this fixes display of STi registers when they do
not carry floating-point data (they are also used to hold MMX vectors).

Differential Revision: https://reviews.llvm.org/D108468
2021-10-12 15:16:06 +02:00
Michał Górny ec2d0ded1b [lldb] Remove "0x" prefix from hex values in dirty-pages
Remove the redudant "0x" prefix in the "dirty-pages" key of
qMemoryRegionInfo packet.  The client accepts hex values both with
and without the prefix.

Differential Revision: https://reviews.llvm.org/D110510
2021-10-11 21:04:11 +02:00
Jonas Devlieghere 070315d04c Revert "Allow signposts to take advantage of deferred string substitution"
This reverts commits f9aba9a5af and
035217ff51.

As explained in the original commit message, this didn't have the
intended effect of improving the common LLDB use case, but still
provided a marginal improvement for the places where LLDB creates a
scoped time with a string literal.

The reason for the revert is that this change pulls in the os/signpost.h
header in Signposts.h. The former transitively includes loader.h, which
contains a series of macro defines that conflict with MachO.h. There are
ways to work around that, but Adrian and I concluded that  none of them
are worth the trade-off in complicating Signposts.h even further.
2021-10-11 11:09:36 -07:00
Michał Górny 660632778f [lldb] [DynamicRegisterInfo] Support setting from vector<Register>
Add an overload of DynamicRegisterInfo::SetRegisterInfo() that accepts
a std::vector<Register> as an argument.  This moves the conversion
from DRI::Register to RegisterInfo directly into DynamicRegisterInfo,
and avoids the necessity of creating fully-compatible intermediate
RegisterInfo instances.

While the new method could technically reuse AddRegister(), the ultimate
goal is to replace AddRegister() with SetRegisterInfo() entirely.

Differential Revision: https://reviews.llvm.org/D111435
2021-10-11 17:02:27 +02:00
Michał Górny 583f67cb4e [lldb] [ABI/AArch64] Add pseudo-regs if missing
Create pseudo-registers on the AArch64 target if they are not provided
by the remote server. This is the case for gdbserver. The created
registers are:

- 32-bit wN partials for 64-bit xN registers
- double precision floating-point dN registers (overlapping with vN)
- single precision floating-point sN registers (overlapping with vN)

Differential Revision: https://reviews.llvm.org/D109876
2021-10-11 17:02:27 +02:00
Michał Górny 1afda54f19 [lldb] [Target] Make addSupplementaryRegister() work on Register vector
Move DynamicRegisterInfo::AddSupplementaryRegister() into a standalone
function working on std::vector<DynamicRegisterInfo::Register>.

Differential Revision: https://reviews.llvm.org/D111295
2021-10-11 17:02:27 +02:00
Michał Górny 5849219126 [lldb] [ABI] Apply AugmentRegisterInfo() to DynamicRegisterInfo::Registers
Call ABI::AugmentRegisterInfo() once with a vector of all defined
registers rather than calling it for every individual register.  Move
and rename RemoteRegisterInfo from gdb-remote to
DynamicRegisterInfo::Register, and use this class when augmenting
registers.

Differential Revision: https://reviews.llvm.org/D111142
2021-10-11 17:02:26 +02:00
Raphael Isemann 8249e50bf4 [lldb][NFC] Remove unnecessary reference from ParseChildMembers's default_accessibility parameter 2021-10-11 15:43:49 +02:00