Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
445 changes: 45 additions & 400 deletions Cargo.lock

Large diffs are not rendered by default.

21 changes: 14 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,18 @@ members = [
]

[workspace.package]
version = "0.1.0"
version = "0.1.1"
edition = "2021"
rust-version = "1.88"
authors = ["swananan <jt26wzz@gmail.com>"]
license = "GPL"
license = "GPL-3.0-only"
description = "GhostScope brings DWARF-aware eBPF tracing to user-space binaries with a printf-like experience."
readme = "README.md"
repository = "https://github.com/swananan/ghostscope"
homepage = "https://github.com/swananan/ghostscope"
documentation = "https://github.com/swananan/ghostscope#readme"
keywords = ["ebpf", "gdb", "dwarf", "debugger"]
categories = ["development-tools::debugging", "development-tools::profiling"]

[workspace.dependencies]
log = "0.4.22"
Expand All @@ -38,11 +45,11 @@ toml = "0.8"
dirs = "5.0"
object = "0.36"

gimli = { git = "https://github.com/gimli-rs/gimli", rev = "0c2a60c00792b4d3c31344d8b5d5c6e8d98b5dd5" }
aya = { git = "https://github.com/aya-rs/aya", rev = "9261554e3c6ca37e401ec23a287a1ddf9cb1f26d" }
aya-obj = { git = "https://github.com/aya-rs/aya", rev = "9261554e3c6ca37e401ec23a287a1ddf9cb1f26d" }
aya-ebpf-bindings = { git = "https://github.com/aya-rs/aya", rev = "9261554e3c6ca37e401ec23a287a1ddf9cb1f26d" }
aya-build = { git = "https://github.com/aya-rs/aya", rev = "9261554e3c6ca37e401ec23a287a1ddf9cb1f26d" }
gimli = "0.31.1"
aya = "0.13.1"
aya-obj = "0.2.1"
aya-ebpf-bindings = "0.1.1"
aya-build = "0.1.2"

# Test dependencies
tempfile = "3.8"
Expand Down
20 changes: 9 additions & 11 deletions README-zh.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
<div align="center">
<img src="assets/logo.png" alt="GhostScope Logo" width="200"/>
<img src="https://raw.githubusercontent.com/swananan/ghostscope/main/assets/logo.png" alt="GhostScope Logo" width="200"/>
<h1 style="margin-top: 0.2em;">GhostScope</h1>
<h3>⚡ 下一代 eBPF 用户态运行时追踪器</h3>
<p>
<strong>Printf 调试的进化</strong> — 无需停止和修改应用即可实时追踪
<strong>Printf 调试的进化</strong> — 无需停止或修改应用即可实时追踪。
</p>

<!-- 徽章 -->
<p>
<img src="https://img.shields.io/badge/版本-0.1.0-blue.svg" alt="Version"/>
<img src="https://img.shields.io/badge/协议-GPL-green.svg" alt="License: GPL"/>
<img src="https://img.shields.io/badge/版本-0.1.1-blue.svg" alt="版本"/>
<img src="https://img.shields.io/badge/协议-GPL-green.svg" alt="协议"/>
<img src="https://img.shields.io/badge/Linux-4.4+-orange.svg" alt="Linux 4.4+"/>
<img src="https://img.shields.io/badge/Rust-1.88.0-red.svg" alt="Rust 1.88.0"/>
</p>

</div>

<br />
Expand All @@ -39,7 +37,7 @@ GhostScope 将编译后的二进制文件转变为可观测系统。在函数入
<br />

<div align="center">
<img src="assets/demo.gif" alt="GhostScope Demo" width="100%"/>
<img src="https://raw.githubusercontent.com/swananan/ghostscope/main/assets/demo.gif" alt="GhostScope Demo" width="100%"/>
<p><sub><i>实时追踪运行中的 nginx worker 进程</i></sub></p>
</div>

Expand All @@ -49,28 +47,28 @@ GhostScope 将编译后的二进制文件转变为可观测系统。在函数入
<table>
<tr>
<td align="center" width="25%">
<img src="assets/icons/performance.svg" width="60" alt="Performance"/>
<img src="https://raw.githubusercontent.com/swananan/ghostscope/main/assets/icons/performance.svg" width="60" alt="Performance"/>
<br />
<strong>零开销</strong>
<br />
<sub>仅需一次上下文切换 + eBPF 执行</sub>
</td>
<td align="center" width="25%">
<img src="assets/icons/realtime.svg" width="60" alt="Real-time"/>
<img src="https://raw.githubusercontent.com/swananan/ghostscope/main/assets/icons/realtime.svg" width="60" alt="Real-time"/>
<br />
<strong>实时追踪</strong>
<br />
<sub>实时跟踪流</sub>
</td>
<td align="center" width="25%">
<img src="assets/icons/dwarf.svg" width="60" alt="DWARF"/>
<img src="https://raw.githubusercontent.com/swananan/ghostscope/main/assets/icons/dwarf.svg" width="60" alt="DWARF"/>
<br />
<strong>DWARF 感知</strong>
<br />
<sub>完整调试信息支持</sub>
</td>
<td align="center" width="25%">
<img src="assets/icons/rust.svg" width="60" alt="Rust"/>
<img src="https://raw.githubusercontent.com/swananan/ghostscope/main/assets/icons/rust.svg" width="60" alt="Rust"/>
<br />
<strong>Rust 构建</strong>
<br />
Expand Down
21 changes: 9 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
<div align="center">
<img src="assets/logo.png" alt="GhostScope Logo" width="200"/>
<img src="https://raw.githubusercontent.com/swananan/ghostscope/main/assets/logo.png" alt="GhostScope Logo" width="200"/>
<h1 style="margin-top: 0.2em;">GhostScope</h1>
<h3>⚡ Next-Generation eBPF Userspace Runtime Tracer</h3>
<h3>⚡ Next-generation eBPF userspace runtime tracer</h3>
<p>
<strong>Printf debugging evolved</strong> — Real-time tracing without stopping your application.
</p>

<!-- Badges -->
<p>
<img src="https://img.shields.io/badge/version-0.1.0-blue.svg" alt="Version"/>
<img src="https://img.shields.io/badge/license-GPL-green.svg" alt="License: GPL"/>
<img src="https://img.shields.io/badge/version-0.1.1-blue.svg" alt="Version"/>
<img src="https://img.shields.io/badge/license-GPL-green.svg" alt="License"/>
<img src="https://img.shields.io/badge/Linux-4.4+-orange.svg" alt="Linux 4.4+"/>
<img src="https://img.shields.io/badge/Rust-1.88.0-red.svg" alt="Rust 1.88.0"/>
</p>

<!-- Language Switch -->
<p>
<a href="README-zh.md"><strong>中文文档</strong></a>
</p>

</div>

<br />
Expand All @@ -44,7 +41,7 @@ The demo below shows GhostScope tracing an nginx worker process with debug infor
<br />

<div align="center">
<img src="assets/demo.gif" alt="GhostScope Demo" width="100%"/>
<img src="https://raw.githubusercontent.com/swananan/ghostscope/main/assets/demo.gif" alt="GhostScope Demo" width="100%"/>
<p><sub><i>Real-time tracing of a running nginx worker process</i></sub></p>
</div>

Expand All @@ -54,28 +51,28 @@ The demo below shows GhostScope tracing an nginx worker process with debug infor
<table>
<tr>
<td align="center" width="25%">
<img src="assets/icons/performance.svg" width="60" alt="Performance"/>
<img src="https://raw.githubusercontent.com/swananan/ghostscope/main/assets/icons/performance.svg" width="60" alt="Performance"/>
<br />
<strong>Zero Overhead</strong>
<br />
<sub>One context switch + eBPF execution</sub>
</td>
<td align="center" width="25%">
<img src="assets/icons/realtime.svg" width="60" alt="Real-time"/>
<img src="https://raw.githubusercontent.com/swananan/ghostscope/main/assets/icons/realtime.svg" width="60" alt="Real-time"/>
<br />
<strong>Real-Time Tracing</strong>
<br />
<sub>Live trace streaming</sub>
</td>
<td align="center" width="25%">
<img src="assets/icons/dwarf.svg" width="60" alt="DWARF"/>
<img src="https://raw.githubusercontent.com/swananan/ghostscope/main/assets/icons/dwarf.svg" width="60" alt="DWARF"/>
<br />
<strong>DWARF-Aware</strong>
<br />
<sub>Full debug info support</sub>
</td>
<td align="center" width="25%">
<img src="assets/icons/rust.svg" width="60" alt="Rust"/>
<img src="https://raw.githubusercontent.com/swananan/ghostscope/main/assets/icons/rust.svg" width="60" alt="Rust"/>
<br />
<strong>Built with Rust</strong>
<br />
Expand Down
12 changes: 10 additions & 2 deletions bins/dwarf-tool/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,22 @@ version.workspace = true
edition.workspace = true
authors.workspace = true
license.workspace = true
rust-version.workspace = true
readme = "README.md"
repository.workspace = true
homepage.workspace = true
documentation.workspace = true
keywords.workspace = true
categories.workspace = true
description = "Standalone helper binary for inspecting DWARF data with GhostScope parsers."

[[bin]]
name = "dwarf-tool"
path = "src/main.rs"

[dependencies]
ghostscope-dwarf = { path = "../../ghostscope-dwarf" }
ghostscope-process = { path = "../../ghostscope-process" }
ghostscope-dwarf = { version = "0.1.1", path = "../../ghostscope-dwarf" }
ghostscope-process = { version = "0.1.1", path = "../../ghostscope-process" }

# Command line parsing
clap.workspace = true
Expand Down
5 changes: 5 additions & 0 deletions bins/dwarf-tool/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# dwarf-tool

`dwarf-tool` is a standalone binary that ships with GhostScope for inspecting DWARF information and validating the `ghostscope-dwarf` parser stack. It is useful when debugging symbol resolution without running the full tracing pipeline.

Usage examples and context can be found in the main documentation: <https://github.com/swananan/ghostscope#readme>.
22 changes: 16 additions & 6 deletions ghostscope-compiler/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
[package]
name = "ghostscope-compiler"
version = "0.1.0"
edition = "2021"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
authors.workspace = true
readme = "README.md"
repository.workspace = true
homepage.workspace = true
documentation.workspace = true
keywords.workspace = true
categories.workspace = true
description = "Compiles GhostScope trace definitions into DWARF-aware eBPF programs ready for injection."

[dependencies]
inkwell = { version = "0.6.0", features = ["llvm18-1", "target-bpf"] }
Expand All @@ -12,7 +22,7 @@ tracing-log = { workspace = true }
thiserror = { workspace = true }
tracing-subscriber = { workspace = true }
aya-ebpf-bindings = { workspace = true }
ghostscope-dwarf = { path = "../ghostscope-dwarf" }
ghostscope-protocol = { path = "../ghostscope-protocol" }
ghostscope-platform = { path = "../ghostscope-platform" }
ghostscope-process = { path = "../ghostscope-process" }
ghostscope-dwarf = { version = "0.1.1", path = "../ghostscope-dwarf" }
ghostscope-protocol = { version = "0.1.1", path = "../ghostscope-protocol" }
ghostscope-platform = { version = "0.1.1", path = "../ghostscope-platform" }
ghostscope-process = { version = "0.1.1", path = "../ghostscope-process" }
9 changes: 9 additions & 0 deletions ghostscope-compiler/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# ghostscope-compiler

`ghostscope-compiler` turns GhostScope trace definitions into DWARF-aware eBPF programs. It parses the DSL, performs DWARF resolution, and emits IR that targets LLVM's BPF backend.

## Build Requirements
- LLVM 18.x with `llvm-config` available on `PATH` (or set `LLVM_CONFIG_PATH`)
- The `inkwell` crate's `llvm18-1` feature expects a shared build; consult your package manager or build from source with `-DLLVM_ENABLE_PROJECTS=clang;lld`

If LLVM lives in a non-standard directory, export `LLVM_SYS_180_PREFIX` or `LLVM_CONFIG_PATH` before invoking Cargo. The top-level documentation explains the full workflow: <https://github.com/swananan/ghostscope#readme>.
13 changes: 10 additions & 3 deletions ghostscope-dwarf/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ edition.workspace = true
authors.workspace = true
license.workspace = true
keywords.workspace = true
rust-version.workspace = true
readme = "README.md"
repository.workspace = true
homepage.workspace = true
documentation.workspace = true
categories.workspace = true
description = "DWARF parser and symbolizer used by GhostScope to resolve variables and types at runtime."

[dependencies]
gimli.workspace = true
Expand All @@ -13,9 +20,9 @@ memmap2 = "0.9"
anyhow.workspace = true
tracing.workspace = true
thiserror.workspace = true
ghostscope-platform = { path = "../ghostscope-platform" }
ghostscope-protocol = { path = "../ghostscope-protocol" }
ghostscope-process = { path = "../ghostscope-process" }
ghostscope-platform = { version = "0.1.1", path = "../ghostscope-platform" }
ghostscope-protocol = { version = "0.1.1", path = "../ghostscope-protocol" }
ghostscope-process = { version = "0.1.1", path = "../ghostscope-process" }
rustc-demangle = "0.1"
cpp_demangle = "0.4"
rayon = "1.10"
Expand Down
5 changes: 5 additions & 0 deletions ghostscope-dwarf/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# ghostscope-dwarf

`ghostscope-dwarf` parses DWARF data from ELF binaries so GhostScope can resolve variables, types, and addresses at runtime. It wraps `gimli`, `object`, `memmap2`, and symbol demanglers, and exposes async-friendly helpers for the rest of the workspace.

Consumers typically do not use this crate directly; it is re-exported via higher-level components. See the main GhostScope docs for usage examples: <https://github.com/swananan/ghostscope#readme>.
20 changes: 15 additions & 5 deletions ghostscope-loader/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
[package]
name = "ghostscope-loader"
version = "0.1.0"
edition = "2021"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
authors.workspace = true
readme = "README.md"
repository.workspace = true
homepage.workspace = true
documentation.workspace = true
keywords.workspace = true
categories.workspace = true
description = "Loads compiled GhostScope programs, manages sessions, and orchestrates eBPF lifecycle."

[dependencies]
ghostscope-compiler = { path = "../ghostscope-compiler" }
ghostscope-protocol = { path = "../ghostscope-protocol" }
ghostscope-process = { path = "../ghostscope-process" }
ghostscope-compiler = { version = "0.1.1", path = "../ghostscope-compiler" }
ghostscope-protocol = { version = "0.1.1", path = "../ghostscope-protocol" }
ghostscope-process = { version = "0.1.1", path = "../ghostscope-process" }
aya = { workspace = true }
aya-obj = { workspace = true }
tracing = { workspace = true }
Expand Down
9 changes: 9 additions & 0 deletions ghostscope-loader/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# ghostscope-loader

`ghostscope-loader` manages eBPF program lifecycles for GhostScope sessions. It loads bytecode emitted by `ghostscope-compiler`, attaches uprobes, and coordinates per-session resources.

## Build Notes
- Requires libbpf-compatible kernel headers and the `aya` user-space stack
- Optional `tokio` features (`io-util`, `mio`, `net`) are enabled to support async device IO

See the root project guide for usage examples: <https://github.com/swananan/ghostscope#readme>.
Loading