1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
|
/*--------------------------------------------------------------------*/
/*--- A header file for all parts of Valgrind. ---*/
/*--- Include no other! ---*/
/*--- vg_include.h ---*/
/*--------------------------------------------------------------------*/
/*
This file is part of Valgrind, an x86 protected-mode emulator
designed for debugging and profiling binaries on x86-Unixes.
Copyright (C) 2000-2002 Julian Seward
jseward@acm.org
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307, USA.
The GNU General Public License is contained in the file LICENSE.
*/
#ifndef __VG_INCLUDE_H
#define __VG_INCLUDE_H
#include <stdarg.h> /* ANSI varargs stuff */
#include <setjmp.h> /* for jmp_buf */
/* ---------------------------------------------------------------------
Build options and table sizes. You should be able to change these
options or sizes, recompile, and still have a working system.
------------------------------------------------------------------ */
#include "vg_constants.h"
/* Set to 1 to enable time profiling. Since this uses SIGPROF, we
don't want this permanently enabled -- only for profiling
builds. */
#if 0
# define VG_PROFILE
#endif
/* Total number of integer registers available for allocation. That's
all of them except %esp, %edi and %ebp. %edi is a general spare
temporary. %ebp permanently points at VG_(baseBlock). Note that
it's important that this tie in with what rankToRealRegNo() says.
DO NOT CHANGE THIS VALUE FROM 5. ! */
#define VG_MAX_REALREGS 5
/* Total number of spill slots available for allocation, if a TempReg
doesn't make it into a RealReg. Just bomb the entire system if
this value is too small; we don't expect it will ever get
particularly high. */
#define VG_MAX_SPILLSLOTS 24
/* Constants for the slow translation lookup cache. */
#define VG_TRANSTAB_SLOW_BITS 11
#define VG_TRANSTAB_SLOW_SIZE (1 << VG_TRANSTAB_SLOW_BITS)
#define VG_TRANSTAB_SLOW_MASK ((VG_TRANSTAB_SLOW_SIZE) - 1)
/* Size of a buffer used for creating messages. */
#define M_VG_MSGBUF 10000
/* Size of a smallish table used to read /proc/self/map entries. */
#define M_PROCMAP_BUF 50000
/* Max length of pathname to a .so/executable file. */
#define M_VG_LIBNAMESTR 100
/* Max length of a text fragment used to construct error messages. */
#define M_VG_ERRTXT 512
/* Max length of the string copied from env var VG_ARGS at startup. */
#define M_VG_CMDLINE_STRLEN 1000
/* Max number of options for Valgrind which we can handle. */
#define M_VG_CMDLINE_OPTS 100
/* After this many different unsuppressed errors have been observed,
be more conservative about collecting new ones. */
#define M_VG_COLLECT_ERRORS_SLOWLY_AFTER 50
/* After this many different unsuppressed errors have been observed,
stop collecting errors at all, and tell the user their program is
evidently a steaming pile of camel dung. */
#define M_VG_COLLECT_NO_ERRORS_AFTER_SHOWN 300
/* After this many total errors have been observed, stop collecting
errors at all. Counterpart to M_VG_COLLECT_NO_ERRORS_AFTER_SHOWN. */
#define M_VG_COLLECT_NO_ERRORS_AFTER_FOUND 30000
/* These many bytes below %ESP are considered addressible if we're
doing the --workaround-gcc296-bugs hack. */
#define VG_GCC296_BUG_STACK_SLOP 256
/* The maximum number of calls we're prepared to save in a
backtrace. */
#define VG_DEEPEST_BACKTRACE 50
/* Number of lists in which we keep track of malloc'd but not free'd
blocks. Should be prime. */
#define VG_N_MALLOCLISTS 997
/* Number of lists in which we keep track of ExeContexts. Should be
prime. */
#define VG_N_EC_LISTS /*997*/ 4999
/* Defines the thread-scheduling timeslice, in terms of the number of
basic blocks we attempt to run each thread for. Smaller values
give finer interleaving but much increased scheduling overheads. */
#define VG_SCHEDULING_QUANTUM 20000
/* The maximum number of pthreads that we support. This is
deliberately not very high since our implementation of some of the
scheduler algorithms is surely O(N) in the number of threads, since
that's simple, at least. And (in practice) we hope that most
programs do not need many threads. */
#define VG_N_THREADS 50
/* Maximum number of pthread keys available. Again, we start low until
the need for a higher number presents itself. */
#define VG_N_THREAD_KEYS 10
/* Number of file descriptors that can simultaneously be waited on for
I/O to complete. Perhaps this should be the same as VG_N_THREADS
(surely a thread can't wait on more than one fd at once?. Who
knows.) */
#define VG_N_WAITING_FDS 10
/* Stack size for a thread. We try and check that they do not go
beyond it. */
#define VG_PTHREAD_STACK_SIZE 65536
/* ---------------------------------------------------------------------
Basic types
------------------------------------------------------------------ */
typedef unsigned char UChar;
typedef unsigned short UShort;
typedef unsigned int UInt;
typedef unsigned long long int ULong;
typedef signed char Char;
typedef signed short Short;
typedef signed int Int;
typedef signed long long int Long;
typedef unsigned int Addr;
typedef unsigned char Bool;
#define False ((Bool)0)
#define True ((Bool)1)
#define mycat_wrk(aaa,bbb) aaa##bbb
#define mycat(aaa,bbb) mycat_wrk(aaa,bbb)
/* Just pray that gcc's constant folding works properly ... */
#define BITS(bit7,bit6,bit5,bit4,bit3,bit2,bit1,bit0) \
( ((bit7) << 7) | ((bit6) << 6) | ((bit5) << 5) | ((bit4) << 4) \
| ((bit3) << 3) | ((bit2) << 2) | ((bit1) << 1) | (bit0))
/* ---------------------------------------------------------------------
Now the basic types are set up, we can haul in the kernel-interface
definitions.
------------------------------------------------------------------ */
#include "./vg_kerneliface.h"
/* ---------------------------------------------------------------------
Command-line-settable options
------------------------------------------------------------------ */
#define VG_CLO_SMC_NONE 0
#define VG_CLO_SMC_SOME 1
#define VG_CLO_SMC_ALL 2
#define VG_CLO_MAX_SFILES 10
/* Shall we V-check addrs (they are always A checked too): default: YES */
extern Bool VG_(clo_check_addrVs);
/* Enquire about whether to attach to GDB at errors? default: NO */
extern Bool VG_(clo_GDB_attach);
/* Sanity-check level: 0 = none, 1 (default), > 1 = expensive. */
extern Int VG_(sanity_level);
/* Verbosity level: 0 = silent, 1 (default), > 1 = more verbose. */
extern Int VG_(clo_verbosity);
/* Automatically attempt to demangle C++ names? default: YES */
extern Bool VG_(clo_demangle);
/* Do leak check at exit? default: NO */
extern Bool VG_(clo_leak_check);
/* In leak check, show reachable-but-not-freed blocks? default: NO */
extern Bool VG_(clo_show_reachable);
/* How closely should we compare ExeContexts in leak records? default: 2 */
extern Int VG_(clo_leak_resolution);
/* Round malloc sizes upwards to integral number of words? default:
NO */
extern Bool VG_(clo_sloppy_malloc);
/* Allow loads from partially-valid addresses? default: YES */
extern Bool VG_(clo_partial_loads_ok);
/* Simulate child processes? default: NO */
extern Bool VG_(clo_trace_children);
/* The file id on which we send all messages. default: 2 (stderr). */
extern Int VG_(clo_logfile_fd);
/* Max volume of the freed blocks queue. */
extern Int VG_(clo_freelist_vol);
/* Assume accesses immediately below %esp are due to gcc-2.96 bugs.
default: NO */
extern Bool VG_(clo_workaround_gcc296_bugs);
/* The number of suppression files specified. */
extern Int VG_(clo_n_suppressions);
/* The names of the suppression files. */
extern Char* VG_(clo_suppressions)[VG_CLO_MAX_SFILES];
/* Single stepping? default: NO */
extern Bool VG_(clo_single_step);
/* Code improvement? default: YES */
extern Bool VG_(clo_optimise);
/* Memory-check instrumentation? default: YES */
extern Bool VG_(clo_instrument);
/* DEBUG: clean up instrumented code? default: YES */
extern Bool VG_(clo_cleanup);
/* Cache simulation instrumentation? default: NO */
extern Bool VG_(clo_cachesim);
/* SMC write checks? default: SOME (1,2,4 byte movs to mem) */
extern Int VG_(clo_smc_check);
/* DEBUG: print system calls? default: NO */
extern Bool VG_(clo_trace_syscalls);
/* DEBUG: print signal details? default: NO */
extern Bool VG_(clo_trace_signals);
/* DEBUG: print symtab details? default: NO */
extern Bool VG_(clo_trace_symtab);
/* DEBUG: print malloc details? default: NO */
extern Bool VG_(clo_trace_malloc);
/* DEBUG: print thread scheduling events? default: NO */
extern Bool VG_(clo_trace_sched);
/* DEBUG: print pthread (mutex etc) events? default: 0 (none), 1
(some), 2 (all) */
extern Int VG_(clo_trace_pthread_level);
/* Stop after this many basic blocks. default: Infinity. */
extern ULong VG_(clo_stop_after);
/* Display gory details for the k'th most popular error. default:
Infinity. */
extern Int VG_(clo_dump_error);
/* Number of parents of a backtrace. Default: 8. */
extern Int VG_(clo_backtrace_size);
/* ---------------------------------------------------------------------
Debugging and profiling stuff
------------------------------------------------------------------ */
/* No, really. I _am_ that strange. */
#define OINK(nnn) VG_(message)(Vg_DebugMsg, "OINK %d",nnn)
/* Tools for building messages from multiple parts. */
typedef
enum { Vg_UserMsg, Vg_DebugMsg, Vg_DebugExtraMsg }
VgMsgKind;
extern void VG_(start_msg) ( VgMsgKind kind );
extern void VG_(add_to_msg) ( Char* format, ... );
extern void VG_(end_msg) ( void );
/* Send a simple, single-part message. */
extern void VG_(message) ( VgMsgKind kind, Char* format, ... );
/* Create a logfile into which messages can be dumped. */
extern void VG_(startup_logging) ( void );
extern void VG_(shutdown_logging) ( void );
/* Profiling stuff */
#ifdef VG_PROFILE
#define VGP_M_STACK 10
#define VGP_M_CCS 24 /* == the # of elems in VGP_LIST */
#define VGP_LIST \
VGP_PAIR(VgpRun=0, "running"), \
VGP_PAIR(VgpMalloc, "low-lev malloc/free"), \
VGP_PAIR(VgpCliMalloc, "client malloc/free"), \
VGP_PAIR(VgpTranslate, "translate-main"), \
VGP_PAIR(VgpToUCode, "to-ucode"), \
VGP_PAIR(VgpFromUcode, "from-ucode"), \
VGP_PAIR(VgpImprove, "improve"), \
VGP_PAIR(VgpInstrument, "instrument"), \
VGP_PAIR(VgpCleanup, "cleanup"), \
VGP_PAIR(VgpRegAlloc, "reg-alloc"), \
VGP_PAIR(VgpDoLRU, "do-lru"), \
VGP_PAIR(VgpSlowFindT, "slow-search-transtab"), \
VGP_PAIR(VgpInitAudit, "init-mem-audit"), \
VGP_PAIR(VgpExeContext, "exe-context"), \
VGP_PAIR(VgpReadSyms, "read-syms"), \
VGP_PAIR(VgpAddToT, "add-to-transtab"), \
VGP_PAIR(VgpSARP, "set-addr-range-perms"), \
VGP_PAIR(VgpSyscall, "syscall wrapper"), \
VGP_PAIR(VgpCacheInstrument, "cache instrument"), \
VGP_PAIR(VgpCacheGetBBCC,"cache get BBCC"), \
VGP_PAIR(VgpCacheSimulate, "cache simulate"), \
VGP_PAIR(VgpCacheDump, "cache stats dump"), \
VGP_PAIR(VgpSpare1, "spare 1"), \
VGP_PAIR(VgpSpare2, "spare 2")
#define VGP_PAIR(enumname,str) enumname
typedef enum { VGP_LIST } VgpCC;
#undef VGP_PAIR
extern void VGP_(init_profiling) ( void );
extern void VGP_(done_profiling) ( void );
extern void VGP_(pushcc) ( VgpCC );
extern void VGP_(popcc) ( void );
#define VGP_PUSHCC(cc) VGP_(pushcc)(cc)
#define VGP_POPCC VGP_(popcc)()
#else
#define VGP_PUSHCC(cc) /* */
#define VGP_POPCC /* */
#endif /* VG_PROFILE */
/* ---------------------------------------------------------------------
Exports of vg_malloc2.c
------------------------------------------------------------------ */
/* Allocation arenas.
SYMTAB is for Valgrind's symbol table storage.
CLIENT is for the client's mallocs/frees.
DEMANGLE is for the C++ demangler.
EXECTXT is for storing ExeContexts.
ERRCTXT is for storing ErrContexts.
PRIVATE is for Valgrind general stuff.
TRANSIENT is for very short-term use. It should be empty
in between uses.
When adding a new arena, remember also to add it
to ensure_mm_init().
*/
typedef Int ArenaId;
#define VG_N_ARENAS 7
#define VG_AR_PRIVATE 0 /* :: ArenaId */
#define VG_AR_SYMTAB 1 /* :: ArenaId */
#define VG_AR_CLIENT 2 /* :: ArenaId */
#define VG_AR_DEMANGLE 3 /* :: ArenaId */
#define VG_AR_EXECTXT 4 /* :: ArenaId */
#define VG_AR_ERRCTXT 5 /* :: ArenaId */
#define VG_AR_TRANSIENT 6 /* :: ArenaId */
extern void* VG_(malloc) ( ArenaId arena, Int nbytes );
extern void VG_(free) ( ArenaId arena, void* ptr );
extern void* VG_(calloc) ( ArenaId arena, Int nmemb, Int nbytes );
extern void* VG_(realloc) ( ArenaId arena, void* ptr, Int size );
extern void* VG_(malloc_aligned) ( ArenaId aid, Int req_alignB,
Int req_pszB );
extern void VG_(mallocSanityCheckArena) ( ArenaId arena );
extern void VG_(mallocSanityCheckAll) ( void );
extern void VG_(show_all_arena_stats) ( void );
extern Bool VG_(is_empty_arena) ( ArenaId aid );
/* The red-zone size for the client. This can be arbitrary, but
unfortunately must be set at compile time. */
#define VG_AR_CLIENT_REDZONE_SZW 4
#define VG_AR_CLIENT_REDZONE_SZB \
(VG_AR_CLIENT_REDZONE_SZW * VKI_BYTES_PER_WORD)
/* ---------------------------------------------------------------------
Exports of vg_clientfuns.c
------------------------------------------------------------------ */
/* This doesn't export code or data that valgrind.so needs to link
against. However, the scheduler does need to know the following
request codes. A few, publically-visible, request codes are also
defined in valgrind.h. */
#define VG_USERREQ__MALLOC 0x2001
#define VG_USERREQ__BUILTIN_NEW 0x2002
#define VG_USERREQ__BUILTIN_VEC_NEW 0x2003
#define VG_USERREQ__FREE 0x2004
#define VG_USERREQ__BUILTIN_DELETE 0x2005
#define VG_USERREQ__BUILTIN_VEC_DELETE 0x2006
#define VG_USERREQ__CALLOC 0x2007
#define VG_USERREQ__REALLOC 0x2008
#define VG_USERREQ__MEMALIGN 0x2009
#define VG_USERREQ__PTHREAD_CREATE 0x3001
#define VG_USERREQ__PTHREAD_JOIN 0x3002
#define VG_USERREQ__PTHREAD_GET_THREADID 0x3003
#define VG_USERREQ__PTHREAD_MUTEX_LOCK 0x3004
#define VG_USERREQ__PTHREAD_MUTEX_TRYLOCK 0x3005
#define VG_USERREQ__PTHREAD_MUTEX_UNLOCK 0x3006
#define VG_USERREQ__PTHREAD_CANCEL 0x3007
#define VG_USERREQ__PTHREAD_EXIT 0x3008
#define VG_USERREQ__PTHREAD_COND_WAIT 0x3009
#define VG_USERREQ__PTHREAD_COND_TIMEDWAIT 0x300A
#define VG_USERREQ__PTHREAD_COND_SIGNAL 0x300B
#define VG_USERREQ__PTHREAD_COND_BROADCAST 0x300C
#define VG_USERREQ__PTHREAD_KEY_CREATE 0x300D
#define VG_USERREQ__PTHREAD_KEY_DELETE 0x300E
#define VG_USERREQ__PTHREAD_SETSPECIFIC 0x300F
#define VG_USERREQ__PTHREAD_GETSPECIFIC 0x3010
#define VG_USERREQ__READ_MILLISECOND_TIMER 0x3011
/* Cosmetic ... */
#define VG_USERREQ__GET_PTHREAD_TRACE_LEVEL 0x3101
/*
In vg_constants.h:
#define VG_USERREQ__SIGNAL_RETURNS 0x4001
#define VG_USERREQ__PTHREAD_RETURNS 0x4002
#define VG_USERREQ__SHUTDOWN_VALGRIND 0x4003
*/
/* ---------------------------------------------------------------------
Constants pertaining to the simulated CPU state, VG_(baseBlock),
which need to go here to avoid ugly circularities.
------------------------------------------------------------------ */
/* How big is the saved FPU state? */
#define VG_SIZE_OF_FPUSTATE 108
/* ... and in words ... */
#define VG_SIZE_OF_FPUSTATE_W ((VG_SIZE_OF_FPUSTATE+3)/4)
/* ---------------------------------------------------------------------
Exports of vg_scheduler.c
------------------------------------------------------------------ */
/* ThreadIds are simply indices into the vg_threads[] array. */
typedef
UInt
ThreadId;
/* Special magic value for an invalid ThreadId. It corresponds to
LinuxThreads using zero as the initial value for
pthread_mutex_t.__m_owner and pthread_cond_t.__c_waiting. */
#define VG_INVALID_THREADID ((ThreadId)(0))
typedef
enum {
VgTs_Empty, /* this slot is not in use */
VgTs_Runnable, /* waiting to be scheduled */
VgTs_WaitJoiner, /* waiting for someone to do join on me */
VgTs_WaitJoinee, /* waiting for the thread I did join on */
VgTs_WaitFD, /* waiting for I/O completion on a fd */
VgTs_WaitMX, /* waiting on a mutex */
VgTs_WaitCV, /* waiting on a condition variable */
VgTs_Sleeping /* sleeping for a while */
}
ThreadStatus;
typedef
struct {
/* ThreadId == 0 (and hence vg_threads[0]) is NEVER USED.
The thread identity is simply the index in vg_threads[].
ThreadId == 1 is the root thread and has the special property
that we don't try and allocate or deallocate its stack. For
convenience of generating error message, we also put the
ThreadId in this tid field, but be aware that it should
ALWAYS == the index in vg_threads[]. */
ThreadId tid;
/* Current scheduling status.
Complications: whenever this is set to VgTs_WaitMX, you
should also set .m_edx to whatever the required return value
is for pthread_mutex_lock / pthread_cond_timedwait for when
the mutex finally gets unblocked. */
ThreadStatus status;
/* Identity of joiner (thread who called join on me), or
VG_INVALID_THREADID if no one asked to join yet. */
ThreadId joiner;
/* When .status == WaitMX, points to the mutex I am waiting for.
When .status == WaitCV, points to the mutex associated with
the condition variable indicated by the .associated_cv field.
In all other cases, should be NULL. */
void* /* pthread_mutex_t* */ associated_mx;
/* When .status == WaitCV, points to the condition variable I am
waiting for. In all other cases, should be NULL. */
void* /* pthread_cond_t* */ associated_cv;
/* If VgTs_Sleeping, this is when we should wake up, measured in
milliseconds as supplied by VG_(read_millisecond_counter).
If VgTs_WaitCV, this indicates the time at which
pthread_cond_timedwait should wake up. If == 0xFFFFFFFF,
this means infinitely far in the future, viz,
pthread_cond_wait. */
UInt awaken_at;
/* return value */
void* retval;
/* thread-specific data */
void* specifics[VG_N_THREAD_KEYS];
/* Stacks. When a thread slot is freed, we don't deallocate its
stack; we just leave it lying around for the next use of the
slot. If the next use of the slot requires a larger stack,
only then is the old one deallocated and a new one
allocated.
For the main thread (threadid == 0), this mechanism doesn't
apply. We don't know the size of the stack since we didn't
allocate it, and furthermore we never reallocate it. */
/* The allocated size of this thread's stack (permanently zero
if this is ThreadId == 0, since we didn't allocate its stack) */
UInt stack_size;
/* Address of the lowest word in this thread's stack. NULL means
not allocated yet.
*/
Addr stack_base;
/* Address of the highest legitimate word in this stack. This is
used for error messages only -- not critical for execution
correctness. Is is set for all stacks, specifically including
ThreadId == 0 (the main thread). */
Addr stack_highest_word;
/* Saved machine context. */
UInt m_eax;
UInt m_ebx;
UInt m_ecx;
UInt m_edx;
UInt m_esi;
UInt m_edi;
UInt m_ebp;
UInt m_esp;
UInt m_eflags;
UInt m_eip;
UInt m_fpu[VG_SIZE_OF_FPUSTATE_W];
UInt sh_eax;
UInt sh_ebx;
UInt sh_ecx;
UInt sh_edx;
UInt sh_esi;
UInt sh_edi;
UInt sh_ebp;
UInt sh_esp;
UInt sh_eflags;
}
ThreadState;
/* Copy the specified thread's state into VG_(baseBlock) in
preparation for running it. */
extern void VG_(load_thread_state)( ThreadId );
/* Save the specified thread's state back in VG_(baseBlock), and fill
VG_(baseBlock) with junk, for sanity-check reasons. */
extern void VG_(save_thread_state)( ThreadId );
/* Get the thread state block for the specified thread. */
extern ThreadState* VG_(get_thread_state)( ThreadId );
/* And for the currently running one, if valid. */
extern ThreadState* VG_(get_current_thread_state) ( void );
/* Similarly ... */
extern ThreadId VG_(get_current_tid) ( void );
/* Which thread is this address in the stack of, if any? Used for
error message generation. */
extern ThreadId VG_(identify_stack_addr)( Addr a );
/* Return codes from the scheduler. */
typedef
enum { VgSrc_Deadlock, VgSrc_Shutdown, VgSrc_BbsDone }
VgSchedReturnCode;
/* The scheduler. */
extern VgSchedReturnCode VG_(scheduler) ( void );
extern void VG_(scheduler_init) ( void );
extern void VG_(pp_sched_status) ( void );
/* vg_oursignalhandler() might longjmp(). Here's the jmp_buf. */
extern jmp_buf VG_(scheduler_jmpbuf);
/* ... and if so, here's the signal which caused it to do so. */
extern Int VG_(longjmpd_on_signal);
/* We check that the initial stack, which we can't move, is allocated
here. VG_(scheduler_init) checks this.
*/
#define VG_STARTUP_STACK_MASK (Addr)0xBFF80000
/* The red-zone size which we put at the bottom (highest address) of
thread stacks, for paranoia reasons. This can be arbitrary, and
doesn't really need to be set at compile time. */
#define VG_AR_CLIENT_STACKBASE_REDZONE_SZW 4
#define VG_AR_CLIENT_STACKBASE_REDZONE_SZB \
(VG_AR_CLIENT_STACKBASE_REDZONE_SZW * VKI_BYTES_PER_WORD)
/* ---------------------------------------------------------------------
Exports of vg_signals.c
------------------------------------------------------------------ */
extern void VG_(sigstartup_actions) ( void );
extern Bool VG_(deliver_signals) ( ThreadId );
extern void VG_(unblock_host_signal) ( Int sigNo );
/* Fake system calls for signal handling. */
extern void VG_(do__NR_sigaction) ( ThreadId tid );
extern void VG_(do__NR_sigprocmask) ( Int how, vki_ksigset_t* set );
/* Modify the current thread's state once we have detected it is
returning from a signal handler. */
extern Bool VG_(signal_returns) ( ThreadId );
/* Handy utilities to block/restore all host signals. */
extern void VG_(block_all_host_signals)
( /* OUT */ vki_ksigset_t* saved_mask );
extern void VG_(restore_host_signals)
( /* IN */ vki_ksigset_t* saved_mask );
/* ---------------------------------------------------------------------
Exports of vg_mylibc.c
------------------------------------------------------------------ */
#define NULL ((void*)0)
extern void VG_(exit)( Int status )
__attribute__ ((__noreturn__));
extern void VG_(printf) ( const char *format, ... );
/* too noisy ... __attribute__ ((format (printf, 1, 2))) ; */
extern void VG_(sprintf) ( Char* buf, Char *format, ... );
extern void VG_(vprintf) ( void(*send)(Char),
const Char *format, va_list vargs );
extern Bool VG_(isspace) ( Char c );
extern Int VG_(strlen) ( const Char* str );
extern Long VG_(atoll) ( Char* str );
extern Char* VG_(strcat) ( Char* dest, const Char* src );
extern Char* VG_(strncat) ( Char* dest, const Char* src, Int n );
extern Char* VG_(strpbrk) ( const Char* s, const Char* accept );
extern Char* VG_(strcpy) ( Char* dest, const Char* src );
extern Int VG_(strcmp) ( const Char* s1, const Char* s2 );
extern Int VG_(strcmp_ws) ( const Char* s1, const Char* s2 );
extern Int VG_(strncmp) ( const Char* s1, const Char* s2, Int nmax );
extern Int VG_(strncmp_ws) ( const Char* s1, const Char* s2, Int nmax );
extern Char* VG_(strstr) ( const Char* haystack, Char* needle );
extern Char* VG_(strchr) ( const Char* s, Char c );
extern Char* VG_(strdup) ( ArenaId aid, const Char* s);
extern Char* VG_(getenv) ( Char* name );
extern Int VG_(getpid) ( void );
extern void VG_(start_rdtsc_calibration) ( void );
extern void VG_(end_rdtsc_calibration) ( void );
extern UInt VG_(read_millisecond_timer) ( void );
extern Char VG_(toupper) ( Char c );
extern void VG_(strncpy_safely) ( Char* dest, const Char* src, Int ndest );
extern void VG_(strncpy) ( Char* dest, const Char* src, Int ndest );
extern Bool VG_(stringMatch) ( Char* pat, Char* str );
#define __STRING(x) #x
/* Asserts are permanently enabled. Hurrah! */
#define vg_assert(expr) \
((void) ((expr) ? 0 : \
(VG_(assert_fail) (__STRING(expr), \
__FILE__, __LINE__, \
__PRETTY_FUNCTION__), 0)))
extern void VG_(assert_fail) ( Char* expr, Char* file,
Int line, Char* fn )
__attribute__ ((__noreturn__));
/* Reading and writing files. */
extern Int VG_(open_read) ( Char* pathname );
extern Int VG_(open_write) ( Char* pathname );
extern Int VG_(create_and_write) ( Char* pathname );
extern void VG_(close) ( Int fd );
extern Int VG_(read) ( Int fd, void* buf, Int count);
extern Int VG_(write) ( Int fd, void* buf, Int count);
extern Int VG_(fcntl) ( Int fd, Int cmd, Int arg );
extern Int VG_(select)( Int n,
vki_fd_set* readfds,
vki_fd_set* writefds,
vki_fd_set* exceptfds,
struct vki_timeval * timeout );
extern Int VG_(nanosleep)( const struct vki_timespec *req,
struct vki_timespec *rem );
/* mmap-ery ... */
extern void* VG_(mmap)( void* start, UInt length,
UInt prot, UInt flags, UInt fd, UInt offset );
extern Int VG_(munmap)( void* start, Int length );
/* Print a (panic) message, and abort. */
extern void VG_(panic) ( Char* str )
__attribute__ ((__noreturn__));
/* Get memory by anonymous mmap. */
extern void* VG_(get_memory_from_mmap) ( Int nBytes );
/* Crude stand-in for the glibc system() call. */
extern Int VG_(system) ( Char* cmd );
/* Signal stuff. Note that these use the vk_ (kernel) structure
definitions, which are different in places from those that glibc
defines. Since we're operating right at the kernel interface,
glibc's view of the world is entirely irrelevant. */
extern Int VG_(ksigfillset)( vki_ksigset_t* set );
extern Int VG_(ksigemptyset)( vki_ksigset_t* set );
extern Int VG_(ksigaddset)( vki_ksigset_t* set, Int signum );
extern Int VG_(ksigprocmask)( Int how, const vki_ksigset_t* set,
vki_ksigset_t* oldset );
extern Int VG_(ksigaction) ( Int signum,
const vki_ksigaction* act,
vki_ksigaction* oldact );
extern Int VG_(ksigismember) ( vki_ksigset_t* set, Int signum );
extern Int VG_(ksignal)(Int signum, void (*sighandler)(Int));
extern Int VG_(ksigaltstack)( const vki_kstack_t* ss, vki_kstack_t* oss );
/* ---------------------------------------------------------------------
Definitions for the JITter (vg_translate.c, vg_to_ucode.c,
vg_from_ucode.c).
------------------------------------------------------------------ */
/* Tags which describe what operands are. */
typedef
enum { TempReg=0, ArchReg=1, RealReg=2,
SpillNo=3, Literal=4, Lit16=5,
NoValue=6 }
Tag;
/* Microinstruction opcodes. */
typedef
enum {
NOP,
GET,
PUT,
LOAD,
STORE,
MOV,
CMOV, /* Used for cmpxchg and cmov */
WIDEN,
JMP,
/* Read/write the %EFLAGS register into a TempReg. */
GETF, PUTF,
ADD, ADC, AND, OR, XOR, SUB, SBB,
SHL, SHR, SAR, ROL, ROR, RCL, RCR,
NOT, NEG, INC, DEC, BSWAP,
CC2VAL,
/* Not strictly needed, but useful for making better
translations of address calculations. */
LEA1, /* reg2 := const + reg1 */
LEA2, /* reg3 := const + reg1 + reg2 * 1,2,4 or 8 */
/* not for translating x86 calls -- only to call helpers */
CALLM_S, CALLM_E, /* Mark start and end of push/pop sequences
for CALLM. */
PUSH, POP, CLEAR, /* Add/remove/zap args for helpers. */
CALLM, /* call to a machine-code helper */
/* Hack for translating string (REP-) insns. Jump to literal if
TempReg/RealReg is zero. */
JIFZ,
/* FPU ops which read/write mem or don't touch mem at all. */
FPU_R,
FPU_W,
FPU,
/* Advance the simulated %eip by some small (< 128) number. */
INCEIP,
/* uinstrs which are not needed for mere translation of x86 code,
only for instrumentation of it. */
LOADV,
STOREV,
GETV,
PUTV,
TESTV,
SETV,
/* Get/set the v-bit (and it is only one bit) for the simulated
%eflags register. */
GETVF,
PUTVF,
/* Do a unary or binary tag op. Only for post-instrumented
code. For TAG1, first and only arg is a TempReg, and is both
arg and result reg. For TAG2, first arg is src, second is
dst, in the normal way; both are TempRegs. In both cases,
3rd arg is a RiCHelper with a Lit16 tag. This indicates
which tag op to do. */
TAG1,
TAG2
}
Opcode;
/* Condition codes, observing the Intel encoding. CondAlways is an
extra. */
typedef
enum {
CondO = 0, /* overflow */
CondNO = 1, /* no overflow */
CondB = 2, /* below */
CondNB = 3, /* not below */
CondZ = 4, /* zero */
CondNZ = 5, /* not zero */
CondBE = 6, /* below or equal */
CondNBE = 7, /* not below or equal */
CondS = 8, /* negative */
ConsNS = 9, /* not negative */
CondP = 10, /* parity even */
CondNP = 11, /* not parity even */
CondL = 12, /* jump less */
CondNL = 13, /* not less */
CondLE = 14, /* less or equal */
CondNLE = 15, /* not less or equal */
CondAlways = 16 /* Jump always */
}
Condcode;
/* Descriptions of additional properties of *unconditional* jumps. */
typedef
enum {
JmpBoring=0, /* boring unconditional jump */
JmpCall=1, /* jump due to an x86 call insn */
JmpRet=2, /* jump due to an x86 ret insn */
JmpSyscall=3, /* do a system call, then jump */
JmpClientReq=4 /* do a client request, then jump */
}
JmpKind;
/* Flags. User-level code can only read/write O(verflow), S(ign),
Z(ero), A(ux-carry), C(arry), P(arity), and may also write
D(irection). That's a total of 7 flags. A FlagSet is a bitset,
thusly:
76543210
DOSZACP
and bit 7 must always be zero since it is unused.
*/
typedef UChar FlagSet;
#define FlagD (1<<6)
#define FlagO (1<<5)
#define FlagS (1<<4)
#define FlagZ (1<<3)
#define FlagA (1<<2)
#define FlagC (1<<1)
#define FlagP (1<<0)
#define FlagsOSZACP (FlagO | FlagS | FlagZ | FlagA | FlagC | FlagP)
#define FlagsOSZAP (FlagO | FlagS | FlagZ | FlagA | FlagP)
#define FlagsOSZCP (FlagO | FlagS | FlagZ | FlagC | FlagP)
#define FlagsOSACP (FlagO | FlagS | FlagA | FlagC | FlagP)
#define FlagsSZACP ( FlagS | FlagZ | FlagA | FlagC | FlagP)
#define FlagsSZAP ( FlagS | FlagZ | FlagA | FlagP)
#define FlagsZCP ( FlagZ | FlagC | FlagP)
#define FlagsOC (FlagO | FlagC )
#define FlagsAC ( FlagA | FlagC )
#define FlagsALL (FlagsOSZACP | FlagD)
#define FlagsEmpty (FlagSet)0
#define VG_IS_FLAG_SUBSET(set1,set2) \
(( ((FlagSet)set1) & ((FlagSet)set2) ) == ((FlagSet)set1) )
#define VG_UNION_FLAG_SETS(set1,set2) \
( ((FlagSet)set1) | ((FlagSet)set2) )
/* A Micro (u)-instruction. */
typedef
struct {
/* word 1 */
UInt lit32; /* 32-bit literal */
/* word 2 */
UShort val1; /* first operand */
UShort val2; /* second operand */
/* word 3 */
UShort val3; /* third operand */
UChar opcode; /* opcode */
UChar size; /* data transfer size */
/* word 4 */
FlagSet flags_r; /* :: FlagSet */
FlagSet flags_w; /* :: FlagSet */
UChar tag1:4; /* first operand tag */
UChar tag2:4; /* second operand tag */
UChar tag3:4; /* third operand tag */
UChar extra4b:4; /* Spare field, used by WIDEN for src
-size, and by LEA2 for scale
(1,2,4 or 8), and by unconditional JMPs for
orig x86 instr size if --cachesim=yes */
/* word 5 */
UChar cond; /* condition, for jumps */
Bool smc_check:1; /* do a smc test, if writes memory. */
Bool signed_widen:1; /* signed or unsigned WIDEN ? */
JmpKind jmpkind:3; /* additional properties of unconditional JMP */
}
UInstr;
/* Expandable arrays of uinstrs. */
typedef
struct {
Int used;
Int size;
UInstr* instrs;
Int nextTemp;
}
UCodeBlock;
/* Refer to `the last instruction stuffed in', including as an
lvalue. */
#define LAST_UINSTR(cb) (cb)->instrs[(cb)->used-1]
/* An invalid temporary number :-) */
#define INVALID_TEMPREG 999999999
/* ---------------------------------------------------------------------
Exports of vg_demangle.c
------------------------------------------------------------------ */
extern void VG_(demangle) ( Char* orig, Char* result, Int result_size );
/* ---------------------------------------------------------------------
Exports of vg_from_ucode.c
------------------------------------------------------------------ */
extern UChar* VG_(emit_code) ( UCodeBlock* cb, Int* nbytes );
/* ---------------------------------------------------------------------
Exports of vg_to_ucode.c
------------------------------------------------------------------ */
extern Int VG_(disBB) ( UCodeBlock* cb, Addr eip0 );
extern Char* VG_(nameOfIntReg) ( Int size, Int reg );
extern Char VG_(nameOfIntSize) ( Int size );
extern UInt VG_(extend_s_8to32) ( UInt x );
extern Int VG_(getNewTemp) ( UCodeBlock* cb );
extern Int VG_(getNewShadow) ( UCodeBlock* cb );
#define SHADOW(tempreg) ((tempreg)+1)
/* ---------------------------------------------------------------------
Exports of vg_translate.c
------------------------------------------------------------------ */
extern void VG_(translate) ( ThreadState* tst,
Addr orig_addr,
UInt* orig_size,
Addr* trans_addr,
UInt* trans_size );
extern void VG_(emptyUInstr) ( UInstr* u );
extern void VG_(newUInstr0) ( UCodeBlock* cb, Opcode opcode, Int sz );
extern void VG_(newUInstr1) ( UCodeBlock* cb, Opcode opcode, Int sz,
Tag tag1, UInt val1 );
extern void VG_(newUInstr2) ( UCodeBlock* cb, Opcode opcode, Int sz,
Tag tag1, UInt val1,
Tag tag2, UInt val2 );
extern void VG_(newUInstr3) ( UCodeBlock* cb, Opcode opcode, Int sz,
Tag tag1, UInt val1,
Tag tag2, UInt val2,
Tag tag3, UInt val3 );
extern void VG_(setFlagRW) ( UInstr* u,
FlagSet fr, FlagSet fw );
extern void VG_(setLiteralField) ( UCodeBlock* cb, UInt lit32 );
extern Bool VG_(anyFlagUse) ( UInstr* u );
extern void VG_(ppUInstr) ( Int instrNo, UInstr* u );
extern void VG_(ppUCodeBlock) ( UCodeBlock* cb, Char* title );
extern UCodeBlock* VG_(allocCodeBlock) ( void );
extern void VG_(freeCodeBlock) ( UCodeBlock* cb );
extern void VG_(copyUInstr) ( UCodeBlock* cb, UInstr* instr );
extern Char* VG_(nameCondcode) ( Condcode cond );
extern Bool VG_(saneUInstr) ( Bool beforeRA, UInstr* u );
extern Bool VG_(saneUCodeBlock) ( UCodeBlock* cb );
extern Char* VG_(nameUOpcode) ( Bool upper, Opcode opc );
extern Int VG_(rankToRealRegNo) ( Int rank );
extern void* VG_(jitmalloc) ( Int nbytes );
extern void VG_(jitfree) ( void* ptr );
/* ---------------------------------------------------------------------
Exports of vg_execontext.c.
------------------------------------------------------------------ */
/* Records the PC and a bit of the call chain. The first 4 %eip
values are used in comparisons do remove duplicate errors, and for
comparing against suppression specifications. The rest are purely
informational (but often important). */
typedef
struct _ExeContextRec {
struct _ExeContextRec * next;
/* The size of this array is VG_(clo_backtrace_size); at least
2, at most VG_DEEPEST_BACKTRACE. [0] is the current %eip,
[1] is its caller, [2] is the caller of [1], etc. */
Addr eips[0];
}
ExeContext;
/* Initialise the ExeContext storage mechanism. */
extern void VG_(init_ExeContext_storage) ( void );
/* Print stats (informational only). */
extern void VG_(show_ExeContext_stats) ( void );
/* Take a snapshot of the client's stack. Search our collection of
ExeContexts to see if we already have it, and if not, allocate a
new one. Either way, return a pointer to the context. */
extern ExeContext* VG_(get_ExeContext) ( Bool skip_top_frame,
Addr eip, Addr ebp );
/* Print an ExeContext. */
extern void VG_(pp_ExeContext) ( ExeContext* );
/* Compare two ExeContexts, just comparing the top two callers. */
extern Bool VG_(eq_ExeContext_top2) ( ExeContext* e1, ExeContext* e2 );
/* Compare two ExeContexts, just comparing the top four callers. */
extern Bool VG_(eq_ExeContext_top4) ( ExeContext* e1, ExeContext* e2 );
/* Compare two ExeContexts, comparing all callers. */
extern Bool VG_(eq_ExeContext_all) ( ExeContext* e1, ExeContext* e2 );
/* ---------------------------------------------------------------------
Exports of vg_errcontext.c.
------------------------------------------------------------------ */
extern void VG_(load_suppressions) ( void );
extern void VG_(show_all_errors) ( void );
extern void VG_(record_value_error) ( Int size );
extern void VG_(record_free_error) ( ThreadState* tst, Addr a );
extern void VG_(record_freemismatch_error) ( ThreadState* tst, Addr a );
extern void VG_(record_address_error) ( Addr a, Int size,
Bool isWrite );
extern void VG_(record_jump_error) ( ThreadState* tst, Addr a );
extern void VG_(record_param_err) ( ThreadState* tst,
Addr a,
Bool isWriteLack,
Char* msg );
extern void VG_(record_user_err) ( ThreadState* tst,
Addr a, Bool isWriteLack );
/* The classification of a faulting address. */
typedef
enum { Stack, Unknown, Freed, Mallocd, UserG, UserS }
AddrKind;
/* Records info about a faulting address. */
typedef
struct {
/* ALL */
AddrKind akind;
/* Freed, Mallocd */
Int blksize;
/* Freed, Mallocd */
Int rwoffset;
/* Freed, Mallocd */
ExeContext* lastchange;
/* Stack */
ThreadId stack_tid;
}
AddrInfo;
/* ---------------------------------------------------------------------
Exports of vg_clientperms.c
------------------------------------------------------------------ */
extern Bool VG_(client_perm_maybe_describe)( Addr a, AddrInfo* ai );
extern UInt VG_(handle_client_request) ( ThreadState* tst, UInt* arg_block );
extern void VG_(delete_client_stack_blocks_following_ESP_change) ( void );
extern void VG_(show_client_block_stats) ( void );
/* ---------------------------------------------------------------------
Exports of vg_procselfmaps.c
------------------------------------------------------------------ */
extern
void VG_(read_procselfmaps) (
void (*record_mapping)( Addr, UInt, Char, Char, Char, UInt, UChar* )
);
/* ---------------------------------------------------------------------
Exports of vg_symtab2.c
------------------------------------------------------------------ */
/* We assume the executable is loaded here ... can't really find
out. There is a hacky sanity check in vg_init_memory_audit()
which should trip up most stupidities.
*/
#define VG_ASSUMED_EXE_BASE (Addr)0x8048000
extern void VG_(read_symbols) ( void );
extern void VG_(mini_stack_dump) ( ExeContext* ec );
extern void VG_(what_obj_and_fun_is_this)
( Addr a,
Char* obj_buf, Int n_obj_buf,
Char* fun_buf, Int n_fun_buf );
extern Bool VG_(what_line_is_this) ( Addr a,
UChar* filename, Int n_filename,
UInt* lineno );
extern Bool VG_(what_fn_is_this) ( Bool no_demangle, Addr a,
Char* fn_name, Int n_fn_name);
extern void VG_(symtab_notify_munmap) ( Addr start, UInt length );
/* ---------------------------------------------------------------------
Exports of vg_clientmalloc.c
------------------------------------------------------------------ */
typedef
enum {
Vg_AllocMalloc = 0,
Vg_AllocNew = 1,
Vg_AllocNewVec = 2
}
VgAllocKind;
/* Description of a malloc'd chunk. */
typedef
struct _ShadowChunk {
struct _ShadowChunk* next;
ExeContext* where; /* where malloc'd/free'd */
UInt size : 30; /* size requested. */
VgAllocKind allockind : 2; /* which wrapper did the allocation */
Addr data; /* ptr to actual block. */
}
ShadowChunk;
extern void VG_(clientmalloc_done) ( void );
extern void VG_(describe_addr) ( Addr a, AddrInfo* ai );
extern ShadowChunk** VG_(get_malloc_shadows) ( /*OUT*/ UInt* n_shadows );
/* These are called from the scheduler, when it intercepts a user
request. */
extern void* VG_(client_malloc) ( ThreadState* tst,
UInt size, VgAllocKind kind );
extern void* VG_(client_memalign) ( ThreadState* tst,
UInt align, UInt size );
extern void VG_(client_free) ( ThreadState* tst,
void* ptrV, VgAllocKind kind );
extern void* VG_(client_calloc) ( ThreadState* tst,
UInt nmemb, UInt size1 );
extern void* VG_(client_realloc) ( ThreadState* tst,
void* ptrV, UInt size_new );
/* ---------------------------------------------------------------------
Exports of vg_main.c
------------------------------------------------------------------ */
/* A structure used as an intermediary when passing the simulated
CPU's state to some assembly fragments, particularly system calls.
Stuff is copied from baseBlock to here, the assembly magic runs,
and then the inverse copy is done. */
extern UInt VG_(m_state_static) [8 /* int regs, in Intel order */
+ 1 /* %eflags */
+ 1 /* %eip */
+ VG_SIZE_OF_FPUSTATE_W /* FPU state */
];
/* Handy fns for doing the copy back and forth. */
extern void VG_(copy_baseBlock_to_m_state_static) ( void );
extern void VG_(copy_m_state_static_to_baseBlock) ( void );
/* Called when some unhandleable client behaviour is detected.
Prints a msg and aborts. */
extern void VG_(unimplemented) ( Char* msg );
/* The stack on which Valgrind runs. We can't use the same stack as the
simulatee -- that's an important design decision. */
extern UInt VG_(stack)[10000];
/* Similarly, we have to ask for signals to be delivered on an
alternative stack, since it is possible, although unlikely, that
we'll have to run client code from inside the Valgrind-installed
signal handler. If this happens it will be done by
vg_deliver_signal_immediately(). */
extern UInt VG_(sigstack)[10000];
/* Holds client's %esp at the point we gained control. From this the
client's argc, argv and envp are deduced. */
extern Addr VG_(esp_at_startup);
extern Int VG_(client_argc);
extern Char** VG_(client_argv);
extern Char** VG_(client_envp);
/* Remove valgrind.so from a LD_PRELOAD=... string so child processes
don't get traced into. */
extern void VG_(mash_LD_PRELOAD_string)( Char* ld_preload_str );
/* Something of a function looking for a home ... start up GDB. This
is called from VG_(swizzle_esp_then_start_GDB) and so runs on the
*client's* stack. This is necessary to give GDB the illusion that
the client program really was running on the real cpu. */
extern void VG_(start_GDB_whilst_on_client_stack) ( void );
/* Spew out vast amounts of junk during JITting? */
extern Bool VG_(disassemble);
/* 64-bit counter for the number of basic blocks done. */
extern ULong VG_(bbs_done);
/* 64-bit counter for the number of bbs to go before a debug exit. */
extern ULong VG_(bbs_to_go);
/* Counts downwards in vg_run_innerloop. */
extern UInt VG_(dispatch_ctr);
/* Is the client running on the simulated CPU or the real one? */
extern Bool VG_(running_on_simd_CPU); /* Initially False */
/* The current LRU epoch. */
extern UInt VG_(current_epoch);
/* --- Counters, for informational purposes only. --- */
/* Number of lookups which miss the fast tt helper. */
extern UInt VG_(tt_fast_misses);
/* Counts for LRU informational messages. */
/* Number and total o/t size of new translations this epoch. */
extern UInt VG_(this_epoch_in_count);
extern UInt VG_(this_epoch_in_osize);
extern UInt VG_(this_epoch_in_tsize);
/* Number and total o/t size of discarded translations this epoch. */
extern UInt VG_(this_epoch_out_count);
extern UInt VG_(this_epoch_out_osize);
extern UInt VG_(this_epoch_out_tsize);
/* Number and total o/t size of translations overall. */
extern UInt VG_(overall_in_count);
extern UInt VG_(overall_in_osize);
extern UInt VG_(overall_in_tsize);
/* Number and total o/t size of discards overall. */
extern UInt VG_(overall_out_count);
extern UInt VG_(overall_out_osize);
extern UInt VG_(overall_out_tsize);
/* The number of LRU-clearings of TT/TC. */
extern UInt VG_(number_of_lrus);
/* Counts pertaining to the register allocator. */
/* total number of uinstrs input to reg-alloc */
extern UInt VG_(uinstrs_prealloc);
/* total number of uinstrs added due to spill code */
extern UInt VG_(uinstrs_spill);
/* number of bbs requiring spill code */
extern UInt VG_(translations_needing_spill);
/* total of register ranks over all translations */
extern UInt VG_(total_reg_rank);
/* Counts pertaining to the self-modifying-code detection machinery. */
/* Total number of writes checked. */
//extern UInt VG_(smc_total_check4s);
/* Number of writes which the fast smc check couldn't show were
harmless. */
extern UInt VG_(smc_cache_passed);
/* Numnber of writes which really did write on original code. */
extern UInt VG_(smc_fancy_passed);
/* Number of translations discarded as a result. */
//extern UInt VG_(smc_discard_count);
/* Counts pertaining to internal sanity checking. */
extern UInt VG_(sanity_fast_count);
extern UInt VG_(sanity_slow_count);
/* Counts pertaining to the scheduler. */
extern UInt VG_(num_scheduling_events_MINOR);
extern UInt VG_(num_scheduling_events_MAJOR);
/* ---------------------------------------------------------------------
Exports of vg_memory.c
------------------------------------------------------------------ */
extern void VGM_(init_memory_audit) ( void );
extern Addr VGM_(curr_dataseg_end);
extern void VG_(show_reg_tags) ( void );
extern void VG_(detect_memory_leaks) ( void );
extern void VG_(done_prof_mem) ( void );
/* Set permissions for an address range. Not speed-critical. */
extern void VGM_(make_noaccess) ( Addr a, UInt len );
extern void VGM_(make_writable) ( Addr a, UInt len );
extern void VGM_(make_readable) ( Addr a, UInt len );
/* Use with care! (read: use for shmat only) */
extern void VGM_(make_readwritable) ( Addr a, UInt len );
extern void VGM_(copy_address_range_perms) ( Addr src, Addr dst,
UInt len );
/* Check permissions for an address range. Not speed-critical. */
extern Bool VGM_(check_writable) ( Addr a, UInt len, Addr* bad_addr );
extern Bool VGM_(check_readable) ( Addr a, UInt len, Addr* bad_addr );
extern Bool VGM_(check_readable_asciiz) ( Addr a, Addr* bad_addr );
/* Sanity checks which may be done at any time. The scheduler decides
when. */
extern void VG_(do_sanity_checks) ( Bool force_expensive );
/* Very cheap ... */
extern Bool VG_(first_and_last_secondaries_look_plausible) ( void );
/* These functions are called from generated code. */
extern void VG_(helperc_STOREV4) ( UInt, Addr );
extern void VG_(helperc_STOREV2) ( UInt, Addr );
extern void VG_(helperc_STOREV1) ( UInt, Addr );
extern UInt VG_(helperc_LOADV1) ( Addr );
extern UInt VG_(helperc_LOADV2) ( Addr );
extern UInt VG_(helperc_LOADV4) ( Addr );
extern void VGM_(handle_esp_assignment) ( Addr new_espA );
extern void VGM_(fpu_write_check) ( Addr addr, Int size );
extern void VGM_(fpu_read_check) ( Addr addr, Int size );
/* Safely (avoiding SIGSEGV / SIGBUS) scan the entire valid address
space and pass the addresses and values of all addressible,
defined, aligned words to notify_word. This is the basis for the
leak detector. Returns the number of calls made to notify_word. */
UInt VG_(scan_all_valid_memory) ( void (*notify_word)( Addr, UInt ) );
/* Is this address within some small distance below %ESP? Used only
for the --workaround-gcc296-bugs kludge. */
extern Bool VG_(is_just_below_ESP)( Addr esp, Addr aa );
/* Nasty kludgery to deal with applications which switch stacks,
like netscape. */
#define VG_PLAUSIBLE_STACK_SIZE 8000000
/* ---------------------------------------------------------------------
Exports of vg_syscall_mem.c
------------------------------------------------------------------ */
extern void VG_(perform_assumed_nonblocking_syscall) ( ThreadId tid );
extern void VG_(check_known_blocking_syscall) ( ThreadId tid,
Int syscallno,
Int* /*IN*/ res );
extern Bool VG_(is_kerror) ( Int res );
#define KERNEL_DO_SYSCALL(thread_id, result_lvalue) \
VG_(load_thread_state)(thread_id); \
VG_(copy_baseBlock_to_m_state_static)(); \
VG_(do_syscall)(); \
VG_(copy_m_state_static_to_baseBlock)(); \
VG_(save_thread_state)(thread_id); \
result_lvalue = VG_(get_thread_state)(thread_id)->m_eax;
/* ---------------------------------------------------------------------
Exports of vg_transtab.c
------------------------------------------------------------------ */
/* An entry in the translation table (TT). */
typedef
struct {
/* +0 */ Addr orig_addr;
/* +4 */ Addr trans_addr;
/* +8 */ UInt mru_epoch;
/* +12 */ UShort orig_size;
/* +14 */ UShort trans_size;
}
TTEntry;
/* The number of basic blocks in an epoch (one age-step). */
#define VG_BBS_PER_EPOCH 20000
extern void VG_(get_tt_tc_used) ( UInt* tt_used, UInt* tc_used );
extern void VG_(maybe_do_lru_pass) ( void );
extern void VG_(flush_transtab) ( void );
extern Addr VG_(copy_to_transcache) ( Addr trans_addr, Int trans_size );
extern void VG_(add_to_trans_tab) ( TTEntry* tte );
extern void VG_(smc_mark_original) ( Addr original_addr,
Int original_len );
extern void VG_(init_transtab_and_SMC) ( void );
extern void VG_(sanity_check_tc_tt) ( void );
extern Addr VG_(search_transtab) ( Addr original_addr );
extern void VG_(invalidate_tt_fast)( void );
/* ---------------------------------------------------------------------
Exports of vg_vtagops.c
------------------------------------------------------------------ */
/* Lists the names of value-tag operations used in instrumented
code. These are the third argument to TAG1 and TAG2 uinsns. */
typedef
enum {
/* Unary. */
VgT_PCast40, VgT_PCast20, VgT_PCast10,
VgT_PCast01, VgT_PCast02, VgT_PCast04,
VgT_PCast14, VgT_PCast12, VgT_PCast11,
VgT_Left4, VgT_Left2, VgT_Left1,
VgT_SWiden14, VgT_SWiden24, VgT_SWiden12,
VgT_ZWiden14, VgT_ZWiden24, VgT_ZWiden12,
/* Binary; 1st is rd; 2nd is rd+wr */
VgT_UifU4, VgT_UifU2, VgT_UifU1, VgT_UifU0,
VgT_DifD4, VgT_DifD2, VgT_DifD1,
VgT_ImproveAND4_TQ, VgT_ImproveAND2_TQ, VgT_ImproveAND1_TQ,
VgT_ImproveOR4_TQ, VgT_ImproveOR2_TQ, VgT_ImproveOR1_TQ,
VgT_DebugFn
}
VgTagOp;
extern Char* VG_(nameOfTagOp) ( VgTagOp );
extern UInt VG_(DebugFn) ( UInt a1, UInt a2 );
/* ---------------------------------------------------------------------
Exports of vg_syscall.S
------------------------------------------------------------------ */
extern void VG_(do_syscall) ( void );
/* ---------------------------------------------------------------------
Exports of vg_startup.S
------------------------------------------------------------------ */
extern void VG_(shutdown);
extern void VG_(switch_to_real_CPU) ( void );
extern void VG_(swizzle_esp_then_start_GDB) ( Addr m_eip_at_error,
Addr m_esp_at_error,
Addr m_ebp_at_error );
/* ---------------------------------------------------------------------
Exports of vg_dispatch.S
------------------------------------------------------------------ */
/* Run a thread for a (very short) while, until some event happens
which means we need to defer to the scheduler. */
extern UInt VG_(run_innerloop) ( void );
/* ---------------------------------------------------------------------
Exports of vg_helpers.S
------------------------------------------------------------------ */
/* SMC fast checks. */
extern void VG_(helper_smc_check4);
/* Mul, div, etc, -- we don't codegen these directly. */
extern void VG_(helper_idiv_64_32);
extern void VG_(helper_div_64_32);
extern void VG_(helper_idiv_32_16);
extern void VG_(helper_div_32_16);
extern void VG_(helper_idiv_16_8);
extern void VG_(helper_div_16_8);
extern void VG_(helper_imul_32_64);
extern void VG_(helper_mul_32_64);
extern void VG_(helper_imul_16_32);
extern void VG_(helper_mul_16_32);
extern void VG_(helper_imul_8_16);
extern void VG_(helper_mul_8_16);
extern void VG_(helper_CLD);
extern void VG_(helper_STD);
extern void VG_(helper_get_dirflag);
extern void VG_(helper_shldl);
extern void VG_(helper_shldw);
extern void VG_(helper_shrdl);
extern void VG_(helper_shrdw);
extern void VG_(helper_RDTSC);
extern void VG_(helper_CPUID);
extern void VG_(helper_bsf);
extern void VG_(helper_bsr);
extern void VG_(helper_fstsw_AX);
extern void VG_(helper_SAHF);
extern void VG_(helper_DAS);
extern void VG_(helper_DAA);
extern void VG_(helper_value_check4_fail);
extern void VG_(helper_value_check2_fail);
extern void VG_(helper_value_check1_fail);
extern void VG_(helper_value_check0_fail);
/* NOT FUNCTIONS; these are bogus RETURN ADDRESS. */
extern void VG_(signalreturn_bogusRA)( void );
extern void VG_(pthreadreturn_bogusRA)( void );
/* ---------------------------------------------------------------------
Exports of vg_cachesim.c
------------------------------------------------------------------ */
extern UCodeBlock* VG_(cachesim_instrument)(UCodeBlock* cb_in, Addr orig_addr);
typedef struct _iCC iCC;
typedef struct _idCC idCC;
extern void VG_(init_cachesim) ( void );
extern void VG_(show_cachesim_results)( Int client_argc, Char** client_argv );
extern void VG_(cachesim_log_non_mem_instr)( iCC* cc );
extern void VG_(cachesim_log_mem_instr) ( idCC* cc, Addr data_addr );
/* ---------------------------------------------------------------------
The state of the simulated CPU.
------------------------------------------------------------------ */
/* This is the Intel register encoding. */
#define R_EAX 0
#define R_ECX 1
#define R_EDX 2
#define R_EBX 3
#define R_ESP 4
#define R_EBP 5
#define R_ESI 6
#define R_EDI 7
#define R_AL (0+R_EAX)
#define R_CL (0+R_ECX)
#define R_DL (0+R_EDX)
#define R_BL (0+R_EBX)
#define R_AH (4+R_EAX)
#define R_CH (4+R_ECX)
#define R_DH (4+R_EDX)
#define R_BH (4+R_EBX)
/* ---------------------------------------------------------------------
Offsets into baseBlock for everything which needs to referred to
from generated code. The order of these decls does not imply
what the order of the actual offsets is. The latter is important
and is set up in vg_main.c.
------------------------------------------------------------------ */
/* An array of words. In generated code, %ebp always points to the
start of this array. Useful stuff, like the simulated CPU state,
and the addresses of helper functions, can then be found by
indexing off %ebp. The following declares variables which, at
startup time, are given values denoting offsets into baseBlock.
These offsets are in *words* from the start of baseBlock. */
#define VG_BASEBLOCK_WORDS 200
extern UInt VG_(baseBlock)[VG_BASEBLOCK_WORDS];
/* -----------------------------------------------------
Read-write parts of baseBlock.
-------------------------------------------------- */
/* State of the simulated CPU. */
extern Int VGOFF_(m_eax);
extern Int VGOFF_(m_ecx);
extern Int VGOFF_(m_edx);
extern Int VGOFF_(m_ebx);
extern Int VGOFF_(m_esp);
extern Int VGOFF_(m_ebp);
extern Int VGOFF_(m_esi);
extern Int VGOFF_(m_edi);
extern Int VGOFF_(m_eflags);
extern Int VGOFF_(m_fpustate);
extern Int VGOFF_(m_eip);
/* Reg-alloc spill area (VG_MAX_SPILLSLOTS words long). */
extern Int VGOFF_(spillslots);
/* Records the valid bits for the 8 integer regs & flags reg. */
extern Int VGOFF_(sh_eax);
extern Int VGOFF_(sh_ecx);
extern Int VGOFF_(sh_edx);
extern Int VGOFF_(sh_ebx);
extern Int VGOFF_(sh_esp);
extern Int VGOFF_(sh_ebp);
extern Int VGOFF_(sh_esi);
extern Int VGOFF_(sh_edi);
extern Int VGOFF_(sh_eflags);
/* -----------------------------------------------------
Read-only parts of baseBlock.
-------------------------------------------------- */
/* Offsets of addresses of helper functions. A "helper" function is
one which is called from generated code. */
extern Int VGOFF_(helper_idiv_64_32);
extern Int VGOFF_(helper_div_64_32);
extern Int VGOFF_(helper_idiv_32_16);
extern Int VGOFF_(helper_div_32_16);
extern Int VGOFF_(helper_idiv_16_8);
extern Int VGOFF_(helper_div_16_8);
extern Int VGOFF_(helper_imul_32_64);
extern Int VGOFF_(helper_mul_32_64);
extern Int VGOFF_(helper_imul_16_32);
extern Int VGOFF_(helper_mul_16_32);
extern Int VGOFF_(helper_imul_8_16);
extern Int VGOFF_(helper_mul_8_16);
extern Int VGOFF_(helper_CLD);
extern Int VGOFF_(helper_STD);
extern Int VGOFF_(helper_get_dirflag);
extern Int VGOFF_(helper_shldl);
extern Int VGOFF_(helper_shldw);
extern Int VGOFF_(helper_shrdl);
extern Int VGOFF_(helper_shrdw);
extern Int VGOFF_(helper_RDTSC);
extern Int VGOFF_(helper_CPUID);
extern Int VGOFF_(helper_bsf);
extern Int VGOFF_(helper_bsr);
extern Int VGOFF_(helper_fstsw_AX);
extern Int VGOFF_(helper_SAHF);
extern Int VGOFF_(helper_DAS);
extern Int VGOFF_(helper_DAA);
extern Int VGOFF_(helper_value_check4_fail);
extern Int VGOFF_(helper_value_check2_fail);
extern Int VGOFF_(helper_value_check1_fail);
extern Int VGOFF_(helper_value_check0_fail);
extern Int VGOFF_(helperc_STOREV4); /* :: UInt -> Addr -> void */
extern Int VGOFF_(helperc_STOREV2); /* :: UInt -> Addr -> void */
extern Int VGOFF_(helperc_STOREV1); /* :: UInt -> Addr -> void */
extern Int VGOFF_(helperc_LOADV4); /* :: Addr -> UInt -> void */
extern Int VGOFF_(helperc_LOADV2); /* :: Addr -> UInt -> void */
extern Int VGOFF_(helperc_LOADV1); /* :: Addr -> UInt -> void */
extern Int VGOFF_(handle_esp_assignment); /* :: Addr -> void */
extern Int VGOFF_(fpu_write_check); /* :: Addr -> Int -> void */
extern Int VGOFF_(fpu_read_check); /* :: Addr -> Int -> void */
extern Int VGOFF_(cachesim_log_non_mem_instr);
extern Int VGOFF_(cachesim_log_mem_instr);
#endif /* ndef __VG_INCLUDE_H */
/* ---------------------------------------------------------------------
Finally - autoconf-generated settings
------------------------------------------------------------------ */
#include "config.h"
/*--------------------------------------------------------------------*/
/*--- end vg_include.h ---*/
/*--------------------------------------------------------------------*/
|