GDB调试程序报如下错误

oyxiaoyu0 2010-05-25 10:12:20
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
int main()
{
int i=5;
char str[10]="dongyu";
printf("%s\t%d\n",str,i);
}

(gdb) b test.c:5
Breakpoint 1 at 0x2940: file test.c, line 5.
(gdb) r
Starting program: /indbbill/user/suiz/test

Program terminated with signal SIGBUS, Bus error.
The program no longer exists.
You can't do that without a process to debug.

以前从来没有遇到过.现在所有的程序调试都报这个错误了.请各位大侠帮忙看看被

就这么一个小程序都过不去,原来我主机的阵列掉了.现在已经挂上了,但挂上后系统就不好用了.
...全文
660 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
luomoweilan 2010-06-07
  • 打赏
  • 举报
回复
学习学习!
needle2 2010-06-07
  • 打赏
  • 举报
回复
学习学习
Gary@Tokyo 2010-06-06
  • 打赏
  • 举报
回复
Program terminated with signal SIGBUS, Bus error.
直接google这
oyxiaoyu0 2010-06-03
  • 打赏
  • 举报
回复
痛苦啊,硬件也不知道啥问题啊.是不是有些补丁没打上的原因呢
CVA4508M 2010-06-03
  • 打赏
  • 举报
回复
硬件故障都出来了。。真无语。。
CVA4508M 2010-06-03
  • 打赏
  • 举报
回复
楼主为什么不先google呢。。
而且。2楼和3楼的回答也被你无视了。。。汗。。

楼主的系统应该是unix吧。
记得linux内核会处理内存对齐问题的,但unix不会
rwjlqn 2010-06-03
  • 打赏
  • 举报
回复
编译器还好吗
jiangfeng999 2010-05-27
  • 打赏
  • 举报
回复
硬件故障吧,看楼主的代码没什么问题;
程序的逻辑问题一般都是报SIGSEGV这个信号
sabflying 2010-05-26
  • 打赏
  • 举报
回复

1) 硬件故障,不用说,程序员最常碰上的肯定不是这种情形。

2) Linux平台上执行malloc(),如果没有足够的RAM,Linux不是让malloc()失败返回,
而是向当前进程分发SIGBUS信号。

3) 某些架构上访问数据时有对齐的要求,比如只能从4字节边界上读取一个4字节的
数据类型。IA-32架构没有硬性要求对齐,尽管未对齐的访问降低执行效率。另外
一些架构,比如SPARC、m68k,要求对齐访问,否则向当前进程分发SIGBUS信号。
lylm 2010-05-26
  • 打赏
  • 举报
回复
<<以前从来没有遇到过.现在所有的程序调试都报这个错误了
你贴的程序没问题,如果所有程序都这样,还是硬件问题
piedgogo 2010-05-26
  • 打赏
  • 举报
回复
int SIGBUS
This signal is generated when an invalid pointer is dereferenced.
Like `SIGSEGV', this signal is typically the result of
dereferencing an uninitialized pointer. The difference between
the two is that `SIGSEGV' indicates an invalid access to valid
memory, while `SIGBUS' indicates an access to an invalid address.
In particular, `SIGBUS' signals often result from dereferencing a
misaligned pointer, such as referring to a four-word integer at an
address not divisible by four. (Each kind of computer has its own
requirements for address alignment.)
woso 2010-05-25
  • 打赏
  • 举报
回复
帮顶,我猜还是阵列有问题,等高手解答

23,114

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 应用程序开发区
社区管理员
  • 应用程序开发区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧