Repository navigation
Windows Support
cc builds and runs natively on Windows. The compiler side is the same compilerlib; the
instrumentation runtime has a platform layer for the parts that cannot be shared with POSIX.
powershell -ExecutionPolicy Bypass -File .\scripts\build-windows.ps1 `
-LLVMDir "C:\LLVM\lib\cmake\llvm" `
-LoggerSourceDir "C:\path\to\coretrace-log" `
-Configuration ReleaseUseful parameters of the script: -BuildDir (default build-win), -InstallDir (default
dist\windows), -Generator (default Ninja Multi-Config), -Arch (default x64),
-Toolset, -BuildTests, -PackageZip.
The result is cc.exe under dist\windows\bin.
CI builds this on windows-2022 against a pinned LLVM 20.1.0 archive, installs it, then runs
the smoke tests, the GoogleTest unit tests and the Python smoke tests.
CMakeLists.txt swaps four translation units on WIN32
(src/runtime/windows/):
| File | Replaces |
|---|---|
ct_runtime_alloc.cpp |
Allocation interception against the MS CRT |
ct_runtime_backtrace.cpp |
Backtraces through dbghelp instead of execinfo/dladdr
|
ct_runtime_env.cpp |
Environment reading |
ct_runtime_vtable.cpp |
Vtable resolution through MSVC RTTI complete-object locators |
The runtime links dbghelp on Windows, and the build forces a consistent MSVC runtime
(coretrace_force_msvc_runtime) across the targets so instrumented programs and the runtime
agree on the CRT.
- Vtable diagnostics use the MSVC ABI: the runtime walks the complete-object locator rather than the Itanium vptr/typeinfo layout. The compiler-side pass is the same.
-
operator new/deleteare rewritten under their Microsoft mangling (??2@…,??3@…,??_U@…,??_V@…), scalar and array, plain, sized and nothrow. -
Aligned
operator deleteis deliberately not rewritten on Windows. The Microsoft CRT allocates aligned blocks with_aligned_malloc, which only the alignedoperator deletemay release; rewriting it would hand the block to the wrong deallocator. On Itanium platforms, where aligned blocks come fromaligned_alloc, it is rewritten. -
Teardown goes through a
dbghelp-aware shutdown path, so symbol handles are released in the right order at exit. - Trace names are resolved with the Windows symbol API, so instrumented functions print readable names rather than raw addresses.
- The runtime fixture suites (
test/run_autofree_tests.sh,test/run_runtime_tests.sh) are shell runners and are exercised on Linux and macOS only. - Objective-C tracking is Apple-only, see Objective-C Support.
- Getting Started — build prerequisites and install layout
- Runtime Library — the ABI and module map
Start
Architecture
Instrumentation
Platforms
Developer