Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

print environment details upon stack trace #101

Merged
merged 5 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions data/python/jepeval.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ def _jepeval(line):
# in the Ghidra console window
import traceback

import jeputils

traceback.print_exc()
jeputils.log_env_details(err)

return more_input_needed
3 changes: 3 additions & 0 deletions data/python/jeprunscript.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,7 @@ def jep_runscript(path):
# messages in the Ghidra console window
import traceback

import jeputils

traceback.print_exc()
jeputils.log_env_details(err)
23 changes: 23 additions & 0 deletions data/python/jeputils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import sys
import platform

import jep
import ghidrathon
from java.lang import System

ALLOWED_EXCEPTIONS = (RuntimeError, OSError)


def log_env_details(exc):
exc_type = type(exc)
if issubclass(exc_type, ALLOWED_EXCEPTIONS):
print(
f"Python={platform.python_version()}, "
f"Arch={System.getProperty('os.arch')}, "
f"OS={System.getProperty('os.name')}, "
f"Ghidra={getGhidraVersion()}, "
f"Java={System.getProperty('java.version')}, "
f"Ghidrathon={ghidrathon.GhidrathonPlugin.getVersion()}, "
f"Jep={jep.__version__}",
file=sys.stderr,
)
6 changes: 6 additions & 0 deletions src/main/java/ghidrathon/GhidrathonPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
public class GhidrathonPlugin extends ProgramPlugin
implements InterpreterConnection, OptionsChangeListener {

private static final String VERSION = "4.0.0";

private InterpreterConsole console;
private GhidrathonConsoleInputThread inputThread;
private TaskMonitor interactiveTaskMonitor;
Expand All @@ -71,6 +73,10 @@ GhidrathonScript getInteractiveScript() {
return interactiveScript;
}

public static String getVersion() {
return VERSION;
}

@Override
protected void init() {

Expand Down
Loading