Skip to content

Commit 055ea41

Browse files
committed
[lldb/Plugin] Add breakpoint setting support to ScriptedProcess
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 <[email protected]>
1 parent bc2a07c commit 055ea41

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,20 @@ size_t ScriptedProcess::DoWriteMemory(lldb::addr_t vm_addr, const void *buf,
246246
return bytes_written;
247247
}
248248

249+
Status ScriptedProcess::EnableBreakpointSite(BreakpointSite *bp_site) {
250+
assert(bp_site != nullptr);
251+
252+
if (bp_site->IsEnabled()) {
253+
return {};
254+
}
255+
256+
if (bp_site->HardwareRequired()) {
257+
return Status("Scripted Processes don't support hardware breakpoints");
258+
}
259+
260+
return EnableSoftwareBreakpoint(bp_site);
261+
}
262+
249263
ArchSpec ScriptedProcess::GetArchitecture() {
250264
return GetTarget().GetArchitecture();
251265
}

lldb/source/Plugins/Process/scripted/ScriptedProcess.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ class ScriptedProcess : public Process {
7272
size_t DoWriteMemory(lldb::addr_t vm_addr, const void *buf, size_t size,
7373
Status &error) override;
7474

75+
Status EnableBreakpointSite(BreakpointSite *bp_site) override;
76+
7577
ArchSpec GetArchitecture();
7678

7779
Status

0 commit comments

Comments
 (0)