Crash API documentation

Version: stable

FUNCTION
crash.get_backtrace() read backtrace recorded in a loaded crash dump
crash.get_extra_data() read text blob recorded in a crash dump
crash.get_modules() get all loaded modules from when the crash occured
crash.get_signum() read signal number from a crash report
crash.get_sys_field() reads a system field from a loaded crash dump
crash.get_user_field() reads user field from a loaded crash dump
crash.load_previous() loads a previously written crash dump
crash.release() releases a previously loaded crash dump
crash.set_file_path() sets the file location for crash dumps
crash.set_user_field() stores user-defined string value
crash.write_dump() writes crash dump
CONSTANT
crash.SYSFIELD_ANDROID_BUILD_FINGERPRINT android build fingerprint
crash.SYSFIELD_DEVICE_LANGUAGE system device language as reported by sys.get_sys_info
crash.SYSFIELD_DEVICE_MODEL device model as reported by sys.get_sys_info
crash.SYSFIELD_ENGINE_HASH engine version as hash
crash.SYSFIELD_ENGINE_VERSION engine version as release number
crash.SYSFIELD_LANGUAGE system language as reported by sys.get_sys_info
crash.SYSFIELD_MANUFACTURER device manufacturer as reported by sys.get_sys_info
crash.SYSFIELD_MAX The max number of sysfields.
crash.SYSFIELD_SYSTEM_NAME system name as reported by sys.get_sys_info
crash.SYSFIELD_SYSTEM_VERSION system version as reported by sys.get_sys_info
crash.SYSFIELD_TERRITORY system territory as reported by sys.get_sys_info
crash.USERFIELD_MAX The max number of user fields.
crash.USERFIELD_SIZE The max size of a single user field.

Functions

crash.get_backtrace()

crash.get_backtrace(handle)

A table is returned containing the addresses of the call stack.

PARAMETERS

handle number crash dump handle

RETURNS

backtrace table table containing the backtrace

crash.get_extra_data()

crash.get_extra_data(handle)

The format of read text blob is platform specific and not guaranteed but can be useful for manual inspection.

PARAMETERS

handle number crash dump handle

RETURNS

blob string string with the platform specific data

crash.get_modules()

crash.get_modules(handle)

The function returns a table containing entries with sub-tables that have fields 'name' and 'address' set for all loaded modules.

PARAMETERS

handle number crash dump handle

RETURNS

modules table module table

crash.get_signum()

crash.get_signum(handle)

read signal number from a crash report

PARAMETERS

handle number crash dump handle

RETURNS

signal number signal number

crash.get_sys_field()

crash.get_sys_field(handle,index)

reads a system field from a loaded crash dump

PARAMETERS

handle number crash dump handle
index number system field enum. Must be less than crash.SYSFIELD_MAX

RETURNS

value string, nil value recorded in the crash dump, or nil if it didn't exist

crash.get_user_field()

crash.get_user_field(handle,index)

reads user field from a loaded crash dump

PARAMETERS

handle number crash dump handle
index number user data slot index

RETURNS

value string user data value recorded in the crash dump

crash.load_previous()

crash.load_previous()

The crash dump will be removed from disk upon a successful load, so loading is one-shot.

PARAMETERS

None

RETURNS

handle number, nil handle to the loaded dump, or nil if no dump was found

crash.release()

crash.release(handle)

releases a previously loaded crash dump

PARAMETERS

handle number handle to loaded crash dump

crash.set_file_path()

crash.set_file_path(path)

Crashes occuring before the path is set will be stored to a default engine location.

PARAMETERS

path string file path to use

crash.set_user_field()

crash.set_user_field(index,value)

Store a user value that will get written to a crash dump when a crash occurs. This can be user id:s, breadcrumb data etc. There are 32 slots indexed from 0. Each slot stores at most 255 characters.

PARAMETERS

index number slot index. 0-indexed
value string string value to store

crash.write_dump()

crash.write_dump()

Performs the same steps as if a crash had just occured but allows the program to continue. The generated dump can be read by crash.load_previous

PARAMETERS

None


Constants

crash.SYSFIELD_ANDROID_BUILD_FINGERPRINT

android build fingerprint


crash.SYSFIELD_DEVICE_LANGUAGE

system device language as reported by sys.get_sys_info


crash.SYSFIELD_DEVICE_MODEL

device model as reported by sys.get_sys_info


crash.SYSFIELD_ENGINE_HASH

engine version as hash


crash.SYSFIELD_ENGINE_VERSION

engine version as release number


crash.SYSFIELD_LANGUAGE

system language as reported by sys.get_sys_info


crash.SYSFIELD_MANUFACTURER

device manufacturer as reported by sys.get_sys_info


crash.SYSFIELD_MAX

The max number of sysfields.


crash.SYSFIELD_SYSTEM_NAME

system name as reported by sys.get_sys_info


crash.SYSFIELD_SYSTEM_VERSION

system version as reported by sys.get_sys_info


crash.SYSFIELD_TERRITORY

system territory as reported by sys.get_sys_info


crash.USERFIELD_MAX

The max number of user fields.


crash.USERFIELD_SIZE

The max size of a single user field.