Swift Command Line

This is going to be fun…

sudo xcode-select --switch /Applications/Xcode6-Beta.app/Contents/Developer/

xcrun swift

Welcome to Swift!  Type :help for assistance.
	1> :help

The Swift REPL (Read-Eval-Print-Loop) acts like an interpreter.  Valid statements, expressions, and declarations are immediately compiled and executed.

The complete set of LLDB
debugging commands are also available as described below.  Commands must be prefixed with a colon at the REPL prompt (:quit for example.)  Typing just a colon followed by return
will switch to the LLDB prompt.


Debugger commands:

_regexp-attach    -- Attach to a process id if in decimal, otherwise treat the argument as a process name to attach to.
_regexp-break     -- Set a breakpoint using a regular expression to specify the location, where <linenum> is in decimal and <address> is in hex.
_regexp-bt        -- Show a backtrace.  An optional argument is accepted; if that argument is a number, it specifies the number of frames to display.  If that argument is 'all',
										 full backtraces of all threads are displayed.
_regexp-display   -- Add an expression evaluation stop-hook.
_regexp-down      -- Go down "n" frames in the stack (1 frame by default).
_regexp-env       -- Implements a shortcut to viewing and setting environment variables.
_regexp-jump      -- Sets the program counter to a new address.
_regexp-list      -- Implements the GDB 'list' command in all of its forms except FILE:FUNCTION and maps them to the appropriate 'source list' commands.
_regexp-tbreak    -- Set a one shot breakpoint using a regular expression to specify the location, where <linenum> is in decimal and <address> is in hex.
_regexp-undisplay -- Remove an expression evaluation stop-hook.
_regexp-up        -- Go up "n" frames in the stack (1 frame by default).
ad                -- 
apropos           -- Find a list of debugger commands related to a particular word/subject.
breakpoint        -- A set of commands for operating on breakpoints. Also see _regexp-break.
command           -- A set of commands for managing or customizing the debugger commands.
disassemble       -- Disassemble bytes in the current function, or elsewhere in the executable program as specified by the user.
expression        -- Evaluate a C/ObjC/C++ expression in the current program context, using user defined variables and variables currently in scope.
frame             -- A set of commands for operating on the current thread's frames.
gdb-remote        -- Connect to a remote GDB server.  If no hostname is provided, localhost is assumed.
gui               -- Switch into the curses based GUI mode.
help              -- Show a list of all debugger commands, or give details about specific commands.
kdp-remote        -- Connect to a remote KDP server.  udp port 41139 is the default port number.
log               -- A set of commands for operating on logs.
memory            -- A set of commands for operating on memory.
platform          -- A set of commands to manage and create platforms.
plugin            -- A set of commands for managing or customizing plugin commands.
process           -- A set of commands for operating on a process.
quit              -- Quit out of the LLDB debugger.
rd                -- 
register          -- A set of commands to access thread registers.
script            -- Pass an expression to the script interpreter for evaluation and return the results. Drop into the interactive interpreter if no expression is given.
settings          -- A set of commands for manipulating internal settable debugger variables.
source            -- A set of commands for accessing source file information
target            -- A set of commands for operating on debugger targets.
thread            -- A set of commands for operating on one or more threads within a running process.
type              -- A set of commands for operating on the type system
version           -- Show version of LLDB debugger.
watchpoint        -- A set of commands for operating on watchpoints.

Current user-defined commands:

bmessage    -- Run Python function __FBDebugCommands_bmessage
border      -- Run Python function __FBDisplayCommands_border
caflush     -- Run Python function __FBDisplayCommands_caflush
fa11y       -- Run Python function __FBFindCommands_fa11y
flicker     -- Run Python function __FBFlickerCommands_flicker
fv          -- Run Python function __FBFindCommands_fv
fvc         -- Run Python function __FBFindCommands_fvc
hide        -- Run Python function __FBDisplayCommands_hide
mask        -- Run Python function __FBDisplayCommands_mask
panim       -- Run Python function __FBPrintCommands_panim
pca         -- Run Python function __FBPrintCommands_pca
pcells      -- Run Python function __FBPrintCommands_pcells
pclass      -- Run Python function __FBPrintCommands_pclass
pinternals  -- Run Python function __FBPrintCommands_pinternals
pinvocation -- Run Python function __FBInvocationCommands_pinvocation
pivar       -- Run Python function __FBPrintCommands_pivar
presponder  -- Run Python function __FBPrintCommands_presponder
ptv         -- Run Python function __FBPrintCommands_ptv
pvc         -- Run Python function __FBPrintCommands_pvc
pviews      -- Run Python function __FBPrintCommands_pviews
show        -- Run Python function __FBDisplayCommands_show
taplog      -- Run Python function __FBFindCommands_taplog
unborder    -- Run Python function __FBDisplayCommands_unborder
unmask      -- Run Python function __FBDisplayCommands_unmask
visualize   -- Run Python function __FBVisualizationCommands_visualize
vs          -- Run Python function __FBFlickerCommands_vs
wivar       -- Run Python function __FBDebugCommands_wivar

For more information on any command, type ':help <command-name>'.
	1> 

Hrm… what now?

The post ‘Swift Command Line’ was first published by Jeffrey Sambells on