GCC debugger stack trace displays wrong file name and line number

后端 未结 11 1952
说谎
说谎 2021-01-21 00:22

I am trying to port a fairly large C++ project to using g++ 4.0 on Mac OS X. My project compiles without errors, but I can\'t get GDB to work properly. When I look at the stack

11条回答
  •  攒了一身酷
    2021-01-21 00:45

    I've tried compiling an XCode SDL project template and did not experience the same problem, so it must be due to something special in my project.

    Correct. Your project settings are the thing that is different.

    You will need to disable the debug optimizations in the Xcode project settings for the debug build. Xcode unfortunately makes GDB jump to weird lines (out of order) when you would expect it to move sequentially.

    Go to your project settings. Set the following

    1) Instruction Scheduling   = None
    2) Optimization Level       = None [-O0]
    3) ZERO_LINK                = None
    

    Your problems should go after after doing this. Here is the project settings screen that you need to change the settings on:

提交回复
热议问题