Sync usage with man page.
[netbsd-mini2440.git] / gnu / lib / libmalloc / mtrace.awk
blobd7689cec3ff53fc3793f0fab1f3471c2106af91b
2 # Awk program to analyze mtrace.c output.
4 $1 == "+" { if (allocated[$2] != "")
5 print "+", $2, "Alloc", NR, "duplicate:", allocated[$2];
6 else
7 allocated[$2] = $3;
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";
16 $1 == "<" { if (allocated[$2] != "")
17 allocated[$2] = "";
18 else
19 print "-", $2, "Realloc", NR, "was never alloc'd";
21 $1 == ">" { if (allocated[$2] != "")
22 print "+", $2, "Realloc", NR, "duplicate:", allocated[$2];
23 else
24 allocated[$2] = $3;
27 # Ignore "= Start"
28 $1 == "=" { }
29 # Ignore failed realloc attempts for now
30 $1 == "!" { }
33 END { for (x in allocated)
34 if (allocated[x] != "")
35 print "+", x, allocated[x];