我为 ARM 交叉编译了一个 Helloworld
可执行文件。它在我 friend 的开发板上运行良好,但在我的开发板上因“段错误”而失败。这两 block 板在硬件和软件上都略有不同。
我的问题是,如何在我的电路板上进行调试?调试这么简单的程序是不是比较容易?这是否表明可执行文件没有任何问题,问题很可能出在我的板的文件系统上?
代码如下:
#include <QApplication>
#include <QPushButton>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QPushButton hello("Hello world");
hello.resize(100, 30);
hello.show();
return app.exec();
}
可执行文件由以下命令生成:
qmake -project
qmake
make
最佳答案
很可能 gdb 被移植为在 ARM 目标上运行,但如果缺少它或为了便于调试,您应该使用 gdb 远程调试。 http://sourceware.org/gdb/onlinedocs/gdb/Remote-Debugging.html#Remote-Debugging
Gdbserver 是应该在目标上运行的应用程序。以下是如何使用它的演示。 (从维基百科复制)
目标设置:
remote$ gdbserver :2345 hello_world
Process hello_world created; pid = 2509
Listening on port 2345
主机设置:
local$ gdb -q hello_world
Reading symbols from /home/user/hello_world...done.
(gdb) target remote 192.168.0.11:2345
Remote debugging using 192.168.0.11:2345
0x002f3850 in ?? () from /lib/ld-linux.so.2
(gdb) continue
Continuing.
Program received signal SIGSEGV, Segmentation fault.
0x08048414 in main () at hello_world.c:10
10 printf("x[%d] = %g\n", i, x[i]);
(gdb)
关于linux - 在嵌入式系统上运行 Qt Helloworld 时出现段错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12296217/