summaryrefslogtreecommitdiff
path: root/lldb/bindings
Commit message (Collapse)AuthorAgeFilesLines
* [lldb] Fix lua build after 27b6a4e63afeAlex Langford2023-05-151-2/+4
| | | | | | | This applies the same trick for Lua that I did for python in 27b6a4e63afe. Differential Revision: https://reviews.llvm.org/D150624
* [lldb] Mark most SBAPI methods involving private types as protected or privateAlex Langford2023-05-102-102/+102
| | | | | | | | | | | | | | | | | | | | | Many SB classes have public constructors or methods involving types that are private. Some are more obvious (e.g. containing lldb_private in the name) than others (lldb::FooSP is usually std::shared_pointer<lldb_private::Foo>). This commit explicitly does not address FileSP, so I'm leaving that one alone for now. Some of these were for other SB classes to use and should have been made protected/private with a friend class entry added. Some of these were public for some of the swig python helpers to use. I put all of those functions into a class and made them static methods. The relevant SB classes mark that class as a friend so they can access those private/protected members. I've also removed an outdated SBStructuredData test (can you guess which constructor it was using?) and updated the other relevant tests. Differential Revision: https://reviews.llvm.org/D150157
* Allow scripted thread plans to modify the thread stop description whenJim Ingham2023-05-031-0/+32
| | | | they are completed.
* [lldb][NFCI] Remove unused swig macrosAlex Langford2023-04-251-34/+0
| | | | These should have been removed in 662548c82683.
* [lldb] Improve breakpoint management for interactive scripted processMed Ismail Bennani2023-04-252-1/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch improves breakpoint management when doing interactive scripted process debugging. In other to know which process set a breakpoint, we need to do some book keeping on the multiplexer scripted process. When initializing the multiplexer, we will first copy breakpoints that are already set on the driving target. Everytime we launch or resume, we should copy breakpoints from the multiplexer to the driving process. When creating a breakpoint from a child process, it needs to be set both on the multiplexer and on the driving process. We also tag the created breakpoint with the name and pid of the originator process. This patch also implements all the requirement to achieve proper breakpoint management. That involves: - Adding python interator for breakpoints and watchpoints in SBTarget - Add a new `ScriptedProcess.create_breakpoint` python method Differential Revision: https://reviews.llvm.org/D148548 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
* [lldb] Fix double free in python bindings error handling.Jorge Gorbe Moya2023-03-271-4/+7
| | | | | | | | | If we have a `%typemap(freearg)` that frees the argument, we shouldn't free it manually on an error path before calling `SWIG_fail`. `SWIG_fail` will already free the memory in this case, and doing it manually results in a double free. Differential Revision: https://reviews.llvm.org/D147007
* [lldb] Update some uses of Python2 API in typemaps.Jorge Gorbe Moya2023-03-221-11/+7
| | | | | | | | | | | | | | | | | | | | | | | Python 3 doesn't have a distinction between PyInt and PyLong, it's all PyLong now. This also fixes a bug in SetNumberFromObject. This used to crash LLDB: ``` lldb -o "script data=lldb.SBData(); data.SetDataFromUInt64Array([2**63])" ``` The problem happened in the PyInt path: ``` if (PyInt_Check(obj)) number = static_cast<T>(PyInt_AsLong(obj)); ``` when obj doesn't fit in a signed long, `PyInt_AsLong` would fail with "OverflowError: Python int too large to convert to C long". The existing long path does the right thing, as it will call `PyLong_AsUnsignedLongLong` for uint64_t. Differential Revision: https://reviews.llvm.org/D146590
* Add a new SBDebugger::SetDestroyCallback() APIJeffrey Tan2023-03-072-0/+35
| | | | | | | | Adding a new SBDebugger::SetDestroyCallback() API. This API can be used by any client to query for statistics/metrics before exiting debug sessions. Differential Revision: https://reviews.llvm.org/D143520
* [lldb/swig] Fix ref counting issue in SBProcess::GetScriptedImplementationMed Ismail Bennani2023-03-031-0/+2
| | | | | | | | | | | | | | When using SBProcess::GetScriptedImplementation in python, if the process has a valid implementation, we returned a reference of the object without incrementing the reference counting. That causes the interpreter to crash after accessing the reference several times. This patch address this by incrementing the reference count when passing the valid object reference. Differential Revision: https://reviews.llvm.org/D145260 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
* [lldb/Plugins] Add memory writing capabilities to Scripted ProcessMed Ismail Bennani2023-03-031-0/+5
| | | | | | | | | | | | | This patch adds memory writing capabilities to the Scripted Process plugin. This allows to user to get a target address and a memory buffer on the python scripted process implementation that the user can make processing on before performing the actual write. This will also be used to write trap instruction to a real process memory to set a breakpoint. Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
* [lldb/Plugins] Add Attach capabilities to ScriptedProcessMed Ismail Bennani2023-03-032-0/+34
| | | | | | | | | | | | | | | | | | | | | | | This patch adds process attach capabilities to the ScriptedProcess plugin. This doesn't really expects a PID or process name, since the process state is already script, however, this allows to create a scripted process without requiring to have an executuble in the target. In order to do so, this patch also turns the scripted process related getters and setters from the `ProcessLaunchInfo` and `ProcessAttachInfo` classes to a `ScriptedMetadata` instance and moves it in the `ProcessInfo` class, so it can be accessed interchangeably. This also adds the necessary SWIG wrappers to convert the internal `Process{Attach,Launch}InfoSP` into a `SB{Attach,Launch}Info` to pass it as argument the scripted process python implementation and convert it back to the internal representation. rdar://104577406 Differential Revision: https://reviews.llvm.org/D143104 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
* [lldb] Extend SWIG SBProcess interface with WriteMemoryAsCString methodMed Ismail Bennani2023-03-031-0/+12
| | | | | | | | | | | | | | | | | | This patch tries to address an interoperability issue when writing python string into the process memory. Since the python string is not null-terminated, it would still be written to memory however, when trying to read it again with `SBProcess::ReadCStringFromMemory`, the memory read would fail, since the read string doens't contain a null-terminator, and therefore is not a valid C string. To address that, this patch extends the `SBProcess` SWIG interface to expose a new `WriteMemoryAsCString` method that is only exposed to the SWIG target language. That method checks that the buffer to write is null-terminated and otherwise, it appends a null byte at the end of it. Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
* Revert "Add SBValue::GetValueAsAddress API for removing non-addressing metadata"Jason Molenda2023-03-021-18/+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.
* Add SBValue::GetValueAsAddress API for removing non-addressing metadataJason Molenda2023-03-021-0/+18
| | | | | | | | | | | 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
* [LLDB] Expose several methods in SBWatchpointDan Liew2023-03-011-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds the following methods: * `GetType()` * `GetWatchValueKind()` * `GetWatchSpec()` * `IsWatchingReads()` * `IsWatchingWrites()` These mostly expose methods that `lldb_private::Watchpoint` already had. Tests are included that exercise these new methods. The motivation for exposing these are as follows: * `GetType()` - With this information and the address from a watchpoint it is now possible to construct an SBValue from an SBWatchpoint. Previously this wasn't possible. The included test case illustrates doing this. * `GetWatchValueKind()` - This allows the caller to determine whether the watchpoint is a variable watchpoint or an expression watchpoint. A new enum (`WatchpointValueKind`) has been introduced to represent the return values. Unfortunately the name `WatchpointKind` was already taken. * `GetWatchSpec()` - This allows (at least for variable watchpoints) to use a sensible name for SBValues created from an SBWatchpoint. * `IsWatchingReads()` - This allow checking if a watchpoint is monitoring read accesses. * `IsWatchingWRites()` - This allow checking if a watchpoint is monitoring write accesses. rdar://105606978 Reviewers: jingham, mib, bulbazord, jasonmolenda, JDevlieghere Differential Revision: https://reviews.llvm.org/D144937
* [lldb] Replace SB swig interfaces with API headersAlex Langford2023-02-16175-10626/+4408
| | | | | | | | | | | Instead of maintaining separate swig interface files, we can use the API headers directly. They implement the exact same C++ APIs and we can conditionally include the python extensions as needed. To remove the swig extensions from the API headers when building the LLDB framework, we can use the unifdef tool when it is available. Otherwise we just copy them as-is. Differential Revision: https://reviews.llvm.org/D142926
* [lldb] Add an SB API to get progress events as SBStructuredDataJonas Devlieghere2023-02-101-0/+2
| | | | | | | | | | | This is a preparatory patch to add an SB API to get the progress data as SBStructuredData. The advantage of using SBStructuredData is that the dictionary can grow over time with more fields. This approach is identical to the way this is implemented for diagnostic events. Differential revision: https://reviews.llvm.org/D143687
* [lldb] Accept negative indexes in __getitem__Dave Lee2023-02-0811-18/+40
| | | | | | | | | | To the Python bindings, add support for Python-like negative indexes. While was using `script`, I tried to access a thread's bottom frame with `thread.frame[-1]`, but that failed. This change updates the `__getitem__` implementations to support negative indexes as one would expect in Python. Differential Revision: https://reviews.llvm.org/D143282
* [lldb] Add a way to get a scripted process implementation from the SBAPIMed Ismail Bennani2023-02-032-0/+16
| | | | | | | | | | | | | | | This patch introduces a new `GetScriptedImplementation` method to the SBProcess class in the SBAPI. It will allow users of Scripted Processes to fetch the scripted implementation object from to script interpreter to be able to interact with it directly (without having to go through lldb). This allows to user to perform action that are not specified in the scripted process interface, like calling un-specified methods, but also to enrich the implementation, by passing it complex objects. Differential Revision: https://reviews.llvm.org/D143236 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
* [lldb/python] Fix scripted_platform python module creationMed Ismail Bennani2023-02-021-7/+1
| | | | | | | | | | | | | | | This patch should fix the creation and addition of the `scripted_platform` python module into the `lldb.plugins` module. Previously, we were creating the `plugins` submodule, each time with a different source file (either `scripted_process` or `scripted_platform`). The removes the redundant `create_python_package` call and group both python source files toghether. Differential Revision: https://reviews.llvm.org/D143122 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
* [lldb/swig] Remove deprecated flags for generating bindingsMed Ismail Bennani2023-01-301-5/+8
| | | | | | | | | | | | | | | This patch conditionaly removes the `-py3` swig flag that was used to generate python3 bindings, since it's unsued since SWIG 4.1.0. ``` Deprecated command line option: -py3. Ignored, this option is no longer supported ``` This also removes the `-shadow` flag that have been deprecated since 2002. Differential Revision: https://reviews.llvm.org/D142245 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
* [lldb] Remove legacy six module for py2->py3Jordan Rupprecht2023-01-241-7/+0
| | | | | | | | LLDB only supports Python3 now, so the `six` shim for Python2 is no longer necessary. Reviewed By: JDevlieghere Differential Revision: https://reviews.llvm.org/D142140
* Revert "[lldb] Add Debugger & ScriptedMetadata reference to ↵Med Ismail Bennani2023-01-131-12/+0
| | | | | | Platform::CreateInstance" This reverts commit 2d53527e9c64c70c24e1abba74fa0a8c8b3392b1.
* [lldb] Add ScriptedPlatform python implementationMed Ismail Bennani2023-01-122-45/+10
| | | | | | | | | | | | | | | | | This patch introduces both the Scripted Platform python base implementation and an example for it. The base implementation is embedded in lldb python module under `lldb.plugins.scripted_platform`. This patch also refactor the various SWIG methods to create scripted objects into a single method, that is now shared between the Scripted Platform, Process and Thread. It also replaces the target argument by a execution context object. Differential Revision: https://reviews.llvm.org/D139250 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
* [lldb] Add Debugger & ScriptedMetadata reference to Platform::CreateInstanceMed Ismail Bennani2023-01-121-0/+12
| | | | | | | | | | | | | | | | | | | | This patch is preparatory work for Scripted Platform support and does multiple things: First, it introduces new options for the `platform select` command and `SBPlatform::Create` API, to hold a reference to the debugger object, the name of the python script managing the Scripted Platform and a structured data dictionary that the user can use to pass arbitrary data. Then, it updates the various `Create` and `GetOrCreate` methods for the `Platform` and `PlatformList` classes to pass down the new parameter to the `Platform::CreateInstance` callbacks. Finally, it updates every callback to reflect these changes. Differential Revision: https://reviews.llvm.org/D139249 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
* [lldb] Fix compile error in Lua typemapJonas Devlieghere2023-01-121-1/+1
| | | | | Fix error "non-const lvalue reference to type 'lldb::FileSP' cannot bind to a value of unrelated type" in Lua typemap.
* [lldb] Limit `nothreadallow` to Python in SWIG bindingsJonas Devlieghere2023-01-121-0/+4
| | | | | | | | | | | SWIG allows you to partially disable thread support for a given function in Python with `nothreadallow`. This functionality is limited to Python, but until SWIG 4.1, it would silently ignore this for other languages, such as Lua. New versions of SWIG are more strict and therefore we need to guard this with `SWIGPYTHON`. For more details on the functionality, I recommend reading the commit message from 070a1d562b30.
* [lldb] Use std::optional instead of llvm::Optional (NFC)Kazu Hirata2023-01-071-2/+2
| | | | | | | | | | | This patch replaces (llvm::|)Optional< with std::optional<. I'll post a separate patch to clean up the "using" declarations, #include "llvm/ADT/Optional.h", etc. This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
* [lldb] Allow configuring on Windows with python interpreter within a junctionMarkus Böck2023-01-061-2/+4
| | | | | | | | | | The current implementation nicely takes into account when the python interpreter is symlinked (or transitively within a symlinked directory). Sadly, `os.path.islink` returns `false` on Windows if instead of Windows symlinks, junctions are used. This has caused me issues after I started using `scoop` as my package manager on Windows, which creates junctions instead of symlinks. The fix proposed in this patch is to check whether `realpath` returns a different path to `exe`, and if it does, to simply try again with that path. The code could also be simplified since `sys.executable` is guaranteed to be absolute, and `os.readlink`, which can return a relative path, is no longer used. Tested on Windows 11 with Python 3.11 as interpreter and Ubuntu 18.04 with Python 3.6 Differential Revision: https://reviews.llvm.org/D141042
* [lldb] Use std::nullopt instead of llvm::None (NFC)Kazu Hirata2022-12-051-4/+4
| | | | | | | This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
* [NFC] Make headers self-contained.Jordan Rupprecht2022-11-291-0/+2
| | | | | | | | | | | | | | | | Some headers in LLDB work only when considered as textual inclusion, but not if one attempts to use them on their own or with a different context. - python-typemaps.h: uses Python definitions without using "Python.h". - RISCVCInstructions.h uses RISC-V register enums without including the enums header. - RISCVInstructions.h includes EmulateInstructionRISCV.h, but is unnecessary since we forward-declare EmulateInstructionRISCV anyway. Including the header is problematic because EmulateInstructionRISCV.h uses DecodeResult which isn't defined until later in RISCVInstructions.h. This makes LLDB build cleanly with the "parse_headers" feature [1]. I'm not sure what the analagous CMake option is. [1] I didn't find public documentation but @MaskRay wrote this up: https://maskray.me/blog/2022-09-25-layering-check-with-clang#parse_headers Reviewed By: labath, MaskRay Differential Revision: https://reviews.llvm.org/D138310
* Reland "[lldb] Fix SBFileSpec.fullpath"Dave Lee2022-11-211-12/+1
| | | | | | Update `fullpath` asserts in TestMiniDump.py. This reverts commit 682fcc95f4149f00e9da961817fe2f5832e4b301.
* Revert "[lldb] Fix SBFileSpec.fullpath"Dave Lee2022-11-211-1/+12
| | | | This reverts commit a59ed8fa86036efe66efcaddd5cd3e1d17856563.
* [lldb] Fix SBFileSpec.fullpathDave Lee2022-11-211-12/+1
| | | | | | | | | | | | | | Reimplement `SBFileSpec.fullpath` to (indirectly) use `FileSpec::GetPath`. Instead of hardcoding a `/` separator, use `GetPath`. This makes use of the `FileSpec`'s internal style, which for example allows for backslash on Windows where required. It's not obvious from looking at the source, but the `fullpath` property is implemented with `str`, which calls `GetDescription`, which finally calls `GetPath`. Differential Revision: https://reviews.llvm.org/D138348
* [lldb/Plugins] Improve error reporting with reading memory in Scripted ProcessMed Ismail Bennani2022-11-181-22/+4
| | | | | | | | | | | | | | | | | | | | | | | | | This patch improves the ScriptedPythonInterface::Dispatch method to support passing lldb_private types to the python implementation. This will allow, for instance, the Scripted Process python implementation to report errors when reading memory back to lldb. To do so, the Dispatch method will transform the private types in the parameter pack into `PythonObject`s to be able to pass them down to the python methods. Then, if the call succeeded, the transformed arguments will be converted back to their original type and re-assigned in the parameter pack, to ensure pointers and references behaviours are preserved. This patch also updates various scripted process python class and tests to reflect this change. rdar://100030995 Differential Revision: https://reviews.llvm.org/D134033 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
* [lldb] Revert SBFileSpec.fullpath path separator fixDave Lee2022-11-121-1/+1
| | | | Primarily reverts 5223366416fb.
* [lldb] Fix SBFileSpec.fullpath for WindowsDave Lee2022-11-111-1/+1
| | | | | | | | | Fix `fullpath` to not assume a `/` path separator. This was discovered when D133130 failed on Windows. Use `os.path.join()` to fix the issue. Reviewed By: mib Differential Revision: https://reviews.llvm.org/D133366
* [lldb][Docs][NFC] Fix sphinx warnings/errors for LLDB docsMichael Buch2022-10-283-4/+7
| | | | | | Ran `ninja docs-lldb-html` and made sure the docs are fixed. Differential Revision: https://reviews.llvm.org/D136766
* [lldb] Add matching based on Python callbacks for data formatters.Jorge Gorbe Moya2022-10-192-0/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds a new matching method for data formatters, in addition to the existing exact typename and regex-based matching. The new method allows users to specify the name of a Python callback function that takes a `SBType` object and decides whether the type is a match or not. Here is an overview of the changes performed: - Add a new `eFormatterMatchCallback` matching type, and logic to handle it in `TypeMatcher` and `SBTypeNameSpecifier`. - Extend `FormattersMatchCandidate` instances with a pointer to the current `ScriptInterpreter` and the `TypeImpl` corresponding to the candidate type, so we can run registered callbacks and pass the type to them. All matcher search functions now receive a `FormattersMatchCandidate` instead of a type name. - Add some glue code to ScriptInterpreterPython and the SWIG bindings to allow calling a formatter matching callback. Most of this code is modeled after the equivalent code for watchpoint callback functions. - Add an API test for the new callback-based matching feature. For more context, please check the RFC thread where this feature was originally discussed: https://discourse.llvm.org/t/rfc-python-callback-for-data-formatters-type-matching/64204/11 Differential Revision: https://reviews.llvm.org/D135648
* [lldb] Fix 'error: non-const lvalue...' caused by SWIG 4.1.0Jitka Plesnikova2022-09-301-1/+1
| | | | | | | Fix the failure caused by change in SwigValueWraper for C++11 and later for improved move semantics in SWIG commit. https://github.com/swig/swig/commit/d1055f4b3d51cb8060893f8036846ac743302dab
* [lldb] Get rid of __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROSserge-sans-paille2022-09-302-5/+0
| | | | | | | | C++11 made the use of these macro obsolete, see https://sourceware.org/bugzilla/show_bug.cgi?id=15366 As a side effect this prevents https://github.com/swig/swig/issues/2193. Differential Revision: https://reviews.llvm.org/D134877
* [lldb] Use SWIG_fail in python-typemaps.swig (NFC)Dave Lee2022-09-161-27/+27
| | | | | | | | | | | | | | | | | When attempting to use SWIG's `-builtin` flag, there were a few compile failures caused by a mismatch between return type and return value. In those cases, the return type was `int` but many of the type maps assume returning `NULL`/`nullptr` (only the latter caused compile failures). This fix abstracts failure paths to use the `SWIG_fail` macro, which performs `goto fail;`. Each of the generated functions contain a `fail` label, which performs any resource cleanup and returns the appropriate failure value. This change isn't strictly necessary at this point, but seems like the right thing to do, and for anyone who tries `-builtin` later, it resolves those issues. Differential Revision: https://reviews.llvm.org/D133961
* [Formatters][NFCI] Replace 'is_regex' arguments with an enum.Jorge Gorbe Moya2022-09-131-0/+6
| | | | | | | | | | | | | | Modify `SBTypeNameSpecifier` and `lldb_private::TypeMatcher` so they have an enum value for the type of matching to perform instead of an `m_is_regex` boolean value. This change paves the way for introducing formatter matching based on the result of a python callback in addition to the existing name-based matching. See the RFC thread at https://discourse.llvm.org/t/rfc-python-callback-for-data-formatters-type-matching/64204 for more details. Differential Revision: https://reviews.llvm.org/D133240
* [lldb] Fixed a number of typosGabriel Ravier2022-09-132-5/+5
| | | | | | | | | | | | | | | | I went over the output of the following mess of a command: (ulimit -m 2000000; ulimit -v 2000000; git ls-files -z | parallel --xargs -0 cat | aspell list --mode=none --ignore-case | grep -E '^[A-Za-z][a-z]*$' | sort | uniq -c | sort -n | grep -vE '.{25}' | aspell pipe -W3 | grep : | cut -d' ' -f2 | less) and proceeded to spend a few days looking at it to find probable typos and fixed a few hundred of them in all of the llvm project (note, the ones I found are not anywhere near all of them, but it seems like a good start). Differential revision: https://reviews.llvm.org/D131122
* Add the ability to show when variables fails to be available when debug info ↵Greg Clayton2022-09-121-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | is valid. Summary: Many times when debugging variables might not be available even though a user can successfully set breakpoints and stops somewhere. Letting the user know will help users fix these kinds of issues and have a better debugging experience. Examples of this include: - enabling -gline-tables-only and being able to set file and line breakpoints and yet see no variables - unable to open object file for DWARF in .o file debugging for darwin targets due to modification time mismatch or not being able to locate the N_OSO file. This patch adds an new API to SBValueList: lldb::SBError lldb::SBValueList::GetError(); object so that if you request a stack frame's variables using SBValueList SBFrame::GetVariables(...), you can get an error the describes why the variables were not available. This patch adds the ability to get an error back when requesting variables from a lldb_private::StackFrame when calling GetVariableList. It also now shows an error in response to "frame variable" if we have debug info and are unable to get varialbes due to an error as mentioned above: (lldb) frame variable error: "a.o" object from the "/tmp/libfoo.a" archive: either the .o file doesn't exist in the archive or the modification time (0x63111541) of the .o file doesn't match Reviewers: labath JDevlieghere aadsm yinghuitan jdoerfert sscalpone Subscribers: Differential Revision: https://reviews.llvm.org/D133164
* Revert "Add the ability to show when variables fails to be available when ↵Stella Stamenova2022-09-121-2/+0
| | | | | | | | debug info is valid." This reverts commit 9af089f5179d52c6561ec27532880edcfb6253af. This broke the windows lldb bot: https://lab.llvm.org/buildbot/#/builders/83/builds/23528
* Add SBDebugger::GetSetting() public APIsJeffrey Tan2022-09-111-0/+2
| | | | | | | | | | | | | | | | This patch adds new SBDebugger::GetSetting() API which enables client to access settings as SBStructedData. Implementation wise, a new ToJSON() virtual function is added to OptionValue class so that each concrete child class can override and provides its own JSON representation. This patch aims to define the APIs and implement a common set of OptionValue child classes, leaving the remaining for future patches. This patch is used later by auto deduce source map from source line breakpoint feature for testing generated source map entries. Differential Revision: https://reviews.llvm.org/D133038
* Add the ability to show when variables fails to be available when debug info ↵Greg Clayton2022-09-091-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | is valid. Many times when debugging variables might not be available even though a user can successfully set breakpoints and stops somewhere. Letting the user know will help users fix these kinds of issues and have a better debugging experience. Examples of this include: - enabling -gline-tables-only and being able to set file and line breakpoints and yet see no variables - unable to open object file for DWARF in .o file debugging for darwin targets due to modification time mismatch or not being able to locate the N_OSO file. This patch adds an new API to SBValueList: lldb::SBError lldb::SBValueList::GetError(); object so that if you request a stack frame's variables using SBValueList SBFrame::GetVariables(...), you can get an error the describes why the variables were not available. This patch adds the ability to get an error back when requesting variables from a lldb_private::StackFrame when calling GetVariableList. It also now shows an error in response to "frame variable" if we have debug info and are unable to get varialbes due to an error as mentioned above: (lldb) frame variable error: "a.o" object from the "/tmp/libfoo.a" archive: either the .o file doesn't exist in the archive or the modification time (0x63111541) of the .o file doesn't match Differential Revision: https://reviews.llvm.org/D133164
* Revert "[lldb][bindings] Fix module_access handling of regex"Stella Stamenova2022-09-061-5/+5
| | | | | | This reverts commit 75f05fccbbdd91393bdc7b6183b9dd2b1e859f8e. This commit broke the windows lldb bot: https://lab.llvm.org/buildbot/#/builders/83/builds/23284
* [lldb][bindings] Fix module_access handling of regexDave Lee2022-09-031-5/+5
| | | | | | | | | | | | | | | | | | | | Fixes broken support for: `target.module[re.compile("libFoo")]` There were two issues: 1. The type check was expecting `re.SRE_Pattern` 2. The expression to search the module path had a typo In the first case, `re.SRE_Pattern` does not exist in Python 3, and is replaced with `re.Pattern`. While editing this code, I changed the type checks to us `isinstance`, which is the conventional way of type checking. From the docs on `type()`: > The `isinstance()` built-in function is recommended for testing the type of an object, because it takes subclasses into account. Differential Revision: https://reviews.llvm.org/D133130