22 void *trace[ALLOC_TRACE_DEPTH];
24 backtrace(
const backtrace &) =
default;
25 explicit backtrace(
void **bt) { memcpy(trace, bt,
sizeof(trace)); }
26 bool operator<(
const backtrace &a)
const {
27 for (
int i = 0; i < ALLOC_TRACE_DEPTH; ++i)
28 if (trace[i] != a.trace[i])
return trace[i] < a.trace[i];
31 bool operator==(
const backtrace &a)
const {
32 for (
int i = 0; i < ALLOC_TRACE_DEPTH; ++i)
33 if (trace[i] != a.trace[i])
return false;
37 std::map<backtrace, std::map<size_t, int>> data;
38 void count(
void **,
size_t);
39 static void callback(
void *t,
void **bt,
size_t sz) {
44 void clear() { data.clear(); }
48 auto tmp = set_alloc_trace(old);
49 BUG_CHECK(tmp.fn == callback && tmp.arg ==
this,
"AllocTrace stopped when not running");
53 BUG(
"Can't trace allocations without garbage collection");
58 friend std::ostream &operator<<(std::ostream &,
const AllocTrace &);
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:13