mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-02-06 06:55:07 +00:00
aot debug: Fix a few NULL dereferences on errors (#3273)
This commit is contained in:
parent
250829c0cc
commit
6b0b5de1c5
|
@ -966,7 +966,9 @@ aot_compile_func(AOTCompContext *comp_ctx, uint32 func_index)
|
|||
location = dwarf_gen_location(
|
||||
comp_ctx, func_ctx,
|
||||
(frame_ip - 1) - comp_ctx->comp_data->wasm_module->buf_code);
|
||||
LLVMSetCurrentDebugLocation2(comp_ctx->builder, location);
|
||||
if (location != NULL) {
|
||||
LLVMSetCurrentDebugLocation2(comp_ctx->builder, location);
|
||||
}
|
||||
#endif
|
||||
|
||||
switch (opcode) {
|
||||
|
|
|
@ -374,7 +374,9 @@ handle_next_reachable_block(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
|
|||
goto fail;
|
||||
}
|
||||
#if WASM_ENABLE_DEBUG_AOT != 0
|
||||
LLVMInstructionSetDebugLoc(ret, return_location);
|
||||
if (return_location != NULL) {
|
||||
LLVMInstructionSetDebugLoc(ret, return_location);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
|
@ -383,7 +385,9 @@ handle_next_reachable_block(AOTCompContext *comp_ctx, AOTFuncContext *func_ctx,
|
|||
goto fail;
|
||||
}
|
||||
#if WASM_ENABLE_DEBUG_AOT != 0
|
||||
LLVMInstructionSetDebugLoc(ret, return_location);
|
||||
if (return_location != NULL) {
|
||||
LLVMInstructionSetDebugLoc(ret, return_location);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
@ -491,6 +491,8 @@ dwarf_gen_location(const AOTCompContext *comp_ctx,
|
|||
dwarf_extractor *extractor;
|
||||
AOTFunc *func = func_ctx->aot_func;
|
||||
|
||||
if (func_ctx->debug_func == NULL)
|
||||
return NULL;
|
||||
if (!(extractor = TO_EXTACTOR(comp_ctx->comp_data->extractor)))
|
||||
return NULL;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user