Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Last revisionBoth sides next revision | ||
howto:debug [2011/12/04 05:44] – [Running the application in a debugger] stephan | howto:debug [2013/04/21 06:38] – haobug | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== | + | ====== |
- | Ofcourse, we all know Xfce is bugfree and stable as a rock. So there shouldn' | + | 当然,我们都知道 |
- | 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, | + | 可是,一些(yet)未知的原因,会引起应用程序崩溃。我们不确定这些神奇事件的源头。有些人亲眼目睹 |
- | 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 50: | Line 49: | ||
</ | </ | ||
- | Now, perform the actions required to crash the application. The next step of the debugger looks something like this: | + | 现在,执行让应用程序崩溃所需的动作。下一步的调试器看起来像这样: |
< | < | ||
(gdb) run | (gdb) run | ||
Line 66: | Line 64: | ||
</ | </ | ||
- | 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 164: | Line 161: | ||
(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 | + |