FreeBSD Developers' Handbook
前一頁 | 章 9. Kernel Debugging | 下一頁

# 9.9. Debugging the Deadlocks

You may experience so called deadlocks, the situation where system stops doing useful work. To provide the helpful bug report in this situation, you shall use ddb as described above. Please, include the output of `ps` and `trace` for suspected processes in the report.

If possible, consider doing further investigation. Receipt below is especially useful if you suspect deadlock occurs in the VFS layer. Add the options

    makeoptions		DEBUG=-g
    	options		INVARIANTS
    	options		INVARIANT_SUPPORT
    	options		WITNESS
    	options		DEBUG_LOCKS
    	options		DEBUG_VFS_LOCKS
    	options		DIAGNOSTIC

to the kernel config. When deadlock occurs, in addition to the output of the `ps` command, provide information from the `show allpcpu`, `show alllocks`, `show lockedvnods` and `show alltrace`.

For threaded processes, to obtain meaningful backtraces, use `thread thread-id` to switch to the thread stack, and do backtrace with `where`.

前一頁 | 內容 | 下一頁
Debugging a Console Driver | 上一層 | Architectures(電腦架構)

本文及其他文件，可由此下載：ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/。

若有 FreeBSD 方面疑問，請先閱讀 FreeBSD 相關文件，如不能解決的話，再洽詢 <questions@FreeBSD.org>。
關於本文件的問題，請洽詢 <doc@FreeBSD.org>。