001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package org.netbeans.modules.cnd.dwarfdump.elf;
043:
044: import org.netbeans.modules.cnd.dwarfdump.dwarfconsts.ElfConstants;
045:
046: public class ElfHeader {
047: public int elfClass = 0; /* File class */
048: public int elfData = 0; /* Data encoding */
049: public int elfVersion = 0; /* File version */
050: public int elfOs = 0; /* Operating system/ABI identification */
051: public int elfAbi = 0; /* ABI version */
052:
053: // Elf Header
054: public short e_type = 0; /* file type */
055: public short e_machine = 0; /* target machine */
056: public int e_version = 0; /* file version */
057: public long e_entry = 0; /* start address */
058: public long e_phoff = 0; /* phdr file offset */
059: public long e_shoff = 0; /* shdr file offset */
060: public int e_flags = 0; /* file flags */
061: public short e_ehsize = 0; /* sizeof ehdr */
062: public short e_phentsize = 0; /* sizeof phdr */
063: public short e_phnum = 0; /* number phdrs */
064: public short e_shentsize = 0; /* sizeof shdr */
065: public short e_shnum = 0; /* number shdrs */
066: public short e_shstrndx = 0; /* shdr string index */
067:
068: public boolean isMSBData() {
069: return elfData == ElfConstants.ELFDATA2MSB;
070: }
071:
072: public boolean isLSBData() {
073: return elfData == ElfConstants.ELFDATA2LSB;
074: }
075:
076: public boolean is32Bit() {
077: return elfClass == ElfConstants.ELFCLASS32;
078: }
079:
080: public boolean is64Bit() {
081: return elfClass == ElfConstants.ELFCLASS64;
082: }
083:
084: public long getSectionHeaderOffset() {
085: return e_shoff;
086: }
087:
088: public int getDataEncoding() {
089: return elfData;
090: }
091:
092: public int getFileClass() {
093: return elfClass;
094: }
095:
096: public int getNumberOfSectionHeaders() {
097: return e_shnum;
098: }
099:
100: public short getELFStringTableSectionIndex() {
101: return e_shstrndx;
102: }
103: }
|