Skip to content

Instantly share code, notes, and snippets.

@walac
Created March 22, 2017 15:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save walac/11b9579378ee83f1eedd40b8d402768c to your computer and use it in GitHub Desktop.
Save walac/11b9579378ee83f1eedd40b8d402768c to your computer and use it in GitHub Desktop.
Generate the assembly code for firefox binaries
!/bin/bash
set -euxv
mount() {
hdiutil attach -noautofsck -mountpoint $2 $1 \
| tail -1 \
| awk '{print substr($0, index($0,$3))}'
}
umount() {
hdiutil detach $1
}
obj_assembly_dump() {
objdump -disassemble -no-show-raw-insn -no-leading-addr $1 \
| sed -e 's/[0-9a-f]*://'
}
tc_dmg=target.dmg
bb_dmg=$(ls -1 firefox*.mac.dmg | tail -1)
tc_mount_point="$(mount $tc_dmg /Volumes/Nightly_tc)"
bb_mount_point="$(mount $bb_dmg /Volumes/Nightly_bb)"
for i in firefox-bin XUL; do
obj_assembly_dump "$tc_mount_point/Nightly.app/Contents/MacOS/$i" > $i.tc.s
obj_assembly_dump "$bb_mount_point/Nightly.app/Contents/MacOS/$i" > $i.bb.s
done
umount "$tc_mount_point"
umount "$bb_mount_point"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment