[Lldb-commits] [PATCH] D153079: Add an llvm::report_fatal_error for when the darwin kernel says we've finished an insn-step but the thread doesn't think it was insn-stepping
Jason Molenda via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Thu Jun 15 15:42:11 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6a8e2538afc1: Add a fatal error for debug builds when disagreement about stepping (authored by jasonmolenda).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D153079/new/
https://reviews.llvm.org/D153079
Files:
lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp
Index: lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp
===================================================================
--- lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp
+++ lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp
@@ -708,12 +708,49 @@
case llvm::Triple::aarch64_32:
case llvm::Triple::aarch64: {
+ // xnu describes three things with type EXC_BREAKPOINT:
+ //
+ // exc_code 0x102 [EXC_ARM_DA_DEBUG], exc_sub_code addr-of-insn
+ // Watchpoint access. exc_sub_code is the address of the
+ // instruction which trigged the watchpoint trap.
+ // debugserver may add the watchpoint number that was triggered
+ // in exc_sub_sub_code.
+ //
+ // exc_code 1 [EXC_ARM_BREAKPOINT], exc_sub_code 0
+ // Instruction step has completed.
+ //
+ // exc_code 1 [EXC_ARM_BREAKPOINT], exc_sub_code address-of-instruction
+ // Software breakpoint instruction executed.
+
if (exc_code == 1 && exc_sub_code == 0) // EXC_ARM_BREAKPOINT
{
// This is hit when we single instruction step aka MDSCR_EL1 SS bit 0
// is set
- is_actual_breakpoint = false;
+ is_actual_breakpoint = true;
is_trace_if_actual_breakpoint_missing = true;
+#ifndef NDEBUG
+ if (thread.GetTemporaryResumeState() != eStateStepping) {
+ StreamString s;
+ s.Printf("CreateStopReasonWithMachException got EXC_BREAKPOINT [1,0] "
+ "indicating trace event, but thread is not tracing, it has "
+ "ResumeState %d",
+ thread.GetTemporaryResumeState());
+ if (RegisterContextSP regctx = thread.GetRegisterContext()) {
+ if (const RegisterInfo *ri = regctx->GetRegisterInfoByName("esr")) {
+ uint32_t esr =
+ (uint32_t)regctx->ReadRegisterAsUnsigned(ri, UINT32_MAX);
+ if (esr != UINT32_MAX) {
+ s.Printf(" esr value: 0x%" PRIx32, esr);
+ }
+ }
+ }
+ llvm::report_fatal_error(s.GetData());
+ lldbassert(
+ false &&
+ "CreateStopReasonWithMachException got EXC_BREAKPOINT [1,0] "
+ "indicating trace event, but thread was not doing a step.");
+ }
+#endif
}
if (exc_code == 0x102) // EXC_ARM_DA_DEBUG
{
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153079.531925.patch
Type: text/x-patch
Size: 2437 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230615/87870205/attachment-0001.bin>
More information about the lldb-commits
mailing list