Fix tracing order
This commit is contained in:
parent
48146e5612
commit
458ecbb60b
|
@ -146,22 +146,19 @@ ASSERT_STATIC (Type::min_size + 1 <= sizeof (_Null##Type))
|
||||||
|
|
||||||
template <int max_depth>
|
template <int max_depth>
|
||||||
struct hb_trace_t {
|
struct hb_trace_t {
|
||||||
explicit hb_trace_t (unsigned int *pdepth) : pdepth(pdepth) { if (max_depth) ++*pdepth; }
|
explicit hb_trace_t (unsigned int *pdepth, const char *what, const char *function, const void *obj) : pdepth(pdepth) {
|
||||||
~hb_trace_t (void) { if (max_depth) --*pdepth; }
|
|
||||||
|
|
||||||
inline void log (const char *what, const char *function, const void *obj)
|
|
||||||
{
|
|
||||||
if (*pdepth < max_depth)
|
if (*pdepth < max_depth)
|
||||||
fprintf (stderr, "%s(%p) %-*d-> %s\n", what, obj, *pdepth, *pdepth, function);
|
fprintf (stderr, "%s(%p) %-*d-> %s\n", what, obj, *pdepth, *pdepth, function);
|
||||||
|
if (max_depth) ++*pdepth;
|
||||||
}
|
}
|
||||||
|
~hb_trace_t (void) { if (max_depth) --*pdepth; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
unsigned int *pdepth;
|
unsigned int *pdepth;
|
||||||
};
|
};
|
||||||
template <> /* Optimize when tracing is disabled */
|
template <> /* Optimize when tracing is disabled */
|
||||||
struct hb_trace_t<0> {
|
struct hb_trace_t<0> {
|
||||||
explicit hb_trace_t (unsigned int *p) {}
|
explicit hb_trace_t (unsigned int *pdepth, const char *what, const char *function, const void *obj) {}
|
||||||
inline void log (const char *what, const char *function, const void *obj) {};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -176,8 +173,7 @@ struct hb_trace_t<0> {
|
||||||
|
|
||||||
|
|
||||||
#define TRACE_SANITIZE() \
|
#define TRACE_SANITIZE() \
|
||||||
hb_trace_t<HB_DEBUG_SANITIZE> trace (&context->debug_depth); \
|
hb_trace_t<HB_DEBUG_SANITIZE> trace (&context->debug_depth, "SANITIZE", HB_FUNC, this); \
|
||||||
trace.log ("SANITIZE", HB_FUNC, this);
|
|
||||||
|
|
||||||
|
|
||||||
struct hb_sanitize_context_t
|
struct hb_sanitize_context_t
|
||||||
|
|
|
@ -36,8 +36,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define TRACE_APPLY() \
|
#define TRACE_APPLY() \
|
||||||
hb_trace_t<HB_DEBUG_APPLY> trace (&context->debug_depth); \
|
hb_trace_t<HB_DEBUG_APPLY> trace (&context->debug_depth, "APPLY", HB_FUNC, this); \
|
||||||
trace.log ("APPLY", HB_FUNC, this);
|
|
||||||
|
|
||||||
|
|
||||||
struct hb_apply_context_t
|
struct hb_apply_context_t
|
||||||
|
|
Loading…
Reference in New Issue