/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* See LICENSE.txt included in this distribution for the specific
* language governing permissions and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at LICENSE.txt.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
/**
* Analyzes ELF (Executable and Linking Format) files.
* Created on September 23, 2005
*
* @author Chandan
* @author Trond Norbye
*/
static {
}
/**
* Creates a new instance of ELFAnalyzer
* @param factory The factory that creates ELFAnalyzers
*/
super(factory);
content = new StringBuilder();
}
if (in instanceof FileInputStream) {
}
} else {
try {
}
} finally {
}
}
}
return;
}
return ;
}
int ri = 0;
if (sectionName != null) {
}
}
}
boolean lastPrintable = false;
for (int i = 0; i < ri; i++) {
byte c;
while (size-- > 0) {
if (isReadable(c)) {
lastPrintable = true;
} else if (lastPrintable) {
lastPrintable = false;
}
}
}
sb.trimToSize();
}
private boolean isReadable(int c) {
if (c > ' ' && c <= 127) {
return true;
}
return false;
}
if (tab == 0) {
return null;
}
byte c;
}
}
}
};
return tc;
}
}
/**
* Write a cross referenced HTML file.
* @param out Writer to write
*/
}
private static class ELFHeader {
// Elf32 Addr = readInt
// elf32 half = readUnsignedShort
// Off = int
// Sword = int
// Word = int
// un = unsignedBtye
@SuppressWarnings("unused")
public int ei_version;
public int e_entry;
public int e_phoff;
public int e_shoff;
public int e_flags;
public int e_ehsize;
public int e_phentsize;
public int e_phnum;
public int e_shentsize;
public int e_shnum;
public int e_shstrndx;
throw new IllegalArgumentException("Not an ELF file");
}
} else {
}
}
return (e_machine.toString() + " " + ei_class.toString() + " " + "\ne_type: " + e_type.toString() + "\ne_machine: " + e_machine.value() + "\ne_version: " + e_version + "\ne_entry: " + e_entry + "\ne_phoff: " + e_phoff + "\ne_shoff: " + e_shoff + "\ne_flags: " + e_flags + "\ne_ehsize: " + e_ehsize + "\ne_phentsize:" + e_phentsize + "\ne_phnum: " + e_phnum + "\ne_shentsize" + e_shentsize + "\ne_shnum: " + e_shnum + "\ne_shstrndx: " + e_shstrndx);
}
}
private static class ELFSection {
public int sh_name;
public int sh_type;
public int sh_flags;
public int sh_addr;
public int sh_offset;
public int sh_size;
public int sh_link;
public int sh_info;
public int sh_addralign;
public int sh_entsize;
}
return ("\nsh_name : " + sh_name + "\nsh_type : " + sh_type + "\nsh_flags: " + sh_flags + "\nsh_addr: " + sh_addr + "\nsh_offset: " + sh_offset + "\nsh_size: " + sh_size + "\nsh_link: " + sh_link + "\nsh_info: " + sh_info + "\nsh_addralign: " + sh_addralign + "\nsh_entsize: " + sh_entsize);
}
}
private static enum ELFIdentification {
private final int value;
}
public int value() {
return this.value;
}
}
private static enum EI_Class {
"None", "32", "64"
};
private final int value;
}
switch (value) {
case 0: return ELFCLASSNONE;
case 1: return ELFCLASS32;
case 2: return ELFCLASS64;
default:
}
}
public int value() {
return this.value;
}
}
}
private static enum EI_Data {
private final int value;
}
switch (value) {
case 0: return ELFDATANONE;
case 1: return ELFDATA2LSB;
case 2: return ELFDATA2MSB;
default:
}
}
public int value() {
return this.value;
}
}
private static enum E_Type {
"None", "Relocable", "Executable", "Shared object", "Core"
};
private final int value;
}
switch (value) {
case 0: return ET_NONE;
case 1: return ET_REL;
case 2: return ET_EXEC;
case 3: return ET_DYN;
case 4: return ET_CORE;
default:
return ET_UNKNOWN;
}
}
public int value() {
return this.value;
}
return "Unknown";
}
}
}
private static enum E_Machine {
"No machine", "AT&T WE 32100", "SPARC", "Intel 80386",
"Intel 80860", "MIPS RS3000"
};
private final int value;
}
switch (value) {
case 0: return EM_NONE;
case 1: return EM_M32;
case 2: return EM_SPARC;
case 3: return EM_386;
case 4: return EM_68K;
case 5: return EM_88K;
case 7: return EM_860;
case 8: return EM_MIPS;
default:
return EM_UNKNOWN;
}
}
public int value() {
return this.value;
}
return "Unknown";
}
}
}
private static enum E_Version {
"Invalid", "Current"
};
private final int value;
}
switch (value) {
case 0: return EV_NONE;
case 1: return EV_CURRENT;
default:
}
}
public int value() {
return this.value;
}
}
}
}