Package ghidra.app.util.bin.format.macho.commands

# Class NList

java.lang.Object
ghidra.app.util.bin.format.macho.commands.NList

All Implemented Interfaces:
  `StructConverter`

public class NList extends Object implements StructConverter
Represents an nlist and nlist_64 structure.

See Also:
  - EXTERNAL_HEADERS/mach-o/nlist.h

- ## Field Summary

  ### Fields inherited from interface ghidra.app.util.bin.StructConverter

  `ASCII, BYTE, DWORD, IBO32, IBO64, POINTER, QWORD, SLEB128, STRING, ULEB128, UTF16, UTF8, VOID, WORD`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `NList(BinaryReader reader, boolean is32bit)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `short`
  `getDescription()`
  A 16-bit value providing additional information about this symbol.
  `int`
  `getLibraryOrdinal()`
  `byte`
  `getSection()`
  An integer specifying the number of the section that this symbol can be found in, or NO_SECT if symbol is not found in a section of this image.
  `int`
  `getSize()`
  `static int`
  `getSize(List<NList> nlists)`
  Gets the size in bytes of the given `NList`s (including associated strings)
  `String`
  `getString()`
  Returns the symbol string defined at the symbol table command string table offset plus n_strx.
  `int`
  `getStringTableIndex()`
  Returns the index into the string table.
  `byte`
  `getType()`
  Returns the symbol type flag.
  `long`
  `getValue()`
  An integer that contains the value of this symbol.
  `void`
  `initString(BinaryReader reader, long stringTableOffset)`
  Initialize the string from the string table.
  `boolean`
  `is32bit()`
  `boolean`
  `isExternal()`
  `boolean`
  `isIndirect()`
  `boolean`
  `isLazyBind()`
  `boolean`
  `isPrivateExternal()`
  `boolean`
  `isSymbolicDebugging()`
  `boolean`
  `isThumbSymbol()`
  `boolean`
  `isTypeAbsolute()`
  `boolean`
  `isTypePreboundUndefined()`
  `boolean`
  `isTypeUndefined()`
  `DataType`
  `toDataType()`
  Returns a structure datatype representing the contents of the implementor of this interface.
  `String`
  `toString()`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### NList

    public NList(BinaryReader reader, boolean is32bit) throws IOException
    Throws:
      `IOException`

- ## Method Details

  - ### initString

    public void initString(BinaryReader reader, long stringTableOffset)
    Initialize the string from the string table.

    You MUST call this method after the NLIST element is created!

    Reading a large NList table can cause a large performance issue if the strings are initialized as the NList entry is created. The string table indexes are scattered. Initializing the strings linearly from the string table is much faster.

    Parameters:
      `reader` - The BinaryReader
      `stringTableOffset` - offset of the string table

  - ### toDataType

    public DataType toDataType() throws DuplicateNameException, IOException
    Description copied from interface: `StructConverter`
    Returns a structure datatype representing the contents of the implementor of this interface.

    For example, given:

         class A {
             int foo;
             double bar;
         }

    The return value should be a structure data type with two data type components; an INT and a DOUBLE. The structure should contain field names and, if possible, field comments.

    Specified by:
      `toDataType` in interface `StructConverter`
    Returns:
      returns a structure datatype representing the implementor of this interface
    Throws:
      `DuplicateNameException` - when a datatype of the same name already exists
      `IOException` - if an IO-related error occurs
    See Also:
      - `StructureDataType`

  - ### getString

    public String getString()
    Returns the symbol string defined at the symbol table command string table offset plus n_strx.
    Returns:
      the symbol string

  - ### getStringTableIndex

    public int getStringTableIndex()
    Returns the index into the string table.
    Returns:
      the index into the string table

  - ### getType

    public byte getType()
    Returns the symbol type flag.
    Returns:
      the symbol type flag

  - ### isTypeUndefined

    public boolean isTypeUndefined()

  - ### isTypeAbsolute

    public boolean isTypeAbsolute()

  - ### isTypePreboundUndefined

    public boolean isTypePreboundUndefined()

  - ### isIndirect

    public boolean isIndirect()

  - ### isSymbolicDebugging

    public boolean isSymbolicDebugging()

  - ### isPrivateExternal

    public boolean isPrivateExternal()

  - ### isExternal

    public boolean isExternal()

  - ### isLazyBind

    public boolean isLazyBind()

  - ### isThumbSymbol

    public boolean isThumbSymbol()

  - ### getSection

    public byte getSection()
    An integer specifying the number of the section that this symbol can be found in, or NO_SECT if symbol is not found in a section of this image.
    Returns:
      the number of the section

  - ### getDescription

    public short getDescription()
    A 16-bit value providing additional information about this symbol.
    Returns:
      a 16-bit value providing additional information about this symbol

  - ### getValue

    public long getValue()
    An integer that contains the value of this symbol. The format of this value is different for each type of symbol.
    Returns:
      the value of this symbol

  - ### getLibraryOrdinal

    public int getLibraryOrdinal()

  - ### is32bit

    public boolean is32bit()

  - ### getSize

    public int getSize()

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### getSize

    public static int getSize(List<NList> nlists)
    Gets the size in bytes of the given `NList`s (including associated strings)
    Parameters:
      `nlists` - A `List` of `NList`s
    Returns:
      The size in bytes of the given `NList`s (including associated strings)