Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Phineas1500/ish/llms.txt
Use this file to discover all available pages before exploring further.
Overview
iSH includes a flexible logging system with multiple channels that can be enabled at build time. These channels provide insights into emulator behavior, system calls, instruction execution, and more.Available Channels
From the README:strace
The most useful channel for application debugging. Logs parameters and return values of almost every system call. Example output:instr
Logs every instruction executed by the emulator. Example output:verbose
General debug logs that donβt fit into other categories. Includes:- Memory management operations
- Process creation/termination
- File system operations
- Signal handling
Additional Channels
More channels may have been added. To find all available channels:debug.h:
all- Enable all channelsverbose- General debug outputinstr- Instruction executiondebug- Debug-specific messagesstrace- System call tracingmemory- Memory operations
Enabling Logs in Xcode
Configuration
Editapp/iSH.xcconfig and set the ISH_LOG variable to a space-separated list of channels:
Log Handler
The log handler is automatically selected based on platform:- iphoneos/iphonesimulator: Uses
NSLog(viewable in Xcode Console) - macosx: Uses
dprintf(outputs to stderr)
Viewing Logs
After building with logging enabled:- Xcode Console: Window β Show Debug Area (Cmd+Shift+Y)
- Console.app: For device builds, use macOS Console app and filter by βiSHβ
- Terminal: If running the macOS command-line tool, logs appear in stderr
Enabling Logs with Meson
For the command-line tool, configure logging when setting up the build:Single Channel
Multiple Channels
All Channels
Build Configuration
Frommeson.build:
Rebuild
After configuring, rebuild:Log Output Interpretation
System Call Traces (strace)
Format:[pid] syscall(args...) = return_value
Example:
[1]- Process IDexecve- System call name("/bin/sh", ...)- Arguments= 0- Return value (0 typically means success)
Instruction Traces (instr)
Format varies but typically includes:- Instruction pointer (EIP/RIP)
- Disassembled instruction
- Sometimes register state
Verbose Logs
Freeform debug messages with context:Performance Impact
Benchmark Comparison
| Configuration | Relative Speed | Use Case |
|---|---|---|
| No logging | 1.0x (baseline) | Production |
strace only | ~0.7x | Debugging syscalls |
verbose | ~0.8x | General debugging |
instr | ~0.05x (20x slower!) | Instruction-level debugging |
all | ~0.03x (30x+ slower!) | Deep debugging only |
Recommendations
- Development:
strace verboseprovides good insight without severe slowdown - Bug hunting: Enable specific channels as needed
- Instruction debugging: Use
instronly on small, isolated test cases - Production: Disable all logging for maximum performance
Implementation Details
Channel Macros
Fromdebug.h:
Using Logging in Code
Channels are used via macros:Disabling Specific Channels
You can explicitly disable channels:Practical Examples
Debugging a Segfault
Tracing File Operations
Debugging Instruction Emulation
Custom Log Handler
You can specify a custom log handler:meson_options.txt:
See Also
- Debugging - Debugging tools and techniques
- Interpreter - Understanding emulator internals