linux arm regtest: leak_cpp_interior try again
[valgrind.git] / include / pub_tool_xtmemory.h
blobe51b221c0d787c71d4b8e794604010c683c94b35
2 /*-----------------------------------------------------------------------*/
3 /*--- Support functions for xtree memory reports. pub_tool_xtmemory.h ---*/
4 /*-----------------------------------------------------------------------*/
6 /*
7 This file is part of Valgrind, a dynamic binary instrumentation
8 framework.
10 Copyright (C) 2016-2017 Philippe Waroquiers
12 This program is free software; you can redistribute it and/or
13 modify it under the terms of the GNU General Public License as
14 published by the Free Software Foundation; either version 2 of the
15 License, or (at your option) any later version.
17 This program is distributed in the hope that it will be useful, but
18 WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, see <http://www.gnu.org/licenses/>.
25 The GNU General Public License is contained in the file COPYING.
28 #ifndef __PUB_TOOL_XTMEMORY_H
29 #define __PUB_TOOL_XTMEMORY_H
31 /* Type to profile allocated size and nr of blocks, typically used for
32 --xtree-memory=allocs. */
33 typedef
34 struct _XT_Allocs {
35 SizeT nbytes;
36 SizeT nblocks;
37 } XT_Allocs;
39 /* Support functions to produce a full xtree memory profiling. */
40 /* tool must call VG_(XTMemory_Full_init) to ini full xtree memory profiling. */
41 extern void VG_(XTMemory_Full_init) (XT_filter_IPs_t filter_IPs_Fn);
42 /* Then each time a certain nr of blocks are allocated or freed, the below
43 functions must be called. The arguments are:
44 szB: nr of bytes for the allocated/freed block(s)
45 ec_alloc : ExeContext of the allocation (original allocation for
46 free and resize_in_place).
47 ec_free : ExeContext of the free.
48 The tool is responsible to properly provide the ExeContext for
49 the allocation and free. For VG_(XTMemory_Full_free), ec_alloc
50 must be the one that was used for the allocation of the just released
51 block. */
52 extern void VG_(XTMemory_Full_alloc)(SizeT szB,
53 ExeContext* ec_alloc);
54 extern void VG_(XTMemory_Full_free)(SizeT szB,
55 ExeContext* ec_alloc,
56 ExeContext* ec_free);
57 extern void VG_(XTMemory_Full_resize_in_place)(SizeT oldSzB, SizeT newSzB,
58 ExeContext* ec_alloc);
60 /* Handle the production of a xtree memory report, either during run (fini False
61 e.g. via a gdb monitor command), or at the end of execution (fini True).
63 VG_(XTMemory_report) behaviour depends on the value of the command line
64 options --xtree-memory=none|allocs|full and --xtree-memory-file=<filename> :
65 If --xtree-memory=full, the report will be produced from the data
66 provided via the calls to void VG_(XTMemory_Full_*).
67 Otherwise, for --xtree-memory=allocs or for --xtree-memory=none (if fini
68 is False), next_block is used to get the data for the report:
69 next_block is called repetitively to get information about all allocated
70 blocks, till xta->nblocks is 0.
71 If filename is NULL, --xtree-memory-file is used to produce the name.
72 filter_IPs_fn : used for --xtree-memory=allocs/none filtering (see
73 VG_(XT_create) and XT_filter_IPs_t typdef for more information). */
74 extern void VG_(XTMemory_report)
75 (const HChar* filename, Bool fini,
76 void (*next_block)(XT_Allocs* xta, ExeContext** ec_alloc),
77 XT_filter_IPs_t filter_IPs_fn);
79 #endif // __PUB_TOOL_XTMEMORY_H
82 /*-----------------------------------------------------------------------*/
83 /*--- end pub_tool_xtmemory.h ---*/
84 /*-----------------------------------------------------------------------*/