Refactor error reporting for bounds checks. (#464)

This introduces a very limited formatter that can embed strings and hex
representations of pointers / integers in an internal buffer. This is
used to format error strings for passing to `Pal::error`.  This is used,
in turn, by a wrapper for reporting bounds checks, which can be used by
external functions to implement bounds checks.

This removes the sprintf_l usage from the bounds checks.

This provides enough of a format implementation that the tests
introduced in #465 can be refactored to use this, instead of their
custom `printf` wrapper and that can be used by SNMALLOC_CHECK.  This
will be a follow-on PR.
This commit is contained in:
David Chisnall
2022-02-25 09:59:51 +00:00
committed by GitHub
parent 86aa28644c
commit 93efbb4807
6 changed files with 296 additions and 103 deletions

View File

@@ -1,5 +1,6 @@
#pragma once
#include "../backend/backend_concept.h"
#include "../ds/mpmcstack.h"
#include "../ds/spmcstack.h"
#include "../mem/metaslab.h"