buflib: Add malloc-backed buflib

This is intended for improving the effectiveness of tools like
ASAN when debugging memory errors in the sim. It's not meant to
be a serious allocator for hosted targets.

Enable it by changing the buflib backend in config.h.

Change-Id: I0cf23cefa47ee35dede7b49e0e5b72dac60e8d3e
This commit is contained in:
Aidan MacDonald 2023-01-02 22:48:07 +00:00
parent f2f198663e
commit 92565e9246
5 changed files with 309 additions and 0 deletions

View file

@ -380,6 +380,8 @@ void buflib_check_valid(struct buflib_context *ctx);
#if CONFIG_BUFLIB_BACKEND == BUFLIB_BACKEND_MEMPOOL
#include "buflib_mempool.h"
#elif CONFIG_BUFLIB_BACKEND == BUFLIB_BACKEND_MALLOC
#include "buflib_malloc.h"
#endif
#ifndef BUFLIB_ALLOC_OVERHEAD