c++ - ARM和Intel发生奇怪的崩溃

标签 c++ assembly crash memory-corruption

仇恨者会讨厌,但由于无法将问题分开,因此我无法提供源代码,但是我将尽力提供尽可能多的信息。

所以我的问题是,在我使用的C++库(OpenCASCADE)中定义明确的位置,我的应用程序在定义明确的情况下崩溃了。

  • 仅当我从新线程
  • 运行代码时,才会发生崩溃
  • 线程
  • 之间没有共享数据
  • 在运行方法中的第一条指令之前,崩溃发生在方法调用中。这是一个令人反感的:
    Shapr3D`GeomInt_ParFunctionOfMyGradientOfTheComputeLineBezierOfWLApprox::Perform(math_Vector const&) at AppParCurves_Function.gxx:262: 0x10b5701b0: pushq %rbp 0x10b5701b1: movq %rsp, %rbp 0x10b5701b4: subq $0x663e0, %rsp 0x10b5701bb: movq %rdi, -0x8(%rbp) 0x10b5701bf: movq %rsi, -0x10(%rbp) 0x10b5701c3: movq -0x8(%rbp), %rsi 0x10b5701c7: movq %rsi, %rdi 0x10b5701ca: addq $0xc0, %rdi 0x10b5701d1: movq -0x10(%rbp), %rax 0x10b5701d5: movq %rsi, -0x65ba0(%rbp) //Crashes here 0x10b5701dc: movq %rax, %rsi 0x10b5701df: callq 0x10c050d76 ; symbol stub for: math_Vector::operator=(math_Vector const&) 0x10b5701e4: movq -0x65ba0(%rbp), %rsi 0x10b5701eb: addq $0x8828, %rsi 0x10b5701f2: movq -0x65ba0(%rbp), %rdi 0x10b5701f9: addq $0xc0, %rdi 0x10b570200: movq %rdi, -0x65ba8(%rbp) 0x10b570207: movq %rsi, %rdi 0x10b57020a: movq -0x65ba8(%rbp), %rsi 0x10b570211: movq %rax, -0x65bb0(%rbp)
  • 由于访问错误而崩溃:EXC_BAD_ACCESS(code = 1,address = 0x9f1606100)
  • 调用方法的对象是动态分配还是静态分配的
  • 都没有关系
  • 我提供了Intel的取消安装信息,但崩溃同时发生在Mac OS和iOS,32位和64位
  • Valgrind没有发现任何问题
  • 另外,这是一个调用栈(除非您熟悉OpenCASCADE,否则它可能不会很有用)
  • 0 0x000000010b5701d5 in GeomInt_ParFunctionOfMyGradientOfTheComputeLineBezierOfWLApprox::Perform(math_Vector const&) at /Users/icsanady/occt_git/occt/adm/mac/xcd/../../../inc/AppParCurves_Function.gxx:265 1 0x000000010b574dac in GeomInt_ParFunctionOfMyGradientOfTheComputeLineBezierOfWLApprox::Values(math_Vector const&, double&, math_Vector&) at /Users/icsanady/occt_git/occt/adm/mac/xcd/../../../inc/AppParCurves_Function.gxx:589 2 0x000000010b790286 in math_BFGS::Perform(math_MultipleVarFunctionWithGradient&, math_Vector const&) at /Users/icsanady/occt_git/occt/src/math/math_BFGS.cxx:187 3 0x000000010b56934c in GeomInt_Gradient_BFGSOfMyGradientOfTheComputeLineBezierOfWLApprox::GeomInt_Gradient_BFGSOfMyGradientOfTheComputeLineBezierOfWLApprox(math_MultipleVarFunctionWithGradient&, math_Vector const&, double, double, double, int) at /Users/icsanady/occt_git/occt/adm/mac/xcd/../../../inc/AppParCurves_Gradient_BFGS.gxx:31 4 0x000000010b5693c9 in GeomInt_Gradient_BFGSOfMyGradientOfTheComputeLineBezierOfWLApprox::GeomInt_Gradient_BFGSOfMyGradientOfTheComputeLineBezierOfWLApprox(math_MultipleVarFunctionWithGradient&, math_Vector const&, double, double, double, int) at /Users/icsanady/occt_git/occt/adm/mac/xcd/../../../inc/AppParCurves_Gradient_BFGS.gxx:32 5 0x000000010b56c80d in GeomInt_MyGradientOfTheComputeLineBezierOfWLApprox::GeomInt_MyGradientOfTheComputeLineBezierOfWLApprox(GeomInt_TheMultiLineOfWLApprox const&, int, int, Handle_AppParCurves_HArray1OfConstraintCouple const&, math_Vector&, int, double, double, int) at /Users/icsanady/occt_git/occt/adm/mac/xcd/../../../inc/AppParCurves_Gradient.gxx:186 6 0x000000010b56cd4a in GeomInt_MyGradientOfTheComputeLineBezierOfWLApprox::GeomInt_MyGradientOfTheComputeLineBezierOfWLApprox(GeomInt_TheMultiLineOfWLApprox const&, int, int, Handle_AppParCurves_HArray1OfConstraintCouple const&, math_Vector&, int, double, double, int) at /Users/icsanady/occt_git/occt/adm/mac/xcd/../../../inc/AppParCurves_Gradient.gxx:209 7 0x000000010b5a67c9 in GeomInt_TheComputeLineBezierOfWLApprox::Compute(GeomInt_TheMultiLineOfWLApprox const&, int, int, math_Vector&, double&, double&) at /Users/icsanady/occt_git/occt/adm/mac/xcd/../../../inc/Approx_ComputeLine.gxx:920 8 0x000000010b5a5704 in GeomInt_TheComputeLineBezierOfWLApprox::Perform(GeomInt_TheMultiLineOfWLApprox const&) at /Users/icsanady/occt_git/occt/adm/mac/xcd/../../../inc/Approx_ComputeLine.gxx:779 9 0x000000010b5c4f79 in GeomInt_WLApprox::Perform(IntSurf_Quadric const&, Handle_Adaptor3d_HSurface const&, Handle_IntPatch_WLine const&, unsigned int, unsigned int, unsigned int, int, int) at /Users/icsanady/occt_git/occt/adm/mac/xcd/../../../inc/ApproxInt_Approx.gxx:1058 10 0x000000010b5c359f in GeomInt_WLApprox::Perform(Handle_Adaptor3d_HSurface const&, Handle_Adaptor3d_HSurface const&, Handle_IntPatch_WLine const&, unsigned int, unsigned int, unsigned int, int, int) at /Users/icsanady/occt_git/occt/adm/mac/xcd/../../../inc/ApproxInt_Approx.gxx:637 11 0x000000010bd61455 in IntTools_FaceFace::MakeCurve(int, Handle_Adaptor3d_TopolTool const&, Handle_Adaptor3d_TopolTool const&) at /Users/icsanady/occt_git/occt/src/IntTools/IntTools_FaceFace.cxx:1839 12 0x000000010bd58cae in IntTools_FaceFace::Perform(TopoDS_Face const&, TopoDS_Face const&) at /Users/icsanady/occt_git/occt/src/IntTools/IntTools_FaceFace.cxx:749 13 0x000000010bccb172 in BOPAlgo_FaceFace::Perform() at /Users/icsanady/occt_git/occt/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx:156 14 0x000000010bccab56 in BOPCol_Functor >::operator()(int) const at /Users/icsanady/occt_git/occt/adm/mac/xcd/../../../inc/BOPCol_Parallel.hxx:45 15 0x000000010bcca8f2 in void OSD_Parallel::For > >(int, int, BOPCol_Functor > const&, unsigned int) at /Users/icsanady/occt_git/occt/adm/mac/xcd/../../../inc/OSD_Parallel.hxx:262 16 0x000000010bcc4d2b in BOPCol_Cnt >, BOPCol_NCVector >::Perform(unsigned int, BOPCol_NCVector&) at /Users/icsanady/occt_git/occt/adm/mac/xcd/../../../inc/BOPCol_Parallel.hxx:68 17 0x000000010bcb9cef in BOPAlgo_PaveFiller::PerformFF() at /Users/icsanady/occt_git/occt/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx:270 18 0x000000010bca41c3 in BOPAlgo_PaveFiller::PerformInternal() at /Users/icsanady/occt_git/occt/src/BOPAlgo/BOPAlgo_PaveFiller.cxx:303 19 0x000000010bca3d6d in BOPAlgo_PaveFiller::Perform() at /Users/icsanady/occt_git/occt/src/BOPAlgo/BOPAlgo_PaveFiller.cxx:203
    我知道没有消息来源真的很难提供帮助,但是目前这是我所能提供的最好的服务,而且我真的很固执。我希望至少有人可以给我一些提示。我将尝试提供任何必要的信息。

    最佳答案

    该方法使用以下方法在堆栈上进行大量分配:

    0x10b5701b4:  subq   $0x663e0, %rsp
    

    使用以下方法存储到堆栈时,您的应用程序崩溃了:
    0x10b5701d5:  movq   %rsi, -0x65ba0(%rbp)   //Crashes here
    

    (它使用 RBP 作为帧指针)

    因此,我怀疑堆栈溢出。尝试increasing the stack size for this thread。注意0x663e0是418784字节,这确实是要使用的大量堆栈。

    关于c++ - ARM和Intel发生奇怪的崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28936130/

    相关文章:

    c++ - 比较成员指针

    c++ - 断点 : Break when c++ exception is thrown - why so slow?

    打开 Activity 时Android应用程序崩溃 - 附加堆栈跟踪

    Android VideoView Activity 崩溃

    c++ - Xerces-C 在根名称中放置冒号时失败

    c++ - 如何将独特的项目插入 vector ?

    linux - Linux 汇编中的整数打印

    linux - 您在哪里检查 x86-64 机器上的系统调用原型(prototype)?

    c - 如何通过将各自的部分放在不同的位置来链接两个目标文件?

    ios - NSRangeException with NSArray objectAtIndex,索引超出范围