debugger icon indicating copy to clipboard operation
debugger copied to clipboard

Crash when debugging a program headlessly on macOS after reboot

Open xusheng6 opened this issue 1 year ago • 1 comments

Steps to repro:

  1. reboot the system
  2. use a headless script (see below) to debug any program
  3. the "Developer Tools Access" dialog pops up
  4. Authenticate as instructed and proceed
  5. Observe the crash

Notes:

  1. This only affects headless scripts. In GUI mode, after the authentication, the debugger works normally
  2. The "Developer Tools Access" dialog only shows up once before the computer reboots. If anyone wants to debug this, please keep it in mind
import binaryninja
from binaryninja.debugger import DebuggerController

bv = binaryninja.load("/Users/xusheng/debugger_build/debugger/test/binaries/Darwin-arm64-signed/helloworld")
dc = DebuggerController(bv)
dc.adapter_type = 'LLDB'

# Launch the target
if dc.launch_and_wait():
    print("Launch successful.")
    # Resume execution and wait for the target to stop
    stop_reason = dc.go_and_wait()
    # After the target has stopped
    print(f"Stop Reason: {dc.stop_reason_str}")
else:
    print("Failed to launch the target.")

print("Done!")

xusheng6 avatar Dec 17 '24 04:12 xusheng6

I cannot seem to get a reliable repro of this -- though I definitely get it at least once

xusheng6 avatar Dec 17 '24 04:12 xusheng6