drd/tests: Add the "dlopen" test program
[valgrind.git] / gdbserver_tests / filter_gdb
blob7177720017b7a416448fb5b3c217dda511ec28d7
1 #! /bin/sh
3 # filter the output of gdb.
5 dir=`dirname $0`
7 $dir/filter_stderr |
9 # Anonymise addresses
10 $dir/../tests/filter_addresses |
12 # memcheck stuff
13 $dir/filter_memcheck_monitor "$@" |
15 # memcheck filter might leave some "..." lines, we are not interested
16 sed -e '/^\ \ \ \ \.\.\.$/d' |
18 # Anonymise or remove :
19 # delete the initial lines between the launch of vgdb and the
20 # output of the echo command telling it is launched.
21 # This removes a whole lot of uninteresting lines varying
22 # with OS/glibc/gdb dep
23 # then have a general way to delete uninteresting and vayring
24 # lines.
25 # suppress lines telling file _exit.c does not exist
26 # initial tty control character sent by gdb 7.0
27 # remove missing debuginfos
28 # vgdb message
29 # pid numbers
30 # Thread numbers
31 # delete thread switches
32 # info threads output (e.g. which thread is running and syscall)
33 # delete Reading symbols file lines
34 # delete Loaded symbols file lines
35 # delete language switch messages.
36 # remove gdb prompts.
37 # remove gdb continuation prompts.
38 # remove gdb done prompts.
39 # a 'general' system calls stack trace part
40 # a more specialised system call select stack trace part
41 # (on 32 bits, we have an int_80, on 64 bits, directly select)
42 # and yet another (gdb 7.0 way) to get a system call
43 # and yet another (gdb 7.0 arm way) to get a system call
44 # and cleanup some lines for a system call (on ubuntu 10 64 bits)
45 # (pay attention : there are tab characters there in)
46 # + yet another way to get a select system call
47 # and yet another (Solaris way) to get a poll system call
48 # (on 32 bits, we have /lib/libc.so.*, on 64 bits, /lib/64/libc.so.*)
49 # which registers can't be modified
50 # special transform for arm/ppc watchpoints which have an additional address
51 # at the beginning
52 # SIGFPE backtrace is varying so much that we just remove all lines
53 # after the signal trapping using an expr in this sed, followed by another sed.
54 # transform info thread of 7.3 into the layout of 7.2 and before.
55 # delete lines telling that some memory can't be accessed: this is
56 # a.o. produced by gdb 7.2 on arm (same with standard gdbserver)
57 # delete empty lines (the last line (only made of prompts) sometimes
58 # finishes with a new line, sometimes not ???).
59 # 'exited with code' and 'exited normally' are printed slightly
60 # differently between gdb versions, normalize to "Program exited...".
61 # for hgtls the breakpoint p=... address might show var location.
62 # gdb might also try to show the "entry value" p=p@entry=0x...
63 # Some gdb versions don't show the source line:number after switching
64 # threads in #0 0x........ in do_burn ().
65 # Newer gdb say Thread .... hit Breakpoint, we expect just Breakpoint.
66 # We expect "Program received" instead of "Thread .... received"
67 # Ordering of ' Thread .... (tid .' might differ between gdb version,
68 # so remove all such lines except the "current" one (starts with '*').
69 sed -e '/Remote debugging using/,/vgdb launched process attached/d' \
70 -e '/filter_gdb BEGIN drop/,/filter_gdb END drop/d' \
71 -e 's/^\e\[?1034hReading symbols/Reading symbols/' \
72 -e '/^Missing separate debuginfo/d' \
73 -e '/\/_exit.c: No such file or directory/d' \
74 -e '/^Try: zypper install -C/d' \
75 -e 's/\(relaying data between gdb and process \)[0-9][0-9]*/\1..../' \
76 -e 's/pid [0-9][0-9]*/pid ..../g' \
77 -e 's/Thread [0-9][0-9]*/Thread ..../g' \
78 -e '/\[Switching to Thread ....\]/d' \
79 -e 's/\(\[Switching to thread [1234] (Thread ....)\]\)#0/\1\n#0/' \
80 -e 's/^\([ \* ] [0-9] Thread .... (tid [0-9] VgTs_WaitSys) 0x........ in\).*$/\1 syscall .../' \
81 -e 's/^Thread .... hit Breakpoint /Breakpoint /' \
82 -e 's/^Thread .... received /Program received /' \
83 -e 's/#[0-9]\( 0x........ in sleeper_or_burner\)/#.\1/' \
84 -e 's/\(#0 0x........ in do_burn ()\) at sleepers.c:41/\1/' \
85 -e '/^Reading symbols from .*\.\.\.done\./d' \
86 -e '/^Loaded symbols for .*$/d' \
87 -e '/^Current language.*/d' \
88 -e '/^The current source language is.*/d' \
89 -e 's/^.*\( exited with code [0-9]\+\).$/Program\1\./g' \
90 -e 's/^.*\( exited normally\).$/Program\1\./g' \
91 -e 's/(gdb) //g' \
92 -e 's/^>[> ]*//' \
93 -e '/^done\.$/d' \
94 -e 's/in _dl_sysinfo_int80 () from \/lib\/ld-linux.so.*/in syscall .../' \
95 -e 's/in kill ().*$/in syscall .../' \
96 -e 's/in .*kill ().*$/in syscall .../' \
97 -e 's/in _dl_sysinfo_int80 ()/in syscall .../' \
98 -e '/^ from \/lib\/ld-linux.so.*$/d' \
99 -e 's/\(0x........\) in ?? () from \/lib.*$/\1 in syscall .../' \
100 -e 's/\(0x........\) in ?? ()$/\1 in syscall .../' \
101 -e 's/in \(.__\)\{0,1\}select () from \/.*$/in syscall .../' \
102 -e '/^ from \/lib\/libc.so.*$/d' \
103 -e '/^ from \/lib64\/libc.so.*$/d' \
104 -e '/^ from \/lib64\/.*\/libc.so.*$/d' \
105 -e 's/in select ()$/in syscall .../' \
106 -e 's/in \.__select ()$/in syscall .../' \
107 -e 's/in select () at \.\.\/sysdeps\/unix\/syscall-template\.S.*$/in syscall .../' \
108 -e '/^[ ]*at \.\.\/sysdeps\/unix\/syscall-template\.S/d' \
109 -e '/^[ ]*in \.\.\/sysdeps\/unix\/syscall-template\.S/d' \
110 -e '/^[1-9][0-9]*[ ]*\.\.\/sysdeps\/unix\/syscall-template\.S/d' \
111 -e '/^[1-9][0-9]*[ ]in *\.\.\/sysdeps\/unix\/syscall-template\.S/d' \
112 -e '/^[1-9][0-9]*[ ]T_PSEUDO (SYSCALL_SYMBOL, SYSCALL_NAME, SYSCALL_NARGS)/d' \
113 -e 's/in __pollsys () from \/.*$/in syscall .../' \
114 -e '/^ from \/lib\/64\/libc.so.*$/d' \
115 -e 's/\(Could not write register \)".*"/\1 "xxx"/' \
116 -e 's/\(ERROR changing register \).*$/\1 xxx regno y/' \
117 -e 's/0x........ in \(main (argc=1, argv=0x........) at watchpoints.c:[24][3689]\)/\1/' \
118 -e 's/0x........ in \(main () at clean_after_fork.c:34\)/\1/' \
119 -e 's/\(^.*signal SIGFPE.*$\)/\1\nafter trap SIGFPE/' \
120 -e 's/p=p@entry=0x/p=0x/' \
121 -e 's/\(^Breakpoint 1, tls_ptr (p=0x........\) <tests[0-9+]*>\() at tls.c:55\)/\1\2/' \
122 -e '/Id Target Id Frame/d' \
123 -e 's/^\([ \*] [1234] \) *Thread /\1Thread /' \
124 -e 's/^ [0-9] Thread .... (tid [0-9] .*$//' \
125 -e 's/VgTs_WaitSys) 0x/VgTs_WaitSys) 0x/' \
126 -e '/Cannot access memory at address 0x......../d' \
127 -e '/\[New Thread/d' \
128 -e '/^$/d' |
130 # remove all the lines telling where the SIGFPE was trapped.
131 sed -e '/after trap SIGFPE/,/after continue SIGFPE/d' |
133 # join together two lines that gdb 7.1 splits in two (???)
134 # (in a separate sed, as the below influences the behaviour of the other expressions)
135 sed -e :a -e '$!N;s/\n at sleepers.c:39/ at sleepers.c:39/;ta' -e 'P;D'