diff --git a/GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevFeature/feature.xml b/GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevFeature/feature.xml index b2944967b0..cd4ef3eb1f 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/GhidraDev_README.html b/GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/GhidraDev_README.html index 1f7ab1b5f3..a66dd96273 100644 --- a/GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/GhidraDev_README.html +++ b/GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/GhidraDev_README.html @@ -19,7 +19,7 @@

GhidraDev README

GhidraDev provides support for developing and debugging Ghidra scripts and modules in Eclipse.

-

The information provided in this document is effective as of GhidraDev 2.1.4 and is subject to +

The information provided in this document is effective as of GhidraDev 2.1.5 and is subject to change with future releases.

Change History

+

2.1.5: Eclipse Python breakpoints now work when Eclipse installs PyDev in .p2 +bundle pool directory.

2.1.4: Fixed exception that occurred when performing a "Link Ghidra" on projects that use a Gradle classpath container.

2.1.3: Fixed a bug that prevented Ghidra projects from recognizing extensions diff --git a/GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/META-INF/MANIFEST.MF b/GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/META-INF/MANIFEST.MF index 3500462360..286135d06b 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: 2.1.4.qualifier +Bundle-Version: 2.1.5.qualifier Bundle-Activator: ghidradev.Activator Require-Bundle: org.eclipse.ant.core;bundle-version="3.5.200", org.eclipse.buildship.core;bundle-version="3.0.0", diff --git a/GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/src/main/java/ghidradev/ghidraprojectcreator/utils/PyDevUtils.java b/GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/src/main/java/ghidradev/ghidraprojectcreator/utils/PyDevUtils.java index edb9b1b0e3..8cdb2f7e74 100644 --- a/GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/src/main/java/ghidradev/ghidraprojectcreator/utils/PyDevUtils.java +++ b/GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/src/main/java/ghidradev/ghidraprojectcreator/utils/PyDevUtils.java @@ -16,24 +16,21 @@ package ghidradev.ghidraprojectcreator.utils; import java.io.File; -import java.io.IOException; +import java.net.URI; +import java.net.URL; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import java.util.ArrayList; import java.util.List; -import java.util.Optional; import java.util.stream.Stream; import javax.naming.OperationNotSupportedException; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.*; import org.eclipse.jdt.core.IClasspathEntry; import org.eclipse.jdt.core.IJavaProject; +import org.osgi.framework.Bundle; +import org.osgi.framework.FrameworkUtil; import ghidradev.Activator; @@ -158,30 +155,30 @@ public class PyDevUtils { * @throws CoreException if there was a problem searching for the PyDev source directory. */ public static File getPyDevSrcDir() throws CoreException { - String eclipsePath = Platform.getInstallLocation().getURL().getFile(); - - List searchDirs = new ArrayList<>(); - searchDirs.add(new File(eclipsePath, "plugins")); - searchDirs.add(new File(eclipsePath, "dropins")); - - for (File searchRoot : searchDirs) { - try (Stream paths = Files.walk(Paths.get(searchRoot.toURI()))) { - Optional pysrcDir = paths.filter( - Files::isDirectory) - .filter(p -> p.endsWith("pysrc")) - .map(p -> p.toFile()) - .filter(f -> f.getParentFile().getName().startsWith("org.python.pydev")) - .findFirst(); - if (pysrcDir.isPresent()) { - return pysrcDir.get(); + Bundle[] bundles = + FrameworkUtil.getBundle(PyDevUtilsInternal.class).getBundleContext().getBundles(); + + Bundle pydevCoreBundle = Stream.of(bundles) + .filter(bundle -> bundle.getSymbolicName().contains("org.python.pydev.core")) + .findFirst() + .orElse(null); + + if (pydevCoreBundle != null) { + try { + URL pydevDirUrl = FileLocator.toFileURL(pydevCoreBundle.getEntry("/")); + URI pydevDirUri = + new URI(pydevDirUrl.getProtocol(), pydevDirUrl.getPath(), null).normalize(); + Path pysrcDir = Paths.get(pydevDirUri).resolve("pysrc"); + if (Files.exists(pysrcDir)) { + return pysrcDir.toFile(); } } - catch (IOException e) { + catch (Exception e) { throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, "Problem searching for PyDev source directory", e)); } } - + return null; } }