|
Revision tags: llvmorg-20.1.0, llvmorg-20.1.0-rc3, llvmorg-20.1.0-rc2, llvmorg-20.1.0-rc1, llvmorg-21-init, llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5, llvmorg-19.1.4, llvmorg-19.1.3, llvmorg-19.1.2, llvmorg-19.1.1, llvmorg-19.1.0, llvmorg-19.1.0-rc4, llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init, llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6, llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init, llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init, llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1, llvmorg-16.0.0, llvmorg-16.0.0-rc4, llvmorg-16.0.0-rc3, llvmorg-16.0.0-rc2, llvmorg-16.0.0-rc1, llvmorg-17-init, llvmorg-15.0.7, llvmorg-15.0.6, llvmorg-15.0.5, llvmorg-15.0.4, llvmorg-15.0.3, llvmorg-15.0.2, llvmorg-15.0.1, llvmorg-15.0.0, llvmorg-15.0.0-rc3, llvmorg-15.0.0-rc2, llvmorg-15.0.0-rc1, llvmorg-16-init, llvmorg-14.0.6, llvmorg-14.0.5, llvmorg-14.0.4, llvmorg-14.0.3, llvmorg-14.0.2, llvmorg-14.0.1, llvmorg-14.0.0, llvmorg-14.0.0-rc4, llvmorg-14.0.0-rc3, llvmorg-14.0.0-rc2, llvmorg-14.0.0-rc1, llvmorg-15-init, llvmorg-13.0.1, llvmorg-13.0.1-rc3 |
|
| #
c154f397 |
| 17-Jan-2022 |
Pavel Labath <[email protected]> |
[lldb/python] Use PythonObject in LLDBSwigPython functions
Return our PythonObject wrappers instead of raw PyObjects (obfuscated as void *). This ensures that ownership (reference counts) of python
[lldb/python] Use PythonObject in LLDBSwigPython functions
Return our PythonObject wrappers instead of raw PyObjects (obfuscated as void *). This ensures that ownership (reference counts) of python objects is automatically tracked.
Differential Revision: https://reviews.llvm.org/D117462
show more ...
|
|
Revision tags: llvmorg-13.0.1-rc2 |
|
| #
0a07c966 |
| 20-Dec-2021 |
Pavel Labath <[email protected]> |
[lldb/python] Fix dangling Event and CommandReturnObject references
Unlike the rest of our SB objects, SBEvent and SBCommandReturnObject have the ability to hold non-owning pointers to their non-SB
[lldb/python] Fix dangling Event and CommandReturnObject references
Unlike the rest of our SB objects, SBEvent and SBCommandReturnObject have the ability to hold non-owning pointers to their non-SB counterparts. This makes it hard to ensure the SB objects do not become dangling once their backing object goes away.
While we could make these two objects behave like others, that would require plubming even more shared pointers through our internal code (Event objects are mostly prepared for it, CommandReturnObject are not). Doing so seems unnecessarily disruptive, given that (unlike for some of the other objects) I don't see any good reason why would someone want to hold onto these objects after the function terminates.
For that reason, this patch implements a different approach -- the SB objects will still hold non-owning pointers, but they will be reset to the empty/default state as soon as the function terminates. This python code will not crash if the user decides to store these objects -- but the objects themselves will be useless/empty.
Differential Revision: https://reviews.llvm.org/D116162
show more ...
|
| #
2efc6892 |
| 17-Dec-2021 |
Pavel Labath <[email protected]> |
[lldb/python] Avoid more dangling pointers in python glue code
|
| #
6c2bf012 |
| 20-Dec-2021 |
Pavel Labath <[email protected]> |
[lldb/python] Fix a compile error in 7406d236d8
cannot pass object of non-trivial type 'lldb_private::python::PythonObject' through variadic function
|
|
Revision tags: llvmorg-13.0.1-rc1 |
|
| #
7406d236 |
| 18-Nov-2021 |
Pavel Labath <[email protected]> |
[lldb/python] Fix (some) dangling pointers in our glue code
This starts to fix the other half of the lifetime problems in this code -- dangling references. SB objects created on the stack will go aw
[lldb/python] Fix (some) dangling pointers in our glue code
This starts to fix the other half of the lifetime problems in this code -- dangling references. SB objects created on the stack will go away when the function returns, which is a problem if the python code they were meant for stashes a reference to them somewhere. Most of the time this goes by unnoticed, as the code rarely has a reason to store these, but in case it does, we shouldn't respond by crashing.
This patch fixes the management for a couple of SB objects (Debugger, Frame, Thread). The SB objects are now created on the heap, and their ownership is immediately passed on to SWIG, which will ensure they are destroyed when the last python reference goes away. I will handle the other objects in separate patches.
I include one test which demonstrates the lifetime issue for SBDebugger. Strictly speaking, one should create a test case for each of these objects and each of the contexts they are being used. That would require figuring out how to persist (and later access) each of these objects. Some of those may involve a lot of hoop-jumping (we can run python code from within a frame-format string). I don't think that is necessary/worth it since the new wrapper functions make it very hard to get this wrong.
Differential Revision: https://reviews.llvm.org/D115925
show more ...
|
| #
9d5e37ed |
| 14-Dec-2021 |
Pavel Labath <[email protected]> |
[lldb] (Semi-automatically) format .swig files
I've found my recent ventures into the swig land painful because of the strange way they are formatted. This patch attempts to alleviate future headach
[lldb] (Semi-automatically) format .swig files
I've found my recent ventures into the swig land painful because of the strange way they are formatted. This patch attempts to alleviate future headaches by formatting these files into something resembling the normal llvm style.
Unfortunately, completely formatting these files automatically does not work because clang format gets confused by swigs % syntax, so I have employed a hybrid approach where I formatted blocks of c++ code with clang-format and then manually massaged the code until it looked reasonable (and compiled).
I don't expect these files to remain perfectly formatted (although, if one's editor is configured to configure the current line/block on request, one can get pretty good results by using it judiciously), but at least it will prevent the (mangled form of the) old lldb style being proliferated endlessly.
Differential Revision: https://reviews.llvm.org/D115736
show more ...
|
| #
ebb6bb72 |
| 26-Nov-2021 |
Pavel Labath <[email protected]> |
[lldb/python] Plug SBStructuredData leaks
This applies the from D114259 to the SBStructuredData class.
|
| #
82de8df2 |
| 25-Nov-2021 |
Pavel Labath <[email protected]> |
[lldb] Clarify StructuredDataImpl ownership
StructuredDataImpl ownership semantics is unclear at best. Various structures were holding a non-owning pointer to it, with a comment that the object is o
[lldb] Clarify StructuredDataImpl ownership
StructuredDataImpl ownership semantics is unclear at best. Various structures were holding a non-owning pointer to it, with a comment that the object is owned somewhere else. From what I was able to gather that "somewhere else" was the SBStructuredData object, but I am not sure that all created object eventually made its way there. (It wouldn't matter even if they did, as we are leaking most of our SBStructuredData objects.)
Since StructuredDataImpl is just a collection of two (shared) pointers, there's really no point in elaborate lifetime management, so this patch replaces all StructuredDataImpl pointers with actual objects or unique_ptrs to it. This makes it much easier to resolve SBStructuredData leaks in a follow-up patch.
Differential Revision: https://reviews.llvm.org/D114791
show more ...
|
| #
9a14adea |
| 22-Nov-2021 |
Pavel Labath <[email protected]> |
[lldb] Remove 'extern "C"' from the lldb-swig-python interface
The LLDBSWIGPython functions had (at least) two problems: - There wasn't a single source of truth (a header file) for the prototypes
[lldb] Remove 'extern "C"' from the lldb-swig-python interface
The LLDBSWIGPython functions had (at least) two problems: - There wasn't a single source of truth (a header file) for the prototypes of these functions. This meant that subtle differences in copies of function declarations could go by undetected. And not-so-subtle differences would result in strange runtime failures. - All of the declarations had to have an extern "C" interface, because the function definitions were being placed inside and extert "C" block generated by swig.
This patch fixes both problems by moving the function definitions to the %header block of the swig files. This block is not surrounded by extern "C", and seems more appropriate anyway, as swig docs say it is meant for "user-defined support code" (whereas the previous %wrapper code was for automatically-generated wrappers).
It also puts the declarations into the SWIGPythonBridge header file (which seems to have been created for this purpose), and ensures it is included by all code wishing to define or use these functions. This means that any differences in the declaration become a compiler error instead of a runtime failure.
Differential Revision: https://reviews.llvm.org/D114369
show more ...
|
| #
7f09ab08 |
| 18-Nov-2021 |
Pavel Labath <[email protected]> |
[lldb] Fix [some] leaks in python bindings
Using an lldb_private object in the bindings involves three steps - wrapping the object in it's lldb::SB variant - using swig to convert/wrap that to a PyO
[lldb] Fix [some] leaks in python bindings
Using an lldb_private object in the bindings involves three steps - wrapping the object in it's lldb::SB variant - using swig to convert/wrap that to a PyObject - wrapping *that* in a lldb_private::python::PythonObject
Our SBTypeToSWIGWrapper was only handling the middle part. This doesn't just result in increased boilerplate in the callers, but is also a functionality problem, as it's very hard to get the lifetime of of all of these objects right. Most of the callers are creating the SB object (step 1) on the stack, which means that we end up with dangling python objects after the function terminates. Most of the time this isn't a problem, because the python code does not need to persist the objects. However, there are legitimate cases where they can do it (and even if the use case is not completely legitimate, crashing is not the best response to that).
For this reason, some of our code creates the SB object on the heap, but it has another problem -- it never gets cleaned up.
This patch begins to add a new function (ToSWIGWrapper), which does all of the three steps, while properly taking care of ownership. In the first step, I have converted most of the leaky code (except for SBStructuredData, which needs a bit more work).
Differential Revision: https://reviews.llvm.org/D114259
show more ...
|
| #
f1127914 |
| 18-Nov-2021 |
Pavel Labath <[email protected]> |
[lldb] Deobfuscate python-swigsafecast.swig
This file was way more complicated than it needed to be.
This patch removes the automagic reference-to-pointer delegation and replaces the template speci
[lldb] Deobfuscate python-swigsafecast.swig
This file was way more complicated than it needed to be.
This patch removes the automagic reference-to-pointer delegation and replaces the template specializations with regular free functions (taking reference arguments).
The reason I chose references is twofold: - there are more arguments being passed by reference than by pointer - the reference arguments make it more obvious that there is a lot of leaking going on in there.
Currently, the code was assuming that the pointer arguments have some kind of a special meaning and that pointer functions take ownership of their arguments, which isn't true (it's possible it was true at some point in the past, I haven't done the archeology).
This makes it easier to implement proper lifetime management in follow-up patches.
Differential Revision: https://reviews.llvm.org/D114150
show more ...
|
| #
738621d0 |
| 19-Oct-2021 |
Med Ismail Bennani <[email protected]> |
[lldb/bindings] Change ScriptedThread initializer parameters
This patch changes the `ScriptedThread` initializer in couple of ways: - It replaces the `SBTarget` parameter by a `SBProcess` (pointing
[lldb/bindings] Change ScriptedThread initializer parameters
This patch changes the `ScriptedThread` initializer in couple of ways: - It replaces the `SBTarget` parameter by a `SBProcess` (pointing to the `ScriptedProcess` that "owns" the `ScriptedThread`). - It adds a reference to the `ScriptedProcessInfo` Dictionary, to pass arbitrary user-input to the `ScriptedThread`.
This patch also fixes the SWIG bindings methods that call the `ScriptedProcess` and `ScriptedThread` initializers by passing all the arguments to the appropriate `PythonCallable` object.
Differential Revision: https://reviews.llvm.org/D112046
Signed-off-by: Med Ismail Bennani <[email protected]>
show more ...
|
| #
a758c9f7 |
| 08-Oct-2021 |
Med Ismail Bennani <[email protected]> |
[lldb/Plugins] Add memory region support in ScriptedProcess
This patch adds support for memory regions in Scripted Processes. This is necessary to read the stack memory region in order to reconstruc
[lldb/Plugins] Add memory region support in ScriptedProcess
This patch adds support for memory regions in Scripted Processes. This is necessary to read the stack memory region in order to reconstruct each stackframe of the program.
In order to do so, this patch makes some changes to the SBAPI, namely: - Add a new constructor for `SBMemoryRegionInfo` that takes arguments such as the memory region name, address range, permissions ... This is used when reading memory at some address to compute the offset in the binary blob provided by the user. - Add a `GetMemoryRegionContainingAddress` method to `SBMemoryRegionInfoList` to simplify the access to a specific memory region.
With these changes, lldb is now able to unwind the stack and reconstruct each frame. On top of that, reloading the target module at offset 0 allows lldb to symbolicate the `ScriptedProcess` using debug info, similarly to an ordinary Process.
To test this, I wrote a simple program with multiple function calls, ran it in lldb, stopped at a leaf function and read the registers values and copied the stack memory into a binary file. These are then used in the python script.
Differential Revision: https://reviews.llvm.org/D108953
Signed-off-by: Med Ismail Bennani <[email protected]>
show more ...
|
| #
59d8dd79 |
| 06-Oct-2021 |
Med Ismail Bennani <[email protected]> |
[lldb/Plugins] Add support for ScriptedThread in ScriptedProcess
This patch introduces the `ScriptedThread` class with its python interface.
When used with `ScriptedProcess`, `ScriptedThreaad` can
[lldb/Plugins] Add support for ScriptedThread in ScriptedProcess
This patch introduces the `ScriptedThread` class with its python interface.
When used with `ScriptedProcess`, `ScriptedThreaad` can provide various information such as the thread state, stop reason or even its register context.
This can be used to reconstruct the program stack frames using lldb's unwinder.
rdar://74503836
Differential Revision: https://reviews.llvm.org/D107585
Signed-off-by: Med Ismail Bennani <[email protected]>
show more ...
|
|
Revision tags: llvmorg-13.0.0, llvmorg-13.0.0-rc4, llvmorg-13.0.0-rc3 |
|
| #
3925204c |
| 03-Sep-2021 |
Med Ismail Bennani <[email protected]> |
[lldb/Plugins] Introduce Scripted Interface Factory
This patch splits the previous `ScriptedProcessPythonInterface` into multiple specific classes:
1. The `ScriptedInterface` abstract class that ca
[lldb/Plugins] Introduce Scripted Interface Factory
This patch splits the previous `ScriptedProcessPythonInterface` into multiple specific classes:
1. The `ScriptedInterface` abstract class that carries the interface instance object and its virtual pure abstract creation method.
2. The `ScriptedPythonInterface` that holds a generic `Dispatch` method that can be used by various interfaces to call python methods and also keeps a reference to the Python Script Interpreter instance.
3. The `ScriptedProcessInterface` that describes the base Scripted Process model with all the methods used in the underlying script.
All these components are used to refactor the `ScriptedProcessPythonInterface` class, making it more modular.
This patch is also a requirement for the upcoming work on `ScriptedThread`.
Differential Revision: https://reviews.llvm.org/D107521
Signed-off-by: Med Ismail Bennani <[email protected]>
show more ...
|
|
Revision tags: llvmorg-13.0.0-rc2, llvmorg-13.0.0-rc1, llvmorg-14-init, llvmorg-12.0.1, llvmorg-12.0.1-rc4, llvmorg-12.0.1-rc3, llvmorg-12.0.1-rc2, llvmorg-12.0.1-rc1, llvmorg-12.0.0, llvmorg-12.0.0-rc5, llvmorg-12.0.0-rc4 |
|
| #
1f6a57c1 |
| 23-Mar-2021 |
Med Ismail Bennani <[email protected]> |
[lldb/Interpreter] Add ScriptInterpreter Wrapper for ScriptedProcess
This patch adds a ScriptedProcess interface to the ScriptInterpreter and more specifically, to the ScriptInterpreterPython.
This
[lldb/Interpreter] Add ScriptInterpreter Wrapper for ScriptedProcess
This patch adds a ScriptedProcess interface to the ScriptInterpreter and more specifically, to the ScriptInterpreterPython.
This interface will be used in the C++ `ScriptProcess` Process Plugin to call the script methods.
At the moment, not all methods are implemented, they will upstreamed in upcoming patches.
This patch also adds helper methods to the ScriptInterpreter to convert `SBAPI` Types (SBData & SBError) to `lldb_private` types (DataExtractor & Status).
rdar://65508855
Differential Revision: https://reviews.llvm.org/D95711
Signed-off-by: Med Ismail Bennani <[email protected]>
show more ...
|
| #
daf36998 |
| 10-Mar-2021 |
Dave Lee <[email protected]> |
[lldb] Ignore linkage diagnostic for LLDBSwigPythonBreakpointCallbackFunction (NFC)
Ignore `-Wreturn-type-c-linkage` diagnostics for `LLDBSwigPythonBreakpointCallbackFunction`.
The function is defi
[lldb] Ignore linkage diagnostic for LLDBSwigPythonBreakpointCallbackFunction (NFC)
Ignore `-Wreturn-type-c-linkage` diagnostics for `LLDBSwigPythonBreakpointCallbackFunction`.
The function is defined in `python-wrapper.swig` which uses `extern "C" { ... }` blocks. The declaration of this function in `ScriptInterpreterPython.cpp` already uses these same pragmas to silence the warning there.
This prevents `-Werror` builds from failing.
Differential Revision: https://reviews.llvm.org/D98368
show more ...
|
|
Revision tags: llvmorg-12.0.0-rc3 |
|
| #
36254f1a |
| 01-Mar-2021 |
Med Ismail Bennani <[email protected]> |
[lldb] Revert ScriptedProcess patches
This patch reverts the following commits: - 5a9c34918bb1526b7e8c29aa5e4fb8d8e27e27b4 - 46796762afe76496ec4dd900f64d0cf4cdc30e99 - 2cff3dec1171188ce04ab1a4373cc1
[lldb] Revert ScriptedProcess patches
This patch reverts the following commits: - 5a9c34918bb1526b7e8c29aa5e4fb8d8e27e27b4 - 46796762afe76496ec4dd900f64d0cf4cdc30e99 - 2cff3dec1171188ce04ab1a4373cc1885ab97be1 - 182f0d1a34419445bb19d67581d6ac1afc98b7fa - d62a53aaf1d38a55d1affbd3a30d564a4e9d3171
Signed-off-by: Med Ismail Bennani <[email protected]>
show more ...
|
|
Revision tags: llvmorg-12.0.0-rc2 |
|
| #
182f0d1a |
| 18-Feb-2021 |
Med Ismail Bennani <[email protected]> |
[lldb/Interpreter] Add ScriptInterpreter Wrapper for ScriptedProcess
This patch adds a ScriptedProcess interface to the ScriptInterpreter and more specifically, to the ScriptInterpreterPython.
This
[lldb/Interpreter] Add ScriptInterpreter Wrapper for ScriptedProcess
This patch adds a ScriptedProcess interface to the ScriptInterpreter and more specifically, to the ScriptInterpreterPython.
This interface will be used in the C++ `ScriptProcess` Process Plugin to call the script methods.
At the moment, not all methods are implemented, they will upstreamed in upcoming patches.
This patch also adds helper methods to the ScriptInterpreter to convert `SBAPI` Types (SBData & SBError) to `lldb_private` types (DataExtractor & Status).
rdar://65508855
Differential Revision: https://reviews.llvm.org/D95711
Signed-off-by: Med Ismail Bennani <[email protected]>
show more ...
|
|
Revision tags: llvmorg-11.1.0, llvmorg-11.1.0-rc3, llvmorg-12.0.0-rc1, llvmorg-13-init, llvmorg-11.1.0-rc2, llvmorg-11.1.0-rc1, llvmorg-11.0.1, llvmorg-11.0.1-rc2, llvmorg-11.0.1-rc1, llvmorg-11.0.0, llvmorg-11.0.0-rc6, llvmorg-11.0.0-rc5 |
|
| #
2f95c50a |
| 29-Sep-2020 |
Richard Smith <[email protected]> |
Fix use of wrong printf format specifier for size_t argument.
This causes a build break under -Werror=format.
|
| #
1b1d9815 |
| 28-Sep-2020 |
Jim Ingham <[email protected]> |
Revert "Revert "Add the ability to write target stop-hooks using the ScriptInterpreter.""
This reverts commit f775fe59640a2e837ad059a8f40e26989d4f9831.
I fixed a return type error in the original p
Revert "Revert "Add the ability to write target stop-hooks using the ScriptInterpreter.""
This reverts commit f775fe59640a2e837ad059a8f40e26989d4f9831.
I fixed a return type error in the original patch that was causing a test failure. Also added a REQUIRES: python to the shell test so we'll skip this for people who build lldb w/o Python. Also added another test for the error printing.
show more ...
|
| #
f775fe59 |
| 28-Sep-2020 |
Jonas Devlieghere <[email protected]> |
Revert "Add the ability to write target stop-hooks using the ScriptInterpreter."
This temporarily reverts commit b65966cff65bfb66de59621347ffd97238d3f645 while Jim figures out why the test is failin
Revert "Add the ability to write target stop-hooks using the ScriptInterpreter."
This temporarily reverts commit b65966cff65bfb66de59621347ffd97238d3f645 while Jim figures out why the test is failing on the bots.
show more ...
|
|
Revision tags: llvmorg-11.0.0-rc4 |
|
| #
67782a0f |
| 26-Sep-2020 |
Fangrui Song <[email protected]> |
[lldb/bindings] Fix -Wformat after D88123
|
| #
b65966cf |
| 22-Sep-2020 |
Jim Ingham <[email protected]> |
Add the ability to write target stop-hooks using the ScriptInterpreter.
Differential Revision: https://reviews.llvm.org/D88123
|
|
Revision tags: llvmorg-11.0.0-rc3, llvmorg-11.0.0-rc2, llvmorg-11.0.0-rc1 |
|
| #
b79dff02 |
| 20-Jul-2020 |
Jonas Devlieghere <[email protected]> |
[lldb] Make sure we don't leak SBThreadPlan pointer (NFCI)
Make sure we don't accidentally leak the SBThreadPlan pointer when we return before handing it off to Python to manage its lifetime.
|