mirror of
https://github.com/NationalSecurityAgency/ghidra
synced 2024-08-27 21:10:26 +00:00
GP-4244 LoadPdbTask: schedule EntryPointAnalyzer
This commit is contained in:
parent
85d276bce0
commit
d5470e1086
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
/*
|
||||
* EntryPointAnalyzer.java
|
||||
*
|
||||
*
|
||||
* Created on Aug 27, 2003
|
||||
*/
|
||||
package ghidra.app.plugin.core.disassembler;
|
||||
|
@ -41,7 +41,7 @@ import ghidra.util.task.TaskMonitor;
|
|||
|
||||
public class EntryPointAnalyzer extends AbstractAnalyzer {
|
||||
|
||||
private final static String NAME = "Disassemble Entry Points";
|
||||
public final static String NAME = "Disassemble Entry Points";
|
||||
private static final String DESCRIPTION = "Disassembles entry points in newly added memory.";
|
||||
|
||||
private final static String OPTION_NAME_RESPECT_EXECUTE_FLAG = "Respect Execute Flag";
|
||||
|
@ -138,7 +138,7 @@ public class EntryPointAnalyzer extends AbstractAnalyzer {
|
|||
/**
|
||||
* Process the items on the do later set. If doing block analysis, then this is the initial
|
||||
* analysis of the program, so schedule the do later set after some analysis has occurred.
|
||||
*
|
||||
*
|
||||
* @param program - this program
|
||||
* @param monitor - monitor
|
||||
* @param doLaterSet - set of functions that were put off until later
|
||||
|
@ -164,11 +164,11 @@ public class EntryPointAnalyzer extends AbstractAnalyzer {
|
|||
|
||||
/**
|
||||
* Check for a single external entry point.
|
||||
*
|
||||
*
|
||||
* @param program - program to check
|
||||
* @param externalCount - count of external entry points found
|
||||
* @param doNowSet - set of functions that are to be done now
|
||||
*
|
||||
*
|
||||
* @return true if this program has only one external entry point
|
||||
*/
|
||||
private boolean isSingleExternalEntryPoint(Program program, int externalCount,
|
||||
|
|
|
@ -26,7 +26,7 @@ import ghidra.program.model.listing.Program;
|
|||
*/
|
||||
public class MicrosoftDemanglerAnalyzer extends AbstractDemanglerAnalyzer {
|
||||
|
||||
private static final String NAME = "Demangler Microsoft";
|
||||
public static final String NAME = "Demangler Microsoft";
|
||||
private static final String DESCRIPTION =
|
||||
"After a function is created, this analyzer will attempt to demangle " +
|
||||
"the name and apply datatypes to parameters.";
|
||||
|
|
|
@ -21,6 +21,7 @@ import java.lang.reflect.InvocationTargetException;
|
|||
|
||||
import ghidra.app.plugin.core.analysis.*;
|
||||
import ghidra.app.plugin.core.datamgr.archive.DuplicateIdException;
|
||||
import ghidra.app.plugin.core.disassembler.EntryPointAnalyzer;
|
||||
import ghidra.app.services.DataTypeManagerService;
|
||||
import ghidra.app.util.bin.format.pdb.PdbException;
|
||||
import ghidra.app.util.bin.format.pdb.PdbParser;
|
||||
|
@ -165,21 +166,34 @@ class LoadPdbTask extends Task {
|
|||
AutoAnalysisManager manager = AutoAnalysisManager.getAnalysisManager(program);
|
||||
Options analysisProperties = program.getOptions(Program.ANALYSIS_PROPERTIES);
|
||||
|
||||
//other planned analysis here.
|
||||
if (!useMsDiaParser && control == PdbApplicatorControl.ALL) {
|
||||
// one-byte functions could have been laid down
|
||||
scheduleEntryPointAnalyzer(manager, analysisProperties, addrs);
|
||||
}
|
||||
if (useMsDiaParser || control != PdbApplicatorControl.DATA_TYPES_ONLY) {
|
||||
// mangled symbols could have been laid down
|
||||
scheduleDemanglerAnalyzer(manager, analysisProperties, addrs);
|
||||
}
|
||||
|
||||
scheduleDemangler(manager, analysisProperties, addrs);
|
||||
}
|
||||
|
||||
private void scheduleDemangler(AutoAnalysisManager manager, Options analysisProperties,
|
||||
private void scheduleEntryPointAnalyzer(AutoAnalysisManager manager, Options analysisProperties,
|
||||
AddressSetView addrs) {
|
||||
MicrosoftDemanglerAnalyzer demanglerAnalyzer = new MicrosoftDemanglerAnalyzer();
|
||||
String analyzerName = demanglerAnalyzer.getName();
|
||||
String valueAsString = analysisProperties.getValueAsString(analyzerName);
|
||||
|
||||
// Only schedule analyzer if enabled
|
||||
if (!Boolean.parseBoolean(valueAsString)) {
|
||||
if (!analysisProperties.getBoolean(EntryPointAnalyzer.NAME, false)) {
|
||||
return;
|
||||
}
|
||||
EntryPointAnalyzer entryPointAnalyzer = new EntryPointAnalyzer();
|
||||
manager.scheduleOneTimeAnalysis(entryPointAnalyzer, addrs);
|
||||
}
|
||||
|
||||
private void scheduleDemanglerAnalyzer(AutoAnalysisManager manager, Options analysisProperties,
|
||||
AddressSetView addrs) {
|
||||
// Only schedule analyzer if enabled
|
||||
if (!analysisProperties.getBoolean(MicrosoftDemanglerAnalyzer.NAME, false)) {
|
||||
return;
|
||||
}
|
||||
MicrosoftDemanglerAnalyzer demanglerAnalyzer = new MicrosoftDemanglerAnalyzer();
|
||||
manager.scheduleOneTimeAnalysis(demanglerAnalyzer, addrs);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue