summaryrefslogtreecommitdiff
path: root/lldb/test/API/python_api
AgeCommit message (Collapse)Author
2022-01-27[lldb/test] Try to fix TestSBModule failureMed Ismail Bennani
This should fix https://lab.llvm.org/buildbot/#/builders/68/builds/25571 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2022-01-26[lldb/API] Add ability to check if module is backed by a file on diskMed Ismail Bennani
This patch introduces a new SBAPI method: `SBModule::IsFileBacked` As the name suggests, it tells the user if the module's object file is on disk or in memory. rdar://68538278 Differential Revision: https://reviews.llvm.org/D118261 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2022-01-19[lldb] Introduce SBPlatform::SetSDKRootPavel Labath
It complements the existing SBDebugger::SetCurrentPlatformSDKRoot and allows one to set the sysroot of a platform without making it current. Differential Revision: https://reviews.llvm.org/D117550
2022-01-10[lldb] Disable several lldb tests that are flaky on WindowsStella Stamenova
This tests have recently become flaky (flakier?) causing occasional failures in the windows lldb buildbot
2022-01-09[lldb] Check for arm64 in TestDisassembleRawDataDave Lee
This test checks for `aarch64` but the lit config could also contain `arm64`. This change adds `arm64` to make the test pass in all cases. Differential Revision: https://reviews.llvm.org/D116912
2021-12-13[lldb/API] Add SetDataWithOwnership method to SBDataMed Ismail Bennani
This patch introduces a new method to SBData: SetDataWithOwnership. Instead of referencing the pointer to the data, this method copies the data buffer into lldb's heap memory. This can prevent having the underlying DataExtractor object point to freed/garbage-collected memory. Differential Revision: https://reviews.llvm.org/D115652 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2021-12-02[lldb] Skip two lldb tests on Windows because they are flakyStella Stamenova
These tests work fine with VS2017, but become more flaky with VS2019 and the buildbot is about to get upgraded. Differential Revision: https://reviews.llvm.org/D114907
2021-11-25[lldb] Fix TestFileHandle.pyPavel Labath
- remove the decorator which is no longer available in main - remove dependence on revision number, which are not available in all builds
2021-11-24Fixed use of -o and -k in LLDB under Windows when statically compiled with ↵Levon Ter-Grigoryan
vcruntime. Right now if the LLDB is compiled under the windows with static vcruntime library, the -o and -k commands will not work. The problem is that the LLDB create FILE* in lldb.exe and pass it to liblldb.dll which is an object from CRT. Since the CRT is statically linked each of these module has its own copy of the CRT with it's own global state and the LLDB should not share CRT objects between them. In this change I moved the logic of creating FILE* out of commands stream from Driver class to SBDebugger. To do this I added new method: SBError SBDebugger::SetInputStream(SBStream &stream) Command to build the LLDB: cmake -G Ninja -DLLVM_ENABLE_PROJECTS="clang;lldb;libcxx" -DLLVM_USE_CRT_RELEASE="MT" -DLLVM_USE_CRT_MINSIZEREL="MT" -DLLVM_USE_CRT_RELWITHDEBINFO="MT" -DP YTHON_HOME:FILEPATH=C:/Python38 -DCMAKE_C_COMPILER:STRING=cl.exe -DCMAKE_CXX_COMPILER:STRING=cl.exe ../llvm Command which will fail: lldb.exe -o help See discord discussion for more details: https://discord.com/channels/636084430946959380/636732809708306432/854629125398724628 This revision is for the further discussion. Reviewed By: teemperor Differential Revision: https://reviews.llvm.org/D104413
2021-10-15[NFC] fix a typoShao-Ce SUN
2021-09-30[lldb] Remove support for replaying the test suite from a reproducerJonas Devlieghere
This patch removes the infrastructure to replay the test suite from a reproducer, as well as the modifications made to the individual tests.
2021-07-16[lldb] Add AllocateMemory/DeallocateMemory to the SBProcess APIPeter S. Housel
This change adds AllocateMemory and DeallocateMemory methods to the SBProcess API, so that clients can allocate and deallocate memory blocks within the process being debugged (for storing JIT-compiled code or other uses). (I am developing a debugger + REPL using the API; it will need to store JIT-compiled code within the target.) Reviewed By: clayborg, jingham Differential Revision: https://reviews.llvm.org/D105389
2021-06-05Revert "[LLDB/API] Expose args and env from SBProcessInfo."Bruce Mitchener
This reverts commit 8d33437d030af27fff21dd3fd0e66893b0148217. This broke one of the buildbots.
2021-06-05[LLDB/API] Expose args and env from SBProcessInfo.Bruce Mitchener
This is another step towards implementing the equivalent of `platform process list` and related functionality. `uint32_t` is used for the argument count and index despite the underlying value being `size_t` to be consistent with other index-based access to arguments. Differential Revision: https://reviews.llvm.org/D103675
2021-06-02[lldb/API] Expose triple for SBProcessInfo.Bruce Mitchener
This is present when doing a `platform process list` and is tracked by the underlying code. To do something like the process list via the SB API in the future, this must be exposed. Differential Revision: https://reviews.llvm.org/D103375
2021-04-13[lldb][Arm/AArch64] Add basic disassemble tests for Arm/AArch64David Spickett
Previously the test would fail if you built on Arm/AArch64 but did not have the x86 llvm backend enabled. Reviewed By: omjavaid Differential Revision: https://reviews.llvm.org/D100192
2021-04-04[lldb] Replace unneeded use of Foundation with ObjectiveC in tests (NFC)Dave Lee
When referencing `NSObject`, it's enough to import `objc/NSObject.h`. Importing `Foundation` is unnecessary in these cases. Differential Revision: https://reviews.llvm.org/D99867
2021-03-05[lldb/API] Add CommandInterpreter::{Get,Set}PrintErrors to SBAPI (NFC)Med Ismail Bennani
This patch exposes the getter and setter methods for the command interpreter `print_errors` run option. rdar://74816984 Differential Revision: https://reviews.llvm.org/D98001 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2021-02-08[lldb/tests] Removed add_test_categories decorator for python API tests, NFCTatyana Krasnukha
There is a .categories file in the python_api directory that makes all nested tests belong to the category "pyapi". The decorator is unnecessary for these tests.
2021-02-08Reland "[lldb] Make CommandInterpreter's execution context the same as ↵Tatyana Krasnukha
debugger's one"
2021-02-03[lldb] Convert more assertTrue to assertEqual (NFC)Dave Lee
Follow up to D95813, this converts multiline assertTrue to assertEqual. Differential Revision: https://reviews.llvm.org/D95899
2021-02-02[lldb] Convert assertTrue(a == b) to assertEqual(a, b)Dave Lee
Convert `assertTrue(a == b)` to `assertEqual(a, b)` to produce better failure messages. These were mostly done via regex search & replace, with some manual fixes. Differential Revision: https://reviews.llvm.org/D95813
2021-02-02Revert "[lldb] Use current execution context in SBDebugger"Raphael Isemann
This reverts commit 754ab803b8dc659e3645d369d1b5d6d2f97be29e. As pointed out in https://reviews.llvm.org/D95761, this patch could lead to having the wrong execution context in some situations (thanks Jim!). D92164 is addressing the same issue and will replace this patch, so I'll revert this one.
2021-02-01[lldb/test] Skip `SBTarget::IsLoaded` test on windows (NFC)Med Ismail Bennani
This patch skips the test for the SBTarget::IsLoaded method on windows since the logic is different. Differential Revision: https://reviews.llvm.org/D95686 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2021-02-01[lldb] Use current execution context in SBDebuggerAndy Yankovsky
Use `GetSelectedExecutionContext()` instead of `GetCommandInterpreter().GetExecutionContext()` in `SBDebugger::GetInternalVariableValue/SBDebugger::SetInternalVariable`. The execution context in the command interpreter might be empty, if no commands has been executed yet (it is updated only when handling commands or completions -- e.g. https://github.com/llvm/llvm-project/blob/main/lldb/source/Interpreter/CommandInterpreter.cpp#L1855). Reviewed By: teemperor Differential Revision: https://reviews.llvm.org/D95761
2021-02-01[lldb/API] Expose Module::IsLoadedInTarget() to SB API (NFC)Med Ismail Bennani
This patch adds an `SBTarget::IsLoaded(const SBModule&) const` endpoint to lldb's Scripting Bridge API. As the name suggests, it will allow the user to know if the module is loaded in a specific target. rdar://37957625 Differential Review: https://reviews.llvm.org/D95686 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2021-01-26Make SBDebugger::CreateTargetWithFileAndArch work with lldb::LLDB_DEFAULT_ARCHJim Ingham
Second try, handling both a bogus arch string and the "null file & arch" used to create an empty but valid target. Also check in that case before logging (previously the logging would have crashed.)
2021-01-25Revert "Fix SBDebugger::CreateTargetWithFileAndArch to accept ↵Richard Smith
LLDB_ARCH_DEFAULT." Also revert "Follow on to: f05dc40c31d1883b46b8bb60547087db2f4c03e3" After these changes, multiple lldb tests are failing. Calls to CreateTargetWithFileAndArch(None, None) appear to fail after these changes. This reverts commit f05dc40c31d1883b46b8bb60547087db2f4c03e3 and 1fba21778f84f266f7d32153c88e59e1900fbe5b.
2021-01-25Fix SBDebugger::CreateTargetWithFileAndArch to accept LLDB_ARCH_DEFAULT.Jim Ingham
The API docs in SBDebugger.i claim this should work but it doesn't. This should fix it. Differential Revision: https://reviews.llvm.org/D95164
2021-01-06[lldb] Skip scoped enum checks with Dwarf <4Jonas Devlieghere
The scoped enum tests depend on DW_AT_enum_class which was added in Dwarf 4. I made part of the test conditional on the Dwarf version instead of splitting it into a separate test and using the decorator to avoid the overhead of setting up the test.
2021-01-02[Process/NetBSD] Copy changes from FreeBSDRemote and reformatMichał Górny
Copy changes, including: - NativeProcessNetBSD::GetLoadedModuleFileSpec() and NativeProcessNetBSD::GetFileLoadAddress() methods - split x86 register sets by CPU extensions - use offset/size-based register reading/writing Differential Revision: https://reviews.llvm.org/D93541
2020-12-22[lldb] Add SBType::GetEnumerationIntegerType methodAndy Yankovsky
Add a method for getting the enumeration underlying type. Differential revision: https://reviews.llvm.org/D93696
2020-12-22[lldb] Add SBType::IsScopedEnumerationType methodAndy Yankovsky
Add a method to check if the type is a scoped enumeration (i.e. "enum class/struct"). Differential revision: https://reviews.llvm.org/D93690
2020-12-20[lldb] [test] Update test status for NetBSDMichał Górny
2020-12-17Revert "[lldb] Make CommandInterpreter's execution context the same as ↵Pavel Labath
debugger's one." This reverts commit a01b26fb51c710a3a8ef88cc83b0701461f5b9ab, because it breaks the "finish" command in some way -- the command does not terminate after it steps out, but continues running the target. The exact blast radius is not clear, but it at least affects the usage of the "finish" command in TestGuiBasicDebug.py. The error is *not* gui-related, as the same issue can be reproduced by running the same steps outside of the gui. There is some kind of a race going on, as the test fails only 20% of the time on the buildbot.
2020-12-12[lldb] Make CommandInterpreter's execution context the same as debugger's one.Tatyana Krasnukha
Currently, the interpreter's context is not updated until a command is executed. This has resulted in the behavior of SB-interface functions and some commands depends on previous user actions. The interpreter's context can stay uninitialized, point to a currently selected target, or point to one of previously selected targets. This patch removes any usages of CommandInterpreter::UpdateExecutionContext. CommandInterpreter::HandleCommand* functions still may override context temporarily, but now they always restore it before exiting. CommandInterpreter saves overriden contexts to the stack, that makes nesting commands possible. Added test reproduces one of the issues. Without this fix, the last assertion fails because interpreter's execution context is empty until running "target list", so, the value of the global property was updated instead of process's local instance. Differential Revision: https://reviews.llvm.org/D92164
2020-12-07[lldb] [test] Link FreeBSD test failures to bugsMichał Górny
Differential Revision: https://reviews.llvm.org/D92740
2020-11-11[lldb][test] Remove not_remote_testsuite_ready in favor of skipIfRemote ↵Raphael Isemann
decorator Those two decorators have identical behaviour. This removes `not_remote_testsuite_ready` as `skipIfRemote` seems more consistent with the other decorator names we have Reviewed By: JDevlieghere Differential Revision: https://reviews.llvm.org/D89376
2020-11-10[lldb] [Process/NetBSD] Copy the recent improvements from FreeBSDMichał Górny
Copy the recent improvements from the FreeBSDRemote plugin, notably: - moving event reporting setup into SetupTrace() helper - adding more debug info into SIGTRAP handling - handling user-generated (and unknown) SIGTRAP events - adding missing error handling to the generic signal handler - fixing attaching to processes - switching watchpoint helpers to use llvm::Error - minor style and formatting changes This fixes a number of tests, mostly related to fixed attaching. Differential Revision: https://reviews.llvm.org/D91167
2020-11-10[lldb] [test] Rename '.categories' to 'categories'Michał Górny
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-10[lldb] [test] Skip ObjC-based tests via 'objc' categoryMichał Górny
Replace the plethora of ObjC-implied 'skipUnlessDarwin' decorators with marking tests as 'objc' category (whenever missing), and skip all ObjC tests on non-Darwin platforms. I have used '.categories' file wherever it was present already or all (>1) tests were relying on ObjC, and explicit add_test_categories() where there was only one test. Differential Revision: https://reviews.llvm.org/D91056
2020-11-07[lldb] [test] Use skipUnlessDarwin for tests specific to DarwinMichał Górny
Use skipUnlessDarwin decorator for tests that are specific to Darwin, instead of skipIf... for all other platforms. This should make it clear that these tests are not supposed to work elsewhere. It will also make these tests stop repeatedly popping up while I look for tests that could be fixed on the platform in question. Differential Revision: https://reviews.llvm.org/D91003
2020-11-05[lldb] Enable FreeBSDRemote plugin by default and update test statusMichał Górny
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] Remove xfail from tests that pass on FreeBSDMichał Górny
2020-11-03Return actual type from SBType::GetArrayElementTypeAndy Yankovsky
SBType::GetArrayElementType should return the actual type, not the canonical type (e.g. int32_t, not the underlying int). Added a test case to validate the new behavior. I also ran all other tests on Linux (ninja check-lldb), they all pass. Differential revision: https://reviews.llvm.org/D90318
2020-10-26Fix SBError::SetErrorToGenericErrorAndy Yankovsky
`SBError::SetErrorToGenericError` should call `Status::SetErrorToGenericError`, not `Status::SetErrorToErrno`. Reviewed By: teemperor Differential Revision: https://reviews.llvm.org/D90151
2020-10-22[lldb] Fix TestTargetAPI.py on Apple simulatorsRaphael Isemann
This test checks that the output of `SBTarget.GetDescription()` contains the substrings `'a.out', 'Target', 'Module', 'Breakpoint'` in that order. This test is currently failing on Apple simulators as apparently 'Module' can't be found in the output after 'Target". The reason for that is that the actual output of `SBTarget.GetDescription()` looks like this: ``` Target Module /build/path/lldb-test-build.noindex/python_api/target/TestTargetAPI.test_get_description_dwarf/a.out 0x7ff2b6d3f990: ObjectFileMachO64, file = /build/path/lldb-test-build.noindex/python_api/target/TestTargetAPI.test_get_description [...] 0x7ff307150000: BreakpointList with 0 Breakpoints: <LLDB module output repeats for each loaded module> ``` Clearly the string order should be `'Target', 'Module', 'a.out', 'Breakpoint'`. However, LLDB is also a bunch of system shared libraries (libxpc.dylib, libobjc.A.dylib, etc.) when *not* running against a simulator, we end up unintentionally finding the `'Target', 'Module', 'Breakpoint'` substrings in the trailing descriptions of the system modules. When running against a simulator we however don't load shared system libraries. This patch just moves the substrings in the correct order to make this test pass without having any shared library modules in the description output. Reviewed By: JDevlieghere Differential Revision: https://reviews.llvm.org/D89698
2020-10-15Add an SB API to get the SBTarget from an SBBreakpointJim Ingham
Differential Revision: https://reviews.llvm.org/D89358
2020-09-30Fix crash in SBStructuredData::GetDescription() when there's no ↵Jim Ingham
StructuredDataPlugin. Also, use the StructuredData::Dump method to print the StructuredData if there is no plugin, rather than just returning an error. Differential Revision: https://reviews.llvm.org/D88266
2020-08-17[lldb] Skip test_launch_simple with reproducersJonas Devlieghere
The test checks the inferior's output. During replay the binary doesn't actually run and the output isn't captured by the reproducers.