Commit Diff


commit - 45f9759f6531afc9e0eeee6d5ce0e2da24dbb38f
commit + 70d6841be45903e797f1e2206b4a53ae8bf2b917
blob - 15ccaf9227183a0216bbef7cb0b08ff29ec59bf0
blob + 641b9dbe977d2151d79f349e2a38875f3478273f
--- test/fuzz/luaL_loadbuffer/luaL_loadbuffer_fuzzer.cc
+++ test/fuzz/luaL_loadbuffer/luaL_loadbuffer_fuzzer.cc
@@ -111,6 +111,10 @@ DEFINE_PROTO_FUZZER(const lua_grammar::Block &message)
 	if (!L)
 		return;
 
+	struct luam_Sysprof_Options opt = {};
+	opt.mode = LUAM_SYSPROF_DEFAULT;
+	opt.interval = 25;
+
 	std::string code = luajit_fuzzer::MainBlockToString(message);
 
 	if (::getenv("LPM_DUMP_NATIVE_INPUT") && code.size() != 0) {
@@ -133,6 +137,10 @@ DEFINE_PROTO_FUZZER(const lua_grammar::Block &message)
 		goto end;
 	}
 
+	/* Profiler staring. */
+	int status = luaM_sysprof_start(L, &opt);
+	assert(status == PROFILE_SUCCESS);
+
 	/*
 	 * Using lua_pcall (protected call) to catch errors due to
 	 * wrong semantics of some generated code chunks.
@@ -143,6 +151,10 @@ DEFINE_PROTO_FUZZER(const lua_grammar::Block &message)
 	if (lua_pcall(L, 0, 0, 0) != LUA_OK)
 		report_error(L, "lua_pcall()");
 
+	/* Profiler stopping. */
+	status = luaM_sysprof_stop(L);
+	assert(status == PROFILE_SUCCESS);
+
 end:
 	metrics.total_num++;
 	collect_lj_metrics(&metrics, L);