acrn-hypervisor/hypervisor/include/debug/assert.h
Shiqing Gao 54bd55d636 hv: fix 'Recursion in procedure calls found'
Here is how the recursion might happen:

                     when there is something wrong
                     |
sbuf_put -> memcpy_s -> pr_err -> do_logmsg
   |                                 |
   -----------------------------------

Replace 'pr_err' with 'ASSERT' in 'memcpy_s' to break this kind of
recursion.

Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
2018-07-09 09:24:15 +08:00

22 lines
396 B
C

/*
* Copyright (C) 2018 Intel Corporation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef ASSERT_H
#define ASSERT_H
#ifdef HV_DEBUG
void __assert(uint32_t line, const char *file, const char *txt);
#define ASSERT(x, ...) \
if (!(x)) {\
__assert(__LINE__, __FILE__, "fatal error");\
}
#else
#define ASSERT(x, ...) do { } while(0)
#endif
#endif /* ASSERT_H */