Browse Source

Fix error when code has no debug info

Yuxiao Mao 10 months ago
parent
commit
6ff1cb5c73
2 changed files with 2 additions and 2 deletions
  1. 1 1
      src/jit.c
  2. 1 1
      src/module.c

+ 1 - 1
src/jit.c

@@ -4417,7 +4417,7 @@ int hl_jit_function( jit_ctx *ctx, hl_module *m, hl_function *f ) {
 		r->lock = 0;
 		r->lock = 0;
 	}
 	}
 	// save debug infos
 	// save debug infos
-	{
+	if( ctx->debug ) {
 		int fid = (int)(f - m->code->functions);
 		int fid = (int)(f - m->code->functions);
 		ctx->debug[fid].start = codePos;
 		ctx->debug[fid].start = codePos;
 		ctx->debug[fid].offsets = debug32 ? (void*)debug32 : (void*)debug16;
 		ctx->debug[fid].offsets = debug32 ? (void*)debug32 : (void*)debug16;

+ 1 - 1
src/module.c

@@ -476,7 +476,7 @@ static void hl_module_init_indexes( hl_module *m ) {
 #include <jitprofiling.h>
 #include <jitprofiling.h>
 h_bool hl_module_init_vtune( hl_module *m ) {
 h_bool hl_module_init_vtune( hl_module *m ) {
 	int i;
 	int i;
-	if( !iJIT_IsProfilingActive() )
+	if( !iJIT_IsProfilingActive() || m->jit_debug == NULL )
 		return false;
 		return false;
 	for(i=0;i<m->code->nfunctions;i++) {
 	for(i=0;i<m->code->nfunctions;i++) {
 		hl_function *f = m->code->functions + i;
 		hl_function *f = m->code->functions + i;