Fixed tools unable to restore Listing location information; fixed

warning getting printed to console for non-Java binaries
This commit is contained in:
dragonmacher 2019-07-15 17:24:51 -04:00
parent 2398f8f6bf
commit 83d85daabc
6 changed files with 20 additions and 29 deletions

View file

@ -34,7 +34,7 @@
<SPLIT_NODE WIDTH="1386" HEIGHT="638" DIVIDER_LOCATION="705" ORIENTATION="VERTICAL">
<SPLIT_NODE WIDTH="1399" HEIGHT="642" DIVIDER_LOCATION="679" ORIENTATION="HORIZONTAL">
<COMPONENT_NODE TOP_INFO="0">
<COMPONENT_INFO NAME="CodeBrowserPlugin" OWNER="CodeBrowserPlugin" TITLE="Listing: " ACTIVE="true" GROUP="Core" INSTANCE_ID="3207819926581772881" />
<COMPONENT_INFO NAME="Listing" OWNER="CodeBrowserPlugin" TITLE="Listing: " ACTIVE="true" GROUP="Core" INSTANCE_ID="3207819926581772881" />
</COMPONENT_NODE>
<COMPONENT_NODE TOP_INFO="0">
<COMPONENT_INFO NAME="Decompiler" OWNER="DecompilePlugin" TITLE="Decompile" ACTIVE="true" GROUP="Default" INSTANCE_ID="3207819926581772879" />

View file

@ -31,7 +31,7 @@
</SPLIT_NODE>
<SPLIT_NODE WIDTH="996" HEIGHT="491" DIVIDER_LOCATION="622" ORIENTATION="HORIZONTAL">
<COMPONENT_NODE TOP_INFO="0">
<COMPONENT_INFO NAME="CodeBrowserPlugin" OWNER="CodeBrowserPlugin" TITLE="Listing: WinHelloCPP.exe" ACTIVE="false" GROUP="Default" INSTANCE_ID="2978368332383876916" />
<COMPONENT_INFO NAME="Listing" OWNER="CodeBrowserPlugin" TITLE="Listing: WinHelloCPP.exe" ACTIVE="false" GROUP="Default" INSTANCE_ID="2978368332383876916" />
</COMPONENT_NODE>
<COMPONENT_NODE TOP_INFO="0">
<COMPONENT_INFO NAME="Decompiler" OWNER="DecompilePlugin" TITLE="Decompiler" ACTIVE="false" GROUP="Default" INSTANCE_ID="2999653489311119725" />
@ -43,9 +43,6 @@
</COMPONENT_NODE>
</SPLIT_NODE>
<SPLIT_NODE WIDTH="100" HEIGHT="100" DIVIDER_LOCATION="0" ORIENTATION="VERTICAL">
<COMPONENT_NODE TOP_INFO="0">
<COMPONENT_INFO NAME="CodeBrowserPlugin" OWNER="CodeBrowserPlugin" TITLE="Listing: WinHelloCPP.exe" ACTIVE="true" GROUP="Core" INSTANCE_ID="2999653489311119722" />
</COMPONENT_NODE>
<COMPONENT_NODE TOP_INFO="0">
<COMPONENT_INFO NAME="Bookmarks" OWNER="BookmarkPlugin" TITLE="Bookmarks" ACTIVE="false" GROUP="Core.Bookmarks" INSTANCE_ID="2999653489311119724" />
</COMPONENT_NODE>

View file

@ -34,11 +34,7 @@
<SPLIT_NODE WIDTH="1475" HEIGHT="596" DIVIDER_LOCATION="632" ORIENTATION="HORIZONTAL">
<SPLIT_NODE WIDTH="950" HEIGHT="985" DIVIDER_LOCATION="894" ORIENTATION="HORIZONTAL">
<COMPONENT_NODE TOP_INFO="0">
<COMPONENT_INFO NAME="CodeBrowserPlugin" OWNER="CodeBrowserPlugin" TITLE="Listing: notepad.exe.2" ACTIVE="true" GROUP="" INSTANCE_ID="2777482860928188961" />
<COMPONENT_INFO NAME="Test Listing" OWNER="Test Listing" TITLE="Test Listing" ACTIVE="false" GROUP="" INSTANCE_ID="2733632016422332683" />
</COMPONENT_NODE>
<COMPONENT_NODE TOP_INFO="0">
<COMPONENT_INFO NAME="CodeBrowserPlugin" OWNER="CodeBrowserPlugin" TITLE="[Listing: notepad.exe]" ACTIVE="false" GROUP="disconnected" INSTANCE_ID="2738354194536315852" />
<COMPONENT_INFO NAME="Listing" OWNER="CodeBrowserPlugin" TITLE="Listing: notepad.exe.2" ACTIVE="true" GROUP="" INSTANCE_ID="2777482860928188961" />
</COMPONENT_NODE>
</SPLIT_NODE>
<SPLIT_NODE WIDTH="355" HEIGHT="1097" DIVIDER_LOCATION="542" ORIENTATION="VERTICAL">

View file

@ -34,11 +34,7 @@
<SPLIT_NODE WIDTH="1475" HEIGHT="551" DIVIDER_LOCATION="632" ORIENTATION="HORIZONTAL">
<SPLIT_NODE WIDTH="950" HEIGHT="985" DIVIDER_LOCATION="894" ORIENTATION="HORIZONTAL">
<COMPONENT_NODE TOP_INFO="0">
<COMPONENT_INFO NAME="CodeBrowserPlugin" OWNER="CodeBrowserPlugin" TITLE="Listing: WallaceSrc" ACTIVE="true" GROUP="" INSTANCE_ID="2769903913093334120" />
<COMPONENT_INFO NAME="Test Listing" OWNER="Test Listing" TITLE="Test Listing" ACTIVE="false" GROUP="" INSTANCE_ID="2733632016422332683" />
</COMPONENT_NODE>
<COMPONENT_NODE TOP_INFO="0">
<COMPONENT_INFO NAME="CodeBrowserPlugin" OWNER="CodeBrowserPlugin" TITLE="[Listing: notepad.exe]" ACTIVE="false" GROUP="disconnected" INSTANCE_ID="2738354194536315852" />
<COMPONENT_INFO NAME="Listing" OWNER="CodeBrowserPlugin" TITLE="Listing: WallaceSrc" ACTIVE="true" GROUP="" INSTANCE_ID="2769903913093334120" />
</COMPONENT_NODE>
</SPLIT_NODE>
<SPLIT_NODE WIDTH="355" HEIGHT="1097" DIVIDER_LOCATION="542" ORIENTATION="VERTICAL">

View file

@ -35,6 +35,10 @@ import ghidra.util.SystemUtilities;
* is active, then this node will create a tabbedPane object to contain the active components.
*/
class ComponentNode extends Node {
private static final String OLD_LISTING_NAME = "CodeBrowserPlugin";
private static final String NEW_LISTING_NAME = "Listing";
private ComponentPlaceholder top;
private List<ComponentPlaceholder> windowPlaceholders;
private JComponent comp;
@ -69,6 +73,7 @@ class ComponentNode extends Node {
* @param elem the xml element describing the configuration of this node.
* @param mgr the docking windows manager
* @param parent the parent node for this node.
* @param restoredPlaceholders the list into which any restored placeholders will be placed
*/
ComponentNode(Element elem, DockingWindowManager mgr, Node parent,
List<ComponentPlaceholder> restoredPlaceholders) {
@ -90,13 +95,10 @@ class ComponentNode extends Node {
group = ComponentProvider.DEFAULT_WINDOW_GROUP;
}
// SCR #4120 - Ignore old, buggy child nodes that had too long titles. This
// will cleanup slow loading XML project files.
if (name.length() > 100) {
name = name.substring(0, 100);
}
if (title.length() > 100) {
title = title.substring(0, 100);
// TODO remove this in a few major releases after 9.1; this prevents existing tools
// from losing layout positioning information due to a recent rename
if (OLD_LISTING_NAME.equals(name)) {
name = NEW_LISTING_NAME;
}
boolean isActive = Boolean.valueOf(e.getAttributeValue("ACTIVE")).booleanValue();
@ -232,9 +234,6 @@ class ComponentNode extends Node {
}
}
/**
* Returns the number of ComponentWindowingPlaceholder objects being managed by this node.
*/
int getComponentCount() {
return windowPlaceholders.size();
}

View file

@ -30,14 +30,17 @@ public class JavaClassUtil {
public final static boolean isClassFile(Program program) {
AddressFactory factory = program.getAddressFactory();
byte[] bytes = new byte[4];
try {
Address address = program.getAddressFactory().getAddressSpace(
JavaLoader.CONSTANT_POOL).getMinAddress();
AddressSpace space = factory.getAddressSpace(JavaLoader.CONSTANT_POOL);
if (space != null) {
Address address = space.getMinAddress();
program.getMemory().getBytes(address, bytes);
}
}
catch (Exception e) {
Msg.info(JavaClassUtil.class, e.getLocalizedMessage());
Msg.error(JavaClassUtil.class, "Exception reading program bytes: " + e.getMessage(), e);
return false;
}
return Arrays.equals(bytes, JavaClassConstants.MAGIC_BYTES);