Skip to content

Commit 23f0454

Browse files
[TOOLS] Don't "extract" empty symbol names or empty files
1 parent 8f396e5 commit 23f0454

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

tools/symbol_extractor/symbol_extractor.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,8 @@ bool extract_symbols(const std::string& filepath, std::vector<SymbolEntry>& symb
283283
}
284284
}
285285
free(demangled);
286-
symbols.push_back(SymbolEntry{ symName, sym.n_value - preferred_load_address });
286+
if(!symName.empty())
287+
symbols.push_back(SymbolEntry{ symName, sym.n_value - preferred_load_address });
287288
}
288289
}
289290

@@ -347,13 +348,15 @@ void scan_dir_recursive(const std::string& basePath, const std::string& currentR
347348
return a.address < b.address;
348349
});
349350

350-
FileEntry fe;
351-
fe.name = name;
352-
// Remove "Symbols" prefix (assumes currentRelPath starts with "Symbols")
353-
fe.path = newRelPath.substr(7);
354-
fe.symbols = std::move(symbols);
351+
if(!symbols.empty()) {
352+
FileEntry fe;
353+
fe.name = name;
354+
// Remove "Symbols" prefix (assumes currentRelPath starts with "Symbols")
355+
fe.path = newRelPath.substr(7);
356+
fe.symbols = std::move(symbols);
355357

356-
entries.push_back(std::move(fe));
358+
entries.push_back(std::move(fe));
359+
}
357360
}
358361
}
359362
closedir(dir);

0 commit comments

Comments
 (0)