Skip to content

Commit

Permalink
Merge pull request #66 from sei-eschwartz/issue65
Browse files Browse the repository at this point in the history
Fix #65
  • Loading branch information
sei-eschwartz committed Jan 6, 2024
2 parents 93b52e3 + fbe4526 commit 1e3579e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Current Release

## 240106
- Bugfixes:
* Improve performance of Disassembly Improvements (#65)

## 231227
- Improvements:
* Support for Ghidra 11.0
Expand Down
12 changes: 3 additions & 9 deletions src/main/java/kaiju/tools/disasm/DisasmStrategy.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ default Pair<AddressRange, Integer> makeAlignment(Listing listing, final Address
* this is a default implementation that shouldn't rely on
* architecture, but can be overriden if needed for some reason.
*/
default Pair<AddressRange, Integer> makeCode(Program currentProgram, Listing listing, AddressSetView allAddresses, final Address address, TaskMonitor monitor) {
default Pair<AddressRange, Integer> makeCode(Program currentProgram, Listing listing, final Address address, TaskMonitor monitor) {
// Making code at a previous gap might have converted this gap to code, so we need to
// check again to see if this address range is still a gap...
if (GhidraTypeUtilities.getBlockType(listing, address) == GhidraTypeUtilities.BlockType.CODE) {
Expand All @@ -110,14 +110,8 @@ default Pair<AddressRange, Integer> makeCode(Program currentProgram, Listing lis
}

// debug(this, "Making code at " + address);
AddressSetView undefinedAddresses = null;
try {
undefinedAddresses = listing.getUndefinedRanges(allAddresses, false, monitor);
} catch (CancelledException e) {
final AddressRange range = new AddressRangeImpl(address, address);
return new Pair<AddressRange, Integer>(range, 0);
}
final DisassembleCommand disassembleCmd = new DisassembleCommand(address, undefinedAddresses, true);

final DisassembleCommand disassembleCmd = new DisassembleCommand(address, null, true);
disassembleCmd.enableCodeAnalysis(true);
disassembleCmd.applyTo(currentProgram, monitor);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ public Pair<AddressRange, Integer> analyzeGap(final AddressRange range) {
if (b == 0xCC) {
return makeAlignment(listing, minAddr, monitor);
} else {
AddressSetView allAddresses = memory.getAllInitializedAddressSet();
return makeCode(currentProgram, listing, allAddresses, minAddr, monitor);
return makeCode(currentProgram, listing, minAddr, monitor);
}
case DATA:
if (b == 0x00)
Expand Down

0 comments on commit 1e3579e

Please sign in to comment.