aboutsummaryrefslogtreecommitdiff
path: root/gdb/mtrace.awk
diff options
context:
space:
mode:
authorJohn Gilmore <gnu@cygnus>1991-04-05 09:01:15 +0000
committerJohn Gilmore <gnu@cygnus>1991-04-05 09:01:15 +0000
commit07d021a6ae8d3ed9da9f55c8623739e7a716308e (patch)
treeb89d9ed8acbddfa222437388e1b1c2e5c3226082 /gdb/mtrace.awk
parent4e1dc656813c2a5e04f210210977ab748514bd4b (diff)
downloadgdb-07d021a6ae8d3ed9da9f55c8623739e7a716308e.zip
gdb-07d021a6ae8d3ed9da9f55c8623739e7a716308e.tar.gz
gdb-07d021a6ae8d3ed9da9f55c8623739e7a716308e.tar.bz2
Initial revision
Diffstat (limited to 'gdb/mtrace.awk')
-rwxr-xr-xgdb/mtrace.awk36
1 files changed, 36 insertions, 0 deletions
diff --git a/gdb/mtrace.awk b/gdb/mtrace.awk
new file mode 100755
index 0000000..d7689ce
--- /dev/null
+++ b/gdb/mtrace.awk
@@ -0,0 +1,36 @@
+#
+# Awk program to analyze mtrace.c output.
+#
+$1 == "+" { if (allocated[$2] != "")
+ print "+", $2, "Alloc", NR, "duplicate:", allocated[$2];
+ else
+ allocated[$2] = $3;
+ }
+$1 == "-" { if (allocated[$2] != "") {
+ allocated[$2] = "";
+ if (allocated[$2] != "")
+ print "DELETE FAILED", $2, allocated[$2];
+ } else
+ print "-", $2, "Free", NR, "was never alloc'd";
+ }
+$1 == "<" { if (allocated[$2] != "")
+ allocated[$2] = "";
+ else
+ print "-", $2, "Realloc", NR, "was never alloc'd";
+ }
+$1 == ">" { if (allocated[$2] != "")
+ print "+", $2, "Realloc", NR, "duplicate:", allocated[$2];
+ else
+ allocated[$2] = $3;
+ }
+
+# Ignore "= Start"
+$1 == "=" { }
+# Ignore failed realloc attempts for now
+$1 == "!" { }
+
+
+END { for (x in allocated)
+ if (allocated[x] != "")
+ print "+", x, allocated[x];
+ }