//===-- stack_trace_compressor.cpp ------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #include "gwp_asan/stack_trace_compressor.h" namespace gwp_asan { namespace compression { namespace { // Encodes `Value` as a variable-length integer to `Out`. Returns zero if there // was not enough space in the output buffer to write the complete varInt. // Otherwise returns the length of the encoded integer. size_t varIntEncode(uintptr_t Value, uint8_t *Out, size_t OutLen) { … } // Decodes a variable-length integer to `Out`. Returns zero if the integer was // too large to be represented in a uintptr_t, or if the input buffer finished // before the integer was decoded (either case meaning that the `In` does not // point to a valid varInt buffer). Otherwise, returns the number of bytes that // were used to store the decoded integer. size_t varIntDecode(const uint8_t *In, size_t InLen, uintptr_t *Out) { … } uintptr_t zigzagEncode(uintptr_t Value) { … } uintptr_t zigzagDecode(uintptr_t Value) { … } } // anonymous namespace size_t pack(const uintptr_t *Unpacked, size_t UnpackedSize, uint8_t *Packed, size_t PackedMaxSize) { … } size_t unpack(const uint8_t *Packed, size_t PackedSize, uintptr_t *Unpacked, size_t UnpackedMaxSize) { … } } // namespace compression } // namespace gwp_asan