Tvheadendcrash » History » Version 6
mdd -, 2010-09-24 15:35
fixed typo
1 | 3 | Andreas Smas | [[PageOutline]] |
---|---|---|---|
2 | 5 | mdd - | This article aims to provide a couple of guidelines of how to debug Tvheadend with GDB. |
3 | 1 | Andreas Smas | |
4 | |||
5 | 6 | mdd - | h1. Running in gdb to file a bug report |
6 | |||
7 | |||
8 | 2 | Andreas Smas | This method is by far the best one as it yields most info. Especially if you have compiled the source yourself. |
9 | 1 | Andreas Smas | It does assume that you are able to reproduce the bug since you probably won't be running Tvheadend inside a gdb session normally. |
10 | |||
11 | To start Tvheadend from a gdb session just execute this command when standing in the dir where tvheadend is checked out. |
||
12 | 6 | mdd - | <pre> |
13 | 1 | Andreas Smas | $ gdb --args build.Linux/tvheadend -d |
14 | 6 | mdd - | </pre> |
15 | 2 | Andreas Smas | |
16 | 1 | Andreas Smas | Or, If you get repeatable crashes in the installed binary you can also run gdb on that binary. In order to that you must disable the running daemon and run the binary as the hts user (or it won't pick up the correct config, etc) |
17 | 6 | mdd - | <pre> |
18 | 2 | Andreas Smas | $ sudo /etc/init.d/hts-tvheadend stop |
19 | $ sudo -u hts -i |
||
20 | $ gdb --args /usr/bin/tvheadend -d |
||
21 | 6 | mdd - | </pre> |
22 | 2 | Andreas Smas | |
23 | 6 | mdd - | <pre> |
24 | 1 | Andreas Smas | GNU gdb (GDB) 7.1-ubuntu |
25 | Copyright (C) 2010 Free Software Foundation, Inc. |
||
26 | License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> |
||
27 | This is free software: you are free to change and redistribute it. |
||
28 | There is NO WARRANTY, to the extent permitted by law. Type "show copying" |
||
29 | and "show warranty" for details. |
||
30 | This GDB was configured as "i486-linux-gnu". |
||
31 | For bug reporting instructions, please see: |
||
32 | <http://www.gnu.org/software/gdb/bugs/>... |
||
33 | Reading symbols from /home/andoma/tvheadend/build.Linux/tvheadend...done. |
||
34 | 6 | mdd - | </pre> |
35 | 1 | Andreas Smas | |
36 | 6 | mdd - | <pre> |
37 | 1 | Andreas Smas | (gdb) r |
38 | 6 | mdd - | </pre> |
39 | 1 | Andreas Smas | |
40 | Eventually the program will crash. Then execute these three commands and paste in the bug report. |
||
41 | |||
42 | 2 | Andreas Smas | |
43 | 6 | mdd - | |
44 | h3. Register dump |
||
45 | |||
46 | <pre> |
||
47 | 1 | Andreas Smas | (gdb) info reg |
48 | eax 0x0 0 |
||
49 | ecx 0x10 16 |
||
50 | edx 0x80cd818 135059480 |
||
51 | ebx 0x8178d90 135761296 |
||
52 | esp 0xb45ff140 0xb45ff140 |
||
53 | ebp 0xb45ff168 0xb45ff168 |
||
54 | esi 0x80f9f18 135241496 |
||
55 | edi 0xb45ff220 -1268780512 |
||
56 | eip 0x8057ec8 0x8057ec8 <subscription_unsubscribe+200> |
||
57 | eflags 0x10282 [ SF IF RF ] |
||
58 | cs 0x73 115 |
||
59 | ss 0x7b 123 |
||
60 | ds 0x7b 123 |
||
61 | es 0x7b 123 |
||
62 | fs 0x0 0 |
||
63 | gs 0x33 51 |
||
64 | 6 | mdd - | </pre> |
65 | 1 | Andreas Smas | |
66 | |||
67 | 6 | mdd - | |
68 | h3. Disassembly of code around the crash |
||
69 | |||
70 | <pre> |
||
71 | 1 | Andreas Smas | (gdb) disassemble $pc-32,$pc+32 |
72 | Dump of assembler code from 0x8057ea8 to 0x8057ee8: |
||
73 | 0x08057ea8 <subscription_unsubscribe+168>: add $0x24,%al |
||
74 | 0x08057eaa <subscription_unsubscribe+170>: call 0x804a814 <free@plt> |
||
75 | 0x08057eaf <subscription_unsubscribe+175>: mov %ebx,(%esp) |
||
76 | 0x08057eb2 <subscription_unsubscribe+178>: call 0x804a814 <free@plt> |
||
77 | 0x08057eb7 <subscription_unsubscribe+183>: call 0x80579c0 <subscription_reschedule> |
||
78 | 0x08057ebc <subscription_unsubscribe+188>: mov 0x80c8bc8,%eax |
||
79 | 0x08057ec1 <subscription_unsubscribe+193>: lea 0x0(%esi,%eiz,1),%esi |
||
80 | => 0x08057ec8 <subscription_unsubscribe+200>: mov (%eax),%edx |
||
81 | 0x08057eca <subscription_unsubscribe+202>: test %edx,%edx |
||
82 | 0x08057ecc <subscription_unsubscribe+204>: je 0x8057ed4 <subscription_unsubscribe+212> |
||
83 | 0x08057ece <subscription_unsubscribe+206>: mov 0x4(%eax),%ecx |
||
84 | 0x08057ed1 <subscription_unsubscribe+209>: mov %ecx,0x4(%edx) |
||
85 | 0x08057ed4 <subscription_unsubscribe+212>: mov 0x4(%eax),%ecx |
||
86 | 0x08057ed7 <subscription_unsubscribe+215>: mov %edx,(%ecx) |
||
87 | 0x08057ed9 <subscription_unsubscribe+217>: mov (%eax),%eax |
||
88 | 0x08057edb <subscription_unsubscribe+219>: jmp 0x8057ec8 <subscription_unsubscribe+200> |
||
89 | 0x08057edd <subscription_unsubscribe+221>: mov 0x2c(%ebx),%eax |
||
90 | 0x08057ee0 <subscription_unsubscribe+224>: movl $0x8094ad9,0x8(%esp) |
||
91 | 6 | mdd - | </pre> |
92 | 1 | Andreas Smas | |
93 | 6 | mdd - | |
94 | h3. Full backtrace |
||
95 | |||
96 | <pre> |
||
97 | 1 | Andreas Smas | (gdb) bt full |
98 | #0 subscription_unsubscribe (s=0x0) at /home/andoma/tvheadend/src/subscriptions.c:221 |
||
99 | t = 0x80f9f18 |
||
100 | #1 0x08061609 in htsp_subscription_destroy (htsp=0xb45ff220, hs=0x81762b8) at /home/andoma/tvheadend/src/htsp.c:240 |
||
101 | No locals. |
||
102 | #2 0x080616e9 in htsp_method_unsubscribe (htsp=0xb45ff220, in=0x817a468) at /home/andoma/tvheadend/src/htsp.c:806 |
||
103 | s = 0x81762b8 |
||
104 | sid = 1 |
||
105 | #3 0x080632ac in htsp_read_loop (fd=38, opaque=0x0, source=0x80d5774, self=0x80d5784) at /home/andoma/tvheadend/src/htsp.c:1065 |
||
106 | m = 0x817a468 |
||
107 | i = 8 |
||
108 | reply = <value optimized out> |
||
109 | r = <value optimized out> |
||
110 | method = <value optimized out> |
||
111 | #4 htsp_serve (fd=38, opaque=0x0, source=0x80d5774, self=0x80d5784) at /home/andoma/tvheadend/src/htsp.c:1188 |
||
112 | htsp = {htsp_fd = 38, htsp_peer = 0x80d5774, htsp_version = 0, htsp_logname = 0x80d3420 "127.0.0.1 [ HTS Showtime ]", |
||
113 | htsp_peername = 0x80ccf50 "127.0.0.1", htsp_username = 0x0, htsp_clientname = 0x80d7dd0 "HTS Showtime", htsp_async_mode = 1, |
||
114 | htsp_async_link = {le_next = 0x0, le_prev = 0x80c7e30}, htsp_writer_thread = 3017796464, htsp_writer_run = 1, htsp_active_output_queues = { |
||
115 | 6 | mdd - | tqh_first = 0x0, tqh_last = 0xb45ff250}, htsp_out_mutex = {+data = {+lock = 0, +count = 0, +owner = 0, +kind = 0, +nusers = 1, { |
116 | </pre> |
||
117 | htsp_out_cond = {+data = {+lock = 0, +futex = 119, +total_seq = 60, +wakeup_seq = 59, +woken_seq = 59, +mutex = 0xb45ff258, |
||
118 | +nwaiters = 2, +broadcast_seq = 0}, |
||
119 | +size = "\000\000\000\000w\000\000\000<\000\000\000\000\000\000\000;\000\000\000\000\000\000\000;\000\000\000\000\000\000\000X\362_\264\002\000\000\000\000\000\000\000\000\000\000", +align = 511101108224}, htsp_hmq_ctrl = {hmq_q = {tqh_first = 0x0, tqh_last = 0xb45ff2a0}, hmq_link = { |
||
120 | 1 | Andreas Smas | tqe_next = 0x0, tqe_prev = 0xb45ff250}, hmq_strict_prio = 0, hmq_length = 0, hmq_payload = 0}, htsp_hmq_epg = {hmq_q = { |
121 | tqh_first = 0x0, tqh_last = 0xb45ff2bc}, hmq_link = {tqe_next = 0x0, tqe_prev = 0x0}, hmq_strict_prio = 0, hmq_length = 0, |
||
122 | hmq_payload = 0}, htsp_hmq_qstatus = {hmq_q = {tqh_first = 0x0, tqh_last = 0xb45ff2d8}, hmq_link = {tqe_next = 0x81762e4, |
||
123 | tqe_prev = 0xb45ff250}, hmq_strict_prio = 1, hmq_length = 0, hmq_payload = 0}, htsp_subscriptions = {lh_first = 0x0}, |
||
124 | htsp_granted_access = 15, htsp_challenge = "\033\231\367B\270ʙ\375q~\272r\305&vә\\aۑ9\332+IM\036\365K\241\067K"} |
||
125 | buf = "127.0.0.1", '\000' <repeats 20 times> |
||
126 | s = <value optimized out> |
||
127 | #5 0x0804d7a3 in tcp_server_start (aux=0x80d5768) at /home/andoma/tvheadend/src/tcp.c:397 |
||
128 | val = 1 |
||
129 | #6 0x0018b96e in start_thread (arg=0xb45ffb70) at pthread_create.c:300 |
||
130 | ---Type <return> to continue, or q <return> to quit--- |
||
131 | 6 | mdd - | +res = <value optimized out> |
132 | +ignore1 = <value optimized out> |
||
133 | +ignore2 = <value optimized out> |
||
134 | 1 | Andreas Smas | pd = 0xb45ffb70 |
135 | now = <value optimized out> |
||
136 | unwind_buf = {cancel_jmp_buf = {{jmp_buf = {1687540, 0, 4001536, -1268779880, 1031645625, -1276594991}, mask_was_saved = 0}}, priv = {pad = { |
||
137 | 6 | mdd - | </pre> |
138 | 1 | Andreas Smas | not_first_call = <value optimized out> |
139 | robust = <value optimized out> |
||
140 | freesize = <value optimized out> |
||
141 | 6 | mdd - | +PRETTY_FUNCTION+ = "start_thread" |
142 | 1 | Andreas Smas | #7 0x00292a4e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130 |
143 | No locals. |
||
144 | 6 | mdd - | </pre> |
145 | 1 | Andreas Smas | |
146 | |||
147 | |||
148 | 6 | mdd - | h1. Using the crash info from syslog |
149 | |||
150 | |||
151 | 4 | Andreas Smas | Starting with r5182 the output in syslog (/var/log/daemon.log) from a crash looks like this: |
152 | 1 | Andreas Smas | |
153 | 6 | mdd - | <pre> |
154 | 4 | Andreas Smas | [ALERT]:CRASH: Signal: 11 in PRG: build.Linux/tvheadend (SVN-r5179) [4c9746188f23f5e04863d2d8388833b71f45cbf4] CWD: /home/andoma/tvheadend |
155 | [ALERT]:CRASH: Fault address 0x3 (Address not mapped) |
||
156 | [ALERT]:CRASH: Loaded libraries: /lib/tls/i686/cmov/librt.so.1 /lib/tls/i686/cmov/libcrypt.so.1 /usr/lib/libavahi-common.so.3 /usr/lib/libavahi-client.so.3 /lib/tls/i686/cmov/libpthread.so.0 /lib/tls/i686/cmov/libm.so.6 /lib/tls/i686/cmov/libc.so.6 /lib/tls/i686/cmov/libdl.so.2 /lib/ld-linux.so.2 /lib/libdbus-1.so.3 /lib/tls/i686/cmov/libnss_compat.so.2 /lib/tls/i686/cmov/libnsl.so.1 /lib/tls/i686/cmov/libnss_nis.so.2 /lib/tls/i686/cmov/libnss_files.so.2 |
||
157 | 6 | mdd - | [ALERT]:CRASH: Register dump r19: 00000033 00000000 0000007b 0000007b 00000001 000003e8 bfb2c948 bfb2c7d0 000003e8 0000009c 0028d36c 00000000 0000000e 00000006 0804bbc3 00000073 00010246 bfb2c7d0 0000007b |
158 | 4 | Andreas Smas | [ALERT]:CRASH: STACKTRACE |
159 | 1 | Andreas Smas | [ALERT]:CRASH: build.Linux/tvheadend 0x80678a9 |
160 | 6 | mdd - | [ALERT]:CRASH: +kernel_rt_sigreturn+0x0 () |
161 | [ALERT]:CRASH: +libc_start_main+0xe6 (/lib/tls/i686/cmov/libc.so.6) |
||
162 | 1 | Andreas Smas | [ALERT]:CRASH: build.Linux/tvheadend 0x804aee1 |
163 | 6 | mdd - | </pre> |
164 | 4 | Andreas Smas | |
165 | 1 | Andreas Smas | Just paste this info in the bug report |