fwkdp(1) | General Commands Manual | fwkdp(1) |
fwkdp
— FireWire
KDP Tool
fwkdp |
[--setargs [=boot-args]]
[--proxy ] [--core ]
[--verbose ] [--disable ]
[--erase ] [--ioff ]
[--restart ] [--help ] |
Use fwkdp to act as a proxy for the kernel debugging KDP protocol over FireWire. It will also accept kernel core dump images transmitted over FireWire. Additionally, fwkdp can be used to set the boot-args necessary for a target machine which is to be debugged.
As a complete technology, FireWireKDP redirects the kernel debugging KDP protocol over FireWire. It enables live LLDB debugging of a trapped kernel over a FireWire cable, just as you would over Ethernet. It provides the following advantages over remote Ethernet kernel debugging:
FireWireKDP also enables Remote Kernel Core Dumps over FireWire. This allows you to debug a static kernel at a later time without the need to be connected at the time of debug. To enable kernel core dumps, see section "CORE DUMPS". For more info on debugging with Kernel Core Dumps, please see: Technical Note TN2118: Debugging With Kernel Core Dumps.
FireWireKDP works in two parts: kernel software on the target side (machine to be debugged) and user-space software on the side of the host. Now, the target side software is integrated into the OS. This means that AppleFireWireKDP.kext is no longer necessary. See the installation instructions below.
--setargs
[=boot-args],
-r
[boot-args]--proxy
,
-p
--core
,
-c
--verbose
,
-v
--disable
,
-x
--erase
,
-e
--ioff
--restart
--help
,
-h
FireWireKDP doesn't interfere with the loading of the normal FireWire stack - it only touches the FireWire hardware when the kernel debugger is invoked, either by a panic, NMI, trap, or similar.
Furthermore, FireWireKDP is designed to work cooperatively with FireWireKPrintf. To use both you must use a combination of boot-args such as "debug=0x14e kdp_match_name=firewire".
To use FireWireKDP on a non-built-in FireWire interface (e.g. when using a Thunderbolt to FireWire adapter) add fwkdp=0x8000 to your boot-args.
Connect two Macs via FireWire and follow the steps below.
On the target (machine to be debugged):
% fwkdp -r
% sudo nvram
boot-args="debug=0x14e kdp_match_name=firewire"
On the debugger machine:
% fwkdp
% lldb
kernel.development
(lldb) settings set
target.load-script-from-symbol-file true
(lldb) kdp-remote
localhost
To capture kernel core dumps, set the proper bits of the boot-args' debug variable and kdp_match_name equal to "firewire". In addition, an IP address for the receiving computer is also required, although it's meaningless over FireWire.
On the target machine, set the boot-args and restart.
% sudo nvram
boot-args="debug=0xd46 _panicd_ip=1.2.3.4
kdp_match_name=firewire"
Connect the machine to be debugged to a second Mac with a FireWire cable. Run "fwkdp" from a Terminal window on the second Mac; it will wait for the target to transmit it's core after it drops to the debugger (panic, NMI, etc.). For more info on the debugging with Kernel Core Dumps, please see Technical Note TN2118: Debugging With Kernel Core Dumps.
Post-Panic Hot-Plugs
Some Macs do not support post-panic
debugging after hot-plugging another Mac. To avoid this problem, keep a
debugger Mac connected in anticipation of a panic.
64-bit Debugging
FireWireKDP does work when running
the kernel in 64-bit mode.
Sleep/Wake Notes
FireWireKDP will work if the target
has been through a sleep/wake cycle. However, if FireWireKDP has run (e.g.
drop into debugger and conitnue) on the target once, it might not work again
if the machine is sleep/wake cycled afterwards. Therefore, if you would like
to debug a sleep/wake issue with FireWireKDP, do not sleep between breaks to
the debugger.
Other FireWire Devices
To avoid conflicts it is best not to
have other FireWire devices plugged into the host or target machines while
using any FireWire debugging tools. However, it is possible to connect more
than one target machine to a single host (e.g. to collect core
dumps).
Second FireWire Interface
FireWireKDP does not work on multiple
FireWire interfaces. Please use a built-in FireWire port without installing
any FireWire add-in cards.
/usr/bin/fwkdp is installed as part of the Mac OS X Developer Tools.
July 7, 2015 | Mac OS X |