-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathconfig.toml
More file actions
270 lines (237 loc) · 10.2 KB
/
config.toml
File metadata and controls
270 lines (237 loc) · 10.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
# GhostScope Configuration File
#
# This is an example configuration file for GhostScope.
# To use this configuration:
# 1. Copy this file to ~/.ghostscope/config.toml (user-level config)
# 2. Or rename to ghostscope.toml in your project directory (project-level config)
# 3. Or specify with --config flag: ghostscope --config path/to/config.toml
#
# Configuration priority (highest to lowest):
# 1. Command line arguments
# 2. --config specified file
# 3. ~/.ghostscope/config.toml
# 4. ./ghostscope.toml
#
# All sections and values are optional - if not specified, built-in defaults are used.
[general]
# Default log file path (overridden by --log-file)
# Default: "ghostscope.log"
log_file = "ghostscope.log"
# Default UI mode when no script is provided (overridden by --tui)
# Default: true
default_tui_mode = true
# Enable/disable logging (overridden by --log/--no-log)
# Default: true
enable_logging = true
# Log level filter (overridden by --log-level)
# Options: "error", "warn", "info", "debug", "trace"
# Default: "warn"
log_level = "warn"
[script]
# Stdout rendering mode for non-TUI script execution
# Options: "pretty", "plain", "quiet"
# - pretty: TUI-like header with timestamp/PID/TID plus indented payload lines
# - plain: only print script payload lines
# - quiet: suppress event output on stdout
# Default: "pretty"
output = "pretty"
# Timestamp format used by pretty script output
# Options: "local", "boot", "none"
# - local: wall-clock time derived from the eBPF monotonic timestamp
# - boot: monotonic offset like boot+12.345s
# - none: omit timestamp prefix
# Default: "local"
timestamp = "local"
# ANSI color mode for CLI script output and interactive stderr status rendering
# Options: "auto", "always", "never"
# - auto: enable colors only when the corresponding stream is a TTY
# - always: force ANSI colors even when redirected
# - never: disable ANSI colors entirely
# Default: "auto"
color = "auto"
[dwarf]
# DWARF debug information search paths for .gnu_debuglink files
#
# When a binary uses .gnu_debuglink to reference separate debug files,
# GhostScope searches these paths to locate the debug file.
#
# Search order (highest priority first):
# 1. Absolute path (if .gnu_debuglink contains an absolute path - rare)
# 2. User-configured search_paths + basename (configured here)
# 3. Same directory as the binary + basename
# 4. .debug subdirectory next to the binary + basename
#
# For each user-configured path, both direct and .debug subdirectory are checked:
# - <path>/debug_filename
# - <path>/.debug/debug_filename
#
# Features:
# - Home directory expansion: "~/" is replaced with your home directory
# - Duplicate paths are automatically removed to avoid redundant checks
# - Paths are tried in order until a matching debug file is found
#
# Common search paths:
# - System debug symbols: "/usr/lib/debug" (for installed debug packages)
# - Local debug symbols: "/usr/local/lib/debug"
# - User-specific: "~/.local/lib/debug"
# - Custom build output: "/path/to/build/debug"
#
# Note: .gnu_debuglink typically uses basename (relative path), but absolute paths
# are also supported. If you need system-wide debug directories like /usr/lib/debug,
# add them to search_paths.
#
# Default: ["/usr/lib/debug", "/usr/local/lib/debug"]
search_paths = [
"/usr/lib/debug",
"/usr/local/lib/debug",
"~/.local/lib/debug"
]
# Allow non-strict debug file matching (CRC/Build-ID)
# Default: false (strict). When true, GhostScope will allow using a separate
# debug file even if CRC or Build-ID does not match exactly. Useful for
# ad-hoc environments; may cause inaccurate symbol/line info.
allow_loose_debug_match = false
[files]
# File saving options (overridden by --save-*/--no-save-* flags)
# Format: { debug = bool, release = bool }
# These control whether files are saved by default in debug/release builds
# Save LLVM IR files (overridden by --save-llvm-ir/--no-save-llvm-ir)
# Default: { debug = true, release = false }
save_llvm_ir = { debug = true, release = false }
# Save eBPF bytecode files (overridden by --save-ebpf/--no-save-ebpf)
# Default: { debug = true, release = false }
save_ebpf = { debug = true, release = false }
# Save AST files (overridden by --save-ast/--no-save-ast)
# Default: { debug = true, release = false }
save_ast = { debug = true, release = false }
[ui]
# TUI layout mode (overridden by --layout)
# Options: "Horizontal", "Vertical"
# Default: "Horizontal"
layout = "Horizontal"
# Default focused panel when TUI starts
# Options: "Source", "EbpfInfo", "InteractiveCommand"
# Default: "InteractiveCommand"
default_focus = "InteractiveCommand"
# Show or hide the source panel (can also be controlled via CLI --source-panel/--no-source-panel, or UI command 'ui source on/off')
# Default: true
show_source_panel = true
# Panel size ratios [Source, EbpfInfo, InteractiveCommand]
# These are relative ratios, e.g., [4, 3, 3] means Source gets 40%, others get 30% each
# Must be an array of 3 positive numbers
# Default: [4, 3, 3]
panel_ratios = [3, 3, 3]
# Two-panel ratios [EbpfInfo, InteractiveCommand] used when source panel is hidden
# If not set, falls back to the last two values of panel_ratios (e.g., 4:3:3 -> 3:3)
# Default: not set (fallback to panel_ratios)
# two_panel_ratios = [3, 3]
# Maximum number of eBPF trace messages to keep in the output panel
# Older messages are automatically discarded when this limit is reached
# Recommended values:
# - Low-frequency tracing: 1000-2000
# - Medium-frequency tracing: 2000-5000 (default: 2000)
# - High-frequency tracing: 5000-10000
# Minimum value: 100
# Note: Larger values consume more memory
# Default: 2000
ebpf_max_messages = 2000
# Command history configuration
[ui.history]
# Enable/disable command history file functionality
# Default: true
enabled = true
# Maximum number of history entries to keep in .ghostscope_history file
# Default: 5000
max_entries = 5000
# Realtime logging configuration
# Note: Realtime logging is controlled via TUI commands (save/stop), not auto-started
[ui.realtime_logging]
# Default directory for realtime log files when not specified
# Default: current working directory
output_dir = "."
# Default filename prefix for auto-generated realtime log files
# Default: "ghostscope_session"
filename_prefix = "ghostscope_session"
[ebpf]
# RingBuf map size in bytes (must be power of 2)
# This controls the size of the ring buffer used to transfer trace events from kernel to userspace.
# Larger sizes allow more events to be buffered but consume more kernel memory.
# Valid range: 4096 (4KB) to 16777216 (16MB)
# Recommended values:
# - Low-frequency tracing: 131072 (128KB)
# - Medium-frequency tracing: 262144 (256KB)
# - High-frequency tracing: 524288 (512KB) or 1048576 (1MB)
# Default: 262144 (256KB)
ringbuf_size = 262144
# Maximum number of (pid, module) offset entries for ASLR translation
# This map stores the runtime address offsets for each loaded module in each process.
# Each entry stores offsets for text/rodata/data/bss sections.
# Valid range: 64 to 65536
# Recommended values:
# - Single process: 1024
# - Multi-process: 4096
# - System-wide tracing: 8192 or 16384
# Default: 4096
proc_module_offsets_max_entries = 4096
# PerfEventArray page count (number of pages per CPU for perf buffer)
# This is only used when PerfEventArray is selected (kernel < 5.8 or when force_perf_event_array=true)
# Must be power of 2. Each page is 4KB on most systems.
# Valid range: 1 to 512 pages
# Recommended values:
# - Low-frequency tracing: 8 pages (32KB per CPU)
# - Medium-frequency tracing: 32 pages (128KB per CPU)
# - High-frequency tracing: 64 pages (256KB per CPU)
# Default: 32 (128KB per CPU)
perf_page_count = 32
# Per-argument memory dump cap for extended format specifiers ({:x}/{:s}).
# Requests beyond this cap are truncated. Increase it to dump more bytes per argument.
mem_dump_cap = 256
# Maximum size (in bytes) of a single trace event message.
# Applies to PerfEventArray accumulation buffer and serves as an upper bound
# when constructing print instructions in the kernel.
# Increase if you plan to print many/large variables in one event.
max_trace_event_size = 32768
# Force use of PerfEventArray instead of RingBuf (for testing only)
# WARNING: This is for testing purposes only. Normally the system auto-detects
# kernel capabilities and uses RingBuf (kernel >= 5.8) or falls back to PerfEventArray.
# Set to true to force PerfEventArray even on kernels that support RingBuf.
# Default: false
force_perf_event_array = false
# Source code path configuration
# When DWARF debug info contains compilation-time paths that differ from runtime paths,
# use these settings to help ghostscope locate the actual source files.
[source]
# Path substitution rules (applied first, highest priority)
# Replaces compilation-time path prefixes with runtime path prefixes.
# Useful when source code was compiled on a different machine or moved to a new location.
#
# Example scenarios:
# - Compiled on CI server: /home/build/project -> /home/user/work/project
# - Kernel sources moved: /usr/src/linux-5.15 -> /home/user/kernel/linux-5.15
# - Cross-compilation: /buildroot/arm/src -> /local/embedded/src
#
# Format: array of { from = "compile_path_prefix", to = "runtime_path_prefix" }
substitutions = [
# { from = "/home/build/myproject", to = "/home/user/work/myproject" },
# { from = "/usr/src/linux", to = "/home/user/kernel/linux" },
]
# Additional search directories (fallback when substitution fails)
# When a source file cannot be found via substitution, ghostscope will search
# these directories by filename (basename matching).
# Similar to GDB's "directory" command.
#
# Format: array of directory paths
search_dirs = [
# "/home/user/sources",
# "/opt/local/src",
]
# Runtime configuration:
# You can also configure source paths interactively using the 'srcpath' command:
# srcpath - Show current configuration
# srcpath map <from> <to> - Add path substitution rule
# srcpath add <directory> - Add search directory
# srcpath remove <path> - Remove a rule
# srcpath clear - Clear all runtime rules
# srcpath reset - Reset to config file rules
#
# Runtime rules take precedence over config file rules and are not persisted.