Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
I don't need an extra file just to define calloc when it can be inlined that easily
[simgrid.git] / src / xbt / mmalloc / mmtrace.awk
1 #
2 #  Awk program to analyze mtrace.c output.
3 #
4 $1 == "+"       { if (allocated[$2] != "")
5                     print "+", $2, "Alloc", NR, "duplicate:", allocated[$2];
6                   else
7                     allocated[$2] = $3;
8                 }
9 $1 == "-"       { if (allocated[$2] != "") {
10                     allocated[$2] = "";
11                     if (allocated[$2] != "")
12                         print "DELETE FAILED", $2, allocated[$2];
13                   } else
14                     print "-", $2, "Free", NR, "was never alloc'd";
15                 }
16 $1 == "<"       { if (allocated[$2] != "")
17                     allocated[$2] = "";
18                   else
19                     print "-", $2, "Realloc", NR, "was never alloc'd";
20                 }
21 $1 == ">"       { if (allocated[$2] != "")
22                     print "+", $2, "Realloc", NR, "duplicate:", allocated[$2];
23                   else
24                     allocated[$2] = $3;
25                 }
26
27 # Ignore "= Start"
28 $1 == "="       { }
29 # Ignore failed realloc attempts for now
30 $1 == "!"       { }
31
32
33 END             { for (x in allocated) 
34                     if (allocated[x] != "")
35                       print "+", x, allocated[x];
36                 }