3 # tracemunch -- compactify ncurses trace logs
5 # The error logs produced by ncurses with tracing enabled can be very tedious
6 # to wade through. This script helps by compacting runs of log lines that
7 # can be conveniently expressed as higher-level operations.
9 # ($Id: tracemunch,v 1.2 1995/10/06 15:02:37 esr Exp $)
11 $putattr="PutAttrChar\\('(.)' = 0x.., {A_NORMAL}\\) at \\(([0-9]+), ([0-9]+)\\)";
12 $waddnstr="waddnstr\\(0x([0-9a-f]+),\"([^\"]+)\",[0-9]+\\) called {A_NORMAL}";
18 $arg =~ s/$curscr/curscr/ if ($curscr);
19 $arg =~ s/$newscr/newscr/ if ($newscr);
20 $arg =~ s/$stdscr/stdscr/ if ($stdscr);
28 # Transform window pointer addresses so it's easier to compare logs
29 $awaiting = "curscr" if ($_ =~ /creating curscr/);
30 $awaiting = "newscr" if ($_ =~ /creating newscr/);
31 $awaiting = "stdscr" if ($_ =~ /creating stdscr/);
32 if ($awaiting && $_ =~ /newwin: returned window is 0x([0-9a-f]+)/)
34 $curscr = "0x$1" if ($awaiting eq "curscr");
35 $newscr = "0x$1" if ($awaiting eq "newscr");
36 $stdscr = "0x$1" if ($awaiting eq "stdscr");
40 # Compactify runs of PutAttrChar calls (TR_CHARPUT)
48 if ($_ =~ /$putattr/) {
54 print "RUN of PutAttrChar()s: \"$putattr_chars\" from ${starty}, ${startx}\n";
58 # Compactify runs of waddnstr calls (TR_CALLS)
59 if ($_ =~ /$waddnstr/)
65 if ($_ =~ /$waddnstr/ && $1 eq $winaddr) {
66 $waddnstr_chars .= $2;
71 $winaddstr = &transaddr($winaddr);
72 print "RUN of waddnstr()s: $winaddr, \"$waddnstr_chars\"\n";
76 # More transformations can go here
78 # Repeated runs of anything
79 $anyline = &transaddr($_);
82 if (&transaddr($_) eq $anyline) {
88 if ($repeatcount > 1) {
89 print "${repeatcount} REPEATS OF $anyline";
98 # tracemunch ends here