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