|
||||
File indexing completed on 2025-01-18 10:13:32
0001 0002 /*-----------------------------------------------------------------------*/ 0003 /*--- Support functions for xtree memory reports. pub_tool_xtmemory.h ---*/ 0004 /*-----------------------------------------------------------------------*/ 0005 0006 /* 0007 This file is part of Valgrind, a dynamic binary instrumentation 0008 framework. 0009 0010 Copyright (C) 2016-2017 Philippe Waroquiers 0011 0012 This program is free software; you can redistribute it and/or 0013 modify it under the terms of the GNU General Public License as 0014 published by the Free Software Foundation; either version 2 of the 0015 License, or (at your option) any later version. 0016 0017 This program is distributed in the hope that it will be useful, but 0018 WITHOUT ANY WARRANTY; without even the implied warranty of 0019 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0020 General Public License for more details. 0021 0022 You should have received a copy of the GNU General Public License 0023 along with this program; if not, see <http://www.gnu.org/licenses/>. 0024 0025 The GNU General Public License is contained in the file COPYING. 0026 */ 0027 0028 #ifndef __PUB_TOOL_XTMEMORY_H 0029 #define __PUB_TOOL_XTMEMORY_H 0030 0031 /* Type to profile allocated size and nr of blocks, typically used for 0032 --xtree-memory=allocs. */ 0033 typedef 0034 struct _XT_Allocs { 0035 SizeT nbytes; 0036 SizeT nblocks; 0037 } XT_Allocs; 0038 0039 /* Support functions to produce a full xtree memory profiling. */ 0040 /* tool must call VG_(XTMemory_Full_init) to ini full xtree memory profiling. */ 0041 extern void VG_(XTMemory_Full_init) (XT_filter_IPs_t filter_IPs_Fn); 0042 /* Then each time a certain nr of blocks are allocated or freed, the below 0043 functions must be called. The arguments are: 0044 szB: nr of bytes for the allocated/freed block(s) 0045 ec_alloc : ExeContext of the allocation (original allocation for 0046 free and resize_in_place). 0047 ec_free : ExeContext of the free. 0048 The tool is responsible to properly provide the ExeContext for 0049 the allocation and free. For VG_(XTMemory_Full_free), ec_alloc 0050 must be the one that was used for the allocation of the just released 0051 block. */ 0052 extern void VG_(XTMemory_Full_alloc)(SizeT szB, 0053 ExeContext* ec_alloc); 0054 extern void VG_(XTMemory_Full_free)(SizeT szB, 0055 ExeContext* ec_alloc, 0056 ExeContext* ec_free); 0057 extern void VG_(XTMemory_Full_resize_in_place)(SizeT oldSzB, SizeT newSzB, 0058 ExeContext* ec_alloc); 0059 0060 /* Handle the production of a xtree memory report, either during run (fini False 0061 e.g. via a gdb monitor command), or at the end of execution (fini True). 0062 0063 VG_(XTMemory_report) behaviour depends on the value of the command line 0064 options --xtree-memory=none|allocs|full and --xtree-memory-file=<filename> : 0065 If --xtree-memory=full, the report will be produced from the data 0066 provided via the calls to void VG_(XTMemory_Full_*). 0067 Otherwise, for --xtree-memory=allocs or for --xtree-memory=none (if fini 0068 is False), next_block is used to get the data for the report: 0069 next_block is called repetitively to get information about all allocated 0070 blocks, till xta->nblocks is 0. 0071 If filename is NULL, --xtree-memory-file is used to produce the name. 0072 filter_IPs_fn : used for --xtree-memory=allocs/none filtering (see 0073 VG_(XT_create) and XT_filter_IPs_t typdef for more information). */ 0074 extern void VG_(XTMemory_report) 0075 (const HChar* filename, Bool fini, 0076 void (*next_block)(XT_Allocs* xta, ExeContext** ec_alloc), 0077 XT_filter_IPs_t filter_IPs_fn); 0078 0079 #endif // __PUB_TOOL_XTMEMORY_H 0080 0081 0082 /*-----------------------------------------------------------------------*/ 0083 /*--- end pub_tool_xtmemory.h ---*/ 0084 /*-----------------------------------------------------------------------*/
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |