1#!/usr/local/bin/perl -i
2#
3# This script converts all numbers that look like addresses or memory sizes,
4# in a debug files generated by --debug (like mysqld --debug-dbug), to #.
5# The script also deletes all thread id's from the start of the line.
6
7# This allows you to easily compare the files (for example with diff)
8# to find out what changes between different executions.
9# This is extremely useful for comparing two mysqld versions to see
10# why things now work differently.
11
12# The script converts the files in place.
13#
14# Typical usage:
15#
16# convert-debug-for-diff /tmp/mysqld.trace /tmp/mysqld-old.trace
17# diff /tmp/mysqld.trace /tmp/mysqld-old.trace
18
19while (<>)
20{
21  s/^T@[0-9]+\s*://g;
22  s/0x[0-9a-f]+(\s|\n|\))/#$1/g;
23  s/size: [0-9]+/size: #/g;
24  print $_;
25}
26