ghidra/Ghidra/Debug/Framework-Debugging/build.gradle
2024-05-10 10:45:58 -04:00

173 lines
5.4 KiB
Groovy

/* ###
* IP: GHIDRA
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
apply from: "${rootProject.projectDir}/gradle/javaProject.gradle"
apply from: "${rootProject.projectDir}/gradle/jacocoProject.gradle"
apply from: "${rootProject.projectDir}/gradle/javaTestProject.gradle"
apply from: "${rootProject.projectDir}/gradle/nativeProject.gradle"
apply from: "${rootProject.projectDir}/gradle/distributableGhidraModule.gradle"
apply plugin: 'eclipse'
eclipse.project.name = 'Debug Framework-Debugging'
dependencies {
api project(':Framework-AsyncComm')
api project(':Generic')
api project(':SoftwareModeling')
api project(':ProposedUtils')
api "net.java.dev.jna:jna:5.14.0"
api "net.java.dev.jna:jna-platform:5.14.0"
testImplementation project(path: ':Framework-AsyncComm', configuration: 'testArtifacts')
}
// Ensure the below native test binaries don't get built for a distribution
ext.nativesTestOnly = true
task testSpecimenWin_x86_64 {
dependsOn 'expCreateProcessWin_x86_64Executable'
dependsOn 'expCreateThreadExitWin_x86_64Executable'
//dependsOn 'expCreateThreadSpinWin_x86_64Executable'
dependsOn 'expPrintWin_x86_64Executable'
//dependsOn 'expSpinWin_x86_64Executable'
dependsOn 'expRegistersWin_x86_64Executable'
dependsOn 'expStackWin_x86_64Executable'
}
task testSpecimenLinux_x86_64 {
dependsOn 'expCloneExecExecutable'//Linux_x86_64Executable'
dependsOn 'expCloneExitLinux_x86_64Executable'
//dependsOn 'expCloneSpinExecutable'//Linux_x86_64Executable'
dependsOn 'expForkExecutable'//Linux_x86_64Executable'
dependsOn 'expPrintLinux_x86_64Executable'
dependsOn 'expReadLinux_x86_64Executable'
dependsOn 'expSpinLinux_x86_64Executable'
dependsOn 'expRegistersLinux_x86_64Executable'
dependsOn 'expStackLinux_x86_64Executable'
dependsOn 'expTraceableSleepExecutable'//Linux_x86_64Executable'
doLast {
exec {
workingDir "build/os/linux_x86_64"
commandLine "strip", "-o", "expSpin.stripped", "expSpin"
}
}
}
task testSpecimenMac_arm_64 {
dependsOn 'expCloneExitMac_arm_64Executable'
dependsOn 'expPrintMac_arm_64Executable'
dependsOn 'expReadMac_arm_64Executable'
}
// TODO: testSpecimenMac_x86_64 (Intel)
// will likely need to codesign them to grant debugee-entitlement
model {
components {
expCreateProcess(NativeExecutableSpec) {
targetPlatform "win_x86_64"
targetPlatform "win_x86_32" // TODO: Test on these
}
expCreateThreadExit(NativeExecutableSpec) {
targetPlatform "win_x86_64"
targetPlatform "win_x86_32" // TODO: Test on these
}
expCreateThreadSpin(NativeExecutableSpec) {
targetPlatform "win_x86_64"
targetPlatform "win_x86_32" // TODO: Test on these
}
expCloneExec(NativeExecutableSpec) {
targetPlatform "linux_x86_64"
//targetPlatform "linux_x86_32" // TODO: Test on these
}
expCloneExit(NativeExecutableSpec) {
targetPlatform "linux_x86_64"
//targetPlatform "linux_x86_32" // TODO: Test on these
targetPlatform "mac_arm_64"
}
expCloneSpin(NativeExecutableSpec) {
targetPlatform "linux_x86_64"
//targetPlatform "linux_x86_32" // TODO: Test on these
}
expFork(NativeExecutableSpec) {
targetPlatform "linux_x86_64"
//targetPlatform "linux_x86_32" // TODO: Test on these
}
expPrint(NativeExecutableSpec) {
targetPlatform "linux_x86_64"
//targetPlatform "linux_x86_32" // TODO: Test on these
targetPlatform "win_x86_64"
targetPlatform "win_x86_32" // TODO: Test on these
targetPlatform "mac_arm_64"
}
expRead(NativeExecutableSpec) {
targetPlatform "linux_x86_64"
targetPlatform "mac_arm_64"
}
expSpin(NativeExecutableSpec) {
targetPlatform "linux_x86_64"
targetPlatform "win_x86_64"
targetPlatform "win_x86_32" // TODO: Test on these
}
expRegisters(NativeExecutableSpec) {
targetPlatform "linux_x86_64"
//targetPlatform "linux_x86_32" // TODO: Test on these
targetPlatform "win_x86_64"
targetPlatform "win_x86_32" // TODO: Test on these
}
expStack(NativeExecutableSpec) {
targetPlatform "linux_x86_64"
//targetPlatform "linux_x86_32" // TODO: Test on these
targetPlatform "win_x86_64"
targetPlatform "win_x86_32" // TODO: Test on these
}
expTraceableSleep(NativeExecutableSpec) {
targetPlatform "linux_x86_64"
}
}
binaries {
withType(NativeExecutableBinarySpec) {
if (toolChain in Gcc) {
cCompiler.args("-std=c99")
linker.args("-lpthread")
linker.args("-lutil")
}
if (toolChain in VisualCpp) {
cppCompiler.define("VS_PROJECT")
// NB. No /SUBSYSTEM:CONSOLE
// that creates a subprocess
linker.args("/SUBSYSTEM:windows", "/DYNAMICBASE", "/NXCOMPAT")
linker.args("shell32.lib");
}
if (isWindows(targetPlatform.name)) {
cppCompiler.define("WIN32")
cCompiler.define("WIN32")
cppCompiler.define("_WINDOWS")
cCompiler.define("_WINDOWS")
cppCompiler.define("UNICODE")
cCompiler.define("_UNICODE")
cppCompiler.define("_UNICODE")
cCompiler.define("UNICODE")
}
}
}
}