aot debug: Fix a NULL dereference (#3274)

It happens on eg. a C function taking a structure argument.
This commit is contained in:
YAMAMOTO Takashi 2024-04-03 18:10:46 +09:00 committed by GitHub
parent 4806e4e298
commit dae09c0e03
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -313,6 +313,17 @@ lldb_function_to_function_dbi(const AOTCompContext *comp_ctx,
if (function_arg_type.IsValid()) {
ParamTypes[function_arg_idx + 1] =
lldb_type_to_type_dbi(comp_ctx, function_arg_type);
if (ParamTypes[function_arg_idx + 1] == NULL) {
LOG_WARNING(
"func %s arg %" PRIu32
" has a type not implemented by lldb_type_to_type_dbi",
function_name, function_arg_idx);
}
}
else {
LOG_WARNING("func %s arg %" PRIu32 ": GetTypeAtIndex failed",
function_name, function_arg_idx);
ParamTypes[function_arg_idx + 1] = NULL;
}
}
@ -399,7 +410,7 @@ lldb_function_to_function_dbi(const AOTCompContext *comp_ctx,
++function_arg_idx) {
uint32_t variable_idx = variable_offset + function_arg_idx;
SBValue variable(variable_list.GetValueAtIndex(variable_idx));
if (variable.IsValid()) {
if (variable.IsValid() && ParamTypes[function_arg_idx + 1] != NULL) {
SBDeclaration dec(variable.GetDeclaration());
auto valtype = variable.GetType();
LLVMMetadataRef ParamLocation = LLVMDIBuilderCreateDebugLocation(