[compiler-rt] [scudo] Add tracing framework (PR #156112)

Fabio D'Urso via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 5 08:19:19 PDT 2025


================
@@ -1376,6 +1379,8 @@ uptr SizeClassAllocator64<Config>::releaseToOSMaybe(RegionInfo *Region,
                                                     uptr ClassId,
                                                     ReleaseToOS ReleaseType)
     REQUIRES(Region->MMLock) EXCLUDES(Region->FLLock) {
+  SCUDO_SCOPED_TRACE(GetPrimaryReleaseToOSMaybeTraceName(ReleaseType));
----------------
fabio-d wrote:

If that helps as an inspiration, Fuchsia's tracing system lets you attach arbitrary arguments (including integers) to trace events. But it relies on sophisticated C preprocessing ([example](https://cs.opensource.google/fuchsia/fuchsia/+/main:docs/development/drivers/diagnostics/tracing.md;drc=e444b41a8b795ff572279f388350f2b01d716f2d;l=28) and [implementation](https://cs.opensource.google/fuchsia/fuchsia/+/main:zircon/system/ulib/trace/include/lib/trace/internal/event_internal.h;drc=e7084628e8ae77ac69ba1bba7e369fc2119fbce7;l=177)).

Maybe we could expose individual trace points directly as macros to give maximum flexibility? For instance
```
#if defined(SCUDO_ENABLE_TRACING)
#include "custom_scudo_tracing.h"
#else
#define TRACE_PRIMARY_RELEASE_TO_OS_MAYBE(ClassId)
... // and so on, one empty macro (instead of a NULL-returning function) per trace point
#endif
```

https://github.com/llvm/llvm-project/pull/156112


More information about the llvm-commits mailing list