Skip to content

Commit

Permalink
Allow makeAlignment to make larger chunks
Browse files Browse the repository at this point in the history
  • Loading branch information
edmcman committed Nov 14, 2024
1 parent a2ba4f7 commit ff52f4c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/main/java/kaiju/tools/disasm/DisasmStrategy.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ public interface DisasmStrategy extends KaijuLogger {
* this is a default implementation that shouldn't rely on
* architecture, but can be overriden if needed for some reason.
*/
default Pair<AddressRange, Integer> makeAlignment(Listing listing, final Address address, TaskMonitor monitor) {
default Pair<AddressRange, Integer> makeAlignment(Listing listing, final Address address, long length, TaskMonitor monitor) {
DataType alignmentType = GhidraTypeUtilities.findGhidraType("Alignment");
try {
Data alignData = listing.createData(address, alignmentType);
Data alignData = listing.createData(address, alignmentType, (int) length);
final Address minAddr = alignData.getMinAddress();
final Address maxAddr = alignData.getMaxAddress();
final AddressRange range = new AddressRangeImpl(minAddr, maxAddr);
debug(this, "Created alignment at: " + range);
debug(this, "Created alignment of " + range.getLength() + " bytes at: " + range);
//alignmentAddresses.add(range);
return new Pair<AddressRange, Integer>(range, 1);
} catch (final CodeUnitInsertionException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@ public Pair<AddressRange, Integer> analyzeGap(final AddressRange range) {
switch (previousBlockType) {
case CODE:
if (b == 0xCC) {
return makeAlignment(listing, minAddr, monitor);
return makeAlignment(listing, minAddr, range.getLength(), monitor);
} else {
return makeCode(currentProgram, listing, minAddr, monitor);
}
case DATA:
if (b == 0x00)
return makeAlignment(listing, minAddr, monitor);
return makeAlignment(listing, minAddr, range.getLength(), monitor);
break;
case ALIGNMENT:
debug(this, "I'm a little surprised to find alignment at " + minAddr);
Expand Down

0 comments on commit ff52f4c

Please sign in to comment.