报告问题、错误或崩溃

通过进行准确的错误报告,并提供重现错误的所有内容,您通常已经完成了一半的错误修复工作。

所以要准确且信息丰富!

1. 错误追踪器

Gambas 错误跟踪器目前托管在 http://gambaswiki.org/bugtracker。请在那里报告您的错误。 请注意,必须使用有效的电子邮件地址注册才能发布错误报告。

不要忘记:

  • 提供有关您的配置的详细信息:您的处理器、您的发行版(Mandriva、SuSE、Debian等)连同版本号、内核版本以及您认为有用的一切。

  • 告诉你正在使用哪种版本的Gambas

  • 对于带有GUI的项目,请指出您的桌面环境是什么以及您正在使用什么图形组件。

  • 试着在一个小项目中隔离问题,并描述如何重现。

您可以从开发环境中的“系统信息”菜单项中收集所有需要的信息:

2. 邮件列表

如果你不能解决你的问题,先尝试向邮件列表报告。可能有人能帮助你,谁知道呢?但是/请/:

  • 提供你的配置细节:你的处理器、你的发行版(Mandriva、SuSE、Debian、等等)和版本号、你的核心版本、以及你找到的任何有用的东西。

  • 告知你使用的Gambas版本*,以及有GUI的工程是否使用gb.qt4gb.gtk 组件。

  • 如果可能,尝试在小的Gambas工程中分离问题。

3. 报告Gambas编译问题

如果您无法成功编译和安装Gambas,请提供以下四个命令的输出: ./reconf-all, ./configure, make, 和 make install.

要执行此操作,请在终端中键入以下命令:

$ cd /gambas/source/directory
$ (./reconf-all && ./configure -C && make clean && make) > output.txt 2>&1
$ su
...
# make install > install.txt 2>&1

而后发送 "output.txt" 和 "install.txt" 文件.

如果 ./reconf-all 不是问题所在, 你能够跳过这步, 只发送另外三个命令的输出。

编译问题必须通过邮件列表, 而不是错误跟踪器!

4. 报告错误

作为最后的手段,如果你几乎可以肯定这是一个可怕的错误,你可以给我发一封电子邮件,但请:

  • 把“bug”这个词放在主题的某个地方。

  • 提供有关您的配置的详细信息:您的处理器、您的发行版(Mandriva、SuSE、Debian等)连同版本号、内核版本以及您认为有用的一切。

  • 告诉你正在使用哪种版本的Gambas

  • 对于带有GUI的项目,请指出您的桌面环境是什么以及您正在使用什么图形组件。

  • 如果在编译或执行程序时出现问题, 请发送您的Gambas项目 ,以便我处理。

  • 如果你不想发送你的项目,试着在一个小项目中隔离问题。

5. 报告崩溃(段错误或信号#11)

如果Gambas崩溃了,你可以追踪它并告诉我它到底崩溃在哪里。这对我很有帮助。

如果你不知道如何做到这一点,请仔细阅读以下内容:

您必须在启用调试信息的情况下编译Gambas,这通常是默认设置。

  • 打开一个终端,然后转到崩溃的项目的目录。

    $ cd /path/to/my/gambas/project
    

如果IDE崩溃,请转到在 app/src/gambas3 目录中IDE源代码。

不要忘记编译IDE。例如

$ cd ~/gambas3-xxx/app/src/gambas3
$ gbc3 -agt

  • 启动GNU调试器。

    $ gdb gbx3
    GNU gdb (GDB) 7.2-ubuntu
    Copyright (C) 2010 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
    and "show warranty" for details.
    This GDB was configured as "i686-linux-gnu".
    For bug reporting instructions, please see:
    <http://www.gnu.org/software/gdb/bugs/>...
    Reading symbols from /usr/bin/gbx3...done.
    (gdb)
    

  • 运行程序直到崩溃。

    (gdb) run
    Starting program: /usr/bin/gbx3
    ...
    Program received signal SIGSEGV, Segmentation fault.
    0x4011010e in select () from /lib/i686/libc.so.6
    (gdb)
    

  • 然后键入 'bt' 命令以获取堆栈内容。

    (gdb) bt
    #0  0x4011010e in select () from /lib/i686/libc.so.6
    #1  0x408ae730 in typeinfo for QMotifStyle () from /usr/lib/qt3/lib/libqt-mt.so.3
    #2  0x4040e270 in QApplication::enter_loop() () from /usr/lib/qt3/lib/libqt-mt.so.3
    #3  0x401d5b0b in MyMainWindow::showModal() (this=0x81d56c0) at CWindow.cpp:770
    #4  0x401d4a8b in CWINDOW_show_modal(void*, void*) (_object=0x81cc7c8, _param=0xbffff4c0)
        at CWindow.cpp:222
    #5  0x0804f624 in EXEC_call_native (exec=0x401d4a60 <CWINDOW_show_modal(void*, void*)>,
        object=0x81cc7c8, param=0xbffff4c0 "rubbish", type=4) at exec.c:592
    #6  0x0804f79f in EXEC_native () at exec.c:643
    #7  0x08050da3 in EXEC_loop () at exec_loop.c:1019
    #8  0x0804f418 in EXEC_function_real (keep_ret_value=0 '\0') at exec.c:505
    #9  0x08066ad6 in main (argc=1, argv=0xbffff814) at gbx.c:246
    #10 0x40061082 in __libc_start_main () from /lib/i686/libc.so.6
    (gdb)
    

现在把之前的清单发给我,这样我就能了解发生了什么。请注意,前面的例子并不是真正的崩溃。。。

6. 使用valgrind报告崩溃(段错误或信号#11)

Sometimes, the program crashes a long time after the bug has been encountered. Then the stack backtrace is not useful.

Hopefully, valgrind is there!

valgrind allows you to instrumentate any program. It runs it inside a CPU-emulator, and can detect any memory bug as soon as it is encountered. Of course, a program run inside valgrind is then a lot slower, but hey!...

Do not forget to install valgrind. It may not be installed by default on your system.

You have to compile Gambas with debugging information enabled, which is normally the default.

To run your gambas project in valgrind, do the following:

  • Open a terminal, and go to the directory of the project that crashes.

    $ cd /path/to/my/gambas/project
    

If the IDE crashes, go to the IDE sources in the app/src/gambas3 directory of the source package. Do not forget to compile the IDE if needed. For example:

$ cd ~/gambas3-xxx/app/src/gambas3
$ gbc3 -agt

  • Then run the project inside valgrind that way:

    $ valgrind --tool=memcheck --num-callers=50 gbx3 > valgrind.out 2>&1
    

Beware that valgrind will try to continue the program, even if it segfaults, until it really has to stop. So you may have to stop the program manually by hitting CTRL+C if you know that the bug has been reached.

Once done, send me the valgrind.out file.

Thanks in advance for all the information you can gather!