Merge remote-tracking branch 'origin/GP-6213_ryanmkurtz_envvar'

This commit is contained in:
Ryan Kurtz
2026-01-06 04:43:29 -05:00
13 changed files with 135 additions and 56 deletions

View File

@@ -4,9 +4,16 @@
# Ghidra launch
#----------------------------------------
# Maximum heap memory may be changed if default is inadequate. This will generally be up to 1/4 of
# the physical memory available to the OS. Uncomment MAXMEM setting if non-default value is needed.
#MAXMEM=2G
# Optionally override the default Java heap memory, which is typically 1/4 of system RAM.
# Supported values are of the regular expression form "\d+[gGmMkK]", allowing the value to be
# specified in gigabytes, megabytes, or kilobytes (for example: 8G, 4096m, etc).
MAXMEM_DEFAULT=
# Allow the above MAXMEM_DEFAULT to be overridden by externally set environment variables
# - GHIDRA_MAXMEM: Desired maximum heap memory for all Ghidra instances
# - GHIDRA_GUI_MAXMEM: Desired maximum heap memory only for Ghidra GUI instances
GHIDRA_MAXMEM=${GHIDRA_MAXMEM:=${MAXMEM_DEFAULT}}
GHIDRA_GUI_MAXMEM=${GHIDRA_GUI_MAXMEM:=${GHIDRA_MAXMEM}}
# Resolve symbolic link if present and get the directory this script lives in.
# NOTE: "readlink -f" is best but works on Linux only, "readlink" will only work if your PWD
@@ -16,4 +23,4 @@ SCRIPT_FILE="$(readlink -f "$0" 2>/dev/null || readlink "$0" 2>/dev/null || echo
SCRIPT_DIR="${SCRIPT_FILE%/*}"
# Launch Ghidra
"${SCRIPT_DIR}"/support/launch.sh bg jdk Ghidra "${MAXMEM}" "" ghidra.GhidraRun "$@"
"${SCRIPT_DIR}"/support/launch.sh bg jdk Ghidra "${GHIDRA_GUI_MAXMEM}" "" ghidra.GhidraRun "$@"

View File

@@ -4,9 +4,17 @@
# Ghidra Headless Analyzer launch (see analyzeHeadlessREADME.html)
#----------------------------------------------------------------------
# Maximum heap memory may be changed if default is inadequate. This will generally be up to 1/4 of
# the physical memory available to the OS. Uncomment MAXMEM setting if non-default value is needed.
MAXMEM=2G
# Optionally override the default Java heap memory, which is typically 1/4 of system RAM.
# Supported values are of the regular expression form "\d+[gGmMkK]", allowing the value to be
# specified in gigabytes, megabytes, or kilobytes (for example: 8G, 4096m, etc).
# We override the default for headless in case users spin up many headless instances in parallel.
MAXMEM_DEFAULT=2G
# Allow the above MAXMEM_DEFAULT to be overridden by externally set environment variables
# - GHIDRA_MAXMEM: Desired maximum heap memory for all Ghidra instances
# - GHIDRA_HEADLESS_MAXMEM: Desired maximum heap memory only for headless Ghidra instances
GHIDRA_MAXMEM=${GHIDRA_MAXMEM:=${MAXMEM_DEFAULT}}
GHIDRA_HEADLESS_MAXMEM=${GHIDRA_HEADLESS_MAXMEM:=${GHIDRA_MAXMEM}}
# Launch mode can be changed to one of the following: fg, debug, debug-suspend
LAUNCH_MODE=fg
@@ -29,4 +37,4 @@ SCRIPT_DIR="${SCRIPT_FILE%/*}"
# Launch HeadlessAnalyzer.
# DEBUG_ADDRESS set via environment for launch.sh
DEBUG_ADDRESS=${DEBUG_ADDRESS} "${SCRIPT_DIR}"/launch.sh "${LAUNCH_MODE}" jdk Ghidra-Headless "${MAXMEM}" "${VMARG_LIST}" ghidra.app.util.headless.AnalyzeHeadless "$@"
DEBUG_ADDRESS=${DEBUG_ADDRESS} "${SCRIPT_DIR}"/launch.sh "${LAUNCH_MODE}" jdk Ghidra-Headless "${GHIDRA_HEADLESS_MAXMEM}" "${VMARG_LIST}" ghidra.app.util.headless.AnalyzeHeadless "$@"

View File

@@ -2,9 +2,16 @@
#
# Command-line script for interacting with a BSim database
# Maximum heap memory may be changed if default is inadequate. This will generally be up to 1/4 of
# the physical memory available to the OS. Uncomment MAXMEM setting if non-default value is needed.
#MAXMEM=2G
# Optionally override the default Java heap memory, which is typically 1/4 of system RAM.
# Supported values are of the regular expression form "\d+[gGmMkK]", allowing the value to be
# specified in gigabytes, megabytes, or kilobytes (for example: 8G, 4096m, etc).
MAXMEM_DEFAULT=
# Allow the above MAXMEM_DEFAULT to be overridden by externally set environment variables
# - GHIDRA_MAXMEM: Desired maximum heap memory for all Ghidra instances
# - GHIDRA_BSIM_MAXMEM: Desired maximum heap memory only for Ghidra BSim instances
GHIDRA_MAXMEM=${GHIDRA_MAXMEM:=${MAXMEM_DEFAULT}}
GHIDRA_BSIM_MAXMEM=${GHIDRA_BSIM_MAXMEM:=${GHIDRA_MAXMEM}}
# launch mode (fg, bg, debug, debug-suspend)
LAUNCH_MODE=fg
@@ -18,4 +25,4 @@ VMARG_LIST="-Djava.awt.headless=true "
SCRIPT_FILE="$(readlink -f "$0" 2>/dev/null || readlink "$0" 2>/dev/null || echo "$0")"
SCRIPT_DIR="${SCRIPT_FILE%/*}"
${SCRIPT_DIR}/launch.sh $LAUNCH_MODE jdk "BSim" "${MAXMEM}" "${VMARG_LIST}" ghidra.features.bsim.query.ingest.BSimLaunchable "$@"
${SCRIPT_DIR}/launch.sh $LAUNCH_MODE jdk "BSim" "${GHIDRA_BSIM_MAXMEM}" "${VMARG_LIST}" ghidra.features.bsim.query.ingest.BSimLaunchable "$@"

View File

@@ -4,9 +4,16 @@
# Ghidra debug launch
#----------------------------------------
# Maximum heap memory may be changed if default is inadequate. This will generally be up to 1/4 of
# the physical memory available to the OS. Uncomment MAXMEM setting if non-default value is needed.
#MAXMEM=2G
# Optionally override the default Java heap memory, which is typically 1/4 of system RAM.
# Supported values are of the regular expression form "\d+[gGmMkK]", allowing the value to be
# specified in gigabytes, megabytes, or kilobytes (for example: 8G, 4096m, etc).
MAXMEM_DEFAULT=
# Allow the above MAXMEM_DEFAULT to be overridden by externally set environment variables
# - GHIDRA_MAXMEM: Desired maximum heap memory for all Ghidra instances
# - GHIDRA_GUI_MAXMEM: Desired maximum heap memory only for Ghidra GUI instances
GHIDRA_MAXMEM=${GHIDRA_MAXMEM:=${MAXMEM_DEFAULT}}
GHIDRA_GUI_MAXMEM=${GHIDRA_GUI_MAXMEM:=${GHIDRA_MAXMEM}}
# Debug launch mode can be changed to one of the following: debug, debug-suspend
LAUNCH_MODE=debug
@@ -24,4 +31,4 @@ SCRIPT_DIR="${SCRIPT_FILE%/*}"
# Launch Ghidra in debug mode
# DEBUG_ADDRESS set via environment for launch.sh
DEBUG_ADDRESS=${DEBUG_ADDRESS} "${SCRIPT_DIR}"/launch.sh "${LAUNCH_MODE}" jdk Ghidra "${MAXMEM}" "" ghidra.GhidraRun "$@"
DEBUG_ADDRESS=${DEBUG_ADDRESS} "${SCRIPT_DIR}"/launch.sh "${LAUNCH_MODE}" jdk Ghidra "${GHIDRA_GUI_MAXMEM}" "" ghidra.GhidraRun "$@"

View File

@@ -4,9 +4,16 @@
# Ghidra JShell launch
#----------------------------------------
# Maximum heap memory may be changed if default is inadequate. This will generally be up to 1/4 of
# the physical memory available to the OS. Uncomment MAXMEM setting if non-default value is needed.
#MAXMEM=2G
# Optionally override the default Java heap memory, which is typically 1/4 of system RAM.
# Supported values are of the regular expression form "\d+[gGmMkK]", allowing the value to be
# specified in gigabytes, megabytes, or kilobytes (for example: 8G, 4096m, etc).
MAXMEM_DEFAULT=
# Allow the above MAXMEM_DEFAULT to be overridden by externally set environment variables
# - GHIDRA_MAXMEM: Desired maximum heap memory for all Ghidra instances
# - GHIDRA_JSHELL_MAXMEM: Desired maximum heap memory only for Ghidra JShell instances
GHIDRA_MAXMEM=${GHIDRA_MAXMEM:=${MAXMEM_DEFAULT}}
GHIDRA_JSHELL_MAXMEM=${GHIDRA_JSHELL_MAXMEM:=${GHIDRA_MAXMEM}}
# Resolve symbolic link if present and get the directory this script lives in.
# NOTE: "readlink -f" is best but works on Linux only, "readlink" will only work if your PWD
@@ -16,4 +23,4 @@ SCRIPT_FILE="$(readlink -f "$0" 2>/dev/null || readlink "$0" 2>/dev/null || echo
SCRIPT_DIR="${SCRIPT_FILE%/*}"
# Launch Ghidra
"${SCRIPT_DIR}"/launch.sh fg jdk Ghidra-JShell "${MAXMEM}" "" ghidra.JShellRun "$@"
"${SCRIPT_DIR}"/launch.sh fg jdk Ghidra-JShell "${GHIDRA_JSHELL_MAXMEM}" "" ghidra.JShellRun "$@"

View File

@@ -4,9 +4,16 @@
# Ghidra Jython launch
#----------------------------------------
# Maximum heap memory may be changed if default is inadequate. This will generally be up to 1/4 of
# the physical memory available to the OS. Uncomment MAXMEM setting if non-default value is needed.
#MAXMEM=2G
# Optionally override the default Java heap memory, which is typically 1/4 of system RAM.
# Supported values are of the regular expression form "\d+[gGmMkK]", allowing the value to be
# specified in gigabytes, megabytes, or kilobytes (for example: 8G, 4096m, etc).
MAXMEM_DEFAULT=
# Allow the above MAXMEM_DEFAULT to be overridden by externally set environment variables
# - GHIDRA_MAXMEM: Desired maximum heap memory for all Ghidra instances
# - GHIDRA_JYTHON_MAXMEM: Desired maximum heap memory only for Ghidra Jython instances
GHIDRA_MAXMEM=${GHIDRA_MAXMEM:=${MAXMEM_DEFAULT}}
GHIDRA_JYTHON_MAXMEM=${GHIDRA_JYTHON_MAXMEM:=${GHIDRA_MAXMEM}}
# Launch mode can be changed to one of the following: fg, debug, debug-suspend
LAUNCH_MODE=fg
@@ -33,4 +40,4 @@ SCRIPT_DIR="${SCRIPT_FILE%/*}"
# Launch Ghidra Jython
# DEBUG_ADDRESS set via environment for launch.sh
DEBUG_ADDRESS=${DEBUG_ADDRESS} "${SCRIPT_DIR}"/launch.sh "${LAUNCH_MODE}" jdk "Ghidra-Jython" "${MAXMEM}" "${VMARG_LIST}" ghidra.jython.JythonRun "$@"
DEBUG_ADDRESS=${DEBUG_ADDRESS} "${SCRIPT_DIR}"/launch.sh "${LAUNCH_MODE}" jdk "Ghidra-Jython" "${GHIDRA_JYTHON_MAXMEM}" "${VMARG_LIST}" ghidra.jython.JythonRun "$@"

View File

@@ -18,9 +18,16 @@
@echo off
setlocal
:: Maximum heap memory may be changed if default is inadequate. This will generally be up to 1/4 of
:: the physical memory available to the OS. Uncomment MAXMEM setting if non-default value is needed.
::set MAXMEM=2G
:: Optionally override the default Java heap memory, which is typically 1/4 of system RAM.
:: Supported values are of the regular expression form "\d+[gGmMkK]", allowing the value to be
:: specified in gigabytes, megabytes, or kilobytes (for example: 8G, 4096m, etc).
set MAXMEM_DEFAULT=
call "%~dp0support\launch.bat" bg jdk Ghidra "%MAXMEM%" "" ghidra.GhidraRun %*
:: Allow the above MAXMEM_DEFAULT to be overridden by externally set environment variables
:: - GHIDRA_MAXMEM: Desired maximum heap memory for all Ghidra instances
:: - GHIDRA_GUI_MAXMEM: Desired maximum heap memory only for Ghidra GUI instances
if not defined GHIDRA_MAXMEM set "GHIDRA_MAXMEM=%MAXMEM_DEFAULT%"
if not defined GHIDRA_GUI_MAXMEM set "GHIDRA_GUI_MAXMEM=%GHIDRA_MAXMEM%"
call "%~dp0support\launch.bat" bg jdk Ghidra "%GHIDRA_GUI_MAXMEM%" "" ghidra.GhidraRun %*

View File

@@ -18,10 +18,17 @@
@echo off
setlocal
:: Maximum heap memory size. For headless, it is recommended to not use the default value
:: because garbage collection could take too long on systems with a large amount of physical
:: memory.
set MAXMEM=2G
:: Optionally override the default Java heap memory, which is typically 1/4 of system RAM.
:: Supported values are of the regular expression form "\d+[gGmMkK]", allowing the value to be
:: specified in gigabytes, megabytes, or kilobytes (for example: 8G, 4096m, etc).
:: We override the default for headless in case users spin up many headless instances in parallel.
set MAXMEM_DEFAULT=2G
:: Allow the above MAXMEM_DEFAULT to be overridden by externally set environment variables
:: - GHIDRA_MAXMEM: Desired maximum heap memory for all Ghidra instances
:: - GHIDRA_HEADLESS_MAXMEM: Desired maximum heap memory only for headless Ghidra instances
if not defined GHIDRA_MAXMEM set "GHIDRA_MAXMEM=%MAXMEM_DEFAULT%"
if not defined GHIDRA_HEADLESS_MAXMEM set "GHIDRA_HEADLESS_MAXMEM=%GHIDRA_MAXMEM%"
:: Launch mode can be changed to one of the following:
:: fg, debug, debug-suspend
@@ -67,4 +74,4 @@ goto Loop
setlocal DisableDelayedExpansion
call "%SCRIPT_DIR%launch.bat" %LAUNCH_MODE% jdk Ghidra-Headless "%MAXMEM%" "%VMARG_LIST%" ghidra.app.util.headless.AnalyzeHeadless %params%
call "%SCRIPT_DIR%launch.bat" %LAUNCH_MODE% jdk Ghidra-Headless "%GHIDRA_HEADLESS_MAXMEM%" "%VMARG_LIST%" ghidra.app.util.headless.AnalyzeHeadless %params%

View File

@@ -18,9 +18,16 @@
@echo off
setlocal
:: Maximum heap memory may be changed if default is inadequate. This will generally be up to 1/4 of
:: the physical memory available to the OS. Uncomment MAXMEM setting if non-default value is needed.
::set MAXMEM=2G
:: Optionally override the default Java heap memory, which is typically 1/4 of system RAM.
:: Supported values are of the regular expression form "\d+[gGmMkK]", allowing the value to be
:: specified in gigabytes, megabytes, or kilobytes (for example: 8G, 4096m, etc).
set MAXMEM_DEFAULT=
:: Allow the above MAXMEM_DEFAULT to be overridden by externally set environment variables
:: - GHIDRA_MAXMEM: Desired maximum heap memory for all Ghidra instances
:: - GHIDRA_BSIM_MAXMEM: Desired maximum heap memory only for Ghidra BSim instances
if not defined GHIDRA_MAXMEM set "GHIDRA_MAXMEM=%MAXMEM_DEFAULT%"
if not defined GHIDRA_BSIM_MAXMEM set "GHIDRA_BSIM_MAXMEM=%GHIDRA_MAXMEM%"
:: launch mode (fg, bg, debug, debug-suspend)
set LAUNCH_MODE=fg
@@ -35,4 +42,4 @@ set LAUNCH_MODE=fg
set "LAUNCH_DIR=%~dp0"
set "LAUNCH_DIR=%LAUNCH_DIR:~0,-1%"
call "%LAUNCH_DIR%\launch.bat" %LAUNCH_MODE% jdk BSim "%MAXMEM%" "" ghidra.features.bsim.query.ingest.BSimLaunchable %*
call "%LAUNCH_DIR%\launch.bat" %LAUNCH_MODE% jdk BSim "%GHIDRA_BSIM_MAXMEM%" "" ghidra.features.bsim.query.ingest.BSimLaunchable %*

View File

@@ -18,9 +18,16 @@
@echo off
setlocal
:: Maximum heap memory may be changed if default is inadequate. This will generally be up to 1/4 of
:: the physical memory available to the OS. Uncomment MAXMEM setting if non-default value is needed.
::set MAXMEM=2G
:: Optionally override the default Java heap memory, which is typically 1/4 of system RAM.
:: Supported values are of the regular expression form "\d+[gGmMkK]", allowing the value to be
:: specified in gigabytes, megabytes, or kilobytes (for example: 8G, 4096m, etc).
set MAXMEM_DEFAULT=
:: Allow the above MAXMEM_DEFAULT to be overridden by externally set environment variables
:: - GHIDRA_MAXMEM: Desired maximum heap memory for all Ghidra instances
:: - GHIDRA_GUI_MAXMEM: Desired maximum heap memory only for Ghidra GUI instances
if not defined GHIDRA_MAXMEM set "GHIDRA_MAXMEM=%MAXMEM_DEFAULT%"
if not defined GHIDRA_GUI_MAXMEM set "GHIDRA_GUI_MAXMEM=%GHIDRA_MAXMEM%"
:: Debug launch mode can be changed to one of the following:
:: debug, debug-suspend
@@ -30,4 +37,4 @@ set LAUNCH_MODE=debug
:: NOTE: This variable is ignored if not launching in a debugging mode.
set DEBUG_ADDRESS=127.0.0.1:18001
call "%~dp0launch.bat" %LAUNCH_MODE% jdk Ghidra "%MAXMEM%" "" ghidra.GhidraRun %*
call "%~dp0launch.bat" %LAUNCH_MODE% jdk Ghidra "%GHIDRA_GUI_MAXMEM%" "" ghidra.GhidraRun %*

View File

@@ -18,9 +18,16 @@
@echo off
setlocal
:: Maximum heap memory may be changed if default is inadequate. This will generally be up to 1/4 of
:: the physical memory available to the OS. Uncomment MAXMEM setting if non-default value is needed.
::set MAXMEM=2G
:: Optionally override the default Java heap memory, which is typically 1/4 of system RAM.
:: Supported values are of the regular expression form "\d+[gGmMkK]", allowing the value to be
:: specified in gigabytes, megabytes, or kilobytes (for example: 8G, 4096m, etc).
set MAXMEM_DEFAULT=
call "%~dp0launch.bat" fg jdk Ghidra-JShell "%MAXMEM%" "" ghidra.JShellRun %*
:: Allow the above MAXMEM_DEFAULT to be overridden by externally set environment variables
:: - GHIDRA_MAXMEM: Desired maximum heap memory for all Ghidra instances
:: - GHIDRA_JSHELL_MAXMEM: Desired maximum heap memory only for JShell Ghidra instances
if not defined GHIDRA_MAXMEM set "GHIDRA_MAXMEM=%MAXMEM_DEFAULT%"
if not defined GHIDRA_JSHELL_MAXMEM set "GHIDRA_JSHELL_MAXMEM=%GHIDRA_MAXMEM%"
call "%~dp0launch.bat" fg jdk Ghidra-JShell "%GHIDRA_JSHELL_MAXMEM%" "" ghidra.JShellRun %*

View File

@@ -18,12 +18,16 @@
@echo off
setlocal
:: Maximum heap memory size
:: Default for Windows 32-bit is 768M and 64-bit is 1024M
:: Raising the value too high may cause a silent failure where
:: Ghidra fails to launch.
:: Uncomment MAXMEM setting if non-default value is needed
::set MAXMEM=768M
:: Optionally override the default Java heap memory, which is typically 1/4 of system RAM.
:: Supported values are of the regular expression form "\d+[gGmMkK]", allowing the value to be
:: specified in gigabytes, megabytes, or kilobytes (for example: 8G, 4096m, etc).
set MAXMEM_DEFAULT=
:: Allow the above MAXMEM_DEFAULT to be overridden by externally set environment variables
:: - GHIDRA_MAXMEM: Desired maximum heap memory for all Ghidra instances
:: - GHIDRA_JYTHON_MAXMEM: Desired maximum heap memory only for Ghidra Jython instances
if not defined GHIDRA_MAXMEM set "GHIDRA_MAXMEM=%MAXMEM_DEFAULT%"
if not defined GHIDRA_JYTHON_MAXMEM set "GHIDRA_JYTHON_MAXMEM=%GHIDRA_MAXMEM%"
:: Launch mode can be changed to one of the following:
:: fg, debug, debug-suspend
@@ -39,4 +43,4 @@ set DEBUG_ADDRESS=127.0.0.1:13002
set VMARG_LIST=-XX:ParallelGCThreads=2
set VMARG_LIST=%VMARG_LIST% -XX:CICompilerCount=2
call "%~dp0launch.bat" %LAUNCH_MODE% jdk Ghidra-Jython "%MAXMEM%" "%VMARG_LIST%" ghidra.jython.JythonRun %*
call "%~dp0launch.bat" %LAUNCH_MODE% jdk Ghidra-Jython "%GHIDRA_JYTHON_MAXMEM%" "%VMARG_LIST%" ghidra.jython.JythonRun %*

View File

@@ -18,7 +18,4 @@
@echo off
setlocal
:: maximum heap memory may be change if inadequate
set MAXMEM=256M
call "%~dp0launch.bat" fg jdk Sleigh "%MAXMEM%" "" ghidra.pcodeCPort.slgh_compile.SleighCompileLauncher %*
call "%~dp0launch.bat" fg jdk Sleigh "" "" ghidra.pcodeCPort.slgh_compile.SleighCompileLauncher %*