Skip to content

Commit b112dba

Browse files
Merge pull request #7 from jamesclement1776/codex/list-changes-in-branch
Add Linux build/test guidance for Firmament2 emitters
2 parents c220476 + 0b14b66 commit b112dba

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

INSTRUMENTATION.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,39 @@ Emitters:
1111
- Code lifecycle: Objects/codeobject.c → `_firm2_emit_code_create_meta/_destroy_meta` (+ `co_extra` provenance)
1212
- Frame lifecycle: Python/ceval.c → `_firm2_emit_frame_event`
1313
- Common envelope everywhere: `event_id`, `pid`, `tid`, `ts_ns`
14+
15+
## Build, install, and test on Linux
16+
17+
The emitters are part of the normal CPython binary. On a Debian/Ubuntu system, install prerequisites and build the tree at the repository root:
18+
19+
```bash
20+
sudo apt update
21+
sudo apt install build-essential gdb lcov pkg-config \
22+
libbz2-dev libffi-dev libgdbm-dev libgdbm-compat-dev \
23+
liblzma-dev libncursesw5-dev libreadline6-dev libsqlite3-dev \
24+
libssl-dev tk-dev uuid-dev xz-utils zlib1g-dev
25+
26+
./configure
27+
make -j$(nproc)
28+
make test # optional, runs the standard CPython suite
29+
sudo make install # installs the instrumented interpreter as python3
30+
```
31+
32+
To exercise the emitters, set `FIRMAMENT2_ENABLE=1` and run any script. The events print to stdout in NDJSON format.
33+
34+
- **Tokenizer NDJSON** (one line per token):
35+
```bash
36+
FIRMAMENT2_ENABLE=1 ./python -c "x = 1 + 2" > tokens.ndjson
37+
head tokens.ndjson
38+
```
39+
40+
- **AST NDJSON** (one line per node):
41+
```bash
42+
FIRMAMENT2_ENABLE=1 ./python - <<'PY' > ast.ndjson
43+
def add(a, b):
44+
return a + b
45+
PY
46+
head ast.ndjson
47+
```
48+
49+
The emitted JSON includes the common envelope (`event_id`, `pid`, `tid`, `ts_ns`) plus the emitter-specific payload fields.

0 commit comments

Comments
 (0)