From 43701f073573858d4e50f755dbcb99c57ff27700 Mon Sep 17 00:00:00 2001
From: dragonmacher <48328597+dragonmacher@users.noreply.github.com>
Date: Thu, 16 May 2024 18:46:29 -0400
Subject: [PATCH 1/3] GP-4604 - Fixed stack overflow exception
---
.../ghidra/app/plugin/core/script/ScriptList.java | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/script/ScriptList.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/script/ScriptList.java
index fb5e70ae10e..905a5a108ed 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/script/ScriptList.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/script/ScriptList.java
@@ -30,14 +30,14 @@
import ghidra.util.task.SwingUpdateManager;
/**
- * Loads and manages updating of available script files.
+ * Loads and manages updating of available script files.
*
* Use the {@link #refresh()} method to reload the script files.
*/
public class ScriptList {
private BundleHost bundleHost;
- private List scriptFiles = new ArrayList<>();
+ private List scriptFiles = null;
private WeakSet listeners = WeakDataStructureFactory.createCopyOnWriteWeakSet();
private SwingUpdateManager refreshUpdateManager = new SwingUpdateManager(this::doRefresh);
@@ -76,7 +76,7 @@ private void doRefresh() {
void load() {
Swing.runNow(() -> {
- if (scriptFiles.isEmpty()) {
+ if (scriptFiles == null) {
doRefresh();
}
});
@@ -87,7 +87,7 @@ List getScriptFiles() {
return Collections.unmodifiableList(scriptFiles);
}
- List getScriptDirectories() {
+ private List getScriptDirectories() {
return bundleHost.getGhidraBundles()
.stream()
.filter(GhidraSourceBundle.class::isInstance)
@@ -96,8 +96,8 @@ List getScriptDirectories() {
.collect(Collectors.toList());
}
- private void updateAvailableScriptFilesForDirectory(
- List scriptAccumulator, ResourceFile directory) {
+ private void updateAvailableScriptFilesForDirectory(List scriptAccumulator,
+ ResourceFile directory) {
ResourceFile[] files = directory.listFiles();
if (files == null) {
return;
From 868b4797d277b2190569d882de38b681af0bcc10 Mon Sep 17 00:00:00 2001
From: Dan <46821332+nsadeveloper789@users.noreply.github.com>
Date: Fri, 17 May 2024 14:36:11 +0000
Subject: [PATCH 2/3] Fix python build to include tlb
---
Ghidra/Debug/Debugger-agent-dbgeng/certification.manifest | 1 +
Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/MANIFEST.in | 1 +
.../Debug/Debugger-agent-dbgeng/src/main/py/pyproject.toml | 6 ++++++
3 files changed, 8 insertions(+)
create mode 100644 Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/MANIFEST.in
diff --git a/Ghidra/Debug/Debugger-agent-dbgeng/certification.manifest b/Ghidra/Debug/Debugger-agent-dbgeng/certification.manifest
index cca8607dd9c..f9799eecd2b 100644
--- a/Ghidra/Debug/Debugger-agent-dbgeng/certification.manifest
+++ b/Ghidra/Debug/Debugger-agent-dbgeng/certification.manifest
@@ -5,6 +5,7 @@ Module.manifest||GHIDRA||||END|
data/debugger-launchers/local-dbgeng.bat||GHIDRA||||END|
data/debugger-launchers/local-ttd.bat||GHIDRA||||END|
src/main/py/LICENSE||GHIDRA||||END|
+src/main/py/MANIFEST.in||GHIDRA||||END|
src/main/py/README.md||GHIDRA||||END|
src/main/py/pyproject.toml||GHIDRA||||END|
src/main/py/src/ghidradbg/dbgmodel/DbgModel.idl||GHIDRA||||END|
diff --git a/Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/MANIFEST.in b/Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/MANIFEST.in
new file mode 100644
index 00000000000..150d74bdc49
--- /dev/null
+++ b/Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/MANIFEST.in
@@ -0,0 +1 @@
+graft src
\ No newline at end of file
diff --git a/Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/pyproject.toml b/Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/pyproject.toml
index a07be476664..122a73141b9 100644
--- a/Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/pyproject.toml
+++ b/Ghidra/Debug/Debugger-agent-dbgeng/src/main/py/pyproject.toml
@@ -24,3 +24,9 @@ dependencies = [
[project.urls]
"Homepage" = "https://github.com/NationalSecurityAgency/ghidra"
"Bug Tracker" = "https://github.com/NationalSecurityAgency/ghidra/issues"
+
+[tool.setuptools.package-data]
+ghidradbg = ["*.tlb"]
+
+[tool.setuptools]
+include-package-data = true
From bccee567ef15b3e84ad692878d18b1f2f9689cd0 Mon Sep 17 00:00:00 2001
From: ghidra1
Date: Fri, 17 May 2024 11:43:01 -0400
Subject: [PATCH 3/3] GP-0 Corrected dbgmodel.tlb handling for multi-platform
build
---
.../Debug/Debugger-agent-dbgeng/build.gradle | 23 ++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/Ghidra/Debug/Debugger-agent-dbgeng/build.gradle b/Ghidra/Debug/Debugger-agent-dbgeng/build.gradle
index 6299b9b1b8a..005ed11231d 100644
--- a/Ghidra/Debug/Debugger-agent-dbgeng/build.gradle
+++ b/Ghidra/Debug/Debugger-agent-dbgeng/build.gradle
@@ -36,13 +36,14 @@ dependencies {
testImplementation project(path: ":Debugger-gadp", configuration: 'testArtifacts')
}
+ext.tlb = file("build/os/win_x86_64/dbgmodel.tlb")
+
if ("win_x86_64".equals(getCurrentPlatformName())) {
String makeName = "win_x86_64DbgmodelTlbMake"
task(type: Exec, makeName) {
ext.tmpBatch = file("build/buildTlb.bat")
ext.idl = file("src/main/py/src/ghidradbg/dbgmodel/DbgModel.idl")
- ext.tlb = file("build/os/win_x86_64/dbgmodel.tlb")
inputs.file(idl)
outputs.file(tlb)
@@ -69,13 +70,29 @@ if ("win_x86_64".equals(getCurrentPlatformName())) {
}
}
}
-else {
+else if (file(tlb).exists()) {
+ // required for multi-platform build
tasks.assemblePyPackage {
- from(rootProject.BIN_REPO + '/' + getGhidraRelativePath(project) + "/os/win_x86_64/dbgmodel.tlb") {
+ from(tlb) {
+ println "Copying existing tlb build artifact: " + tlb
into("src/ghidradbg/dbgmodel/tlb")
}
}
}
+else {
+ def prebuiltTlb = new File(rootProject.BIN_REPO + '/' + getGhidraRelativePath(project) + "/os/win_x86_64/dbgmodel.tlb")
+ if (prebuiltTlb.exists()) {
+ println "Copying prebuilt dbgmodel.tlb"
+ tasks.assemblePyPackage {
+ from(rootProject.BIN_REPO + '/' + getGhidraRelativePath(project) + "/os/win_x86_64/dbgmodel.tlb") {
+ into("src/ghidradbg/dbgmodel/tlb")
+ }
+ }
+ }
+ else {
+ println "WARNING: dbgmodel.tlb omitted from ghidradbg python package"
+ }
+}
distributePyDep("Pybag-2.2.10-py3-none-any.whl")
distributePyDep("capstone-5.0.1-py3-none-win_amd64.whl")