2 /*--------------------------------------------------------------------*/
3 /*--- Misc simple stuff lacking a better home. priv_misc.h ---*/
4 /*--------------------------------------------------------------------*/
7 This file is part of Valgrind, a dynamic binary instrumentation
10 Copyright (C) 2008-2013 OpenWorks LLP
13 This program is free software; you can redistribute it and/or
14 modify it under the terms of the GNU General Public License as
15 published by the Free Software Foundation; either version 2 of the
16 License, or (at your option) any later version.
18 This program is distributed in the hope that it will be useful, but
19 WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 General Public License for more details.
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software
25 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
28 The GNU General Public License is contained in the file COPYING.
30 Neither the names of the U.S. Department of Energy nor the
31 University of California nor the names of its contributors may be
32 used to endorse or promote products derived from this software
33 without prior written permission.
39 #include "pub_core_basics.h" // SizeT
41 /* Allocate(zeroed), free, strdup, memdup, shrink, all in VG_AR_DINFO.
42 The allocation functions never return NULL. */
43 void* ML_(dinfo_zalloc
)( const HChar
* cc
, SizeT szB
);
44 void ML_(dinfo_free
)( void* v
);
45 HChar
* ML_(dinfo_strdup
)( const HChar
* cc
, const HChar
* str
);
46 void* ML_(dinfo_memdup
)( const HChar
* cc
, const void* str
, SizeT nStr
);
47 void* ML_(dinfo_realloc
) ( const HChar
* cc
, void* ptr
, SizeT new_size
);
48 void ML_(dinfo_shrink_block
)( void* ptr
, SizeT szB
);
50 /* Extract (possibly unaligned) data of various sizes from a buffer. */
51 Short
ML_(read_Short
)( const UChar
* data
);
52 Int
ML_(read_Int
)( const UChar
* data
);
53 Long
ML_(read_Long
)( const UChar
* data
);
54 UShort
ML_(read_UShort
)( const UChar
* data
);
55 UWord
ML_(read_UWord
)( const UChar
* data
);
56 UInt
ML_(read_UInt
)( const UChar
* data
);
57 ULong
ML_(read_ULong
)( const UChar
* data
);
58 UChar
ML_(read_UChar
)( const UChar
* data
);
59 Addr
ML_(read_Addr
)( const UChar
* data
);
61 UChar
* ML_(write_UShort
)( UChar
* ptr
, UShort val
);
62 UChar
* ML_(write_UInt
)( UChar
* ptr
, UInt val
);
63 UChar
* ML_(write_ULong
)( UChar
* ptr
, ULong val
);
64 UChar
* ML_(write_UChar
)( UChar
* ptr
, UChar val
);
65 UChar
* ML_(write_Addr
)( UChar
* ptr
, Addr val
);
67 /* A handy type, a la Haskell's Maybe type. Yes, I know, C sucks.
68 Been there. Done that. Seen the movie. Got the T-shirt. Etc. */
69 typedef struct { ULong ul
; Bool b
; } MaybeULong
;
72 #endif /* ndef __PRIV_MISC_H */
74 /*--------------------------------------------------------------------*/
75 /*--- end priv_misc.h ---*/
76 /*--------------------------------------------------------------------*/