blob: f7995973e6349623b5e25c12f2b6d5c5f72e10c2 [file] [log] [blame]
philippef5774342014-05-03 11:12:50 +00001
2/*---------------------------------------------------------------------*/
3/*--- Address Description, used e.g. to describe addresses involved ---*/
4/*--- in race conditions, locks. ---*/
5/*--- hg_addrdescr.h ---*/
6/*---------------------------------------------------------------------*/
7
8/*
9 This file is part of Helgrind, a Valgrind tool for detecting errors
10 in threaded programs.
11
Elliott Hughesed398002017-06-21 14:41:24 -070012 Copyright (C) 2007-2017 OpenWorks Ltd
philippef5774342014-05-03 11:12:50 +000013 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 __HG_ADDRDESCR_H
34#define __HG_ADDRDESCR_H
35
philippef5774342014-05-03 11:12:50 +000036/* Describe an address as best you can, for error messages or
philippe07c08522014-05-14 20:39:27 +000037 lock description, putting the result in ai.
38 This might allocate some memory in ai, to be cleared with
39 VG_(clear_addrinfo). */
40extern void HG_(describe_addr) ( Addr a, /*OUT*/AddrInfo* ai );
philippef5774342014-05-03 11:12:50 +000041
philippef5774342014-05-03 11:12:50 +000042/* Get a readable description of addr, then print it using HG_(pp_addrdescr)
43 using xml False and VG_(printf) to emit the characters.
44 Returns True if a description was found/printed, False otherwise. */
philippe07c08522014-05-14 20:39:27 +000045extern Bool HG_(get_and_pp_addrdescr) (Addr a);
philippef5774342014-05-03 11:12:50 +000046
47/* For error creation/address description:
48 map 'data_addr' to a malloc'd chunk, if any.
49 Slow linear search accelerated in some special cases normal hash
50 search of the mallocmeta table. This is an abuse of the normal file
51 structure since this is exported by hg_main.c, not hg_addrdesc.c. Oh
52 Well. Returns True if found, False if not. Zero-sized blocks are
53 considered to contain the searched-for address if they equal that
54 address. */
55Bool HG_(mm_find_containing_block)( /*OUT*/ExeContext** where,
philippe0c9ac8d2014-07-18 00:03:58 +000056 /*OUT*/UInt* tnr,
philippef5774342014-05-03 11:12:50 +000057 /*OUT*/Addr* payload,
58 /*OUT*/SizeT* szB,
59 Addr data_addr );
60
61
62#endif /* ! __HG_ADDRDESCR_H */
63
64/*--------------------------------------------------------------------*/
65/*--- end hg_addrdescr.h ---*/
66/*--------------------------------------------------------------------*/