7 #define Purify_Begincode _start
9 void Purify_Init (void)
11 extern void Purify_Begincode (void);
12 extern void Purify_Endcode (void);
13 extern int Purify_Beginrodata
;
14 extern int Purify_Endrodata
;
15 extern int Purify_Beginbss
;
16 extern int Purify_Endbss
;
17 extern int Purify_Begindata
;
18 extern int Purify_Enddata
;
19 extern int * Purify_Beginstaticdata
;
20 extern int * Purify_Endstaticdata
;
26 printf ("Purify active\n");
29 Purify_Functionname
= "_start";
32 ptr
= (&Purify_Beginrodata
)+1;
33 size
= (long)(&Purify_Endrodata
) - (long)(&Purify_Beginrodata
) - 4;
37 node
= Purify_AddMemory (ptr
39 , PURIFY_MemFlag_Readable
43 node
->data
= "rodata";
46 ptr
= (&Purify_Beginbss
)+1;
47 size
= (long)(&Purify_Endbss
) - (long)(&Purify_Beginbss
) - 4;
51 node
= Purify_AddMemory (ptr
53 , PURIFY_MemFlag_Readable
54 | PURIFY_MemFlag_Writable
61 ptr
= (&Purify_Begindata
)+1;
62 size
= (long)(&Purify_Enddata
) - (long)(&Purify_Begindata
) - 4;
66 node
= Purify_AddMemory (ptr
68 , PURIFY_MemFlag_Readable
69 | PURIFY_MemFlag_Writable
76 size
= (long)(Purify_Endstaticdata
) - (long)(Purify_Beginstaticdata
) - 4;
80 node
= Purify_AddMemory (Purify_Beginstaticdata
+1
82 , PURIFY_MemFlag_Readable
83 | PURIFY_MemFlag_Writable
87 node
->data
= "static data";
90 size
= (long)Purify_Endcode
- (long)Purify_Begincode
;
94 node
= Purify_AddMemory (Purify_Begincode
96 , PURIFY_MemFlag_Readable
103 node
= Purify_AddMemory (__ctype_b
104 , sizeof(__ctype_b
[0])*256
105 , PURIFY_MemFlag_Readable
106 , PURIFY_MemType_Data
109 node
->data
= "ctype array";
111 node
= Purify_AddMemory (__ctype_tolower
112 , sizeof(__ctype_tolower
[0])*256
113 , PURIFY_MemFlag_Readable
114 , PURIFY_MemType_Data
117 node
->data
= "tolower array";
119 node
= Purify_AddMemory (__ctype_toupper
120 , sizeof(__ctype_toupper
[0])*256
121 , PURIFY_MemFlag_Readable
122 , PURIFY_MemType_Data
125 node
->data
= "toupper array";
127 #define ADDGLOBAL(var,name) \
128 node = Purify_AddMemory (&(var) \
130 , PURIFY_MemFlag_Readable|PURIFY_MemFlag_Writable \
131 , PURIFY_MemType_Data \
136 ADDGLOBAL(errno
,"errno");
138 node
= Purify_AddMemory (stdin
140 , PURIFY_MemFlag_Readable
141 , PURIFY_MemType_Data
144 node
->data
= "stdin";
146 node
= Purify_AddMemory (stdout
148 , PURIFY_MemFlag_Readable
149 , PURIFY_MemType_Data
152 node
->data
= "stdout";
154 Purify_PrintMemory ();
157 void Purify_Exit (void)
159 printf ("Purify finished\n");
161 Purify_MemoryExit ();