Revisions
-
fpotter revised this gist
May 6, 2012 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -17,7 +17,7 @@ syscall::sendto:entry syscall::sendto:return /pid == $1/ { /* RubyMotion doesn't send null-terminated strings, so we copy it into our own null-terminated string. */ self->text = (char *)alloca(self->length + 1); copyinto(self->buffer, self->length, self->text); @@ -35,7 +35,7 @@ syscall::recvfrom:entry syscall::recvfrom:return /pid == $1/ { /* RubyMotion doesn't send null-terminated strings, so we copy it into our own null-terminated string. */ self->numBytes = arg0; self->text = (char *)alloca(self->numBytes + 1); -
fpotter revised this gist
May 6, 2012 . No changes.There are no files selected for viewing
-
fpotter created this gist
May 6, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,60 @@ #!/usr/bin/env dtrace -s /* * DTrace script to observe UNIX socket reads/writes for RubyMotion apps running * in the iOS Simulator. * * Usage: sudo dtrace_rubymotion_repl <pid of running RubyMotion iOS app> * */ syscall::sendto:entry /pid == $1/ { self->buffer = arg1; self->length = arg2; } syscall::sendto:return /pid == $1/ { /* RubyMotion doesn't send null-terminate strings, so we copy it into our own null-terminated string. */ self->text = (char *)alloca(self->length + 1); copyinto(self->buffer, self->length, self->text); self->text[self->length] = '\0'; printf("%s >> SOCKET >> '%s'", execname, stringof(self->text)); } syscall::recvfrom:entry /pid == $1/ { self->buffer = arg1; } syscall::recvfrom:return /pid == $1/ { /* RubyMotion doesn't send null-terminate strings, so we copy it into our own null-terminated string. */ self->numBytes = arg0; self->text = (char *)alloca(self->numBytes + 1); copyinto(self->buffer, self->numBytes, self->text); self->text[self->numBytes] = '\0'; printf("%s << SOCKET << '%s'", execname, stringof(self->text)); } syscall::write:entry /pid == $1/ { self->buffer = arg1; self->fd = arg0; } syscall::write:return /pid == $1 && self->fd == 1/ { self->text = copyin(self->buffer, arg0); printf("%s >> STDOUT >> '%s')", execname, stringof(self->text)); }