File: filter_fdleak

package info (click to toggle)
valgrind 1:3.12.0~svn20160714-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 120,428 kB
  • ctags: 70,855
  • sloc: ansic: 674,645; exp: 26,134; xml: 21,574; asm: 7,570; cpp: 7,567; makefile: 7,380; sh: 6,188; perl: 5,855; haskell: 195
file content (27 lines) | stat: -rwxr-xr-x 1,361 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#! /bin/sh

dir=`dirname $0`

./filter_stderr |

perl -p -e 's/^Open AF_UNIX socket [0-9]*: <unknown>/Open AF_UNIX socket ...: <unknown>/' |
perl -p -e 's/^Open (AF_UNIX socket|file descriptor) [0-9]*: \/dev\/null/Open $1 ...: \/dev\/null/' |
# Solaris-specific, translate /devices/pseudo/mm@0:null to /dev/null
perl -p -e 's/^Open (AF_UNIX socket|file descriptor) [0-9]*: \/devices\/pseudo\/mm\@0:null/Open $1 ...: \/dev\/null/' |
# Nb: on Darwin, /tmp is a symlink to /private/tmp, so sometimes it's
# necessary to filter out the "/private" part.
perl -p -e 's/^Open (AF_UNIX socket|file descriptor) [0-9]*: (\/private)?\/tmp\/(sock|data1|data2|file)\.[0-9]*/Open $1 ...: \/tmp\/$3/' |
perl -p -e 's/^Open file descriptor [0-9]*: .*/Open file descriptor ...: .../' |
perl -p -e 's/^Open file descriptor [0-9]*:$/Open file descriptor ...:/' |
perl -p -e 's/127.0.0.1:[0-9]*/127.0.0.1:.../g' |

# Stack traces showing where fds were created have lots of variations:
# different numbers of entries, line numbers or not depending on whether
# libc debug info is present, 'main' vs. '(below main)', etc.  
#
# So we just cut out the entire stack trace.  It's coarse but effective;
# before we did this we had a plethora of expected outputs, with only
# painfully minor variations between them.
perl -p -0 -e 's/(Open[^\n]*\n)(   (at|by)[^\n]*\n)+/$1   ...\n/gs'