aboutsummaryrefslogtreecommitdiff
path: root/lldb
AgeCommit message (Collapse)AuthorFilesLines
2024-03-07[lldb][test][FreeBSD] xfail TestPlatformConnect on AArch64David Spickett1-0/+7
Details in the linked issue. Might fail on other architectures but I can't confirm, they can add to this if it does.
2024-03-07[lldb][test] Enforce `pexpect` system availability by default (#84270)Jordan Rupprecht2-2/+4
This switches the default of `LLDB_TEST_USE_VENDOR_PACKAGES` from `ON` to `OFF` in preparation for eventually deleting it. All known LLDB buildbots have this package installed, so flipping the default will uncover any other users. If this breaks anything, the preferred fix is to install `pexpect` on the host system. The second fix is to build with cmake option `-DLLDB_TEST_USE_VENDOR_PACKAGES=ON` as a temporary measure until `pexpect` can be installed. If neither of those work, reverting this patch is OK.
2024-03-06[lldb] Log module build remarks to types log too (#84260)Dave Lee1-1/+1
2024-03-06[lldb] Extract getter function for experimental target properties (NFC) (#83504)Dave Lee2-17/+13
In Swift's downstream lldb, there are a number of experimental properties. This change extracts a getter function containing the common logic for getting a boolean valued experimental property. This also deletes `SetInjectLocalVariables` which isn't used anywhere.
2024-03-06[lldb] Remove unused #includes in ClangModulesDeclVendor.cpp (#84262)Dave Lee1-8/+0
2024-03-06[lldb][test] iwyu for vfork testJordan Rupprecht1-0/+1
2024-03-06[lldb] Print mangled names with verbose break list (#84071)Felipe de Azevedo Piovezan2-1/+18
When debugging LLDB itself, it can often be useful to know the mangled name of the function where a breakpoint is set. Since the `--verbose` setting of `break --list` is aimed at debugging LLDB, this patch makes it so that the mangled name is also printed in that mode. Note about testing: since mangling is not the same on Windows and Linux, the test refrains from hardcoding mangled names.
2024-03-06Don't require a UUID in a .dwp file. (#83935)Greg Clayton2-1/+14
DWP files don't usually have a GNU build ID built into them. When searching for a .dwp file, don't require a UUID to be in the .dwp file. The debug info search information was checking for a UUID in the .dwp file when debug info search paths were being used. This is now fixed by not specifying the UUID in the ModuleSpec being used for the .dwp file search.
2024-03-06Skip TestAddressMasks API tests on 32-bit armJason Molenda1-0/+3
TestAddressMasks failed on the lldb-arm-buntu bot with the Code address mask test, mask = process.GetAddressMask(lldb.eAddressMaskTypeAny) process.SetAddressMask(lldb.eAddressMaskTypeCode, mask | 0x3) self.assertEqual( 0x000002950001F694, process.FixAddress(0x00265E950001F697, lldb.eAddressMaskTypeCode), ) The API returned 0x000002950001f694 instead of the expected 0x00265e950001f696. The low bits differ because ABISysV_arm hardcodes the Code address mask to clear the 0th bit, it doesn't use the Process code mask. I didn't debug why some of the high bytes were dropped. The address mask APIs are only important on 64-bit targets, where many of the bits are not used for addressing and are used for metadata instead, so I'm going to skip these tests on 32-bit arm instead of debugging.
2024-03-06Fix lldb crash while handling concurrent vfork() (#81564)jeffreytan816-12/+243
We got user reporting lldb crash while the debuggee is calling vfork() concurrently from multiple threads. The crash happens because the current implementation can only handle single vfork, vforkdone protocol transaction. This diff fixes the crash by lldb-server storing forked debuggee's <pid, tid> pair in jstopinfo which will be decoded by lldb client to create StopInfoVFork for follow parent/child policy. Each StopInfoVFork will later have a corresponding vforkdone packet. So the patch also changes the `m_vfork_in_progress` to be reference counting based. Two new test cases are added which crash/assert without the changes in this patch. --------- Co-authored-by: jeffreytan81 <jeffreytan@fb.com>
2024-03-06[lldb] Address mask sbprocess apis and new mask invalid const (#83663)Jason Molenda19-45/+517
[lldb] Add SBProcess methods for get/set/use address masks (#83095) I'm reviving a patch from phabracator, https://reviews.llvm.org/D155905 which was approved but I wasn't thrilled with all the API I was adding to SBProcess for all of the address mask types / memory regions. In this update, I added enums to control type address mask type (code, data, any) and address space specifiers (low, high, all) with defaulted arguments for the most common case. I originally landed this via https://github.com/llvm/llvm-project/pull/83095 but it failed on CIs outside of arm64 Darwin so I had to debug it on more environments and update the patch. This patch is also fixing a bug in the "addressable bits to address mask" calculation I added in AddressableBits::SetProcessMasks. If lldb were told that 64 bits are valid for addressing, this method would overflow the calculation and set an invalid mask. Added tests to check this specific bug while I was adding these APIs. This patch changes the value of "no mask set" from 0 to LLDB_INVALID_ADDRESS_MASK, which is UINT64_MAX. A mask of all 1's means "no bits are used for addressing" which is an impossible mask, whereas a mask of 0 means "all bits are used for addressing" which is possible. I added a base class implementation of ABI::FixCodeAddress and ABI::FixDataAddress that will apply the Process mask values if they are set to a value other than LLDB_INVALID_ADDRESS_MASK. I updated all the callers/users of the Mask methods which were handling a value of 0 to mean invalid mask to use LLDB_INVALID_ADDRESS_MASK. I added code to the all AArch64 ABI Fix* methods to apply the Highmem masks if they have been set. These will not be set on a Linux environment, but in TestAddressMasks.py I test the highmem masks feature for any AArch64 target, so all AArch64 ABI plugins must handle it. rdar://123530562
2024-03-06[lldb][lldb-server] Fix pipe spelling mistake in log messageDavid Spickett1-1/+1
2024-03-06[lldb] Fix build failure in Debugger.cpp (NFC)Jie Fu1-1/+1
llvm-project/lldb/source/Core/Debugger.cpp:107:14: error: no type named 'DefaultThreadPoolThreadPool' in namespace 'llvm' static llvm::DefaultThreadPoolThreadPool *g_thread_pool = nullptr; ~~~~~~^ 1 error generated.
2024-03-05Rename llvm::ThreadPool -> llvm::DefaultThreadPool (NFC) (#83702)Mehdi Amini1-2/+2
The base class llvm::ThreadPoolInterface will be renamed llvm::ThreadPool in a subsequent commit. This is a breaking change: clients who use to create a ThreadPool must now create a DefaultThreadPool instead.
2024-03-05[lldb] Print a message when background tasks take a while to complete (#82799)Jonas Devlieghere1-1/+14
When terminating the debugger, we wait for all background tasks to complete. Given that there's no way to interrupt those treads, this can take a while. When that happens, the debugger appears to hang at exit. The above situation is unfortunately not uncommon when background downloading of dSYMs is enabled (`symbols.auto-download background`). Even when calling dsymForUUID with a reasonable timeout, it can take a while to complete. This patch improves the user experience by printing a message from the driver when it takes more than one (1) second to terminate the debugger.
2024-03-05[lldb] Log to system log instead of stderr from Host::SystemLog (#83366)Jonas Devlieghere1-0/+11
Currently, calls to Host::SystemLog print to stderr on all host platforms except Darwin. This severely limits its value on the command line, where we don't want to overload the user with log messages. Switch to using the syslog function on POSIX systems to send messages to the system logger instead of stdout. On Darwin systems this sends the log message to os_log, which matches what we do today. Nevertheless I kept the current implementation that uses os_log directly as it gives us more freedom. I'm not sure if there's an equivalent on Windows, so I kept the existing behavior of logging to stderr.
2024-03-04[lldb] Enable a test that was never enabled (#83925)Felipe de Azevedo Piovezan1-0/+1
According to the git log (d9442afba1bd6), this test has never been enabled/disabled, it was checked in without being called anywhere. But it passes and it is useful, so this commit enables it.
2024-03-04[lldb/crashlog] Fix breaking changes in textual report format (#83861)Med Ismail Bennani3-4/+70
This patch should address some register parsing issue in the legacy report format. rdar://107210149 Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2024-03-04[lldb/lua] Fix Lua building on Windows (#83871)Alexander M1-7/+3
Add `liblldb` dependency and use correct extension for compiled Lua module. Replace 'Python' with 'Lua' in install path name. Fixes #55075.
2024-03-04[lldb/Test] Fix oversight in ProcessEventDataTest::SetUp (NFC) (#83895)Med Ismail Bennani1-0/+3
This patch addresses an oversight in `ProcessEventDataTest::SetUp` unittest to ensure the Debugger is initialized properly. Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2024-03-04[lldb][test][NFC] Narrow scope of `import pexpect`Jordan Rupprecht3-7/+3
We do not run `pexpect` based tests on Windows, but there are still cases where those tests run `import pexpect` outside of the scope where the test is skipped. By moving the import statement to a different scope, those tests can run even when `pexpect` truly isn't installed. Tangentially related: TestSTTYBeforeAndAfter.py is using a manual `@expectedFailureAll` for windows instead of the common `@skipIfWindows`. If `pexepect` is generally expected to not be available, we should not bother running the test at all.
2024-03-04[lldb] Use sort-ordering for indexes when sorting by size (#83889)Jonas Devlieghere2-4/+5
Use sort-ordering for indexes when sorting by size. This addresses Jason's post commit review feedback.
2024-03-04[lldb][test] Add test for chained PCH debugging (#83582)Michael Buch5-0/+118
Adds a test-case for debugging a program with a pch chain, that is, the main executable depends on a pch that itself included another pch. Currently clang doesn't emit the sekeleton CUs required for LLDB to track all types on the pch chain. Thus this test is XFAILed for now.
2024-03-02Fix LLDB build after renaming the base class for ThreadPool to ↵Mehdi Amini1-1/+1
ThreadPoolInterface The header was updated but not the implementation.
2024-03-02Split the llvm::ThreadPool into an abstract base class and an implementation ↵Mehdi Amini1-3/+3
(#82094) This decouples the public API used to enqueue tasks and wait for completion from the actual implementation, and opens up the possibility for clients to set their own thread pool implementation for the pool. https://discourse.llvm.org/t/construct-threadpool-from-vector-of-existing-threads/76883
2024-03-02[lldb][X86] Fix setting target features in ClangExpressionParser (#82364)Daniil Kovalev1-2/+2
Currently, for x86 and x86_64 triples, "+sse" and "+sse2" are appended to `Features` vector of `TargetOptions` unconditionally. This vector is later reset in `TargetInfo::CreateTargetInfo` and filled using info from `FeaturesAsWritten` vector, so previous modifications of the `Features` vector have no effect. For x86_64 triple, we append "sse2" unconditionally in `X86TargetInfo::initFeatureMap`, so despite the `Features` vector reset, we still have the desired sse features enabled. The corresponding code in `X86TargetInfo::initFeatureMap` is marked as FIXME, so we should not probably rely on it and should set desired features properly in `ClangExpressionParser`. This patch changes the vector the features are appended to from `Features` to `FeaturesAsWritten`. It's not reset later and is used to compute resulting `Features` vector.
2024-03-01[lldb] Fix -Wformat after #83602Fangrui Song1-2/+2
2024-03-01[lldb] Fix `thread backtrace --count` (#83602)Jonas Devlieghere3-15/+38
The help output for `thread backtrace` specifies that you can pass -1 to `--count` to display all the frames. ``` -c <count> ( --count <count> ) How many frames to display (-1 for all) ``` However, that doesn't work: ``` (lldb) thread backtrace --count -1 error: invalid integer value for option 'c' ``` The problem is that we store the option value as an unsigned and the code to parse the string correctly rejects it. There's two ways to fix this: 1. Make `m_count` a signed value so that it accepts negative values and appease the parser. The function that prints the frames takes an unsigned so a negative value will just become a really large positive value, which is what the current implementation relies on. 2. Keep `m_count` unsigned and instead use 0 the magic value to show all frames. I don't really see a point in not showing any frames at all, plus that's already broken (`error: error displaying backtrace for thread: "0x0001"`). This patch implements (2) and at the same time improve the error reporting so that we print the invalid value when we cannot parse it. rdar://123881767
2024-03-01[lldb][progress] Hook up new broadcast bit and progress manager (#83069)Chelsea Cassanova5-38/+177
This commit adds the functionality to broadcast events using the `Debugger::eBroadcastProgressCategory` bit (https://github.com/llvm/llvm-project/pull/81169) by keeping track of these reports with the `ProgressManager` class (https://github.com/llvm/llvm-project/pull/81319). The new bit is used in such a way that it will only broadcast the initial and final progress reports for specific progress categories that are managed by the progress manager. This commit also adds a new test to the progress report unit test that checks that only the initial/final reports are broadcasted when using the new bit.
2024-03-01[lldb] Add support for sorting by size to `target module dump symtab` (#83527)Jonas Devlieghere4-7/+39
This patch adds support to sort the symbol table by size. The command already supports sorting and it already reports sizes. Sorting by size helps diagnosing size issues. rdar://123788375
2024-03-01[lldb][test][Windows] Don't check for pexpect with ↵David Spickett1-4/+8
LLDB_ENFORCE_STRICT_TEST_REQUIREMENTS See https://github.com/llvm/llvm-project/issues/22648 for why we don't use it on Windows. Any pexpect tests are skipped there.
2024-02-29[lldb] [debugserver] fix qLaunchSuccess error, add ↵Jason Molenda2-160/+168
QErrorStringInPacketSupported (#82593) Pavel added an extension to lldb's gdb remote serial protocol that allows the debug stub to append an error message (ascii hex encoded) after an error response packet Exx. This was added in 2017 in https://reviews.llvm.org/D34945 . lldb sends the QErrorStringInPacketSupported packet and then the remote stub may add these error strings. debugserver has two bugs in its use of extended error messages: the vAttach family would send the extended error string without checking if the mode had been enabled. And qLaunchSuccess would not properly format its error response packet (missing the hex digits, did not asciihex encode the string). There is also a bug in the HandlePacket_D (detach) packet where the error packets did not include hex digits, but this one does not append an error string. I'm adding a new RNBRemote::SendErrorPacket() and routing all error packet returns though this one method. It takes an optional second string which is the longer error message; it now handles appending it to the Exx response or not, depending on the QErrorStringInPacketSupported state. I updated all packets to send their errors via this method.
2024-02-29[lldb][progress][NFC] Fix Doxygen information (#83502)Chelsea Cassanova1-0/+3
2024-02-29Revert "XFAIL TestLocalVariables.py on Windows" (#83454)Alexander M1-1/+0
This reverts commit 3434472ed74141848634b5eb3cd625d651e22562. Closes #43097.
2024-02-29Revert "[lldb] Add SBProcess methods for get/set/use address masks (#83095)"Jason Molenda10-328/+6
This reverts commit 9a12b0a60084b2b92f728e1bddec884a47458459. TestAddressMasks fails its first test on lldb-x86_64-debian, lldb-arm-ubuntu, lldb-aarch64-ubuntu bots. Reverting while investigating.
2024-02-29[lldb] Add SBProcess methods for get/set/use address masks (#83095)Jason Molenda10-6/+328
I'm reviving a patch from phabracator, https://reviews.llvm.org/D155905 which was approved but I wasn't thrilled with all the API I was adding to SBProcess for all of the address mask types / memory regions. In this update, I added enums to control type address mask type (code, data, any) and address space specifiers (low, high, all) with defaulted arguments for the most common case. This patch is also fixing a bug in the "addressable bits to address mask" calculation I added in AddressableBits::SetProcessMasks. If lldb were told that 64 bits are valid for addressing, this method would overflow the calculation and set an invalid mask. Added tests to check this specific bug while I was adding these APIs. rdar://123530562
2024-02-29[lldb][ClangASTImporter] Import record layouts from origin if available (#83295)Michael Buch5-7/+111
Layout information for a record gets stored in the `ClangASTImporter` associated with the `DWARFASTParserClang` that originally parsed the record. LLDB sometimes moves clang types from one AST to another (in the reproducer the origin AST was a precompiled-header and the destination was the AST backing the executable). When clang then asks LLDB to `layoutRecordType`, it will do so with the help of the `ClangASTImporter` the type is associated with. If the type's origin is actually in a different LLDB module (and thus a different `DWARFASTParserClang` was used to set its layout info), we won't find the layout info in our local `ClangASTImporter`. In the reproducer this meant we would drop the alignment info of the origin type and misread a variable's contents with `frame var` and `expr`. There is logic in `ClangASTSource::layoutRecordType` to import an origin's layout info. This patch re-uses that infrastructure to import an origin's layout from one `ClangASTImporter` instance to another. rdar://123274144
2024-02-29[lldb][NFC] Move helpers to import record layout into ClangASTImporter (#83291)Michael Buch4-259/+331
This patch moves the logic for copying the layout info of a `RecordDecl`s origin into a target AST. A follow-up patch re-uses the logic from within the `ClangASTImporter`, so the natural choice was to move it there.
2024-02-29Increase timeout to reduce test failure rate. (#83312)Shubham Sandeep Rastogi2-6/+9
The timeout for this test was set to 1.0s which is very low, it should be a default of 10s and be increased by a factor of 10 if ASAN is enabled. This will help reduce the falkiness of the test, especially in ASAN builds.
2024-02-29[lldb] Don't cache lldb_find_python_module resultJonas Devlieghere1-3/+3
Don't cache lldb_find_python_module result as that requires you to do a clean build after installing the dependency.
2024-02-29[lldb] Add pexpect to LLDB_ENFORCE_STRICT_TEST_REQUIREMENTSJonas Devlieghere1-1/+2
This executed Alex' idea [1] of adding pexpect to the list of "strict test requirements" as we're planning to stop vendoring it. This will ensure all the bots have the package before we toggle the default. [1] https://github.com/llvm/llvm-project/pull/83191
2024-02-29[lldb][test] Use pexpect spawn instead of spawnuDavid Spickett2-3/+4
This is marked deprecated from at least 4.6 onward: Deprecated: pass encoding to spawn() instead.
2024-02-29[lldb][test] Clear pexpect found var before checking againDavid Spickett1-0/+1
If you run cmake without pexpect installed it errors as expected. However, if you just `pip install pexpect` and cmake again it still doesn't find it because it cached the result of the search. Unset the result before looking for pexpect. So that this works as expected: cmake ... pip3 install pexpect cmake ...
2024-02-29[LLDB] Fix test failure introduced by #83234 (#83406)Sudharsan Veeravalli1-1/+1
Missed adding a . in the test check
2024-02-29[LLDB] Fix crash when using tab completion on class variables (#83234)Sudharsan Veeravalli3-9/+18
We weren't checking to see if the partial_path was empty before adding completions and this led to crashes when the class object and a variable both start with the same substring. Fixes [#81536](https://github.com/llvm/llvm-project/issues/81536) --------- Co-authored-by: Michael Buch <michaelbuch12@gmail.com>
2024-02-28Revert "[lldb] Add pexpect to LLDB_ENFORCE_STRICT_TEST_REQUIREMENTS"Jonas Devlieghere1-2/+1
This reverts commit 793300988b7c723bacadce67879ea8bf71c87e70 as pexpect is not available on any of the GreenDragon bots.
2024-02-28[lldb] Add pexpect to LLDB_ENFORCE_STRICT_TEST_REQUIREMENTSJonas Devlieghere1-1/+2
This executed Alex' idea [1] of adding pexpect to the list of "strict test requirements" as we're planning to stop vendoring it. This will ensure all the bots have the package before we toggle the default. [1] https://github.com/llvm/llvm-project/pull/83191
2024-02-28Fix interactive use of "command script add". (#83350)jimingham3-1/+19
There was a think-o in a previous commit that made us only able to define 1 line commands when using command script add interactively. There was also no test for this feature, so I fixed the think-o and added a test.
2024-02-28[lldb] Ignore swig warnings about shadowed overloads (#83317)Alex Langford1-1/+5
This specifically addresses the warnings: $LLVM/lldb/include/lldb/API/SBCommandReturnObject.h:119: Warning 509: Overloaded method lldb::SBCommandReturnObject::PutCString(char const *) effectively ignored, $LLVM/lldb/include/lldb/API/SBCommandReturnObject.h:119: Warning 509: as it is shadowed by lldb::SBCommandReturnObject::PutCString(char const *,int). There is exactly one declaration of SBCommandReturnObject::PutCString. The second parameter (of type `int`) has default value `-1`. Without investigating why SWIG believes there are 2 method declarations, I believe it is safe to ignore this warning. It does not appear to actually impact functionality in any way. rdar://117744660
2024-02-28Change `image list -r` so that it actually shows the ref count and whether ↵jimingham2-4/+8
the image is in the shared cache. (#83341) The help for the `-r` option to `image list` says: -r[<width>] ( --ref-count=[<width>] ) Display the reference count if the module is still in the shared module cache. but that's not what it actually does. It unconditionally shows the use_count for all Module shared pointers, regardless of whether they are still in the shared module cache or whether they are just in the ModuleCollection and other entities are keeping them alive. That seems like a more useful behavior, but then it is also useful to know what's in the shared cache, so I changed this to: -r[<width>] ( --ref-count=[<width>] ) Display whether the module is still in the the shared module cache (Y/N), and its shared pointer use_count. So instead of just `{5}` you will see `{Y 5}` if it is in the shared cache and `{N 5}` if not. I didn't add tests for this because I'm not sure how much we want to fix shared cache behavior in the testsuite.