blob: df9479f6dab5da192202348711478870148e762c [file] [log] [blame]
sewardj3b290482011-05-06 21:02:55 +00001#! /bin/sh
2
3# filter the output of gdb.
4
5dir=`dirname $0`
6
7$dir/filter_stderr |
8
9# Anonymise addresses
10$dir/../tests/filter_addresses |
11
12# memcheck stuff
philippea22f59d2012-01-26 23:13:52 +000013$dir/filter_memcheck_monitor "$@" |
sewardj3b290482011-05-06 21:02:55 +000014
philipped6a98092012-10-14 18:16:41 +000015# memcheck filter might leave some "..." lines, we are not interested
16sed -e '/^\ \ \ \ \.\.\.$/d' |
sewardj3b290482011-05-06 21:02:55 +000017
18# Anonymise or remove :
sewardjeefeeb72011-05-10 11:01:07 +000019# 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
philipped7194532014-04-24 21:52:02 +000023# then have a general way to delete uninteresting and vayring
24# lines.
philippea460df82014-04-26 20:40:41 +000025# suppress lines telling file _exit.c does not exist
sewardj3b290482011-05-06 21:02:55 +000026# 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
sewardjeefeeb72011-05-10 11:01:07 +000035# delete language switch messages.
sewardj3b290482011-05-06 21:02:55 +000036# 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
sewardj8eb8bab2015-07-21 14:44:28 +000047# 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.*)
sewardj3b290482011-05-06 21:02:55 +000049# which registers can't be modified
50# special transform for arm/ppc watchpoints which have an additional address
51# at the beginning
sewardj76291802011-05-31 07:09:06 +000052# 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.
sewardj6b7357b2011-05-27 13:23:44 +000054# transform info thread of 7.3 into the layout of 7.2 and before.
sewardj3b290482011-05-06 21:02:55 +000055# 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 ???).
philippe0447bbd2012-10-17 21:32:03 +000059# 'exited with code' and 'exited normally' are printed slightly
60# differently between gdb versions, normalize to "Program exited...".
mjw7697dd12014-08-22 10:14:28 +000061# for hgtls the breakpoint p=... address might show var location.
mjwacb39292014-08-28 21:42:45 +000062# gdb might also try to show the "entry value" p=p@entry=0x...
mjwd704f732014-09-02 10:16:42 +000063# Some gdb versions don't show the source line:number after switching
64# threads in #0 0x........ in do_burn ().
sewardjd142f992011-05-17 17:15:07 +000065sed -e '/Remote debugging using/,/vgdb launched process attached/d' \
philipped7194532014-04-24 21:52:02 +000066 -e '/filter_gdb BEGIN drop/,/filter_gdb END drop/d' \
sewardjeefeeb72011-05-10 11:01:07 +000067 -e 's/^\[?1034hReading symbols/Reading symbols/' \
sewardjd142f992011-05-17 17:15:07 +000068 -e '/^Missing separate debuginfo/d' \
philippea460df82014-04-26 20:40:41 +000069 -e '/\/_exit.c: No such file or directory/d' \
sewardjd142f992011-05-17 17:15:07 +000070 -e '/^Try: zypper install -C/d' \
sewardj3b290482011-05-06 21:02:55 +000071 -e 's/\(relaying data between gdb and process \)[0-9][0-9]*/\1..../' \
72 -e 's/pid [0-9][0-9]*/pid ..../g' \
73 -e 's/Thread [0-9][0-9]*/Thread ..../g' \
74 -e '/\[Switching to Thread ....\]/d' \
sewardj6b7357b2011-05-27 13:23:44 +000075 -e 's/\(\[Switching to thread [1234] (Thread ....)\]\)#0/\1\n#0/' \
sewardj3b290482011-05-06 21:02:55 +000076 -e 's/^\([ \* ] [0-9] Thread .... (tid [0-9] VgTs_WaitSys) 0x........ in\).*$/\1 syscall .../' \
77 -e 's/#[0-9]\( 0x........ in sleeper_or_burner\)/#.\1/' \
sewardj8eb8bab2015-07-21 14:44:28 +000078 -e 's/\(#0 0x........ in do_burn ()\) at sleepers.c:41/\1/' \
sewardj3b290482011-05-06 21:02:55 +000079 -e '/^Reading symbols from .*\.\.\.done\./d' \
80 -e '/^Loaded symbols for .*$/d' \
sewardjeefeeb72011-05-10 11:01:07 +000081 -e '/^Current language.*/d' \
82 -e '/^The current source language is.*/d' \
philippea460df82014-04-26 20:40:41 +000083 -e 's/^.*\( exited with code [0-9]\+\).$/Program\1\./g' \
84 -e 's/^.*\( exited normally\).$/Program\1\./g' \
sewardj3b290482011-05-06 21:02:55 +000085 -e 's/(gdb) //g' \
86 -e 's/^>[> ]*//' \
87 -e '/^done\.$/d' \
88 -e 's/in _dl_sysinfo_int80 () from \/lib\/ld-linux.so.*/in syscall .../' \
sewardjb2572b52011-06-26 09:36:38 +000089 -e 's/in kill ().*$/in syscall .../' \
florian71fe57f2011-10-20 22:49:58 +000090 -e 's/in .*kill ().*$/in syscall .../' \
sewardj3b290482011-05-06 21:02:55 +000091 -e 's/in _dl_sysinfo_int80 ()/in syscall .../' \
92 -e '/^ from \/lib\/ld-linux.so.*$/d' \
sewardjd142f992011-05-17 17:15:07 +000093 -e 's/\(0x........\) in ?? () from \/lib.*$/\1 in syscall .../' \
sewardjeefeeb72011-05-10 11:01:07 +000094 -e 's/\(0x........\) in ?? ()$/\1 in syscall .../' \
sewardj3b290482011-05-06 21:02:55 +000095 -e 's/in \(.__\)\{0,1\}select () from \/.*$/in syscall .../' \
96 -e '/^ from \/lib\/libc.so.*$/d' \
sewardjeefeeb72011-05-10 11:01:07 +000097 -e '/^ from \/lib64\/libc.so.*$/d' \
philippe2c891072014-04-23 21:27:07 +000098 -e '/^ from \/lib64\/.*\/libc.so.*$/d' \
sewardj3b290482011-05-06 21:02:55 +000099 -e 's/in select ()$/in syscall .../' \
sewardjeefeeb72011-05-10 11:01:07 +0000100 -e 's/in \.__select ()$/in syscall .../' \
sewardj3b290482011-05-06 21:02:55 +0000101 -e 's/in select () at \.\.\/sysdeps\/unix\/syscall-template\.S.*$/in syscall .../' \
102 -e '/^[ ]*at \.\.\/sysdeps\/unix\/syscall-template\.S/d' \
103 -e '/^[ ]*in \.\.\/sysdeps\/unix\/syscall-template\.S/d' \
104 -e '/^[1-9][0-9]*[ ]*\.\.\/sysdeps\/unix\/syscall-template\.S/d' \
105 -e '/^[1-9][0-9]*[ ]in *\.\.\/sysdeps\/unix\/syscall-template\.S/d' \
philippea17ec012012-09-24 21:12:41 +0000106 -e '/^[1-9][0-9]*[ ]T_PSEUDO (SYSCALL_SYMBOL, SYSCALL_NAME, SYSCALL_NARGS)/d' \
sewardj8eb8bab2015-07-21 14:44:28 +0000107 -e 's/in __pollsys () from \/.*$/in syscall .../' \
108 -e '/^ from \/lib\/64\/libc.so.*$/d' \
sewardj3b290482011-05-06 21:02:55 +0000109 -e 's/\(Could not write register \)".*"/\1 "xxx"/' \
110 -e 's/\(ERROR changing register \).*$/\1 xxx regno y/' \
111 -e 's/0x........ in \(main (argc=1, argv=0x........) at watchpoints.c:[24][3689]\)/\1/' \
sewardjf5194b32011-07-04 22:00:41 +0000112 -e 's/0x........ in \(main () at clean_after_fork.c:34\)/\1/' \
sewardj76291802011-05-31 07:09:06 +0000113 -e 's/\(^.*signal SIGFPE.*$\)/\1\nafter trap SIGFPE/' \
mjwacb39292014-08-28 21:42:45 +0000114 -e 's/p=p@entry=0x/p=0x/' \
mjw7697dd12014-08-22 10:14:28 +0000115 -e 's/\(^Breakpoint 1, tls_ptr (p=0x........\) <tests[0-9+]*>\() at tls.c:55\)/\1\2/' \
sewardj6b7357b2011-05-27 13:23:44 +0000116 -e '/Id Target Id Frame/d' \
117 -e 's/^\([ \*] [1234] \) *Thread /\1Thread /' \
118 -e 's/VgTs_WaitSys) 0x/VgTs_WaitSys) 0x/' \
sewardj3b290482011-05-06 21:02:55 +0000119 -e '/Cannot access memory at address 0x......../d' \
philippe03f0fc12015-06-20 22:22:56 +0000120 -e '/\[New Thread/d' \
philippea460df82014-04-26 20:40:41 +0000121 -e '/^$/d' |
sewardj76291802011-05-31 07:09:06 +0000122
123# remove all the lines telling where the SIGFPE was trapped.
philippea460df82014-04-26 20:40:41 +0000124sed -e '/after trap SIGFPE/,/after continue SIGFPE/d' |
sewardj3b290482011-05-06 21:02:55 +0000125
126# join together two lines that gdb 7.1 splits in two (???)
127# (in a separate sed, as the below influences the behaviour of the other expressions)
sewardj76291802011-05-31 07:09:06 +0000128sed -e :a -e '$!N;s/\n at sleepers.c:39/ at sleepers.c:39/;ta' -e 'P;D'
sewardj3b290482011-05-06 21:02:55 +0000129