| 1 |
#!/usr/bin/env perl |
| 2 |
|
| 3 |
use warnings; |
| 4 |
use strict; |
| 5 |
use feature 'say'; |
| 6 |
|
| 7 |
# Replace pthread_create with pthread_create@* which is expected on Linux |
| 8 |
s/pthread_create \(hg_intercepts.c:/pthread_create@* \(hg_intercepts.c:/g; |
| 9 |
|
| 10 |
# ditto pthread_cond_destroy |
| 11 |
s/pthread_cond_destroy \(hg_intercepts.c:/pthread_cond_destroy@* \(hg_intercepts.c:/g; |
| 12 |
|
| 13 |
# ditto pthread_cond_timedwait |
| 14 |
s/pthread_cond_timedwait \(hg_intercepts.c:/pthread_cond_timedwait@* \(hg_intercepts.c:/g; |
| 15 |
|
| 16 |
my @regex = ( |
| 17 |
[" by 0x\.{8}: pthread_create_WRK \(hg_intercepts.c:[0-9]{3,4}\)", |
| 18 |
" by 0x.{8}: pthread_create\@\* \(hg_intercepts.c:[0-9]{3,4}\)", |
| 19 |
" by 0x........: pthread_create@* \(hg_intercepts.c:...\)" |
| 20 |
] |
| 21 |
); |
| 22 |
|
| 23 |
foreach my $item (@regex) { |
| 24 |
my $just_saw_first_line; |
| 25 |
|
| 26 |
while (<>) { |
| 27 |
|
| 28 |
if ($just_saw_first_line and not /^$item->[1]/) { |
| 29 |
say $item->[2]; |
| 30 |
} |
| 31 |
|
| 32 |
$just_saw_first_line = /^$item->[0]/; |
| 33 |
print |
| 34 |
} |
| 35 |
} |
| 36 |
|
| 37 |
# because of optimization, there's one less line in the callstack when VG is built with clang |
| 38 |
# not this is a host difference, not a client one |
| 39 |
#s/(0x........: pthread_create_WRK \(hg_intercepts.c:433\)\n)(?! by 0x........: pthread_create@\* \(hg_intercepts.c:472\))/$1 by 0x........: pthread_create@* (hg_intercepts.c:...)\n/; |
| 40 |
#s/$ by 0x\.{8}: pthread_create_WRK \(hg_intercepts.c:[0-9]{3,4}\).(?! by 0x\.{8}: pthread_create@\* \(hg_intercepts.c:[0-9]{3,4}\))^/ by 0x........: pthread_create_WRK \(hg_intercepts.c:...\)\n by 0x........: pthread_create@* \(hg_intercepts.c:...\)\n/s; |
| 41 |
|
| 42 |
#s/0x\.{8}: pthread_destroy_WRK \(hg_intercepts.c:[0-9]+\).(?! by 0x[0-9A-F]+: pthread_destroy@\* \(hg_intercepts.c:[0-9]+\))/0x........: pthread_destroy_WRK \(hg_intercepts.c:...\)\n by 0x........: pthread_destroy@* \(hg_intercepts.c:...\)\n/gms; |
| 43 |
|
| 44 |
#s/0x\.{8}: pthread_cond_timedwait_WRK \(hg_intercepts.c:\.{3,4}\).(?! by 0x[0-9A-F]+: pthread_cond_timedwait@\* \(hg_intercepts.c:\.{3,4}\))/0x........: pthread_cond_timedwait_WRK \(hg_intercepts.c:...\)\n by 0x........: pthread_cond_timedwait@* \(hg_intercepts.c:...\)\n/gms; |
| 45 |
|
| 46 |
#s/0x\.{8}: mutex_lock_WRK \(hg_intercepts.c:[0-9]+\).(?! by 0x\.{8}: pthread_mutex_lock \(hg_intercepts.c:[0-9]+\))/0x........: mutex_lock_WRK \(hg_intercepts.c:...\)\n by 0x........: pthread_mutex_lock \(hg_intercepts.c:...\)\n/gms; |
| 47 |
|
| 48 |
#s/0x\.{8}: mutex_unlock_WRK \(hg_intercepts.c:.[0-9]+\).(?! by 0x\.{8}: pthread_mutex_unlock \(hg_intercepts.c:.[0-9]+\))/0x........: mutex_unlock_WRK \(hg_intercepts.c:...\)\n by 0x........: pthread_mutex_unlock \(hg_intercepts.c:...\)\n/gms; |
| 49 |
|
| 50 |
#s/0x\.{8}: pthread_cond_wait_WRK \(hg_intercepts.c:.[0-9]+\).(?! by 0x\.{8}: pthread_cond_wait \(hg_intercepts.c:.[0-9]+\))/0x........: pthread_cond_wait_WRK (hg_intercepts.c:...)\n by 0x........: pthread_cond_wait (hg_intercepts.c:...)\n/gms; |
| 51 |
|
| 52 |
#s/0x\.{8}: pthread_cond_signal_WRK \(hg_intercepts.c:[0-9]+\).(?! by 0x\.{8}: pthread_cond_signal \(hg_intercepts.c:....\))/0x........: pthread_cond_signal_WRK (hg_intercepts.c:...)\n by 0x........: pthread_cond_signal (hg_intercepts.c:...)\n/gms; |
| 53 |
|
| 54 |
#s/0x\.{8}: sem_init_WRK \(hg_intercepts.c:.[0-9]+\).(?! by 0x\.{8}: sem_init \(hg_intercepts.c:.[0-9]+\))/0x........: sem_init_WRK (hg_intercepts.c:...)\n by 0x........: sem_init (hg_intercepts.c:...)\n/gms; |
| 55 |
|
| 56 |
#s/0x\.{8}: sem_wait_WRK \(hg_intercepts.c:[0-9]+\).(?! by 0x\.{8}: sem_wait \(hg_intercepts.c:....\))/0x........: sem_wait_WRK (hg_intercepts.c:...)\n by 0x........: sem_wait (hg_intercepts.c:...)\n/gms; |
| 57 |
|
| 58 |
#s/0x\.{8}: sem_post_WRK \(hg_intercepts.c:[0-9]+\).(?! by 0x\.{8}: sem_post \(hg_intercepts.c:.[0-9]+\))/0x........: sem_post_WRK (hg_intercepts.c:...)\n by 0x........: sem_post (hg_intercepts.c:...)\n/gms; |
| 59 |
|
| 60 |
#s/0x\.{8}: sem_destroy_WRK \(hg_intercepts.c:[0-9]+\).(?! by 0x\.{8}: sem_destroy \(hg_intercepts.c:....\))/0x........: sem_destroy_WRK (hg_intercepts.c:...)\n by 0x........: sem_destroy (hg_intercepts.c:...)\n/gms; |