aboutsummaryrefslogtreecommitdiff
path: root/lldb/test/API/api
AgeCommit message (Collapse)AuthorFilesLines
2026-01-09[lldb] Fix TestMultithreaded.py when libc++ symbols are present (#174664)Alex Langford2-3/+7
There are a few test cases in TestMultithreaded.py. Most of them set a breakpoint by name on "next". There's no problem with doing that, but one of the tests cases in particular relies on being able to grab a specific breakpoint location corresponding to the test inferior. If you have libc++ symbols, this test will also have breakpoint locations for symbols named `next` in libc++. I could have changed the test to find the correct `next` breakpoint location, but it seems easier to give it a more uncommon name instead.
2025-06-13[lldb] Include unistd.h for _exit in multi-process-driver.cppJonas Devlieghere1-1/+2
This test fails to build on macOS without the correct header include.
2025-06-13[lldb][test] Disable TestMultipleDebuggers againDavid Spickett1-0/+4
I did manage to turn a crash into a non-zero return code, but on the very first build it managed to time out. I thought I had the appetite to tweak timeouts but on second thought, I don't want yet another test to look out for. The test is not wrong, but on heavily loaded machines it's always going to be inherently unstable.
2025-06-13[lldb][test] Don't call SBDebugger::Terminate if TestMultipleDebuggers times ↵David Spickett2-4/+5
out (#143732) Fixes #101162 This test did this: * SBDebugger::Initialize * Spawn a bunch of threads that do: * SBDebugger::Create * some work * SBDebugger::Destroy * Wait on those threads to finish then call SBDebugger::Terminate and exit, or - * Reach a time limit before all the threads finish, call SBDebugger::Terminate and exit. The problem was that in the timeout case, calling SBDebugger::Terminate destroys data being used by threads that are still running. I expect this test was expecting said threads to be so broken they were probably stuck, but when the machine is just heavily loaded, one of them might read that data before the whole program exits. This means what should have been a timeout becomes a crash. Sometimes. Which explains why we saw both timeouts and various signals on the AArch64 Linux bot. It depends on the timings. So I'm changing it not to call SBDebugger::Terminate in the timeout case. We will have to tweak the timeout value based on what happens on the buildbot, but we will know it's machine load not an lldb bug. Also use _exit instead of exit, to skip more cleanup that might cause a crash.
2025-05-27[lldb][NFC] update API tests which skip/expect-fail armJason Molenda1-1/+1
The architectures provided to skipIf / expectedFail are regular expressions (v. _match_decorator_property() in decorators.py so on Darwin systems "arm64" would match the skips for "arm" (32-bit Linux). Update these to "arm$" to prevent this, and also update three tests (TestBuiltinFormats.py, TestCrossDSOTailCalls.py, TestCrossObjectTailCalls.py) that were skipped for arm64 via this behavior, and need to be skipped or they will fail. This was moviated by the new TestDynamicValue.py test which has an expected-fail for arm, but the test was passing on arm64 Darwin resulting in failure for the CIs.
2025-02-19[lldb] Store the return SBValueList in the CommandReturnObject (#127566)Jonas Devlieghere1-0/+13
There are a lot of lldb commands whose result is really one or more ValueObjects that we then print with the ValueObjectPrinter. Now that we have the ability to access the SBCommandReturnObject through a callback (#125006), we can store the resultant ValueObjects in the return object, allowing an IDE to access the SBValues and do its own rich formatting. rdar://143965453
2025-02-09[lldb] Merge TestSBCommandReturnObject testsJonas Devlieghere1-0/+9
In #125132, Michael pointed out that there are now two tests with the same name: ./lldb/test/API/api/command-return-object/TestSBCommandReturnObject.py ./lldb/test/API/python_api/commandreturnobject/TestSBCommandReturnObject.py
2024-12-12Convert the StackFrameList mutex to a shared mutex. (#117252)jimingham3-2/+123
In fact, there's only one public API in StackFrameList that changes the list explicitly. The rest only change the list if you happen to ask for more frames than lldb has currently fetched and that always adds frames "behind the user's back". So we were much more prone to deadlocking than we needed to be. This patch uses a shared_mutex instead, and when we have to add more frames (in GetFramesUpTo) we switches to exclusive long enough to add the frames, then goes back to shared. Most of the work here was actually getting the stack frame list locking to not require a recursive mutex (shared mutexes aren't recursive). I also added a test that has 5 threads progressively asking for more frames simultaneously to make sure we get back valid frames and don't deadlock.
2024-09-04[lldb][test] Disable TestMultipleDebuggers on LinuxDavid Spickett1-0/+1
This used to timeout (https://github.com/llvm/llvm-project/issues/101162) now it's aborting (https://github.com/llvm/llvm-project/pull/105765#issuecomment-2327645665)
2024-07-31[lldb][test] Fix TestMultipleDebuggers test on non-x86, other small issues ↵David Spickett2-18/+28
(#101169) This test has been flaky lately (https://github.com/llvm/llvm-project/issues/101162) and I disabled it everywhere initially. I found that it always uses "x86_64" for the program architecture so the test was "passing" elsewhere but I don't think it was meant to. So I have added a define to pass on the host's architecture when compiling. This makes it work on AArch64 as well. While I'm here I've fixed the uint64_t formatting warnings by using the defined formats that'll work everywhere. In addition, I found that the function names include "()" on Linux, so now we check for "foo" or "foo()". The test cpp file has never been, or was only partially formatted so I've not formatted the changes, just kept to the local style. I've removed the Linux skip to see if any of this helps the timeouts, and to verify the build command changes. If the timeouts come back I'll disable it again.
2024-07-10[lldb][test] Disable flakey TestMultipleDebuggers on LinuxDavid Spickett1-0/+3
This has been flakey lately on Linux on the buildbots and in CI on PRs. For example: https://lab.llvm.org/buildbot/#/builders/59/builds/1324 https://github.com/llvm/llvm-project/pull/98237 I will try to track down the cause tomorrow.
2024-06-20[lldb] Give more time to test/API/multiple-debuggersAdrian Prantl1-25/+30
This test occasionally fails on two of the busiest CI bots (asan and matrix), and we can't reproduce it locally. This leads to the hypothesis that the test is timing out (in the sense of the number of "join attempts" performed by this test's driver). This commit doubles the number of iterations performed and also does an NFC refactor of the main test loop so that it can be more easily understood.
2024-02-16[lldb] Don't overwrite the dynamic loader library path for "driver tests"Jonas Devlieghere5-75/+21
We have a handful of tests that build a driver which links against LLDB. When running those binaries, we overwrite the dynamic loader library path to point to the build directory's libs dir, presumably to make sure we load LLDB from there. This above becomes an issue when you have libc++ enabled and the driver is linked against the system's libc++, but the dynamic loader flag forces it to pick up libc++ from the libs dir. We could try to make the logic for building the driver smarter and have it pick up the just-built libc++ like we do for our test binaries, but I don't think we need to overwrite the library path in the first place. The build logic to build these drivers already takes care to set the correct RPATH in the linker. This patch removes the logic and simplifies the tests.
2024-02-16[lldb] Fix and rename skipIfHostIncompatibleWithRemoteJonas Devlieghere4-1/+9
Fix and rename the broken and confusingly named decorator skipIfHostIncompatibleWithRemote. The decorator is meant to skip test which uses the inferior test build system (i.e. to build test inferiors) to build host binaries (e.g. lldb drivers). The decorator was broken on macOS, where the host and target platform report macosx, but the decorator overwrote it with Darwin, resulting in tests incorrectly being skipped. The decorator was also missing on a handful of tests that use the buildDriver helper, which this commit fixes as well.
2024-01-26[lldb] Remove obsolete signBinary helper (#79656)Jonas Devlieghere4-4/+0
On Darwin, the Makefile already (ad-hoc) signs everything it builds. There's also no need to use lldb_codesign for this.
2023-12-04[lldb] Additional pieces towards OpenBSD support (#74198)Brad Smith1-1/+2
2023-08-16Replace the singleton "ShadowListener" with a primary and N secondary ListenersJim Ingham1-1/+0
Before the addition of the process "Shadow Listener" you could only have one Listener observing the Process Broadcaster. That was necessary because fetching the Process event is what switches the public process state, and for the execution control logic to be manageable you needed to keep other listeners from causing this to happen before the main process control engine was ready. Ismail added the notion of a "ShadowListener" - which allowed you ONE extra process listener. This patch inverts that setup by designating the first listener as primary - and giving it priority in fetching events. Differential Revision: https://reviews.llvm.org/D157556
2023-05-25[NFC][Py Reformat] Reformat python files in lldbJonas Devlieghere8-111/+174
This is an ongoing series of commits that are reformatting our Python code. Reformatting is done with `black` (23.1.0). If you end up having problems merging this commit because you have made changes to a python file, the best way to handle that is to run `git checkout --ours <yourfile>` and then reformat it with black. RFC: https://discourse.llvm.org/t/rfc-document-and-standardize-python-code-style Differential revision: https://reviews.llvm.org/D151460
2023-03-17[lldb] Enable TestPublicAPIHeaders.py on Apple SiliconAlex Langford1-10/+3
This cleans up the test a bit and enables it to run on apple silicon machines.
2023-03-02Revert "Add SBValue::GetValueAsAddress API for removing non-addressing metadata"Jason Molenda3-86/+0
Revert while I investigate two CI bot failures; the more important is the lldb-arm-ubuntu where the FixAddress is removing the 0th bit so we're adding the `actual=` decorator on a string pointer, ``` Got output: (char *) strptr = 0x00400817 (actual=0x400816) ptr = [{ },{H}] ``` in TestDataFormatterSmartArray.py line 229. This reverts commit 4d635be2dbadc77522eddc9668697385a3b9f8b4.
2023-03-02Add SBValue::GetValueAsAddress API for removing non-addressing metadataJason Molenda3-0/+86
On target where metadata is stored in bits that aren't used for virtual addressing -- AArch64 Top Byte Ignore and pointer authentication are two examples -- an SBValue object representing a pointer will return the address with metadata for SBValue::GetValueAsUnsigned. Users may want to get the virtual address without the metadata; this new method gives them a way to do this. Differential Revision: https://reviews.llvm.org/D142792
2023-02-10[lldb] Fix passing None as an env variable in TestMultipleDebuggersAugusto Noronha1-3/+6
2023-02-10Adapt TestCustomShell and TestMultipleDebuggers to run under ASANAugusto Noronha1-1/+3
In situations where only LLDB is ASANified, a false positive occurs unless ASAN_OPTIONS=detect_container_overflow=0 is set in the environment. Differential Revision: https://reviews.llvm.org/D143772
2022-11-17[test] Allow skipTestIfFn to apply to entire classes for skipIfNoSBHeadersJordan Rupprecht2-7/+2
Some test cases are already marked @skipIfNoSBHeaders, but they make use of SBAPI headers in test setup. The setup will fail if the headers are missing, so it is too late to wait until the test case to apply the skip annotation. In addition to allowing this to apply to entire classes, I also changed all the existing annotations from test cases to test classes where necessary/appropriate. Reviewed By: DavidSpickett Differential Revision: https://reviews.llvm.org/D138181
2022-11-11[lldb] Rewrite to assertEqual/assertNotEqual (NFC)Dave Lee1-4/+4
Using the more specific assert* methods results in more useful error message.
2022-09-12[lldb] Add SBBreakpointLocation::SetCallbackLaura Chaparro-Gutierrez2-0/+62
* Include SetCallback in SBBreakpointLocation, similar as in SBBreakpoint. * Add test_breakpoint_location_callback test as part of TestMultithreaded. Reviewed By: werat, JDevlieghere Differential Revision: https://reviews.llvm.org/D133689 Co-authored-by: Andy Yankovsky <weratt@gmail.com>
2022-08-15[LLDB] Remove __future__ imports from testsDavid Spickett5-14/+0
Not needed now that we require python 3. Reviewed By: kastiglione, JDevlieghere Differential Revision: https://reviews.llvm.org/D131761
2022-08-11[lldb] Remove uses of six module (NFC)Dave Lee1-2/+0
With lldb (& llvm) requiring Python 3.6+, use of the `six` module can be removed. Differential Revision: https://reviews.llvm.org/D131304
2022-06-17[lldb][tests] Automatically call compute_mydir (NFC)Dave Lee7-14/+0
Eliminate boilerplate of having each test manually assign to `mydir` by calling `compute_mydir` in lldbtest.py. Differential Revision: https://reviews.llvm.org/D128077
2022-06-08[lldb] Update TestMultithreaded to report FAIL for a non-zero exit codeJonas Devlieghere1-6/+9
A non-zero exit code from the test binary results in a CalledProcessError. Without catching the exception, that would result in a error (unresolved test) instead of a failure. This patch fixes that.
2022-06-07[LLDB] Remove decorator from XPASSes AArch64/WindowsMuhammad Omair Javaid2-2/+2
This patch remove XFAIL decorator from tests which as passing on AArch64 Windows. This is tested on surface pro x using tot llvm and clang 14.0.3 as compiler with visual studio 2019 x86_arm64 environment.
2022-03-04[LLDB] Remove cases of using namespace stdShafik Yaghmour1-2/+2
We had using namespace std; sprinkled around several source files and tests. Differential Revision: https://reviews.llvm.org/D120966
2021-09-30[lldb] Remove support for replaying the test suite from a reproducerJonas Devlieghere1-3/+0
This patch removes the infrastructure to replay the test suite from a reproducer, as well as the modifications made to the individual tests.
2021-05-24[lldb] Introduce createTestTarget for creating a valid target in API testsRaphael Isemann1-9/+3
At the moment nearly every test calls something similar to `self.dbg.CreateTarget(self.getBuildArtifact("a.out"))` and them sometimes checks if the created target is actually valid with something like `self.assertTrue(target.IsValid(), "some useless text")`. Beside being really verbose the error messages generated by this pattern are always just indicating that the target failed to be created but now why. This patch introduces a helper function `createTestTarget` to our Test class that creates the target with the much more verbose `CreateTarget` overload that gives us back an SBError (with a fancy error). If the target couldn't be created the function prints out the SBError that LLDB returned and asserts for us. It also defaults to the "a.out" build artifact path that nearly all tests are using to avoid to hardcode "a.out" in every test. I converted a bunch of tests to the new function but I'll do the rest of the test suite as follow ups. Reviewed By: JDevlieghere Differential Revision: https://reviews.llvm.org/D102771
2021-02-16[LLDB] Skip TestMultipleTargets.py on Arm/AArch64 LinuxMuhammad Omair Javaid1-0/+1
TestMultipleTargets.py fails randomly on Arm/AArch64 Linux buildbot with no reasonable clues. I am marking it skipped for avoiding LLDB buildbot failures due to this test.
2021-02-03[lldb] Convert more assertTrue to assertEqual (NFC)Dave Lee1-4/+4
Follow up to D95813, this converts multiline assertTrue to assertEqual. Differential Revision: https://reviews.llvm.org/D95899
2020-12-20[lldb] [test] Update test status for NetBSDMichał Górny1-0/+1
2020-12-17[lldb] [POSIX-DYLD] Add libraries from initial rendezvous brkpt hitMichał Górny1-1/+0
Explicitly consider the libraries reported on the initial rendezvous breakpoint hit added. This is necessary on FreeBSD since the dynamic loader issues only a single 'consistent' state rendezvous breakpoint hit for all the libraries present in DT_NEEDED. It is also helpful on Linux where it ensures that ld-linux is considered loaded as well as the shared system libraries reported afterwards. Reenable memory maps on FreeBSD since this fixed the issue triggered by them. Differential Revision: https://reviews.llvm.org/D92187
2020-12-07Revert "[lldb] [POSIX-DYLD] Add libraries from initial eTakeSnapshot action"Michał Górny1-0/+1
This reverts commit 09b08833f301ea375137931d26b7193101f82ceb. This code is wrong on Linux, and causes ld-linux and linux-vdso to be reported twice. I need to work on it more.
2020-12-07[lldb] [POSIX-DYLD] Add libraries from initial eTakeSnapshot actionMichał Górny1-1/+0
Explicitly consider the libraries reported on the initial eTakeSnapshot action added, through adding them to the added soentry list in DYLDRendezvous::SaveSOEntriesFromRemote(). This is necessary on FreeBSD since the dynamic loader issues only a single 'consistent' state rendezvous breakpoint hit for all the libraries present in DT_NEEDED (while Linux issues an added-consistent event pair). Reenable memory maps on FreeBSD since this fixed the issue triggered by them. Differential Revision: https://reviews.llvm.org/D92187
2020-12-07[lldb] [test] Link FreeBSD test failures to bugsMichał Górny1-1/+1
Differential Revision: https://reviews.llvm.org/D92740
2020-11-18[lldb] [test] Un-XFAIL TestMultipleDebuggers.pyMichał Górny1-1/+0
This test is flaky, and for the time being we do not mark them as XFAIL.
2020-11-10[lldb] [test] Rename '.categories' to 'categories'Michał Górny1-0/+0
Make category-specifying files visible. There is really no good reason to keep them hidden, and having them visible increases the chances that someone will actually spot them. Differential Revision: https://reviews.llvm.org/D91065
2020-11-05[lldb] Enable FreeBSDRemote plugin by default and update test statusMichał Górny1-1/+1
The new FreeBSDRemote plugin has reached feature parity on i386 and amd64 targets. Use it by default on these architectures, while allowing the use of the legacy plugin via FREEBSD_LEGACY_PLUGIN envvar. Revisit the method of switching plugins. Apparently, the return value of PlatformFreeBSD::CanDebugProcess() is what really decides whether the legacy or the new plugin is used. Update the test status. Reenable the tests that were previously disabled on FreeBSD and do not cause hangs or are irrelevant to FreeBSD. Mark all tests that fail reliably as expectedFailure. For now, tests that are flaky (i.e. produce unstable results) are left enabled and cause unpredictable test failures. Differential Revision: https://reviews.llvm.org/D90757
2020-11-03[lldb] [test] Update XFAILs/skips for FreeBSDMichał Górny2-0/+2
Update expected failures and test skips based on common results for the old and new FreeBSD plugins.
2020-11-03[lldb] [test] Remove xfail from tests that pass on FreeBSDMichał Górny1-1/+1
2020-10-29Provide a reasonable value for PATH_MAX if the lldb headers don't provide it.Jim Ingham1-0/+4
2020-10-29Mark the execution of stop-hooks as non-interactive.Jim Ingham3-0/+173
The intention is not to allow stop-hook commands to query the user, so this is correct. It also works around a deadlock in switching to the Python Session to execute python based commands in the stop hook when the Debugger stdin is backed by a FILE *. Differential Revision: https://reviews.llvm.org/D90332
2020-08-21[lldb] Fix TestAPILog.py for reproducer replayJonas Devlieghere1-8/+3
With the log file being a build artifact we don't need to clean it up. If this happens before the reproducer is captured, the file will be missing from the reproducer root but being part of the mapping.
2020-08-17[lldb] Skip TestMultipleDebuggers on WindowsJonas Devlieghere1-0/+1