mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 02:39:44 +02:00
GP-5834 fix DWARF file / line issue
remove access to dwarfline file count because it encourages callers to try to iterate via index, which is not something they should do.
This commit is contained in:
parent
2c10392a79
commit
20c8d97c85
6 changed files with 43 additions and 59 deletions
|
@ -88,13 +88,7 @@ public class DWARFLineInfoSourceMapScript extends GhidraScript {
|
|||
for (DWARFCompilationUnit cu : compUnits) {
|
||||
DWARFLine dLine = cu.getLine();
|
||||
monitor.increment();
|
||||
for (int i = 0; i < dLine.getNumFiles(); ++i) {
|
||||
String filePath = dLine.getFilePath(i, true);
|
||||
if (filePath == null) {
|
||||
continue;
|
||||
}
|
||||
byte[] md5 = dLine.getFile(i).getMD5();
|
||||
SourceFileInfo sfi = new SourceFileInfo(filePath, md5);
|
||||
for (SourceFileInfo sfi : dLine.getAllSourceFileInfos()) {
|
||||
if (sourceFileInfoToSourceFile.containsKey(sfi)) {
|
||||
continue;
|
||||
}
|
||||
|
@ -102,11 +96,11 @@ public class DWARFLineInfoSourceMapScript extends GhidraScript {
|
|||
continue;
|
||||
}
|
||||
try {
|
||||
String path = SourceFileUtils.normalizeDwarfPath(filePath,
|
||||
String path = SourceFileUtils.normalizeDwarfPath(sfi.filePath(),
|
||||
COMPILATION_ROOT_DIRECTORY);
|
||||
SourceFileIdType type =
|
||||
md5 == null ? SourceFileIdType.NONE : SourceFileIdType.MD5;
|
||||
SourceFile sFile = new SourceFile(path, type, md5);
|
||||
sfi.md5() == null ? SourceFileIdType.NONE : SourceFileIdType.MD5;
|
||||
SourceFile sFile = new SourceFile(path, type, sfi.md5());
|
||||
sourceManager.addSourceFile(sFile);
|
||||
sourceFileInfoToSourceFile.put(sfi, sFile);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue