text:
package com.robbland.vend_machine.domain.exceptions;

public class InvalidCashTypeException extends Exception {

	/**
	 * This is required since Exception is Serializable.
	 * @see java.lang.Exception
	 * @see java.io.Serializable
	 */
	private static final long serialVersionUID = -4003999085824498143L;

}


text:
import { Component } from '@angular/core';

@Component({
    selector: 'demo-tooltip-basic',
    templateUrl: './tooltip-basic.html',
    styleUrls: ['./tooltip-basic.less']
})
export class TooltipBasicDemo { }

redpajama_set_name: RedPajamaGithub


text:
import types
import time

from xen.xend import sxp
from xen.xend import XendOptions
xoptions = XendOptions.instance()

from xen.xend import arch
from xen.xend.XendError import VmError
from xen.xend.XendLogging import log
from xen.xend.XendConstants import *

from xen.xend.server.DevController import DevController
from xen.xend.server.DevConstants import xenbusState

import xen.lowlevel.xc

from xen.util.pci import *
import resource
import re

from xen.xend.server.pciquirk import *
from xen.xend.xenstore.xstransact import xstransact
from xen.xend.xenstore.xswatch import xswatch

xc = xen.lowlevel.xc.xc()

#Calculate PAGE_SHIFT: number of bits to shift an address to get the page number
PAGE_SIZE = resource.getpagesize()
PAGE_SHIFT = 0
t = PAGE_SIZE
while not (t&1):
    t>>=1
    PAGE_SHIFT+=1

def parse_hex(val):
    try:
        if isinstance(val, types.StringTypes):
            return int(val, 16)
        else:
            return val
    except ValueError:
        return None

def get_assigned_pci_devices(domid):
    dev_str_list = []
    path = '/local/domain/0/backend/pci/%u/0/' % domid
    num_devs = xstransact.Read(path + 'num_devs');
    if num_devs is None or num_devs == "":
        return dev_str_list
    num_devs = int(num_devs)
    for i in range(num_devs):
        dev_str = xstransact.Read(path + 'dev-%i' % i)
        dev_str_list = dev_str_list + [dev_str]
    return dev_str_list

def get_all_assigned_pci_devices(domid = 0):
    dom_list = xstransact.List('/local/domain')
    pci_str_list = []
    ti = 0
    ts = xstransact.Read('/local/domain/' + str(domid) + '/target')
    if ts is not None :
        ti = int(ts)
    for d in dom_list:
        target = xstransact.Read('/local/domain/' + d + '/target')
        if int(d) is not ti and target is None :
            pci_str_list = pci_str_list + get_assigned_pci_devices(int(d))
    return pci_str_list

class PciController(DevController):

    def __init__(self, vm):
        self.aerStateWatch = None
        DevController.__init__(self, vm)

    def getDeviceDetails(self, config):
        """@see DevController.getDeviceDetails"""
        back = {}
        pcidevid = 0
        pci_defopts = []

        if 'pci_msitranslate' in self.vm.info['platform']:
            pci_defopts.append(['msitranslate',
                    str(self.vm.info['platform']['pci_msitranslate'])])
        if 'pci_power_mgmt' in self.vm.info['platform']:
            pci_defopts.append(['power_mgmt',
                    str(self.vm.info['platform']['pci_power_mgmt'])])

        for pci_config in config.get('devs', []):
            domain = parse_hex(pci_config.get('domain', 0))
            bus = parse_hex(pci_config.get('bus', 0))
            slot = parse_hex(pci_config.get('slot', 0))
            func = parse_hex(pci_config.get('func', 0))
            vdevfn = parse_hex(pci_config.get('vdevfn', \
                                              '0x%02x' % AUTO_PHP_SLOT))

            optslist = []
            if pci_config.has_key('opts'):
                optslist += pci_config['opts']
            if optslist or pci_defopts:
                opts = serialise_pci_opts(
                       append_default_pci_opts(optslist, pci_defopts))
                back['opts-%i' % pcidevid] = opts

            back['dev-%i' % pcidevid] = "%04x:%02x:%02x.%01x" % \
                                        (domain, bus, slot, func)
            back['uuid-%i' % pcidevid] = pci_config.get('uuid', '')
            back['key-%i' % pcidevid] = pci_config.get('key', '')
            back['vdevfn-%i' % pcidevid] = "%02x" % vdevfn
            pcidevid += 1

        back['num_devs']=str(pcidevid)
        back['uuid'] = config.get('uuid','')

        return (0, back, {})

    def reconfigureDevice_find(self, devid, nsearch_dev, match_dev):
        for j in range(nsearch_dev):
            if match_dev == self.readBackend(devid, 'dev-%i' % j):
                return j
        return None

    def reconfigureDevice(self, _, config):
        """@see DevController.reconfigureDevice"""
        (devid, back, front) = self.getDeviceDetails(config)
        num_devs = int(back['num_devs'])
        states = config.get('states', [])
        num_olddevs = int(self.readBackend(devid, 'num_devs'))

        for i in range(num_devs):
            try:
                dev = back['dev-%i' % i]
                state = states[i]
                uuid = back['uuid-%i' %i]
                key = back['key-%i' %i]
                opts = ''
                if 'opts-%i' % i in back:
                    opts = back['opts-%i' % i]
            except:
                raise XendError('Error reading config')

            if state == 'Initialising':
                devno = self.reconfigureDevice_find(devid, num_olddevs, dev)
                if devno == None:
                    devno = num_olddevs + i
                    log.debug('Attaching PCI device %s.' % dev)
                    attaching = True
                else:
                    log.debug('Reconfiguring PCI device %s.' % dev)
                    attaching = False

                self.setupOneDevice(parse_pci_name(dev))

                self.writeBackend(devid, 'dev-%i' % devno, dev)
                self.writeBackend(devid, 'state-%i' % devno,
                                  str(xenbusState['Initialising']))
                self.writeBackend(devid, 'uuid-%i' % devno, uuid)
                self.writeBackend(devid, 'key-%i' % devno, key)
                if len(opts) > 0:
                    self.writeBackend(devid, 'opts-%i' % devno, opts)
                if back.has_key('vdevfn-%i' % i):
                    self.writeBackend(devid, 'vdevfn-%i' % devno,
                                      back['vdevfn-%i' % i])

                # If a device is being attached then num_devs will grow
                if attaching:
                    self.writeBackend(devid, 'num_devs', str(devno + 1))

            elif state == 'Closing':
                # PCI device detachment
                devno = self.reconfigureDevice_find(devid, num_olddevs, dev)
                if devno == None:
                    raise XendError('Device %s is not connected' % dev)
                log.debug('Detaching device %s' % dev)
                self.writeBackend(devid, 'state-%i' % devno,
                                  str(xenbusState['Closing']))

            else:
                raise XendError('Error configuring device %s: invalid state %s'
                                % (dev,state))

        self.writeBackend(devid, 'state', str(xenbusState['Reconfiguring']))

        return self.readBackend(devid, 'uuid')

    def getDeviceConfiguration(self, devid, transaction = None):
        result = DevController.getDeviceConfiguration(self, devid, transaction)
        num_devs = self.readBackend(devid, 'num_devs')
        pci_devs = []

        for i in range(int(num_devs)):
            pci_dev = parse_pci_name(self.readBackend(devid, 'dev-%d' % i))

            # Per device uuid info
            pci_dev['uuid'] = self.readBackend(devid, 'uuid-%d' % i)
            pci_dev['key'] = self.readBackend(devid, 'key-%d' % i)
            pci_dev['vdevfn'] = '0x%s' % self.readBackend(devid,
                                                          'vdevfn-%d' % i)

            #append opts info
            opts = self.readBackend(devid, 'opts-%d' % i)
            if opts is not None:
                pci_dev['opts'] = opts

            pci_devs.append(pci_dev)

        result['devs'] = pci_devs
        result['uuid'] = self.readBackend(devid, 'uuid')
        return result

    def configuration(self, devid, transaction = None):
        """Returns SXPR for devices on domain.

        @note: we treat this dict especially to convert to
        SXP because it is not a straight dict of strings."""

        configDict = self.getDeviceConfiguration(devid, transaction)
        sxpr = [self.deviceClass]

        # remove devs
        devs = configDict.pop('devs', [])

        for dev in devs:
            dev_sxpr = ['dev']
            for dev_key, dev_val in dev.items():
                if dev_key == 'opts':
                    opts_sxpr = pci_opts_list_to_sxp(split_pci_opts(dev_val))
                    dev_sxpr = sxp.merge(dev_sxpr, opts_sxpr)
                else:
                    dev_sxpr.append([dev_key, dev_val])
            sxpr.append(dev_sxpr)

        for key, val in configDict.items():
            if type(val) == type(list()):
                for v in val:
                    sxpr.append([key, v])
            else:
                sxpr.append([key, val])

        return sxpr

    def CheckSiblingDevices(self, domid, dev):
        """ Check if all sibling devices of dev are owned by pciback or pci-stub
        """
        if not self.vm.info.is_hvm():
            return

        group_str = xc.get_device_group(domid, dev.domain, dev.bus, dev.slot, dev.func)
        if group_str == "":
            return

        #group string format xx:xx.x,xx:xx.x,
        for i in group_str.split(','):
            if i == '':
                continue
            pci_dev = parse_pci_name(i)
            pci_dev['domain'] = '%04x' % dev.domain
            try:
                sdev = PciDevice(pci_dev)
            except Exception, e:
                #no dom0 drivers bound to sdev
                continue

            if sdev.driver!='pciback' and sdev.driver!='pci-stub':
                raise VmError(("pci: PCI Backend and pci-stub don't "+ \
                    "own sibling device %s of device %s"\
                    )%(sdev.name, dev.name))
        return

    def setupOneDevice(self, pci_dev):
        """ Attach I/O resources for device to frontend domain
        """
        fe_domid = self.getDomid()

        try:
            dev = PciDevice(pci_dev)
        except Exception, e:
            raise VmError("pci: failed to locate device and "+
                    "parse its resources - "+str(e))

        if dev.driver!='pciback' and dev.driver!='pci-stub':
            raise VmError(("pci: PCI Backend and pci-stub don't own "+ \
                    "device %s") %(dev.name))

        self.CheckSiblingDevices(fe_domid, dev)

        if dev.driver == 'pciback':
            PCIQuirk(dev)

        if not self.vm.info.is_hvm() and not self.vm.info.is_stubdom() :
            # Setup IOMMU device assignment
            bdf = xc.assign_device(fe_domid, pci_dict_to_xc_str(pci_dev))
            pci_str = pci_dict_to_bdf_str(pci_dev)
            if bdf > 0:
                raise VmError("Failed to assign device to IOMMU (%s)" % pci_str)
            log.debug("pci: assign device %s" % pci_str)

        for (start, size) in dev.ioports:
            log.debug('pci: enabling ioport 0x%x/0x%x'%(start,size))
            rc = xc.domain_ioport_permission(domid = fe_domid, first_port = start,
                    nr_ports = size, allow_access = True)
            if rc<0:
                raise VmError(('pci: failed to configure I/O ports on device '+
                            '%s - errno=%d')%(dev.name,rc))

        for (start, size) in dev.iomem:
            # Convert start/size from bytes to page frame sizes
            start_pfn = start>>PAGE_SHIFT
            # Round number of pages up to nearest page boundary (if not on one)
            nr_pfns = (size+(PAGE_SIZE-1))>>PAGE_SHIFT

            log.debug('pci: enabling iomem 0x%x/0x%x pfn 0x%x/0x%x'% \
                    (start,size,start_pfn,nr_pfns))
            rc = xc.domain_iomem_permission(domid =  fe_domid,
                    first_pfn = start_pfn,
                    nr_pfns = nr_pfns,
                    allow_access = True)
            if rc<0:
                raise VmError(('pci: failed to configure I/O memory on device '+
                            '%s - errno=%d')%(dev.name,rc))

        if dev.irq > 0:
            rc = xc.physdev_map_pirq(domid = fe_domid,
                                   index = dev.irq,
                                   pirq  = dev.irq)
            if rc < 0:
                raise VmError(('pci: failed to map irq on device '+
                            '%s - errno=%d')%(dev.name,rc))
        if dev.irq>0:
            log.debug('pci: enabling irq %d'%dev.irq)
            rc = xc.domain_irq_permission(domid =  fe_domid, pirq = dev.irq,
                    allow_access = True)
            if rc<0:
                raise VmError(('pci: failed to configure irq on device '+
                            '%s - errno=%d')%(dev.name,rc))

    def dev_check_assignability_and_do_FLR(self, config):
        pci_dev_list = config.get('devs', [])
        pci_str_list = map(pci_dict_to_bdf_str, pci_dev_list)

        if len(pci_str_list) != len(set(pci_str_list)):
            raise VmError('pci: duplicate devices specified in guest config?')

        strict_check = xoptions.get_pci_dev_assign_strict_check()
        devs = []
        for pci_dev in pci_dev_list:
            try:
                dev = PciDevice(pci_dev)
            except Exception, e:
                raise VmError("pci: failed to locate device and "+
                        "parse its resources - "+str(e))
            if dev.driver!='pciback' and dev.driver!='pci-stub':
                raise VmError(("pci: PCI Backend and pci-stub don't own device"\
                    " %s") %(dev.name))

            devs.append(dev)

            if dev.has_non_page_aligned_bar and strict_check:
                raise VmError("pci: %s: non-page-aligned MMIO BAR found." % dev.name)

            # Check if there is intermediate PCIe switch bewteen the device and
            # Root Complex.
            if self.vm.info.is_hvm() and dev.is_behind_switch_lacking_acs() \
                and strict_check:
                err_msg = 'pci: to avoid potential security issue, %s is not'+\
                        ' allowed to be assigned to guest since it is behind'+\
                        ' PCIe switch that does not support or enable ACS.'
                raise VmError(err_msg % dev.name)

            if (dev.dev_type == DEV_TYPE_PCIe_ENDPOINT) and not dev.pcie_flr:
                if dev.bus == 0:
                    # We cope with this case by using the Dstate transition
                    # method or some vendor specific methods for now.
                    err_msg = 'pci: %s: it is on bus 0, but has no PCIe' +\
                        ' FLR Capability. Will try the Dstate transition'+\
                        ' method or some vendor specific methods if available.'
                    log.warn(err_msg % dev.name)
                else:
                    if not self.vm.info.is_hvm():
                        continue
                    if not strict_check:
                        continue

                    funcs = dev.find_all_the_multi_functions()
                    dev.devs_check_driver(funcs)
                    for f in funcs:
                        if not f in pci_str_list:
                            # f has been assigned to other guest?
                            if f in get_all_assigned_pci_devices():
                                err_msg = 'pci: %s must be co-assigned to' + \
                                    ' the same guest with %s'
                                raise VmError(err_msg % (f, dev.name))
            elif dev.dev_type == DEV_TYPE_PCI:
                if dev.bus == 0 or arch.type == "ia64":
                    if not dev.pci_af_flr:
                        # We cope with this case by using the Dstate transition
                        # method or some vendor specific methods for now.
                        err_msg = 'pci: %s: it is on bus 0, but has no PCI' +\
                            ' Advanced Capabilities for FLR. Will try the'+\
                            ' Dstate transition method or some vendor' +\
                            ' specific methods if available.'
                        log.warn(err_msg % dev.name)
                else:
                    if not self.vm.info.is_hvm():
                        continue
                    if not strict_check:
                        continue

                    # All devices behind the uppermost PCI/PCI-X bridge must be\
                    # co-assigned to the same guest.
                    devs_str = dev.find_coassigned_pci_devices(True)
                    # Remove the element 0 which is a bridge
                    del devs_str[0]

                    dev.devs_check_driver(devs_str)
                    for s in devs_str:
                        if not s in pci_str_list:
                            # s has been assigned to other guest?
                            if s in get_all_assigned_pci_devices():
                                err_msg = 'pci: %s must be co-assigned to the'+\
                                    ' same guest with %s'
                                raise VmError(err_msg % (s, dev.name))
        # try to do FLR
        for dev in devs:
            dev.do_FLR(self.vm.info.is_hvm(), strict_check)

    def setupDevice(self, config):
        """Setup devices from config
        """
        pci_dev_list = config.get('devs', [])
        for d in pci_dev_list:
            self.setupOneDevice(d)
        wPath = '/local/domain/0/backend/pci/%u/0/aerState' % (self.getDomid())
        self.aerStateWatch = xswatch(wPath, self._handleAerStateWatch)
        log.debug('pci: register aer watch %s', wPath)
        return

    def _handleAerStateWatch(self, _):
        log.debug('XendDomainInfo.handleAerStateWatch')
        if self.getDomid() == 0:
            raise XendError('Domain 0 cannot be shutdown')
        readPath = '/local/domain/0/backend/pci/%u/0/aerState' % (self.getDomid())
        action = xstransact.Read(readPath)
        if action and action=='aerfail':
            log.debug('shutdown domain because of aer handle error')
            self.vm.shutdown('poweroff')
        return True

    def cleanupOneDevice(self, pci_dev):
        """ Detach I/O resources for device from frontend domain
        """
        fe_domid = self.getDomid()

        try:
            dev = PciDevice(pci_dev)
        except Exception, e:
            raise VmError("pci: failed to locate device and "+
                    "parse its resources - "+str(e))

        if dev.driver!='pciback' and dev.driver!='pci-stub':
            raise VmError(("pci: PCI Backend and pci-stub don't own device "+ \
                    "%s") %(dev.name))

        # Need to do FLR here before deassign device in order to terminate
        # DMA transaction, etc
        dev.do_FLR(self.vm.info.is_hvm(),
            xoptions.get_pci_dev_assign_strict_check())

        if not self.vm.info.is_stubdom() :
            bdf = xc.deassign_device(fe_domid, pci_dict_to_xc_str(pci_dev))
            pci_str = pci_dict_to_bdf_str(pci_dev)
            if bdf > 0:
                raise VmError("Failed to deassign device from IOMMU (%s)" % pci_str)
            log.debug("pci: Deassign device %s" % pci_str)

        for (start, size) in dev.ioports:
            log.debug('pci: disabling ioport 0x%x/0x%x'%(start,size))
            rc = xc.domain_ioport_permission(domid = fe_domid, first_port = start,
                    nr_ports = size, allow_access = False)
            if rc<0:
                raise VmError(('pci: failed to configure I/O ports on device '+
                            '%s - errno=%d')%(dev.name,rc))

        for (start, size) in dev.iomem:
            # Convert start/size from bytes to page frame sizes
            start_pfn = start>>PAGE_SHIFT
            # Round number of pages up to nearest page boundary (if not on one)
            nr_pfns = (size+(PAGE_SIZE-1))>>PAGE_SHIFT

            log.debug('pci: disabling iomem 0x%x/0x%x pfn 0x%x/0x%x'% \
                    (start,size,start_pfn,nr_pfns))
            rc = xc.domain_iomem_permission(domid =  fe_domid,
                    first_pfn = start_pfn,
                    nr_pfns = nr_pfns,
                    allow_access = False)
            if rc<0:
                raise VmError(('pci: failed to configure I/O memory on device '+
                            '%s - errno=%d')%(dev.name,rc))

        if dev.irq>0:
            log.debug('pci: disabling irq %d'%dev.irq)
            rc = xc.domain_irq_permission(domid =  fe_domid, pirq = dev.irq,
                    allow_access = False)
            if rc<0:
                raise VmError(('pci: failed to configure irq on device '+
                            '%s - errno=%d')%(dev.name,rc))

    def cleanupDevice(self, devid):
        """ Detach I/O resources for device and cleanup xenstore nodes
        after reconfigure.

        @param devid: The device ID
        @type devid:  int
        @return:      Return the number of devices connected
        @rtype:       int
        """
        num_devs = int(self.readBackend(devid, 'num_devs'))
        new_num_devs = 0
        for i in range(num_devs):
            try:
                state = int(self.readBackend(devid, 'state-%i' % i))
            except:
                state = xenbusState['Unknown']

            if state == xenbusState['Closing']:
                # Detach I/O resources.
                pci_dev = parse_pci_name(self.readBackend(devid, 'dev-%i' % i))
                # In HVM case, I/O resources are disabled in ioemu.
                self.cleanupOneDevice(pci_dev)
                # Remove xenstore nodes.
                list = ['dev', 'vdev', 'state', 'uuid', 'vdevfn', 'key']
                if self.readBackend(devid, 'opts-%i' % i) is not None:
                    list.append('opts')
                for key in list:
                    self.removeBackend(devid, '%s-%i' % (key, i))
            else:
                new_num_devs = new_num_devs + 1
                if new_num_devs == i + 1:
                    continue

                list = ['dev', 'vdev', 'state', 'uuid', 'opts', 'vdevfn', 'key']
                for key in list:
                    tmp = self.readBackend(devid, '%s-%i' % (key, i))
                    if tmp is None:
                        continue
                    self.removeBackend(devid, '%s-%i' % (key, i))
                    self.writeBackend(devid,
                                      '%s-%i' % (key, new_num_devs - 1), tmp)

        self.writeBackend(devid, 'num_devs', str(new_num_devs))

        return new_num_devs

    def destroyDevice(self, devid, force):
        DevController.destroyDevice(self, devid, True)
        log.debug('pci: unregister aer watch')
        self.unwatchAerState()

    def unwatchAerState(self):
        """Remove the watch on the domain's aerState node, if any."""
        try:
            try:
                if self.aerStateWatch:
                    self.aerStateWatch.unwatch()
            finally:
                self.aerStateWatch = None
        except:
            log.exception("Unwatching aerState failed.")

    def waitForBackend(self,devid):
        return (0, "ok - no hotplug")

    def migrate(self, config, network, dst, step, domName):
        raise XendError('Migration not permitted with assigned PCI device.')


text:
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE chapter SYSTEM "chapter.dtd">

<chapter>

    <copyright>
      <year>1999</year><year>2013</year>
      <holder>Ericsson AB. All Rights Reserved.</holder>
    </copyright>
    <legalnotice>
      The contents of this file are subject to the Erlang Public License,
      Version 1.1, (the "License"); you may not use this file except in
      compliance with the License. You should have received a copy of the
      Erlang Public License along with this software. If not, it can be
      retrieved online at http://www.erlang.org/.

      Software distributed under the License is distributed on an "AS IS"
      basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
      the License for the specific language governing rights and limitations
      under the License.

    </legalnotice>

    <title>How to interpret the Erlang crash dumps</title>
    <prepared>Patrik Nyblom</prepared>
    <responsible></responsible>
    <docno></docno>
    <approved></approved>
    <checked></checked>
    <date>1999-11-11</date>
    <rev>PA1</rev>
    <file>crash_dump.xml</file>

This document describes the <c><![CDATA[erl_crash.dump]]></c> file generated
    upon abnormal exit of the Erlang runtime system.

Important: For OTP release R9C the Erlang crash dump has
    had a major facelift. This means that the information in this
    document will not be directly applicable for older dumps. However,
    if you use the Crashdump Viewer tool on older dumps, the crash
    dumps are translated into a format similar to this.

The system will write the crash dump in the current directory of
    the emulator or in the file pointed out by the environment variable
    (whatever that means on the current operating system)
    ERL_CRASH_DUMP. For a crash dump to be written, there has to be a
    writable file system mounted.

Crash dumps are written mainly for one of two reasons: either the
    builtin function <c><![CDATA[erlang:halt/1]]></c> is called explicitly with a
    string argument from running Erlang code, or else the runtime
    system has detected an error that cannot be handled. The most
    usual reason that the system can't handle the error is that the
    cause is external limitations, such as running out of memory. A
    crash dump due to an internal error may be caused by the system
    reaching limits in the emulator itself (like the number of atoms
    in the system, or too many simultaneous ets tables). Usually the
    emulator or the operating system can be reconfigured to avoid the
    crash, which is why interpreting the crash dump correctly is
    important.

The erlang crash dump is a readable text file, but it might not be
    very easy to read. Using the Crashdump Viewer tool in the
    <c><![CDATA[observer]]></c> application will simplify the task. This is an
    HTML based tool for browsing Erlang crash dumps.

    <marker id="general_info"></marker>
    <title>General information</title>

The first part of the dump shows the creation time for the dump,
      a slogan indicating the reason for the dump, the system version,
      of the node from which the dump originates, the compile time of
      the emulator running the originating node and the number of
      atoms in the atom table.

      <title>Reasons for crash dumps (slogan)</title>

The reason for the dump is noted in the beginning of the file
        as Slogan: <reason> (the word "slogan" has historical
        roots). If the system is halted by the BIF
        <c><![CDATA[erlang:halt/1]]></c>, the slogan is the string parameter
        passed to the BIF, otherwise it is a description generated by
        the emulator or the (Erlang) kernel. Normally the message
        should be enough to understand the problem, but nevertheless
        some messages are described here. Note however that the
        suggested reasons for the crash are only suggestions. The exact reasons for the errors may vary
        depending on the local applications and the underlying
        operating system.

      <list type="bulleted">
        <item>"<A>: Cannot allocate <N>
         bytes of memory (of type "<T>")." - The system
         has run out of memory. <A> is the allocator that failed
         to allocate memory, <N> is the number of bytes that
         <A> tried to allocate, and <T> is the memory block
         type that the memory was needed for. The most common case is
         that a process stores huge amounts of data. In this case
         <T> is most often <c><![CDATA[heap]]></c>, <c><![CDATA[old_heap]]></c>,
        <c><![CDATA[heap_frag]]></c>, or <c><![CDATA[binary]]></c>. For more information on
         allocators see
        <seealso marker="erts_alloc">erts_alloc(3)</seealso>.</item>
        <item>"<A>: Cannot reallocate <N>
         bytes of memory (of type "<T>")." - Same as
         above with the exception that memory was being reallocated
         instead of being allocated when the system ran out of memory.</item>
        <item>"Unexpected op code N" - Error in compiled
         code, <c><![CDATA[beam]]></c> file damaged or error in the compiler.</item>
        <item>"Module Name undefined" <c><![CDATA[|]]></c> "Function
        Name undefined" <c><![CDATA[|]]></c> "No function
        Name:Name/1" <c><![CDATA[|]]></c> "No function
        Name:start/2" - The kernel/stdlib applications are
         damaged or the start script is damaged.</item>
        <item>"Driver_select called with too large file descriptor
        <c><![CDATA[N]]></c>" - The number of file descriptors for sockets
         exceed 1024 (Unix only). The limit on file-descriptors in
         some Unix flavors can be set to over 1024, but only 1024
         sockets/pipes can be used simultaneously by Erlang (due to
         limitations in the Unix <c><![CDATA[select]]></c> call).  The number of
         open regular files is not affected by this.</item>
        <item>"Received SIGUSR1" - The SIGUSR1 signal was sent to the
         Erlang machine (Unix only).</item>
        <item>"Kernel pid terminated (Who)
         (Exit-reason)" - The kernel supervisor has detected
         a failure, usually that the <c><![CDATA[application_controller]]></c>
         has shut down (<c><![CDATA[Who]]></c> = <c><![CDATA[application_controller]]></c>,
        <c><![CDATA[Why]]></c> = <c><![CDATA[shutdown]]></c>).  The application controller
         may have shut down for a number of reasons, the most usual
         being that the node name of the distributed Erlang node is
         already in use. A complete supervisor tree "crash" (i.e.,
         the top supervisors have exited) will give about the same
         result. This message comes from the Erlang code and not from
         the virtual machine itself. It is always due to some kind of
         failure in an application, either within OTP or a
         "user-written" one. Looking at the error log for your
         application is probably the first step to take.</item>
        <item>"Init terminating in do_boot ()" - The primitive Erlang boot
         sequence was terminated, most probably because the boot
         script has errors or cannot be read. This is usually a
         configuration error - the system may have been started with
         a faulty <c><![CDATA[-boot]]></c> parameter or with a boot script from
         the wrong version of OTP.</item>
        <item>"Could not start kernel pid (Who) ()" - One of the
         kernel processes could not start. This is probably due to
         faulty arguments (like errors in a <c><![CDATA[-config]]></c> argument)
         or faulty configuration files. Check that all files are in
         their correct location and that the configuration files (if
         any) are not damaged. Usually there are also messages
         written to the controlling terminal and/or the error log
         explaining what's wrong.</item>
      </list>

Other errors than the ones mentioned above may occur, as the
        <c><![CDATA[erlang:halt/1]]></c> BIF may generate any message. If the
        message is not generated by the BIF and does not occur in the
        list above, it may be due to an error in the emulator. There
        may however be unusual messages that I haven't mentioned, that
        still are connected to an application failure. There is a lot
        more information available, so more thorough reading of the
        crash dump may reveal the crash reason. The size of processes,
        the number of ets tables and the Erlang data on each process
        stack can be useful for tracking down the problem.

      <title>Number of atoms</title>

The number of atoms in the system at the time of the crash is
        shown as Atoms: <number>. Some ten thousands atoms is
        perfectly normal, but more could indicate that the BIF
        <c><![CDATA[erlang:list_to_atom/1]]></c> is used to dynamically generate a
        lot of different atoms, which is never a good idea.

    <marker id="memory"></marker>
    <title>Memory information</title>

Under the tag =memory you will find information similar
      to what you can obtain on a living node with
      <seealso marker="erts:erlang#erlang:memory/0">erlang:memory()</seealso>.

    <marker id="internal_tables"></marker>
    <title>Internal table information</title>

The tags =hash_table:<table_name> and
      =index_table:<table_name> presents internal
      tables. These are mostly of interest for runtime system
      developers.

    <marker id="allocated_areas"></marker>
    <title>Allocated areas</title>

Under the tag =allocated_areas you will find information
      similar to what you can obtain on a living node with
      <seealso marker="erts:erlang#system_info_allocated_areas">erlang:system_info(allocated_areas)</seealso>.

    <marker id="allocator"></marker>
    <title>Allocator</title>

Under the tag =allocator:<A> you will find
      various information about allocator <A>. The information
      is similar to what you can obtain on a living node with
      <seealso marker="erts:erlang#system_info_allocator_tuple">erlang:system_info({allocator, <A>})</seealso>.
      For more information see the documentation of
      <seealso marker="erts:erlang#system_info_allocator_tuple">erlang:system_info({allocator, <A>})</seealso>,
      and the
      <seealso marker="erts_alloc">erts_alloc(3)</seealso>
      documentation.

    <marker id="processes"></marker>
    <title>Process information</title>

The Erlang crashdump contains a listing of each living Erlang
      process in the system. The process information for one process
      may look like this (line numbers have been added):

The following fields can exist for a process:

    <taglist>
      <tag>=proc:<pid></tag>
      <item>Heading, states the process identifier</item>
      <tag>State</tag>
      <item>

The state of the process. This can be one of the following:

        <list type="bulleted">
          <item>Scheduled - The process was scheduled to run
           but not currently running ("in the run queue").</item>
          <item>Waiting - The process was waiting for
           something (in <c><![CDATA[receive]]></c>).</item>
          <item>Running - The process was currently
           running. If the BIF <c><![CDATA[erlang:halt/1]]></c> was called, this was
           the process calling it.</item>
          <item>Exiting - The process was on its way to
           exit.</item>
          <item>Garbing - This is bad luck, the process was
           garbage collecting when the crash dump was written, the rest
           of the information for this process is limited.</item>
          <item>Suspended - The process is suspended, either
           by the BIF <c><![CDATA[erlang:suspend_process/1]]></c> or because it is
           trying to write to a busy port.</item>
        </list>
      </item>
      <tag>Registered name</tag>
      <item>The registered name of the process, if any.</item>
      <tag>Spawned as</tag>
      <item>The entry point of the process, i.e., what function was
       referenced in the <c><![CDATA[spawn]]></c> or <c><![CDATA[spawn_link]]></c> call that
       started the process.</item>
      <tag>Last scheduled in for | Current call</tag>
      <item>The current function of the process. These fields will not
       always exist.</item>
      <tag>Spawned by</tag>
      <item>The parent of the process, i.e. the process which executed
      <c><![CDATA[spawn]]></c> or <c><![CDATA[spawn_link]]></c>.</item>
      <tag>Started</tag>
      <item>The date and time when the process was started.</item>
      <tag>Message queue length</tag>
      <item>The number of messages in the process' message queue.</item>
      <tag>Number of heap fragments</tag>
      <item>The number of allocated heap fragments.</item>
      <tag>Heap fragment data</tag>
      <item>Size of fragmented heap data. This is data either created by
       messages being sent to the process or by the Erlang BIFs. This
       amount depends on so many things that this field is utterly
       uninteresting.</item>
      <tag>Link list</tag>
      <item>Process id's of processes linked to this one. May also contain
       ports. If process monitoring is used, this field also tells in
       which direction the monitoring is in effect, i.e., a link
       being "to" a process tells you that the "current" process was
       monitoring the other and a link "from" a process tells you
       that the other process was monitoring the current one.</item>
      <tag>Reductions</tag>
      <item>The number of reductions consumed by the process.</item>
      <tag>Stack+heap</tag>
      <item>The size of the stack and heap (they share memory segment)</item>
      <tag>OldHeap</tag>
      <item>The size of the "old heap". The Erlang virtual machine uses
       generational garbage collection with two generations. There is
       one heap for new data items and one for the data that have
       survived two garbage collections. The assumption (which is
       almost always correct) is that data that survive two garbage
       collections can be "tenured" to a heap more seldom garbage
       collected, as they will live for a long period. This is a
       quite usual technique in virtual machines.  The sum of the
       heaps and stack together constitute most of the process's
       allocated memory.</item>
      <tag>Heap unused, OldHeap unused</tag>
      <item>The amount of unused memory on each heap. This information is
       usually useless.</item>
      <tag>Stack</tag>
      <item>If the system uses shared heap, the fields
      Stack+heap, OldHeap, Heap unused
       and OldHeap unused do not exist. Instead this field
       presents the size of the process' stack.</item>
      <tag>Memory</tag>
      <item>The total memory used by this process. This includes call stack,
      heap and internal structures. Same as <seealso marker="erlang#process_info-2">erlang:process_info(Pid,memory)</seealso>.
      </item>
      <tag>Program counter</tag>
      <item>The current instruction pointer. This is only interesting for
       runtime system developers. The function into which the program
       counter points is the current function of the process.</item>
      <tag>CP</tag>
      <item>The continuation pointer, i.e. the return address for the
       current call. Usually useless for other than runtime system
       developers. This may be followed by the function into which
       the CP points, which is the function calling the current
       function.</item>
      <tag>Arity</tag>
      <item>The number of live argument registers. The argument registers,
       if any are live, will follow. These may contain the arguments
       of the function if they are not yet moved to the stack.</item>
    </taglist>

See also the section about <seealso marker="#proc_data">process data</seealso>.

    <marker id="ports"></marker>
    <title>Port information</title>

This section lists the open ports, their owners, any linked
      processed, and the name of their driver or external process.

    <marker id="ets_tables"></marker>
    <title>ETS tables</title>

This section contains information about all the ETS tables in
      the system. The following fields are interesting for each table:

    <taglist>
      <tag>=ets:<owner></tag>
      <item>Heading, states the owner of the table (a process identifier)</item>
      <tag>Table</tag>
      <item>The identifier for the table. If the table is a
      <c><![CDATA[named_table]]></c>, this is the name.</item>
      <tag>Name</tag>
      <item>The name of the table, regardless of whether it is a
      <c><![CDATA[named_table]]></c> or not.</item>
      <tag>Buckets</tag>
      <item>This occurs if the table is a hash table, i.e. if it is not an
      <c><![CDATA[ordered_set]]></c>.</item>
      <tag>Ordered set (AVL tree), Elements</tag>
      <item>This occurs only if the table is an <c><![CDATA[ordered_set]]></c>. (The
       number of elements is the same as the number of objects in the
       table.)</item>
      <tag>Objects</tag>
      <item>The number of objects in the table</item>
      <tag>Words</tag>
      <item>The number of words (usually 4 bytes/word) allocated to data
       in the table.</item>
    </taglist>

    <marker id="timers"></marker>
    <title>Timers</title>

This section contains information about all the timers started
      with the BIFs <c><![CDATA[erlang:start_timer/3]]></c> and
      <c><![CDATA[erlang:send_after/3]]></c>. The following fields exists for each
      timer:

    <taglist>
      <tag>=timer:<owner></tag>
      <item>Heading, states the owner of the timer (a process identifier)
       i.e. the process to receive the message when the timer
       expires.</item>
      <tag>Message</tag>
      <item>The message to be sent.</item>
      <tag>Time left</tag>
      <item>Number of milliseconds left until the message would have been
       sent.</item>
    </taglist>

    <marker id="distribution_info"></marker>
    <title>Distribution information</title>

If the Erlang node was alive, i.e., set up for communicating
      with other nodes, this section lists the connections that were
      active. The following fields can exist:

    <taglist>
      <tag>=node:<node_name></tag>
      <item>The name of the node</item>
      <tag>no_distribution</tag>
      <item>This will only occur if the node was not distributed.</item>
      <tag>=visible_node:<channel></tag>
      <item>Heading for a visible nodes, i.e. an alive node with a
       connection to the node that crashed. States the channel number
       for the node.</item>
      <tag>=hidden_node:<channel></tag>
      <item>Heading for a hidden node. A hidden node is the same as a
       visible node, except that it is started with the "-hidden"
       flag. States the channel number for the node.</item>
      <tag>=not_connected:<channel></tag>
      <item>Heading for a node which is has been connected to the crashed
       node earlier. References (i.e. process or port identifiers)
       to the not connected node existed at the time of the crash.
       exist. States the channel number for the node.</item>
      <tag>Name</tag>
      <item>The name of the remote node.</item>
      <tag>Controller</tag>
      <item>The port which controls the communication with the remote node.</item>
      <tag>Creation</tag>
      <item>An integer (1-3) which together with the node name identifies
       a specific instance of the node.</item>
      <tag>Remote monitoring: <local_proc>  <remote_proc></tag>
      <item>The local process was monitoring the remote process at the
       time of the crash.</item>
      <tag>Remotely monitored by: <local_proc>  <remote_proc></tag>
      <item>The remote process was monitoring the local process at the
       time of the crash.</item>
      <tag>Remote link: <local_proc> <remote_proc></tag>
      <item>A link existed between the local process and the remote
       process at the time of the crash.</item>
    </taglist>

    <marker id="loaded_modules"></marker>
    <title>Loaded module information</title>

This section contains information about all loaded modules.
      First, the memory usage by loaded code is summarized. There is
      one field for "Current code" which is code that is the current
      latest version of the modules. There is also a field for "Old
      code" which is code where there exists a newer version in the
      system, but the old version is not yet purged. The memory usage
      is in bytes.

All loaded modules are then listed. The following fields exist:

    <taglist>
      <tag>=mod:<module_name></tag>
      <item>Heading, and the name of the module.</item>
      <tag>Current size</tag>
      <item>Memory usage for the loaded code in bytes</item>
      <tag>Old size</tag>
      <item>Memory usage for the old code, if any.</item>
      <tag>Current attributes</tag>
      <item>Module attributes for the current code. This field is decoded
       when looked at by the Crashdump Viewer tool.</item>
      <tag>Old attributes</tag>
      <item>Module attributes for the old code, if any. This field is
       decoded when looked at by the Crashdump Viewer tool.</item>
      <tag>Current compilation info</tag>
      <item>Compilation information (options) for the current code. This
       field is decoded when looked at by the Crashdump Viewer tool.</item>
      <tag>Old compilation info</tag>
      <item>Compilation information (options) for the old code, if
       any. This field is decoded when looked at by the Crashdump
       Viewer tool.</item>
    </taglist>

    <marker id="funs"></marker>
    <title>Fun information</title>

In this section, all funs are listed. The following fields exist
      for each fun:

    <taglist>
      <tag>=fun</tag>
      <item>Heading</item>
      <tag>Module</tag>
      <item>The name of the module where the fun was defined.</item>
      <tag>Uniq, Index</tag>
      <item>Identifiers</item>
      <tag>Address</tag>
      <item>The address of the fun's code.</item>
      <tag>Native_address</tag>
      <item>The address of the fun's code when HiPE is enabled.</item>
      <tag>Refc</tag>
      <item>The number of references to the fun.</item>
    </taglist>

    <marker id="proc_data"></marker>
    <title>Process Data</title>

For each process there will be at least one =proc_stack
      and one =proc_heap tag followed by the raw memory
      information for the stack and heap of the process.

For each process there will also be a =proc_messages
      tag if the process' message queue is non-empty and a
      =proc_dictionary tag if the process' dictionary (the
      <c><![CDATA[put/2]]></c> and <c><![CDATA[get/1]]></c> thing) is non-empty.

The raw memory information can be decoded by the Crashdump
      Viewer tool. You will then be able to see the stack dump, the
      message queue (if any) and the dictionary (if any).

The stack dump is a dump of the Erlang process stack. Most of
      the live data (i.e., variables currently in use) are placed on
      the stack; thus this can be quite interesting. One has to
      "guess" what's what, but as the information is symbolic,
      thorough reading of this information can be very useful. As an
      example we can find the state variable of the Erlang primitive
      loader on line <c><![CDATA[(5)]]></c> in the example below:

    <![CDATA[
(1)  3cac44   Return addr 0x13BF58 (<terminate process normally>)
(2)  y(0)     ["/view/siri_r10_dev/clearcase/otp/erts/lib/kernel/ebin","/view/siri_r10_dev/
(3)  clearcase/otp/erts/lib/stdlib/ebin"]
(4)  y(1)     <0.1.0>
(5)  y(2)     {state,[],none,#Fun<erl_prim_loader.6.7085890>,undefined,#Fun<erl_prim_loader.7.9000327>,#Fun<erl_prim_loader.8.116480692>,#Port<0.2>,infinity,#Fun<erl_prim_loader.9.10708760>}
(6)  y(3)     infinity    ]]>

When interpreting the data for a process, it is helpful to know
      that anonymous function objects (funs) are given a name
      constructed from the name of the function in which they are
      created, and a number (starting with 0) indicating the number of
      that fun within that function.

    <marker id="atoms"></marker>
    <title>Atoms</title>

Now all the atoms in the system are written. This is only
      interesting if one suspects that dynamic generation of atoms could
      be a problem, otherwise this section can be ignored.

Note that the last created atom is printed first.

    <title>Disclaimer</title>

The format of the crash dump evolves between releases of
      OTP. Some information here may not apply to your
      version. A description as this will never be complete; it is meant as
      an explanation of the crash dump in general and as a help
      when trying to find application errors, not as a complete
      specification.

</chapter>