Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
howto:debug [2013/04/21 06:38] – haobug | howto:debug [2013/04/21 06:40] (current) – sorry for mess it up. haobug | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== | + | ====== |
- | 当然,我们都知道 | + | Ofcourse, we all know Xfce is bugfree and stable as a rock. So there shouldn' |
- | 可是,一些(yet)未知的原因,会引起应用程序崩溃。我们不确定这些神奇事件的源头。有些人亲眼目睹 | + | However, due to some (yet) unexplained cause, it can happen that an application crashes. We are not sure of the origin of these mysterious events. Some people have witnessed the presence of Rodents, maybe there is a relationship, |
- | 不管怎样,如果有神秘事件发生,这是一种可以帮助开发都解决问题的手段: | + | However, if these mysterious events happen, this is the way you can help the developers resolve it: |
- | ===== 确认崩溃 | + | ===== Identifying a crash ===== |
- | 当应用程序崩溃时,它通常会由于 | + | When an application crashed, it usually exits due to SIG_SEGV, a segmentation-fault. This means the operating-system has detected that the application tries to access a piece (segment) of memory that it is not allowed to. The operating-system then sends the application a signal causing an immediate abort. |
- | 如果应用程序从终端启动,输出可能像下面这样: | + | When the application is started from a terminal, this can look like the following example: |
< | < | ||
stephan@hermes: | stephan@hermes: | ||
- | 段错误 | + | Segmentation fault |
stephan@hermes: | stephan@hermes: | ||
</ | </ | ||
- | 这条消息只是简短的描述,让我们尝试找出它崩溃的原因。 | + | This message is little descriptive, |
- | ===== 在调试器中运行程序 | + | ===== Running the application in a debugger |
- | 要找出应用程序为什么崩溃,首先要在调试器中运行它。 | + | To find out why the application crashed, the first thing to try is running it in a debugger. The most commonly used debugger on GNU/ |
- | 使用 | + | To use gdb, you just start it from the command-line with the application to debug as a first argument to the application, |
< | < | ||
stephan@hermes: | stephan@hermes: | ||
Line 38: | Line 38: | ||
</ | </ | ||
- | 现在 | + | Now gdb is started, but the application itself is not doing anything yet. |
- | 要启动的应用程序,键入 | + | To start the application, |
+ | |||
+ | Now, if the application does not crash immediately, | ||
- | 现在,如果应用程序没有立即崩溃,你可以看到它启动了并且调试器里出现几行字。(见下面的例子) | ||
< | < | ||
... | ... | ||
Line 49: | Line 50: | ||
</ | </ | ||
- | 现在,执行让应用程序崩溃所需的动作。下一步的调试器看起来像这样: | + | Now, perform the actions required to crash the application. The next step of the debugger looks something like this: |
< | < | ||
(gdb) run | (gdb) run | ||
Line 64: | Line 66: | ||
</ | </ | ||
- | 当然,应用程序的不同,或 | + | Ofcourse, the output-lines differ from application to application and from bug to bug, so you shouldn' |
+ | |||
+ | The next step is getting a so called ' | ||
- | 下一步是得到一个所谓的“回溯”(backtrace)。回溯可以追踪到导致应用程序崩溃的流程: | ||
< | < | ||
(gdb) backtrace | (gdb) backtrace | ||
Line 161: | Line 164: | ||
(gdb) | (gdb) | ||
</ | </ | ||
- | 将它复制到一个文本文件中,并把它添加到 https:// | ||
- | 但如果回溯的最后一行以 | + | Copy this to a text-file, and add it to a bugreport on https:// |
+ | |||
+ | If the last line of the backtrace starts with 0x000000000000 |