from Hacker News

Debugging using system calls in Mac OS X

by bryceneal on 7/30/16, 6:19 PM with 22 comments

  • by danieldk on 7/31/16, 4:51 AM

    One thing that the article does not mention is that dtruss is also just a DTrace script (well, a DTrace script in a shell script ;)). DTrace comes with some other nice scripts (iosnoop, execsnoop, opensnoop, etc.)[1].

    But you need to disable some portion of the system integrity protection:

    http://stackoverflow.com/a/34616033

    [1] http://dtrace.org/blogs/brendan/2011/10/10/top-10-dtrace-scr...

  • by chmaynard on 7/30/16, 7:35 PM

    I love articles about expert sleuthing, especially when it involves low-level code. I hope the author shares his discovery with the Go engineering and documentation teams, perhaps via bug reports.
  • by 0x0 on 7/30/16, 8:59 PM

    Meanwhile, if you try to run the system lldb on the system ruby interpreter on OSX, you get this:

      % lldb ruby
      (lldb) target create "ruby"
      Current executable set to 'ruby' (x86_64).
      (lldb) run
      error: process exited with status -1 
      (cannot attach to process due to System Integrity Protection)
  • by mkagenius on 7/30/16, 9:01 PM

    Great tools, I should try to use them.

    In this case could it have been done by lsof ?

  • by callesgg on 7/30/16, 8:29 PM

    "UDP connections"? UPD is connection less.
  • by cheez on 7/30/16, 8:36 PM

    I often wonder why I don't come across bugs like this but then I think to myself "I'd never write code that closes a socket until all writes and reads are done."

    So the question is: how do you do that in Go?