Skip to content

Commit 9dd6fef

Browse files
authored
Only support Ghidra 11.4 (#75)
Co-authored-by: Florian Magin <[email protected]>
1 parent 851517d commit 9dd6fef

File tree

4 files changed

+48
-46
lines changed

4 files changed

+48
-46
lines changed

.github/workflows/main.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ jobs:
1010
matrix:
1111
ghidra:
1212
# - "latest"
13-
- "11.3.1"
14-
- "11.2.1"
13+
- "11.4"
14+
# - "11.3.2"
15+
# - "11.2.1"
1516
# - "11.1.1"
1617
# - "11.1"
1718
# - "11.0.3"

src/main/java/lol/fairplay/ghidraapple/analysis/objectivec/blocks/BlockDataTypes.kt

Lines changed: 35 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,22 @@ class BlockLayoutDataType(
4848
"invoke${invokeFunctionTypeSuffix?.let { "_$it" } ?: ""}",
4949
).apply {
5050
returnType = invokeReturnType
51-
arguments = arrayOf(
52-
ParameterDefinitionImpl(
53-
"block",
54-
PointerDataType(
55-
// Throwing this all together at once seems to avoid data type conflicts. If this
56-
// were instead defined outside the `apply` block and then used inside, it seems
57-
// to cause two data types to be defined for this singular block layout type.
58-
this@BlockLayoutDataType,
59-
dataTypeManager,
60-
),
61-
null,
62-
),
63-
) + parameters
51+
setArguments(
52+
*
53+
arrayOf(
54+
ParameterDefinitionImpl(
55+
"block",
56+
PointerDataType(
57+
// Throwing this all together at once seems to avoid data type conflicts. If this
58+
// were instead defined outside the `apply` block and then used inside, it seems
59+
// to cause two data types to be defined for this singular block layout type.
60+
this@BlockLayoutDataType,
61+
dataTypeManager,
62+
),
63+
null,
64+
),
65+
) + parameters,
66+
)
6467
}
6568
add(PointerDataType(invokeFunctionType, dataTypeManager), "invoke", null)
6669
add(PointerDataType(BlockDescriptor1DataType(dataTypeManager), dataTypeManager), "descriptor", null)
@@ -84,21 +87,19 @@ class BlockDescriptor2DataType(
8487
val copyHelperFunctionDataType =
8588
FunctionDefinitionDataType("copy_helper").apply {
8689
returnType = VoidDataType.dataType
87-
arguments =
88-
arrayOf(
89-
ParameterDefinitionImpl("dst", PointerDataType(VoidDataType(), dataTypeManager), null),
90-
ParameterDefinitionImpl("src", PointerDataType(VoidDataType(), dataTypeManager), null),
91-
)
90+
setArguments(
91+
ParameterDefinitionImpl("dst", PointerDataType(VoidDataType(), dataTypeManager), null),
92+
ParameterDefinitionImpl("src", PointerDataType(VoidDataType(), dataTypeManager), null),
93+
)
9294
}
9395
add(PointerDataType(copyHelperFunctionDataType), "copy_helper", null)
9496
val disposeHelperFunctionDataType =
9597
FunctionDefinitionDataType("dispose_helper").apply {
9698
returnType = VoidDataType.dataType
97-
arguments =
98-
arrayOf(
99-
ParameterDefinitionImpl("dst", PointerDataType(VoidDataType(), dataTypeManager), null),
100-
ParameterDefinitionImpl("src", PointerDataType(VoidDataType(), dataTypeManager), null),
101-
)
99+
setArguments(
100+
ParameterDefinitionImpl("dst", PointerDataType(VoidDataType(), dataTypeManager), null),
101+
ParameterDefinitionImpl("src", PointerDataType(VoidDataType(), dataTypeManager), null),
102+
)
102103
}
103104
add(PointerDataType(disposeHelperFunctionDataType, dataTypeManager), "dispose_helper", null)
104105
}
@@ -149,26 +150,24 @@ class BlockByrefKeepFunctionDefinitionDataType(
149150
init {
150151
val blockByRefPointerType =
151152
PointerDataType(BlockByRef3DataType(dataTypeManager), dataTypeManager)
152-
arguments =
153-
arrayOf(
154-
ParameterDefinitionImpl(null, blockByRefPointerType, null),
155-
ParameterDefinitionImpl(null, blockByRefPointerType, null),
156-
)
153+
setArguments(
154+
ParameterDefinitionImpl(null, blockByRefPointerType, null),
155+
ParameterDefinitionImpl(null, blockByRefPointerType, null),
156+
)
157157
}
158158
}
159159

160160
class BlockByrefDestroyFunctionDefinitionDataType(
161161
dataTypeManager: DataTypeManager,
162162
) : FunctionDefinitionDataType("BlockByrefDestroyFunction", dataTypeManager) {
163163
init {
164-
arguments =
165-
arrayOf(
166-
ParameterDefinitionImpl(
167-
null,
168-
PointerDataType(BlockByRef3DataType(dataTypeManager), dataTypeManager),
169-
null,
170-
),
171-
)
164+
setArguments(
165+
ParameterDefinitionImpl(
166+
null,
167+
PointerDataType(BlockByRef3DataType(dataTypeManager), dataTypeManager),
168+
null,
169+
),
170+
)
172171
}
173172
}
174173

src/main/java/lol/fairplay/ghidraapple/analysis/passes/objcclasses/ApplyAllocTypeOverrideCommand.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class ApplyAllocTypeOverrideCommand(
4242
): FunctionSignature {
4343
val fsig = FunctionDefinitionDataType("tmpname")
4444
fsig.returnType = type
45-
fsig.arguments = arrayOf(ParameterDefinitionImpl("cls", type, null))
45+
fsig.setArguments(ParameterDefinitionImpl("cls", type, null))
4646
if (withVarargs) {
4747
fsig.setVarArgs(true)
4848
}

src/main/java/lol/fairplay/ghidraapple/loading/UniversalBinaryLoader.kt

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package lol.fairplay.ghidraapple.loading
33
import ghidra.app.util.Option
44
import ghidra.app.util.bin.ByteProvider
55
import ghidra.app.util.importer.MessageLog
6+
import ghidra.app.util.opinion.LoadSpec
67
import ghidra.app.util.opinion.Loaded
78
import ghidra.app.util.opinion.MachoLoader
89
import ghidra.framework.model.Project
@@ -24,13 +25,14 @@ class UniversalBinaryLoader : MachoLoader() {
2425
}
2526

2627
override fun postLoadProgramFixups(
27-
loadedPrograms: MutableList<Loaded<Program>>?,
28-
project: Project?,
29-
options: MutableList<Option>?,
30-
messageLog: MessageLog?,
31-
monitor: TaskMonitor?,
28+
loadedPrograms: List<Loaded<Program>>?,
29+
project: Project,
30+
loadSpec: LoadSpec,
31+
options: List<Option>,
32+
messageLog: MessageLog,
33+
monitor: TaskMonitor,
3234
) {
33-
super.postLoadProgramFixups(loadedPrograms, project, options, messageLog, monitor)
35+
super.postLoadProgramFixups(loadedPrograms, project, loadSpec, options, messageLog, monitor)
3436
if (loadedPrograms != null) {
3537
for (loaded in loadedPrograms) {
3638
// The actual program is wrapped, so we need to unwrap it.
@@ -60,7 +62,7 @@ class UniversalBinaryLoader : MachoLoader() {
6062
.joinToString("/")
6163
loaded.projectFolderPath = newFolderPath
6264
// Now that the program is up one folder, we can delete the original one.
63-
project?.projectData?.getFolder(originalFolderPath)?.delete()
65+
project.projectData?.getFolder(originalFolderPath)?.delete()
6466
}
6567
}
6668
}

0 commit comments

Comments
 (0)