mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-05-09 13:16:26 +00:00
aot debug: Try to use a bit more appropriate file names (#3000)
When the original wasm contains multiple compilation units, the current logic uses the first one for everything. This commit tries to use a bit more appropriate ones.
This commit is contained in:
parent
23d2e0627c
commit
837b9904f5
|
@ -133,9 +133,10 @@ dwarf_gen_file_info(const AOTCompContext *comp_ctx)
|
||||||
file_name = filespec.GetFilename();
|
file_name = filespec.GetFilename();
|
||||||
dir_name = filespec.GetDirectory();
|
dir_name = filespec.GetDirectory();
|
||||||
if (file_name || dir_name) {
|
if (file_name || dir_name) {
|
||||||
file_info = LLVMDIBuilderCreateFile(comp_ctx->debug_builder,
|
file_info = LLVMDIBuilderCreateFile(
|
||||||
file_name, strlen(file_name),
|
comp_ctx->debug_builder, file_name,
|
||||||
dir_name, strlen(dir_name));
|
file_name ? strlen(file_name) : 0, dir_name,
|
||||||
|
dir_name ? strlen(dir_name) : 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return file_info;
|
return file_info;
|
||||||
|
@ -298,7 +299,7 @@ lldb_function_to_function_dbi(const AOTCompContext *comp_ctx,
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
LLVMDIBuilderRef DIB = comp_ctx->debug_builder;
|
LLVMDIBuilderRef DIB = comp_ctx->debug_builder;
|
||||||
LLVMMetadataRef File = comp_ctx->debug_file;
|
LLVMMetadataRef File = comp_ctx->debug_file; /* a fallback */
|
||||||
|
|
||||||
LLVMMetadataRef ParamTypes[num_function_args + 1];
|
LLVMMetadataRef ParamTypes[num_function_args + 1];
|
||||||
|
|
||||||
|
@ -315,6 +316,21 @@ lldb_function_to_function_dbi(const AOTCompContext *comp_ctx,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto compile_unit = sc.GetCompileUnit();
|
||||||
|
auto file_spec = compile_unit.GetFileSpec();
|
||||||
|
const char *file_name = file_spec.GetFilename();
|
||||||
|
const char *dir_name = file_spec.GetDirectory();
|
||||||
|
LLVMMetadataRef file_info = NULL;
|
||||||
|
if (file_name || dir_name) {
|
||||||
|
file_info =
|
||||||
|
LLVMDIBuilderCreateFile(comp_ctx->debug_builder, file_name,
|
||||||
|
file_name ? strlen(file_name) : 0, dir_name,
|
||||||
|
dir_name ? strlen(dir_name) : 0);
|
||||||
|
}
|
||||||
|
if (file_info) {
|
||||||
|
File = file_info;
|
||||||
|
}
|
||||||
|
|
||||||
LLVMMetadataRef FunctionTy = LLVMDIBuilderCreateSubroutineType(
|
LLVMMetadataRef FunctionTy = LLVMDIBuilderCreateSubroutineType(
|
||||||
DIB, File, ParamTypes, num_function_args + 1, LLVMDIFlagZero);
|
DIB, File, ParamTypes, num_function_args + 1, LLVMDIFlagZero);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user