1 /*
2  * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * This code is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License version 2 only, as
7  * published by the Free Software Foundation.
8  *
9  * This code is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12  * version 2 for more details (a copy is included in the LICENSE file that
13  * accompanied this code).
14  *
15  * You should have received a copy of the GNU General Public License version
16  * 2 along with this work; if not, write to the Free Software Foundation,
17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18  *
19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20  * or visit www.oracle.com if you need additional information or have any
21  * questions.
22  *
23  */
24 
25 package sun.jvm.hotspot.debugger.posix.elf;
26 
27 import java.io.FileInputStream;
28 
29 /**
30  * This is a Java class that represents a ELF file header.
31  *
32  * @author Joshua W. Outwater
33  */
34 public interface ELFHeader {
35     /** No file type. */
36     public static final int FT_NONE = 0;
37     /** Relocatable file type. */
38     public static final int FT_REL = 1;
39     /** Executable file type. */
40     public static final int FT_EXEC = 2;
41     /** Shared object file type. */
42     public static final int FT_DYN = 3;
43     /** Core file file type. */
44     public static final int FT_CORE = 4;
45     /** Processor specific. */
46     public static final int FT_LOCPROC = 0xff00;
47     /** Processor specific. */
48     public static final int FT_HICPROC = 0xffff;
49 
50     /** No architecture type. */
51     public static final int ARCH_NONE = 0;
52     /** AT&T architecture type. */
53     public static final int ARCH_ATT = 1;
54     /** SPARC architecture type. */
55     public static final int ARCH_SPARC = 2;
56     /** Intel 386 architecture type. */
57     public static final int ARCH_i386 = 3;
58     /** Motorolla 68000 architecture type. */
59     public static final int ARCH_68k = 4;
60     /** Motorolla 88000 architecture type. */
61     public static final int ARCH_88k = 5;
62     /** Intel 860 architecture type. */
63     public static final int ARCH_i860 = 7;
64     /** MIPS architecture type. */
65     public static final int ARCH_MIPS = 8;
66 
67     /** Returns a file type which is defined by the file type constants. */
getFileType()68     public short getFileType();
69     /** Returns one of the architecture constants. */
getArch()70     public short getArch();
71     /** Returns the size of a section header. */
getSectionHeaderSize()72     public short getSectionHeaderSize();
73     /** Returns the number of section headers. */
getNumberOfSectionHeaders()74     public short getNumberOfSectionHeaders();
75     /** Returns the section header at the specified index.  The section header
76      * at index 0 is the undefined section header. */
getSectionHeader(int index)77     public ELFSectionHeader getSectionHeader(int index);
78     /** Returns the section header string table associated with this ELF
79      * file. */
getSectionHeaderStringTable()80     public ELFStringTable getSectionHeaderStringTable();
81     /** Returns the string table associated with this ELF file. */
getStringTable()82     public ELFStringTable getStringTable();
83     /** Returns the dynamic string table associated with this ELF file, or null
84      * if one does not exist. */
getDynamicStringTable()85     public ELFStringTable getDynamicStringTable();
86     /** Returns the hash table associated with this ELF file, or null if one
87      * does not exist.  NOTE: Currently the ELFHashTable does not work so this
88      * method will always return null. */
getHashTable()89     public ELFHashTable getHashTable();
90     /** Returns the symbol table associated with this ELF file, or null if one
91      * does not exist. */
getSymbolTableSection()92     public ELFSectionHeader getSymbolTableSection();
93     /** Returns the dynamic symbol table associated with this ELF file, or null
94      * if one does not exist. */
getDynamicSymbolTableSection()95     public ELFSectionHeader getDynamicSymbolTableSection();
96     /** Returns the elf symbol with the specified name or null if one is not
97      * found. */
getELFSymbol(String name)98     public ELFSymbol getELFSymbol(String name);
99     /** Returns the elf symbol with the specified address or null if one is not
100      * found. 'address' is relative to base of shared object for .so's. */
getELFSymbol(long address)101     public ELFSymbol getELFSymbol(long address);
102     /** Returns the size of a program header. */
103     //public short getProgramHeaderSize();
104     /** Returns the number of program headers. */
105     //public short getNumberOfProgramHeaders();
106     /** Returns the program header at the specified index. */
107     //public ProgramHeader getProgramHeader(int index);
108 }
109