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 /** Describes the header of a section in a COFF file. The section 28 headers are grouped together into the Section Table. (Some of the 29 descriptions are taken directly from Microsoft's documentation and 30 are copyrighted by Microsoft.) */ 31 32 public interface SectionHeader { getName()33 public String getName(); 34 35 /** Total size of the section when loaded into memory. If this value 36 is greater than Size of Raw Data, the section is zero-padded. 37 This field is valid only for executable images and should be set 38 to 0 for object files. */ getSize()39 public int getSize(); 40 41 /** For executable images this is the address of the first byte of 42 the section, when loaded into memory, relative to the image 43 base. For object files, this field is the address of the first 44 byte before relocation is applied; for simplicity, compilers 45 should set this to zero. Otherwise, it is an arbitrary value 46 that is subtracted from offsets during relocation. */ getVirtualAddress()47 public int getVirtualAddress(); 48 49 /** Size of the section (object file) or size of the initialized 50 data on disk (image files). For executable image, this must be a 51 multiple of FileAlignment from the optional header. If this is 52 less than VirtualSize the remainder of the section is zero 53 filled. Because this field is rounded while the VirtualSize 54 field is not it is possible for this to be greater than 55 VirtualSize as well. When a section contains only uninitialized 56 data, this field should be 0. */ getSizeOfRawData()57 public int getSizeOfRawData(); 58 59 /** File pointer to section's first page within the COFF file. For 60 executable images, this must be a multiple of FileAlignment from 61 the optional header. For object files, the value should be 62 aligned on a four-byte boundary for best performance. When a 63 section contains only uninitialized data, this field should be 64 0. */ getPointerToRawData()65 public int getPointerToRawData(); 66 67 /** File pointer to beginning of relocation entries for the section. 68 Set to 0 for executable images or if there are no 69 relocations. */ getPointerToRelocations()70 public int getPointerToRelocations(); 71 72 /** File pointer to beginning of line-number entries for the 73 section. Set to 0 if there are no COFF line numbers. */ getPointerToLineNumbers()74 public int getPointerToLineNumbers(); 75 76 /** Number of relocation entries for the section. Set to 0 for 77 executable images. */ getNumberOfRelocations()78 public short getNumberOfRelocations(); 79 80 /** Number of line-number entries for the section. */ getNumberOfLineNumbers()81 public short getNumberOfLineNumbers(); 82 83 /** Flags describing section's characteristics; see {@link 84 sun.jvm.hotspot.debugger.win32.coff.SectionFlags}. */ getSectionFlags()85 public int getSectionFlags(); 86 87 /** Returns true if the appropriate flag (from {@link 88 sun.jvm.hotspot.debugger.win32.coff.SectionFlags}) is set. */ hasSectionFlag(int flag)89 public boolean hasSectionFlag(int flag); 90 91 /** This is only present for object files. Retrieves the COFF 92 relocation at the given index; valid indices are numbered 93 0...getNumberOfRelocations() - 1. */ getCOFFRelocation(int index)94 public COFFRelocation getCOFFRelocation(int index); 95 96 /** Retrieves the COFF line number at the given index; valid indices 97 are numbered 0...getNumberOfLineNumbers() - 1. */ getCOFFLineNumber(int index)98 public COFFLineNumber getCOFFLineNumber(int index); 99 } 100