sewardj | 024598e | 2008-09-18 14:43:05 +0000 | [diff] [blame] | 1 | |
| 2 | /*--------------------------------------------------------------------*/ |
| 3 | /*--- Ptrcheck: a pointer-use checker. ---*/ |
| 4 | /*--- Exports for heap access checking. ---*/ |
| 5 | /*--- h_main.h ---*/ |
| 6 | /*--------------------------------------------------------------------*/ |
| 7 | |
| 8 | /* |
| 9 | This file is part of Ptrcheck, a Valgrind tool for checking pointer |
| 10 | use in programs. |
| 11 | |
sewardj | 0f157dd | 2013-10-18 14:27:36 +0000 | [diff] [blame] | 12 | Copyright (C) 2003-2013 Nicholas Nethercote |
sewardj | 024598e | 2008-09-18 14:43:05 +0000 | [diff] [blame] | 13 | njn@valgrind.org |
sewardj | 0f157dd | 2013-10-18 14:27:36 +0000 | [diff] [blame] | 14 | Copyright (C) 2008-2013 OpenWorks Ltd |
sewardj | 024598e | 2008-09-18 14:43:05 +0000 | [diff] [blame] | 15 | info@open-works.co.uk |
| 16 | |
| 17 | This program is free software; you can redistribute it and/or |
| 18 | modify it under the terms of the GNU General Public License as |
| 19 | published by the Free Software Foundation; either version 2 of the |
| 20 | License, or (at your option) any later version. |
| 21 | |
| 22 | This program is distributed in the hope that it will be useful, but |
| 23 | WITHOUT ANY WARRANTY; without even the implied warranty of |
| 24 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 25 | General Public License for more details. |
| 26 | |
| 27 | You should have received a copy of the GNU General Public License |
| 28 | along with this program; if not, write to the Free Software |
| 29 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 30 | 02111-1307, USA. |
| 31 | |
| 32 | The GNU General Public License is contained in the file COPYING. |
| 33 | */ |
| 34 | |
| 35 | #ifndef __H_MAIN_H |
| 36 | |
| 37 | #define __H_MAIN_H |
| 38 | |
| 39 | // Choose values that couldn't possibly be pointers |
| 40 | #define NONPTR ((Seg*)0xA1) |
| 41 | #define UNKNOWN ((Seg*)0xB2) |
| 42 | #define BOTTOM ((Seg*)0xC3) |
| 43 | |
| 44 | static inline Bool is_known_segment(Seg* teg) { |
| 45 | return (UNKNOWN != teg && BOTTOM != teg && NONPTR != teg); |
| 46 | // better? teg <= BOTTOM |
| 47 | } |
| 48 | |
| 49 | void Seg__cmp(Seg* seg, Addr a, Int* cmp, UWord* n); |
| 50 | Bool Seg__is_freed(Seg* seg); |
| 51 | ExeContext* Seg__where(Seg* seg); |
| 52 | SizeT Seg__size(Seg* seg); |
| 53 | Addr Seg__addr(Seg* seg); |
| 54 | |
| 55 | void h_pre_clo_init ( void ); |
| 56 | void h_post_clo_init ( void ); |
| 57 | void h_fini ( Int exitcode ); |
| 58 | |
| 59 | void* h_replace_malloc ( ThreadId tid, SizeT n ); |
| 60 | void* h_replace___builtin_new ( ThreadId tid, SizeT n ); |
| 61 | void* h_replace___builtin_vec_new ( ThreadId tid, SizeT n ); |
| 62 | void* h_replace_memalign ( ThreadId tid, SizeT align, SizeT n ); |
| 63 | void* h_replace_calloc ( ThreadId tid, SizeT nmemb, SizeT size1 ); |
| 64 | void h_replace_free ( ThreadId tid, void* p ); |
| 65 | void h_replace___builtin_delete ( ThreadId tid, void* p ); |
| 66 | void h_replace___builtin_vec_delete ( ThreadId tid, void* p ); |
| 67 | void* h_replace_realloc ( ThreadId tid, void* p_old, SizeT new_size ); |
njn | 8b140de | 2009-02-17 04:31:18 +0000 | [diff] [blame] | 68 | SizeT h_replace_malloc_usable_size ( ThreadId tid, void* p ); |
sewardj | 024598e | 2008-09-18 14:43:05 +0000 | [diff] [blame] | 69 | |
sewardj | 024598e | 2008-09-18 14:43:05 +0000 | [diff] [blame] | 70 | /* Note that this also does the sg_ instrumentation. */ |
| 71 | IRSB* h_instrument ( VgCallbackClosure* closure, |
| 72 | IRSB* sbIn, |
| 73 | VexGuestLayout* layout, |
| 74 | VexGuestExtents* vge, |
florian | ca503be | 2012-10-07 21:59:42 +0000 | [diff] [blame] | 75 | VexArchInfo* archinfo_host, |
sewardj | 024598e | 2008-09-18 14:43:05 +0000 | [diff] [blame] | 76 | IRType gWordTy, IRType hWordTy ); |
| 77 | |
| 78 | #endif |
| 79 | |
| 80 | /*--------------------------------------------------------------------*/ |
| 81 | /*--- end h_main.h ---*/ |
| 82 | /*--------------------------------------------------------------------*/ |