summaryrefslogtreecommitdiff
path: root/tests/filter_libc
blob: a89fb89123a148b91c421eaba9024aba4b1e3583 (plain)
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#! /usr/bin/perl -w

use strict;

my @libc_symbols = qw(__libc_start_main accept execve fcntl
                      getsockname poll readv recvmsg
                      socket socketpair syscall writev);

my $libc_symbols = join("|", @libc_symbols);

while (<>)
{
    s/ __getsockname / getsockname /;
    s/ __sigaction / sigaction /;
    s/ __GI___/ __/;
    s/ __([a-z]*)_nocancel / $1 /;

    s/\(in \/.*libc.*\)$/(in \/...libc...)/;
    s/\(within \/.*libc.*\)$/(within \/...libc...)/;

    # Remove the filename -- on some platforms (eg. Linux) it will be in
    # libc, on some (eg. Darwin) it will be in the main executable.
    s/\(below main\) \(.+\)$/(below main)/;

    s/($libc_symbols) \(.+\.[cS]:\d+\)$/$1 (in \/...libc...)/;

    # Merge the different C++ operator variations.
    s/(at.*)__builtin_new/$1...operator new.../;
    s/(at.*)operator new\(unsigned(| int| long)\)/$1...operator new.../;

    s/(at.*)__builtin_vec_new/$1...operator new.../;
    s/(at.*)operator new\[\]\(unsigned(| int| long)\)/$1...operator new[].../;

    s/(at.*)__builtin_delete/$1...operator delete.../;
    s/(at.*)operator delete\(void\*\)/$1...operator delete.../;

    s/(at.*)__builtin_vec_delete/$1...operator delete[].../;
    s/(at.*)operator delete\[\]\(void\*\)/$1...operator delete[].../;

    # Tidy up in cases where glibc (+ libdl + libpthread + ld) have
    # been built with debugging information, hence source locs are present.
    s/\((exit|_exit|brk|sbrk).c:[0-9]*\)/(in \/...libc...)/;

    print;
}

exit 0;