Commit | Line | Data |
---|---|---|
63abb1e7 FF |
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 | } |