使用lldb对osx核心转储进行Backtrace

时间:2014-03-11 15:09:33

标签: macos lldb

我的内核扩展崩溃了好几次,所以我想从崩溃中获得正确的回溯(带有函数名)

收录文章https://developer.apple.com/library/mac/technotes/tn2004/tn2118.html 我想为此使用gdb,但似乎GDB不理解转储

dhcp80-241:KernelDebugKit gburanov$ sudo gdb -c /PanicDumps/core-xnu-2050.48.12-10.41.20.195-39882f44
GNU gdb 6.3.50-20050815 (Apple version gdb-1824) (Wed Feb  6 22:51:23 UTC 2013)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin".
Core file contained no thread-specific data
(gdb)

我听说gdb不可能,但lldb不能正常工作

dhcp80-241:KernelDebugKit gburanov$ lldb
(lldb) target create -d -c /PanicDumps/core-xnu-2050.48.12-10.41.18.191-2c2bf92f /Volumes/KernelDebugKit/mach_kernel
Loading kernel debugging from /Volumes/KernelDebugKit/mach_kernel.dSYM/Contents/Resources/Python/mach_kernel.py
LLDB version LLDB-179.5
settings set target.process.python-os-plugin-path "/Volumes/KernelDebugKit/mach_kernel.dSYM/Contents/Resources/Python/lldbmacros/core/operating_system.py"
command script import "/Volumes/KernelDebugKit/mach_kernel.dSYM/Contents/Resources/Python/lldbmacros/xnu.py"
xnu debug macros loaded successfully. Run showlldbtypesummaries to enable type summaries.
error: Unable to find process plug-in for core file '/PanicDumps/core-xnu-2050.48.12-10.41.18.191-2c2bf92f'
(lldb)

使用核心转储的正确方法是什么?

1 个答案:

答案 0 :(得分:1)

这看起来像是来自Xcode 4.6的lldb - 我无法记住该版本具有的核心文件支持状态 - 而且随着kenel dSYM提供的内核调试命令无法使用LLDB。您需要安装Xcode 5.1才能使其正常运行。

gdb表示无法在核心文件中找到注册表上下文这一事实可能表明您有一个损坏/截断的核心文件。 Xcode 5.1中的lldb将是一个更好的检查。