## mars.util
Class MemoryDump

    java.lang.Object
      mars.util.MemoryDump

    public class MemoryDump

extends Object

Field Summary
`static ArrayList` `dumpTriples` A list of segmentname/dumpformat/filename triples which should be dumped

Constructor Summary
`MemoryDump()`

Method Summary
`static int` `getAddressOfFirstNull(int baseAddress, int limitAddress)` Look for first "null" memory value in an address range.
`static int[]` `getBaseAddresses(String[] segments)` Get the MIPS memory base address(es) of the specified segment name(s).
`static int[]` `getLimitAddresses(String[] segments)` Get the MIPS memory limit address(es) of the specified segment name(s).
`static Integer[]` `getSegmentBounds(String segment)` Return array with segment address bounds for specified segment.
`static String[]` `getSegmentNames()` Get the names of segments available for memory dump.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### dumpTriples

    public static ArrayList dumpTriples

  A list of segmentname/dumpformat/filename triples which should be dumped

Constructor Detail

### MemoryDump

    public MemoryDump()

Method Detail

### getSegmentBounds

    public static Integer[] getSegmentBounds(String segment)

  Return array with segment address bounds for specified segment.

  Parameters:
    `segment` - String with segment name (initially ".text" and ".data")
  Returns:
    array of two Integer, the base and limit address for that segment. Null if parameter name does not match a known segment name.

### getSegmentNames

    public static String[] getSegmentNames()

  Get the names of segments available for memory dump.

  Returns:
    array of Strings, each string is segment name (e.g. ".text", ".data")

### getBaseAddresses

    public static int[] getBaseAddresses(String[] segments)

  Get the MIPS memory base address(es) of the specified segment name(s). If invalid segment name is provided, will throw NullPointerException, so I recommend getting segment names from getSegmentNames().

  Parameters:
    `segments` - Array of Strings containing segment names (".text", ".data")
  Returns:
    Array of int containing corresponding base addresses.

### getLimitAddresses

    public static int[] getLimitAddresses(String[] segments)

  Get the MIPS memory limit address(es) of the specified segment name(s). If invalid segment name is provided, will throw NullPointerException, so I recommend getting segment names from getSegmentNames().

  Parameters:
    `segments` - Array of Strings containing segment names (".text", ".data")
  Returns:
    Array of int containing corresponding limit addresses.

### getAddressOfFirstNull

    public static int getAddressOfFirstNull(int baseAddress,
                                            int limitAddress)
                                     throws AddressErrorException

  Look for first "null" memory value in an address range. For text segment (binary code), this represents a word that does not contain an instruction. Normally use this to find the end of the program. For data segment, this represents the first block of simulated memory (block length currently 4K words) that has not been referenced by an assembled/executing program.

  Parameters:
    `baseAddress` - lowest MIPS address to be searched; the starting point
    `limitAddress` - highest MIPS address to be searched
  Returns:
    lowest address within specified range that contains "null" value as described above.
  Throws:
    `AddressErrorException` - if the base address is not on a word boundary