How to debug dylib with Xcode?

后端 未结 2 1784
死守一世寂寞
死守一世寂寞 2021-02-04 18:25

I have a Xcode project for library arith. I could build it with debug configuration, and I need to debug it. How can I do that?

The ideal method would be to set up a test

2条回答
  •  不知归路
    2021-02-04 19:20

    I faced the same problem and no one of the previous answer worked for my case so I share my solution (for Xcode):

    If you need to debug a c/c++ dylib which is loaded by an external (executable) program:

    1. First be sure that your dylib is build with the same architecture as your external program.
    2. Then Go to --> Product —>Scheme—>Edit scheme
    3. Got to Tab Run(Debug) and check "Debug Executable" , then select into the dropdown button your external program as executable. Then check "Launch Automatically"
    4. Additionally if you program needs extra argument you can add it into the "Arguments" tab.
    5. Finally you set some breakpoints to your c source file and finally click run.

提交回复
热议问题