You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recent versions of Xcode no longer come with a gdb symlink, so you have to use lldb instead.
While lldb does have synonyms for its commands that make everything work, its command-line arguments are different. You have to use --source rather than -command, and if you use -n you have to give it an argument (which also makes things simpler, because now you can just pass the process name as an argument instead of having to hack up the script with sed—or just use -p with the PID, which means no quoting issues).
If you don't need admin privileges, the whole thing can be an AppleScript:
tell application "System Events"
unix id of the first process whose frontmost is true
end tell
Then pass the result to a shell script with input as arguments:
lldb --attach-pid "$*" <<EOF
p (char)[[NSBundle bundleWithPath:@"/Library/Frameworks/FScript.framework"] load]
p (void)[FScriptMenuItem insertInMainMenu]
detach
quit
EOF
If you do, then you can remove the first line of gdbtemp.txt (and rename it to lldbtemp.txt while you're at it) and replace the existing AppleScript with:
tell application "System Events"
set pid to unix id of the first process whose frontmost is true
end tell
do shell script "lldb -attach-pid" & pid & " --source=/tmp/lldbtemp.txt" with administrator privileges
Personally, I've created an fscript-inject shell script:
#!/bin/bash
lldb --attach-pid "$1" <<EOF
p (char)[[NSBundle bundleWithPath:@"/Library/Frameworks/FScript.framework"] load]
p (void)[FScriptMenuItem insertInMainMenu]
detach
quit
EOF
So my workflow is just one AppleScript:
tell application "System Events"
set pid to unix id of the first process whose frontmost is true
end tell
do shell script "fscript-inject " & pid with administrator privileges
The text was updated successfully, but these errors were encountered:
Recent versions of Xcode no longer come with a
gdb
symlink, so you have to uselldb
instead.While
lldb
does have synonyms for its commands that make everything work, its command-line arguments are different. You have to use--source
rather than-command
, and if you use-n
you have to give it an argument (which also makes things simpler, because now you can just pass the process name as an argument instead of having to hack up the script with sed—or just use-p
with the PID, which means no quoting issues).If you don't need admin privileges, the whole thing can be an AppleScript:
Then pass the result to a shell script with input as arguments:
If you do, then you can remove the first line of gdbtemp.txt (and rename it to lldbtemp.txt while you're at it) and replace the existing AppleScript with:
Personally, I've created an fscript-inject shell script:
So my workflow is just one AppleScript:
The text was updated successfully, but these errors were encountered: