sg_main.h revision b32f58018498ea2225959b0ba11c18f0c433deef
1
2/*--------------------------------------------------------------------*/
3/*--- Ptrcheck: a pointer-use checker.                             ---*/
4/*--- Exports for stack and global access checking.                ---*/
5/*---                                                    sg_main.h ---*/
6/*--------------------------------------------------------------------*/
7
8/*
9   This file is part of Ptrcheck, a Valgrind tool for checking pointer
10   use in programs.
11
12   Copyright (C) 2008-2011 OpenWorks Ltd
13      info@open-works.co.uk
14
15   This program is free software; you can redistribute it and/or
16   modify it under the terms of the GNU General Public License as
17   published by the Free Software Foundation; either version 2 of the
18   License, or (at your option) any later version.
19
20   This program is distributed in the hope that it will be useful, but
21   WITHOUT ANY WARRANTY; without even the implied warranty of
22   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
23   General Public License for more details.
24
25   You should have received a copy of the GNU General Public License
26   along with this program; if not, write to the Free Software
27   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
28   02111-1307, USA.
29
30   The GNU General Public License is contained in the file COPYING.
31*/
32
33#ifndef __SG_MAIN_H
34
35#define __SG_MAIN_H
36
37void sg_pre_clo_init ( void );
38void sg_post_clo_init ( void );
39void sg_fini(Int exitcode);
40
41void sg_die_mem_stack ( Addr old_SP, SizeT len );
42void sg_pre_thread_ll_create ( ThreadId parent, ThreadId child );
43void sg_pre_thread_first_insn ( ThreadId tid );
44
45void sg_new_mem_mmap( Addr a, SizeT len,
46                      Bool rr, Bool ww, Bool xx, ULong di_handle );
47void sg_new_mem_startup( Addr a, SizeT len,
48                         Bool rr, Bool ww, Bool xx, ULong di_handle );
49void sg_die_mem_munmap ( Addr a, SizeT len );
50
51/* These really ought to be moved elsewhere, so that we don't have to
52   include this file in h_main.c.  See comments in sg_main.c and
53   h_main.c for what this is about. */
54
55struct _SGEnv;  /* abstract export */
56
57struct _SGEnv* sg_instrument_init ( IRTemp (*newIRTemp_cb)(IRType,void*),
58                                    void* newIRTemp_opaque );
59
60void sg_instrument_fini ( struct _SGEnv * env );
61
62void sg_instrument_IRStmt ( /*MOD*/struct _SGEnv * env,
63                            /*MOD*/IRSB* sbOut,
64                            IRStmt* st,
65                            VexGuestLayout* layout,
66                            IRType gWordTy, IRType hWordTy );
67
68void sg_instrument_final_jump ( /*MOD*/struct _SGEnv * env,
69                                /*MOD*/IRSB* sbOut,
70                                IRExpr* next,
71                                IRJumpKind jumpkind,
72                                VexGuestLayout* layout,
73                                IRType gWordTy, IRType hWordTy );
74#endif
75
76/*--------------------------------------------------------------------*/
77/*--- end                                                sg_main.h ---*/
78/*--------------------------------------------------------------------*/
79