Unverified Commit 6f2a5775 by Melvin Klimke Committed by GitHub

Fix no tid for external symbol with internal reference (#120)

parent 542db66e
...@@ -75,7 +75,14 @@ public class PcodeExtractor extends GhidraScript { ...@@ -75,7 +75,14 @@ public class PcodeExtractor extends GhidraScript {
protected Term<Program> iterateFunctions(SimpleBlockModel simpleBM, Listing listing, Term<Program> program) { protected Term<Program> iterateFunctions(SimpleBlockModel simpleBM, Listing listing, Term<Program> program) {
FunctionIterator functions = HelperFunctions.funcMan.getFunctions(true); FunctionIterator functions = HelperFunctions.funcMan.getFunctions(true);
for (Function func : functions) { for (Function func : functions) {
if (!ExternSymbolCreator.externalSymbolMap.containsKey(func.getName())){ if(ExternSymbolCreator.externalSymbolMap.containsKey(func.getName())) {
ArrayList<String> addresses = ExternSymbolCreator.externalSymbolMap.get(func.getName()).getAddresses();
if(!addresses.stream().anyMatch(addr -> addr.equals(func.getEntryPoint().toString()))) {
Term<Sub> currentSub = TermCreator.createSubTerm(func);
currentSub.getTerm().setBlocks(iterateBlocks(currentSub, simpleBM, listing));
program.getTerm().addSub(currentSub);
}
} else {
Term<Sub> currentSub = TermCreator.createSubTerm(func); Term<Sub> currentSub = TermCreator.createSubTerm(func);
currentSub.getTerm().setBlocks(iterateBlocks(currentSub, simpleBM, listing)); currentSub.getTerm().setBlocks(iterateBlocks(currentSub, simpleBM, listing));
program.getTerm().addSub(currentSub); program.getTerm().addSub(currentSub);
......
...@@ -166,7 +166,7 @@ public final class HelperFunctions { ...@@ -166,7 +166,7 @@ public final class HelperFunctions {
*/ */
public static Boolean notInReferences(Function func) { public static Boolean notInReferences(Function func) {
for(Function calling : func.getCallingFunctions(monitor)) { for(Function calling : func.getCallingFunctions(monitor)) {
if(calling.getName().equals(func.getName())) { if(calling.getName().equals(func.getName()) && calling.isThunk()) {
return false; return false;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment