linux - 在嵌入式系统上运行 Qt Helloworld 时出现段错误

标签 linux qt filesystems embedded arm

我为 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/

相关文章:

c - 共享内存

linux - 用于在任务栏上放置图标的 Bash 工具?

qt - 即使我设置了 CMAKE_PREFIX_PATH,Cmake 似乎也找不到所需的 Qt cmake 文件

c++ - 如何在文件系统之上添加层?就像 OneDrive 或 Google Drive 中的缓存

hash - 元数据会改变文件的哈希吗?

java - 如何使用 samba 客户端创建目录

c++ - 堆栈变量或函数声明

linux - 如何解析 unix shell 脚本中路径的结尾?

android - 在平板电脑上编写 Qt 应用程序

qt - QFrame圆形边框透明背景