mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-31 21:37:54 +08:00
GP-42 tweak symbol dir bootstrap logic, misc text & help
This commit is contained in:
@@ -184,7 +184,7 @@
|
||||
change the search criteria, they are not persisted to your program's metadata.</P>
|
||||
<UL>
|
||||
<LI><B>PDB Name Checkbox</B> - this checkbox allows entering a custom value for the desired PDB file name.</LI>
|
||||
<LI><B>PDB Unique Id Checkbox</B> - this checkbox allows entering a custom GUID or ID value.</LI>
|
||||
<LI><B>PDB Unique ID Checkbox</B> - this checkbox allows entering a custom GUID or ID value.</LI>
|
||||
<LI><B>PDB Age Checkbox</B> - this checkbox allows entering a custom age value.</LI>
|
||||
</UL>
|
||||
<P>After changing a search option, you will need to perform another search to use the new options.</P>
|
||||
@@ -198,7 +198,12 @@
|
||||
<UL>
|
||||
<LI><B>Universal</B> - Platform-independent PDB analyzer (No PDB.XML support).</LI>
|
||||
<LI><B>MSDIA</B> - Legacy PDB Analyzer. Requires MS DIA-SDK for raw PDB processing (Windows only), or preprocessed PDB.XML file.</LI>
|
||||
<LI><B>Control</B> - Process All, Data Types Only, Public Symbols Only.</LI>
|
||||
</UL>
|
||||
<P><B>Control</B> (Universal only) - Controls how the PDB is applied to the Program</P>
|
||||
<UL>
|
||||
<LI><B>Process All</B>: Applies Data Types and Public, Global, and Module Symbols.</LI>
|
||||
<LI><B>Data Types Only</B>: Applies Data Types and Typedefs found in the Global Symbols.</LI>
|
||||
<LI><B>Public Symbols Only</B>: Applies only Public symbols to the program. It ignores Global symbols and Module symbols.</LI>
|
||||
</UL>
|
||||
</BLOCKQUOTE>
|
||||
</BLOCKQUOTE>
|
||||
|
||||
BIN
Binary file not shown.
|
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 42 KiB |
BIN
Binary file not shown.
|
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 77 KiB |
BIN
Binary file not shown.
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 28 KiB |
@@ -15,9 +15,8 @@
|
||||
*/
|
||||
package pdb.symbolserver;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
|
||||
@@ -33,6 +32,8 @@ import utilities.util.FileUtilities;
|
||||
*/
|
||||
public class LocalSymbolStore extends AbstractSymbolServer implements SymbolStore {
|
||||
private static final String ADMIN_DIRNAME = "000admin"; // per MS custom
|
||||
private static final Set<File> ALREADY_WARNED_ABOUT =
|
||||
Collections.synchronizedSet(new HashSet<>());
|
||||
|
||||
/**
|
||||
* Predicate that returns true if the location string is a LocalSymbolStore path
|
||||
@@ -152,9 +153,49 @@ public class LocalSymbolStore extends AbstractSymbolServer implements SymbolStor
|
||||
if (pingMeFile.isFile() && adminDir.isDirectory()) {
|
||||
return super.detectStorageLevel(monitor);
|
||||
}
|
||||
return doHackyStorageLevelDetection(monitor);
|
||||
}
|
||||
|
||||
private int doHackyStorageLevelDetection(TaskMonitor monitor) {
|
||||
// dig through the files in the rootDir and see if there is anything
|
||||
// that looks like a level1 or level2 directory.
|
||||
if (containsPdbSymbolDirsWithFiles(rootDir)) {
|
||||
if (ALREADY_WARNED_ABOUT.add(rootDir)) {
|
||||
Msg.warn(this,
|
||||
"Symbol directory missing control files, guessing storage scheme as level 1: " +
|
||||
rootDir);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
File[] possibleLevel2SymbolDirs =
|
||||
list(rootDir, f -> f.isDirectory() && f.getName().length() == 2);
|
||||
for (File dir : possibleLevel2SymbolDirs) {
|
||||
if (containsPdbSymbolDirsWithFiles(dir)) {
|
||||
if (ALREADY_WARNED_ABOUT.add(rootDir)) {
|
||||
Msg.warn(this,
|
||||
"Symbol directory missing control files, guessing storage scheme as level 2: " +
|
||||
rootDir);
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private boolean containsPdbSymbolDirsWithFiles(File testDir) {
|
||||
File[] possibleLevel1SymbolDirs =
|
||||
list(testDir, f -> f.isDirectory() && f.getName().toLowerCase().endsWith(".pdb"));
|
||||
for (File dir : possibleLevel1SymbolDirs) {
|
||||
if (list(dir, f -> f.isDirectory() &&
|
||||
SymbolFileInfo.fromSubdirectoryPath("doesntmatter", f.getName()) != null &&
|
||||
new File(f, dir.getName()).isFile()).length > 0) {
|
||||
Msg.debug(this, "Detected symbol file directory: " + dir);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SymbolFileLocation> find(SymbolFileInfo symbolFileInfo, Set<FindOption> options,
|
||||
TaskMonitor monitor) {
|
||||
@@ -296,6 +337,12 @@ public class LocalSymbolStore extends AbstractSymbolServer implements SymbolStor
|
||||
Msg.info(this, logPrefix() + ": File already exists: " + destinationFile);
|
||||
return relativeDestinationFilename;
|
||||
}
|
||||
if (destinationFile.isDirectory()) {
|
||||
Msg.error(this, logPrefix() + ": File's location already exists and is a directory: " +
|
||||
destinationFile);
|
||||
Msg.error(this, logPrefix() + ": Possible symbol storage directory misconfiguration!");
|
||||
return relativeDestinationFilename;
|
||||
}
|
||||
|
||||
File destinationFileTmp = new File(rootDir, relativeDestinationFilename + ".tmp");
|
||||
destinationFileTmp.delete();
|
||||
|
||||
@@ -331,7 +331,7 @@ public class LoadPdbDialog extends DialogComponentProvider {
|
||||
}
|
||||
SymbolFileInfo symbolFileInfo = getCurrentSymbolFileInfo();
|
||||
if (symbolFileInfo == null) {
|
||||
Msg.showWarn(this, null, "Bad PDB GUID/Id",
|
||||
Msg.showWarn(this, null, "Bad PDB GUID/ID",
|
||||
"Invalid PDB GUID / UID value: " + pdbUniqueIdTextField.getText());
|
||||
return;
|
||||
}
|
||||
@@ -441,14 +441,14 @@ public class LoadPdbDialog extends DialogComponentProvider {
|
||||
pdbUniqueIdTextField = new BetterNonEditableTextField(36);
|
||||
pdbUniqueIdTextField.setEditable(false);
|
||||
pdbUniqueIdTextField.setToolTipText(
|
||||
"<html>PDB GUID - either 36 or 32 hexadecimal characters:<br>" +
|
||||
" <b>'012345678-0123-0123-0123-0123456789ABC'</b> or <b>'0123456780123012301230123456789ABC'</b>, or<br>" +
|
||||
"PDB Signature Id - 8 hexadecimal character Id:<br>" +
|
||||
"<html>PDB GUID - 32 hexadecimal characters:<br>" +
|
||||
" <b>'012345678-0123-0123-0123-0123456789ABC'</b> (with or without dashes) or<br>" +
|
||||
"PDB Signature ID - 8 hexadecimal characters:<br>" +
|
||||
" <b>'11223344'</b>");
|
||||
|
||||
overridePdbUniqueIdCheckBox = new GCheckBox();
|
||||
overridePdbUniqueIdCheckBox.setVisible(false);
|
||||
overridePdbUniqueIdCheckBox.setToolTipText("Override PDB unique id (when searching).");
|
||||
overridePdbUniqueIdCheckBox.setToolTipText("Override PDB Unique ID (when searching).");
|
||||
overridePdbUniqueIdCheckBox.addItemListener(e -> {
|
||||
pdbUniqueIdTextField.setEditable(overridePdbUniqueIdCheckBox.isSelected());
|
||||
if (overridePdbUniqueIdCheckBox.isSelected()) {
|
||||
@@ -494,7 +494,7 @@ public class LoadPdbDialog extends DialogComponentProvider {
|
||||
join(null, new GLabel("PDB Name:", SwingConstants.RIGHT), overridePdbPathCheckBox));
|
||||
programPdbPanel.add(pdbPathTextField);
|
||||
|
||||
programPdbPanel.add(join(null, new GLabel("PDB Unique Id:", SwingConstants.RIGHT),
|
||||
programPdbPanel.add(join(null, new GLabel("PDB Unique ID:", SwingConstants.RIGHT),
|
||||
overridePdbUniqueIdCheckBox));
|
||||
programPdbPanel.add(pdbUniqueIdTextField);
|
||||
|
||||
@@ -574,6 +574,7 @@ public class LoadPdbDialog extends DialogComponentProvider {
|
||||
radioButtons.add(msdiaParserButton);
|
||||
|
||||
applicatorControlCombo = new GComboBox<>(PdbApplicatorControl.values());
|
||||
applicatorControlCombo.setToolTipText("Selects which subsets of information to parse.");
|
||||
applicatorControlCombo.setSelectedItem(PdbApplicatorControl.ALL);
|
||||
|
||||
parserOptionsPanel = new JPanel(new PairLayout(5, 5));
|
||||
|
||||
@@ -266,6 +266,8 @@ class SymbolServerPanel extends JPanel {
|
||||
private JPanel buildSymbolStorageLocationPanel() {
|
||||
symbolStorageLocationTextField = new HintTextField(" Required ");
|
||||
symbolStorageLocationTextField.setEditable(false);
|
||||
symbolStorageLocationTextField
|
||||
.setToolTipText("User-specified directory where PDB files are stored. Required.");
|
||||
|
||||
chooseSymbolStorageLocationButton =
|
||||
ButtonPanelFactory.createButton(ButtonPanelFactory.BROWSE_TYPE);
|
||||
@@ -273,8 +275,8 @@ class SymbolServerPanel extends JPanel {
|
||||
|
||||
symbolStorageLocationPanel = new JPanel(new PairLayout(5, 5));
|
||||
GLabel symbolStorageLocLabel = new GLabel("Local Symbol Storage:", SwingConstants.RIGHT);
|
||||
symbolStorageLocLabel
|
||||
.setToolTipText("User-specified directory where PDB files are stored. Required.");
|
||||
symbolStorageLocLabel.setToolTipText(symbolStorageLocationTextField.getToolTipText());
|
||||
|
||||
symbolStorageLocationPanel.add(symbolStorageLocLabel);
|
||||
symbolStorageLocationPanel.add(LoadPdbDialog.join(null, symbolStorageLocationTextField,
|
||||
chooseSymbolStorageLocationButton));
|
||||
|
||||
Reference in New Issue
Block a user