Skip to content

Commit

Permalink
Add support for Ghidra 11.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Gekkio committed Sep 29, 2024
1 parent 6f155d7 commit 81629c9
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ jobs:
- ghidra_version: "11.1.2"
ghidra_build_date: "20240709"
ghidra_sha256: "219ec130b901645779948feeb7cc86f131dd2da6c36284cf538c3a7f3d44b588"
- ghidra_version: "11.2"
ghidra_build_date: "20240926"
ghidra_sha256: "a98fe01038fe8791c54b121ede545ea799d26358794d7c2ac09fa3f5054f3cdc"
env:
GHIDRA_VERSION: ${{ matrix.ghidra_version }}
GHIDRA_BUILD_DATE: ${{ matrix.ghidra_build_date }}
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Changed

- Build with Java 21
- Add support for Ghidra 11.2

## 20240711 - 2024-07-11

Expand Down
1 change: 1 addition & 0 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

Supported Ghidra versions:

- 11.2
- 11.1.2
- 11.1.1
- 11.1
Expand Down
37 changes: 34 additions & 3 deletions src/test/kotlin/fi/gekkio/ghidraboy/decompiler/DecompilerTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import fi.gekkio.ghidraboy.withTransaction
import ghidra.app.decompiler.DecompInterface
import ghidra.app.plugin.assembler.Assemblers
import ghidra.app.util.importer.MessageLog
import ghidra.framework.Application
import ghidra.program.database.ProgramDB
import ghidra.program.model.address.Address
import ghidra.program.model.address.AddressSet
Expand Down Expand Up @@ -114,7 +115,21 @@ class DecompilerTest : IntegrationTest() {
)
assertDecompiled(
f,
when (Application.getApplicationVersion()) {
"11.2" ->
"""
void memcpy(byte *dst,byte *src,word len)
{
for (; (char)(len >> 8) != '\0' || (char)len != '\0'; len = len - 1) {
*dst = *src;
src = src + 1;
dst = dst + 1;
}
return;
}
"""
else ->
"""
void memcpy(byte *dst,byte *src,word len)
{
for (; (byte)((byte)(len >> 8) | (byte)len) != 0; len = len - 1) {
Expand All @@ -124,7 +139,8 @@ class DecompilerTest : IntegrationTest() {
}
return;
}
""".trimIndent(),
"""
},
)
}

Expand Down Expand Up @@ -153,7 +169,20 @@ class DecompilerTest : IntegrationTest() {
)
assertDecompiled(
f,
when (Application.getApplicationVersion()) {
"11.2" ->
"""
void memset(byte *dst,byte val,word len)
{
for (; (char)(len >> 8) != '\0' || (char)len != '\0'; len = len - 1) {
*dst = val;
dst = dst + 1;
}
return;
}
"""
else ->
"""
void memset(byte *dst,byte val,word len)
{
for (; (byte)((byte)(len >> 8) | (byte)len) != 0; len = len - 1) {
Expand All @@ -162,7 +191,8 @@ class DecompilerTest : IntegrationTest() {
}
return;
}
""".trimIndent(),
"""
},
)
}

Expand Down Expand Up @@ -375,7 +405,8 @@ class DecompilerTest : IntegrationTest() {
returnParam: Parameter? = null,
): Function =
program.withTransaction {
val instructions: Iterable<Instruction> = Assemblers.getAssembler(program).assemble(address, *code.lines().toTypedArray())
val instructions: Iterable<Instruction> =
Assemblers.getAssembler(program).assemble(address, *code.lines().toTypedArray())
val addressSet = AddressSet()
for (instruction in instructions) {
addressSet.add(instruction.minAddress, instruction.maxAddress)
Expand Down

0 comments on commit 81629c9

Please sign in to comment.