package sun.jvm.hotspot.debugger.win32.coff;
import java.io.*;
import java.nio.*;
import java.nio.channels.*;
import java.util.*;
import sun.jvm.hotspot.utilities.memo.*;
import sun.jvm.hotspot.utilities.Assert;
import sun.jvm.hotspot.debugger.DataSource;
import sun.jvm.hotspot.debugger.MappedByteBufferDataSource;
public class COFFFileParser {
private static COFFFileParser soleInstance;
private static final int = 20;
private static final int = 40;
private static final int SYMBOL_SIZE = 18;
private static final int RELOCATION_SIZE = 10;
private static final int LINE_NUMBER_SIZE = 6;
private static final String US_ASCII = "US-ASCII";
private COFFFileParser() {}
public static COFFFileParser getParser() {
if (soleInstance == null) {
soleInstance = new COFFFileParser();
}
return soleInstance;
}
public COFFFile parse(String filename) throws COFFException {
try {
File file = new File(filename);
FileInputStream stream = new FileInputStream(file);
MappedByteBuffer buf = stream.getChannel().map(FileChannel.MapMode.READ_ONLY,
0,
file.length());
return parse(new MappedByteBufferDataSource(buf));
} catch (FileNotFoundException e) {
throw new COFFException(e);
} catch (IOException e) {
throw new COFFException(e);
}
}
public COFFFile parse(DataSource source) throws COFFException {
return new COFFFileImpl(source);
}
class COFFFileImpl implements COFFFile {
private DataSource file;
private long filePos;
private boolean isImage;
private long ;
private MemoizedObject = new MemoizedObject() {
public Object computeValue() {
return new COFFHeaderImpl();
}
};
COFFFileImpl(DataSource file) throws COFFException {
this.file = file;
initialize();
}
public boolean isImage() {
return isImage;
}
public COFFHeader () {
return (COFFHeaderImpl) header.getValue();
}
class implements COFFHeader {
private short ;
private short ;
private int ;
private int ;
private int ;
private short ;
private short ;
private MemoizedObject[] ;
private MemoizedObject[] ;
private MemoizedObject = new MemoizedObject() {
public Object () {
int ptr = getPointerToSymbolTable();
if (ptr == 0) {
return new StringTable(0);
} else {
return new StringTable(ptr + SYMBOL_SIZE * getNumberOfSymbols());
}
}
};
() {
seek(imageHeaderOffset);
machine = readShort();
numberOfSections = readShort();
timeDateStamp = readInt();
pointerToSymbolTable = readInt();
numberOfSymbols = readInt();
sizeOfOptionalHeader = readShort();
characteristics = readShort();
sectionHeaders = new MemoizedObject[numberOfSections];
for (int i = 0; i < numberOfSections; i++) {
final int secHdrOffset = (int)
(imageHeaderOffset + COFF_HEADER_SIZE + sizeOfOptionalHeader + i * SECTION_HEADER_SIZE);
sectionHeaders[i] = new MemoizedObject() {
public Object () {
return new SectionHeaderImpl(secHdrOffset);
}
};
}
symbols = new MemoizedObject[numberOfSymbols];
for (int i = 0; i < numberOfSymbols; i++) {
final int symbolOffset = pointerToSymbolTable + i * SYMBOL_SIZE;
symbols[i] = new MemoizedObject() {
public Object () {
return new COFFSymbolImpl(symbolOffset);
}
};
}
}
public short () { return machine; }
public short () { return numberOfSections; }
public int () { return timeDateStamp; }
public int () { return pointerToSymbolTable; }
public int () { return numberOfSymbols; }
public short () { return sizeOfOptionalHeader; }
public OptionalHeader () throws COFFException {
if (getSizeOfOptionalHeader() == 0) {
return null;
}
return new OptionalHeaderImpl((int) (imageHeaderOffset + COFF_HEADER_SIZE));
}
public short () { return characteristics; }
public boolean (short characteristic) {
return ((characteristics & characteristic) != 0);
}
public SectionHeader (int index) {
return (SectionHeader) sectionHeaders[index - 1].getValue();
}
public COFFSymbol (int index) {
return (COFFSymbol) symbols[index].getValue();
}
public int () {
return getStringTable().getNum();
}
public String (int i) {
return getStringTable().get(i);
}
StringTable () { return (StringTable) stringTable.getValue(); }
int (int rva) {
if (rva == 0) return 0;
for (int i = 1; i <= getNumberOfSections(); i++) {
SectionHeader sec = getSectionHeader(i);
int va = sec.getVirtualAddress();
int sz = sec.getSize();
if ((va <= rva) && (rva < (va + sz))) {
return sec.getPointerToRawData() + (rva - va);
}
}
throw new COFFException("Unable to find RVA 0x" +
Integer.toHexString(rva) +
" in any section");
}
class implements OptionalHeader {
private short ;
private MemoizedObject standardFields;
private MemoizedObject ;
private MemoizedObject ;
private static final int STANDARD_FIELDS_OFFSET = 2;
private static final int = 28;
private static final int = 96;
private static final int = 24;
private static final int = 112;
(final int offset) {
seek(offset);
magic = readShort();
final boolean isPE32Plus = (magic == MAGIC_PE32_PLUS);
final int standardFieldsOffset = offset + STANDARD_FIELDS_OFFSET;
final int windowsSpecificFieldsOffset = offset +
(isPE32Plus
? PE32_PLUS_WINDOWS_SPECIFIC_FIELDS_OFFSET
: PE32_WINDOWS_SPECIFIC_FIELDS_OFFSET);
final int dataDirectoriesOffset = offset +
(isPE32Plus
? PE32_PLUS_DATA_DIRECTORIES_OFFSET
: PE32_DATA_DIRECTORIES_OFFSET);
standardFields = new MemoizedObject() {
public Object () {
return new OptionalHeaderStandardFieldsImpl(standardFieldsOffset,
isPE32Plus);
}
};
windowsSpecificFields = new MemoizedObject() {
public Object () {
return new OptionalHeaderWindowsSpecificFieldsImpl(windowsSpecificFieldsOffset,
isPE32Plus);
}
};
dataDirectories = new MemoizedObject() {
public Object () {
return new OptionalHeaderDataDirectoriesImpl(dataDirectoriesOffset,
getWindowsSpecificFields().getNumberOfRvaAndSizes());
}
};
}
public short () {
return magic;
}
public OptionalHeaderStandardFields getStandardFields() {
return (OptionalHeaderStandardFields) standardFields.getValue();
}
public OptionalHeaderWindowsSpecificFields () {
return (OptionalHeaderWindowsSpecificFields) windowsSpecificFields.getValue();
}
public OptionalHeaderDataDirectories () {
return (OptionalHeaderDataDirectories) dataDirectories.getValue();
}
}
class OptionalHeaderStandardFieldsImpl implements OptionalHeaderStandardFields {
private boolean isPE32Plus;
private byte majorLinkerVersion;
private byte minorLinkerVersion;
private int sizeOfCode;
private int sizeOfInitializedData;
private int sizeOfUninitializedData;
private int addressOfEntryPoint;
private int baseOfCode;
private int baseOfData;
OptionalHeaderStandardFieldsImpl(int offset,
boolean isPE32Plus) {
this.isPE32Plus = isPE32Plus;
seek(offset);
majorLinkerVersion = readByte();
minorLinkerVersion = readByte();
sizeOfCode = readInt();
sizeOfInitializedData = readInt();
sizeOfUninitializedData = readInt();
addressOfEntryPoint = readInt();
baseOfCode = readInt();
if (!isPE32Plus) {
baseOfData = readInt();
}
}
public byte getMajorLinkerVersion() { return majorLinkerVersion; }
public byte getMinorLinkerVersion() { return minorLinkerVersion; }
public int getSizeOfCode() { return sizeOfCode; }
public int getSizeOfInitializedData() { return sizeOfInitializedData; }
public int getSizeOfUninitializedData() { return sizeOfUninitializedData; }
public int getAddressOfEntryPoint() { return addressOfEntryPoint; }
public int getBaseOfCode() { return baseOfCode; }
public int getBaseOfData() throws COFFException {
if (isPE32Plus) {
throw new COFFException("Not present in PE32+ files");
}
return baseOfData;
}
}
class implements OptionalHeaderWindowsSpecificFields {
private long ;
private int ;
private int ;
private short ;
private short ;
private short ;
private short ;
private short ;
private short ;
private int ;
private int ;
private int ;
private short ;
private short ;
private long ;
private long ;
private long ;
private long ;
private int ;
private int numberOfRvaAndSizes;
(int offset, boolean isPE32Plus) {
seek(offset);
if (!isPE32Plus) {
imageBase = maskInt(readInt());
} else {
imageBase = readLong();
}
sectionAlignment = readInt();
fileAlignment = readInt();
majorOperatingSystemVersion = readShort();
minorOperatingSystemVersion = readShort();
majorImageVersion = readShort();
minorImageVersion = readShort();
majorSubsystemVersion = readShort();
minorSubsystemVersion = readShort();
readInt();
sizeOfImage = readInt();
sizeOfHeaders = readInt();
checkSum = readInt();
subsystem = readShort();
dllCharacteristics = readShort();
if (!isPE32Plus) {
sizeOfStackReserve = maskInt(readInt());
sizeOfStackCommit = maskInt(readInt());
sizeOfHeapReserve = maskInt(readInt());
sizeOfHeapCommit = maskInt(readInt());
} else {
sizeOfStackReserve = readLong();
sizeOfStackCommit = readLong();
sizeOfHeapReserve = readLong();
sizeOfHeapCommit = readLong();
}
loaderFlags = readInt();
numberOfRvaAndSizes = readInt();
}
public long () { return imageBase; }
public int () { return sectionAlignment; }
public int () { return fileAlignment; }
public short () { return majorOperatingSystemVersion; }
public short () { return minorOperatingSystemVersion; }
public short () { return majorImageVersion; }
public short () { return minorImageVersion; }
public short () { return majorSubsystemVersion; }
public short () { return minorSubsystemVersion; }
public int () { return sizeOfImage; }
public int () { return sizeOfHeaders; }
public int () { return checkSum; }
public short () { return subsystem; }
public short () { return dllCharacteristics; }
public long () { return sizeOfStackReserve; }
public long () { return sizeOfStackCommit; }
public long () { return sizeOfHeapReserve; }
public long () { return sizeOfHeapCommit; }
public int () { return loaderFlags; }
public int getNumberOfRvaAndSizes() { return numberOfRvaAndSizes; }
private long (long arg) {
return (arg & 0x00000000FFFFFFFFL);
}
}
class implements OptionalHeaderDataDirectories {
private int numberOfRvaAndSizes;
private MemoizedObject[] ;
private MemoizedObject ;
private MemoizedObject ;
private static final int = 8;
(int offset,
int numberOfRvaAndSizes) {
this.numberOfRvaAndSizes = numberOfRvaAndSizes;
dataDirectories = new MemoizedObject[numberOfRvaAndSizes];
for (int i = 0; i < numberOfRvaAndSizes; i++) {
final int dirOffset = offset + (i * DATA_DIRECTORY_SIZE);
dataDirectories[i] = new MemoizedObject() {
public Object () {
return new DataDirectoryImpl(dirOffset);
}
};
}
exportDirectoryTable = new MemoizedObject() {
public Object () {
DataDirectory dir = getExportTable();
if (dir.getRVA() == 0 || dir.getSize() == 0) {
return null;
}
return new
ExportDirectoryTableImpl(dir.getRVA(), dir.getSize());
}
};
debugDirectory = new MemoizedObject() {
public Object () {
DataDirectory dir = getDebug();
if (dir.getRVA() == 0 || dir.getSize() == 0) {
return null;
}
return new DebugDirectoryImpl(rvaToFileOffset(dir.getRVA()), dir.getSize());
}
};
}
public DataDirectory () throws COFFException {
return (DataDirectory) dataDirectories[checkIndex(0)].getValue();
}
public DataDirectory () throws COFFException {
return (DataDirectory) dataDirectories[checkIndex(1)].getValue();
}
public DataDirectory () throws COFFException {
return (DataDirectory) dataDirectories[checkIndex(2)].getValue();
}
public DataDirectory () throws COFFException {
return (DataDirectory) dataDirectories[checkIndex(3)].getValue();
}
public DataDirectory () throws COFFException {
return (DataDirectory) dataDirectories[checkIndex(4)].getValue();
}
public DataDirectory () throws COFFException {
return (DataDirectory) dataDirectories[checkIndex(5)].getValue();
}
public DataDirectory () throws COFFException {
return (DataDirectory) dataDirectories[checkIndex(6)].getValue();
}
public DataDirectory () throws COFFException {
return (DataDirectory) dataDirectories[checkIndex(7)].getValue();
}
public DataDirectory () throws COFFException {
return (DataDirectory) dataDirectories[checkIndex(8)].getValue();
}
public DataDirectory () throws COFFException {
return (DataDirectory) dataDirectories[checkIndex(9)].getValue();
}
public DataDirectory () throws COFFException {
return (DataDirectory) dataDirectories[checkIndex(10)].getValue();
}
public DataDirectory () throws COFFException {
return (DataDirectory) dataDirectories[checkIndex(11)].getValue();
}
public DataDirectory () throws COFFException {
return (DataDirectory) dataDirectories[checkIndex(12)].getValue();
}
public DataDirectory () throws COFFException {
return (DataDirectory) dataDirectories[checkIndex(13)].getValue();
}
public DataDirectory () throws COFFException {
return (DataDirectory) dataDirectories[checkIndex(14)].getValue();
}
public ExportDirectoryTable () throws COFFException {
return (ExportDirectoryTable) exportDirectoryTable.getValue();
}
public DebugDirectory () throws COFFException {
return (DebugDirectory) debugDirectory.getValue();
}
private int (int index) throws COFFException {
if ((index < 0) || (index >= dataDirectories.length)) {
throw new COFFException("Directory " + index + " unavailable (only " +
numberOfRvaAndSizes + " tables present)");
}
return index;
}
}
class implements DataDirectory {
int ;
int ;
(int offset) {
seek(offset);
rva = readInt();
size = readInt();
}
public int () { return rva; }
public int () { return size; }
}
class implements ExportDirectoryTable {
private int ;
private int ;
private int ;
private int ;
private int ;
private short ;
private short ;
private int ;
private int ;
private int ;
private int ;
private int ;
private int ;
private int ;
private MemoizedObject ;
private MemoizedObject ;
private MemoizedObject ;
private MemoizedObject ;
private MemoizedObject ;
(int exportDataDirRVA, int size) {
this.exportDataDirRVA = exportDataDirRVA;
offset = rvaToFileOffset(exportDataDirRVA);
this.size = size;
seek(offset);
exportFlags = readInt();
timeDateStamp = readInt();
majorVersion = readShort();
minorVersion = readShort();
nameRVA = readInt();
ordinalBase = readInt();
addressTableEntries = readInt();
numberOfNamePointers = readInt();
exportAddressTableRVA = readInt();
namePointerTableRVA = readInt();
ordinalTableRVA = readInt();
dllName = new MemoizedObject() {
public Object () {
seek(rvaToFileOffset(getNameRVA()));
return readCString();
}
};
exportNamePointerTable = new MemoizedObject() {
public Object () {
int[] pointers = new int[getNumberOfNamePointers()];
seek(rvaToFileOffset(getNamePointerTableRVA()));
for (int i = 0; i < pointers.length; i++) {
pointers[i] = readInt();
}
for (int i = 0; i < pointers.length; i++) {
pointers[i] = rvaToFileOffset(pointers[i]);
}
return pointers;
}
};
exportNameTable = new MemoizedObject() {
public Object () {
return new ExportNameTable(getExportNamePointerTable());
}
};
exportOrdinalTable = new MemoizedObject() {
public Object () {
short[] ordinals = new short[getNumberOfNamePointers()];
seek(rvaToFileOffset(getOrdinalTableRVA()));
for (int i = 0; i < ordinals.length; i++) {
ordinals[i] = readShort();
}
return ordinals;
}
};
exportAddressTable = new MemoizedObject() {
public Object () {
int[] addresses = new int[getNumberOfAddressTableEntries()];
seek(rvaToFileOffset(getExportAddressTableRVA()));
for (int i = 0; i < addresses.length; i++) {
addresses[i] = readInt();
}
return addresses;
}
};
}
public int () { return exportFlags; }
public int () { return timeDateStamp; }
public short () { return majorVersion; }
public short () { return minorVersion; }
public int () { return nameRVA; }
public String () {
return (String) dllName.getValue();
}
public int () { return ordinalBase; }
public int () { return addressTableEntries; }
public int () { return numberOfNamePointers; }
public int () { return exportAddressTableRVA; }
public int () { return namePointerTableRVA; }
public int () { return ordinalTableRVA; }
public String (int i) {
return getExportNameTable().get(i);
}
public short (int i) {
return getExportOrdinalTable()[i];
}
public boolean (short ordinal) {
int addr = getExportAddress(ordinal);
return ((exportDataDirRVA <= addr) &&
(addr < (exportDataDirRVA + size)));
}
public String (short ordinal) {
seek(rvaToFileOffset(getExportAddress(ordinal)));
return readCString();
}
public int (short ordinal) {
return getExportAddressTable()[ordinal];
}
private ExportNameTable () {
return (ExportNameTable) exportNameTable.getValue();
}
private int[] () {
return (int[]) exportNamePointerTable.getValue();
}
private short[] () {
return (short[]) exportOrdinalTable.getValue();
}
private int[] () {
return (int[]) exportAddressTable.getValue();
}
}
class {
private MemoizedObject[] ;
(final int[] exportNamePointerTable) {
names = new MemoizedObject[exportNamePointerTable.length];
for (int i = 0; i < exportNamePointerTable.length; i++) {
final int idx = i;
names[idx] = new MemoizedObject() {
public Object () {
seek(exportNamePointerTable[idx]);
return readCString();
}
};
};
}
String (int i) {
return (String) names[i].getValue();
}
}
class implements DebugDirectory {
private int ;
private int ;
private int ;
private static final int = 28;
(int offset, int size) {
this.offset = offset;
this.size = size;
if ((size % DEBUG_DIRECTORY_ENTRY_SIZE) != 0) {
throw new COFFException("Corrupt DebugDirectory at offset 0x" +
Integer.toHexString(offset));
}
numEntries = size / DEBUG_DIRECTORY_ENTRY_SIZE;
}
public int () { return numEntries; }
public DebugDirectoryEntry (int i) {
if ((i < 0) || (i >= getNumEntries())) throw new IndexOutOfBoundsException();
return new DebugDirectoryEntryImpl(offset + i * DEBUG_DIRECTORY_ENTRY_SIZE);
}
}
class implements DebugDirectoryEntry, DebugTypes {
private int ;
private int ;
private short ;
private short ;
private int ;
private int ;
private int ;
private int ;
(int offset) {
seek(offset);
characteristics = readInt();
timeDateStamp = readInt();
majorVersion = readShort();
minorVersion = readShort();
type = readInt();
sizeOfData = readInt();
addressOfRawData = readInt();
pointerToRawData = readInt();
}
public int () { return characteristics; }
public int () { return timeDateStamp; }
public short () { return majorVersion; }
public short () { return minorVersion; }
public int () { return type; }
public int () { return sizeOfData; }
public int () { return addressOfRawData; }
public int () { return pointerToRawData; }
public DebugVC50 () {
try {
if (getType() != IMAGE_DEBUG_TYPE_CODEVIEW) return null;
int offset = getPointerToRawData();
seek(offset);
if (readByte() == 'N' &&
readByte() == 'B' &&
readByte() == '1' &&
readByte() == '1') {
return new DebugVC50Impl(offset);
}
} catch (COFFException e) {
e.printStackTrace();
}
return null;
}
public byte (int i) {
if (i < 0 || i >= getSizeOfData()) {
throw new IndexOutOfBoundsException();
}
seek(getPointerToRawData() + i);
return readByte();
}
}
class implements DebugVC50, DebugVC50TypeLeafIndices {
private int ;
private int ;
private MemoizedObject ;
(int offset) {
lfaBase = offset;
seek(offset);
readInt();
subsectionDirectoryOffset = globalOffset(readInt());
verify();
subsectionDirectory = new MemoizedObject() {
public Object () {
return new DebugVC50SubsectionDirectoryImpl(getSubsectionDirectoryOffset());
}
};
}
public int () {
return subsectionDirectoryOffset;
}
public DebugVC50SubsectionDirectory () {
return (DebugVC50SubsectionDirectory) subsectionDirectory.getValue();
}
private int (int offset) {
return offset + lfaBase;
}
private void () {
seek(subsectionDirectoryOffset);
int headerLength = readShort();
int entryLength = readShort();
int numEntries = readInt();
int endOffset = subsectionDirectoryOffset + headerLength + numEntries * entryLength;
seek(endOffset);
if (readByte() == 'N' &&
readByte() == 'B' &&
readByte() == '1' &&
readByte() == '1') {
return;
}
throw new COFFException("Did not find NB11 signature at end of debug info");
}
class
implements DebugVC50SubsectionDirectory,
DebugVC50SubsectionTypes {
private int ;
private short ;
private short ;
private int ;
(int offset) {
this.offset = offset;
seek(offset);
dirHeaderLength = readShort();
dirEntryLength = readShort();
numEntries = readInt();
}
public short () { return dirHeaderLength; }
public short () { return dirEntryLength; }
public int () { return numEntries; }
public DebugVC50Subsection (int i) {
seek(offset + dirHeaderLength + (i * dirEntryLength));
short ssType = readShort();
short iMod = readShort();
int lfo = globalOffset(readInt());
int cb = readInt();
switch (ssType) {
case SST_MODULE:
return new DebugVC50SSModuleImpl(ssType, iMod, cb, lfo);
case SST_TYPES:
return new DebugVC50SSTypesImpl(ssType, iMod, cb, lfo);
case SST_PUBLIC:
return new DebugVC50SSPublicImpl(ssType, iMod, cb, lfo);
case SST_PUBLIC_SYM:
return new DebugVC50SSPublicSymImpl(ssType, iMod, cb, lfo);
case SST_SYMBOLS:
return new DebugVC50SSSymbolsImpl(ssType, iMod, cb, lfo);
case SST_ALIGN_SYM:
return new DebugVC50SSAlignSymImpl(ssType, iMod, cb, lfo);
case SST_SRC_LN_SEG:
return new DebugVC50SSSrcLnSegImpl(ssType, iMod, cb, lfo);
case SST_SRC_MODULE:
return new DebugVC50SSSrcModuleImpl(ssType, iMod, cb, lfo);
case SST_LIBRARIES:
return new DebugVC50SSLibrariesImpl(ssType, iMod, cb, lfo);
case SST_GLOBAL_SYM:
return new DebugVC50SSGlobalSymImpl(ssType, iMod, cb, lfo);
case SST_GLOBAL_PUB:
return new DebugVC50SSGlobalPubImpl(ssType, iMod, cb, lfo);
case SST_GLOBAL_TYPES:
return new DebugVC50SSGlobalTypesImpl(ssType, iMod, cb, lfo);
case SST_MPC:
return new DebugVC50SSMPCImpl(ssType, iMod, cb, lfo);
case SST_SEG_MAP:
return new DebugVC50SSSegMapImpl(ssType, iMod, cb, lfo);
case SST_SEG_NAME:
return new DebugVC50SSSegNameImpl(ssType, iMod, cb, lfo);
case SST_PRE_COMP:
return new DebugVC50SSPreCompImpl(ssType, iMod, cb, lfo);
case SST_UNUSED:
return null;
case SST_OFFSET_MAP_16:
return new DebugVC50SSOffsetMap16Impl(ssType, iMod, cb, lfo);
case SST_OFFSET_MAP_32:
return new DebugVC50SSOffsetMap32Impl(ssType, iMod, cb, lfo);
case SST_FILE_INDEX:
return new DebugVC50SSFileIndexImpl(ssType, iMod, cb, lfo);
case SST_STATIC_SYM:
return new DebugVC50SSStaticSymImpl(ssType, iMod, cb, lfo);
default:
throw new COFFException("Unknown section type " + ssType);
}
}
}
class implements DebugVC50Subsection {
private short ;
private short ;
private int ;
(short ssType, short iMod, int ssSize, int offset) {
this.ssType = ssType;
this.iMod = iMod;
this.ssSize = ssSize;
}
public short () { return ssType; }
public short () { return iMod; }
public int () { return ssSize; }
}
class extends DebugVC50SubsectionImpl implements DebugVC50SSModule {
private int ;
private short ;
private short ;
private short ;
private short ;
private MemoizedObject ;
private MemoizedObject ;
private static final int = 8;
private static final int = 12;
(short ssType, short iMod, int ssSize, final int offset) {
super(ssType, iMod, ssSize, offset);
this.offset = offset;
seek(offset);
ovlNumber = readShort();
iLib = readShort();
cSeg = readShort();
style = readShort();
segInfo = new MemoizedObject() {
public Object () {
int base = offset + HEADER_SIZE;
DebugVC50SegInfo[] res = new DebugVC50SegInfo[cSeg];
for (int i = 0; i < cSeg; i++) {
res[i] = new DebugVC50SegInfoImpl(base);
base += SEG_INFO_SIZE;
}
return res;
}
};
name = new MemoizedObject() {
public Object () {
return readLengthPrefixedStringAt(offset + (HEADER_SIZE + cSeg * SEG_INFO_SIZE));
}
};
}
public short () { return ovlNumber; }
public short () { return iLib; }
public short () { return cSeg; }
public short () { return style; }
public DebugVC50SegInfo (int i) { return ((DebugVC50SegInfo[]) segInfo.getValue())[i]; }
public String () { return (String) name.getValue(); }
}
class implements DebugVC50SegInfo {
private short ;
private int ;
private int ;
(int offset) {
seek(offset);
seg = readShort();
readShort();
offset = readInt();
cbSeg = readInt();
}
public short () { return seg; }
public int () { return offset; }
public int () { return cbSeg; }
}
class extends DebugVC50SubsectionImpl implements DebugVC50SSTypes {
(short ssType, short iMod, int ssSize, int offset) {
super(ssType, iMod, ssSize, offset);
}
}
class extends DebugVC50SubsectionImpl implements DebugVC50SSPublic {
(short ssType, short iMod, int ssSize, int offset) {
super(ssType, iMod, ssSize, offset);
}
}
class extends DebugVC50SubsectionImpl implements DebugVC50SSPublicSym {
(short ssType, short iMod, int ssSize, int offset) {
super(ssType, iMod, ssSize, offset);
}
}
class extends DebugVC50SubsectionImpl implements DebugVC50SSSymbols {
(short ssType, short iMod, int ssSize, int offset) {
super(ssType, iMod, ssSize, offset);
}
}
class extends DebugVC50SubsectionImpl implements DebugVC50SSAlignSym {
private int ;
(short ssType, short iMod, int ssSize, int offset) {
super(ssType, iMod, ssSize, offset);
this.offset = offset;
}
public DebugVC50SymbolIterator () {
return new DebugVC50SymbolIteratorImpl(offset, getSubsectionSize());
}
}
class extends DebugVC50SubsectionImpl implements DebugVC50SSSrcLnSeg {
(short ssType, short iMod, int ssSize, int offset) {
super(ssType, iMod, ssSize, offset);
}
}
class extends DebugVC50SubsectionImpl implements DebugVC50SSSrcModule {
private int ;
private short ;
private short ;
private MemoizedObject ;
private MemoizedObject ;
private MemoizedObject ;
(short ssType, short iMod, int ssSize, final int offset) {
super(ssType, iMod, ssSize, offset);
this.offset = offset;
seek(offset);
cFile = readShort();
cSeg = readShort();
baseSrcFiles = new MemoizedObject() {
public Object () {
int[] offsets = new int[getNumSourceFiles()];
seek(offset + 4);
for (int i = 0; i < getNumSourceFiles(); i++) {
offsets[i] = offset + readInt();
}
DebugVC50SrcModFileDescImpl[] res = new DebugVC50SrcModFileDescImpl[offsets.length];
for (int i = 0; i < res.length; i++) {
res[i] = new DebugVC50SrcModFileDescImpl(offsets[i], offset);
}
return res;
}
};
segOffsets = new MemoizedObject() {
public Object () {
seek(offset + 4 * (getNumSourceFiles() + 1));
int[] res = new int[2 * getNumCodeSegments()];
for (int i = 0; i < 2 * getNumCodeSegments(); i++) {
res[i] = readInt();
}
return res;
}
};
segs = new MemoizedObject() {
public Object () {
seek(offset + 4 * (getNumSourceFiles() + 1) + 8 * getNumCodeSegments());
short[] res = new short[getNumCodeSegments()];
for (int i = 0; i < getNumCodeSegments(); i++) {
res[i] = readShort();
}
return res;
}
};
}
public int () { return cFile & 0xFFFF; }
public int () { return cSeg & 0xFFFF; }
public DebugVC50SrcModFileDesc (int i) {
return ((DebugVC50SrcModFileDescImpl[]) baseSrcFiles.getValue())[i];
}
public int (int i) {
return ((int[]) segOffsets.getValue())[2*i];
}
public int (int i) {
return ((int[]) segOffsets.getValue())[2*i+1];
}
public int (int i) {
return ((short[]) segs.getValue())[i] & 0xFFFF;
}
}
class implements DebugVC50SrcModFileDesc {
private short ;
private MemoizedObject ;
private MemoizedObject ;
private MemoizedObject ;
(final int offset, final int baseOffset) {
seek(offset);
cSeg = readShort();
baseSrcLn = new MemoizedObject() {
public Object () {
seek(offset + 4);
int[] offsets = new int[getNumCodeSegments()];
for (int i = 0; i < getNumCodeSegments(); i++) {
offsets[i] = baseOffset + readInt();
}
DebugVC50SrcModLineNumberMapImpl[] res =
new DebugVC50SrcModLineNumberMapImpl[getNumCodeSegments()];
for (int i = 0; i < getNumCodeSegments(); i++) {
res[i] = new DebugVC50SrcModLineNumberMapImpl(offsets[i]);
}
return res;
}
};
segOffsets = new MemoizedObject() {
public Object () {
seek(offset + 4 * (getNumCodeSegments() + 1));
int[] res = new int[2 * getNumCodeSegments()];
for (int i = 0; i < 2 * getNumCodeSegments(); i++) {
res[i] = readInt();
}
return res;
}
};
name = new MemoizedObject() {
public Object () {
seek(offset + 4 + 12 * getNumCodeSegments());
int cbName = readByte() & 0xFF;
byte[] res = new byte[cbName];
readBytes(res);
try {
return new String(res, US_ASCII);
} catch (UnsupportedEncodingException e) {
throw new COFFException(e);
}
}
};
}
public int () { return cSeg & 0xFFFF; }
public DebugVC50SrcModLineNumberMap (int i) {
return ((DebugVC50SrcModLineNumberMapImpl[]) baseSrcLn.getValue())[i];
}
public int (int i) {
return ((int[]) segOffsets.getValue())[2*i];
}
public int (int i) {
return ((int[]) segOffsets.getValue())[2*i+1];
}
public String () {
return (String) name.getValue();
}
}
class implements DebugVC50SrcModLineNumberMap {
private short ;
private short ;
private MemoizedObject ;
private MemoizedObject ;
(final int offset) {
seek(offset);
seg = readShort();
cPair = readShort();
offsets = new MemoizedObject() {
public Object () {
seek(offset + 4);
int[] res = new int[getNumSourceLinePairs()];
for (int i = 0; i < getNumSourceLinePairs(); i++) {
res[i] = readInt();
}
return res;
}
};
lineNumbers = new MemoizedObject() {
public Object () {
seek(offset + 4 * (getNumSourceLinePairs() + 1));
short[] res = new short[getNumSourceLinePairs()];
for (int i = 0; i < getNumSourceLinePairs(); i++) {
res[i] = readShort();
}
return res;
}
};
}
public int () { return seg; }
public int () { return cPair; }
public int (int i) {
return ((int[]) offsets.getValue())[i];
}
public int (int i) {
return ((short[]) lineNumbers.getValue())[i] & 0xFFFF;
}
}
class extends DebugVC50SubsectionImpl implements DebugVC50SSLibraries {
(short ssType, short iMod, int ssSize, int offset) {
super(ssType, iMod, ssSize, offset);
}
}
class extends DebugVC50SubsectionImpl implements DebugVC50SSSymbolBase {
private int ;
private short ;
private short ;
private int ;
private int ;
private int ;
private static final int = 16;
(short ssType, short iMod, int ssSize, int offset) {
super(ssType, iMod, ssSize, offset);
this.offset = offset;
seek(offset);
symHash = readShort();
addrHash = readShort();
cbSymbol = readInt();
cbSymHash = readInt();
cbAddrHash = readInt();
}
public short () { return symHash; }
public short () { return addrHash; }
public int () { return cbSymbol; }
public int () { return cbSymHash; }
public int () { return cbAddrHash; }
public DebugVC50SymbolIterator () {
return new DebugVC50SymbolIteratorImpl(offset + HEADER_SIZE, cbSymbol);
}
}
class extends DebugVC50SSSymbolBaseImpl implements DebugVC50SSGlobalSym {
(short ssType, short iMod, int ssSize, int offset) {
super(ssType, iMod, ssSize, offset);
}
}
class extends DebugVC50SSSymbolBaseImpl implements DebugVC50SSGlobalPub {
(short ssType, short iMod, int ssSize, int offset) {
super(ssType, iMod, ssSize, offset);
}
}
class extends DebugVC50SubsectionImpl implements DebugVC50SSGlobalTypes {
private int ;
private int ;
(short ssType, short iMod, int ssSize, int offset) {
super(ssType, iMod, ssSize, offset);
this.offset = offset;
seek(offset);
readInt();
cType = readInt();
}
public int () { return cType; }
public int (int i) {
seek(offset + 4 * (i + 2));
return readInt() + offsetOfFirstType();
}
public DebugVC50TypeIterator () {
return new DebugVC50TypeIteratorImpl(this,
offsetOfFirstType(),
cType);
}
private int () {
return offset + 4 * (getNumTypes() + 2);
}
}
class extends DebugVC50SubsectionImpl implements DebugVC50SSMPC {
(short ssType, short iMod, int ssSize, int offset) {
super(ssType, iMod, ssSize, offset);
}
}
class extends DebugVC50SubsectionImpl implements DebugVC50SSSegMap {
private short ;
private short ;
private MemoizedObject ;
(short ssType, short iMod, int ssSize, final int offset) {
super(ssType, iMod, ssSize, offset);
seek(offset);
cSeg = readShort();
cSegLog = readShort();
segDescs = new MemoizedObject() {
public Object () {
DebugVC50SegDesc[] descs = new DebugVC50SegDesc[cSeg];
for (int i = 0; i < cSeg; i++) {
descs[i] = new DebugVC50SegDescImpl(offset + 4 + (20 * i));
}
return descs;
}
};
}
public short () { return cSeg; }
public short () { return cSegLog; }
public DebugVC50SegDesc (int i) { return ((DebugVC50SegDesc[]) segDescs.getValue())[i]; }
}
class implements DebugVC50SegDesc {
private short ;
private short ;
private short ;
private short ;
private short ;
private short ;
private int ;
private int ;
(int offset) {
seek(offset);
flags = readShort();
ovl = readShort();
group = readShort();
frame = readShort();
iSegName = readShort();
iClassName = readShort();
offset = readInt();
cbSeg = readInt();
}
public short () { return flags; }
public short () { return ovl; }
public short () { return group; }
public short () { return frame; }
public short () { return iSegName; }
public short () { return iClassName; }
public int () { return offset; }
public int () { return cbSeg; }
}
class extends DebugVC50SubsectionImpl implements DebugVC50SSSegName {
private int ;
private int ;
private MemoizedObject ;
(short ssType, short iMod, int ssSize, int offset) {
super(ssType, iMod, ssSize, offset);
this.offset = offset;
this.size = ssSize;
seek(offset);
names = new MemoizedObject() {
public Object () {
int i = 0;
List<String> data = new ArrayList<>();
while (i < size) {
String s = readCString();
data.add(s);
i += s.length();
}
String[] res = new String[data.size()];
res = data.toArray(res);
return res;
}
};
}
public String (int i) {
return ((String[]) names.getValue())[i];
}
}
class extends DebugVC50SubsectionImpl implements DebugVC50SSPreComp {
(short ssType, short iMod, int ssSize, int offset) {
super(ssType, iMod, ssSize, offset);
}
}
class extends DebugVC50SubsectionImpl implements DebugVC50SSOffsetMap16 {
(short ssType, short iMod, int ssSize, int offset) {
super(ssType, iMod, ssSize, offset);
}
}
class extends DebugVC50SubsectionImpl implements DebugVC50SSOffsetMap32 {
(short ssType, short iMod, int ssSize, int offset) {
super(ssType, iMod, ssSize, offset);
}
}
class extends DebugVC50SubsectionImpl implements DebugVC50SSFileIndex {
private int ;
private short ;
private short ;
private MemoizedObject ;
private MemoizedObject ;
private MemoizedObject ;
private MemoizedObject ;
(short ssType, short iMod, int ssSize, final int offset) {
super(ssType, iMod, ssSize, offset);
this.offset = offset;
seek(offset);
cMod = readShort();
cRef = readShort();
modStart = new MemoizedObject() {
public Object () {
short[] vals = new short[cMod];
seek(4 + offset);
for (int i = 0; i < cMod; i++) {
vals[i] = readShort();
}
return vals;
}
};
cRefCnt = new MemoizedObject() {
public Object () {
short[] vals = new short[cMod];
seek(4 + offset + (2 * cMod));
for (int i = 0; i < cMod; i++) {
vals[i] = readShort();
}
return vals;
}
};
nameRef = new MemoizedObject() {
public Object () {
int[] vals = new int[cRef];
seek(4 + offset + (4 * cMod));
for (int i = 0; i < cMod; i++) {
vals[i] = readInt();
}
return vals;
}
};
names = new MemoizedObject() {
public Object () {
String[] vals = new String[cRef];
for (int i = 0; i < cRef; i++) {
vals[i] = readCString();
}
return vals;
}
};
}
public short () { return cMod; }
public short () { return cRef; }
public short[] () { return (short[]) modStart.getValue(); }
public short[] () { return (short[]) cRefCnt.getValue(); }
public int[] () { return (int[]) nameRef.getValue(); }
public String[] () { return (String[]) names.getValue(); }
}
class extends DebugVC50SSSymbolBaseImpl implements DebugVC50SSStaticSym {
(short ssType, short iMod, int ssSize, int offset) {
super(ssType, iMod, ssSize, offset);
}
}
class implements DebugVC50SymbolIterator {
private int ;
private int ;
private int ;
private int ;
private int ;
private static final int = 4;
(int base, int size) {
this(base, size, base);
}
private (int base, int size, int pos) {
this.base = base;
this.size = size;
this.pos = pos;
seek(pos);
curSymSize = readShort() & 0xFFFF;
curSymType = readShort() & 0xFFFF;
}
public boolean () {
return (pos == (base + size));
}
public void () throws NoSuchElementException {
if (done()) throw new NoSuchElementException("No more symbols");
pos += curSymSize + 2;
seek(pos);
curSymSize = readShort() & 0xFFFF;
curSymType = readShort() & 0xFFFF;
}
public short () {
return (short) curSymSize;
}
public int () {
return curSymType;
}
public int () {
return pos + HEADER_SIZE;
}
public byte () {
symSeek(0);
return readByte();
}
public int () {
symSeek(1);
int res = 0;
for (int i = 0; i < 3; i++) {
int b = readByte() & 0xFF;
res = (res << 8) | b;
}
return res;
}
public String () {
return readLengthPrefixedStringAt(4);
}
public int () {
symSeek(0);
return readInt();
}
public short () {
symSeek(4);
return readShort();
}
public String () {
return readLengthPrefixedStringAt(6);
}
public int () {
symSeek(0);
return readInt();
}
public int () throws DebugVC50WrongNumericTypeException {
return readIntNumericLeafAt(4);
}
public long () throws DebugVC50WrongNumericTypeException {
return readLongNumericLeafAt(4);
}
public float () throws DebugVC50WrongNumericTypeException {
return readFloatNumericLeafAt(4);
}
public double () throws DebugVC50WrongNumericTypeException {
return readDoubleNumericLeafAt(4);
}
public String () {
return readLengthPrefixedStringAt(4 + numericLeafLengthAt(4));
}
public int () {
symSeek(0);
return readInt();
}
public String () {
return readLengthPrefixedStringAt(4);
}
public int () {
symSeek(0);
return readInt();
}
public short () {
symSeek(4);
return readShort();
}
public int () {
symSeek(0);
return readInt();
}
public String () {
return readLengthPrefixedStringAt(4);
}
public int () {
symSeek(0);
return readInt();
}
public byte () {
symSeek(4);
return readByte();
}
public byte (int i) {
symSeek(5 + i);
return readByte();
}
public String () {
return readLengthPrefixedStringAt(5 + getManyRegCount());
}
public short () {
symSeek(0);
return readShort();
}
public byte () {
symSeek(2);
return readByte();
}
public byte () {
symSeek(3);
return readByte();
}
public byte (int i) {
symSeek(4 + i);
return readByte();
}
public void () {
seek(pos + 4);
int tmpSymSize = readShort();
int tmpSymType = readShort();
if (Assert.ASSERTS_ENABLED) {
Assert.that(pos + curSymSize + 2 == pos + 4 + tmpSymSize,
"advanceToEntryThisSymbol needs more work");
}
pos += 4;
curSymSize = tmpSymSize;
curSymType = tmpSymType;
}
public int () {
symSeek(0);
return readInt();
}
public int () {
symSeek(4);
return readInt();
}
public String () {
return readLengthPrefixedStringAt(8);
}
public int () {
symSeek(0);
return readInt();
}
public int () {
symSeek(4);
return readInt();
}
public short () {
symSeek(8);
return readShort();
}
public String () {
return readLengthPrefixedStringAt(10);
}
public DebugVC50SymbolIterator () {
int offs = getLGProcParentOffset();
if (offs == 0) return null;
return new DebugVC50SymbolIteratorImpl(base, size, offs);
}
public int () {
symSeek(0);
int offs = readInt();
if (offs == 0) return 0;
return base + offs;
}
public DebugVC50SymbolIterator () {
int offs = getLGProcEndOffset();
return new DebugVC50SymbolIteratorImpl(base, size, offs);
}
public int () {
symSeek(4);
int offs = readInt();
if (Assert.ASSERTS_ENABLED) {
Assert.that(offs != 0, "should not have null end offset for procedure symbols");
}
return base + offs;
}
public DebugVC50SymbolIterator () {
int offs = getLGProcNextOffset();
if (offs == 0) return null;
return new DebugVC50SymbolIteratorImpl(base, size, offs);
}
public int () {
symSeek(8);
int offs = readInt();
if (offs == 0) return 0;
return base + offs;
}
public int () {
symSeek(12);
return readInt();
}
public int () {
symSeek(16);
return readInt();
}
public int () {
symSeek(20);
return readInt();
}
public int () {
symSeek(24);
return readInt();
}
public int () {
symSeek(28);
return readInt();
}
public short () {
symSeek(32);
return readShort();
}
public byte () {
symSeek(34);
return readByte();
}
public String () {
return readLengthPrefixedStringAt(35);
}
public DebugVC50SymbolIterator () {
int offs = getThunkParentOffset();
if (offs == 0) return null;
return new DebugVC50SymbolIteratorImpl(base, size, offs);
}
public int () {
symSeek(0);
int offs = readInt();
if (offs == 0) return 0;
return base + offs;
}
public DebugVC50SymbolIterator () {
symSeek(4);
int offs = readInt();
return new DebugVC50SymbolIteratorImpl(base, size, offs);
}
public int () {
symSeek(4);
int offs = readInt();
if (Assert.ASSERTS_ENABLED) {
Assert.that(offs != 0, "should not have null end offset for thunk symbols");
}
return base + offs;
}
public DebugVC50SymbolIterator () {
int offs = getThunkNextOffset();
if (offs == 0) return null;
return new DebugVC50SymbolIteratorImpl(base, size, base + offs);
}
public int () {
symSeek(8);
int offs = readInt();
if (offs == 0) return 0;
return base + offs;
}
public int () {
symSeek(12);
return readInt();
}
public short () {
symSeek(16);
return readShort();
}
public short () {
symSeek(18);
return readShort();
}
public byte () {
symSeek(20);
return readByte();
}
public String () {
return readLengthPrefixedStringAt(21);
}
public short () {
symSeek(21 + lengthPrefixedStringLengthAt(21));
return readShort();
}
public String () {
return readLengthPrefixedStringAt(23 + lengthPrefixedStringLengthAt(21));
}
public short () {
symSeek(21 + lengthPrefixedStringLengthAt(21));
return readShort();
}
public int () {
symSeek(21 + lengthPrefixedStringLengthAt(21));
return readInt();
}
public short () {
symSeek(25 + lengthPrefixedStringLengthAt(21));
return readShort();
}
public DebugVC50SymbolIterator () {
int offs = getBlockParentOffset();
if (offs == 0) return null;
return new DebugVC50SymbolIteratorImpl(base, size, offs);
}
public int () {
symSeek(0);
int offs = readInt();
if (offs == 0) return 0;
return base + offs;
}
public DebugVC50SymbolIterator () {
symSeek(4);
int offs = readInt();
return new DebugVC50SymbolIteratorImpl(base, size, offs);
}
public int () {
symSeek(4);
int offs = readInt();
if (Assert.ASSERTS_ENABLED) {
Assert.that(offs != 0, "should not have null end offset for block symbols");
}
return base + offs;
}
public int () {
symSeek(8);
return readInt();
}
public int () {
symSeek(12);
return readInt();
}
public short () {
symSeek(16);
return readShort();
}
public String () {
return readLengthPrefixedStringAt(18);
}
public int () {
symSeek(0);
return readInt();
}
public short () {
symSeek(4);
return readShort();
}
public byte () {
symSeek(6);
return readByte();
}
public String () {
return readLengthPrefixedStringAt(7);
}
public int () {
symSeek(0);
return readInt();
}
public short () {
symSeek(4);
return readShort();
}
public short () {
symSeek(6);
return readShort();
}
public int () {
symSeek(0);
return readInt();
}
public int () {
symSeek(4);
return readInt();
}
public int () {
symSeek(8);
return readInt();
}
public short () {
symSeek(12);
return readShort();
}
public int () {
symSeek(0);
return readInt();
}
public int () {
symSeek(4);
return readInt();
}
public short () {
symSeek(8);
return readShort();
}
public String () {
return readLengthPrefixedStringAt(10);
}
public int () {
symSeek(0);
return readInt();
}
public int () {
symSeek(4);
return readInt();
}
public short () {
symSeek(8);
return readShort();
}
public String () {
return readLengthPrefixedStringAt(10);
}
private void (int offsetInSym) {
seek(pos + HEADER_SIZE + offsetInSym);
}
private int (int offsetInSym) {
return DebugVC50Impl.this.numericLeafLengthAt(pos + HEADER_SIZE + offsetInSym);
}
private int (int offsetInSym) {
return DebugVC50Impl.this.readIntNumericLeafAt(pos + HEADER_SIZE + offsetInSym);
}
private long (int offsetInSym) {
return DebugVC50Impl.this.readLongNumericLeafAt(pos + HEADER_SIZE + offsetInSym);
}
private float (int offsetInSym) {
return DebugVC50Impl.this.readFloatNumericLeafAt(pos + HEADER_SIZE + offsetInSym);
}
private double (int offsetInSym) {
return DebugVC50Impl.this.readDoubleNumericLeafAt(pos + HEADER_SIZE + offsetInSym);
}
private int (int offsetInSym) {
return DebugVC50Impl.this.lengthPrefixedStringLengthAt(pos + HEADER_SIZE + offsetInSym);
}
private String (int offsetInSym) {
return DebugVC50Impl.this.readLengthPrefixedStringAt(pos + HEADER_SIZE + offsetInSym);
}
}
class implements DebugVC50TypeIterator,
DebugVC50TypeLeafIndices, DebugVC50MemberAttributes, DebugVC50TypeEnums {
private DebugVC50SSGlobalTypes ;
private int ;
private int ;
private int ;
private int ;
private int ;
private int ;
private int ;
(DebugVC50SSGlobalTypes parent, int base, int numTypes) {
this(parent, base, numTypes, 0, base);
}
private (DebugVC50SSGlobalTypes parent, int base, int numTypes, int curType, int offset) {
this.parent = parent;
this.base = base;
this.numTypes = numTypes;
this.typeIndex = curType;
if (!done()) {
typeRecordOffset = offset;
loadTypeRecord();
}
}
public boolean () {
return (typeIndex == numTypes);
}
public void () throws NoSuchElementException {
if (done()) throw new NoSuchElementException();
++typeIndex;
if (!done()) {
typeRecordOffset = parent.getTypeOffset(typeIndex);
loadTypeRecord();
}
}
public short () {
return (short) typeRecordSize;
}
public int () {
return biasTypeIndex(typeIndex);
}
public int () {
return numTypes;
}
public boolean () {
return (typeStringOffset - typeRecordOffset - 2) >= typeRecordSize;
}
public void () throws NoSuchElementException {
if (typeStringDone()) throw new NoSuchElementException();
typeStringOffset += typeStringLength();
loadTypeString();
}
public int () {
return typeStringLeaf;
}
public int () {
return typeStringOffset;
}
public int () {
typeSeek(2);
return readInt();
}
public short () {
typeSeek(6);
return readShort();
}
public int () {
typeSeek(2);
return readInt();
}
public int () {
typeSeek(6);
return readInt();
}
public int () {
typeSeek(10);
return readInt();
}
public String () {
return readLengthPrefixedStringAt(14);
}
public int () {
typeSeek(10);
return readInt();
}
public short () {
typeSeek(14);
return readShort();
}
public int () {
typeSeek(2);
return readInt();
}
public int () {
typeSeek(6);
return readInt();
}
public int () throws DebugVC50WrongNumericTypeException {
return readIntNumericLeafAt(10);
}
public String () {
return readLengthPrefixedStringAt(10 + numericLeafLengthAt(10));
}
public short () {
typeSeek(2);
return readShort();
}
public short () {
typeSeek(4);
return readShort();
}
public int () {
typeSeek(6);
return readInt();
}
public DebugVC50TypeIterator () {
int index = unbiasTypeIndex(getClassFieldList());
int offset = parent.getTypeOffset(index);
return new DebugVC50TypeIteratorImpl(parent, base, numTypes, index, offset);
}
public int () {
typeSeek(10);
return readInt();
}
public int () {
typeSeek(14);
return readInt();
}
public int () throws DebugVC50WrongNumericTypeException {
return readIntNumericLeafAt(18);
}
public String () {
return readLengthPrefixedStringAt(18 + numericLeafLengthAt(18));
}
public short () {
typeSeek(2);
return readShort();
}
public short () {
typeSeek(4);
return readShort();
}
public int () {
typeSeek(6);
return readInt();
}
public DebugVC50TypeIterator () {
int index = unbiasTypeIndex(getUnionFieldList());
int offset = parent.getTypeOffset(index);
return new DebugVC50TypeIteratorImpl(parent, base, numTypes, index, offset);
}
public int () throws DebugVC50WrongNumericTypeException {
return readIntNumericLeafAt(10);
}
public String () {
return readLengthPrefixedStringAt(10 + numericLeafLengthAt(10));
}
public short () {
typeSeek(2);
return readShort();
}
public short () {
typeSeek(4);
return readShort();
}
public int () {
typeSeek(6);
return readInt();
}
public int () {
typeSeek(10);
return readInt();
}
public DebugVC50TypeIterator () {
int index = unbiasTypeIndex(getEnumFieldList());
int offset = parent.getTypeOffset(index);
return new DebugVC50TypeIteratorImpl(parent, base, numTypes, index, offset);
}
public String () {
return readLengthPrefixedStringAt(14);
}
public int () {
typeSeek(2);
return readInt();
}
public byte () {
typeSeek(6);
return readByte();
}
public short () {
typeSeek(8);
return readShort();
}
public int () {
typeSeek(10);
return readInt();
}
public DebugVC50TypeIterator () {
int index = unbiasTypeIndex(getProcedureArgumentList());
int offset = parent.getTypeOffset(index);
return new DebugVC50TypeIteratorImpl(parent, base, numTypes, index, offset);
}
public int () {
typeSeek(2);
return readInt();
}
public int () {
typeSeek(6);
return readInt();
}
public int () {
typeSeek(10);
return readInt();
}
public byte () {
typeSeek(14);
return readByte();
}
public short () {
typeSeek(16);
return readShort();
}
public int () {
typeSeek(18);
return readInt();
}
public DebugVC50TypeIterator () {
int index = unbiasTypeIndex(getMFunctionArgumentList());
int offset = parent.getTypeOffset(index);
return new DebugVC50TypeIteratorImpl(parent, base, numTypes, index, offset);
}
public int () {
typeSeek(22);
return readInt();
}
public short () {
typeSeek(2);
return readShort();
}
public int (int i) {
typeSeek(4 + (i / 2));
int val = readByte() & 0xFF;
if ((i % 2) != 0) {
val = val >> 4;
}
return val;
}
public int () {
typeSeek(2);
return readInt();
}
public short () {
typeSeek(2);
return readShort();
}
public int () {
typeSeek(2);
return readInt();
}
public int () {
typeSeek(6);
return readInt();
}
public String () {
return readLengthPrefixedStringAt(10);
}
public int () {
typeSeek(2);
return readInt();
}
public int (int i) {
typeSeek(6 + (4 * i));
return readInt();
}
public int () {
typeSeek(2);
return readInt();
}
public int () {
typeSeek(2);
return readInt();
}
public int (int i) {
typeSeek(6 + (4 * i));
return readInt();
}
public int () {
typeSeek(2);
return readInt();
}
public String () {
return readLengthPrefixedStringAt(6);
}
public int () {
typeSeek(2);
return readInt();
}
public int (int i) {
typeSeek(6);
return readInt();
}
public int () {
typeSeek(2);
return readInt();
}
public byte () {
typeSeek(6);
return readByte();
}
public byte () {
typeSeek(7);
return readByte();
}
public short () {
typeSeek(2);
return readShort();
}
public int () {
return (getLength() - 6 - (isMListIntroducingVirtual() ? 4 : 0)) / 4;
}
public int (int i) {
typeSeek(6 + 4 * i);
return readInt();
}
public boolean () {
return isIntroducingVirtual(getMListAttribute());
}
public int () {
typeSeek(6 + 4 * getMListLength());
return readInt();
}
public DebugVC50SymbolIterator () {
typeSeek(2);
int len = readShort() & 0xFFFF;
return new DebugVC50SymbolIteratorImpl(typeStringOffset + 2, len);
}
public short () {
typeSeek(2);
return readShort();
}
public int () {
typeSeek(4);
return readInt();
}
public int () throws DebugVC50WrongNumericTypeException {
return readIntNumericLeafAt(8);
}
public short () {
typeSeek(2);
return readShort();
}
public int () {
typeSeek(4);
return readInt();
}
public int () {
typeSeek(8);
return readInt();
}
public int () throws DebugVC50WrongNumericTypeException {
return readIntNumericLeafAt(12);
}
public int () throws DebugVC50WrongNumericTypeException {
return readIntNumericLeafAt(12 + numericLeafLengthAt(12));
}
public short () {
typeSeek(2);
return readShort();
}
public int () {
typeSeek(4);
return readInt();
}
public int () {
typeSeek(8);
return readInt();
}
public int () throws DebugVC50WrongNumericTypeException {
return readIntNumericLeafAt(12);
}
public int () throws DebugVC50WrongNumericTypeException {
return readIntNumericLeafAt(12 + numericLeafLengthAt(12));
}
public short () {
typeSeek(2);
return readShort();
}
public long () {
return readIntNumericLeafAt(4);
}
public String () {
return readLengthPrefixedStringAt(4 + numericLeafLengthAt(4));
}
public int () {
typeSeek(4);
return readInt();
}
public String () {
return readLengthPrefixedStringAt(8);
}
public int () {
typeSeek(4);
return readInt();
}
public DebugVC50TypeIterator () {
int index = unbiasTypeIndex(getIndexValue());
int offset = parent.getTypeOffset(index);
return new DebugVC50TypeIteratorImpl(parent, base, numTypes, index, offset);
}
public short () {
typeSeek(2);
return readShort();
}
public int () {
typeSeek(4);
return readInt();
}
public int () throws DebugVC50WrongNumericTypeException {
return readIntNumericLeafAt(8);
}
public String () {
return readLengthPrefixedStringAt(8 + numericLeafLengthAt(8));
}
public short () {
typeSeek(2);
return readShort();
}
public int () {
typeSeek(4);
return readInt();
}
public String () {
return readLengthPrefixedStringAt(8);
}
public short () {
typeSeek(2);
return readShort();
}
public int () {
typeSeek(4);
return readInt();
}
public String () {
return readLengthPrefixedStringAt(8);
}
public int () {
typeSeek(4);
return readInt();
}
public String () {
return readLengthPrefixedStringAt(8);
}
public int () {
typeSeek(4);
return readInt();
}
public int () {
typeSeek(4);
return readInt();
}
public short () {
typeSeek(2);
return readShort();
}
public int () {
typeSeek(4);
return readInt();
}
public boolean () {
return isIntroducingVirtual(getOneMethodAttribute());
}
public int () {
typeSeek(8);
return readInt();
}
public String () {
int baseLen = 8 + (isOneMethodIntroducingVirtual() ? 4 : 0);
return readLengthPrefixedStringAt(baseLen);
}
public int () {
typeSeek(4);
return readInt();
}
public int () {
typeSeek(8);
return readInt();
}
public short () {
typeSeek(2);
return readShort();
}
public int () {
typeSeek(4);
return readInt();
}
public String () {
return readLengthPrefixedStringAt(8);
}
public short () {
typeSeek(2);
return readShort();
}
public int () {
typeSeek(4);
return readInt();
}
public String () {
return readLengthPrefixedStringAt(8);
}
public short (int byteOffset) {
typeSeek(byteOffset);
return readShort();
}
public int (int byteOffset)
throws DebugVC50WrongNumericTypeException {
return numericLeafLengthAt(byteOffset);
}
public int (int byteOffset)
throws DebugVC50WrongNumericTypeException {
return readIntNumericLeafAt(byteOffset);
}
public long (int byteOffset)
throws DebugVC50WrongNumericTypeException {
throw new RuntimeException("Unimplemented");
}
public float (int byteOffset)
throws DebugVC50WrongNumericTypeException {
throw new RuntimeException("Unimplemented");
}
public double (int byteOffset)
throws DebugVC50WrongNumericTypeException {
throw new RuntimeException("Unimplemented");
}
public byte[] (int byteOffset)
throws DebugVC50WrongNumericTypeException {
throw new RuntimeException("Unimplemented");
}
private void () {
seek(typeRecordOffset);
typeRecordSize = readShort() & 0xFFFF;
typeStringOffset = typeRecordOffset + 2;
loadTypeString();
}
private void () {
seek(typeStringOffset);
int lo = readByte() & 0xFF;
if (lo >= LF_PAD0) {
typeStringLeaf = lo;
} else {
int hi = readByte() & 0xFF;
typeStringLeaf = (hi << 8) | lo;
}
}
private void (int offset) {
seek(typeStringOffset + offset);
}
private int () {
if (typeStringLeaf >= 0xF0 && typeStringLeaf <= 0xFF) {
return (typeStringLeaf - 0xF0);
}
switch (typeStringLeaf) {
case LF_MODIFIER: return 8;
case LF_POINTER: {
int extraLen = 0;
int attr = (getPointerAttributes() & POINTER_PTRTYPE_MASK) >> POINTER_PTRTYPE_SHIFT;
int mode = (getPointerAttributes() & POINTER_PTRMODE_MASK) >> POINTER_PTRMODE_SHIFT;
if (attr == POINTER_PTRTYPE_BASED_ON_TYPE) {
extraLen = 4 + numericLeafLengthAt(typeStringOffset + 14);
} else if (mode == POINTER_PTRMODE_PTR_TO_DATA_MEMBER ||
mode == POINTER_PTRMODE_PTR_TO_METHOD) {
extraLen = 6;
}
return 10 + extraLen;
}
case LF_ARRAY: {
int temp = 10 + numericLeafLengthAt(10);
return temp + lengthPrefixedStringLengthAt(temp);
}
case LF_CLASS:
case LF_STRUCTURE: {
int temp = 18 + numericLeafLengthAt(18);
return temp + lengthPrefixedStringLengthAt(temp);
}
case LF_UNION: {
int temp = 10 + numericLeafLengthAt(10);
return temp + lengthPrefixedStringLengthAt(temp);
}
case LF_ENUM: {
return 14 + lengthPrefixedStringLengthAt(14);
}
case LF_PROCEDURE: return 14;
case LF_MFUNCTION: return 26;
case LF_VTSHAPE: return 4 + ((getVTShapeCount() + 1) / 2);
case LF_COBOL0:
case LF_COBOL1: throw new COFFException("COBOL symbols unimplemented");
case LF_BARRAY: return 6;
case LF_LABEL: return 4;
case LF_NULL: return 2;
case LF_NOTTRAN: return 2;
case LF_DIMARRAY: return 10 + lengthPrefixedStringLengthAt(10);
case LF_VFTPATH: return 6 + 4 * getVFTPathCount();
case LF_PRECOMP: return 14 + lengthPrefixedStringLengthAt(14);
case LF_ENDPRECOMP: return 6;
case LF_OEM: throw new COFFException("OEM symbols unimplemented");
case LF_TYPESERVER: return 10 + lengthPrefixedStringLengthAt(10);
case LF_SKIP: return 6 + numericLeafLengthAt(6);
case LF_ARGLIST: return 6 + 4 * getArgListCount();
case LF_DEFARG: return 6 + lengthPrefixedStringLengthAt(6);
case LF_FIELDLIST: return 2;
case LF_DERIVED: return 6 + 4 * getDerivedCount();
case LF_BITFIELD: return 8;
case LF_METHODLIST: {
return 6 + 4 * getMListLength() + (isMListIntroducingVirtual() ? 4 : 0);
}
case LF_DIMCONU:
case LF_DIMCONLU:
case LF_DIMVARU:
case LF_DIMVARLU: throw new COFFException("LF_DIMCONU, LF_DIMCONLU, LF_DIMVARU, and LF_DIMVARLU unsupported");
case LF_REFSYM: {
seek(typeStringOffset + 2);
return 4 + readShort();
}
case LF_BCLASS: return 8 + numericLeafLengthAt(8);
case LF_VBCLASS:
case LF_IVBCLASS: {
int temp = 12 + numericLeafLengthAt(12);
return temp + numericLeafLengthAt(temp);
}
case LF_ENUMERATE: {
int temp = 4 + numericLeafLengthAt(4);
return temp + lengthPrefixedStringLengthAt(temp);
}
case LF_FRIENDFCN: return 8 + lengthPrefixedStringLengthAt(8);
case LF_INDEX: return 8;
case LF_MEMBER: {
int temp = 8 + numericLeafLengthAt(8);
return temp + lengthPrefixedStringLengthAt(temp);
}
case LF_STMEMBER: return 8 + lengthPrefixedStringLengthAt(8);
case LF_METHOD: return 8 + lengthPrefixedStringLengthAt(8);
case LF_NESTTYPE: return 8 + lengthPrefixedStringLengthAt(8);
case LF_VFUNCTAB: return 8;
case LF_FRIENDCLS: return 8;
case LF_ONEMETHOD: {
int baseLen = 8 + (isOneMethodIntroducingVirtual() ? 4 : 0);
return baseLen + lengthPrefixedStringLengthAt(baseLen);
}
case LF_VFUNCOFF: return 12;
case LF_NESTTYPEEX: return 8 + lengthPrefixedStringLengthAt(8);
case LF_MEMBERMODIFY: return 8 + lengthPrefixedStringLengthAt(8);
case LF_CHAR:
case LF_SHORT:
case LF_USHORT:
case LF_LONG:
case LF_ULONG:
case LF_REAL32:
case LF_REAL64:
case LF_REAL80:
case LF_REAL128:
case LF_QUADWORD:
case LF_UQUADWORD:
case LF_REAL48:
case LF_COMPLEX32:
case LF_COMPLEX64:
case LF_COMPLEX80:
case LF_COMPLEX128:
case LF_VARSTRING: throw new RuntimeException("Unexpected numeric leaf " + typeStringLeaf +
"in type string");
default:
throw new COFFException("Unrecognized leaf " + typeStringLeaf + " in type string at offset " +
typeStringOffset);
}
}
private boolean (int mprop) {
int masked = mprop & MEMATTR_MPROP_MASK;
return ((masked == MEMATTR_MPROP_INTRODUCING_VIRTUAL) ||
(masked == MEMATTR_MPROP_PURE_INTRODUCING_VIRTUAL));
}
private int (int offset) {
return DebugVC50Impl.this.numericLeafLengthAt(typeStringOffset + offset);
}
private int (int offset) {
return DebugVC50Impl.this.readIntNumericLeafAt(typeStringOffset + offset);
}
private int (int offset) {
return DebugVC50Impl.this.lengthPrefixedStringLengthAt(typeStringOffset + offset);
}
private String (int offset) {
return DebugVC50Impl.this.readLengthPrefixedStringAt(typeStringOffset + offset);
}
}
private int (int absoluteOffset) throws DebugVC50WrongNumericTypeException {
seek(absoluteOffset);
int leaf = readShort() & 0xFFFF;
if (leaf < 0x8000) return 2;
switch (leaf) {
case LF_CHAR: return 3;
case LF_SHORT:
case LF_USHORT: return 4;
case LF_LONG:
case LF_ULONG: return 6;
case LF_REAL32: return 6;
case LF_REAL64: return 10;
case LF_REAL80: return 12;
case LF_REAL128: return 18;
case LF_QUADWORD:
case LF_UQUADWORD: return 18;
case LF_REAL48: return 8;
case LF_COMPLEX32: return 10;
case LF_COMPLEX64: return 18;
case LF_COMPLEX80: return 26;
case LF_COMPLEX128: return 66;
case LF_VARSTRING: return 4 + readIntNumericLeafAt(absoluteOffset + 2);
default:
throw new DebugVC50WrongNumericTypeException("Illegal numeric leaf index " + leaf +
" at offset " + absoluteOffset);
}
}
private int (int absoluteOffset) throws DebugVC50WrongNumericTypeException {
seek(absoluteOffset);
int leaf = readShort() & 0xFFFF;
if (leaf < 0x8000) return leaf;
switch (leaf) {
case LF_CHAR: return readByte() & 0xFF;
case LF_SHORT:
case LF_USHORT: return readShort() & 0xFFFF;
case LF_LONG:
case LF_ULONG: return readInt();
default:
throw new DebugVC50WrongNumericTypeException("Illegal numeric leaf index " + leaf);
}
}
private long (int absoluteOffset) throws DebugVC50WrongNumericTypeException {
seek(absoluteOffset);
int leaf = readShort() & 0xFFFF;
if (leaf < 0x8000) return leaf;
switch (leaf) {
case LF_CHAR: return readByte() & 0xFF;
case LF_SHORT:
case LF_USHORT: return readShort() & 0xFFFF;
case LF_LONG:
case LF_ULONG: return readInt() & 0xFFFFFFFF;
case LF_QUADWORD:
case LF_UQUADWORD: return readLong();
default:
throw new DebugVC50WrongNumericTypeException("Illegal numeric leaf index " + leaf);
}
}
private float (int absoluteOffset) throws DebugVC50WrongNumericTypeException {
seek(absoluteOffset);
int leaf = readShort() & 0xFFFF;
if (leaf != LF_REAL32) {
throw new DebugVC50WrongNumericTypeException("Illegal numeric leaf index " + leaf);
}
return readFloat();
}
private double (int absoluteOffset) throws DebugVC50WrongNumericTypeException {
seek(absoluteOffset);
int leaf = readShort() & 0xFFFF;
if (leaf != LF_REAL64) {
throw new DebugVC50WrongNumericTypeException("Illegal numeric leaf index " + leaf);
}
return readDouble();
}
private int (int absoluteOffset) {
seek(absoluteOffset);
int len = readByte() & 0xFF;
return 1 + len;
}
private String (int absoluteOffset) {
seek(absoluteOffset);
int len = readByte() & 0xFF;
byte[] res = new byte[len];
int numRead = readBytes(res);
if (numRead != len) {
throw new COFFException("Error reading length prefixed string in symbol at offset " +
absoluteOffset);
}
try {
return new String(res, US_ASCII);
} catch (UnsupportedEncodingException e) {
throw new COFFException(e);
}
}
private int (int index) {
return index - 0x1000;
}
private int (int index) {
return index + 0x1000;
}
}
class implements SectionHeader {
private String ;
private int ;
private int ;
private int ;
private int ;
private int ;
private int ;
private short ;
private short ;
private int ;
private MemoizedObject[] ;
private MemoizedObject[] ;
public (int offset) throws COFFException {
seek(offset);
byte[] tmpName = new byte[8];
int numRead = readBytes(tmpName);
if (numRead != 8) {
throw new COFFException("Error reading name of section header at offset " + offset);
}
if (tmpName[0] == (byte) '/') {
int index = 0;
try {
index = Integer.parseInt(new String(tmpName, 1, tmpName.length - 1, US_ASCII));
} catch (NumberFormatException e) {
throw new COFFException("Error parsing string table index of name of section header " +
"at offset " + offset);
} catch (UnsupportedEncodingException e) {
throw new COFFException(e);
}
name = getStringTable().get(index);
} else {
try {
int length = 0;
for (; length < tmpName.length && tmpName[length] != '\0';) {
length++;
}
name = new String(tmpName, 0, length, US_ASCII);
} catch (UnsupportedEncodingException e) {
throw new COFFException(e);
}
}
virtualSize = readInt();
virtualAddress = readInt();
sizeOfRawData = readInt();
pointerToRawData = readInt();
pointerToRelocations = readInt();
pointerToLineNumbers = readInt();
numberOfRelocations = readShort();
numberOfLineNumbers = readShort();
characteristics = readInt();
relocations = new MemoizedObject[numberOfRelocations];
for (int i = 0; i < numberOfRelocations; i++) {
final int relocOffset = pointerToRelocations + i * RELOCATION_SIZE;
relocations[i] = new MemoizedObject() {
public Object () {
return new COFFRelocationImpl(relocOffset);
}
};
}
lineNumbers = new MemoizedObject[numberOfLineNumbers];
for (int i = 0; i < numberOfLineNumbers; i++) {
final int lineNoOffset = pointerToLineNumbers + i * LINE_NUMBER_SIZE;
lineNumbers[i] = new MemoizedObject() {
public Object () {
return new COFFLineNumberImpl(lineNoOffset);
}
};
}
}
public String () { return name; }
public int () { return virtualSize; }
public int () { return virtualAddress; }
public int () { return sizeOfRawData; }
public int () { return pointerToRawData; }
public int () { return pointerToRelocations; }
public int () { return pointerToLineNumbers; }
public short () { return numberOfRelocations; }
public short () { return numberOfLineNumbers; }
public int () { return characteristics; }
public boolean (int flag ) {
return ((characteristics & flag) != 0);
}
public COFFRelocation (int index) {
return (COFFRelocation) relocations[index].getValue();
}
public COFFLineNumber (int index) {
return (COFFLineNumber) lineNumbers[index];
}
}
class implements COFFSymbol, COFFSymbolConstants {
private int ;
private String ;
private int ;
private short ;
private short ;
private byte ;
private byte ;
private MemoizedObject = new MemoizedObject() {
public Object () {
return new AuxFunctionDefinitionRecordImpl(offset + SYMBOL_SIZE);
}
};
private MemoizedObject = new MemoizedObject() {
public Object () {
return new AuxBfEfRecordImpl(offset + SYMBOL_SIZE);
}
};
private MemoizedObject = new MemoizedObject() {
public Object () {
return new AuxWeakExternalRecordImpl(offset + SYMBOL_SIZE);
}
};
private MemoizedObject = new MemoizedObject() {
public Object () {
return new AuxFileRecordImpl(offset + SYMBOL_SIZE);
}
};
private MemoizedObject = new MemoizedObject() {
public Object () {
return new AuxSectionDefinitionsRecordImpl(offset + SYMBOL_SIZE);
}
};
public (int offset) throws COFFException {
this.offset = offset;
seek(offset);
byte[] tmpName = new byte[8];
int numRead = readBytes(tmpName);
if (numRead != 8) {
throw new COFFException("Error reading name of symbol at offset " + offset);
}
if ((tmpName[0] == 0) &&
(tmpName[1] == 0) &&
(tmpName[2] == 0) &&
(tmpName[3] == 0)) {
int stringOffset = (tmpName[4] << 24 |
tmpName[5] << 16 |
tmpName[6] << 8 |
tmpName[7]);
name = getStringTable().getAtOffset(stringOffset);
}
value = readInt();
sectionNumber = readShort();
type = readShort();
storageClass = readByte();
numberOfAuxSymbols = readByte();
}
public int () { return offset; }
public String () { return name; }
public int () { return value; }
public short () { return sectionNumber; }
public short () { return type; }
public byte () { return storageClass; }
public byte () { return numberOfAuxSymbols; }
public boolean () {
return ((getStorageClass() == IMAGE_SYM_CLASS_EXTERNAL) &&
((getType() >>> 8) == IMAGE_SYM_DTYPE_FUNCTION) &&
(getSectionNumber() > 0));
}
public AuxFunctionDefinitionRecord () {
return (AuxFunctionDefinitionRecord) auxFunctionDefinitionRecord.getValue();
}
public boolean () {
return ((getName().equals(".bf") || getName().equals(".ef")) &&
(getStorageClass() == IMAGE_SYM_CLASS_FUNCTION));
}
public AuxBfEfRecord () {
return (AuxBfEfRecord) auxBfEfRecord.getValue();
}
public boolean () {
return ((getStorageClass() == IMAGE_SYM_CLASS_EXTERNAL) &&
(getSectionNumber() == IMAGE_SYM_UNDEFINED) &&
(getValue() == 0));
}
public AuxWeakExternalRecord () {
return (AuxWeakExternalRecord) auxWeakExternalRecord.getValue();
}
public boolean () {
return ((getName().equals(".file")) &&
(getStorageClass() == IMAGE_SYM_CLASS_FILE));
}
public AuxFileRecord () {
return (AuxFileRecord) auxFileRecord.getValue();
}
public boolean () {
return ((getName().charAt(0) == '.') &&
(getStorageClass() == IMAGE_SYM_CLASS_STATIC));
}
public AuxSectionDefinitionsRecord () {
return (AuxSectionDefinitionsRecord) auxSectionDefinitionsRecord.getValue();
}
}
class implements AuxFunctionDefinitionRecord {
private int ;
private int ;
private int ;
private int ;
(int offset) {
seek(offset);
tagIndex = readInt();
totalSize = readInt();
pointerToLineNumber = readInt() - 1;
pointerToNextFunction = readInt();
}
public int () { return tagIndex; }
public int () { return totalSize; }
public int () { return pointerToLineNumber; }
public int () { return pointerToNextFunction; }
public int () { return FUNCTION_DEFINITION; }
}
class implements AuxBfEfRecord {
private short ;
private int ;
(int offset) {
seek(offset);
readInt();
lineNumber = readShort();
readInt();
readShort();
pointerToNextFunction = readInt();
}
public short () { return lineNumber; }
public int () { return pointerToNextFunction; }
public int () { return BF_EF_RECORD; }
}
class implements AuxWeakExternalRecord {
private int ;
private int ;
(int offset) {
seek(offset);
tagIndex = readInt();
characteristics = readInt();
}
public int () { return tagIndex; }
public int () { return characteristics; }
public int () { return WEAK_EXTERNAL; }
}
class implements AuxFileRecord {
private String ;
(int offset) {
seek(offset);
byte[] tmpName = new byte[18];
int numRead = readBytes(tmpName);
if (numRead != 18) {
throw new COFFException("Error reading auxiliary file record at offset " + offset);
}
try {
name = new String(tmpName, US_ASCII);
} catch (UnsupportedEncodingException e) {
throw new COFFException(e);
}
}
public String () { return name; }
public int () { return FILE; }
}
class implements AuxSectionDefinitionsRecord {
private int ;
private short ;
private short ;
private int ;
private short ;
private byte ;
(int offset) {
seek(offset);
length = readInt();
numberOfRelocations = readShort();
numberOfLineNumbers = readShort();
checkSum = readInt();
number = readShort();
selection = readByte();
}
public int () { return length; }
public short () { return numberOfRelocations; }
public short () { return numberOfLineNumbers; }
public int () { return checkSum; }
public short () { return number; }
public byte () { return selection; }
public int () { return SECTION_DEFINITION; }
}
class implements COFFRelocation {
private int ;
private int ;
private short ;
(int offset) {
seek(offset);
virtualAddress = readInt();
symbolTableIndex = readInt();
type = readShort();
}
public int () { return virtualAddress; }
public int () { return symbolTableIndex; }
public short () { return type; }
}
class implements COFFLineNumber {
private int ;
private short ;
(int offset) {
seek(offset);
type = readInt();
lineNumber = readShort();
}
public int () {
return type;
}
public short () {
return lineNumber;
}
}
class {
class {
String ;
int ;
(String str, int offset) {
this.str = str; this.offset = offset;
}
}
COFFString[] ;
(int offset) {
if (offset == 0) {
strings = new COFFString[0];
return;
}
seek(offset);
int length = readInt();
byte[] data = new byte[length - 4];
int numBytesRead = readBytes(data);
if (numBytesRead != data.length) {
throw new COFFException("Error reading string table (read " +
numBytesRead + " bytes, expected to read " + data.length + ")");
}
int numStrings = 0;
int ptr = 0;
for (ptr = 0; ptr < data.length; ptr++) {
if (data[ptr] == 0) {
numStrings++;
}
}
strings = new COFFString[numStrings];
int lastPtr = 0;
ptr = 0;
for (int i = 0; i < numStrings; i++) {
while (data[ptr] != 0) {
ptr++;
}
try {
strings[i] = new COFFString(new String(data, lastPtr, ptr - lastPtr, US_ASCII),
offset + ptr + 4);
} catch (UnsupportedEncodingException e) {
throw new COFFException(e);
}
ptr++;
lastPtr = ptr;
}
}
int () {
return strings.length;
}
String (int i) {
return strings[i].str;
}
String (int offset) {
int i = Arrays.binarySearch(strings, new COFFString(null, offset),
new Comparator<>() {
public int (COFFString s1, COFFString s2) {
if (s1.offset == s2.offset) {
return 0;
} else if (s1.offset < s2.offset) {
return -1;
} else {
return 1;
}
}
});
if (i < 0) {
throw new COFFException("No string found at file offset " + offset);
}
return strings[i].str;
}
}
}
void initialize() throws COFFException {
seek(0x3c);
try {
int peOffset = readInt();
seek(peOffset);
if ((readByte() == (byte) 'P') &&
(readByte() == (byte) 'E') &&
(readByte() == (byte) 0) &&
(readByte() == (byte) 0)) {
isImage = true;
imageHeaderOffset = getFilePointer();
}
}
catch (COFFException e) {
}
}
byte readByteAt(long offset) throws COFFException {
seek(offset);
return readByte();
}
byte readByte() throws COFFException {
try {
return file.readByte();
} catch (IOException e) {
throw new COFFException(e.toString() + " at offset 0x" +
Long.toHexString(filePos), e);
}
}
int readBytesAt(long offset, byte[] b) throws COFFException {
seek(offset);
return readBytes(b);
}
int readBytes(byte[] b) throws COFFException {
try {
return file.read(b);
} catch (IOException e) {
throw new COFFException(e.toString() + " at offset 0x" +
Long.toHexString(filePos), e);
}
}
short readShortAt(long offset) throws COFFException {
seek(offset);
return readShort();
}
short readShort() throws COFFException {
try {
return byteSwap(file.readShort());
} catch (IOException e) {
throw new COFFException(e.toString() + " at offset 0x" +
Long.toHexString(filePos), e);
}
}
int readIntAt(long offset) throws COFFException {
seek(offset);
return readInt();
}
int readInt() throws COFFException {
try {
return byteSwap(file.readInt());
} catch (IOException e) {
throw new COFFException(e.toString() + " at offset 0x" +
Long.toHexString(filePos), e);
}
}
long readLongAt(long offset) throws COFFException {
seek(offset);
return readLong();
}
long readLong() throws COFFException {
try {
return byteSwap(file.readLong());
} catch (IOException e) {
throw new COFFException(e.toString() + " at offset 0x" +
Long.toHexString(filePos), e);
}
}
float readFloat() throws COFFException {
int i = readInt();
return Float.intBitsToFloat(i);
}
double readDouble() throws COFFException {
long l = readLong();
return Double.longBitsToDouble(l);
}
String readCString() throws COFFException {
List<Byte> data = new ArrayList<>();
byte b = 0;
while ((b = readByte()) != 0) {
data.add(b);
}
byte[] bytes = new byte[data.size()];
for (int i = 0; i < data.size(); i++) {
bytes[i] = (data.get(i)).byteValue();
}
try {
return new String(bytes, US_ASCII);
} catch (UnsupportedEncodingException e) {
throw new COFFException(e);
}
}
void seek(long offset) throws COFFException {
try {
filePos = offset;
file.seek(offset);
} catch (IOException e) {
throw new COFFException(e.toString() + " at offset 0x" +
Long.toHexString(offset), e);
}
}
long getFilePointer() throws COFFException {
try {
return file.getFilePointer();
} catch (IOException e) {
throw new COFFException(e);
}
}
short byteSwap(short arg) {
return (short) ((arg << 8) | ((arg >>> 8) & 0xFF));
}
int byteSwap(int arg) {
return (((int) byteSwap((short) arg)) << 16) | (((int) (byteSwap((short) (arg >>> 16)))) & 0xFFFF);
}
long byteSwap(long arg) {
return ((((long) byteSwap((int) arg)) << 32) | (((long) byteSwap((int) (arg >>> 32))) & 0xFFFFFFFF));
}
public void close() throws COFFException {
try {
file.close();
} catch (IOException e) {
throw new COFFException(e);
}
}
}
}