标签: bus-error

什么是总线错误?

"总线错误"消息的含义是什么,它与段错误有什么不同?

c unix segmentation-fault bus-error

245
推荐指数
8
解决办法
28万
查看次数

总线错误与分段故障

总线错误和分段错误之间的区别?是否会发生程序发出seg故障并第一次停止并且第二次发生总线错误并退出?

c segmentation-fault bus-error sigbus

37
推荐指数
4
解决办法
3万
查看次数

在x86 Linux上调试SIGBUS

在Linux中的通用x86用户态应用程序上会导致SIGBUS(总线错误)的原因是什么?我在网上找到的所有讨论都是关于内存对齐错误,根据我的理解,它并不适用于x86.

(我的代码在Geode上运行,以防有任何相关的处理器特定怪癖.)

linux debugging bus-error sigbus

18
推荐指数
6
解决办法
3万
查看次数

如何获得"总线错误"?

我正在努力解决总线错误.

一种方法是错位访问,我尝试了这里这里给出的例子,但没有错误对我来说 - 程序执行得很好.

是否存在一些肯定会产生总线错误的情况?

c++ bus-error

15
推荐指数
3
解决办法
1万
查看次数

更新到Xcode 10.2后如何修复“总线错误10”

我将Xcode更新为新的稳定版10.2v。我试图建立我的项目,并且成功了。当我尝试归档项目(工作区)时,出现如下屏幕截图所示的错误:

到目前为止,我已经尝试过:

  1. 将可可豆荚更新到最新版本-> COCOAPODS:1.7.0.beta.3
  2. 清理DeliveredData文件夹
  3. 重新安装Xcode
  4. 删除存储库,再次克隆它并安装Pod
  5. 从项目中完全删除所有Pod,然后重新添加

bus-error ipa cocoapods xcode10.2

12
推荐指数
1
解决办法
1562
查看次数

为什么在使用macOS上的clang -O2编译C程序时,"空"循环会导致总线错误?

我在macOS High Sierra上.

$ uname -v
Darwin Kernel Version 17.2.0: Fri Sep 29 18:27:05 PDT 2017; root:xnu-4570.20.62~3/RELEASE_X86_64
Run Code Online (Sandbox Code Playgroud)

我有以下合成程序.

void nop1() {
  for (;;);
}

void nop2() {
  while (1);
}

void nop3() {
  int i = 0;
  while(1) {
    i++;
  }
}

void nop4() {
  static int i = 0;
  while(1) {
    i++;
  };
}

int main() {
  nop1();
  return 0;
}
Run Code Online (Sandbox Code Playgroud)

编辑2:我现在已经在下面的例子中用clang明确编译了.

当我编译并运行以下C程序与clang -O2我得到总线错误时main()调用nop1(),nop2(),nop3()但不适合nop4().

$ ./a.out …
Run Code Online (Sandbox Code Playgroud)

c macos llvm clang bus-error

8
推荐指数
1
解决办法
155
查看次数

在尝试执行git-commit或git-status时如何修复"总线错误"

我在OS X服务器上有一个git存储库,以前工作正常.我能够添加文件,提交它们,并将内容提取到我的笔记本电脑.

现在,当我进入服务器并执行git commitgit status在存储库中时,我在命令行中看到的只是bus error.

git log 仍然可以正常工作,并给我通常的输出.

我猜的东西是错误与资源库,因为在同一服务器上其他回购git commitgit status做仍然可以工作.

我该如何调试/修复此问题?

更新:我在问题发生之前重新创建了我上次创建的目录.这让我再做git status一次!

git commit -a但是,在此之后直接运行会出现以下错误:

fatal: Unable to create '/path/to/repo/.git/index.lock': File exists.

If no other git process is currently running, this probably means a
git process crashed in this repository earlier. Make sure no other git
process is running and remove the file manually to continue.
Run Code Online (Sandbox Code Playgroud)

然后我手动删除了index.lock文件,现在问题解决了..

我不知道出了什么问题.有任何想法吗..?

git macos bus-error git-commit git-status

7
推荐指数
1
解决办法
6277
查看次数

在C中取消引用函数指针以访问CODE内存

我们在这里处理C. 我只是想到了这个想法,想知道是否有可能访问存储函数的内存中的点foo,并将函数的内容复制到内存中的另一个点.具体来说,我正在努力让以下工作:

#include <stdlib.h>
#include <stdio.h>
#include <string.h>

void foo(){
    printf("Hello World");
}

int main(){

    void (*bar)(void) = malloc(sizeof foo);
    memcpy(&bar, &foo, sizeof foo);


    bar();
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

但运行它会导致总线错误:Bus error: 10.我试图将函数的内容复制foo到一个内存空间bar然后执行新创建的函数bar.

除了查看这样的事情是否可能之外,没有其他原因可以揭示C语言的复杂性.我没想到它有什么实际用途.

我正在寻找指导让这个工作,或以其他方式被告知,有理由,为什么这不起作用

编辑查看一些答案并了解读取,写入可执行内存,我突然意识到可以通过写入可执行内存来在C中动态创建函数.

c memory function-pointers memcpy bus-error

7
推荐指数
2
解决办法
359
查看次数

为什么以下C程序会出现总线错误?

我认为这是第一次失败的召唤.我写了C已经有一段时间了,我不知所措.非常感谢.

#include <stdio.h>
#include <string.h>

int main(int argc, char **argv) {
  char *str = "one|two|three";

  char *tok = strtok(str, "|");

  while (tok != NULL) {
    printf("%s\n", tok);
    tok = strtok(NULL, "|");
  }

  return 0;
}
Run Code Online (Sandbox Code Playgroud)

c strtok bus-error

6
推荐指数
1
解决办法
3611
查看次数

我在下面的代码中遇到总线错误

我的代码中出现总线错误.使用此代码我试图将数字转换为单词,但我知道我的逻辑存在缺陷.但在此之前,当我在mac中使用g ++编译并运行此代码时,我正在尝试使此代码按原样运行并且我收到总线错误.任何帮助,将不胜感激.

当我运行代码时,我得到以下输出.我有调试消息来跟踪错误发生的位置.

    Enter a number:1234
    main 1:numbers are:234
    Function1: Number is 234
    two
    two hundred 
    34Function2: Number is 34
    Function3: Number is 34
    Bus error: 10

#include <iostream>
#include <string>

using namespace std;
char *convert_number(int);

char *tens[]={"","ten", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"};
char *words[]={"zero","one", "two", "three", "four", "five", "six", "seven", "eight", "nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen", "eighteen","ninteen"};
char *place[]={"","hundred","thouands","million","billion","trillion"};


int main(int argc, char **argv)
{
int number,conv_num,places;
places=1;
char *string= new char[1000];
char *temp_string = new char[100];
cout<<"Enter a number:"; …
Run Code Online (Sandbox Code Playgroud)

c++ bus-error

6
推荐指数
1
解决办法
1万
查看次数