AdH Kraken 0.0.0
Next generation Adaptive Hydraulics
Loading...
Searching...
No Matches
debug.h
Go to the documentation of this file.
1
12//****************************************************************
13//****************************************************************
14//****************************************************************
15
16#ifndef H_DEBUG_
17#define H_DEBUG_
18
19
20#ifdef _DEBUG
21#define BWIDTH 8 /* number of int-size entities for buffer on each side of data */
22#define PICKET 0xfffb5b5a /* guardpost value */
23#define MY_NAN 0xfffa5a5a /* NaN to use to initialize memory buffers */
24
25/* HASHSIZE used for hash function */
26#define DEBUG_HASHSIZE 65537
27
28/* structure for linked lists of allocated memory locations */
29typedef struct debug_mem_entry {
30 struct debug_mem_entry *next;
31 unsigned long address;
32 size_t isize;
33 int linenumber;
34 char *filename;
35} DEBUG_MEM_ENTRY;
36
37void tl_check_picket(char *, size_t, int, char *);
38void tl_set_nan(char *, size_t);
39void tl_set_picket(char *, size_t);
40void tl_add_hash_entry(void *pntr, size_t isize, int linenumber, char *filename);
41void tl_remove_hash_entry(void *pntr);
42void tl_check_all_pickets(char *,int);
43void tl_check_unfreed(void);
44void Push_Hash_Entry(DEBUG_MEM_ENTRY **,unsigned long,size_t,int,char *);
45void Delete_Hash_Entry(DEBUG_MEM_ENTRY **,unsigned long);
46int hash_function(unsigned long);
47int LengthList(DEBUG_MEM_ENTRY *);
48void CreateHistogram(int, int, int);
49unsigned long tl_get_allocated_memory_size(void *);
50#endif
51
52#endif
53
54//****************************************************************
55//****************************************************************
56//****************************************************************
57
58
59#ifdef _DEBUG
60
61#ifdef DEBUG_INIT
62#define EXTERN_DEBUG
63#else
64#define EXTERN_DEBUG extern
65#endif
66
67EXTERN_DEBUG size_t allocated_memory;
68EXTERN_DEBUG size_t max_allocated_memory;
69EXTERN_DEBUG DEBUG_MEM_ENTRY **mem_hash;
70EXTERN_DEBUG int picket_value;
71EXTERN_DEBUG char *picket_pointer;
72EXTERN_DEBUG int nan_value;
73EXTERN_DEBUG char *nan_pointer;
74EXTERN_DEBUG FILE *outalloc;
75EXTERN_DEBUG FILE *outfree;
76
77#else
78
79extern int allocated_memory;
80extern int max_allocated_memory;
81
82#endif
int allocated_memory
ifndef H_DEBUG_
Definition: tl_debug_init.c:10