mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 18:29:37 +02:00
Fixed tools unable to restore Listing location information; fixed
warning getting printed to console for non-Java binaries
This commit is contained in:
parent
2398f8f6bf
commit
83d85daabc
6 changed files with 20 additions and 29 deletions
|
@ -34,7 +34,7 @@
|
||||||
<SPLIT_NODE WIDTH="1386" HEIGHT="638" DIVIDER_LOCATION="705" ORIENTATION="VERTICAL">
|
<SPLIT_NODE WIDTH="1386" HEIGHT="638" DIVIDER_LOCATION="705" ORIENTATION="VERTICAL">
|
||||||
<SPLIT_NODE WIDTH="1399" HEIGHT="642" DIVIDER_LOCATION="679" ORIENTATION="HORIZONTAL">
|
<SPLIT_NODE WIDTH="1399" HEIGHT="642" DIVIDER_LOCATION="679" ORIENTATION="HORIZONTAL">
|
||||||
<COMPONENT_NODE TOP_INFO="0">
|
<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>
|
||||||
<COMPONENT_NODE TOP_INFO="0">
|
<COMPONENT_NODE TOP_INFO="0">
|
||||||
<COMPONENT_INFO NAME="Decompiler" OWNER="DecompilePlugin" TITLE="Decompile" ACTIVE="true" GROUP="Default" INSTANCE_ID="3207819926581772879" />
|
<COMPONENT_INFO NAME="Decompiler" OWNER="DecompilePlugin" TITLE="Decompile" ACTIVE="true" GROUP="Default" INSTANCE_ID="3207819926581772879" />
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
</SPLIT_NODE>
|
</SPLIT_NODE>
|
||||||
<SPLIT_NODE WIDTH="996" HEIGHT="491" DIVIDER_LOCATION="622" ORIENTATION="HORIZONTAL">
|
<SPLIT_NODE WIDTH="996" HEIGHT="491" DIVIDER_LOCATION="622" ORIENTATION="HORIZONTAL">
|
||||||
<COMPONENT_NODE TOP_INFO="0">
|
<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>
|
||||||
<COMPONENT_NODE TOP_INFO="0">
|
<COMPONENT_NODE TOP_INFO="0">
|
||||||
<COMPONENT_INFO NAME="Decompiler" OWNER="DecompilePlugin" TITLE="Decompiler" ACTIVE="false" GROUP="Default" INSTANCE_ID="2999653489311119725" />
|
<COMPONENT_INFO NAME="Decompiler" OWNER="DecompilePlugin" TITLE="Decompiler" ACTIVE="false" GROUP="Default" INSTANCE_ID="2999653489311119725" />
|
||||||
|
@ -43,9 +43,6 @@
|
||||||
</COMPONENT_NODE>
|
</COMPONENT_NODE>
|
||||||
</SPLIT_NODE>
|
</SPLIT_NODE>
|
||||||
<SPLIT_NODE WIDTH="100" HEIGHT="100" DIVIDER_LOCATION="0" ORIENTATION="VERTICAL">
|
<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_NODE TOP_INFO="0">
|
||||||
<COMPONENT_INFO NAME="Bookmarks" OWNER="BookmarkPlugin" TITLE="Bookmarks" ACTIVE="false" GROUP="Core.Bookmarks" INSTANCE_ID="2999653489311119724" />
|
<COMPONENT_INFO NAME="Bookmarks" OWNER="BookmarkPlugin" TITLE="Bookmarks" ACTIVE="false" GROUP="Core.Bookmarks" INSTANCE_ID="2999653489311119724" />
|
||||||
</COMPONENT_NODE>
|
</COMPONENT_NODE>
|
||||||
|
|
|
@ -34,11 +34,7 @@
|
||||||
<SPLIT_NODE WIDTH="1475" HEIGHT="596" DIVIDER_LOCATION="632" ORIENTATION="HORIZONTAL">
|
<SPLIT_NODE WIDTH="1475" HEIGHT="596" DIVIDER_LOCATION="632" ORIENTATION="HORIZONTAL">
|
||||||
<SPLIT_NODE WIDTH="950" HEIGHT="985" DIVIDER_LOCATION="894" ORIENTATION="HORIZONTAL">
|
<SPLIT_NODE WIDTH="950" HEIGHT="985" DIVIDER_LOCATION="894" ORIENTATION="HORIZONTAL">
|
||||||
<COMPONENT_NODE TOP_INFO="0">
|
<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="Listing" 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_NODE>
|
</COMPONENT_NODE>
|
||||||
</SPLIT_NODE>
|
</SPLIT_NODE>
|
||||||
<SPLIT_NODE WIDTH="355" HEIGHT="1097" DIVIDER_LOCATION="542" ORIENTATION="VERTICAL">
|
<SPLIT_NODE WIDTH="355" HEIGHT="1097" DIVIDER_LOCATION="542" ORIENTATION="VERTICAL">
|
||||||
|
|
|
@ -34,11 +34,7 @@
|
||||||
<SPLIT_NODE WIDTH="1475" HEIGHT="551" DIVIDER_LOCATION="632" ORIENTATION="HORIZONTAL">
|
<SPLIT_NODE WIDTH="1475" HEIGHT="551" DIVIDER_LOCATION="632" ORIENTATION="HORIZONTAL">
|
||||||
<SPLIT_NODE WIDTH="950" HEIGHT="985" DIVIDER_LOCATION="894" ORIENTATION="HORIZONTAL">
|
<SPLIT_NODE WIDTH="950" HEIGHT="985" DIVIDER_LOCATION="894" ORIENTATION="HORIZONTAL">
|
||||||
<COMPONENT_NODE TOP_INFO="0">
|
<COMPONENT_NODE TOP_INFO="0">
|
||||||
<COMPONENT_INFO NAME="CodeBrowserPlugin" OWNER="CodeBrowserPlugin" TITLE="Listing: WallaceSrc" ACTIVE="true" GROUP="" INSTANCE_ID="2769903913093334120" />
|
<COMPONENT_INFO NAME="Listing" 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_NODE>
|
</COMPONENT_NODE>
|
||||||
</SPLIT_NODE>
|
</SPLIT_NODE>
|
||||||
<SPLIT_NODE WIDTH="355" HEIGHT="1097" DIVIDER_LOCATION="542" ORIENTATION="VERTICAL">
|
<SPLIT_NODE WIDTH="355" HEIGHT="1097" DIVIDER_LOCATION="542" ORIENTATION="VERTICAL">
|
||||||
|
|
|
@ -35,6 +35,10 @@ import ghidra.util.SystemUtilities;
|
||||||
* is active, then this node will create a tabbedPane object to contain the active components.
|
* is active, then this node will create a tabbedPane object to contain the active components.
|
||||||
*/
|
*/
|
||||||
class ComponentNode extends Node {
|
class ComponentNode extends Node {
|
||||||
|
|
||||||
|
private static final String OLD_LISTING_NAME = "CodeBrowserPlugin";
|
||||||
|
private static final String NEW_LISTING_NAME = "Listing";
|
||||||
|
|
||||||
private ComponentPlaceholder top;
|
private ComponentPlaceholder top;
|
||||||
private List<ComponentPlaceholder> windowPlaceholders;
|
private List<ComponentPlaceholder> windowPlaceholders;
|
||||||
private JComponent comp;
|
private JComponent comp;
|
||||||
|
@ -69,6 +73,7 @@ class ComponentNode extends Node {
|
||||||
* @param elem the xml element describing the configuration of this node.
|
* @param elem the xml element describing the configuration of this node.
|
||||||
* @param mgr the docking windows manager
|
* @param mgr the docking windows manager
|
||||||
* @param parent the parent node for this node.
|
* @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,
|
ComponentNode(Element elem, DockingWindowManager mgr, Node parent,
|
||||||
List<ComponentPlaceholder> restoredPlaceholders) {
|
List<ComponentPlaceholder> restoredPlaceholders) {
|
||||||
|
@ -90,13 +95,10 @@ class ComponentNode extends Node {
|
||||||
group = ComponentProvider.DEFAULT_WINDOW_GROUP;
|
group = ComponentProvider.DEFAULT_WINDOW_GROUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
// SCR #4120 - Ignore old, buggy child nodes that had too long titles. This
|
// TODO remove this in a few major releases after 9.1; this prevents existing tools
|
||||||
// will cleanup slow loading XML project files.
|
// from losing layout positioning information due to a recent rename
|
||||||
if (name.length() > 100) {
|
if (OLD_LISTING_NAME.equals(name)) {
|
||||||
name = name.substring(0, 100);
|
name = NEW_LISTING_NAME;
|
||||||
}
|
|
||||||
if (title.length() > 100) {
|
|
||||||
title = title.substring(0, 100);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isActive = Boolean.valueOf(e.getAttributeValue("ACTIVE")).booleanValue();
|
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() {
|
int getComponentCount() {
|
||||||
return windowPlaceholders.size();
|
return windowPlaceholders.size();
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,14 +30,17 @@ public class JavaClassUtil {
|
||||||
|
|
||||||
public final static boolean isClassFile(Program program) {
|
public final static boolean isClassFile(Program program) {
|
||||||
|
|
||||||
|
AddressFactory factory = program.getAddressFactory();
|
||||||
byte[] bytes = new byte[4];
|
byte[] bytes = new byte[4];
|
||||||
try {
|
try {
|
||||||
Address address = program.getAddressFactory().getAddressSpace(
|
AddressSpace space = factory.getAddressSpace(JavaLoader.CONSTANT_POOL);
|
||||||
JavaLoader.CONSTANT_POOL).getMinAddress();
|
if (space != null) {
|
||||||
|
Address address = space.getMinAddress();
|
||||||
program.getMemory().getBytes(address, bytes);
|
program.getMemory().getBytes(address, bytes);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
Msg.info(JavaClassUtil.class, e.getLocalizedMessage());
|
Msg.error(JavaClassUtil.class, "Exception reading program bytes: " + e.getMessage(), e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return Arrays.equals(bytes, JavaClassConstants.MAGIC_BYTES);
|
return Arrays.equals(bytes, JavaClassConstants.MAGIC_BYTES);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue