1 
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 
12    Copyright (C) 2007-2012 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 __HG_ADDRDESCR_H
34 #define __HG_ADDRDESCR_H
35 
36 /* Describe an address as best you can, for error messages or
37    lock description, putting the result in ai.
38    This might allocate some memory in ai, to be cleared with
39    VG_(clear_addrinfo). */
40 extern void HG_(describe_addr) ( Addr a, /*OUT*/AddrInfo* ai );
41 
42 /* 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. */
45 extern Bool HG_(get_and_pp_addrdescr) (Addr a);
46 
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. */
55 Bool HG_(mm_find_containing_block)( /*OUT*/ExeContext** where,
56                                     /*OUT*/UInt*        tnr,
57                                     /*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 /*--------------------------------------------------------------------*/
67