Author: Med Ismail Bennani
Date: 2023-04-25T15:02:34-07:00
New Revision: ad03aeadfb72e9c872b297bbaedbf46ebac3572c

URL: 
https://github.com/llvm/llvm-project/commit/ad03aeadfb72e9c872b297bbaedbf46ebac3572c
DIFF: 
https://github.com/llvm/llvm-project/commit/ad03aeadfb72e9c872b297bbaedbf46ebac3572c.diff

LOG: [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 <medismail.benn...@gmail.com>

Added: 
    

Modified: 
    lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
    lldb/source/Plugins/Process/scripted/ScriptedProcess.h

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp 
b/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
index 3c2e8f51aa039..dc27bcf425957 100644
--- a/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
+++ b/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp
@@ -249,6 +249,20 @@ size_t ScriptedProcess::DoWriteMemory(lldb::addr_t 
vm_addr, const void *buf,
   return bytes_written;
 }
 
+Status ScriptedProcess::EnableBreakpointSite(BreakpointSite *bp_site) {
+  assert(bp_site != nullptr);
+
+  if (bp_site->IsEnabled()) {
+    return {};
+  }
+
+  if (bp_site->HardwareRequired()) {
+    return Status("Scripted Processes don't support hardware breakpoints");
+  }
+
+  return EnableSoftwareBreakpoint(bp_site);
+}
+
 ArchSpec ScriptedProcess::GetArchitecture() {
   return GetTarget().GetArchitecture();
 }

diff  --git a/lldb/source/Plugins/Process/scripted/ScriptedProcess.h 
b/lldb/source/Plugins/Process/scripted/ScriptedProcess.h
index 594bd090fb988..24b5a317b54fa 100644
--- a/lldb/source/Plugins/Process/scripted/ScriptedProcess.h
+++ b/lldb/source/Plugins/Process/scripted/ScriptedProcess.h
@@ -74,6 +74,8 @@ class ScriptedProcess : public Process {
   size_t DoWriteMemory(lldb::addr_t vm_addr, const void *buf, size_t size,
                        Status &error) override;
 
+  Status EnableBreakpointSite(BreakpointSite *bp_site) override;
+
   ArchSpec GetArchitecture();
 
   Status


        
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to