Ghidra is a software reverse engineering (SRE) framework
Fixes for building SleighEditor, buildreadme, and added popcount to grammar
emteere04ddbf598139
diff --git a/GhidraBuild/EclipsePlugins/GhidraSleighEditor/ghidra.xtext.sleigh.ide/build.gradle b/GhidraBuild/EclipsePlugins/GhidraSleighEditor/ghidra.xtext.sleigh.ide/build.gradleindex 346edff8af..47fb6a0d3c 100644--- a/GhidraBuild/EclipsePlugins/GhidraSleighEditor/ghidra.xtext.sleigh.ide/build.gradle+++ b/GhidraBuild/EclipsePlugins/GhidraSleighEditor/ghidra.xtext.sleigh.ide/build.gradle@@ -5,6 +5,16 @@ apply plugin: 'java'if (hasProperty("eclipseDSL")) {apply plugin: 'eclipse'eclipse {+ // Check to make sure the generated build folders exists+ def srcGenFolder = file ("src-gen")+ if (!srcGenFolder.exists()) {+ srcGenFolder.mkdirs()+ }+ def xtendGenFolder = file ("xtend-gen")+ if (!xtendGenFolder.exists()) {+ xtendGenFolder.mkdirs()+ }+project {name = 'Eclipse SleighEditor IDE'buildCommand 'org.eclipse.pde.ManifestBuilder'diff --git a/GhidraBuild/EclipsePlugins/GhidraSleighEditor/ghidra.xtext.sleigh.tests/build.gradle b/GhidraBuild/EclipsePlugins/GhidraSleighEditor/ghidra.xtext.sleigh.tests/build.gradleindex f2266d2784..2868767233 100644--- a/GhidraBuild/EclipsePlugins/GhidraSleighEditor/ghidra.xtext.sleigh.tests/build.gradle+++ b/GhidraBuild/EclipsePlugins/GhidraSleighEditor/ghidra.xtext.sleigh.tests/build.gradle@@ -5,6 +5,16 @@ apply plugin: 'java'if (hasProperty("eclipseDSL")) {apply plugin: 'eclipse'eclipse {+ // Check to make sure the generated build folders exists+ def srcGenFolder = file ("src-gen")+ if (!srcGenFolder.exists()) {+ srcGenFolder.mkdirs()+ }+ def xtendGenFolder = file ("xtend-gen")+ if (!xtendGenFolder.exists()) {+ xtendGenFolder.mkdirs()+ }+project {name = 'Eclipse SleighEditor Tests'buildCommand 'org.eclipse.pde.ManifestBuilder'diff --git a/GhidraBuild/EclipsePlugins/GhidraSleighEditor/ghidra.xtext.sleigh.tests/src/ghidra/xtext/sleigh/tests/SleighParsingTest.xtend b/GhidraBuild/EclipsePlugins/GhidraSleighEditor/ghidra.xtext.sleigh.tests/src/ghidra/xtext/sleigh/tests/SleighParsingTest.xtendindex 21c62985f6..a2a075d8b9 100644--- a/GhidraBuild/EclipsePlugins/GhidraSleighEditor/ghidra.xtext.sleigh.tests/src/ghidra/xtext/sleigh/tests/SleighParsingTest.xtend+++ b/GhidraBuild/EclipsePlugins/GhidraSleighEditor/ghidra.xtext.sleigh.tests/src/ghidra/xtext/sleigh/tests/SleighParsingTest.xtend@@ -181,6 +181,7 @@ class SleighParsingTest {@if defined(ENDIAN)reg = tmp;@endif+ tmp = popcount(CC);}Dest: loc is op=0 [ loc = inst_next; ] { export loc; }diff --git a/GhidraBuild/EclipsePlugins/GhidraSleighEditor/ghidra.xtext.sleigh.ui.tests/build.gradle b/GhidraBuild/EclipsePlugins/GhidraSleighEditor/ghidra.xtext.sleigh.ui.tests/build.gradleindex 3057f75f08..f297a4d46d 100644--- a/GhidraBuild/EclipsePlugins/GhidraSleighEditor/ghidra.xtext.sleigh.ui.tests/build.gradle+++ b/GhidraBuild/EclipsePlugins/GhidraSleighEditor/ghidra.xtext.sleigh.ui.tests/build.gradle@@ -5,6 +5,16 @@ apply plugin: 'java'if (hasProperty("eclipseDSL")) {apply plugin: 'eclipse'eclipse {+ // Check to make sure the generated build folders exists+ def srcGenFolder = file ("src-gen")+ if (!srcGenFolder.exists()) {+ srcGenFolder.mkdirs()+ }+ def xtendGenFolder = file ("xtend-gen")+ if (!xtendGenFolder.exists()) {+ xtendGenFolder.mkdirs()+ }+project {name = 'Eclipse SleighEditor UI Tests'buildCommand 'org.eclipse.pde.ManifestBuilder'diff --git a/GhidraBuild/EclipsePlugins/GhidraSleighEditor/ghidra.xtext.sleigh.ui/build.gradle b/GhidraBuild/EclipsePlugins/GhidraSleighEditor/ghidra.xtext.sleigh.ui/build.gradleindex 8f18815c74..d6088f4ca0 100644--- a/GhidraBuild/EclipsePlugins/GhidraSleighEditor/ghidra.xtext.sleigh.ui/build.gradle+++ b/GhidraBuild/EclipsePlugins/GhidraSleighEditor/ghidra.xtext.sleigh.ui/build.gradle@@ -5,6 +5,16 @@ apply plugin: 'java'if (hasProperty("eclipseDSL")) {apply plugin: 'eclipse'eclipse {+ // Check to make sure the generated build folders exists+ def srcGenFolder = file ("src-gen")+ if (!srcGenFolder.exists()) {+ srcGenFolder.mkdirs()+ }+ def xtendGenFolder = file ("xtend-gen")+ if (!xtendGenFolder.exists()) {+ xtendGenFolder.mkdirs()+ }+project {name = 'Eclipse SleighEditor UI'buildCommand 'org.eclipse.pde.ManifestBuilder'diff --git a/GhidraBuild/EclipsePlugins/GhidraSleighEditor/ghidra.xtext.sleigh/build.gradle b/GhidraBuild/EclipsePlugins/GhidraSleighEditor/ghidra.xtext.sleigh/build.gradleindex b824254ccc..534e0c6d0f 100644--- a/GhidraBuild/EclipsePlugins/GhidraSleighEditor/ghidra.xtext.sleigh/build.gradle+++ b/GhidraBuild/EclipsePlugins/GhidraSleighEditor/ghidra.xtext.sleigh/build.gradle@@ -5,6 +5,16 @@ apply plugin: 'java'if (hasProperty("eclipseDSL")) {apply plugin: 'eclipse'eclipse {+ // Check to make sure the generated build folders exists+ def srcGenFolder = file ("src-gen")+ if (!srcGenFolder.exists()) {+ srcGenFolder.mkdirs()+ }+ def xtendGenFolder = file ("xtend-gen")+ if (!xtendGenFolder.exists()) {+ xtendGenFolder.mkdirs()+ }+project {name = 'Eclipse SleighEditor'buildCommand 'org.eclipse.pde.ManifestBuilder'diff --git a/GhidraBuild/EclipsePlugins/GhidraSleighEditor/ghidra.xtext.sleigh/build_README.txt b/GhidraBuild/EclipsePlugins/GhidraSleighEditor/ghidra.xtext.sleigh/build_README.txtindex ab599c09e1..5497a9a2b6 100644--- a/GhidraBuild/EclipsePlugins/GhidraSleighEditor/ghidra.xtext.sleigh/build_README.txt+++ b/GhidraBuild/EclipsePlugins/GhidraSleighEditor/ghidra.xtext.sleigh/build_README.txt@@ -13,13 +13,13 @@ have added 80Meg.Importing GhidraSleighEditor Eclipse projects (they are deactivated by default):1) Uncomment the line in settings.gradle that includes the GhidraSleighEditor project.- 2) Run "gradle eclipse -PSleighEditor" to generate the GhidraSleighEditor Eclipse projects.+ 2) Run "gradle eclipse -PeclipseDSL" to generate the GhidraSleighEditor Eclipse projects.3) From Eclipse, File --> Import --> General --> Existing Projects into Workspace4) From the ghidra repo, import all "Eclipse GhidraSleighEditor *" projects.Generating all Sleigh XTEXT generated files:- 1) open ghidra.xtext.sleigh project+ 1) open "Eclipse SleighEditor" project2) navigate to the file src --> ghidra.xtext.sleigh --> GenerateSleigh.mwe23) NOTE: the following will download a jar file from the internet (not from NSA)unless you pre-download.@@ -28,6 +28,8 @@ Generating all Sleigh XTEXT generated files:3c) Rename the file to .antlr-generator-3.2.0-patch.jar3) From the popup menu RunAs --> MWE2 Workflow- Files in xtend-gen and src-gen will be created+ 4) If there are any red bookmarks on any of the Eclipse Sliehg* projects,+ - Select all the Eclipse Sleigh* projects, and refresh from the popup menu- The project should rebuild, and there should be no red Problem errorsdiff --git a/GhidraBuild/EclipsePlugins/GhidraSleighEditor/ghidra.xtext.sleigh/src/ghidra/xtext/sleigh/Sleigh.xtext b/GhidraBuild/EclipsePlugins/GhidraSleighEditor/ghidra.xtext.sleigh/src/ghidra/xtext/sleigh/Sleigh.xtextindex d5d22878df..844e1df12f 100644--- a/GhidraBuild/EclipsePlugins/GhidraSleighEditor/ghidra.xtext.sleigh/src/ghidra/xtext/sleigh/Sleigh.xtext+++ b/GhidraBuild/EclipsePlugins/GhidraSleighEditor/ghidra.xtext.sleigh/src/ghidra/xtext/sleigh/Sleigh.xtext@@ -658,6 +658,7 @@ exprSingle returns Expression:| pcodeop='ceil' '(' op1=expr ')'| pcodeop='floor' '(' op1=expr ')'| pcodeop='round' '(' op1=expr ')'+ | pcodeop='popcount' '(' op1=expr ')'| pcodeop='cpool' '(' op1=expr ',' op2=expr ',' op3=expr ')'| pcodeop='newobject' '(' op1=newObjParams ')'| op=[macroOrPcode] op1=paramlist