Skip to content

Commit

Permalink
DBG: automatically break on panic inside debugger
Browse files Browse the repository at this point in the history
  • Loading branch information
Kobzol committed Sep 6, 2021
1 parent 6191e97 commit 0d4b480
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class RsDebugProcessConfigurationHelper(
try {
driver.loadRustcSources()
driver.loadPrettyPrinters()
driver.setBreakOnPanic()
} catch (e: DebuggerCommandException) {
process.printlnToConsole(e.message)
LOG.warn(e)
Expand All @@ -60,6 +61,17 @@ class RsDebugProcessConfigurationHelper(
}
}

private fun DebuggerDriver.setBreakOnPanic() {
val commands = when (this) {
is LLDBDriver -> listOf("breakpoint set -n rust_panic")
is GDBDriver -> listOf("set breakpoint pending on", "break rust_panic")
else -> return
}
for (command in commands) {
executeInterpreterCommand(threadId, frameIndex, command)
}
}

private fun DebuggerDriver.loadRustcSources() {
if (commitHash == null) return

Expand Down

0 comments on commit 0d4b480

Please sign in to comment.