File: filter_stderr_solaris

package info (click to toggle)
valgrind 1%3A3.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 (55 lines) | stat: -rwxr-xr-x 2,288 bytes parent folder | download | duplicates (7)
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
#!/usr/bin/perl

# Replace stack frame for a thread created by pthread_create():
#     by 0x........: _thrp_setup (in /lib/libc.so.1)
# with a stack frame expected on Linux:
#     by 0x........: start_thread (pthread_create.c:123)
# It will be further reduced and mangled by the main filter_stderr script.
# This needs to be done first.
s/_thrp_setup \(in .*libc.*\)/start_thread \(pthread_create.c:123\)/g;

# We need to filter out the Solaris libc's stack frame which looks like:
#     by 0x........: pthread_mutex_init (in /...libc...)
# to be consistent with the expected output of test cases.
#
# Stack frames for synchronization functions are missing on Linux because
# of optimalization. 
# 
s/.*\(in \/...libc...\)\R//m;

# We need to replace Solaris threading and sychronization function
# names with POSIX ones for drd_pthread_intercepts.c stack frame:
#     by 0x........: cond_init (drd_pthread_intercepts.c:123)
# See also comments in drd_pthread_intercepts.c.
my %regex = (
    'thr_create'     => 'pthread_create',
    'thr_join'       => 'pthread_join',
    'mutex_init'     => 'pthread_mutex_init',
    'mutex_destroy'  => 'pthread_mutex_destroy',
    'mutex_lock'     => 'pthread_mutex_lock',
    'mutex_trylock'  => 'pthread_mutex_trylock',
    'mutex_unlock'   => 'pthread_mutex_unlock',
    'cond_init'      => 'pthread_cond_init',
    'cond_destroy'   => 'pthread_cond_destroy',
    'cond_wait'      => 'pthread_cond_wait',
    'cond_timedwait' => 'pthread_cond_timedwait',
    'cond_signal'    => 'pthread_cond_signal',
    'cond_broadcast' => 'pthread_cond_broadcast',
    'sema_init'      => 'sem_init',
    'sema_destroy'   => 'sem_destroy',
    'sema_wait'      => 'sem_wait',
    'sema_trywait'   => 'sem_trywait',
    'sema_timedwait' => 'sem_timedwait',
    'sema_post'      => 'sem_post',
    'rwlock_init'    => 'pthread_rwlock_init',
    'rwlock_destroy' => 'pthread_rwlock_destroy',
    'rw_rdlock'      => 'pthread_rwlock_rdlock',
    'rw_wrlock'      => 'pthread_rwlock_wrlock',
    'rw_tryrdlock'   => 'pthread_rwlock_tryrdlock',
    'rw_trywrlock'   => 'pthread_rwlock_trywrlock',
    'rw_unlock'      => 'pthread_rwlock_unlock'
);
my $check = join "|", keys %regex;
if (! /: pthread_/) {
    s/($check)(.*drd_pthread_intercepts.c)/$regex{$1}$2/g;
}