filter_libc revision e739ac0589b4fb43561f801c4faba8c1b89f8680
1#! /usr/bin/perl -w 2 3use strict; 4 5my @libc_symbols = qw(__libc_start_main accept execve fcntl 6 getsockname poll readv recvmsg 7 socket socketpair syscall writev); 8 9my $libc_symbols = join("|", @libc_symbols); 10 11while (<>) 12{ 13 s/ __getsockname / getsockname /; 14 s/ __sigaction / sigaction /; 15 s/ __GI___/ __/; 16 s/ __([a-z]*)_nocancel / $1 /; 17 18 # "libSystem*" occurs on Darwin. 19 s/\(in \/.*(libc|libSystem).*\)$/(in \/...libc...)/; 20 s/\(within \/.*(libc|libSystem).*\)$/(within \/...libc...)/; 21 22 # Remove the filename -- on some platforms (eg. Linux) it will be in 23 # libc, on some (eg. Darwin) it will be in the main executable. 24 s/\(below main\) \(.+\)$/(below main)/; 25 26 s/($libc_symbols) \(.+\.[cS]:\d+\)$/$1 (in \/...libc...)/; 27 28 # Merge the different C++ operator variations. 29 s/(at.*)__builtin_new/$1...operator new.../; 30 s/(at.*)operator new\(unsigned(| int| long)\)/$1...operator new.../; 31 32 s/(at.*)__builtin_vec_new/$1...operator new.../; 33 s/(at.*)operator new\[\]\(unsigned(| int| long)\)/$1...operator new[].../; 34 35 s/(at.*)__builtin_delete/$1...operator delete.../; 36 s/(at.*)operator delete\(void\*\)/$1...operator delete.../; 37 38 s/(at.*)__builtin_vec_delete/$1...operator delete[].../; 39 s/(at.*)operator delete\[\]\(void\*\)/$1...operator delete[].../; 40 41 # Tidy up in cases where glibc (+ libdl + libpthread + ld) have 42 # been built with debugging information, hence source locs are present. 43 s/\((exit|_exit|brk|sbrk).c:[0-9]*\)/(in \/...libc...)/; 44 45 print; 46} 47 48exit 0; 49