mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 10:19:23 +02:00
GP-4244 LoadPdbTask: schedule EntryPointAnalyzer
This commit is contained in:
parent
85d276bce0
commit
d5470e1086
3 changed files with 28 additions and 14 deletions
|
@ -15,7 +15,7 @@
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* EntryPointAnalyzer.java
|
* EntryPointAnalyzer.java
|
||||||
*
|
*
|
||||||
* Created on Aug 27, 2003
|
* Created on Aug 27, 2003
|
||||||
*/
|
*/
|
||||||
package ghidra.app.plugin.core.disassembler;
|
package ghidra.app.plugin.core.disassembler;
|
||||||
|
@ -41,7 +41,7 @@ import ghidra.util.task.TaskMonitor;
|
||||||
|
|
||||||
public class EntryPointAnalyzer extends AbstractAnalyzer {
|
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 static final String DESCRIPTION = "Disassembles entry points in newly added memory.";
|
||||||
|
|
||||||
private final static String OPTION_NAME_RESPECT_EXECUTE_FLAG = "Respect Execute Flag";
|
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
|
* 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.
|
* analysis of the program, so schedule the do later set after some analysis has occurred.
|
||||||
*
|
*
|
||||||
* @param program - this program
|
* @param program - this program
|
||||||
* @param monitor - monitor
|
* @param monitor - monitor
|
||||||
* @param doLaterSet - set of functions that were put off until later
|
* @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.
|
* Check for a single external entry point.
|
||||||
*
|
*
|
||||||
* @param program - program to check
|
* @param program - program to check
|
||||||
* @param externalCount - count of external entry points found
|
* @param externalCount - count of external entry points found
|
||||||
* @param doNowSet - set of functions that are to be done now
|
* @param doNowSet - set of functions that are to be done now
|
||||||
*
|
*
|
||||||
* @return true if this program has only one external entry point
|
* @return true if this program has only one external entry point
|
||||||
*/
|
*/
|
||||||
private boolean isSingleExternalEntryPoint(Program program, int externalCount,
|
private boolean isSingleExternalEntryPoint(Program program, int externalCount,
|
||||||
|
|
|
@ -26,7 +26,7 @@ import ghidra.program.model.listing.Program;
|
||||||
*/
|
*/
|
||||||
public class MicrosoftDemanglerAnalyzer extends AbstractDemanglerAnalyzer {
|
public class MicrosoftDemanglerAnalyzer extends AbstractDemanglerAnalyzer {
|
||||||
|
|
||||||
private static final String NAME = "Demangler Microsoft";
|
public static final String NAME = "Demangler Microsoft";
|
||||||
private static final String DESCRIPTION =
|
private static final String DESCRIPTION =
|
||||||
"After a function is created, this analyzer will attempt to demangle " +
|
"After a function is created, this analyzer will attempt to demangle " +
|
||||||
"the name and apply datatypes to parameters.";
|
"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.analysis.*;
|
||||||
import ghidra.app.plugin.core.datamgr.archive.DuplicateIdException;
|
import ghidra.app.plugin.core.datamgr.archive.DuplicateIdException;
|
||||||
|
import ghidra.app.plugin.core.disassembler.EntryPointAnalyzer;
|
||||||
import ghidra.app.services.DataTypeManagerService;
|
import ghidra.app.services.DataTypeManagerService;
|
||||||
import ghidra.app.util.bin.format.pdb.PdbException;
|
import ghidra.app.util.bin.format.pdb.PdbException;
|
||||||
import ghidra.app.util.bin.format.pdb.PdbParser;
|
import ghidra.app.util.bin.format.pdb.PdbParser;
|
||||||
|
@ -165,21 +166,34 @@ class LoadPdbTask extends Task {
|
||||||
AutoAnalysisManager manager = AutoAnalysisManager.getAnalysisManager(program);
|
AutoAnalysisManager manager = AutoAnalysisManager.getAnalysisManager(program);
|
||||||
Options analysisProperties = program.getOptions(Program.ANALYSIS_PROPERTIES);
|
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) {
|
AddressSetView addrs) {
|
||||||
MicrosoftDemanglerAnalyzer demanglerAnalyzer = new MicrosoftDemanglerAnalyzer();
|
|
||||||
String analyzerName = demanglerAnalyzer.getName();
|
|
||||||
String valueAsString = analysisProperties.getValueAsString(analyzerName);
|
|
||||||
|
|
||||||
// Only schedule analyzer if enabled
|
// Only schedule analyzer if enabled
|
||||||
if (!Boolean.parseBoolean(valueAsString)) {
|
if (!analysisProperties.getBoolean(EntryPointAnalyzer.NAME, false)) {
|
||||||
return;
|
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);
|
manager.scheduleOneTimeAnalysis(demanglerAnalyzer, addrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue