feat(runtime): trace calls into the libraries listed in ANYBOX_TRACE #30

Manually merged
github merged 1 commit from gh-pr/30/head into gh-pr/30/base 2026-11-26 19:14:26 +00:00
Owner

@⁠Dark3581 on GitHub · 2026-11-22 03:17 UTC · original
Dark3581:feat/runtime-trace → main · +152 −17 · 9 files · 1 commits · merged 2026-11-22 03:20 UTC

What

First of the three pull requests planned in #4: a switch that logs every call into chosen AnyBox libraries, for bring-up runs.

  • ab_runtime.dll exports AbxTraceEnabled(library). It reads ANYBOX_TRACE once: a comma list of library names, or all; case, spaces and empty items are ignored.
  • AbxTrace(format, ...) (in AbxApi.hpp) logs through AbxLog on the library's channel. Each call site asks AbxTraceEnabled once and caches the answer, so a trace that is off costs one branch.
  • xmem and the d3d12_x root signature functions trace every call with arguments and result, e.g. [xmem] XMemAlloc(100, 0x5e50000) -> 000001... and [d3d12_x] D3D12SerializeRootSignature(...) parameters 0, samplers 0, flags 0x3000001 -> 0x1, result 0x00000000. xgameruntime follows in its own pull request.
  • Documented in USAGE (environment table), ARCHITECTURE (runtime) and CONVENTIONS (trace line format).

Tested

  • Windows 10, MinGW WinLibs GCC 15.2 UCRT, Ninja, Release, clean build directory: no warnings, CTest 53/53; runtime_trace and the crash scenarios passed 5 repeats.
  • New runtime_trace test drives lib_probe with ANYBOX_TRACE unset, empty, listing another library, xmem, gameinput , D3D12_X and all, and checks the lines on stderr and in ANYBOX_LOG_FILE.
  • python -m unittest discover -s tools/tests 52/52; check_conventions.py, debt_fold.py --check, progress.py --json pass.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • python tools/check_conventions.py passes (no comments in code, one declaration per export, Conventional Commit subjects)
  • Unimplemented paths stop (AbxNotImplemented / AbxUnsupported); silent stubs are listed under Silent stubs through a debt fragment
  • Known gaps added, changed or removed through docs/dev/debt/changes/<branch>.md
  • Generic behaviour, not specific to one title
  • No game files, keys, notes or logs added to the repository
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • Source of behaviour: n/a (AnyBox diagnostics)
  • AI-assisted: yes
**@⁠Dark3581** on GitHub · 2026-11-22 03:17 UTC · [original](https://github.com/Dark3581/AnyBox/pull/30) `Dark3581:feat/runtime-trace` → `main` · +152 −17 · 9 files · 1 commits · merged 2026-11-22 03:20 UTC ### What First of the three pull requests planned in #4: a switch that logs every call into chosen AnyBox libraries, for bring-up runs. - `ab_runtime.dll` exports `AbxTraceEnabled(library)`. It reads `ANYBOX_TRACE` once: a comma list of library names, or `all`; case, spaces and empty items are ignored. - `AbxTrace(format, ...)` (in `AbxApi.hpp`) logs through `AbxLog` on the library's channel. Each call site asks `AbxTraceEnabled` once and caches the answer, so a trace that is off costs one branch. - `xmem` and the `d3d12_x` root signature functions trace every call with arguments and result, e.g. `[xmem] XMemAlloc(100, 0x5e50000) -> 000001...` and `[d3d12_x] D3D12SerializeRootSignature(...) parameters 0, samplers 0, flags 0x3000001 -> 0x1, result 0x00000000`. `xgameruntime` follows in its own pull request. - Documented in USAGE (environment table), ARCHITECTURE (runtime) and CONVENTIONS (trace line format). ### Tested - Windows 10, MinGW WinLibs GCC 15.2 UCRT, Ninja, Release, clean build directory: no warnings, CTest 53/53; `runtime_trace` and the crash scenarios passed 5 repeats. - New `runtime_trace` test drives `lib_probe` with `ANYBOX_TRACE` unset, empty, listing another library, `xmem`, ` gameinput , D3D12_X ` and `all`, and checks the lines on stderr and in `ANYBOX_LOG_FILE`. - `python -m unittest discover -s tools/tests` 52/52; `check_conventions.py`, `debt_fold.py --check`, `progress.py --json` pass. ### Checklist <!-- Rules behind each item: CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] `python tools/check_conventions.py` passes (no comments in code, one declaration per export, Conventional Commit subjects) - [x] Unimplemented paths stop (`AbxNotImplemented` / `AbxUnsupported`); silent stubs are listed under Silent stubs through a debt fragment - [x] Known gaps added, changed or removed through `docs/dev/debt/changes/<branch>.md` - [x] Generic behaviour, not specific to one title - [x] No game files, keys, notes or logs added to the repository - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] Source of behaviour: n/a (AnyBox diagnostics) - [x] AI-assisted: yes
AbxTraceEnabled reads ANYBOX_TRACE once (a comma list of library names or all, case and spaces ignored), and the AbxTrace macro logs through AbxLog on the library's channel, asking once per call site so a trace that is off costs one branch. xmem and the d3d12_x root signature functions trace every call with its arguments and result. The runtime_trace test checks the default, selection, all and the log file.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 19:14:24 +00:00
github manually merged commit e39277b6db into gh-pr/30/base 2026-11-26 19:14:26 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.