Trying to run the Deepcut analyzer on a project using overlay spaces fails with the following stacktrace:
Address are in different spaces demo_sub.ovl != demo_task.ovl
java.lang.IllegalArgumentException: Address are in different spaces demo_sub.ovl != demo_task.ovl
at ghidra.program.model.address.OverlayAddressSpace.subtract(OverlayAddressSpace.java:80)
at ghidra.program.model.address.GenericAddress.subtract(GenericAddress.java:117)
at deepcut.EdgeInfo.<init>(EdgeInfo.java:50)
at deepcut.FunctionCallGraph.createListOfEdges(FunctionCallGraph.java:117)
at deepcut.FunctionCallGraph.<init>(FunctionCallGraph.java:77)
at deepcut.DeepCutAnalyzer.added(DeepCutAnalyzer.java:101)
at ghidra.app.plugin.core.analysis.OneShotAnalysisCommand.applyTo(OneShotAnalysisCommand.java:46)
at ghidra.app.plugin.core.analysis.OneShotAnalysisCommand.applyTo(OneShotAnalysisCommand.java:30)
at ghidra.app.plugin.core.analysis.AutoAnalysisManager$AnalysisTaskWrapper.run(AutoAnalysisManager.java:660)
at ghidra.app.plugin.core.analysis.AutoAnalysisManager.startAnalysis(AutoAnalysisManager.java:760)
at ghidra.app.plugin.core.analysis.AutoAnalysisManager.startAnalysis(AutoAnalysisManager.java:639)
at ghidra.app.plugin.core.analysis.AutoAnalysisManager.startAnalysis(AutoAnalysisManager.java:604)
at ghidra.app.plugin.core.analysis.AnalysisBackgroundCommand.applyTo(AnalysisBackgroundCommand.java:55)
at ghidra.app.plugin.core.analysis.AnalysisBackgroundCommand.applyTo(AnalysisBackgroundCommand.java:33)
at ghidra.framework.plugintool.mgr.BackgroundCommandTask.run(BackgroundCommandTask.java:103)
at ghidra.framework.plugintool.mgr.ToolTaskManager.run(ToolTaskManager.java:351)
at java.base/java.lang.Thread.run(Thread.java:1474)
To check if addresses are in the same space, there's Address#hasSameAddressSpace(Address). Physical addresses are available using Address#getPhysicalAddress(), so checks could be avoided like a.getPhysicalAddress().subtract(b.getPhysicalAddress()). That might work here, assuming edges wouldn't span overlapping spaces.
To start, I think assuming translation units won't cross overlay boundaries is fine. For this project, the only way translation units split across address spaces is for .vtables, which all occur in section order at the end of .data.
Trying to run the Deepcut analyzer on a project using overlay spaces fails with the following stacktrace:
To check if addresses are in the same space, there's
Address#hasSameAddressSpace(Address). Physical addresses are available usingAddress#getPhysicalAddress(), so checks could be avoided likea.getPhysicalAddress().subtract(b.getPhysicalAddress()). That might work here, assuming edges wouldn't span overlapping spaces.To start, I think assuming translation units won't cross overlay boundaries is fine. For this project, the only way translation units split across address spaces is for
.vtables, which all occur in section order at the end of.data.