#!/usr/bin/env python3 """Nearest preceding symbol for a file offset in a Mach-O. The host nm cannot read Mach-O and reports zero symbols, which reads as a stripped binary; this parses LC_SYMTAB directly. Offsets come from a core's NT_FILE mapping (address minus mapping start), so they are FILE offsets and have to go through the segment table to become vmaddrs. """ import struct, sys, bisect def load(path): d = open(path, 'rb').read() magic = struct.unpack_from('