Skip to content

Commit

Permalink
lj_auditlog.c: Log GCfunc objects referenced by IR constants
Browse files Browse the repository at this point in the history
  • Loading branch information
lukego committed Apr 12, 2018
1 parent 1c81d51 commit 486f720
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/lj_auditlog.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,11 @@ static void log_GCtrace(GCtrace *T)
if (ir->o == IR_KGC) {
GCobj *o = ir_kgc(ir);
/* Log referenced string constants. For e.g. HREFK table keys. */
if (o->gch.gct == ~LJ_TSTR) {
switch (o->gch.gct) {
case ~LJ_TSTR:
case ~LJ_TFUNC:
log_GCobj(o);
break;
}
}
}
Expand All @@ -188,6 +191,11 @@ static void log_GCstr(GCstr *s)
log_mem("GCstr", s, sizeof(*s) + s->len);
}

static void log_GCfunc(GCfunc *f)
{
log_mem("GCfunc", f, sizeof(*f));
}

static void log_GCobj(GCobj *o)
{
/* Log some kinds of objects (could be fancier...) */
Expand All @@ -201,6 +209,8 @@ static void log_GCobj(GCobj *o)
case ~LJ_TSTR:
log_GCstr((GCstr *)o);
break;
case ~LJ_TFUNC:
log_GCfunc((GCfunc *)o);
}
}

Expand Down

0 comments on commit 486f720

Please sign in to comment.