Write the contents of a buffer to the XRPLD trace log

Behaviour

  • Write a buffer from inside the Hook to the trace log along with a message (if any)

Definition

int64_t trace (
    uint32_t mread_ptr,
    uint32_t mread_len,
    uint32_t dread_ptr,
    uint32_t dread_len,
    uint32_t as_hex
);

Example

#define SBUF(str) (uint32_t)(str), sizeof(str)
trace(SBUF("Buffer conatained"), SBUF(some_buffer), 1);

Parameters

NameTypeDescription
mread_ptruint32_tPointer to a message to output before the buffer. May be null.
mread_lenuint32_tLength of the message. May be null.
dread_ptruint32_tPointer to the buffer to output.
dread_lenuint32_tLength of the buffer to output.
as_hexuint32_tIf 1 output the buffer as hex.
If 0 output the buffer as utf-8.

Return Code

TypeDescription
int64_t0 if successful

If negative, an error:
OUT_OF_BOUNDS
- pointers/lengths specified outside of hook memory.