aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/Process/scripted/ScriptedProcess.h
AgeCommit message (Collapse)AuthorFilesLines
2025-03-17Reapply "[lldb] Implement basic support for reverse-continue (#125242)" ↵Pavel Labath1-1/+1
(again) (#128156) This reverts commit https://github.com/llvm/llvm-project/commit/87b7f63a117c340a6d9ca47959335fd7ef6c7ad2, reapplying https://github.com/llvm/llvm-project/commit/7e66cf74fb4e6a103f923e34700a7b6f20ac2a9b with a small (and probably temporary) change to generate more debug info to help with diagnosing buildbot issues.
2025-01-31Revert "Reland "[lldb] Implement basic support for reverse-continue" (#125242)"Adrian Prantl1-1/+1
This reverts commit 7e66cf74fb4e6a103f923e34700a7b6f20ac2a9b. Breaking green dragon: https://green.lab.llvm.org/job/llvm.org/view/LLDB/job/as-lldb-cmake/19569/testReport/junit/lldb-api/functionalities_reverse-execution/TestReverseContinueWatchpoints_py/
2025-01-31Reland "[lldb] Implement basic support for reverse-continue" (#125242)David Spickett1-1/+1
This reverts commit a774de807e56c1147d4630bfec3110c11d41776e. This is the same changes as last time, plus: * We load the binary into the target object so that on Windows, we can resolve the locations of the functions. * We now assert that each required breakpoint has at least 1 location, to prevent an issue like that in the future. * We are less strict about the unsupported error message, because it prints "error: windows" on Windows instead of "error: gdb-remote".
2025-01-30Revert "Reland "[lldb] Implement basic support for reverse-continue" ↵David Spickett1-1/+1
(#123906)"" (#125091) Reverts llvm/llvm-project#123945 Has failed on the Windows on Arm buildbot: https://lab.llvm.org/buildbot/#/builders/141/builds/5865 ``` ******************** Unresolved Tests (2): lldb-api :: functionalities/reverse-execution/TestReverseContinueBreakpoints.py lldb-api :: functionalities/reverse-execution/TestReverseContinueWatchpoints.py ******************** Failed Tests (1): lldb-api :: functionalities/reverse-execution/TestReverseContinueNotSupported.py ``` Reverting while I reproduce locally.
2025-01-30Reland "[lldb] Implement basic support for reverse-continue" (#123906)" ↵David Spickett1-1/+1
(#123945) This reverts commit 22561cfb443267905d4190f0e2a738e6b412457f and fixes b7b9ccf44988edf49886743ae5c3cf4184db211f (#112079). The problem is that x86_64 and Arm 32-bit have memory regions above the stack that are readable but not writeable. First Arm: ``` (lldb) memory region --all <...> [0x00000000fffcf000-0x00000000ffff0000) rw- [stack] [0x00000000ffff0000-0x00000000ffff1000) r-x [vectors] [0x00000000ffff1000-0xffffffffffffffff) --- ``` Then x86_64: ``` $ cat /proc/self/maps <...> 7ffdcd148000-7ffdcd16a000 rw-p 00000000 00:00 0 [stack] 7ffdcd193000-7ffdcd196000 r--p 00000000 00:00 0 [vvar] 7ffdcd196000-7ffdcd197000 r-xp 00000000 00:00 0 [vdso] ffffffffff600000-ffffffffff601000 --xp 00000000 00:00 0 [vsyscall] ``` Compare this to AArch64 where the test did pass: ``` $ cat /proc/self/maps <...> ffffb87dc000-ffffb87dd000 r--p 00000000 00:00 0 [vvar] ffffb87dd000-ffffb87de000 r-xp 00000000 00:00 0 [vdso] ffffb87de000-ffffb87e0000 r--p 0002a000 00:3c 76927217 /usr/lib/aarch64-linux-gnu/ld-linux-aarch64.so.1 ffffb87e0000-ffffb87e2000 rw-p 0002c000 00:3c 76927217 /usr/lib/aarch64-linux-gnu/ld-linux-aarch64.so.1 fffff4216000-fffff4237000 rw-p 00000000 00:00 0 [stack] ``` To solve this, look up the memory region of the stack pointer (using https://lldb.llvm.org/resources/lldbgdbremote.html#qmemoryregioninfo-addr) and constrain the read to within that region. Since we know the stack is all readable and writeable. I have also added skipIfRemote to the tests, since getting them working in that context is too complex to be worth it. Memory write failures now display the range they tried to write, and register write errors will show the name of the register where possible. The patch also includes a workaround for a an issue where the test code could mistake an `x` response that happens to begin with an `O` for an output packet (stdout). This workaround will not be necessary one we start using the [new implementation](https://discourse.llvm.org/t/rfc-fixing-incompatibilties-of-the-x-packet-w-r-t-gdb/84288) of the `x` packet. --------- Co-authored-by: Pavel Labath <pavel@labath.sk>
2025-01-22Revert "[lldb] Implement basic support for reverse-continue" (#123906)Pavel Labath1-1/+1
Reverts llvm/llvm-project#112079 due to failures on the arm bot.
2025-01-22[lldb] Implement basic support for reverse-continue (#112079)Robert O'Callahan1-1/+1
This commit adds support for a `SBProcess::ContinueInDirection()` API. A user-accessible command for this will follow in a later commit. This feature depends on a gdbserver implementation (e.g. `rr`) providing support for the `bc` and `bs` packets. `lldb-server` does not support those packets, and there is no plan to change that. For testing purposes, this commit adds a Python implementation of *very limited* record-and-reverse-execute functionality, implemented as a proxy between lldb and lldb-server in `lldbreverse.py`. This should not (and in practice cannot) be used for anything except testing. The tests here are quite minimal but we test that simple breakpoints and watchpoints work as expected during reverse execution, and that conditional breakpoints and watchpoints work when the condition calls a function that must be executed in the forward direction.
2024-10-10Revert "[lldb] Implement basic support for reverse-continue (#99736)"Jason Molenda1-1/+1
Reverting this again; I added a commit which added @skipIfDarwin markers to the TestReverseContinueBreakpoints.py and TestReverseContinueNotSupported.py API tests, which use lldb-server in gdbserver mode which does not work on Darwin. But the aarch64 ubuntu bot reported a failure on TestReverseContinueBreakpoints.py, https://lab.llvm.org/buildbot/#/builders/59/builds/6397 File "/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/functionalities/reverse-execution/TestReverseContinueBreakpoints.py", line 63, in test_reverse_continue_skip_breakpoint self.reverse_continue_skip_breakpoint_internal(async_mode=False) File "/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/functionalities/reverse-execution/TestReverseContinueBreakpoints.py", line 81, in reverse_continue_skip_breakpoint_internal self.expect( File "/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 2372, in expect self.runCmd( File "/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 1002, in runCmd self.assertTrue(self.res.Succeeded(), msg + output) AssertionError: False is not true : Process should be stopped due to history boundary Error output: error: Process must be launched. This reverts commit 4f297566b3150097de26c6a23a987d2bd5fc19c5.
2024-10-10[lldb] Implement basic support for reverse-continue (#99736)Robert O'Callahan1-1/+1
This commit only adds support for the `SBProcess::ReverseContinue()` API. A user-accessible command for this will follow in a later commit. This feature depends on a gdbserver implementation (e.g. `rr`) providing support for the `bc` and `bs` packets. `lldb-server` does not support those packets, and there is no plan to change that. So, for testing purposes, `lldbreverse.py` wraps `lldb-server` with a Python implementation of *very limited* record-and-replay functionality for use by *tests only*. The majority of this PR is test infrastructure (about 700 of the 950 lines added).
2024-10-10Revert "[lldb] Implement basic support for reverse-continue (#99736)"Augusto Noronha1-1/+1
This reverts commit d5e1de6da96c1ab3b8cae68447e8ed3696a7006e.
2024-10-10[lldb] Implement basic support for reverse-continue (#99736)Robert O'Callahan1-1/+1
This commit only adds support for the `SBProcess::ReverseContinue()` API. A user-accessible command for this will follow in a later commit. This feature depends on a gdbserver implementation (e.g. `rr`) providing support for the `bc` and `bs` packets. `lldb-server` does not support those packets, and there is no plan to change that. So, for testing purposes, `lldbreverse.py` wraps `lldb-server` with a Python implementation of *very limited* record-and-replay functionality for use by *tests only*. The majority of this PR is test infrastructure (about 700 of the 950 lines added).
2023-07-06[lldb] Fix dead lock issue when loading modules in Scripted ProcessMed Ismail Bennani1-0/+6
This patch attempts to fix a dead lock when loading modules in a Scripted Process. This issue was triggered by loading the modules after the process did resume, but before the process actually stop, causing the language runtime mutex to be locked by a separate thread, responsible to unwind the stack (using the runtime unwind plan), while the module loading thread was trying to notify the runtimes of the newly loaded module. To address that, this patch moves the module loading logic to be done before sending the stop event, to prevent the dead lock situation described above. Differential Revision: https://reviews.llvm.org/D154649 Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2023-04-25[lldb/Plugin] Add breakpoint setting support to ScriptedProcessMed Ismail Bennani1-0/+2
This patch adds support for breakpoint setting to Scripted Processes. For now, Scripted Processes only support setting software breakpoints. When doing interactive scripted process debugging, it makes use of the memory writing capability to write the trap opcodes in the memory of the driving process. However the real process' target doesn't keep track of the breakpoints that got added by the scripted process. This is a design that we might need to change in the future, since we'll probably need to do some book keeping to handle breakpoints that were set by different scripted processes. Differential Revision: https://reviews.llvm.org/D145296 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2023-04-25[lldb] Move ScriptedProcess private state update to implementationMed Ismail Bennani1-2/+0
While debugging a Scripted Process, in order to update its state and work nicely with lldb's execution model, it needs to toggle its private state from running to stopped, which will result in broadcasting a process state changed event to the debugger listener. Originally, this state update was done systematically in the Scripted Process C++ plugin, however in order to make scripted process interactive, we need to be able to update their state dynamically. This patch makes use of the recent addition of the SBProcess::ForceScriptedState to programatically, and moves the process private state update to the python implementation of the resume method instead of doing it in ScriptedProcess::DoResume. This patch also removes the unused ShouldStop & Stop scripted process APIs, and adds new ScriptedInterface transform methods for boolean arguments. This allow the user to programmatically decide if after running the process, we should stop it (which is the default setting). Differential Revision: https://reviews.llvm.org/D145295 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2023-04-25[lldb/API] Introduce SBProcess::ForceScriptedState methodMed Ismail Bennani1-0/+4
This patch introduces a new method to the SBProcess API called ForceScriptedState. As the name suggests, this affordance will allow the user to alter the state of the scripted process programatically. This is necessary to update the scripted process state when perform interactive debugging. Differential Revision: https://reviews.llvm.org/D145294 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2023-04-12[lldb] Fix assertion when ScriptedProcess have no pid after launchMed Ismail Bennani1-0/+2
This patch should fix an assertion that causes some test failures: https://ci.swift.org/view/LLDB/job/llvm-org-lldb-release-debuginfo/3587/console This was caused by the changes introduces in `88f409194d5a` where we replaced `DidLaunch` by `DidResume` in the `ScriptedProcess` class. However, by the time we resume the process, the pid should be already set. To address this, this patch brings back `DidLaunch` which will initialize the ScriptedProcess pid with a placeholder value. That value will be updated in `DidResume` to the final pid. Note, this 2 stage PID initialization is necessary sometimes, when the scripted process gets stopped at entry (launch) and gets assigned an object that contains the PID value. In this case, we need to update the PID when we resume the process after we've stopped at entry. This also replaces the default scripted process id to an arbitrary number (42) since the current value (0) is considered invalid. Differential Revision: https://reviews.llvm.org/D148153 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2023-04-11[lldb] Parse the crashlog only onceJonas Devlieghere1-1/+1
Now that we can pass Python objects to the scripted process instance, we don't need to parse the crashlog twice anymore. Differential revision: https://reviews.llvm.org/D148063
2023-03-06Revert "[lldb/Plugin] Add breakpoint setting support to ScriptedProcesses."Med Ismail Bennani1-2/+0
This reverts commit cfe06f495beb520ab366957d1108bb80c7c92832.
2023-03-06Revert "[lldb] Move ScriptedProcess private state update to implementation"Med Ismail Bennani1-0/+2
This reverts commit 3c33d72e7fa83beb8a9b39fb3b8ecf4ee00c697d.
2023-03-06Revert "[lldb/API] Introduce SBProcess::ForceScriptedState method"Med Ismail Bennani1-4/+0
This reverts commit 3675e0bb67fa86b8476a67bb1a7623a6b1a373b3.
2023-03-06[lldb/Utility] Fix layering violation caused by ScriptedMetadataMed Ismail Bennani1-1/+1
This patch moves `ScriptedMetadata.h` from the `Interpreter` directory to the `Utility` sub-directory since `ProcessInfo.h` depends on it. It also gets rid of the unused `OptionGroupPythonClassWithDict` constructor for `ScriptedMetadata` which would address the layering violation. Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2023-03-06[lldb/Plugin] Add breakpoint setting support to ScriptedProcesses.Med Ismail Bennani1-0/+2
This patch adds support for breakpoint setting to Scripted Processes. For now, Scripted Processes only support setting software breakpoints. When doing interactive scripted process debugging, it makes use of the memory writing capability to write the trap opcodes in the memory of the driving process. However the real process' target doesn't keep track of the breakpoints that got added by the scripted process. This is a design that we might need to change in the future, since we'll probably need to do some book keeping to handle breakpoints that were set by different scripted processes. Differential Revision: https://reviews.llvm.org/D145296 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2023-03-06[lldb] Move ScriptedProcess private state update to implementationMed Ismail Bennani1-2/+0
While debugging a Scripted Process, in order to update its state and work nicely with lldb's execution model, it needs to toggle its private state from running to stopped, which will result in broadcasting a process state changed event to the debugger listener. Originally, this state update was done systematically in the Scripted Process C++ plugin, however in order to make scripted process interactive, we need to be able to update their state dynamically. This patch makes use of the recent addition of the `SBProcess::ForceScriptedState` to programatically, and moves the process private state update to the python implementation of the `resume` method instead of doing it in `ScriptedProcess::DoResume`. This patch also removes the unused `ShouldStop` & `Stop` scripted process APIs, and adds new ScriptedInterface transform methods for boolean arguments. This allow the user to programmatically decide if after running the process, we should stop it (which is the default setting). Differential Revision: https://reviews.llvm.org/D145295 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2023-03-06[lldb/API] Introduce SBProcess::ForceScriptedState methodMed Ismail Bennani1-0/+4
This patch introduces a new method to the SBProcess API called ForceScriptedState. As the name suggests, this affordance will allow the user to alter the private state of the scripted process programatically. This is necessary to update the scripted process state when perform interactive debugging. Differential Revision: https://reviews.llvm.org/D145294 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2023-03-03[lldb/Plugins] Add memory writing capabilities to Scripted ProcessMed Ismail Bennani1-0/+3
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>
2023-03-03[lldb/Plugins] Add Attach capabilities to ScriptedProcessMed Ismail Bennani1-0/+11
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>
2023-02-06[lldb/Plugins] Fix method dispatch bug when using multiple scripted processesMed Ismail Bennani1-4/+5
This patch should address a bug when a user have multiple scripted processes in the same debugging session. In order for the scripted process plugin to be able to call into the scripted object instance methods to fetch the necessary data to reconstruct its state, the scripted process plugin calls into a scripted process interface, that has a reference to the created script object instance. However, prior to this patch, we only had a single instance of the scripted process interface, living the script interpreter. So every time a new scripted process plugin was created, it would overwrite the script object instance that was held by the single scripted process interface in the script interpreter. That would cause all the method calls made to the scripted process interface to be dispatched by the last instanciated script object instance, which is wrong. In order to prevent that, this patch moves the scripted process interface reference to be help by the scripted process plugin itself. rdar://104882562 Differential Revision: https://reviews.llvm.org/D143308 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2023-02-03[lldb] Add a way to get a scripted process implementation from the SBAPIMed Ismail Bennani1-0/+2
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>
2023-01-12[lldb/Process] Populate queues in Scripted ProcessMed Ismail Bennani1-0/+2
This patch enhances queue support in Scripted Processes. Scripted Threads could already report their queue name if they had one, but this information was only surfaced when getting the process and thread status. However, no queue was create and added to the scripted process queue list. This patch improves that by creating a queue from the scripted thread queue name. For now, it uses an invalid queue id, since the scripted thread doesn't expose this capability yet, but this could easily be supported if the queue id information is available. rdar://98844004 Differential Revision: https://reviews.llvm.org/D139853 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2023-01-12[lldb/Interpreter] Make ScriptedProcessInfo more genericMed Ismail Bennani1-20/+3
This patch moves the ScriptedProcessInfo class out of the ScriptedProcess and hoist it as a standalone interpreter class, so it can be reused with the Scripted Platform. Differential Revision: https://reviews.llvm.org/D139247 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2022-11-03[lldb/crashlog] Add support for Application Specific Backtraces & InformationMed Ismail Bennani1-2/+2
For an exception crashlog, the thread backtraces aren't usually very helpful and instead, developpers look at the "Application Specific Backtrace" that was generated by `objc_exception_throw`. LLDB could already parse and symbolicate these Application Specific Backtraces for regular textual-based crashlog, so this patch adds support to parse them in JSON crashlogs, and materialize them a HistoryThread extending the crashed ScriptedThread. This patch also includes the Application Specific Information messages as part of the process extended crash information log. To do so, the ScriptedProcess Python interface has a new GetMetadata method that returns an arbitrary dictionary with data related to the process. rdar://93207586 Differential Revision: https://reviews.llvm.org/D126260 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2022-08-08[lldb] Make Process and subclass constructors protectedMichał Górny1-4/+4
Make constructors of the Process and its subclasses class protected, to prevent accidentally constructing Process on stack when it could be afterwards accessed via a shared_ptr (since it uses std::enable_shared_from_this<>). The only place where a stack allocation was used were unittests, and fixing them via declaring an explicit public constructor in the respective mock classes is trivial. Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.llvm.org/D131275
2022-03-04[lldb/Plugins] Add ability to load modules to Scripted ProcessesMed Ismail Bennani1-0/+3
This patch introduces a new way to load modules programatically with Scripted Processes. To do so, the scripted process blueprint holds a list of dictionary describing the modules to load, which their path or uuid, load address and eventually a slide offset. LLDB will fetch that list after launching the ScriptedProcess, and iterate over each entry to create the module that will be loaded in the Scripted Process' target. The patch also refactors the StackCoreScriptedProcess test to stop inside the `libbaz` module and make sure it's loaded correctly and that we can fetch some variables from it. rdar://74520238 Differential Revision: https://reviews.llvm.org/D120969 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2022-02-10Reland "[lldb] Remove non address bits when looking up memory regions"David Spickett1-3/+3
This reverts commit 0df522969a7a0128052bd79182c8d58e00556e2f. Additional checks are added to fix the detection of the last memory region in GetMemoryRegions or repeating the "memory region" command when the target has non-address bits. Normally you keep reading from address 0, looking up each region's end address until you get LLDB_INVALID_ADDR as the region end address. (0xffffffffffffffff) This is what the remote will return once you go beyond the last mapped region: [0x0000fffffffdf000-0x0001000000000000) rw- [stack] [0x0001000000000000-0xffffffffffffffff) --- Problem is that when we "fix" the lookup address, we remove some bits from it. On an AArch64 system we have 48 bit virtual addresses, so when we fix the end address of the [stack] region the result is 0. So we loop back to the start. [0x0000fffffffdf000-0x0001000000000000) rw- [stack] [0x0000000000000000-0x0000000000400000) --- To fix this I added an additional check for the last range. If the end address of the region is different once you apply FixDataAddress, we are at the last region. Since the end of the last region will be the last valid mappable address, plus 1. That 1 will be removed by the ABI plugin. The only side effect is that on systems with non-address bits, you won't get that last catch all unmapped region from the max virtual address up to 0xf...f. [0x0000fffff8000000-0x0000fffffffdf000) --- [0x0000fffffffdf000-0x0001000000000000) rw- [stack] <ends here> Though in some way this is more correct because that region is not just unmapped, it's not mappable at all. No extra testing is needed because this is already covered by TestMemoryRegion.py, I simply forgot to run it on system that had both top byte ignore and pointer authentication. This change has been tested on a qemu VM with top byte ignore, memory tagging and pointer authentication enabled. Reviewed By: omjavaid Differential Revision: https://reviews.llvm.org/D115508
2021-11-26Revert "Reland "[lldb] Remove non address bits when looking up memory regions""David Spickett1-3/+3
This reverts commit fac3f20de55769d028bd92220e74f22fa57dd4b2. I found this has broken how we detect the last memory region in GetMemoryRegions/"memory region" command. When you're debugging an AArch64 system with pointer authentication, the ABI plugin will remove the top bit from the end address of the last user mapped area. (lldb) [0x0000fffffffdf000-0x0001000000000000) rw- [stack] ABI plugin removes anything above the 48th bit (48 bit virtual addresses by default on AArch64, leaving an address of 0. (lldb) [0x0000000000000000-0x0000000000400000) --- You get back a mapping for 0 and get into an infinite loop.
2021-11-11[lldb/Plugins] Refactor ScriptedThread register context creationMed Ismail Bennani1-1/+1
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 <medismail.bennani@gmail.com>
2021-11-10[lldb] Fix Scripted ProcessLaunchInfo Argument nullptr derefMed Ismail Bennani1-5/+3
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 <medismail.bennani@gmail.com>
2021-11-03Reland "[lldb] Remove non address bits when looking up memory regions"David Spickett1-3/+3
This reverts commit 5fbcf677347e38718461496d9e9e184a7a30c3fb. ProcessDebugger is used in ProcessWindows and NativeProcessWindows. I thought I was simplifying things by renaming to DoGetMemoryRegionInfo in ProcessDebugger but the Native process side expects "GetMemoryRegionInfo". Follow the pattern that WriteMemory uses. So: * ProcessWindows::DoGetMemoryRegioninfo calls ProcessDebugger::GetMemoryRegionInfo * NativeProcessWindows::GetMemoryRegionInfo does the same
2021-11-03Revert "[lldb] Remove non address bits when looking up memory regions"David Spickett1-3/+3
This reverts commit 6f5ce43b433706c3ae5c37022d6c0964b6bfadf8 due to build failure on Windows.
2021-11-03[lldb] Remove non address bits when looking up memory regionsDavid Spickett1-3/+3
On AArch64 we have various things using the non address bits of pointers. This means when you lookup their containing region you won't find it if you don't remove them. This changes Process GetMemoryRegionInfo to a non virtual method that uses the current ABI plugin to remove those bits. Then it calls DoGetMemoryRegionInfo. That function does the actual work and is virtual to be overriden by Process implementations. A test case is added that runs on AArch64 Linux using the top byte ignore feature. Reviewed By: omjavaid Differential Revision: https://reviews.llvm.org/D102757
2021-10-28[lldb] Remove ConstString from Process, ScriptInterpreter and StructuredData ↵Pavel Labath1-5/+3
plugin names
2021-10-18[lldb] Return StringRef from PluginInterface::GetPluginNamePavel Labath1-1/+3
There is no reason why this function should be returning a ConstString. While modifying these files, I also fixed several instances where GetPluginName and GetPluginNameStatic were returning different strings. I am not changing the return type of GetPluginNameStatic in this patch, as that would necessitate additional changes, and this patch is big enough as it is. Differential Revision: https://reviews.llvm.org/D111877
2021-10-08[lldb/Plugins] Add support for ScriptedThread in ScriptedProcessMed Ismail Bennani1-0/+4
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 <medismail.bennani@gmail.com>
2021-09-13[lldb] Remove PluginInterface::GetPluginVersionPavel Labath1-2/+0
In all these years, we haven't found a use for this function (it has zero callers). Lets just remove the boilerplate. Differential Revision: https://reviews.llvm.org/D109600
2021-07-22[lldb/Plugins] Add ScriptedProcess Process PluginMed Ismail Bennani1-0/+119
This patch introduces Scripted Processes to lldb. The goal, here, is to be able to attach in the debugger to fake processes that are backed by script files (in Python, Lua, Swift, etc ...) and inspect them statically. Scripted Processes can be used in cooperative multithreading environments like the XNU Kernel or other real-time operating systems, but it can also help us improve the debugger testing infrastructure by writting synthetic tests that simulates hard-to-reproduce process/thread states. Although ScriptedProcess is not feature-complete at the moment, it has basic execution capabilities and will improve in the following patches. rdar://65508855 Differential Revision: https://reviews.llvm.org/D100384 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2021-03-24Revert "[lldb/Plugins] Add ScriptedProcess Process Plugin"Med Ismail Bennani1-113/+0
Reverting commit b09d44b6ae0901865a0d4b2a0cf797c3cd34eeeb, since it breaks the windows bots: https://lab.llvm.org/buildbot/#/builders/83/builds/4993 It seems to crash the `TestIRMemoryMapWindows.test` test.
2021-03-24[lldb/Plugins] Add ScriptedProcess Process PluginMed Ismail Bennani1-0/+113
This patch introduces Scripted Processes to lldb. The goal, here, is to be able to attach in the debugger to fake processes that are backed by script files (in Python, Lua, Swift, etc ...) and inspect them statically. Scripted Processes can be used in cooperative multithreading environments like the XNU Kernel or other real-time operating systems, but it can also help us improve the debugger testing infrastructure by writting synthetic tests that simulates hard-to-reproduce process/thread states. Although ScriptedProcess is not feature-complete at the moment, it has basic execution capabilities and will improve in the following patches. rdar://65508855 Differential Revision: https://reviews.llvm.org/D95713 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2021-03-24Revert "[lldb/Plugins] Add ScriptedProcess Process Plugin"David Zarzycki1-113/+0
This reverts commit dd391e1ef762d79f86112dc2480a89c9be066ce1. This patch causes 17 LLDB test regressions on Fedora 33 (x86-64).
2021-03-23[lldb/Plugins] Add ScriptedProcess Process PluginMed Ismail Bennani1-0/+113
This patch introduces Scripted Processes to lldb. The goal, here, is to be able to attach in the debugger to fake processes that are backed by script files (in Python, Lua, Swift, etc ...) and inspect them statically. Scripted Processes can be used in cooperative multithreading environments like the XNU Kernel or other real-time operating systems, but it can also help us improve the debugger testing infrastructure by writting synthetic tests that simulates hard-to-reproduce process/thread states. Although ScriptedProcess is not feature-complete at the moment, it has basic execution capabilities and will improve in the following patches. rdar://65508855 Differential Revision: https://reviews.llvm.org/D95713 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2021-03-01[lldb] Revert ScriptedProcess patchesMed Ismail Bennani1-113/+0
This patch reverts the following commits: - 5a9c34918bb1526b7e8c29aa5e4fb8d8e27e27b4 - 46796762afe76496ec4dd900f64d0cf4cdc30e99 - 2cff3dec1171188ce04ab1a4373cc1885ab97be1 - 182f0d1a34419445bb19d67581d6ac1afc98b7fa - d62a53aaf1d38a55d1affbd3a30d564a4e9d3171 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>