mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 10:49:34 +02:00
GT-2913: launch.properties can now take platform-specific VMARGS.
This commit is contained in:
parent
8c689a0099
commit
fa20ba3762
7 changed files with 87 additions and 75 deletions
|
@ -41,12 +41,7 @@ public abstract class AbstractGCellRenderer extends GDHtmlLabel {
|
||||||
protected static boolean systemAlternateRowColors = getAlternateRowColors();
|
protected static boolean systemAlternateRowColors = getAlternateRowColors();
|
||||||
|
|
||||||
private static boolean getAlternateRowColors() {
|
private static boolean getAlternateRowColors() {
|
||||||
String disable = System.getProperty(DISABLE_ALTERNATING_ROW_COLORS_PROPERTY);
|
return !Boolean.getBoolean(DISABLE_ALTERNATING_ROW_COLORS_PROPERTY);
|
||||||
if (disable == null) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return !Boolean.parseBoolean(disable);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final Border focusBorder;
|
protected final Border focusBorder;
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
/* ###
|
/* ###
|
||||||
* IP: GHIDRA
|
* IP: GHIDRA
|
||||||
* REVIEWED: YES
|
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -22,11 +21,7 @@ import net.sf.cglib.proxy.Enhancer;
|
||||||
|
|
||||||
public class ContinuesFactory implements GenericFactory {
|
public class ContinuesFactory implements GenericFactory {
|
||||||
|
|
||||||
private static final String CONTINUES_INTERCEPTOR_DISABLED_PROPERTY =
|
private static final boolean disabled = Boolean.getBoolean("ContinuesInterceptor.disabled");
|
||||||
"ContinuesInterceptor.disabled";
|
|
||||||
|
|
||||||
private static final boolean disabled =
|
|
||||||
System.getProperty(CONTINUES_INTERCEPTOR_DISABLED_PROPERTY) != null;
|
|
||||||
|
|
||||||
private ExceptionHandler exceptionHandler;
|
private ExceptionHandler exceptionHandler;
|
||||||
|
|
||||||
|
|
|
@ -137,8 +137,8 @@ public class ApplicationUtilities {
|
||||||
throws FileNotFoundException {
|
throws FileNotFoundException {
|
||||||
|
|
||||||
// Look for preset cache directory
|
// Look for preset cache directory
|
||||||
String cachedir = System.getProperty("application.cachedir");
|
String cachedir = System.getProperty("application.cachedir", "").trim();
|
||||||
if (cachedir != null && !cachedir.isEmpty()) {
|
if (!cachedir.isEmpty()) {
|
||||||
return new File(cachedir,
|
return new File(cachedir,
|
||||||
SystemUtilities.getUserName() + "-" + applicationProperties.getApplicationName());
|
SystemUtilities.getUserName() + "-" + applicationProperties.getApplicationName());
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,20 +15,14 @@ VMARGS=-Duser.country=US
|
||||||
VMARGS=-Duser.language=en
|
VMARGS=-Duser.language=en
|
||||||
VMARGS=-Duser.variant=
|
VMARGS=-Duser.variant=
|
||||||
|
|
||||||
# The following two options increase rendering performance when using
|
|
||||||
# anti-aliasing/transparency/transforms. If you experience any trouble
|
|
||||||
# rendering Ghidra, try toggling these values
|
|
||||||
|
|
||||||
# The following options affect rendering on different platforms. It may be necessary to play
|
# The following options affect rendering on different platforms. It may be necessary to play
|
||||||
# with these settings to get Ghidra to display and perform optimally on HiDPI monitors or in VM's.
|
# with these settings to get Ghidra to display and perform optimally on HiDPI monitors or in VM's.
|
||||||
# - All platforms
|
|
||||||
VMARGS=-Dsun.java2d.opengl=false
|
VMARGS=-Dsun.java2d.opengl=false
|
||||||
VMARGS=-Dsun.java2d.uiScale=1
|
VMARGS=-Dsun.java2d.uiScale=1
|
||||||
# - Linux
|
VMARGS_LINUX=-Dsun.java2d.pmoffscreen=false
|
||||||
VMARGS=-Dsun.java2d.pmoffscreen=false
|
VMARGS_LINUX=-Dsun.java2d.xrender=true
|
||||||
VMARGS=-Dsun.java2d.xrender=true
|
VMARGS_LINUX=-Dawt.useSystemAAFontSettings=on
|
||||||
# - Windows
|
VMARGS_WINDOWS=-Dsun.java2d.d3d=false
|
||||||
VMARGS=-Dsun.java2d.d3d=false
|
|
||||||
|
|
||||||
# Set acceptable HTTPS protocols
|
# Set acceptable HTTPS protocols
|
||||||
VMARGS=-Dhttps.protocols=TLSv1,TLSv1.1,TLSv1.2
|
VMARGS=-Dhttps.protocols=TLSv1,TLSv1.1,TLSv1.2
|
||||||
|
@ -52,31 +46,34 @@ VMARGS=-Dcpu.core.override=
|
||||||
# Default font size for many java swing elements.
|
# Default font size for many java swing elements.
|
||||||
VMARGS=-Dfont.size.override=
|
VMARGS=-Dfont.size.override=
|
||||||
|
|
||||||
# Temporary directory used by the application. This directory will be used for
|
# Eclipse on macOS can have file locking issues if the user home directory is networked. Therefore,
|
||||||
# all temporary files and may also be used for the persistent user cache
|
# we will disable file locking by default for macOS. Comment the following line out if Eclipse file
|
||||||
# directory <java.io.tmpdir>/<username>-Ghidra. The specified directory must
|
# locking is needed and known to work.
|
||||||
# exist and have appropriate read/write/execute permissions
|
VMARGS_MACOS=-Declipse.filelock.disable=true
|
||||||
#VMARGS=-Djava.io.tmpdir=
|
|
||||||
|
|
||||||
# Persistent cache directory used by the application. This directory will be
|
# Where the menu bar is displayed on macOS
|
||||||
# used to store persistent application caches for all users. The default
|
VMARGS_MACOS=-Dapple.laf.useScreenMenuBar=false
|
||||||
# location for Mac/Linux is the same as specified by java.io.tmpdir property.
|
|
||||||
# The default location for Windows corresponds to the application local
|
# Prevent log4j from using the Jansi DLL on Windows.
|
||||||
# settings directory for the user (e.g., %LOCALAPPDATA%). If you wish to use a
|
VMARGS_WINDOWS=-Dlog4j.skipJansi=true
|
||||||
# directory with more storage or avoid system cleanups, it may be desirable to
|
|
||||||
# override the default location.
|
# Persistent cache directory used by the application. This directory will be used to store
|
||||||
|
# persistent application caches for all users. The default location for Mac/Linux is the same as
|
||||||
|
# specified by java.io.tmpdir property. The default location for Windows corresponds to the
|
||||||
|
# application local settings directory for the user (e.g., %LOCALAPPDATA%). If you wish to use a
|
||||||
|
# directory with more storage or avoid system cleanups, it may be desirable to override the default
|
||||||
|
# location.
|
||||||
#VMARGS=-Dapplication.cachedir=
|
#VMARGS=-Dapplication.cachedir=
|
||||||
|
|
||||||
|
# Temporary directory used by the application. This directory will be used for all temporary files
|
||||||
|
# and may also be used for the persistent user cache directory <java.io.tmpdir>/<username>-Ghidra.
|
||||||
|
# The specified directory must exist and have appropriate read/write/execute permissions
|
||||||
|
#VMARGS=-Djava.io.tmpdir=
|
||||||
|
|
||||||
# Disable alternating row colors in tables
|
# Disable alternating row colors in tables
|
||||||
#VMARGS=-Ddisable.alternating.row.colors=true
|
#VMARGS=-Ddisable.alternating.row.colors=true
|
||||||
|
|
||||||
# Hoist the menu bar out of the window on macOS
|
|
||||||
#VMARGS=-Dapple.laf.useScreenMenuBar=true
|
|
||||||
|
|
||||||
# The ContinuesInterceptor allows the import process to proceed if parsing corrupted headers
|
# The ContinuesInterceptor allows the import process to proceed if parsing corrupted headers
|
||||||
# generates uncaught exceptions. Disabling it can be helpful when trying to debug what went
|
# generates uncaught exceptions. Disabling it can be helpful when trying to debug what went
|
||||||
# wrong because the ContinuesIntercepter affects the usefulness of the stack trace.
|
# wrong because the ContinuesIntercepter affects the usefulness of the stack trace.
|
||||||
#VMARGS=-DContinuesInterceptor.disabled
|
#VMARGS=-DContinuesInterceptor.disabled=true
|
||||||
|
|
||||||
# Prevent log4j from using the Jansi DLL on Windows.
|
|
||||||
VMARGS=-Dlog4j.skipJansi=true
|
|
||||||
|
|
|
@ -116,17 +116,6 @@ VMARG_LIST+=" $(java -cp "${LS_CPATH}" LaunchSupport "${INSTALL_DIR}" -vmargs)"
|
||||||
# Add extra macOS VM arguments
|
# Add extra macOS VM arguments
|
||||||
if [ "$(uname -s)" = "Darwin" ]; then
|
if [ "$(uname -s)" = "Darwin" ]; then
|
||||||
VMARG_LIST+=" -Xdock:name=${APPNAME}"
|
VMARG_LIST+=" -Xdock:name=${APPNAME}"
|
||||||
VMARG_LIST+=" -Xdock:icon=\"${INSTALL_DIR}/Ghidra/Features/Base/os/osx64/ghidra.icns\""
|
|
||||||
|
|
||||||
# Eclipse on macOS (Darwin) can have file locking issues if the user home directory is
|
|
||||||
# networked. Therefore, we will disable file locking by default for macOS. Comment the
|
|
||||||
# following line out if Eclipse file locking is needed and known to work.
|
|
||||||
VMARG_LIST+=" -Declipse.filelock.disable=true"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Add extra Linux VM arguments
|
|
||||||
if [ "$(uname -s)" = "Linux" ]; then
|
|
||||||
VMARG_LIST+=" -Dawt.useSystemAAFontSettings=on"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set Max Heap Size if specified
|
# Set Max Heap Size if specified
|
||||||
|
|
|
@ -33,23 +33,46 @@ public abstract class JavaFinder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a Java finder to use for the current OS.
|
* The different supported platforms (operating systems).
|
||||||
|
*/
|
||||||
|
public enum Platform {
|
||||||
|
WINDOWS, MACOS, LINUX;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the current {@link Platform}.
|
||||||
*
|
*
|
||||||
* @return The Java finder to use for the current OS.
|
* @return The current {@link Platform}
|
||||||
|
*/
|
||||||
|
public static Platform getCurrentPlatform() {
|
||||||
|
String os = System.getProperty("os.name");
|
||||||
|
if (os != null) {
|
||||||
|
os = os.toLowerCase();
|
||||||
|
if (os.contains("win")) {
|
||||||
|
return Platform.WINDOWS;
|
||||||
|
}
|
||||||
|
if (os.contains("mac")) {
|
||||||
|
return Platform.MACOS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Platform.LINUX;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a Java finder to use for the current {@link Platform platform}.
|
||||||
|
*
|
||||||
|
* @return The Java finder to use for the current {@link Platform platform}
|
||||||
*/
|
*/
|
||||||
public static JavaFinder create() {
|
public static JavaFinder create() {
|
||||||
JavaFinder javaFinder;
|
switch (getCurrentPlatform()) {
|
||||||
String os = System.getProperty("os.name").toLowerCase();
|
case WINDOWS:
|
||||||
if (os != null && os.contains("win")) {
|
return new WindowsJavaFinder();
|
||||||
javaFinder = new WindowsJavaFinder();
|
case MACOS:
|
||||||
|
return new MacJavaFinder();
|
||||||
|
case LINUX:
|
||||||
|
default:
|
||||||
|
return new LinuxJavaFinder();
|
||||||
}
|
}
|
||||||
else if (os != null && os.contains("mac")) {
|
|
||||||
javaFinder = new MacJavaFinder();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
javaFinder = new LinuxJavaFinder();
|
|
||||||
}
|
|
||||||
return javaFinder;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -19,6 +19,8 @@ import java.io.*;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import ghidra.launch.JavaFinder.Platform;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses and provides convenient access to the properties defined in a launch properties file.
|
* Parses and provides convenient access to the properties defined in a launch properties file.
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -34,10 +36,15 @@ public class LaunchProperties {
|
||||||
public static String JAVA_HOME_OVERRIDE = "JAVA_HOME_OVERRIDE";
|
public static String JAVA_HOME_OVERRIDE = "JAVA_HOME_OVERRIDE";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The VM arguments to use to launch.
|
* The VM arguments to use to launch (all platforms).
|
||||||
*/
|
*/
|
||||||
public static String VMARGS = "VMARGS";
|
public static String VMARGS = "VMARGS";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The VM arguments to use to launch (current platform only).
|
||||||
|
*/
|
||||||
|
public static String VMARGS_PLATFORM = "VMARGS_" + JavaFinder.getCurrentPlatform();
|
||||||
|
|
||||||
private Map<String, List<String>> propertyMap;
|
private Map<String, List<String>> propertyMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -68,12 +75,11 @@ public class LaunchProperties {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the command line string of VM arguments to use for the launch.
|
* Gets the command line string of VM arguments to use for the launch for the current
|
||||||
* This will be the union of all VM arguments defined in both the user and installation launch
|
* {@link Platform platform}.
|
||||||
* properties. If conflicting VM arguments are defined in both files, the user version
|
|
||||||
* will override the installation version.
|
|
||||||
*
|
*
|
||||||
* @return The command line string of VM arguments to use for the launch.
|
* @return The command line string of VM arguments to use for the launch for the current
|
||||||
|
* {@link Platform}
|
||||||
*/
|
*/
|
||||||
public String getVmArgs() {
|
public String getVmArgs() {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
@ -84,6 +90,13 @@ public class LaunchProperties {
|
||||||
sb.append(" ");
|
sb.append(" ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
List<String> vmargPlatformList = propertyMap.get(VMARGS_PLATFORM);
|
||||||
|
if (vmargPlatformList != null) {
|
||||||
|
for (String arg : vmargPlatformList) {
|
||||||
|
sb.append(arg);
|
||||||
|
sb.append(" ");
|
||||||
|
}
|
||||||
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue