Skip to content

Instantly share code, notes, and snippets.

This file has been truncated, but you can view the full file.
$ sudo dtrace -lP fbt
ID PROVIDER MODULE FUNCTION NAME
181138 fbt com.apple.iokit.IOSCSIBlockCommandsDevice _ZN22IOBlockStorageServices9MetaClassC1Ev [IOBlockStorageServices::MetaClass::MetaClass()] entry
181139 fbt com.apple.iokit.IOSCSIBlockCommandsDevice _ZN22IOBlockStorageServices9MetaClassC1Ev [IOBlockStorageServices::MetaClass::MetaClass()] return
181140 fbt com.apple.iokit.IOSCSIBlockCommandsDevice _ZN22IOBlockStorageServicesC2EPK11OSMetaClass [IOBlockStorageServices::IOBlockStorageServices(OSMetaClass const*)] entry
181141 fbt com.apple.iokit.IOSCSIBlockCommandsDevice _ZN22IOBlockStorageServicesC2EPK11OSMetaClass [IOBlockStorageServices::IOBlockStorageServices(OSMetaClass const*)] return
181142 fbt com.apple.iokit.IOSCSIBlockCommandsDevice _ZN22IOBlockStorageServicesC1EPK11OSMetaClass [IOBlockStorageServices::IOBlockStorageServices(OSMetaClass const*)] entry
181143 fbt com.apple.iokit.IOSCSIBlockCommandsDevice _ZN22IOBl
Bhyve-HandleProtocol: Copying DevPath: PciRoot(0x0)/Pci(0x4,0x0)/HD(1,MBR,0x00000000,0x40,0x3C0) [64]
probing: pc0 mem[640K 999M 16M 6M 64K]
disk:Bhyve-HandleProtocol: Copying DevPath: PciRoot(0x0)/Pci(0x4,0x0) [22]
 hd0
>> OpenBSD/amd64 BOOTX64 3.30
boot>
cannot open hd0a:/etc/random.seed: No such file or directory
booting hd0a:/bsd: 3343316+1410944+2413568+0+598016=0x76a238
entry point at 0xf001000 [7205c766, 34000004, 24448b12, 94b0a304]

XNU build blog

  • Build dtrace
    • mkdir -p obj sym dst
    • $ xcodebuild install -target ctfconvert -target ctfdump -target ctfmerge ARCHS="x86_64" SRCROOT=$PWD OBJROOT=$PWD/obj SYMROOT=$PWD/sym DSTROOT=$PWD/dst
  • sudo xcodebuild -license

7.3.1

  • hfs:
@pnasrat
pnasrat / debugging-tools.md
Created June 20, 2016 20:54
RC Linux/UNIX debugging tool notes
  • ls
  • ps
  • pgrep
  • strace - used to trace system (kernel) calls
  • ltrace - used to trace library (C)
  • /proc filesystem - lots of information
  • /proc/
  • /proc//fd
  • lsof - list of open files including network
  • gdb - briefly
@pnasrat
pnasrat / Enter the hypervisor framework
Last active June 17, 2016 15:05
Debugging com.docker.hyperkit
(gdb) bt
#0 0x00000001002400ab in hv_vcpu_run () from /System/Library/Frameworks/Hypervisor.framework/Versions/A/Hypervisor
#1 0x00000001000054d9 in vmx_run ()
#2 0x0000000100023b78 in vcpu_thread ()
#3 0x00007fff954ed99d in _pthread_body () from /usr/lib/system/libsystem_pthread.dylib
#4 0x00007fff954ed91a in _pthread_start () from /usr/lib/system/libsystem_pthread.dylib
#5 0x00007fff954eb351 in thread_start () from /usr/lib/system/libsystem_pthread.dylib
#6 0x0000000000000000 in ?? ()
@pnasrat
pnasrat / expecting.md
Created June 9, 2016 15:54 — forked from ksafranski/expecting.md
Basic principles of using tcl-expect scripts

Intro

TCL-Expect scripts are an amazingly easy way to script out laborious tasks in the shell when you need to be interactive with the console. Think of them as a "macro" or way to programmaticly step through a process you would run by hand. They are similar to shell scripts but utilize the .tcl extension and a different #! call.

Setup Your Script

The first step, similar to writing a bash script, is to tell the script what it's executing under. For expect we use the following:

#!/usr/bin/expect
#!/usr/bin/env expect
spawn "./hyperkitrun.sh"
set pid [exp_pid]
expect "tc@box:~$"
send "sudo halt\r\n";
expect {
timeout {exec kill -9 $pid; exit 1}
"reboot: System halted"
}
-Usage: xhyve [-behuwxMACHPWY] [-c vcpus] [-g <gdb port>] [-l <lpc>]
- [-m mem] [-p vcpu:hostcpu] [-s <pci>] [-U uuid] -f <fw>
+Usage: com.docker.hyperkit [-behuwxMACHPWY] [-c vcpus] [-F <pidfile>] [-g <gdb port>] [-l <lpc>]
+ [-m mem] [-p vcpu:hostcpu] [-s <pci>] [-U uuid] -f <fw>
-A: create ACPI tables
-c: # cpus (default 1)
-C: include guest memory in core file
-e: exit on unhandled I/O access
-f: firmware
+ -F: pidfile
Availability Uptime
90.0% 36 day 12 hours
95.0% 18 days, 6 hours
99.0% 87 hours, 36 minutes
99.50% 43 hours, 48 minutes
99.90% 8 hours, 48 minutes
99.99% 52 minutes, 33 seconds
99.999% 5 minutes, 15 seconds
99.9999% 32 seconds
@pnasrat
pnasrat / shell_intro.md
Last active May 5, 2016 15:30 — forked from niftynei/shell_intro.md
intro to shell, a script

what is a shell?

Shell is a programming environment that terminal runs. it's a text based GUI for interacting with your system.

what is shell good for?

shell can give you information about your system, allows you to modify and run programs. let's try something

say "hello pris"