主题 : 大家帮忙看看这个Segmentation fault是什么情况 复制链接 | 浏览器收藏 | 打印
级别: 新手上路
UID: 63167
精华: 0
发帖: 12
金钱: 65 两
威望: 13 点
综合积分: 24 分
注册时间: 2012-02-15
最后登录: 2012-10-07
楼主  发表于: 2012-07-18 15:15

 大家帮忙看看这个Segmentation fault是什么情况

if ((fd = open (videodevice, O_RDWR)) == -1) {
perror ("ERROR opening V4L interface \n");
exit (1);
}
.....
videochan.norm = norme;
videochan.channel = channel;
if (ioctl (fd, VIDIOCSCHAN, &videochan) == -1) {
printf ("ERROR setting channel and norme \n");
exit (1);
运行发生Segmentation fault
我用gdb远程调试确定问题是在那里
同样的程序在PC上可以正常运行,移植到开发板上就有了问题
我用了arm-linux-gcc 4 和3 编译都有问题
有趣的是相同的问题又发生在另一个程序里
fb_info_to_driver.Bpp = vinfo.bits_per_pixel ;
  fb_info_to_driver.LeftTop_x = 0;
  fb_info_to_driver.LeftTop_y = 0;
  fb_info_to_driver.Width = destWidth;
  fb_info_to_driver.Height = destHeight;

  if (ioctl(dev_fb0, SET_OSD_INFO, &fb_info_to_driver)) {
  printf("Some problem with the ioctl SET_VS_INFO!!!\n");
  return -1;
  }
运行报Some problem with the ioctl SET_VS_INFO!!! Segmentation fault
几乎一模一样的问题