diff --git a/GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevFeature/feature.xml b/GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevFeature/feature.xml index d77986fab7..21961b1ea8 100644 --- a/GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevFeature/feature.xml +++ b/GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevFeature/feature.xml @@ -2,7 +2,7 @@ diff --git a/GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/.launch/GhidraDev.launch b/GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/.launch/GhidraDev.launch index 655bd9c454..fe36c5c7ff 100644 --- a/GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/.launch/GhidraDev.launch +++ b/GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/.launch/GhidraDev.launch @@ -156,6 +156,7 @@ + @@ -163,6 +164,7 @@ + @@ -173,11 +175,11 @@ - - + + @@ -185,11 +187,8 @@ - - - @@ -351,6 +350,7 @@ + @@ -391,7 +391,6 @@ - @@ -439,7 +438,7 @@ - + diff --git a/GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/META-INF/MANIFEST.MF b/GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/META-INF/MANIFEST.MF index 54947f8f3c..c4ae021280 100644 --- a/GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/META-INF/MANIFEST.MF +++ b/GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: GhidraDev Bundle-SymbolicName: ghidra.ghidradev;singleton:=true -Bundle-Version: 5.0.0.qualifier +Bundle-Version: 5.0.1.qualifier Bundle-Activator: ghidradev.Activator Require-Bundle: org.eclipse.ant.core;bundle-version="3.7.200", org.eclipse.buildship.core;bundle-version="3.1.8", diff --git a/GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/README.md b/GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/README.md index 4fa5b8a0d4..3c8f686474 100644 --- a/GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/README.md +++ b/GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/README.md @@ -1,7 +1,7 @@ # GhidraDev Eclipse Plugin GhidraDev provides support for developing and debugging Ghidra scripts and modules in Eclipse. -The information provided in this document is effective as of GhidraDev 5.0.0 and is subject to +The information provided in this document is effective as of GhidraDev 5.0.1 and is subject to change with future releases. ## Table of Contents @@ -31,6 +31,10 @@ change with future releases. 12. [Building](#building) ## Change History +__5.0.1:__ +* Fixed a bug that prevented Ghidra from discovering the Ghidra module project when launched with + the PyGhidra run configuration. + __5.0.0:__ * Added support for PyGhidra. diff --git a/GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/src/main/java/ghidradev/ghidraprojectcreator/launchers/GhidraLaunchDelegate.java b/GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/src/main/java/ghidradev/ghidraprojectcreator/launchers/GhidraLaunchDelegate.java index 80d8d5c0b7..276e5ca8f5 100644 --- a/GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/src/main/java/ghidradev/ghidraprojectcreator/launchers/GhidraLaunchDelegate.java +++ b/GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/src/main/java/ghidradev/ghidraprojectcreator/launchers/GhidraLaunchDelegate.java @@ -21,11 +21,11 @@ import java.text.ParseException; import javax.naming.OperationNotSupportedException; -import org.eclipse.core.resources.*; +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.*; import org.eclipse.debug.core.*; import org.eclipse.debug.ui.IDebugUIConstants; -import org.eclipse.jdt.core.IClasspathEntry; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants; import org.eclipse.jdt.launching.JavaLaunchDelegate; @@ -102,7 +102,7 @@ public class GhidraLaunchDelegate extends JavaLaunchDelegate { vmArgs += " " + configuration.getAttribute(GhidraLaunchUtils.ATTR_VM_ARGUMENTS, "").trim(); vmArgs += " -Dghidra.external.modules=\"%s%s%s\"".formatted( javaProject.getProject().getLocation(), File.pathSeparator, - getProjectDependencyDirs(javaProject)); + GhidraProjectUtils.getProjectDependencyDirs(javaProject)); File pyDevSrcDir = PyDevUtils.getPyDevSrcDir(); if (pyDevSrcDir != null) { vmArgs += " " + "-Declipse.pysrc.dir=\"" + pyDevSrcDir + "\""; @@ -115,7 +115,7 @@ public class GhidraLaunchDelegate extends JavaLaunchDelegate { ResourcesPlugin.getWorkspace().getRoot().getLocation() + "\""; vmArgs += " " + "-Declipse.project.dir=\"" + javaProject.getProject().getLocation() + "\""; vmArgs += " " + "-Declipse.project.dependencies=\"" + - getProjectDependencyDirs(javaProject) + "\""; + GhidraProjectUtils.getProjectDependencyDirs(javaProject) + "\""; //---------------------------------------- wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, vmArgs); @@ -128,34 +128,6 @@ public class GhidraLaunchDelegate extends JavaLaunchDelegate { super.launch(wc.doSave(), mode, launch, monitor); } - /** - * For the given Java project, gets all of its classpath dependencies that are themselves - * projects. The result is formatted as a string of paths separated by - * {@link File#pathSeparator}. - * - * @param javaProject The Java project whose project dependencies we are getting. - * @return A string of paths separated by {@link File#pathSeparator} that represents the given - * Java project's dependencies that are projects. Could be empty if there are no - * dependencies. - * @throws CoreException if there was an Eclipse-related problem with getting the dependencies. - */ - private static String getProjectDependencyDirs(IJavaProject javaProject) throws CoreException { - String paths = ""; - for (IClasspathEntry entry : javaProject.getRawClasspath()) { - if (entry.getEntryKind() == IClasspathEntry.CPE_PROJECT) { - if (!paths.isEmpty()) { - paths += File.pathSeparator; - } - IResource resource = - ResourcesPlugin.getWorkspace().getRoot().findMember(entry.getPath()); - if (resource != null) { - paths += resource.getLocation(); - } - } - } - return paths; - } - /** * Handles extra things that should happen when we are launching in debug mode. */ diff --git a/GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/src/main/java/ghidradev/ghidraprojectcreator/launchers/PyGhidraLaunchDelegate.java b/GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/src/main/java/ghidradev/ghidraprojectcreator/launchers/PyGhidraLaunchDelegate.java index 0d790422cd..582a89617f 100644 --- a/GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/src/main/java/ghidradev/ghidraprojectcreator/launchers/PyGhidraLaunchDelegate.java +++ b/GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/src/main/java/ghidradev/ghidraprojectcreator/launchers/PyGhidraLaunchDelegate.java @@ -88,7 +88,10 @@ public class PyGhidraLaunchDelegate extends RegularLaunchConfigurationDelegate { .formatted(project.getName())); // Set program arguments - wc.setAttribute(PyDevUtils.getAttrProgramArguments(), "-v -g"); + wc.setAttribute(PyDevUtils.getAttrProgramArguments(), + "-v -g -D ghidra.external.modules=\"%s%s%s\"".formatted( + javaProject.getProject().getLocation(), File.pathSeparator, + GhidraProjectUtils.getProjectDependencyDirs(javaProject))); // Set Python interpreter String interpreterName = PyDevUtils.getInterpreterName(project); diff --git a/GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/src/main/java/ghidradev/ghidraprojectcreator/utils/GhidraProjectUtils.java b/GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/src/main/java/ghidradev/ghidraprojectcreator/utils/GhidraProjectUtils.java index 8899e3f6a7..8906e11fdd 100644 --- a/GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/src/main/java/ghidradev/ghidraprojectcreator/utils/GhidraProjectUtils.java +++ b/GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/src/main/java/ghidradev/ghidraprojectcreator/utils/GhidraProjectUtils.java @@ -205,6 +205,34 @@ public class GhidraProjectUtils { return project; } + /** + * For the given Java project, gets all of its classpath dependencies that are themselves + * projects. The result is formatted as a string of paths separated by + * {@link File#pathSeparator}. + * + * @param javaProject The Java project whose project dependencies we are getting. + * @return A string of paths separated by {@link File#pathSeparator} that represents the given + * Java project's dependencies that are projects. Could be empty if there are no + * dependencies. + * @throws CoreException if there was an Eclipse-related problem with getting the dependencies. + */ + public static String getProjectDependencyDirs(IJavaProject javaProject) throws CoreException { + String paths = ""; + for (IClasspathEntry entry : javaProject.getRawClasspath()) { + if (entry.getEntryKind() == IClasspathEntry.CPE_PROJECT) { + if (!paths.isEmpty()) { + paths += File.pathSeparator; + } + IResource resource = + ResourcesPlugin.getWorkspace().getRoot().findMember(entry.getPath()); + if (resource != null) { + paths += resource.getLocation(); + } + } + } + return paths; + } + /** * Creates the given folder, including any necessary but nonexistent parent directories. *