标题:S3C2410上一个QTE多线程程序的执行问题
作者:vera
日期:2006-10-08 19:31
内容:
编写了一个需要多线程支持,包含系统调用(自己写的驱动)的程序,在X86-qtopia和arm-qtopia下编译都通过了,决定下到板子上试试。
但是运行后报错:
。。。。__6QMutex 什么的认不到 (具体的没考过来)
运行HELLO例程:
可以正常运行。
考虑是这2410的板子买来时带的QTE的库是不支持多线程的,而我交叉编译时用的arm-qtopia下的库是加了线程支持的,于是用ftp get了 libqte.so.2.3.7, 放到了板子的 /opt/qt/lib/下,但是该目录下的fonts文件夹没有做改变。
重新设置好环境变量,insmod了驱动模块后运行我的程序:
报错:
Bus Error
运行HELLO例程:
报错:
Bus Error
看来一定是库文件出问题了,但是问题是什么呢?该怎么解决呢?
#1 [shiroki 10-09 13:59]
关于bus error的解释, 希望有所帮助
In computing, a bus error is generally an attempt to access memory that the CPU cannot physically address. Bus errors can also be caused by any general device fault that the computer detects.
A bus error rarely means that computer hardware is physically broken. It is normally caused by buggy software trying to access something it can't.
There are two main causes of bus error:
non-existent address
The CPU is instructed by software to read or write a specific physical memory address. Accordingly, the CPU sets this physical address on its address bus and requests all other hardware connected to the CPU to respond with the results, if they answer for this specific address. If no other hardware responds, the CPU raises an exception, stating that the requested physical address is unrecognised by the whole computer system. Note that this only covers physical memory addresses. When software tries to access an undefined virtual memory address, that is generally considered to be a segmentation fault rather than a bus error.
unaligned access
Most CPUs are byte-addressable, where each unique memory address refers to an 8-bit byte. Most CPUs can access individual bytes from each memory address, but they generally cannot access larger units (16 bits, 32 bits, 64 bits and so on) without these units being "aligned" to a specific boundary, such as 16 bits (addresses 0, 2, 4 can be accessed, addresses from 1, 3, 5, are unaligned) or 32 bits (0, 4, 8, 12 are aligned, all addresses in-between are unaligned). Attempting to access a value larger than a byte at an unaligned address can cause a bus error.
CPUs generally access data at the full width of their data bus at all times. To address bytes, they access memory at the full width of their data bus, then mask and shift to address the individual byte. This is inefficient, but tolerated as it is an essential feature for most software, especially string-processing...
#2 [fengshenx 10-10 11:02]
你应该先确定你的驱动没有问题。
#3 [vera 10-10 14:42]
驱动没有问题,
在使用QT程序之前针对该驱动写了测试程序,已经完成测试,现在实际上是把这个测试程序和QT的图形界面整合到一起。
#4 [vera 10-10 14:54]
有人说这个QTE2.3.7对多线程支持不完善,是不是指的是没有QMutex这个类?
我写程序的时候刚开始参考的是3.X的那个中文的文档,添加了头文件qmutex.h, 但是后来报错,查了2.3.7的文档才发现是没有这个头文件的,但是在QThread类中说使用的时候只包含qthread.h就可以了,所谓的不完善指的是这个吗?
我现在是需要使用pthread重新把程序改一遍还是换一个3.x的QTE重新编译程序呢?
正在改写,C和C++如此混合,恼火……
#5 [vera 10-10 15:03]
看了shiroki 关于BUS ERROR 的说明, 觉得有一件事不清楚,就是为什么HELLO例程在不使用驱动和硬件的情况下也会包BUS ERROR的错误呢?
这个问题肯定和库相关把,因为错误是因为我换了个加了线程支持的库引起的。