xref: /illumos-gate/usr/src/lib/libdemangle/common/demangle_int.h (revision 8a2b682e57a046b828f37bcde1776f131ef4629f)
1 /*
2  * This file and its contents are supplied under the terms of the
3  * Common Development and Distribution License ("CDDL"), version 1.0.
4  * You may only use this file in accordance with the terms of version
5  * 1.0 of the CDDL.
6  *
7  * A full copy of the text of the CDDL should have accompanied this
8  * source.  A copy of the CDDL is also available via the Internet at
9  * http://www.illumos.org/license/CDDL.
10  */
11 
12 /*
13  * Copyright 2017 Jason King
14  * Copyright 2019, Joyent, Inc.
15  */
16 #ifndef _DEMANGLE_INT_H
17 #define	_DEMANGLE_INT_H
18 
19 #include <stdio.h>
20 #include "demangle-sys.h"
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 extern sysdem_ops_t *sysdem_ops_default;
27 
28 char *cpp_demangle(const char *, size_t, sysdem_ops_t *);
29 char *rust_demangle(const char *, size_t, sysdem_ops_t *);
30 
31 void *zalloc(sysdem_ops_t *, size_t);
32 void *xrealloc(sysdem_ops_t *, void *, size_t, size_t);
33 void xfree(sysdem_ops_t *, void *, size_t);
34 char *xstrdup(sysdem_ops_t *, const char *);
35 
36 extern volatile boolean_t demangle_debug;
37 
38 /*
39  * gcc seems to get unhappy with the ASSERT() style definition (also borrowed
40  * for the DEMDEBUG macro unless demdebug() is returns a non-void value
41  * (despite the return value never being used).
42  */
43 int demdebug(const char *, ...);
44 
45 #define	DEMDEBUG(s, ...) \
46 	((void)(demangle_debug && demdebug(s, ## __VA_ARGS__)))
47 
48 #ifdef __cplusplus
49 }
50 #endif
51 
52 #endif /* _DEMANGLE_INT_H */
53