readdwarf3: Skip units without addresses when looking for inlined functions
[valgrind.git] / gdbserver_tests / filter_gdb
blob4a5b5d7a5b4ccbb1239b9161c9fe53fb63c171ca
1 #! /bin/sh
3 # filter the output of gdb.
5 PATTERNFILE=$(mktemp filter_gdb.tmp.XXXXXXXXXX)
6 cat > $PATTERNFILE <<EOF
7 # delete the initial lines between the launch of vgdb and the
8 # output of the echo command telling it is launched.
9 # This removes a whole lot of uninteresting lines varying
10 # with OS/glibc/gdb dep
11 /Remote debugging using/,/vgdb launched process attached/d
13 # general way to delete uninteresting and varying lines.
14 /filter_gdb BEGIN drop/,/filter_gdb END drop/d
16 # initial tty control character sent by gdb 7.0
17 s/^\e\[?1034hReading symbols/Reading symbols/
19 # remove message about missing debuginfos
20 /^Missing separate debuginfo/d
22 # remove messages about not being able to download debuginfos
23 /^Download failed: /d
25 # suppress lines telling file _exit.c does not exist
26 /\/_exit.c: No such file or directory/d
28 # Remove some Suse package manager messages
29 /^Try: zypper install -C/d
31 # Remove vgdb message
32 /relaying data between gdb and process/d
34 # Anonymise pid numbers
35 s/pid [0-9][0-9]*/pid ..../g
37 # filter 'remote target killed' messages (produced by gdb >= 8.2)
38 /(Remote target) killed/d
40 # Anonymise Thread numbers
41 s/Thread [0-9][0-9]*/Thread ..../g
43 # delete thread switches
44 /\[Switching to Thread ....\]/d
46 # ??? Probably we had a 'Switching ' message in front of
47 # a frame line ?
48 s/\(\[Switching to thread [1234] (Thread ....)\]\)#0/\1\n#0/
50 # Anonymise info threads output (e.g. which thread is running and syscall)
51 s/^\([ \* ] [0-9] Thread .... (tid [0-9] VgTs_WaitSys) 0x........ in\).*$/\1 syscall .../
53 # Newer gdb say Thread .... hit Breakpoint, we expect just Breakpoint.
54 s/^Thread .... hit Breakpoint /Breakpoint /
56 # We expect "Program received" instead of "Thread .... received"
57 s/^Thread .... received /Program received /
59 s/#[0-9]\( 0x........ in sleeper_or_burner\)/#.\1/
61 # Some gdb versions don't show the source line:number after switching
62 # threads in #0 0x........ in do_burn ().
63 s/\(#0 0x........ in do_burn ()\) at sleepers.c:41/\1/
66 # delete Reading symbols file lines
67 # Note: The 'done.' in "Reading symbols from <exe>...done."
68 # is optional (bugzilla 406357).
69 /^Reading symbols from .*\.\.\.\(done\.\)\?/d
71 # delete Loaded symbols file lines
72 /^Loaded symbols for .*$/d
74 # delete language switch messages.
75 /^Current language.*/d
76 /^The current source language is.*/d
78 # 'exited with code' and 'exited normally' are printed slightly
79 # differently between gdb versions, normalize to "Program exited...".
80 s/^.*\( exited with code [0-9]\+\).$/Program\1\./g
81 s/^.*\( exited normally\).$/Program\1\./g
83 # remove gdb prompts.
84 s/(gdb) //g
86 # remove gdb continuation prompts.
87 s/^>[> ]*//
89 # remove gdb done prompts.
90 /^done\.$/d
92 # anonymise a 'general' system calls stack trace part
93 s/in _dl_sysinfo_int80 () from \/lib\/ld-linux.so.*/in syscall .../
95 # anonymise kill syscall.
96 s/in kill ().*$/in syscall .../
98 # anonymise syscall on ppc64 (bugzilla #284305)
99 s/in .*kill ().*$/in syscall .../
102 s/in _dl_sysinfo_int80 ()/in syscall .../
103 /^ from \/lib\/ld-linux.so.*$/d
104 s/\(0x........\) in ?? () from \/lib.*$/\1 in syscall .../
105 s/\(0x........\) in ?? ()$/\1 in syscall .../
107 # 4 expressions to cover glibc 2.27 way to do a select, such as
108 # * 1 Thread 5548 (tid 1 VgTs_WaitSys) 0x0000000004f6203f in __GI___select (
109 # nfds=0, readfds=0x0, writefds=0x0, exceptfds=0x0, timeout=0x30a0e0 <t>)
110 # at ../sysdeps/unix/sysv/linux/select.c:41
111 # If select.c sources are present, we can also get a line containing:
112 # return SYSCALL_CANCEL....
113 s/in __select .*/in syscall .../
114 s/in __select$/in syscall .../
115 /exceptfds/d
116 /sysv\/linux\/select\.c/d
117 /return SYSCALL_CANCEL /d
119 # a more specialised system call select stack trace part
120 # (on 32 bits, we have an int_80, on 64 bits, directly select)
121 s/in \(.__\)\{0,1\}select () from \/.*$/in syscall .../
123 /^ from \/lib\/libc.so.*$/d
124 /^ from \/lib64\/libc.so.*$/d
125 /^ from \/lib64\/.*\/libc.so.*$/d
127 # and yet another (gdb 7.0 way) to get a system call
128 s/in select ()$/in syscall .../
130 # and yet another (gdb 7.0 arm way) to get a system call
131 s/in \.__select ()$/in syscall .../
133 # + yet another way to get a select system call
134 s/in select () at \.\.\/sysdeps\/unix\/syscall-template\.S.*$/in syscall .../
136 # filter out names which starts with a "."
137 # such names are used for "function descriptors" on ppc64
138 # bugzilla 406561
139 s/in \.__select () at \.\.\/sysdeps\/unix\/syscall-template\.S.*$/in syscall .../
141 # cleanup some lines for a system call (on ubuntu 10 64 bits)
142 # (pay attention : there are tab characters there in)
143 /^[ ]*at \.\.\/sysdeps\/unix\/syscall-template\.S/d
144 /^[ ]*in \.\.\/sysdeps\/unix\/syscall-template\.S/d
146 /^[1-9][0-9]*[ ]*\.\.\/sysdeps\/unix\/syscall-template\.S/d
147 /^[1-9][0-9]*[ ]in *\.\.\/sysdeps\/unix\/syscall-template\.S/d
148 /^[1-9][0-9]*[ ]T_PSEUDO (SYSCALL_SYMBOL, SYSCALL_NAME, SYSCALL_NARGS)/d
150 # and yet another (Solaris way) to get a poll system call
151 # (on 32 bits, we have /lib/libc.so.*, on 64 bits, /lib/64/libc.so.*)
152 s/in __pollsys () from \/.*$/in syscall .../
153 /^ from \/lib\/64\/libc.so.*$/d
155 # which registers can't be modified
156 s/\(Could not write register \)".*"/\1 "xxx"/
157 s/\(ERROR changing register \).*$/\1 xxx regno y/
159 # special transform for arm/ppc watchpoints which have an additional address
160 # at the beginning
161 s/0x........ in \(main (argc=1, argv=0x........) at watchpoints.c:[24][3689]\)/\1/
163 s/0x........ in \(main () at clean_after_fork.c:34\)/\1/
165 # SIGFPE backtrace is varying so much that we just remove all lines
166 # after the signal trapping using an expr in this sed, followed by another sed.
167 s/\(^.*signal SIGFPE.*$\)/\1\nafter trap SIGFPE/
169 # gdb might also try to show the "entry value" p=p@entry=0x...
170 s/p=p@entry=0x/p=0x/
172 # for hgtls the breakpoint p=... address might show var location.
173 s/\(^Breakpoint 1, tls_ptr (p=0x........\) <tests[0-9+]*>\() at tls.c:55\)/\1\2/
175 /Id Target Id *Frame/d
176 s/^\([ \*] [1234] \) *Thread /\1Thread /
178 # Ordering of ' Thread .... (tid .' might differ between gdb version,
179 # so remove all such lines except the "current" one (starts with '*').
180 s/^ [0-9] Thread .... (tid [0-9] .*$//
182 # transform info thread of 7.3 into the layout of 7.2 and before.
183 s/VgTs_WaitSys) 0x/VgTs_WaitSys) 0x/
185 # delete lines telling that some memory can't be accessed: this is
186 # a.o. produced by gdb 7.2 on arm (same with standard gdbserver)
187 /Cannot access memory at address 0x......../d
189 # Filter 'New thread' lines
190 # gdb 7.9 reports new threads at different moment than the previous versions.
191 # Filter these new threads lines so as to not be dependent on this
192 # gdb aspect.
193 /\[New Thread/d
195 # 406355
196 # adjust filtering for the new gdb output
197 # mcsigpass and mcsignopass tests fails due to the slightly different
198 # gdb output. Filter the tests output to make it the same for different
199 # gdb version. Change mcsigpass and mcsignopass .exp to fit filtered
200 # .out.
201 s/^0x........ in \(\w\+ (\)/\1/
203 # delete empty lines (the last line (only made of prompts) sometimes
204 # finishes with a new line, sometimes not ???).
205 /^$/d
210 dir=`dirname $0`
212 $dir/filter_stderr |
214 # Anonymise addresses
215 $dir/../tests/filter_addresses |
217 # memcheck stuff
218 $dir/filter_memcheck_monitor "$@" |
220 # memcheck filter might leave some "..." lines, we are not interested
221 sed -e '/^\ \ \ \ \.\.\.$/d' |
223 # Anonymise or remove, using the big list of PATTERN prepared above
224 sed -f $PATTERNFILE |
226 # remove all the lines telling where the SIGFPE was trapped.
227 sed -e '/after trap SIGFPE/,/after continue SIGFPE/d' |
229 # join together two lines that gdb 7.1 splits in two (???)
230 # (in a separate sed, as the below influences the behaviour of the other expressions)
231 sed -e :a -e '$!N;s/\n at sleepers.c:39/ at sleepers.c:39/;ta' -e 'P;D'
233 rm $PATTERNFILE