mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-28 19:18:38 +08:00
GP-2662 - Paste hex in search memory window
This commit is contained in:
+12
-8
@@ -580,10 +580,10 @@ class MemSearchDialog extends DialogComponentProvider {
|
|||||||
memoryBlockGroup.add(loadedBlocks);
|
memoryBlockGroup.add(loadedBlocks);
|
||||||
memoryBlockGroup.add(allBlocks);
|
memoryBlockGroup.add(allBlocks);
|
||||||
|
|
||||||
loadedBlocks.setToolTipText(HTMLUtilities.toHTML(
|
loadedBlocks.setToolTipText(HTMLUtilities
|
||||||
"Only searches memory blocks that are loaded in a running executable.\n " +
|
.toHTML("Only searches memory blocks that are loaded in a running executable.\n " +
|
||||||
"Ghidra now includes memory blocks for other data such as section headers.\n" +
|
"Ghidra now includes memory blocks for other data such as section headers.\n" +
|
||||||
"This option exludes these OTHER (non loaded) blocks."));
|
"This option exludes these OTHER (non loaded) blocks."));
|
||||||
allBlocks.setToolTipText(
|
allBlocks.setToolTipText(
|
||||||
"Searches all memory blocks including blocks that are not actually loaded in a running executable");
|
"Searches all memory blocks including blocks that are not actually loaded in a running executable");
|
||||||
|
|
||||||
@@ -793,7 +793,8 @@ class MemSearchDialog extends DialogComponentProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String removeNumberBasePrefixAndSuffix(String str) {
|
private String removeNumberBasePrefixAndSuffix(String str) {
|
||||||
if (!(currentFormat instanceof HexSearchFormat || currentFormat instanceof BinarySearchFormat)) {
|
if (!(currentFormat instanceof HexSearchFormat ||
|
||||||
|
currentFormat instanceof BinarySearchFormat)) {
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -802,12 +803,15 @@ class MemSearchDialog extends DialogComponentProvider {
|
|||||||
if (currentFormat instanceof HexSearchFormat) {
|
if (currentFormat instanceof HexSearchFormat) {
|
||||||
if (lowercase.startsWith("0x")) {
|
if (lowercase.startsWith("0x")) {
|
||||||
numMaybe = numMaybe.substring(2);
|
numMaybe = numMaybe.substring(2);
|
||||||
} else if (lowercase.startsWith("$")) {
|
}
|
||||||
|
else if (lowercase.startsWith("$")) {
|
||||||
numMaybe = numMaybe.substring(1);
|
numMaybe = numMaybe.substring(1);
|
||||||
} else if (lowercase.endsWith("h")) {
|
}
|
||||||
|
else if (lowercase.endsWith("h")) {
|
||||||
numMaybe = numMaybe.substring(0, numMaybe.length() - 1);
|
numMaybe = numMaybe.substring(0, numMaybe.length() - 1);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
if (lowercase.startsWith("0b")) {
|
if (lowercase.startsWith("0b")) {
|
||||||
numMaybe = numMaybe.substring(2);
|
numMaybe = numMaybe.substring(2);
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-9
@@ -15,8 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package ghidra.app.plugin.core.searchmem;
|
package ghidra.app.plugin.core.searchmem;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.*;
|
||||||
import static org.junit.Assert.assertNotNull;
|
|
||||||
|
|
||||||
import java.awt.Container;
|
import java.awt.Container;
|
||||||
import java.awt.Window;
|
import java.awt.Window;
|
||||||
@@ -99,8 +98,7 @@ public class MnemonicSearchPluginTest extends AbstractGhidraHeadedIntegrationTes
|
|||||||
|
|
||||||
performAction(searchMnemonicOperandsNoConstAction, cb.getProvider(), true);
|
performAction(searchMnemonicOperandsNoConstAction, cb.getProvider(), true);
|
||||||
|
|
||||||
MemSearchDialog dialog =
|
MemSearchDialog dialog = waitForDialogComponent(MemSearchDialog.class);
|
||||||
waitForDialogComponent(tool.getToolFrame(), MemSearchDialog.class, 2000);
|
|
||||||
assertNotNull(dialog);
|
assertNotNull(dialog);
|
||||||
Container component = dialog.getComponent();
|
Container component = dialog.getComponent();
|
||||||
|
|
||||||
@@ -121,8 +119,7 @@ public class MnemonicSearchPluginTest extends AbstractGhidraHeadedIntegrationTes
|
|||||||
|
|
||||||
performAction(searchMnemonicNoOperandsNoConstAction, cb.getProvider(), true);
|
performAction(searchMnemonicNoOperandsNoConstAction, cb.getProvider(), true);
|
||||||
|
|
||||||
MemSearchDialog dialog =
|
MemSearchDialog dialog = waitForDialogComponent(MemSearchDialog.class);
|
||||||
waitForDialogComponent(tool.getToolFrame(), MemSearchDialog.class, 2000);
|
|
||||||
assertNotNull(dialog);
|
assertNotNull(dialog);
|
||||||
Container component = dialog.getComponent();
|
Container component = dialog.getComponent();
|
||||||
|
|
||||||
@@ -143,8 +140,7 @@ public class MnemonicSearchPluginTest extends AbstractGhidraHeadedIntegrationTes
|
|||||||
|
|
||||||
performAction(searchMnemonicOperandsConstAction, cb.getProvider(), true);
|
performAction(searchMnemonicOperandsConstAction, cb.getProvider(), true);
|
||||||
|
|
||||||
MemSearchDialog dialog =
|
MemSearchDialog dialog = waitForDialogComponent(MemSearchDialog.class);
|
||||||
waitForDialogComponent(tool.getToolFrame(), MemSearchDialog.class, 2000);
|
|
||||||
assertNotNull(dialog);
|
assertNotNull(dialog);
|
||||||
Container component = dialog.getComponent();
|
Container component = dialog.getComponent();
|
||||||
|
|
||||||
@@ -181,7 +177,7 @@ public class MnemonicSearchPluginTest extends AbstractGhidraHeadedIntegrationTes
|
|||||||
// Here's the main assert: If the code recognizes that we have multiple selection, the
|
// Here's the main assert: If the code recognizes that we have multiple selection, the
|
||||||
// MemSearchDialog will NOT be displayed (an error message pops up instead). So verify that
|
// MemSearchDialog will NOT be displayed (an error message pops up instead). So verify that
|
||||||
// the dialog is null and we're ok.
|
// the dialog is null and we're ok.
|
||||||
Window errorDialog = waitForWindow("Mnemonic Search Error", 2000);
|
Window errorDialog = waitForWindow("Mnemonic Search Error");
|
||||||
assertNotNull(errorDialog);
|
assertNotNull(errorDialog);
|
||||||
errorDialog.setVisible(false);
|
errorDialog.setVisible(false);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user