Skip to content

Ghidra is a software reverse engineering (SRE) framework

allow debug info used for Rust lang when present

Ancietyb87be05fd25e
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/dwarf4/next/DWARFFunctionImporter.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/dwarf4/next/DWARFFunctionImporter.java
index 4d97a71122..b24d9045e8 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/dwarf4/next/DWARFFunctionImporter.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/dwarf4/next/DWARFFunctionImporter.java
@@ -288,25 +288,26 @@ public class DWARFFunctionImporter {
Function gfunc = createFunction(dfunc, diea);
- boolean updateSignature = true;
+ Number dwarfLanguage = -1;
+
DWARFCompilationUnit firstCompilationUnit = prog.getCompilationUnits().get(0);
if (firstCompilationUnit != null) {
- Number dwarfLanguage = firstCompilationUnit.getCompileUnit().getLanguage();
-
- // Rust does not have associated function signature
- if (dwarfLanguage == (Number) DWARFSourceLanguage.DW_LANG_Rust) {
- updateSignature = false;
- }
+ dwarfLanguage = firstCompilationUnit.getCompileUnit().getLanguage();
}
- if (gfunc != null && updateSignature) {
+ if (gfunc != null) {
if (formalParams.isEmpty() && dfunc.localVarErrors) {
// if there were no defined parameters and we had problems decoding local variables,
// don't force the method to have an empty param signature because there are other
// issues afoot.
skipFuncSignature = true;
+ } else if (formalParams.isEmpty() && dwarfLanguage == (Number) DWARFSourceLanguage.DW_LANG_Rust) {
+ // if there were no defined parameters and the language is Rust, don't force an
+ // empty param signature. Rust language emit dwarf info without types (signatures)
+ // when used without -g.
+ skipFuncSignature = true;
}
if (skipFuncSignature) {