add support for Zaptel versions that contain the new transcoder interface
[asterisk-bristuff.git] / doc / backtrace.txt
blobce39b0a3e511f5973f0be3f2c1b75ee772a001dc
1 This document is intended to provide information on how to obtain the
2 backtraces required on the asterisk bug tracker, available at
3 http://bugs.digium.com. The information is required by developers to
4 help fix problem with bugs of any kind. Backtraces provide information
5 about what was wrong when a program crashed; in our case,
6 Asterisk. There are two kind of backtraces (aka 'bt') which are
7 useful: bt and bt full.
9 First of all, when you start Asterisk, you MUST start it with option
10 -g. This tells Asterisk to produce a core file if it crashes.
12 If you start Asterisk with the safe_asterisk script, it automatically
13 starts using the option -g.
15 If you're not sure if Asterisk is running with the -g option, type the
16 following command in your shell:
18 debian:/tmp# ps aux | grep asterisk
19 root     17832  0.0  1.2   2348   788 pts/1    S    Aug12   0:00 /bin/sh /usr/sbin/safe_asterisk
20 root     26686  0.0  2.8  15544  1744 pts/1    S    Aug13   0:02 asterisk -vvvg -c
21 [...]
23 The interesting information is located in the last column.
25 Second, your copy of Asterisk must have been built without
26 optimization or the backtrace will be (nearly) unusable. This can be
27 done by selecting the 'DONT_OPTIMIZE' option in the Compiler Flags
28 submenu in the 'make menuselect' tree before building Asterisk.
30 After Asterisk crashes, a core file will be "dumped" in your /tmp/
31 directory. To make sure it's really there, you can just type the
32 following command in your shell:
34 debian:/tmp# ls -l /tmp/core.*
35 -rw-------  1 root root 10592256 Aug 12 19:40 /tmp/core.26252
36 -rw-------  1 root root  9924608 Aug 12 20:12 /tmp/core.26340
37 -rw-------  1 root root 10862592 Aug 12 20:14 /tmp/core.26374
38 -rw-------  1 root root  9105408 Aug 12 20:19 /tmp/core.26426
39 -rw-------  1 root root  9441280 Aug 12 20:20 /tmp/core.26462
40 -rw-------  1 root root  8331264 Aug 13 00:32 /tmp/core.26647
41 debian:/tmp#
43 In the event that there are multiple core files present (as in the
44 above example), it is important to look at the file timestamps in
45 order to determine which one you really intend to look at.
47 Now that we've verified the core file has been written to disk, the
48 final part is to extract 'bt' from the core file. Core files are
49 pretty big, don't be scared, it's normal.
51 *** NOTE: Don't attach core files on the bug tracker, we only need the bt and bt full. ***
53 For extraction, we use a really nice tool, called gdb. To verify that
54 you have gdb installed on your system:
56 debian:/tmp# gdb -v
57 GNU gdb 6.3-debian
58 Copyright 2004 Free Software Foundation, Inc.
59 GDB is free software, covered by the GNU General Public License, and you are
60 welcome to change it and/or distribute copies of it under certain conditions.
61 Type "show copying" to see the conditions.
62 There is absolutely no warranty for GDB.  Type "show warranty" for details.
63 This GDB was configured as "i386-linux".
64 debian:/tmp#
66 Which is great, we can continue. If you don't have gdb installed, go install gdb.
68 Now load the core file in gdb, as follows:
70 debian:/tmp# gdb asterisk /tmp/core.26252
71 [...]
72 (You would see a lot of output here.)
73 [...]
74 Reading symbols from /usr/lib/asterisk/modules/app_externalivr.so...done.
75 Loaded symbols for /usr/lib/asterisk/modules/app_externalivr.so
76 #0  0x29b45d7e in ?? ()
77 (gdb)
79 In order to make extracting the gdb output easier, you may wish to
80 turn on logging using "set logging on". This command will save all
81 output to the default file of gdb.txt, which in the end can be 
82 uploaded as an attachment to the bug tracker.
84 Now at the gdb prompt, type: bt
85 You would see output similar to:
86 (gdb) bt
87 #0  0x29b45d7e in ?? ()
88 #1  0x08180bf8 in ?? ()
89 #2  0xbcdffa58 in ?? ()
90 #3  0x08180bf8 in ?? ()
91 #4  0xbcdffa60 in ?? ()
92 #5  0x08180bf8 in ?? ()
93 #6  0x180bf894 in ?? ()
94 #7  0x0bf80008 in ?? ()
95 #8  0x180b0818 in ?? ()
96 #9  0x08068008 in ast_stopstream (tmp=0x40758d38) at file.c:180
97 #10 0x000000a0 in ?? ()
98 #11 0x000000a0 in ?? ()
99 #12 0x00000000 in ?? ()
100 #13 0x407513c3 in confcall_careful_stream (conf=0x8180bf8, filename=0x8181de8 "Zap/pseudo-1324221520") at app_meetme.c:262
101 #14 0x40751332 in streamconfthread (args=0x8180bf8) at app_meetme.c:1965
102 #15 0xbcdffbe0 in ?? ()
103 #16 0x40028e51 in pthread_start_thread () from /lib/libpthread.so.0
104 #17 0x401ec92a in clone () from /lib/libc.so.6
105 (gdb)
108 The bt's output is the information that we need on the bug tracker.
110 Now do a bt full as follows:
111 (gdb) bt full
112 #0  0x29b45d7e in ?? ()
113 No symbol table info available.
114 #1  0x08180bf8 in ?? ()
115 No symbol table info available.
116 #2  0xbcdffa58 in ?? ()
117 No symbol table info available.
118 #3  0x08180bf8 in ?? ()
119 No symbol table info available.
120 #4  0xbcdffa60 in ?? ()
121 No symbol table info available.
122 #5  0x08180bf8 in ?? ()
123 No symbol table info available.
124 #6  0x180bf894 in ?? ()
125 No symbol table info available.
126 #7  0x0bf80008 in ?? ()
127 No symbol table info available.
128 #8  0x180b0818 in ?? ()
129 No symbol table info available.
130 #9  0x08068008 in ast_stopstream (tmp=0x40758d38) at file.c:180
131 No locals.
132 #10 0x000000a0 in ?? ()
133 No symbol table info available.
134 #11 0x000000a0 in ?? ()
135 No symbol table info available.
136 #12 0x00000000 in ?? ()
137 No symbol table info available.
138 #13 0x407513c3 in confcall_careful_stream (conf=0x8180bf8, filename=0x8181de8 "Zap/pseudo-1324221520") at app_meetme.c:262
139         f = (struct ast_frame *) 0x8180bf8
140         trans = (struct ast_trans_pvt *) 0x0
141 #14 0x40751332 in streamconfthread (args=0x8180bf8) at app_meetme.c:1965
142 No locals.
143 #15 0xbcdffbe0 in ?? ()
144 No symbol table info available.
145 #16 0x40028e51 in pthread_start_thread () from /lib/libpthread.so.0
146 No symbol table info available.
147 #17 0x401ec92a in clone () from /lib/libc.so.6
148 No symbol table info available.
149 (gdb)
151 We also need gdb's output. That output gives more details compared to
152 the simple "bt". So we recommend that you use bt full instead of bt.
153 But, if you could include both, we appreciate that.
155 The final "extraction" would be to know all traces by all
156 threads. Even if asterisk runs on the same thread for each call, it
157 could have created some new threads.
159 To make sure we have the correct information, just do:
160 (gdb) thread apply all bt
162 Thread 1 (process 26252):
163 #0  0x29b45d7e in ?? ()
164 #1  0x08180bf8 in ?? ()
165 #2  0xbcdffa58 in ?? ()
166 #3  0x08180bf8 in ?? ()
167 #4  0xbcdffa60 in ?? ()
168 #5  0x08180bf8 in ?? ()
169 #6  0x180bf894 in ?? ()
170 #7  0x0bf80008 in ?? ()
171 #8  0x180b0818 in ?? ()
172 #9  0x08068008 in ast_stopstream (tmp=0x40758d38) at file.c:180
173 #10 0x000000a0 in ?? ()
174 #11 0x000000a0 in ?? ()
175 #12 0x00000000 in ?? ()
176 #13 0x407513c3 in confcall_careful_stream (conf=0x8180bf8, filename=0x8181de8 "Zap/pseudo-1324221520") at app_meetme.c:262
177 #14 0x40751332 in streamconfthread (args=0x8180bf8) at app_meetme.c:1965
178 #15 0xbcdffbe0 in ?? ()
179 #16 0x40028e51 in pthread_start_thread () from /lib/libpthread.so.0
180 #17 0x401ec92a in clone () from /lib/libc.so.6
181 (gdb)
184 That output tells us crucial information about each thread.
186 Now, if you turned on logging upload your gdb.txt file. Otherwise,
187 create an output.txt file and dump your "bt full" (and/or "bt")
188 ALONG WITH "thread apply all bt" into it.
190 Note: Please ATTACH your output, DO NOT paste it as a note.
192 And you're ready for upload on the bug tracker.
195 If you have questions or comments regarding this documentation, feel
196 free to pass by the #asterisk-bugs channel on irc.freenode.net.