File: filter_stderr_solaris

package info (click to toggle)
valgrind 1%3A3.14.0-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 156,980 kB
  • sloc: ansic: 728,128; exp: 26,134; xml: 22,268; cpp: 7,638; asm: 7,312; makefile: 6,102; perl: 5,910; sh: 5,717
file content (55 lines) | stat: -rwxr-xr-x 2,288 bytes parent folder | download | duplicates (5)
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;
}