blob: cb5a734416622e3444217cf5730c21cd9172c25d [file] [log] [blame]
sewardj5cf515f2004-06-26 20:10:35 +00001
2/*---------------------------------------------------------------*/
3/*--- ---*/
sewardj35421a32004-07-05 13:12:34 +00004/*--- This file (vex_util.h) is ---*/
sewardj5cf515f2004-06-26 20:10:35 +00005/*--- Copyright (c) 2004 OpenWorks LLP. All rights reserved. ---*/
6/*--- ---*/
7/*---------------------------------------------------------------*/
8
sewardjf8ed9d82004-11-12 17:40:23 +00009/*
10 This file is part of LibVEX, a library for dynamic binary
11 instrumentation and translation.
12
13 Copyright (C) 2004 OpenWorks, LLP.
14
15 This program is free software; you can redistribute it and/or modify
16 it under the terms of the GNU General Public License as published by
17 the Free Software Foundation; Version 2 dated June 1991 of the
18 license.
19
20 This program is distributed in the hope that it will be useful,
21 but WITHOUT ANY WARRANTY; without even the implied warranty of
22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or liability
23 for damages. See the GNU General Public License for more details.
24
25 Neither the names of the U.S. Department of Energy nor the
26 University of California nor the names of its contributors may be
27 used to endorse or promote products derived from this software
28 without prior written permission.
29
30 You should have received a copy of the GNU General Public License
31 along with this program; if not, write to the Free Software
32 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
33 USA.
34*/
35
sewardj35421a32004-07-05 13:12:34 +000036#ifndef __VEX_UTIL_H
37#define __VEX_UTIL_H
sewardj5cf515f2004-06-26 20:10:35 +000038
sewardj887a11a2004-07-05 17:26:47 +000039#include "libvex_basictypes.h"
sewardj5cf515f2004-06-26 20:10:35 +000040
41
sewardj35421a32004-07-05 13:12:34 +000042/* Misc. */
43
44#define NULL ((void*)0)
45
46
sewardj5cf515f2004-06-26 20:10:35 +000047/* Stuff for panicking and assertion. */
48
49#define VG__STRING(__str) #__str
50
sewardj35421a32004-07-05 13:12:34 +000051#define vassert(expr) \
sewardj5cf515f2004-06-26 20:10:35 +000052 ((void) ((expr) ? 0 : \
53 (vex_assert_fail (VG__STRING(expr), \
54 __FILE__, __LINE__, \
55 __PRETTY_FUNCTION__), 0)))
56
57__attribute__ ((__noreturn__))
58extern void vex_assert_fail ( const Char* expr, const Char* file,
59 Int line, const Char* fn );
60__attribute__ ((__noreturn__))
sewardj35421a32004-07-05 13:12:34 +000061extern void vpanic ( Char* str );
sewardj5cf515f2004-06-26 20:10:35 +000062
63
sewardj35421a32004-07-05 13:12:34 +000064/* Printing */
65
66__attribute__ ((format (printf, 1, 2)))
sewardj41f43bc2004-07-08 14:23:22 +000067extern UInt vex_printf ( const Char *format, ... );
sewardj35421a32004-07-05 13:12:34 +000068
sewardj41f43bc2004-07-08 14:23:22 +000069__attribute__ ((format (printf, 2, 3)))
70extern UInt vex_sprintf ( Char* buf, const Char *format, ... );
sewardj35421a32004-07-05 13:12:34 +000071
sewardj36ca5132004-07-24 13:12:23 +000072
73/* String ops */
74
75extern Bool vex_streq ( const Char* s1, const Char* s2 );
76
77
sewardj35421a32004-07-05 13:12:34 +000078#endif /* ndef __VEX_UTIL_H */
sewardjac9af022004-07-05 01:15:34 +000079
80/*---------------------------------------------------------------*/
sewardj35421a32004-07-05 13:12:34 +000081/*--- vex_util.h ---*/
sewardjac9af022004-07-05 01:15:34 +000082/*---------------------------------------------------------------*/