forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 344
[lldb] Add support for ScriptedProcess #3535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
medismailben
merged 14 commits into
swiftlang:stable/20210726
from
medismailben:stable/20210726
Nov 15, 2021
Merged
[lldb] Add support for ScriptedProcess #3535
medismailben
merged 14 commits into
swiftlang:stable/20210726
from
medismailben:stable/20210726
Nov 15, 2021
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@swift-ci test |
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]>
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]>
This patch disables TestScriptedProcess.py on Linux and Windows while I investigate the OS specific failure: http://lab.llvm.org:8011/#/builders/68/builds/19793 Signed-off-by: Med Ismail Bennani <[email protected]>
This should fix a build failure on Windows caused by the macro __PRETTY_FUNCTION__ not being defined. https://lab.llvm.org/buildbot/#/builders/83/builds/10836 https://reviews.llvm.org/D107585 Signed-off-by: Med Ismail Bennani <[email protected]>
…ION (NFC) This patch refactors Scripted Process and Scripted Thread related classes to use LLVM_PRETTY_FUNCTION instead of the compiler macro. Differential Revision: https://reviews.llvm.org/D111452 Signed-off-by: Med Ismail Bennani <[email protected]>
This is disabling 'TestScriptedProcess.py' on macOS since it fails on Green Dragon: https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/35974 Signed-off-by: Med Ismail Bennani <[email protected]>
This patch adds a new `StructuredData::Dictionary` constructor that takes a `StructuredData::ObjectSP` as an argument. This is used to pass the opaque_ptr from the `SBStructuredData` used to initialize a ScriptedProecss, to the `ProcessLaunchInfo` class. This also updates `SBLaunchInfo::SetScriptedProcessDictionary` to reflect the formentionned changes which solves the nullptr deref. Differential Revision: https://reviews.llvm.org/D112107 Signed-off-by: Med Ismail Bennani <[email protected]>
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]>
This is failing on Arm and AArch64 Linux buildbots since the time it was comitted. https://lab.llvm.org/buildbot/#/builders/96/builds/12628 Differential Revision: https://reviews.llvm.org/D107585
This patch changes the ScriptedProcess test to use a stack-only skinny corefile as a backing store. The corefile is saved as a temporary file at the beginning of the test, and a second target is created for the ScriptedProcess. To do so, we use the SBAPI from the ScriptedProcess' python script to interact with the corefile process. This patch also makes some small adjustments to the other ScriptedProcess scripts to resolve some inconsistencies and removes the raw memory dump that was previously checked in. Differential Revision: https://reviews.llvm.org/D112047 Signed-off-by: Med Ismail Bennani <[email protected]>
…(NFC) Because TestScriptedProcess.py creates a skinny corefile to provides data to the ScriptedProcess and ScriptedThread, we need to make sure that the debugserver used is not out of tree, to ensure feature availability between debugserver and lldb. This also removes the `SKIP_SCRIPTED_PROCESS_LAUNCH` env variable after each test finish running. Signed-off-by: Med Ismail Bennani <[email protected]>
This patch changes the ScriptedThread class to create the register context when Process::RefreshStateAfterStop is called rather than doing it in the thread constructor. This is required to update the thread state for execution control. Differential Revision: https://reviews.llvm.org/D112167 Signed-off-by: Med Ismail Bennani <[email protected]>
This patch replaces `DynamicRegisterInfo.h` include path since the file has been moved upstream in 214054f, but merging that change requires cherry-picking multiple patches that could potentially affect the branch stability. Signed-off-by: Med Ismail Bennani <[email protected]>
28183bb
to
4c10566
Compare
@swift-ci test |
Signed-off-by: Med Ismail Bennani <[email protected]>
@swift-ci test |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
rdar://74640909