-
-
Notifications
You must be signed in to change notification settings - Fork 62
/
Copy pathfilter_libc
executable file
·56 lines (41 loc) · 1.9 KB
/
filter_libc
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
48
49
50
51
52
53
54
55
56
#!/usr/bin/env perl
use strict;
use warnings;
while (<>)
{
s/ __getsockname / getsockname /;
s/ __sigaction / sigaction /;
s/ __GI___/ __/;
s/ __([a-z]*)_nocancel / $1 /;
# "lib[S|s]ystem*" occurs on Darwin, "libsocket" on older Solaris/illumos.
s/\(in \/.*(libc|libSystem|libsystem|libsocket|libsys).*\)$/(in \/...libc...)/;
s/\(within \/.*(libc|libSystem|libsystem|libsocket).*\)$/(within \/...libc...)/;
# Filter out dynamic loader
s/ \(in \/.*ld-.*so\)$//;
# 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/start \(in \/usr\/lib\/system\/libdyld.dylib\)/(below main)/;
# libc on x86 FreeBSD
s#_start1 \(src/lib/csu/i386/crt1_c.c.*#(below main)#;
s#__libc_start1 \(in /...libc...\)#(below main)#;
# on Illumos
s#_start_crt \(in .*#(below main)#;
# filter out the exact libc-start.c:### line number. (ppc64*)
s/\(libc-start.c:[0-9]*\)$/(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\*(, unsigned(| int| long))?\)/$1...operator delete.../;
s/(at.*)__builtin_vec_delete/$1...operator delete[].../;
s/(at.*)operator delete\[\]\(void\*\)/$1...operator delete[].../;
# Some glibc versions complain about unexpected futex syscall errors.
# With or without newline (see sourceware PR20271).
next if /^The futex facility returned an unexpected error code.$/;
s/The futex facility returned an unexpected error code.//;
print;
}
exit 0;