ยปCore Development>Code coverage>Modules/_ctypes/libffi_arm_wince/debug.c

Python code coverage for Modules/_ctypes/libffi_arm_wince/debug.c

#countcontent
1n/a/* -----------------------------------------------------------------------
2n/a debug.c - Copyright (c) 1996 Red Hat, Inc.
3n/a
4n/a Permission is hereby granted, free of charge, to any person obtaining
5n/a a copy of this software and associated documentation files (the
6n/a ``Software''), to deal in the Software without restriction, including
7n/a without limitation the rights to use, copy, modify, merge, publish,
8n/a distribute, sublicense, and/or sell copies of the Software, and to
9n/a permit persons to whom the Software is furnished to do so, subject to
10n/a the following conditions:
11n/a
12n/a The above copyright notice and this permission notice shall be included
13n/a in all copies or substantial portions of the Software.
14n/a
15n/a THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
16n/a OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17n/a MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18n/a IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
19n/a OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20n/a ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21n/a OTHER DEALINGS IN THE SOFTWARE.
22n/a ----------------------------------------------------------------------- */
23n/a
24n/a#include <ffi.h>
25n/a#include <ffi_common.h>
26n/a#include <stdlib.h>
27n/a#include <stdio.h>
28n/a
29n/a/* General debugging routines */
30n/a
31n/avoid ffi_stop_here(void)
32n/a{
33n/a /* This function is only useful for debugging purposes.
34n/a Place a breakpoint on ffi_stop_here to be notified of
35n/a significant events. */
36n/a}
37n/a
38n/a/* This function should only be called via the FFI_ASSERT() macro */
39n/a
40n/avoid ffi_assert(char *expr, char *file, int line)
41n/a{
42n/a fprintf(stderr, "ASSERTION FAILURE: %s at %s:%d\n", expr, file, line);
43n/a ffi_stop_here();
44n/a abort();
45n/a}
46n/a
47n/a/* Perform a sanity check on an ffi_type structure */
48n/a
49n/avoid ffi_type_test(ffi_type *a, char *file, int line)
50n/a{
51n/a FFI_ASSERT_AT(a != NULL, file, line);
52n/a
53n/a /*@-usedef@*/
54n/a FFI_ASSERT_AT(a->type <= FFI_TYPE_LAST, file, line);
55n/a FFI_ASSERT_AT(a->type == FFI_TYPE_VOID || a->size > 0, file, line);
56n/a FFI_ASSERT_AT(a->type == FFI_TYPE_VOID || a->alignment > 0, file, line);
57n/a FFI_ASSERT_AT(a->type != FFI_TYPE_STRUCT || a->elements != NULL, file, line);
58n/a /*@=usedef@*/
59n/a}