================
@@ -1159,6 +1159,40 @@ class StopInfoUnixSignal : public StopInfo {
     return false;
   }
 
+  void PerformAction(Event *event_ptr) override {
+    // A signal of SIGTRAP indicates that a break instruction has been hit
+    if (m_value == SIGTRAP) {
+      Log *log = GetLog(LLDBLog::Process);
+      Status error;
+      std::array<uint8_t, 4> bytes_at_pc = {0, 0, 0, 0};
+      auto reg_ctx_sp = GetThread()->GetRegisterContext();
+      auto process_sp = GetThread()->GetProcess();
+      addr_t pc = reg_ctx_sp->GetPC();
+      if (!process_sp->ReadMemory(pc, bytes_at_pc.data(), bytes_at_pc.size(),
+                                  error)) {
+        // If this fails, we simply don't handle the step-over-break logic and
+        // log the failure
+        LLDB_LOG(log, "failed to read program bytes at pc address {}, error 
{}",
+                 pc, error);
+        return;
+      }
+      auto &target = process_sp->GetTarget();
+      auto platform_sp = target.GetPlatform();
+      auto platform_opcode =
+          platform_sp->SoftwareTrapOpcodeTable(target.GetArchitecture());
----------------
DuncanMcBain wrote:

This is correct. The problem is I don't think there's a way from "up here" to 
know what the correct choice of the size hint would be. However, the size_hint 
is used elsewhere in the process plugins to disambiguate certain situations, so 
I tried to mirror that (and preserve the behaviour of the 
GetSoftwareBreakpointTrapOpcode function).

It should be possible to change it such that the ArchitectureXxx 
implementations actually check for both the normal and compressed functions and 
check if either match (much like ArchitectureArm currently will check for 
either the undef instruction or BKPT sequences at the moment). Do you think 
that would be better?

https://github.com/llvm/llvm-project/pull/174348
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to