1 /*
2  * Copyright (c) 2000, 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.win32.coff;
26 
27 /** Models the information stored in the COFF header of either a
28     Portable Executable or object file. */
29 
30 public interface COFFHeader {
31   /** Returns one of the constants in {@link
32       sun.jvm.hotspot.debugger.win32.coff.MachineTypes}. */
getMachineType()33   public short getMachineType();
34 
35   /** Number of sections; indicates size of the Section Table, which
36       immediately follows the headers. */
getNumberOfSections()37   public short getNumberOfSections();
38 
39   /** Time and date the file was created. */
getTimeDateStamp()40   public int getTimeDateStamp();
41 
42   /** File offset of the COFF symbol table or 0 if none is present. */
getPointerToSymbolTable()43   public int getPointerToSymbolTable();
44 
45   /** Number of entries in the symbol table. This data can be used in
46       locating the string table, which immediately follows the symbol
47       table. */
getNumberOfSymbols()48   public int getNumberOfSymbols();
49 
50   /** Size of the optional header, which is required for executable
51       files but not for object files. An object file should have a
52       value of 0 here. */
getSizeOfOptionalHeader()53   public short getSizeOfOptionalHeader();
54 
55   /** Returns the optional header if one is present or null if not. */
getOptionalHeader()56   public OptionalHeader getOptionalHeader() throws COFFException;
57 
58   /** Gets the union of all characteristics set for this object or
59       image file. See {@link
60       sun.jvm.hotspot.debugger.win32.coff.Characteristics}. */
getCharacteristics()61   public short getCharacteristics();
62 
63   /** Indicates whether this file has the given characteristic. The
64       argument must be one of the constants specified in {@link
65       sun.jvm.hotspot.debugger.win32.coff.Characteristics}. */
hasCharacteristic(short characteristic)66   public boolean hasCharacteristic(short characteristic);
67 
68   /** Retrieves the section header at the given index, between
69       1 and getNumberOfSections(). <B>NOTE</B>: This index is one-based,
70       so the first section is numbered one, not zero. */
getSectionHeader(int index)71   public SectionHeader getSectionHeader(int index);
72 
73   /** Retrieves the COFF symbol at the given index, between 0 and
74       getNumberOfSymbols() - 1. This is distinct from CodeView
75       information. */
getCOFFSymbol(int index)76   public COFFSymbol getCOFFSymbol(int index);
77 
78   /** Returns the number of strings in the String Table, which
79       immediately follows the COFF Symbol Table. */
getNumberOfStrings()80   public int getNumberOfStrings();
81 
82   /** Retrieves the <i>i</i>th string (0..{@link #getNumberOfStrings} - 1)
83       from the string table. */
getString(int i)84   public String getString(int i);
85 }
86