Native crash logging functions and constants.
Version: alpha
| TYPES | |
|---|---|
| crash.USERFIELD | User crash-field slot index |
| RECORDS | |
|---|---|
| crash.module_info | Loaded crash module |
| ENUMS | |
|---|---|
| crash.SYSFIELD | System crash fields |
| FUNCTIONS | |
|---|---|
| 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 |
| CONSTANTS | |
|---|---|
| crash.SYSFIELD_MAX | The max number of sysfields. |
| crash.USERFIELD_MAX | The max number of user fields. |
| crash.USERFIELD_SIZE | The max size of a single user field. |
crash.USERFIELD = integer
An integer index identifying one of the 32 user-defined fields stored in a
crash dump. Valid indices are 0 through 31. Each field stores a string of at
most crash.USERFIELD_SIZE bytes; longer strings are truncated.
EXAMPLES
crash.set_user_field(0, "level=forest")
crash.set_user_field(1, "checkpoint=3")
Loaded crash module
FIELDS
name |
string |
module name |
address |
string |
module load address |
crash.SYSFIELD: integer
System crash fields
VALUES
crash.get_backtrace(handle:number)→backtrace:string[]
A table is returned containing the addresses of the call stack.
PARAMETERS
handle |
number |
crash dump handle |
RETURNS
backtrace |
string[] |
table containing the backtrace |
crash.get_extra_data(handle:number)→blob:string
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(handle:number)→modules:crash.module_info[]
get all loaded modules from when the crash occured
PARAMETERS
handle |
number |
crash dump handle |
RETURNS
modules |
crash.module_info[] |
loaded modules |
crash.get_signum(handle:number)→signal:number
read signal number from a crash report
PARAMETERS
handle |
number |
crash dump handle |
RETURNS
signal |
number |
signal number |
crash.get_sys_field(handle:number, index:crash.SYSFIELD)→value:string|nil
reads a system field from a loaded crash dump
PARAMETERS
handle |
number |
crash dump handle |
index |
crash.SYSFIELD |
system field enum. Must be less than crash.SYSFIELD_MAX |
RETURNS
value |
stringnil |
value recorded in the crash dump, or nil if it didn't exist
|
crash.get_user_field(handle:number, index:crash.USERFIELD)→value:string
reads user field from a loaded crash dump
PARAMETERS
handle |
number |
crash dump handle |
index |
crash.USERFIELD |
user data slot index |
RETURNS
value |
string |
user data value recorded in the crash dump |
crash.load_previous()→handle:number|nil
The crash dump will be removed from disk upon a successful load, so loading is one-shot.
PARAMETERS
None
RETURNS
handle |
numbernil |
handle to the loaded dump, or nil if no dump was found
|
crash.release(handle:number)
releases a previously loaded crash dump
PARAMETERS
handle |
number |
handle to loaded crash dump |
crash.set_file_path(path:string)
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(index:crash.USERFIELD, value:string)
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 |
crash.USERFIELD |
slot index. 0-indexed |
value |
string |
string value to store |
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