mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-25 05:32:14 +00:00
Merge remote-tracking branch
'origin/GP-1938_emteere_Mangaged_X86_disassembly' into patch (Closes #4159)
This commit is contained in:
commit
bb56b711e6
@ -38,6 +38,7 @@ import ghidra.app.util.importer.MessageLog;
|
||||
import ghidra.program.database.function.OverlappingFunctionException;
|
||||
import ghidra.program.model.address.*;
|
||||
import ghidra.program.model.data.*;
|
||||
import ghidra.program.model.lang.PrototypeModel;
|
||||
import ghidra.program.model.listing.*;
|
||||
import ghidra.program.model.listing.Function.FunctionUpdateType;
|
||||
import ghidra.program.model.symbol.SourceType;
|
||||
@ -55,6 +56,7 @@ import ghidra.util.task.TaskMonitor;
|
||||
public class CliTableMethodDef extends CliAbstractTable {
|
||||
|
||||
private static final int CLITABLEMETHODDEF_PINVOKE_JUMP_LENGTH = 0x06;
|
||||
private static final String CLITABLEMETHODDEF_CLRCALL_CONVENTION = "__clrcall";
|
||||
|
||||
public class CliMethodDefRow extends CliAbstractTableRow {
|
||||
public int RVA;
|
||||
@ -437,6 +439,25 @@ public class CliTableMethodDef extends CliAbstractTable {
|
||||
newFunc.setReturnType(returnType, SourceType.ANALYSIS);
|
||||
newFunc.updateFunction(null, null, FunctionUpdateType.DYNAMIC_STORAGE_ALL_PARAMS,
|
||||
true, SourceType.ANALYSIS, parameters);
|
||||
|
||||
// If Code here is not of the correct type, create a data element to stop disassembly, and comment
|
||||
PrototypeModel cliCallingConvention = program.getLanguage()
|
||||
.getDefaultCompilerSpec()
|
||||
.getCallingConvention(CLITABLEMETHODDEF_CLRCALL_CONVENTION);
|
||||
|
||||
if ((cliCallingConvention == null && !methodRow.isNative()) ||
|
||||
(cliCallingConvention != null && methodRow.isNative())) {
|
||||
Data data = program.getListing()
|
||||
.createData(startAddr, new ArrayDataType(BYTE, (int) endAddr.subtract(startAddr) + 1, 1));
|
||||
data.setComment(CodeUnit.PRE_COMMENT,
|
||||
(methodRow.isManaged() ? ".NET CLR Managed Code" : "Native Code"));
|
||||
}
|
||||
}
|
||||
catch (CodeUnitInsertionException e) {
|
||||
// Ignore, something there already
|
||||
}
|
||||
catch (DataTypeConflictException e) {
|
||||
// Ignore, something there already
|
||||
}
|
||||
catch (NullPointerException e) {
|
||||
Msg.warn(this, "Error processing function \"" + funcName + "\" (" + methodRowIndex +
|
||||
|
Loading…
Reference in New Issue
Block a user