mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-09 20:18:01 +08:00
GP-1907: Removing ContinuesInterceptor and associated API
This commit is contained in:
+1
-3
@@ -22,7 +22,6 @@ import java.util.Set;
|
||||
import java.util.concurrent.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import generic.continues.RethrowContinuesFactory;
|
||||
import ghidra.app.cmd.disassemble.DisassembleCommand;
|
||||
import ghidra.app.plugin.core.debug.workflow.DisassemblyInject;
|
||||
import ghidra.app.plugin.core.debug.workflow.DisassemblyInjectInfo;
|
||||
@@ -107,8 +106,7 @@ public class DbgengX64DisassemblyInject implements DisassemblyInject {
|
||||
}
|
||||
MemoryByteProvider mbp = new MemoryByteProvider(view.getMemory(), module.getBase());
|
||||
try {
|
||||
PortableExecutable pe = PortableExecutable.createPortableExecutable(
|
||||
RethrowContinuesFactory.INSTANCE, mbp, SectionLayout.MEMORY, false, false);
|
||||
PortableExecutable pe = new PortableExecutable(mbp, SectionLayout.MEMORY, false, false);
|
||||
NTHeader ntHeader = pe.getNTHeader();
|
||||
if (ntHeader == null) {
|
||||
return Mode.UNK;
|
||||
|
||||
@@ -29,6 +29,6 @@
|
||||
<stringAttribute key="org.eclipse.jdt.launching.MODULE_NAME" value="_Integration Test"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="ghidra.GhidraRun"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="_Integration Test"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-XX:+IgnoreUnrecognizedVMOptions -Djava.system.class.loader=ghidra.GhidraClassLoader -Xshare:off -Dfile.encoding=UTF8 -Duser.country=US -Duser.language=en -Dsun.java2d.pmoffscreen=false -Dsun.java2d.xrender=true -Dsun.java2d.d3d=false -Xdock:name="Ghidra" -Dvisualvm.display.name=Ghidra -Dpython.console.encoding=UTF-8 --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.desktop/sun.awt.image=ALL-UNNAMED"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-XX:+IgnoreUnrecognizedVMOptions -Djava.system.class.loader=ghidra.GhidraClassLoader -Xshare:off -Dfile.encoding=UTF8 -Duser.country=US -Duser.language=en -Dsun.java2d.pmoffscreen=false -Dsun.java2d.xrender=true -Dsun.java2d.d3d=false -Xdock:name="Ghidra" -Dvisualvm.display.name=Ghidra -Dpython.console.encoding=UTF-8 --add-opens=java.desktop/sun.awt.image=ALL-UNNAMED"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:Framework Utility}"/>
|
||||
</launchConfiguration>
|
||||
|
||||
@@ -31,5 +31,5 @@
|
||||
<stringAttribute key="org.eclipse.jdt.launching.MODULE_NAME" value="Framework Utility"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="ghidra.GhidraRun"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="Framework Utility"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-XX:+IgnoreUnrecognizedVMOptions -Djava.system.class.loader=ghidra.GhidraClassLoader -Xshare:off -Dfile.encoding=UTF8 -Duser.country=US -Duser.language=en -Dsun.java2d.pmoffscreen=false -Dsun.java2d.xrender=true -Dsun.java2d.d3d=false -Xdock:name="Ghidra" -Dvisualvm.display.name=Ghidra -Dpython.console.encoding=UTF-8 --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.desktop/sun.awt.image=ALL-UNNAMED"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-XX:+IgnoreUnrecognizedVMOptions -Djava.system.class.loader=ghidra.GhidraClassLoader -Xshare:off -Dfile.encoding=UTF8 -Duser.country=US -Duser.language=en -Dsun.java2d.pmoffscreen=false -Dsun.java2d.xrender=true -Dsun.java2d.d3d=false -Xdock:name="Ghidra" -Dvisualvm.display.name=Ghidra -Dpython.console.encoding=UTF-8 --add-opens=java.desktop/sun.awt.image=ALL-UNNAMED"/>
|
||||
</launchConfiguration>
|
||||
|
||||
@@ -24,7 +24,6 @@ import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import generic.continues.RethrowContinuesFactory;
|
||||
import ghidra.app.script.GhidraScript;
|
||||
import ghidra.app.util.bin.ByteProvider;
|
||||
import ghidra.app.util.bin.MemoryByteProvider;
|
||||
@@ -48,8 +47,7 @@ public class PortableExecutableRichPrintScript extends GhidraScript {
|
||||
PortableExecutable pe = null;
|
||||
|
||||
try {
|
||||
pe = PortableExecutable.createPortableExecutable(RethrowContinuesFactory.INSTANCE,
|
||||
provider, SectionLayout.MEMORY, false, false);
|
||||
pe = new PortableExecutable(provider, SectionLayout.MEMORY, false, false);
|
||||
}
|
||||
catch (Exception e) {
|
||||
printerr("Unable to create PE from current program");
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
/* ###
|
||||
* IP: GHIDRA
|
||||
* REVIEWED: YES
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,7 +18,9 @@
|
||||
//are placed in the same directory with the processor name appended.
|
||||
//@category Binary
|
||||
|
||||
import generic.continues.RethrowContinuesFactory;
|
||||
import java.io.*;
|
||||
import java.util.List;
|
||||
|
||||
import ghidra.app.script.GhidraScript;
|
||||
import ghidra.app.util.bin.ByteProvider;
|
||||
import ghidra.app.util.bin.RandomAccessByteProvider;
|
||||
@@ -28,9 +29,6 @@ import ghidra.app.util.bin.format.ubi.FatArch;
|
||||
import ghidra.app.util.bin.format.ubi.FatHeader;
|
||||
import ghidra.program.model.lang.Processor;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class SplitUniversalBinariesScript extends GhidraScript {
|
||||
|
||||
@@ -40,7 +38,7 @@ public class SplitUniversalBinariesScript extends GhidraScript {
|
||||
File outputDirectory = askDirectory("Select Output Directory", "GO");
|
||||
|
||||
ByteProvider provider = new RandomAccessByteProvider(ubiFile) ;
|
||||
FatHeader header = FatHeader.createFatHeader(RethrowContinuesFactory.INSTANCE, provider);
|
||||
FatHeader header = new FatHeader(provider);
|
||||
|
||||
List<FatArch> architectures = header.getArchitectures();
|
||||
for (FatArch arch : architectures) {
|
||||
|
||||
+2
-3
@@ -17,7 +17,6 @@ package ghidra.app.cmd.formats;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import generic.continues.RethrowContinuesFactory;
|
||||
import ghidra.app.plugin.core.analysis.AnalysisWorker;
|
||||
import ghidra.app.plugin.core.analysis.AutoAnalysisManager;
|
||||
import ghidra.app.util.bin.ByteProvider;
|
||||
@@ -94,8 +93,8 @@ public class MachoBinaryAnalysisCommand extends FlatProgramAPI
|
||||
program.getAddressFactory().getDefaultAddressSpace());
|
||||
|
||||
try {
|
||||
MachHeader header = MachHeader.createMachHeader(RethrowContinuesFactory.INSTANCE,
|
||||
provider, getAddress(program).getOffset(), isRelativeToAddress);
|
||||
MachHeader header =
|
||||
new MachHeader(provider, getAddress(program).getOffset(), isRelativeToAddress);
|
||||
header.parse();
|
||||
|
||||
Address machAddress = getAddress(program);
|
||||
|
||||
+4
-10
@@ -18,12 +18,9 @@ package ghidra.app.cmd.formats;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import generic.continues.RethrowContinuesFactory;
|
||||
import ghidra.app.plugin.core.analysis.AnalysisWorker;
|
||||
import ghidra.app.plugin.core.analysis.AutoAnalysisManager;
|
||||
import ghidra.app.util.bin.ByteProvider;
|
||||
import ghidra.app.util.bin.MemoryByteProvider;
|
||||
import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
|
||||
import ghidra.app.util.bin.*;
|
||||
import ghidra.app.util.bin.format.mz.DOSHeader;
|
||||
import ghidra.app.util.bin.format.pe.*;
|
||||
import ghidra.app.util.bin.format.pe.PortableExecutable.SectionLayout;
|
||||
@@ -56,10 +53,9 @@ public class PortableExecutableBinaryAnalysisCommand extends FlatProgramAPI
|
||||
ByteProvider provider = new MemoryByteProvider(memory,
|
||||
program.getAddressFactory().getDefaultAddressSpace());
|
||||
|
||||
FactoryBundledWithBinaryReader reader = new FactoryBundledWithBinaryReader(
|
||||
RethrowContinuesFactory.INSTANCE, provider, !program.getLanguage().isBigEndian());
|
||||
BinaryReader reader = new BinaryReader(provider, !program.getLanguage().isBigEndian());
|
||||
|
||||
DOSHeader dosHeader = DOSHeader.createDOSHeader(reader);
|
||||
DOSHeader dosHeader = new DOSHeader(reader);
|
||||
|
||||
if (dosHeader.isDosSignature()) {
|
||||
|
||||
@@ -82,9 +78,7 @@ public class PortableExecutableBinaryAnalysisCommand extends FlatProgramAPI
|
||||
ByteProvider provider = new MemoryByteProvider(currentProgram.getMemory(),
|
||||
program.getAddressFactory().getDefaultAddressSpace());
|
||||
|
||||
PortableExecutable pe =
|
||||
PortableExecutable.createPortableExecutable(RethrowContinuesFactory.INSTANCE, provider,
|
||||
SectionLayout.FILE);
|
||||
PortableExecutable pe = new PortableExecutable(provider, SectionLayout.FILE);
|
||||
|
||||
DOSHeader dos = pe.getDOSHeader();
|
||||
if (dos == null || dos.e_magic() != DOSHeader.IMAGE_DOS_SIGNATURE) {
|
||||
|
||||
+5
-7
@@ -15,7 +15,10 @@
|
||||
*/
|
||||
package ghidra.app.plugin.core.analysis;
|
||||
|
||||
import generic.continues.RethrowContinuesFactory;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import ghidra.app.services.*;
|
||||
import ghidra.app.util.bin.*;
|
||||
import ghidra.app.util.bin.format.dwarf.DwarfSectionNames;
|
||||
@@ -32,10 +35,6 @@ import ghidra.util.Msg;
|
||||
import ghidra.util.exception.CancelledException;
|
||||
import ghidra.util.task.TaskMonitor;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
public class DwarfLineNumberAnalyzer extends AbstractAnalyzer {
|
||||
private static final String NAME = "DWARF Line Number";
|
||||
private static final String DESCRIPTION = "Extracts DWARF debug line number information.";
|
||||
@@ -114,8 +113,7 @@ public class DwarfLineNumberAnalyzer extends AbstractAnalyzer {
|
||||
}
|
||||
RandomAccessByteProvider provider = new RandomAccessByteProvider(dSymFile);
|
||||
try {
|
||||
MachHeader header =
|
||||
MachHeader.createMachHeader(RethrowContinuesFactory.INSTANCE, provider);
|
||||
MachHeader header = new MachHeader(provider);
|
||||
header.parse();
|
||||
List<Section> allSections = header.getAllSections();
|
||||
for (Section section : allSections) {
|
||||
|
||||
+2
-6
@@ -19,7 +19,6 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
import generic.continues.GenericFactory;
|
||||
import ghidra.app.cmd.function.CreateFunctionCmd;
|
||||
import ghidra.app.services.*;
|
||||
import ghidra.app.util.PseudoDisassembler;
|
||||
@@ -29,7 +28,6 @@ import ghidra.app.util.bin.format.macho.MachHeader;
|
||||
import ghidra.app.util.bin.format.macho.commands.*;
|
||||
import ghidra.app.util.bin.format.macho.dyld.*;
|
||||
import ghidra.app.util.importer.MessageLog;
|
||||
import ghidra.app.util.importer.MessageLogContinuesFactory;
|
||||
import ghidra.app.util.opinion.DyldCacheLoader;
|
||||
import ghidra.app.util.opinion.MachoLoader;
|
||||
import ghidra.framework.options.Options;
|
||||
@@ -170,8 +168,7 @@ public class MachoFunctionStartsAnalyzer extends AbstractAnalyzer {
|
||||
private void analyzeMachoFunctionStarts(Program program, ByteProvider provider,
|
||||
AddressSetView set, TaskMonitor monitor, MessageLog log)
|
||||
throws MachException, IOException, CancelledException {
|
||||
GenericFactory factory = MessageLogContinuesFactory.create(log);
|
||||
MachHeader header = MachHeader.createMachHeader(factory, provider);
|
||||
MachHeader header = new MachHeader(provider);
|
||||
header.parse();
|
||||
monitor.setIndeterminate(true);
|
||||
monitor.setMessage("Analyzing function starts...");
|
||||
@@ -215,8 +212,7 @@ public class MachoFunctionStartsAnalyzer extends AbstractAnalyzer {
|
||||
monitor.incrementProgress(1);
|
||||
|
||||
// Parse Mach-O header
|
||||
MachHeader machoHeader = MachHeader.createMachHeader(
|
||||
MessageLogContinuesFactory.create(log), providerMap.get(dyldCacheHeader),
|
||||
MachHeader machoHeader = new MachHeader(providerMap.get(dyldCacheHeader),
|
||||
mappedImage.getAddress() - dyldCacheHeader.getBaseAddress(), false);
|
||||
machoHeader.parse();
|
||||
|
||||
|
||||
-37
@@ -1,37 +0,0 @@
|
||||
/* ###
|
||||
* IP: GHIDRA
|
||||
* REVIEWED: YES
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package ghidra.app.util.bin.format;
|
||||
|
||||
import generic.continues.*;
|
||||
import ghidra.app.util.bin.*;
|
||||
|
||||
public class FactoryBundledWithBinaryReader extends BinaryReader {
|
||||
private final GenericFactory factory;
|
||||
|
||||
public GenericFactory getFactory() {
|
||||
return factory;
|
||||
}
|
||||
|
||||
public FactoryBundledWithBinaryReader(GenericFactory factory,
|
||||
ByteProvider provider, boolean isLittleEndian) {
|
||||
super(provider, isLittleEndian);
|
||||
if (factory == null) {
|
||||
throw new IllegalArgumentException("factory == null not allowed");
|
||||
}
|
||||
this.factory = factory;
|
||||
}
|
||||
}
|
||||
+1
-2
@@ -20,7 +20,6 @@ import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import generic.continues.RethrowContinuesFactory;
|
||||
import ghidra.app.util.bin.*;
|
||||
import ghidra.app.util.bin.format.macho.*;
|
||||
import ghidra.app.util.opinion.MachoLoader;
|
||||
@@ -62,7 +61,7 @@ public class DSymSectionProvider implements DWARFSectionProvider {
|
||||
public DSymSectionProvider(File dsymFile) throws IOException, MachException {
|
||||
this.provider = new RandomAccessByteProvider(dsymFile);
|
||||
|
||||
machHeader = MachHeader.createMachHeader(RethrowContinuesFactory.INSTANCE, provider);
|
||||
machHeader = new MachHeader(provider);
|
||||
machHeader.parse();
|
||||
for (Section s : machHeader.getAllSections()) {
|
||||
// strip leading "_"'s from section name to normalize
|
||||
|
||||
+31
-38
@@ -19,9 +19,7 @@ import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import generic.continues.GenericFactory;
|
||||
import ghidra.app.util.bin.*;
|
||||
import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
|
||||
import ghidra.app.util.bin.format.macho.commands.*;
|
||||
import ghidra.program.model.data.*;
|
||||
import ghidra.util.exception.DuplicateNameException;
|
||||
@@ -44,7 +42,7 @@ public class MachHeader implements StructConverter {
|
||||
private boolean _is32bit;
|
||||
private List<LoadCommand> _commands = new ArrayList<>();
|
||||
private long _commandIndex;
|
||||
private FactoryBundledWithBinaryReader _reader;
|
||||
private BinaryReader _reader;
|
||||
private long _machHeaderStartIndexInProvider;
|
||||
private long _machHeaderStartIndex = 0;
|
||||
private boolean _parsed = false;
|
||||
@@ -65,58 +63,49 @@ public class MachHeader implements StructConverter {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Assumes the MachHeader starts at index 0 in the ByteProvider.
|
||||
* Creates a new {@link MachHeader}. Assumes the MachHeader starts at index 0 in the
|
||||
* ByteProvider.
|
||||
*
|
||||
* @param provider the ByteProvider
|
||||
* @throws IOException if an I/O error occurs while reading from the ByteProvider
|
||||
* @throws MachException if an invalid MachHeader is detected
|
||||
*/
|
||||
public static MachHeader createMachHeader(GenericFactory factory, ByteProvider provider)
|
||||
throws IOException, MachException {
|
||||
return createMachHeader(factory, provider, 0);
|
||||
public MachHeader(ByteProvider provider) throws IOException, MachException {
|
||||
this(provider, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assumes the MachHeader starts at index <i>machHeaderStartIndexInProvider</i> in the ByteProvider.
|
||||
* Creates a new {@link MachHeader}. Assumes the MachHeader starts at index
|
||||
* <i>machHeaderStartIndexInProvider</i> in the ByteProvider.
|
||||
*
|
||||
* @param provider the ByteProvider
|
||||
* @param machHeaderStartIndexInProvider the index into the ByteProvider where the MachHeader begins.
|
||||
* @param machHeaderStartIndexInProvider the index into the ByteProvider where the MachHeader
|
||||
* begins
|
||||
* @throws IOException if an I/O error occurs while reading from the ByteProvider
|
||||
* @throws MachException if an invalid MachHeader is detected
|
||||
*/
|
||||
public static MachHeader createMachHeader(GenericFactory factory, ByteProvider provider,
|
||||
long machHeaderStartIndexInProvider) throws IOException, MachException {
|
||||
MachHeader machHeader = (MachHeader) factory.create(MachHeader.class);
|
||||
machHeader.initMachHeader(factory, provider, machHeaderStartIndexInProvider, true);
|
||||
return machHeader;
|
||||
public MachHeader(ByteProvider provider, long machHeaderStartIndexInProvider)
|
||||
throws IOException, MachException {
|
||||
this(provider, machHeaderStartIndexInProvider, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assumes the MachHeader starts at index <i>machHeaderStartIndexInProvider</i> in the ByteProvider.
|
||||
* Creatse a new {@link MachHeader}. Assumes the MachHeader starts at index
|
||||
* <i>machHeaderStartIndexInProvider</i> in the ByteProvider.
|
||||
*
|
||||
* @param provider the ByteProvider
|
||||
* @param machHeaderStartIndexInProvider the index into the ByteProvider where the MachHeader begins.
|
||||
* @param isRemainingMachoRelativeToStartIndex TRUE if the rest of the macho uses relative indexing. This is common in UBI and kernel cache files.
|
||||
* FALSE if the rest of the file uses absolute indexing from 0. This is common in DYLD cache files.
|
||||
* @param machHeaderStartIndexInProvider the index into the ByteProvider where the MachHeader
|
||||
* begins.
|
||||
* @param isRemainingMachoRelativeToStartIndex true if the rest of the macho uses relative
|
||||
* indexin (this is common in UBI and kernel cache files); otherwise, false if the rest of the
|
||||
* file uses absolute indexing from 0 (this is common in DYLD cache files)
|
||||
* @throws IOException if an I/O error occurs while reading from the ByteProvider
|
||||
* @throws MachException if an invalid MachHeader is detected
|
||||
*/
|
||||
public static MachHeader createMachHeader(GenericFactory factory, ByteProvider provider,
|
||||
long machHeaderStartIndexInProvider, boolean isRemainingMachoRelativeToStartIndex)
|
||||
throws IOException, MachException {
|
||||
MachHeader machHeader = (MachHeader) factory.create(MachHeader.class);
|
||||
machHeader.initMachHeader(factory, provider, machHeaderStartIndexInProvider,
|
||||
isRemainingMachoRelativeToStartIndex);
|
||||
return machHeader;
|
||||
}
|
||||
|
||||
/**
|
||||
* DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
|
||||
*/
|
||||
public MachHeader() {
|
||||
}
|
||||
|
||||
private void initMachHeader(GenericFactory factory, ByteProvider provider,
|
||||
long machHeaderStartIndexInProvider, boolean isRemainingMachoRelativeToStartIndex)
|
||||
throws IOException, MachException {
|
||||
public MachHeader(ByteProvider provider, long machHeaderStartIndexInProvider,
|
||||
boolean isRemainingMachoRelativeToStartIndex) throws IOException, MachException {
|
||||
magic = readMagic(provider, machHeaderStartIndexInProvider);
|
||||
|
||||
if (!MachConstants.isMagic(magic)) {
|
||||
@@ -128,7 +117,7 @@ public class MachHeader implements StructConverter {
|
||||
}
|
||||
|
||||
_machHeaderStartIndexInProvider = machHeaderStartIndexInProvider;
|
||||
_reader = new FactoryBundledWithBinaryReader(factory, provider, isLittleEndian());
|
||||
_reader = new BinaryReader(provider, isLittleEndian());
|
||||
_reader.setPointerIndex(machHeaderStartIndexInProvider + 4);//skip magic number...
|
||||
|
||||
cpuType = _reader.readNextInt();
|
||||
@@ -219,13 +208,17 @@ public class MachHeader implements StructConverter {
|
||||
* Returns the start index that should be used for calculating offsets.
|
||||
* This will be 0 for things such as the dyld shared cache where offsets are
|
||||
* based off the beginning of the file.
|
||||
*
|
||||
* @return the start index that should be used for calculating offsets
|
||||
*/
|
||||
public long getStartIndex() {
|
||||
return _machHeaderStartIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns offset of MachHeader in the ByteProvider
|
||||
* Returns the offset of the MachHeader in the ByteProvider
|
||||
*
|
||||
* @return the offset of the MachHeader in the ByteProvider
|
||||
*/
|
||||
public long getStartIndexInProvider() {
|
||||
return _machHeaderStartIndexInProvider;
|
||||
|
||||
+2
-14
@@ -17,8 +17,8 @@ package ghidra.app.util.bin.format.macho;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import ghidra.app.util.bin.BinaryReader;
|
||||
import ghidra.app.util.bin.StructConverter;
|
||||
import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
|
||||
import ghidra.program.model.data.*;
|
||||
import ghidra.util.exception.DuplicateNameException;
|
||||
|
||||
@@ -72,19 +72,7 @@ public class RelocationInfo implements StructConverter {
|
||||
*/
|
||||
private int r_type;
|
||||
|
||||
public static RelocationInfo createRelocationInfo(FactoryBundledWithBinaryReader reader)
|
||||
throws IOException {
|
||||
RelocationInfo relocationInfo =
|
||||
(RelocationInfo) reader.getFactory().create(RelocationInfo.class);
|
||||
relocationInfo.initRelocationInfo(reader);
|
||||
return relocationInfo;
|
||||
}
|
||||
|
||||
public RelocationInfo() {
|
||||
}
|
||||
|
||||
private void initRelocationInfo(FactoryBundledWithBinaryReader reader) throws IOException {
|
||||
|
||||
public RelocationInfo(BinaryReader reader) throws IOException {
|
||||
int i1 = reader.readNextInt();
|
||||
int i2 = reader.readNextInt();
|
||||
|
||||
|
||||
@@ -20,8 +20,8 @@ import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import ghidra.app.util.bin.BinaryReader;
|
||||
import ghidra.app.util.bin.StructConverter;
|
||||
import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
|
||||
import ghidra.app.util.bin.format.macho.commands.SegmentNames;
|
||||
import ghidra.program.model.data.*;
|
||||
import ghidra.util.exception.DuplicateNameException;
|
||||
@@ -46,25 +46,11 @@ public class Section implements StructConverter {
|
||||
private int reserved2;
|
||||
private int reserved3;//only used for 64 bit
|
||||
|
||||
private FactoryBundledWithBinaryReader reader;
|
||||
private BinaryReader reader;
|
||||
private boolean is32bit;
|
||||
private List<RelocationInfo> relocations = new ArrayList<>();
|
||||
|
||||
public static Section createSection(FactoryBundledWithBinaryReader reader, boolean is32bit)
|
||||
throws IOException {
|
||||
Section section = (Section) reader.getFactory().create(Section.class);
|
||||
section.initSection(reader, is32bit);
|
||||
return section;
|
||||
}
|
||||
|
||||
/**
|
||||
* DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
|
||||
*/
|
||||
public Section() {
|
||||
}
|
||||
|
||||
private void initSection(FactoryBundledWithBinaryReader reader, boolean is32bit)
|
||||
throws IOException {
|
||||
public Section(BinaryReader reader, boolean is32bit) throws IOException {
|
||||
this.reader = reader;
|
||||
this.is32bit = is32bit;
|
||||
|
||||
@@ -93,7 +79,7 @@ public class Section implements StructConverter {
|
||||
long index = reader.getPointerIndex();
|
||||
reader.setPointerIndex(reloff);
|
||||
for (int i = 0; i < nrelocs; ++i) {
|
||||
relocations.add(RelocationInfo.createRelocationInfo(reader));
|
||||
relocations.add(new RelocationInfo(reader));
|
||||
}
|
||||
reader.setPointerIndex(index);
|
||||
}
|
||||
|
||||
+2
-17
@@ -17,8 +17,8 @@ package ghidra.app.util.bin.format.macho.commands;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import ghidra.app.util.bin.BinaryReader;
|
||||
import ghidra.app.util.bin.StructConverter;
|
||||
import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
|
||||
import ghidra.app.util.bin.format.macho.MachConstants;
|
||||
import ghidra.app.util.bin.format.macho.MachHeader;
|
||||
import ghidra.app.util.importer.MessageLog;
|
||||
@@ -42,22 +42,7 @@ public class BuildVersionCommand extends LoadCommand {
|
||||
private int ntools;
|
||||
private BuildToolVersion[] buildToolVersions;
|
||||
|
||||
static BuildVersionCommand createBuildVersionCommand(FactoryBundledWithBinaryReader reader)
|
||||
throws IOException {
|
||||
|
||||
BuildVersionCommand command =
|
||||
(BuildVersionCommand) reader.getFactory().create(BuildVersionCommand.class);
|
||||
command.initEntryPointCommand(reader);
|
||||
return command;
|
||||
}
|
||||
|
||||
/**
|
||||
* DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
|
||||
*/
|
||||
public BuildVersionCommand() {
|
||||
}
|
||||
|
||||
private void initEntryPointCommand(FactoryBundledWithBinaryReader reader) throws IOException {
|
||||
BuildVersionCommand(BinaryReader reader) throws IOException {
|
||||
initLoadCommand(reader);
|
||||
|
||||
platform = reader.readNextInt();
|
||||
|
||||
+4
-19
@@ -17,8 +17,8 @@ package ghidra.app.util.bin.format.macho.commands;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import ghidra.app.util.bin.BinaryReader;
|
||||
import ghidra.app.util.bin.StructConverter;
|
||||
import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
|
||||
import ghidra.app.util.bin.format.macho.MachConstants;
|
||||
import ghidra.program.model.data.*;
|
||||
import ghidra.util.exception.DuplicateNameException;
|
||||
@@ -41,22 +41,7 @@ public class DyldChainedFixupHeader implements StructConverter {
|
||||
DyldChainedStartsInImage chainedStartsInImage;
|
||||
DyldChainedImports chainedImports;
|
||||
|
||||
static DyldChainedFixupHeader createDyldChainedFixupHeader(
|
||||
FactoryBundledWithBinaryReader reader) throws IOException {
|
||||
DyldChainedFixupHeader dyldChainedFixupHeader =
|
||||
(DyldChainedFixupHeader) reader.getFactory().create(DyldChainedFixupHeader.class);
|
||||
dyldChainedFixupHeader.initDyldChainedFixupHeader(reader);
|
||||
return dyldChainedFixupHeader;
|
||||
}
|
||||
|
||||
/**
|
||||
* DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
|
||||
*/
|
||||
public DyldChainedFixupHeader() {
|
||||
}
|
||||
|
||||
private void initDyldChainedFixupHeader(FactoryBundledWithBinaryReader reader)
|
||||
throws IOException {
|
||||
DyldChainedFixupHeader(BinaryReader reader) throws IOException {
|
||||
long ptrIndex = reader.getPointerIndex();
|
||||
|
||||
fixups_version = reader.readNextInt();
|
||||
@@ -68,10 +53,10 @@ public class DyldChainedFixupHeader implements StructConverter {
|
||||
symbols_format = reader.readNextInt();
|
||||
|
||||
reader.setPointerIndex(ptrIndex + starts_offset);
|
||||
chainedStartsInImage = DyldChainedStartsInImage.createDyldChainedStartsInImage(reader);
|
||||
chainedStartsInImage = new DyldChainedStartsInImage(reader);
|
||||
|
||||
reader.setPointerIndex(ptrIndex + imports_offset);
|
||||
chainedImports = DyldChainedImports.createDyldChainedImports(reader, this);
|
||||
chainedImports = new DyldChainedImports(reader, this);
|
||||
|
||||
reader.setPointerIndex(ptrIndex + symbols_offset);
|
||||
chainedImports.initSymbols(reader, this);
|
||||
|
||||
+5
-16
@@ -18,7 +18,7 @@ package ghidra.app.util.bin.format.macho.commands;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
|
||||
import ghidra.app.util.bin.BinaryReader;
|
||||
import ghidra.app.util.bin.format.macho.MachHeader;
|
||||
import ghidra.app.util.importer.MessageLog;
|
||||
import ghidra.program.flatapi.FlatProgramAPI;
|
||||
@@ -38,24 +38,13 @@ public class DyldChainedFixupsCommand extends LinkEditDataCommand {
|
||||
|
||||
private DyldChainedFixupHeader chainHeader;
|
||||
|
||||
static LinkEditDataCommand createDyldChainedFixupsCommand(FactoryBundledWithBinaryReader reader)
|
||||
throws IOException {
|
||||
DyldChainedFixupsCommand command =
|
||||
(DyldChainedFixupsCommand) reader.getFactory().create(DyldChainedFixupsCommand.class);
|
||||
command.initLinkEditDataCommand(reader);
|
||||
DyldChainedFixupsCommand(BinaryReader reader) throws IOException {
|
||||
super(reader);
|
||||
|
||||
long ptrIndex = reader.getPointerIndex();
|
||||
reader.setPointerIndex(command.getDataOffset());
|
||||
command.chainHeader = DyldChainedFixupHeader.createDyldChainedFixupHeader(reader);
|
||||
reader.setPointerIndex(getDataOffset());
|
||||
chainHeader = new DyldChainedFixupHeader(reader);
|
||||
reader.setPointerIndex(ptrIndex);
|
||||
|
||||
return command;
|
||||
}
|
||||
|
||||
/**
|
||||
* DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
|
||||
*/
|
||||
public DyldChainedFixupsCommand() {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+7
-22
@@ -17,8 +17,8 @@ package ghidra.app.util.bin.format.macho.commands;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import ghidra.app.util.bin.BinaryReader;
|
||||
import ghidra.app.util.bin.StructConverter;
|
||||
import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
|
||||
import ghidra.app.util.bin.format.macho.MachConstants;
|
||||
import ghidra.program.model.data.*;
|
||||
import ghidra.util.exception.DuplicateNameException;
|
||||
@@ -40,25 +40,10 @@ public class DyldChainedImport implements StructConverter {
|
||||
private long addend;
|
||||
private String symbolName;
|
||||
|
||||
static DyldChainedImport createDyldChainedImport(FactoryBundledWithBinaryReader reader,
|
||||
DyldChainedFixupHeader cfh, int imports_format) throws IOException {
|
||||
DyldChainedImport dyldChainedImport =
|
||||
(DyldChainedImport) reader.getFactory().create(DyldChainedImport.class);
|
||||
dyldChainedImport.initDyldChainedImport(reader, cfh, imports_format);
|
||||
return dyldChainedImport;
|
||||
}
|
||||
|
||||
/**
|
||||
* DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
|
||||
*/
|
||||
public DyldChainedImport() {
|
||||
}
|
||||
|
||||
private void initDyldChainedImport(FactoryBundledWithBinaryReader reader,
|
||||
DyldChainedFixupHeader cfh, int format) throws IOException {
|
||||
|
||||
this.imports_format = format;
|
||||
switch (format) {
|
||||
DyldChainedImport(BinaryReader reader, DyldChainedFixupHeader cfh, int imports_format)
|
||||
throws IOException {
|
||||
this.imports_format = imports_format;
|
||||
switch (imports_format) {
|
||||
case DYLD_CHAINED_IMPORT: {
|
||||
int ival = reader.readNextInt();
|
||||
lib_ordinal = ival & 0xff;
|
||||
@@ -83,7 +68,7 @@ public class DyldChainedImport implements StructConverter {
|
||||
break;
|
||||
}
|
||||
default:
|
||||
throw new IOException("Bad Chained import format: " + format);
|
||||
throw new IOException("Bad Chained import format: " + imports_format);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,7 +127,7 @@ public class DyldChainedImport implements StructConverter {
|
||||
return symbolName;
|
||||
}
|
||||
|
||||
public void initString(FactoryBundledWithBinaryReader reader) throws IOException {
|
||||
public void initString(BinaryReader reader) throws IOException {
|
||||
symbolName = reader.readNextNullTerminatedAsciiString();
|
||||
}
|
||||
|
||||
|
||||
+5
-21
@@ -18,8 +18,8 @@ package ghidra.app.util.bin.format.macho.commands;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import ghidra.app.util.bin.BinaryReader;
|
||||
import ghidra.app.util.bin.StructConverter;
|
||||
import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
|
||||
import ghidra.program.model.data.ArrayDataType;
|
||||
import ghidra.program.model.data.DataType;
|
||||
import ghidra.util.exception.DuplicateNameException;
|
||||
@@ -36,23 +36,7 @@ public class DyldChainedImports implements StructConverter {
|
||||
private long imports_offset;
|
||||
private DyldChainedImport chainedImports[];
|
||||
|
||||
static DyldChainedImports createDyldChainedImports(FactoryBundledWithBinaryReader reader,
|
||||
DyldChainedFixupHeader cfh) throws IOException {
|
||||
DyldChainedImports dyldChainedImports =
|
||||
(DyldChainedImports) reader.getFactory().create(DyldChainedImports.class);
|
||||
dyldChainedImports.initDyldChainedStartsInImage(reader, cfh);
|
||||
return dyldChainedImports;
|
||||
}
|
||||
|
||||
/**
|
||||
* DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
|
||||
*/
|
||||
public DyldChainedImports() {
|
||||
}
|
||||
|
||||
private void initDyldChainedStartsInImage(FactoryBundledWithBinaryReader reader,
|
||||
DyldChainedFixupHeader cfh) throws IOException {
|
||||
|
||||
DyldChainedImports(BinaryReader reader, DyldChainedFixupHeader cfh) throws IOException {
|
||||
long ptrIndex = reader.getPointerIndex();
|
||||
imports_offset = ptrIndex;
|
||||
|
||||
@@ -61,7 +45,7 @@ public class DyldChainedImports implements StructConverter {
|
||||
|
||||
ArrayList<DyldChainedImport> starts = new ArrayList<>();
|
||||
for (int i = 0; i < imports_count; i++) {
|
||||
starts.add(DyldChainedImport.createDyldChainedImport(reader, cfh, imports_format));
|
||||
starts.add(new DyldChainedImport(reader, cfh, imports_format));
|
||||
}
|
||||
chainedImports = starts.toArray(DyldChainedImport[]::new);
|
||||
}
|
||||
@@ -94,8 +78,8 @@ public class DyldChainedImports implements StructConverter {
|
||||
return chainedImports[ordinal];
|
||||
}
|
||||
|
||||
public void initSymbols(FactoryBundledWithBinaryReader reader,
|
||||
DyldChainedFixupHeader dyldChainedFixupHeader) throws IOException {
|
||||
public void initSymbols(BinaryReader reader, DyldChainedFixupHeader dyldChainedFixupHeader)
|
||||
throws IOException {
|
||||
long ptrIndex = reader.getPointerIndex();
|
||||
|
||||
for (DyldChainedImport dyldChainedImport : chainedImports) {
|
||||
|
||||
+3
-18
@@ -18,8 +18,8 @@ package ghidra.app.util.bin.format.macho.commands;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import ghidra.app.util.bin.BinaryReader;
|
||||
import ghidra.app.util.bin.StructConverter;
|
||||
import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
|
||||
import ghidra.app.util.bin.format.macho.MachConstants;
|
||||
import ghidra.program.model.data.*;
|
||||
import ghidra.util.exception.DuplicateNameException;
|
||||
@@ -36,22 +36,7 @@ public class DyldChainedStartsInImage implements StructConverter {
|
||||
|
||||
private DyldChainedStartsInSegment chainedStarts[];
|
||||
|
||||
static DyldChainedStartsInImage createDyldChainedStartsInImage(
|
||||
FactoryBundledWithBinaryReader reader) throws IOException {
|
||||
DyldChainedStartsInImage dyldChainedStartsInImage =
|
||||
(DyldChainedStartsInImage) reader.getFactory().create(DyldChainedStartsInImage.class);
|
||||
dyldChainedStartsInImage.initDyldChainedStartsInImage(reader);
|
||||
return dyldChainedStartsInImage;
|
||||
}
|
||||
|
||||
/**
|
||||
* DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
|
||||
*/
|
||||
public DyldChainedStartsInImage() {
|
||||
}
|
||||
|
||||
private void initDyldChainedStartsInImage(FactoryBundledWithBinaryReader reader)
|
||||
throws IOException {
|
||||
DyldChainedStartsInImage(BinaryReader reader) throws IOException {
|
||||
|
||||
long ptrIndex = reader.getPointerIndex();
|
||||
|
||||
@@ -62,7 +47,7 @@ public class DyldChainedStartsInImage implements StructConverter {
|
||||
for (int off : seg_info_offset) {
|
||||
|
||||
reader.setPointerIndex(ptrIndex + off);
|
||||
starts.add(DyldChainedStartsInSegment.createDyldChainedFixupHeader(reader));
|
||||
starts.add(new DyldChainedStartsInSegment(reader));
|
||||
}
|
||||
chainedStarts = starts.toArray(DyldChainedStartsInSegment[]::new);
|
||||
}
|
||||
|
||||
+2
-18
@@ -17,8 +17,8 @@ package ghidra.app.util.bin.format.macho.commands;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import ghidra.app.util.bin.BinaryReader;
|
||||
import ghidra.app.util.bin.StructConverter;
|
||||
import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
|
||||
import ghidra.app.util.bin.format.macho.MachConstants;
|
||||
import ghidra.program.model.data.*;
|
||||
import ghidra.util.exception.DuplicateNameException;
|
||||
@@ -39,23 +39,7 @@ public class DyldChainedStartsInSegment implements StructConverter {
|
||||
private short page_starts[]; // each entry is offset in each page of first element in chain
|
||||
private short chain_starts[]; // TODO: used for some 32-bit formats with multiple starts per page
|
||||
|
||||
static DyldChainedStartsInSegment createDyldChainedFixupHeader(
|
||||
FactoryBundledWithBinaryReader reader) throws IOException {
|
||||
DyldChainedStartsInSegment dyldChainedFixupHeader =
|
||||
(DyldChainedStartsInSegment) reader.getFactory().create(
|
||||
DyldChainedStartsInSegment.class);
|
||||
dyldChainedFixupHeader.initDyldChainedStartsInSegment(reader);
|
||||
return dyldChainedFixupHeader;
|
||||
}
|
||||
|
||||
/**
|
||||
* DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
|
||||
*/
|
||||
public DyldChainedStartsInSegment() {
|
||||
}
|
||||
|
||||
private void initDyldChainedStartsInSegment(FactoryBundledWithBinaryReader reader)
|
||||
throws IOException {
|
||||
DyldChainedStartsInSegment(BinaryReader reader) throws IOException {
|
||||
size = reader.readNextInt();
|
||||
page_size = reader.readNextShort();
|
||||
pointer_format = reader.readNextShort();
|
||||
|
||||
+2
-16
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.macho.commands;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
|
||||
import ghidra.app.util.bin.BinaryReader;
|
||||
import ghidra.app.util.bin.format.macho.MachConstants;
|
||||
import ghidra.app.util.bin.format.macho.MachHeader;
|
||||
import ghidra.app.util.importer.MessageLog;
|
||||
@@ -45,21 +45,7 @@ public class DyldInfoCommand extends LoadCommand {
|
||||
private int export_off;
|
||||
private int export_size;
|
||||
|
||||
static DyldInfoCommand createDyldInfoCommand(FactoryBundledWithBinaryReader reader)
|
||||
throws IOException {
|
||||
DyldInfoCommand command =
|
||||
(DyldInfoCommand) reader.getFactory().create(DyldInfoCommand.class);
|
||||
command.initDyldInfoCommand(reader);
|
||||
return command;
|
||||
}
|
||||
|
||||
/**
|
||||
* DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
|
||||
*/
|
||||
public DyldInfoCommand() {
|
||||
}
|
||||
|
||||
private void initDyldInfoCommand(FactoryBundledWithBinaryReader reader) throws IOException {
|
||||
DyldInfoCommand(BinaryReader reader) throws IOException {
|
||||
initLoadCommand(reader);
|
||||
|
||||
rebase_off = reader.readNextInt();
|
||||
|
||||
+3
-18
@@ -17,8 +17,8 @@ package ghidra.app.util.bin.format.macho.commands;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import ghidra.app.util.bin.BinaryReader;
|
||||
import ghidra.app.util.bin.StructConverter;
|
||||
import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
|
||||
import ghidra.app.util.bin.format.macho.MachConstants;
|
||||
import ghidra.program.model.data.*;
|
||||
import ghidra.util.exception.DuplicateNameException;
|
||||
@@ -34,23 +34,8 @@ public class DynamicLibrary implements StructConverter {
|
||||
private int current_version;
|
||||
private int compatibility_version;
|
||||
|
||||
public static DynamicLibrary createDynamicLibrary(FactoryBundledWithBinaryReader reader,
|
||||
LoadCommand command) throws IOException {
|
||||
DynamicLibrary dynamicLibrary =
|
||||
(DynamicLibrary) reader.getFactory().create(DynamicLibrary.class);
|
||||
dynamicLibrary.initDynamicLibrary(reader, command);
|
||||
return dynamicLibrary;
|
||||
}
|
||||
|
||||
/**
|
||||
* DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
|
||||
*/
|
||||
public DynamicLibrary() {
|
||||
}
|
||||
|
||||
private void initDynamicLibrary(FactoryBundledWithBinaryReader reader, LoadCommand command)
|
||||
throws IOException {
|
||||
name = LoadCommandString.createLoadCommandString(reader, command);
|
||||
public DynamicLibrary(BinaryReader reader, LoadCommand command) throws IOException {
|
||||
name = new LoadCommandString(reader, command);
|
||||
timestamp = reader.readNextInt();
|
||||
current_version = reader.readNextInt();
|
||||
compatibility_version = reader.readNextInt();
|
||||
|
||||
+3
-18
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.macho.commands;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
|
||||
import ghidra.app.util.bin.BinaryReader;
|
||||
import ghidra.app.util.bin.format.macho.MachConstants;
|
||||
import ghidra.app.util.bin.format.macho.MachHeader;
|
||||
import ghidra.app.util.importer.MessageLog;
|
||||
@@ -36,24 +36,9 @@ import ghidra.util.task.TaskMonitor;
|
||||
public class DynamicLibraryCommand extends LoadCommand {
|
||||
private DynamicLibrary dylib;
|
||||
|
||||
static DynamicLibraryCommand createDynamicLibraryCommand(FactoryBundledWithBinaryReader reader)
|
||||
throws IOException {
|
||||
DynamicLibraryCommand dynamicLibraryCommand =
|
||||
(DynamicLibraryCommand) reader.getFactory().create(DynamicLibraryCommand.class);
|
||||
dynamicLibraryCommand.initDynamicLibraryCommand(reader);
|
||||
return dynamicLibraryCommand;
|
||||
}
|
||||
|
||||
/**
|
||||
* DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
|
||||
*/
|
||||
public DynamicLibraryCommand() {
|
||||
}
|
||||
|
||||
private void initDynamicLibraryCommand(FactoryBundledWithBinaryReader reader)
|
||||
throws IOException {
|
||||
DynamicLibraryCommand(BinaryReader reader) throws IOException {
|
||||
initLoadCommand(reader);
|
||||
dylib = DynamicLibrary.createDynamicLibrary(reader, this);
|
||||
dylib = new DynamicLibrary(reader, this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+8
-20
@@ -15,13 +15,14 @@
|
||||
*/
|
||||
package ghidra.app.util.bin.format.macho.commands;
|
||||
|
||||
import ghidra.app.util.bin.*;
|
||||
import ghidra.app.util.bin.format.*;
|
||||
import ghidra.app.util.bin.format.macho.*;
|
||||
import ghidra.program.model.data.*;
|
||||
import ghidra.util.exception.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import java.io.*;
|
||||
import ghidra.app.util.bin.BinaryReader;
|
||||
import ghidra.app.util.bin.StructConverter;
|
||||
import ghidra.app.util.bin.format.macho.MachConstants;
|
||||
import ghidra.app.util.bin.format.macho.MachHeader;
|
||||
import ghidra.program.model.data.*;
|
||||
import ghidra.util.exception.DuplicateNameException;
|
||||
|
||||
public class DynamicLibraryModule implements StructConverter {
|
||||
private int module_name; // the module name (index into string table)
|
||||
@@ -41,20 +42,7 @@ public class DynamicLibraryModule implements StructConverter {
|
||||
private boolean is32bit;
|
||||
private String moduleName;
|
||||
|
||||
public static DynamicLibraryModule createDynamicLibraryModule(
|
||||
FactoryBundledWithBinaryReader reader, MachHeader header)
|
||||
throws IOException {
|
||||
DynamicLibraryModule dynamicLibraryModule = (DynamicLibraryModule) reader.getFactory().create(DynamicLibraryModule.class);
|
||||
dynamicLibraryModule.initDynamicLibraryModule(reader, header);
|
||||
return dynamicLibraryModule;
|
||||
}
|
||||
|
||||
/**
|
||||
* DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
|
||||
*/
|
||||
public DynamicLibraryModule() {}
|
||||
|
||||
private void initDynamicLibraryModule(FactoryBundledWithBinaryReader reader, MachHeader header) throws IOException {
|
||||
public DynamicLibraryModule(BinaryReader reader, MachHeader header) throws IOException {
|
||||
this.is32bit = header.is32bit();
|
||||
|
||||
module_name = reader.readNextInt();
|
||||
|
||||
+2
-17
@@ -17,8 +17,8 @@ package ghidra.app.util.bin.format.macho.commands;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import ghidra.app.util.bin.BinaryReader;
|
||||
import ghidra.app.util.bin.StructConverter;
|
||||
import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
|
||||
import ghidra.app.util.bin.format.macho.MachConstants;
|
||||
import ghidra.program.model.data.*;
|
||||
import ghidra.util.exception.DuplicateNameException;
|
||||
@@ -32,22 +32,7 @@ public class DynamicLibraryReference implements StructConverter {
|
||||
private int isym;
|
||||
private int flags;
|
||||
|
||||
static DynamicLibraryReference createDynamicLibraryReference(
|
||||
FactoryBundledWithBinaryReader reader) throws IOException {
|
||||
DynamicLibraryReference dynamicLibraryReference =
|
||||
(DynamicLibraryReference) reader.getFactory().create(DynamicLibraryReference.class);
|
||||
dynamicLibraryReference.initDynamicLibraryReference(reader);
|
||||
return dynamicLibraryReference;
|
||||
}
|
||||
|
||||
/**
|
||||
* DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
|
||||
*/
|
||||
public DynamicLibraryReference() {
|
||||
}
|
||||
|
||||
private void initDynamicLibraryReference(FactoryBundledWithBinaryReader reader)
|
||||
throws IOException {
|
||||
DynamicLibraryReference(BinaryReader reader) throws IOException {
|
||||
int value = reader.readNextInt();
|
||||
|
||||
if (reader.isLittleEndian()) {
|
||||
|
||||
+3
-18
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.macho.commands;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
|
||||
import ghidra.app.util.bin.BinaryReader;
|
||||
import ghidra.app.util.bin.format.macho.MachConstants;
|
||||
import ghidra.app.util.bin.format.macho.MachHeader;
|
||||
import ghidra.app.util.importer.MessageLog;
|
||||
@@ -36,24 +36,9 @@ import ghidra.util.task.TaskMonitor;
|
||||
public class DynamicLinkerCommand extends LoadCommand {
|
||||
private LoadCommandString name;
|
||||
|
||||
public static DynamicLinkerCommand createDynamicLinkerCommand(
|
||||
FactoryBundledWithBinaryReader reader) throws IOException {
|
||||
DynamicLinkerCommand dynamicLinkerCommand =
|
||||
(DynamicLinkerCommand) reader.getFactory().create(DynamicLinkerCommand.class);
|
||||
dynamicLinkerCommand.initDynamicLinkerCommand(reader);
|
||||
return dynamicLinkerCommand;
|
||||
}
|
||||
|
||||
/**
|
||||
* DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
|
||||
*/
|
||||
public DynamicLinkerCommand() {
|
||||
}
|
||||
|
||||
private void initDynamicLinkerCommand(FactoryBundledWithBinaryReader reader)
|
||||
throws IOException {
|
||||
public DynamicLinkerCommand(BinaryReader reader) throws IOException {
|
||||
initLoadCommand(reader);
|
||||
name = LoadCommandString.createLoadCommandString(reader, this);
|
||||
name = new LoadCommandString(reader, this);
|
||||
}
|
||||
|
||||
public LoadCommandString getLoadCommandString() {
|
||||
|
||||
+7
-22
@@ -19,7 +19,7 @@ import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
|
||||
import ghidra.app.util.bin.BinaryReader;
|
||||
import ghidra.app.util.bin.format.macho.*;
|
||||
import ghidra.app.util.importer.MessageLog;
|
||||
import ghidra.program.flatapi.FlatProgramAPI;
|
||||
@@ -65,22 +65,7 @@ public class DynamicSymbolTableCommand extends LoadCommand {
|
||||
private List<RelocationInfo> externalRelocations = new ArrayList<RelocationInfo>();
|
||||
private List<RelocationInfo> localRelocations = new ArrayList<RelocationInfo>();
|
||||
|
||||
static DynamicSymbolTableCommand createDynamicSymbolTableCommand(
|
||||
FactoryBundledWithBinaryReader reader, MachHeader header) throws IOException {
|
||||
DynamicSymbolTableCommand command =
|
||||
(DynamicSymbolTableCommand) reader.getFactory().create(DynamicSymbolTableCommand.class);
|
||||
command.initDynamicSymbolTableCommand(reader, header);
|
||||
return command;
|
||||
}
|
||||
|
||||
/**
|
||||
* DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
|
||||
*/
|
||||
public DynamicSymbolTableCommand() {
|
||||
}
|
||||
|
||||
private void initDynamicSymbolTableCommand(FactoryBundledWithBinaryReader reader,
|
||||
MachHeader header) throws IOException {
|
||||
DynamicSymbolTableCommand(BinaryReader reader, MachHeader header) throws IOException {
|
||||
initLoadCommand(reader);
|
||||
|
||||
ilocalsym = reader.readNextInt();
|
||||
@@ -107,19 +92,19 @@ public class DynamicSymbolTableCommand extends LoadCommand {
|
||||
if (tocoff > 0) {
|
||||
reader.setPointerIndex(header.getStartIndex() + tocoff);
|
||||
for (int i = 0; i < ntoc; ++i) {
|
||||
tocList.add(TableOfContents.createTableOfContents(reader));
|
||||
tocList.add(new TableOfContents(reader));
|
||||
}
|
||||
}
|
||||
if (modtaboff > 0) {
|
||||
reader.setPointerIndex(header.getStartIndex() + modtaboff);
|
||||
for (int i = 0; i < nmodtab; ++i) {
|
||||
moduleList.add(DynamicLibraryModule.createDynamicLibraryModule(reader, header));
|
||||
moduleList.add(new DynamicLibraryModule(reader, header));
|
||||
}
|
||||
}
|
||||
if (extrefsymoff > 0) {
|
||||
reader.setPointerIndex(header.getStartIndex() + extrefsymoff);
|
||||
for (int i = 0; i < nextrefsyms; ++i) {
|
||||
referencedList.add(DynamicLibraryReference.createDynamicLibraryReference(reader));
|
||||
referencedList.add(new DynamicLibraryReference(reader));
|
||||
}
|
||||
}
|
||||
if (indirectsymoff > 0) {
|
||||
@@ -132,13 +117,13 @@ public class DynamicSymbolTableCommand extends LoadCommand {
|
||||
if (extreloff > 0) {
|
||||
reader.setPointerIndex(header.getStartIndex() + extreloff);
|
||||
for (int i = 0; i < nextrel; ++i) {
|
||||
externalRelocations.add(RelocationInfo.createRelocationInfo(reader));
|
||||
externalRelocations.add(new RelocationInfo(reader));
|
||||
}
|
||||
}
|
||||
if (locreloff > 0) {
|
||||
reader.setPointerIndex(header.getStartIndex() + locreloff);
|
||||
for (int i = 0; i < nlocrel; ++i) {
|
||||
localRelocations.add(RelocationInfo.createRelocationInfo(reader));
|
||||
localRelocations.add(new RelocationInfo(reader));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-19
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.macho.commands;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
|
||||
import ghidra.app.util.bin.BinaryReader;
|
||||
import ghidra.app.util.bin.format.macho.MachConstants;
|
||||
import ghidra.app.util.bin.format.macho.MachHeader;
|
||||
import ghidra.app.util.importer.MessageLog;
|
||||
@@ -40,26 +40,10 @@ public class EncryptedInformationCommand extends LoadCommand {
|
||||
|
||||
private boolean is32bit;
|
||||
|
||||
static EncryptedInformationCommand createEncryptedInformationCommand(
|
||||
FactoryBundledWithBinaryReader reader, boolean is32bit) throws IOException {
|
||||
EncryptedInformationCommand command =
|
||||
(EncryptedInformationCommand) reader.getFactory().create(
|
||||
EncryptedInformationCommand.class);
|
||||
command.initEncryptedInformationCommand(reader, is32bit);
|
||||
return command;
|
||||
}
|
||||
|
||||
/**
|
||||
* DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
|
||||
*/
|
||||
public EncryptedInformationCommand() {
|
||||
}
|
||||
|
||||
private void initEncryptedInformationCommand(FactoryBundledWithBinaryReader reader,
|
||||
boolean is32bit) throws IOException {
|
||||
EncryptedInformationCommand(BinaryReader reader, boolean is32bit) throws IOException {
|
||||
initLoadCommand(reader);
|
||||
this.is32bit = is32bit;
|
||||
|
||||
|
||||
cryptoff = reader.readNextInt();
|
||||
cryptsize = reader.readNextInt();
|
||||
cryptid = reader.readNextInt();
|
||||
|
||||
+2
-17
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.macho.commands;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
|
||||
import ghidra.app.util.bin.BinaryReader;
|
||||
import ghidra.app.util.bin.format.macho.MachConstants;
|
||||
import ghidra.app.util.bin.format.macho.MachHeader;
|
||||
import ghidra.app.util.importer.MessageLog;
|
||||
@@ -37,22 +37,7 @@ public class EntryPointCommand extends LoadCommand {
|
||||
private long entryOffset;
|
||||
private long stackSize;
|
||||
|
||||
static EntryPointCommand createEntryPointCommand(FactoryBundledWithBinaryReader reader)
|
||||
throws IOException {
|
||||
|
||||
EntryPointCommand command =
|
||||
(EntryPointCommand) reader.getFactory().create(EntryPointCommand.class);
|
||||
command.initEntryPointCommand(reader);
|
||||
return command;
|
||||
}
|
||||
|
||||
/**
|
||||
* DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
|
||||
*/
|
||||
public EntryPointCommand() {
|
||||
}
|
||||
|
||||
private void initEntryPointCommand(FactoryBundledWithBinaryReader reader) throws IOException {
|
||||
EntryPointCommand(BinaryReader reader) throws IOException {
|
||||
initLoadCommand(reader);
|
||||
entryOffset = reader.readNextLong();
|
||||
stackSize = reader.readNextLong();
|
||||
|
||||
+2
-17
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.macho.commands;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
|
||||
import ghidra.app.util.bin.BinaryReader;
|
||||
import ghidra.app.util.bin.format.macho.MachConstants;
|
||||
import ghidra.app.util.bin.format.macho.MachHeader;
|
||||
import ghidra.app.util.importer.MessageLog;
|
||||
@@ -42,22 +42,7 @@ public class FileSetEntryCommand extends LoadCommand {
|
||||
|
||||
boolean is32bit;
|
||||
|
||||
public static FileSetEntryCommand createFileSetEntryCommand(
|
||||
FactoryBundledWithBinaryReader reader, boolean is32bit) throws IOException {
|
||||
FileSetEntryCommand filesetEntryCommand =
|
||||
(FileSetEntryCommand) reader.getFactory().create(FileSetEntryCommand.class);
|
||||
filesetEntryCommand.initFileSetEntryCommand(reader, is32bit);
|
||||
return filesetEntryCommand;
|
||||
}
|
||||
|
||||
/**
|
||||
* DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
|
||||
*/
|
||||
public FileSetEntryCommand() {
|
||||
}
|
||||
|
||||
private void initFileSetEntryCommand(FactoryBundledWithBinaryReader reader, boolean is32bit)
|
||||
throws IOException {
|
||||
public FileSetEntryCommand(BinaryReader reader, boolean is32bit) throws IOException {
|
||||
initLoadCommand(reader);
|
||||
this.is32bit = is32bit;
|
||||
|
||||
|
||||
+2
-18
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.macho.commands;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
|
||||
import ghidra.app.util.bin.BinaryReader;
|
||||
import ghidra.app.util.bin.format.macho.MachConstants;
|
||||
import ghidra.app.util.bin.format.macho.MachHeader;
|
||||
import ghidra.app.util.importer.MessageLog;
|
||||
@@ -37,23 +37,7 @@ public class FixedVirtualMemoryFileCommand extends LoadCommand {
|
||||
private LoadCommandString name;
|
||||
private int header_addr;
|
||||
|
||||
public static FixedVirtualMemoryFileCommand createFixedVirtualMemoryFileCommand(
|
||||
FactoryBundledWithBinaryReader reader) throws IOException {
|
||||
FixedVirtualMemoryFileCommand command =
|
||||
(FixedVirtualMemoryFileCommand) reader.getFactory().create(
|
||||
FixedVirtualMemoryFileCommand.class);
|
||||
command.initFixedVirtualMemoryFileCommand(reader);
|
||||
return command;
|
||||
}
|
||||
|
||||
/**
|
||||
* DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
|
||||
*/
|
||||
public FixedVirtualMemoryFileCommand() {
|
||||
}
|
||||
|
||||
private void initFixedVirtualMemoryFileCommand(FactoryBundledWithBinaryReader reader)
|
||||
throws IOException {
|
||||
public FixedVirtualMemoryFileCommand(BinaryReader reader) throws IOException {
|
||||
initLoadCommand(reader);
|
||||
}
|
||||
|
||||
|
||||
+3
-19
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.macho.commands;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
|
||||
import ghidra.app.util.bin.BinaryReader;
|
||||
import ghidra.app.util.bin.format.macho.MachException;
|
||||
|
||||
/**
|
||||
@@ -27,24 +27,8 @@ import ghidra.app.util.bin.format.macho.MachException;
|
||||
*/
|
||||
public class FixedVirtualMemorySharedLibraryCommand extends ObsoleteCommand {
|
||||
|
||||
static FixedVirtualMemorySharedLibraryCommand createFixedVirtualMemorySharedLibraryCommand(
|
||||
FactoryBundledWithBinaryReader reader) throws IOException, MachException {
|
||||
FixedVirtualMemorySharedLibraryCommand command =
|
||||
(FixedVirtualMemorySharedLibraryCommand) reader.getFactory().create(
|
||||
FixedVirtualMemorySharedLibraryCommand.class);
|
||||
command.initFixedVirtualMemorySharedLibraryCommand(reader);
|
||||
return command;
|
||||
}
|
||||
|
||||
/**
|
||||
* DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
|
||||
*/
|
||||
public FixedVirtualMemorySharedLibraryCommand() {
|
||||
}
|
||||
|
||||
private void initFixedVirtualMemorySharedLibraryCommand(FactoryBundledWithBinaryReader reader)
|
||||
throws IOException, MachException {
|
||||
initObsoleteCommand(reader);
|
||||
FixedVirtualMemorySharedLibraryCommand(BinaryReader reader) throws IOException, MachException {
|
||||
super(reader);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-13
@@ -21,7 +21,6 @@ import java.util.List;
|
||||
|
||||
import ghidra.app.util.bin.BinaryReader;
|
||||
import ghidra.app.util.bin.ByteProvider;
|
||||
import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
|
||||
import ghidra.app.util.bin.format.dwarf4.LEB128;
|
||||
import ghidra.program.model.address.Address;
|
||||
|
||||
@@ -32,18 +31,8 @@ import ghidra.program.model.address.Address;
|
||||
*/
|
||||
public class FunctionStartsCommand extends LinkEditDataCommand {
|
||||
|
||||
static FunctionStartsCommand createFunctionStartsCommand(FactoryBundledWithBinaryReader reader)
|
||||
throws IOException {
|
||||
FunctionStartsCommand command =
|
||||
(FunctionStartsCommand) reader.getFactory().create(FunctionStartsCommand.class);
|
||||
command.initLinkEditDataCommand(reader);
|
||||
return command;
|
||||
}
|
||||
|
||||
/**
|
||||
* DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
|
||||
*/
|
||||
public FunctionStartsCommand() {
|
||||
FunctionStartsCommand(BinaryReader reader) throws IOException {
|
||||
super(reader);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+3
-17
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.macho.commands;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
|
||||
import ghidra.app.util.bin.BinaryReader;
|
||||
import ghidra.app.util.bin.format.macho.MachException;
|
||||
|
||||
/**
|
||||
@@ -27,22 +27,8 @@ import ghidra.app.util.bin.format.macho.MachException;
|
||||
*/
|
||||
public class IdentCommand extends ObsoleteCommand {
|
||||
|
||||
static IdentCommand createIdentCommand(FactoryBundledWithBinaryReader reader)
|
||||
throws IOException, MachException {
|
||||
IdentCommand identCommand = (IdentCommand) reader.getFactory().create(IdentCommand.class);
|
||||
identCommand.initIdentCommand(reader);
|
||||
return identCommand;
|
||||
}
|
||||
|
||||
/**
|
||||
* DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
|
||||
*/
|
||||
public IdentCommand() {
|
||||
}
|
||||
|
||||
private void initIdentCommand(FactoryBundledWithBinaryReader reader)
|
||||
throws IOException, MachException {
|
||||
initObsoleteCommand(reader);
|
||||
IdentCommand(BinaryReader reader) throws IOException, MachException {
|
||||
super(reader);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-17
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.macho.commands;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
|
||||
import ghidra.app.util.bin.BinaryReader;
|
||||
import ghidra.app.util.bin.format.macho.MachConstants;
|
||||
import ghidra.app.util.bin.format.macho.MachHeader;
|
||||
import ghidra.app.util.importer.MessageLog;
|
||||
@@ -37,22 +37,7 @@ public class LinkEditDataCommand extends LoadCommand {
|
||||
private int dataoff;
|
||||
private int datasize;
|
||||
|
||||
static LinkEditDataCommand createLinkEditDataCommand(FactoryBundledWithBinaryReader reader)
|
||||
throws IOException {
|
||||
LinkEditDataCommand command =
|
||||
(LinkEditDataCommand) reader.getFactory().create(LinkEditDataCommand.class);
|
||||
command.initLinkEditDataCommand(reader);
|
||||
return command;
|
||||
}
|
||||
|
||||
/**
|
||||
* DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
|
||||
*/
|
||||
public LinkEditDataCommand() {
|
||||
}
|
||||
|
||||
protected void initLinkEditDataCommand(FactoryBundledWithBinaryReader reader)
|
||||
throws IOException {
|
||||
LinkEditDataCommand(BinaryReader reader) throws IOException {
|
||||
initLoadCommand(reader);
|
||||
dataoff = reader.readNextInt();
|
||||
datasize = reader.readNextInt();
|
||||
|
||||
+2
-17
@@ -19,7 +19,7 @@ import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
|
||||
import ghidra.app.util.bin.BinaryReader;
|
||||
import ghidra.app.util.bin.format.macho.MachHeader;
|
||||
import ghidra.app.util.importer.MessageLog;
|
||||
import ghidra.program.flatapi.FlatProgramAPI;
|
||||
@@ -40,22 +40,7 @@ public class LinkerOptionCommand extends LoadCommand {
|
||||
private int count;
|
||||
private List<String> linkerOptions;
|
||||
|
||||
static LinkerOptionCommand createLinkerOptionCommand(FactoryBundledWithBinaryReader reader)
|
||||
throws IOException {
|
||||
|
||||
LinkerOptionCommand command =
|
||||
(LinkerOptionCommand) reader.getFactory().create(LinkerOptionCommand.class);
|
||||
command.initLinkerOptionCommand(reader);
|
||||
return command;
|
||||
}
|
||||
|
||||
/**
|
||||
* DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
|
||||
*/
|
||||
public LinkerOptionCommand() {
|
||||
}
|
||||
|
||||
private void initLinkerOptionCommand(FactoryBundledWithBinaryReader reader) throws IOException {
|
||||
LinkerOptionCommand(BinaryReader reader) throws IOException {
|
||||
initLoadCommand(reader);
|
||||
count = reader.readNextInt();
|
||||
linkerOptions = new ArrayList<>(count);
|
||||
|
||||
+2
-5
@@ -17,8 +17,8 @@ package ghidra.app.util.bin.format.macho.commands;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import ghidra.app.util.bin.BinaryReader;
|
||||
import ghidra.app.util.bin.StructConverter;
|
||||
import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
|
||||
import ghidra.app.util.bin.format.macho.MachHeader;
|
||||
import ghidra.app.util.importer.MessageLog;
|
||||
import ghidra.program.flatapi.FlatProgramAPI;
|
||||
@@ -37,10 +37,7 @@ public abstract class LoadCommand implements StructConverter {
|
||||
private int cmd;
|
||||
private int cmdsize;
|
||||
|
||||
public LoadCommand() {
|
||||
}
|
||||
|
||||
protected void initLoadCommand(FactoryBundledWithBinaryReader reader) throws IOException {
|
||||
protected void initLoadCommand(BinaryReader reader) throws IOException {
|
||||
startIndex = reader.getPointerIndex();
|
||||
cmd = reader.readNextInt();
|
||||
cmdsize = reader.readNextInt();
|
||||
|
||||
+2
-18
@@ -17,8 +17,8 @@ package ghidra.app.util.bin.format.macho.commands;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import ghidra.app.util.bin.BinaryReader;
|
||||
import ghidra.app.util.bin.StructConverter;
|
||||
import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
|
||||
import ghidra.app.util.bin.format.macho.MachConstants;
|
||||
import ghidra.program.model.data.*;
|
||||
import ghidra.util.exception.DuplicateNameException;
|
||||
@@ -32,23 +32,7 @@ public class LoadCommandString implements StructConverter {
|
||||
private int offset;
|
||||
private String string;
|
||||
|
||||
static LoadCommandString createLoadCommandString(FactoryBundledWithBinaryReader reader,
|
||||
LoadCommand command) throws IOException {
|
||||
LoadCommandString loadCommandString =
|
||||
(LoadCommandString) reader.getFactory().create(LoadCommandString.class);
|
||||
loadCommandString.initLoadCommandString(reader, command);
|
||||
return loadCommandString;
|
||||
}
|
||||
|
||||
/**
|
||||
* DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY
|
||||
* METHODS INSTEAD.
|
||||
*/
|
||||
public LoadCommandString() {
|
||||
}
|
||||
|
||||
private void initLoadCommandString(FactoryBundledWithBinaryReader reader, LoadCommand command)
|
||||
throws IOException {
|
||||
LoadCommandString(BinaryReader reader, LoadCommand command) throws IOException {
|
||||
offset = reader.readNextInt();
|
||||
string = reader.readAsciiString(command.getStartIndex() + offset);
|
||||
}
|
||||
|
||||
+42
-44
@@ -19,7 +19,7 @@ package ghidra.app.util.bin.format.macho.commands;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
|
||||
import ghidra.app.util.bin.BinaryReader;
|
||||
import ghidra.app.util.bin.format.macho.MachException;
|
||||
import ghidra.app.util.bin.format.macho.MachHeader;
|
||||
import ghidra.app.util.bin.format.macho.threadcommand.ThreadCommand;
|
||||
@@ -30,145 +30,143 @@ import ghidra.util.Msg;
|
||||
*/
|
||||
public final class LoadCommandTypes {
|
||||
|
||||
public static LoadCommand getLoadCommand(FactoryBundledWithBinaryReader reader,
|
||||
MachHeader header) throws IOException, MachException {
|
||||
public static LoadCommand getLoadCommand(BinaryReader reader, MachHeader header)
|
||||
throws IOException, MachException {
|
||||
int type = reader.peekNextInt();
|
||||
switch (type) {
|
||||
case LC_SEGMENT: {
|
||||
return SegmentCommand.createSegmentCommand(reader, header.is32bit());
|
||||
return new SegmentCommand(reader, header.is32bit());
|
||||
}
|
||||
case LC_SYMTAB: {
|
||||
return SymbolTableCommand.createSymbolTableCommand(reader, header);
|
||||
return new SymbolTableCommand(reader, header);
|
||||
}
|
||||
case LC_SYMSEG: {
|
||||
return SymbolCommand.createSymbolCommand(reader);
|
||||
return new SymbolCommand(reader);
|
||||
}
|
||||
case LC_THREAD:
|
||||
case LC_UNIXTHREAD: {
|
||||
return ThreadCommand.createThreadCommand(reader, header);
|
||||
return new ThreadCommand(reader, header);
|
||||
}
|
||||
case LC_LOADFVMLIB:
|
||||
case LC_IDFVMLIB: {
|
||||
return FixedVirtualMemorySharedLibraryCommand
|
||||
.createFixedVirtualMemorySharedLibraryCommand(reader);
|
||||
return new FixedVirtualMemorySharedLibraryCommand(reader);
|
||||
}
|
||||
case LC_IDENT: {
|
||||
return IdentCommand.createIdentCommand(reader);
|
||||
return new IdentCommand(reader);
|
||||
}
|
||||
case LC_FVMFILE: {
|
||||
return FixedVirtualMemoryFileCommand.createFixedVirtualMemoryFileCommand(reader);
|
||||
return new FixedVirtualMemoryFileCommand(reader);
|
||||
}
|
||||
case LC_PREPAGE: {
|
||||
return UnsupportedLoadCommand.createUnsupportedLoadCommand(reader, type);
|
||||
return new UnsupportedLoadCommand(reader, type);
|
||||
}
|
||||
case LC_DYSYMTAB: {
|
||||
return DynamicSymbolTableCommand.createDynamicSymbolTableCommand(reader, header);
|
||||
return new DynamicSymbolTableCommand(reader, header);
|
||||
}
|
||||
case LC_LOAD_DYLIB:
|
||||
case LC_ID_DYLIB:
|
||||
case LC_LOAD_UPWARD_DYLIB:
|
||||
case LC_DYLD_ENVIRONMENT: {
|
||||
return DynamicLibraryCommand.createDynamicLibraryCommand(reader);
|
||||
return new DynamicLibraryCommand(reader);
|
||||
}
|
||||
case LC_LOAD_DYLINKER:
|
||||
case LC_ID_DYLINKER: {
|
||||
return DynamicLinkerCommand.createDynamicLinkerCommand(reader);
|
||||
return new DynamicLinkerCommand(reader);
|
||||
}
|
||||
case LC_PREBOUND_DYLIB: {
|
||||
return PreboundDynamicLibraryCommand.createPreboundDynamicLibraryCommand(reader);
|
||||
return new PreboundDynamicLibraryCommand(reader);
|
||||
}
|
||||
case LC_ROUTINES: {
|
||||
return RoutinesCommand.createRoutinesCommand(reader, header.is32bit());
|
||||
return new RoutinesCommand(reader, header.is32bit());
|
||||
}
|
||||
case LC_SUB_FRAMEWORK: {
|
||||
return SubFrameworkCommand.createSubFrameworkCommand(reader);
|
||||
return new SubFrameworkCommand(reader);
|
||||
}
|
||||
case LC_SUB_UMBRELLA: {
|
||||
return SubUmbrellaCommand.createSubUmbrellaCommand(reader);
|
||||
return new SubUmbrellaCommand(reader);
|
||||
}
|
||||
case LC_SUB_CLIENT: {
|
||||
return SubClientCommand.createSubClientCommand(reader);
|
||||
return new SubClientCommand(reader);
|
||||
}
|
||||
case LC_SUB_LIBRARY: {
|
||||
return SubLibraryCommand.createSubLibraryCommand(reader);
|
||||
return new SubLibraryCommand(reader);
|
||||
}
|
||||
case LC_TWOLEVEL_HINTS: {
|
||||
return TwoLevelHintsCommand.createTwoLevelHintsCommand(reader);
|
||||
return new TwoLevelHintsCommand(reader);
|
||||
}
|
||||
case LC_PREBIND_CKSUM: {
|
||||
return PrebindChecksumCommand.createPrebindChecksumCommand(reader);
|
||||
return new PrebindChecksumCommand(reader);
|
||||
}
|
||||
case LC_LOAD_WEAK_DYLIB: {
|
||||
return DynamicLibraryCommand.createDynamicLibraryCommand(reader);
|
||||
return new DynamicLibraryCommand(reader);
|
||||
}
|
||||
case LC_SEGMENT_64: {
|
||||
return SegmentCommand.createSegmentCommand(reader, header.is32bit());
|
||||
return new SegmentCommand(reader, header.is32bit());
|
||||
}
|
||||
case LC_ROUTINES_64: {
|
||||
return RoutinesCommand.createRoutinesCommand(reader, header.is32bit());
|
||||
return new RoutinesCommand(reader, header.is32bit());
|
||||
}
|
||||
case LC_UUID: {
|
||||
return UuidCommand.createUuidCommand(reader);
|
||||
return new UuidCommand(reader);
|
||||
}
|
||||
case LC_RPATH: {
|
||||
return RunPathCommand.createRunPathCommand(reader);
|
||||
return new RunPathCommand(reader);
|
||||
}
|
||||
case LC_CODE_SIGNATURE:
|
||||
case LC_SEGMENT_SPLIT_INFO:
|
||||
case LC_DATA_IN_CODE:
|
||||
case LC_OPTIMIZATION_HINT:
|
||||
case LC_DYLIB_CODE_SIGN_DRS: {
|
||||
return LinkEditDataCommand.createLinkEditDataCommand(reader);
|
||||
return new LinkEditDataCommand(reader);
|
||||
}
|
||||
case LC_REEXPORT_DYLIB: {
|
||||
return DynamicLibraryCommand.createDynamicLibraryCommand(reader);
|
||||
return new DynamicLibraryCommand(reader);
|
||||
}
|
||||
case LC_ENCRYPTION_INFO:
|
||||
case LC_ENCRYPTION_INFO_64: {
|
||||
return EncryptedInformationCommand.createEncryptedInformationCommand(reader,
|
||||
header.is32bit());
|
||||
return new EncryptedInformationCommand(reader, header.is32bit());
|
||||
}
|
||||
case LC_DYLD_INFO:
|
||||
case LC_DYLD_INFO_ONLY: {
|
||||
return DyldInfoCommand.createDyldInfoCommand(reader);
|
||||
return new DyldInfoCommand(reader);
|
||||
}
|
||||
case LC_VERSION_MIN_MACOSX:
|
||||
case LC_VERSION_MIN_IPHONEOS:
|
||||
case LC_VERSION_MIN_TVOS:
|
||||
case LC_VERSION_MIN_WATCHOS: {
|
||||
return VersionMinCommand.createVersionMinCommand(reader);
|
||||
return new VersionMinCommand(reader);
|
||||
}
|
||||
case LC_FUNCTION_STARTS: {
|
||||
return FunctionStartsCommand.createFunctionStartsCommand(reader);
|
||||
return new FunctionStartsCommand(reader);
|
||||
}
|
||||
case LC_MAIN: {
|
||||
return EntryPointCommand.createEntryPointCommand(reader);
|
||||
return new EntryPointCommand(reader);
|
||||
}
|
||||
case LC_SOURCE_VERSION: {
|
||||
return SourceVersionCommand.createSourceVersionCommand(reader);
|
||||
return new SourceVersionCommand(reader);
|
||||
}
|
||||
case LC_LAZY_LOAD_DYLIB: {
|
||||
return DynamicLibraryCommand.createDynamicLibraryCommand(reader);
|
||||
return new DynamicLibraryCommand(reader);
|
||||
}
|
||||
case LC_BUILD_VERSION: {
|
||||
return BuildVersionCommand.createBuildVersionCommand(reader);
|
||||
return new BuildVersionCommand(reader);
|
||||
}
|
||||
case LC_LINKER_OPTIONS: {
|
||||
return LinkerOptionCommand.createLinkerOptionCommand(reader);
|
||||
return new LinkerOptionCommand(reader);
|
||||
}
|
||||
|
||||
case LC_DYLD_EXPORTS_TRIE:
|
||||
return LinkEditDataCommand.createLinkEditDataCommand(reader);
|
||||
return new LinkEditDataCommand(reader);
|
||||
|
||||
case LC_DYLD_CHAINED_FIXUPS:
|
||||
return DyldChainedFixupsCommand.createDyldChainedFixupsCommand(reader);
|
||||
return new DyldChainedFixupsCommand(reader);
|
||||
|
||||
case LC_FILESET_ENTRY:
|
||||
return FileSetEntryCommand.createFileSetEntryCommand(reader, header.is32bit());
|
||||
return new FileSetEntryCommand(reader, header.is32bit());
|
||||
|
||||
default: {
|
||||
Msg.warn(header, "Unsupported load command " + Integer.toHexString(type));
|
||||
return UnsupportedLoadCommand.createUnsupportedLoadCommand(reader, type);
|
||||
return new UnsupportedLoadCommand(reader, type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+4
-18
@@ -17,8 +17,8 @@ package ghidra.app.util.bin.format.macho.commands;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import ghidra.app.util.bin.BinaryReader;
|
||||
import ghidra.app.util.bin.StructConverter;
|
||||
import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
|
||||
import ghidra.app.util.bin.format.macho.MachConstants;
|
||||
import ghidra.program.model.data.*;
|
||||
import ghidra.util.exception.AssertException;
|
||||
@@ -39,21 +39,7 @@ public class NList implements StructConverter {
|
||||
private String string;
|
||||
private boolean is32bit;
|
||||
|
||||
public static NList createNList(FactoryBundledWithBinaryReader reader, boolean is32bit)
|
||||
throws IOException {
|
||||
NList nList = (NList) reader.getFactory().create(NList.class);
|
||||
nList.initNList(reader, is32bit);
|
||||
return nList;
|
||||
}
|
||||
|
||||
/**
|
||||
* DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
|
||||
*/
|
||||
public NList() {
|
||||
}
|
||||
|
||||
private void initNList(FactoryBundledWithBinaryReader reader, boolean is32bit)
|
||||
throws IOException {
|
||||
public NList(BinaryReader reader, boolean is32bit) throws IOException {
|
||||
this.is32bit = is32bit;
|
||||
|
||||
n_strx = reader.readNextInt();
|
||||
@@ -78,10 +64,10 @@ public class NList implements StructConverter {
|
||||
* scattered. Initializing the strings linearly from the string table is much
|
||||
* faster.
|
||||
*
|
||||
* @param reader
|
||||
* @param reader The BinaryReader
|
||||
* @param stringTableOffset offset of the string table
|
||||
*/
|
||||
public void initString(FactoryBundledWithBinaryReader reader, long stringTableOffset) {
|
||||
public void initString(BinaryReader reader, long stringTableOffset) {
|
||||
try {
|
||||
string = reader.readAsciiString(stringTableOffset + n_strx);
|
||||
}
|
||||
|
||||
+11
-16
@@ -15,26 +15,21 @@
|
||||
*/
|
||||
package ghidra.app.util.bin.format.macho.commands;
|
||||
|
||||
import ghidra.app.util.bin.format.*;
|
||||
import ghidra.app.util.bin.format.macho.*;
|
||||
import ghidra.app.util.importer.*;
|
||||
import ghidra.program.flatapi.*;
|
||||
import ghidra.program.model.address.*;
|
||||
import ghidra.program.model.data.*;
|
||||
import ghidra.program.model.listing.*;
|
||||
import ghidra.util.exception.*;
|
||||
import ghidra.util.task.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import java.io.*;
|
||||
import ghidra.app.util.bin.BinaryReader;
|
||||
import ghidra.app.util.bin.format.macho.*;
|
||||
import ghidra.app.util.importer.MessageLog;
|
||||
import ghidra.program.flatapi.FlatProgramAPI;
|
||||
import ghidra.program.model.address.Address;
|
||||
import ghidra.program.model.data.*;
|
||||
import ghidra.program.model.listing.ProgramModule;
|
||||
import ghidra.util.exception.DuplicateNameException;
|
||||
import ghidra.util.task.TaskMonitor;
|
||||
|
||||
public abstract class ObsoleteCommand extends LoadCommand {
|
||||
|
||||
/**
|
||||
* DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
|
||||
*/
|
||||
public ObsoleteCommand() {}
|
||||
|
||||
protected void initObsoleteCommand(FactoryBundledWithBinaryReader reader) throws IOException, MachException {
|
||||
public ObsoleteCommand(BinaryReader reader) throws IOException, MachException {
|
||||
initLoadCommand(reader);
|
||||
throw new ObsoleteException();
|
||||
}
|
||||
|
||||
+2
-17
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.macho.commands;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
|
||||
import ghidra.app.util.bin.BinaryReader;
|
||||
import ghidra.app.util.bin.format.macho.MachConstants;
|
||||
import ghidra.app.util.bin.format.macho.MachHeader;
|
||||
import ghidra.app.util.importer.MessageLog;
|
||||
@@ -36,22 +36,7 @@ import ghidra.util.task.TaskMonitor;
|
||||
public class PrebindChecksumCommand extends LoadCommand {
|
||||
private int cksum;
|
||||
|
||||
static PrebindChecksumCommand createPrebindChecksumCommand(
|
||||
FactoryBundledWithBinaryReader reader) throws IOException {
|
||||
PrebindChecksumCommand checksumCommand =
|
||||
(PrebindChecksumCommand) reader.getFactory().create(PrebindChecksumCommand.class);
|
||||
checksumCommand.initPrebindChecksumCommand(reader);
|
||||
return checksumCommand;
|
||||
}
|
||||
|
||||
/**
|
||||
* DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
|
||||
*/
|
||||
public PrebindChecksumCommand() {
|
||||
}
|
||||
|
||||
private void initPrebindChecksumCommand(FactoryBundledWithBinaryReader reader)
|
||||
throws IOException {
|
||||
PrebindChecksumCommand(BinaryReader reader) throws IOException {
|
||||
initLoadCommand(reader);
|
||||
cksum = reader.readNextInt();
|
||||
}
|
||||
|
||||
+4
-20
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.macho.commands;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
|
||||
import ghidra.app.util.bin.BinaryReader;
|
||||
import ghidra.app.util.bin.format.macho.MachConstants;
|
||||
import ghidra.app.util.bin.format.macho.MachHeader;
|
||||
import ghidra.app.util.importer.MessageLog;
|
||||
@@ -38,27 +38,11 @@ public class PreboundDynamicLibraryCommand extends LoadCommand {
|
||||
private int nmodules;
|
||||
private LoadCommandString linkedModules;
|
||||
|
||||
static PreboundDynamicLibraryCommand createPreboundDynamicLibraryCommand(
|
||||
FactoryBundledWithBinaryReader reader) throws IOException {
|
||||
PreboundDynamicLibraryCommand command =
|
||||
(PreboundDynamicLibraryCommand) reader.getFactory().create(
|
||||
PreboundDynamicLibraryCommand.class);
|
||||
command.initPreboundDynamicLibraryCommand(reader);
|
||||
return command;
|
||||
}
|
||||
|
||||
/**
|
||||
* DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
|
||||
*/
|
||||
public PreboundDynamicLibraryCommand() {
|
||||
}
|
||||
|
||||
private void initPreboundDynamicLibraryCommand(FactoryBundledWithBinaryReader reader)
|
||||
throws IOException {
|
||||
PreboundDynamicLibraryCommand(BinaryReader reader) throws IOException {
|
||||
initLoadCommand(reader);
|
||||
name = LoadCommandString.createLoadCommandString(reader, this);
|
||||
name = new LoadCommandString(reader, this);
|
||||
nmodules = reader.readNextInt();
|
||||
linkedModules = LoadCommandString.createLoadCommandString(reader, this);
|
||||
linkedModules = new LoadCommandString(reader, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-15
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.macho.commands;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
|
||||
import ghidra.app.util.bin.BinaryReader;
|
||||
import ghidra.app.util.bin.format.macho.MachConstants;
|
||||
import ghidra.app.util.bin.format.macho.MachHeader;
|
||||
import ghidra.app.util.importer.MessageLog;
|
||||
@@ -45,20 +45,7 @@ public class RoutinesCommand extends LoadCommand {
|
||||
|
||||
private boolean is32bit;
|
||||
|
||||
static RoutinesCommand createRoutinesCommand(FactoryBundledWithBinaryReader reader,
|
||||
boolean is32bit) throws IOException {
|
||||
RoutinesCommand command = (RoutinesCommand) reader.getFactory().create(RoutinesCommand.class);
|
||||
command.initRoutinesCommand(reader, is32bit);
|
||||
return command;
|
||||
}
|
||||
|
||||
/**
|
||||
* DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
|
||||
*/
|
||||
public RoutinesCommand() {}
|
||||
|
||||
private void initRoutinesCommand(FactoryBundledWithBinaryReader reader, boolean is32bit)
|
||||
throws IOException {
|
||||
RoutinesCommand(BinaryReader reader, boolean is32bit) throws IOException {
|
||||
initLoadCommand(reader);
|
||||
this.is32bit = is32bit;
|
||||
if (is32bit) {
|
||||
|
||||
+3
-16
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.macho.commands;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
|
||||
import ghidra.app.util.bin.BinaryReader;
|
||||
import ghidra.app.util.bin.format.macho.MachConstants;
|
||||
import ghidra.app.util.bin.format.macho.MachHeader;
|
||||
import ghidra.app.util.importer.MessageLog;
|
||||
@@ -36,22 +36,9 @@ import ghidra.util.task.TaskMonitor;
|
||||
public class RunPathCommand extends LoadCommand {
|
||||
private LoadCommandString path;
|
||||
|
||||
static RunPathCommand createRunPathCommand(FactoryBundledWithBinaryReader reader)
|
||||
throws IOException {
|
||||
RunPathCommand command = (RunPathCommand) reader.getFactory().create(RunPathCommand.class);
|
||||
command.initRunPathCommand(reader);
|
||||
return command;
|
||||
}
|
||||
|
||||
/**
|
||||
* DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
|
||||
*/
|
||||
public RunPathCommand() {
|
||||
}
|
||||
|
||||
private void initRunPathCommand(FactoryBundledWithBinaryReader reader) throws IOException {
|
||||
RunPathCommand(BinaryReader reader) throws IOException {
|
||||
initLoadCommand(reader);
|
||||
path = LoadCommandString.createLoadCommandString(reader, this);
|
||||
path = new LoadCommandString(reader, this);
|
||||
}
|
||||
|
||||
public LoadCommandString getPath() {
|
||||
|
||||
+3
-18
@@ -19,7 +19,7 @@ import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
|
||||
import ghidra.app.util.bin.BinaryReader;
|
||||
import ghidra.app.util.bin.format.macho.*;
|
||||
import ghidra.app.util.importer.MessageLog;
|
||||
import ghidra.program.flatapi.FlatProgramAPI;
|
||||
@@ -50,22 +50,7 @@ public class SegmentCommand extends LoadCommand {
|
||||
private boolean is32bit;
|
||||
private List<Section> sections = new ArrayList<Section>();
|
||||
|
||||
public static SegmentCommand createSegmentCommand(FactoryBundledWithBinaryReader reader,
|
||||
boolean is32bit) throws IOException {
|
||||
SegmentCommand segmentCommand =
|
||||
(SegmentCommand) reader.getFactory().create(SegmentCommand.class);
|
||||
segmentCommand.initSegmentCommand(reader, is32bit);
|
||||
return segmentCommand;
|
||||
}
|
||||
|
||||
/**
|
||||
* DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
|
||||
*/
|
||||
public SegmentCommand() {
|
||||
}
|
||||
|
||||
private void initSegmentCommand(FactoryBundledWithBinaryReader reader, boolean is32bit)
|
||||
throws IOException {
|
||||
public SegmentCommand(BinaryReader reader, boolean is32bit) throws IOException {
|
||||
initLoadCommand(reader);
|
||||
this.is32bit = is32bit;
|
||||
|
||||
@@ -88,7 +73,7 @@ public class SegmentCommand extends LoadCommand {
|
||||
flags = reader.readNextInt();
|
||||
|
||||
for (int i = 0; i < nsects; ++i) {
|
||||
sections.add(Section.createSection(reader, is32bit));
|
||||
sections.add(new Section(reader, is32bit));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-17
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.macho.commands;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
|
||||
import ghidra.app.util.bin.BinaryReader;
|
||||
import ghidra.app.util.bin.format.macho.MachConstants;
|
||||
import ghidra.app.util.bin.format.macho.MachHeader;
|
||||
import ghidra.app.util.importer.MessageLog;
|
||||
@@ -36,22 +36,7 @@ import ghidra.util.task.TaskMonitor;
|
||||
public class SourceVersionCommand extends LoadCommand {
|
||||
private long version;
|
||||
|
||||
static SourceVersionCommand createSourceVersionCommand(FactoryBundledWithBinaryReader reader)
|
||||
throws IOException {
|
||||
|
||||
SourceVersionCommand command =
|
||||
(SourceVersionCommand) reader.getFactory().create(SourceVersionCommand.class);
|
||||
command.initEntryPointCommand(reader);
|
||||
return command;
|
||||
}
|
||||
|
||||
/**
|
||||
* DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
|
||||
*/
|
||||
public SourceVersionCommand() {
|
||||
}
|
||||
|
||||
private void initEntryPointCommand(FactoryBundledWithBinaryReader reader) throws IOException {
|
||||
SourceVersionCommand(BinaryReader reader) throws IOException {
|
||||
initLoadCommand(reader);
|
||||
version = reader.readNextLong();
|
||||
}
|
||||
|
||||
+3
-17
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.macho.commands;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
|
||||
import ghidra.app.util.bin.BinaryReader;
|
||||
import ghidra.app.util.bin.format.macho.MachConstants;
|
||||
import ghidra.app.util.bin.format.macho.MachHeader;
|
||||
import ghidra.app.util.importer.MessageLog;
|
||||
@@ -36,23 +36,9 @@ import ghidra.util.task.TaskMonitor;
|
||||
public class SubClientCommand extends LoadCommand {
|
||||
private LoadCommandString client;
|
||||
|
||||
static SubClientCommand createSubClientCommand(FactoryBundledWithBinaryReader reader)
|
||||
throws IOException {
|
||||
SubClientCommand clientCommand =
|
||||
(SubClientCommand) reader.getFactory().create(SubClientCommand.class);
|
||||
clientCommand.initSubClientCommand(reader);
|
||||
return clientCommand;
|
||||
}
|
||||
|
||||
/**
|
||||
* DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
|
||||
*/
|
||||
public SubClientCommand() {
|
||||
}
|
||||
|
||||
private void initSubClientCommand(FactoryBundledWithBinaryReader reader) throws IOException {
|
||||
SubClientCommand(BinaryReader reader) throws IOException {
|
||||
initLoadCommand(reader);
|
||||
client = LoadCommandString.createLoadCommandString(reader, this);
|
||||
client = new LoadCommandString(reader, this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+3
-17
@@ -17,7 +17,7 @@ package ghidra.app.util.bin.format.macho.commands;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import ghidra.app.util.bin.format.FactoryBundledWithBinaryReader;
|
||||
import ghidra.app.util.bin.BinaryReader;
|
||||
import ghidra.app.util.bin.format.macho.MachConstants;
|
||||
import ghidra.app.util.bin.format.macho.MachHeader;
|
||||
import ghidra.app.util.importer.MessageLog;
|
||||
@@ -36,23 +36,9 @@ import ghidra.util.task.TaskMonitor;
|
||||
public class SubFrameworkCommand extends LoadCommand {
|
||||
private LoadCommandString umbrella;
|
||||
|
||||
static SubFrameworkCommand createSubFrameworkCommand(FactoryBundledWithBinaryReader reader)
|
||||
throws IOException {
|
||||
SubFrameworkCommand command =
|
||||
(SubFrameworkCommand) reader.getFactory().create(SubFrameworkCommand.class);
|
||||
command.initSubFrameworkCommand(reader);
|
||||
return command;
|
||||
}
|
||||
|
||||
/**
|
||||
* DO NOT USE THIS CONSTRUCTOR, USE create*(GenericFactory ...) FACTORY METHODS INSTEAD.
|
||||
*/
|
||||
public SubFrameworkCommand() {
|
||||
}
|
||||
|
||||
private void initSubFrameworkCommand(FactoryBundledWithBinaryReader reader) throws IOException {
|
||||
SubFrameworkCommand(BinaryReader reader) throws IOException {
|
||||
initLoadCommand(reader);
|
||||
umbrella = LoadCommandString.createLoadCommandString(reader, this);
|
||||
umbrella = new LoadCommandString(reader, this);
|
||||
}
|
||||
|
||||
public LoadCommandString getUmbrellaFrameworkName() {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user