(filename, extern, label)
| 140 | |
| 141 | # Wrapper function to write to file |
| 142 | def writeToFile(filename, extern, label): |
| 143 | file = open(filename,'w') |
| 144 | # External functions |
| 145 | print >>file, """#include "ghidra.h"\n""" |
| 146 | for item in extern: |
| 147 | print("extern:",item) |
| 148 | functionList = getGlobalFunctions(item) |
| 149 | print(functionList) |
| 150 | if len(functionList) > 0: |
| 151 | function = functionList[0] |
| 152 | #if function is not None: |
| 153 | results = function.getSignature().getPrototypeString() |
| 154 | results = "extern " + results + ";" |
| 155 | print("Results:", results) |
| 156 | print >>file, results |
| 157 | |
| 158 | # Decompiled functions |
| 159 | for item in label: |
| 160 | # function = getGlobalFunctions(item)[0] |
| 161 | function = currentProgram.getFunctionManager().getFunctionAt(getAddress(item)) |
| 162 | results = ifc.decompileFunction(function, 0, ConsoleTaskMonitor()) |
| 163 | filedata = results.getDecompiledFunction().getC() |
| 164 | file.write(filedata) |
| 165 | |
| 166 | file.close() |
nothing calls this directly
no test coverage detected