Improve assertions.

This commit is contained in:
Mike Pall
2020-06-13 00:52:54 +02:00
parent 8b55054473
commit 8ae5170cdc
71 changed files with 1363 additions and 927 deletions

View File

@@ -724,7 +724,7 @@ static void gdbjit_buildobj(GDBJITctx *ctx)
SECTALIGN(ctx->p, sizeof(uintptr_t));
gdbjit_initsect(ctx, GDBJIT_SECT_eh_frame, gdbjit_ehframe);
ctx->objsize = (size_t)((char *)ctx->p - (char *)obj);
lua_assert(ctx->objsize < sizeof(GDBJITobj));
lj_assertX(ctx->objsize < sizeof(GDBJITobj), "GDBJITobj overflow");
}
#undef SECTALIGN
@@ -782,7 +782,8 @@ void lj_gdbjit_addtrace(jit_State *J, GCtrace *T)
ctx.spadjp = CFRAME_SIZE_JIT +
(MSize)(parent ? traceref(J, parent)->spadjust : 0);
ctx.spadj = CFRAME_SIZE_JIT + T->spadjust;
lua_assert(startpc >= proto_bc(pt) && startpc < proto_bc(pt) + pt->sizebc);
lj_assertJ(startpc >= proto_bc(pt) && startpc < proto_bc(pt) + pt->sizebc,
"start PC out of range");
ctx.lineno = lj_debug_line(pt, proto_bcpos(pt, startpc));
ctx.filename = proto_chunknamestr(pt);
if (*ctx.filename == '@' || *ctx.filename == '=')