LLDB未在正确的行

时间:2015-11-25 10:35:31

标签: c++ xcode debugging breakpoints lldb

这应该服务器来说明问题。我最初试图在Xcode中设置断点,但是当我在LLDB的命令行上设置它们时发现同样的问题:

(lldb) list /Users/jim/Code/breakout-juce/Source/BalLGame.h:300
   300         }
   301     }
   302 
   303     void handleCollision(const Object & other) override
   304     {
   305         if (other.getComponentID() == "paddle")
   306         {
   307             auto & paddle = dynamic_cast<const Paddle&>(other);
   308 
   309             auto positionInPaddle = paddle.getLocalPoint(this, getLocalBounds().getCentre());
   310             auto normal = paddle.getNormal(positionInPaddle.getX());

现在让我在第305行设置一个断点。

(lldb) break set -f /Users/jim/Code/breakout-juce/Source/BalLGame.h -l 305
Breakpoint 4: where = Buzz`Ball::getDamage() const + 12 at BalLGame.h:341, address = 0x00000001000018ac

但是开玩笑 - 它现在在第341行。

这是第341行:

(lldb) list /Users/jim/Code/breakout-juce/Source/BalLGame.h:340
   340 
   341     int getDamage() const { return damage; }
   342 
   343     void tick() override
   344     {
   345         setBounds(getBounds().translated(getDirectionVector().x, getDirectionVector().y));
   346         angle += deltaAngle;
   347     }
   348 
   349     bool isKilled() override { return killed; }
   350 

我们有调试符号:

(lldb) script lldb.target.module['/Users/jim/Code/breakout-juce/Builds/MacOSX/build/Debug/Buzz.app/Contents/MacOS/Buzz'].GetNumCompileUnits()
19

任何想法接下来要检查什么?这是一个调试版本......我刚刚升级到最新的Xcode版本,但它在Xcode 6中也以完全相同的方式失败了。

PS。以下是可爱的编译器选项:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c ++ -arch x86_64 -fmessage-length = 0 -fdiagnostics-show-note-include-stack -fmacro- backtrace-limit = 0 -std = c ++ 11 -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wnon-virtual-dtor- Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value - Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion - Wno-enum-conversion -Wno-shorten-64-to-32 -Wno-newline-eof -Wno-c ++ 11-extensions -D_DEBUG = 1 -DDEBUG = 1 -DJUCER_XCODE_MAC_F6D2F4CF = 1 -DJUCE_APP_VERSION = 1.0.0 -DJUCE_APP_VERSION_HEX = 0x10000 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk - fasm-blocks -fstrict-aliasing -Wdeprecated-declarations -Winvalid-offsetof -mmacosx-version-min = 10.10 -g -fvisibility = hidden -fvisibility-inlines-hidden -Wno-sign-conversion -iquote / Users / jim / Library / Developer / Xcode / DerivedData / Buzz-gymosgfspfkofkhbahhngwelyhbv / Build / Intermediates / Buzz.build / Debug / Buzz.build / Buzz-generated-files.hmap -I / Users / jim / Library / Developer / Xcode / DerivedData / Buzz-gymosgfspfkofkhbahhngwelyhbv / Build / Intermediates / Buzz.build / Debug / Buzz.build / Buzz-own-target-headers.hmap -I / Users / jim / Library / Developer / Xcode / DerivedData / Buzz-gymosgfspfkofkhbahhngwelyhbv / Build / Intermediates / Buzz.build / Debug / Buzz.build / Buzz-all-target-headers.hmap -iquote /Users/jim/Library/Developer/Xcode/DerivedData/Buzz-gymosgfspfkofkhbahhngwelyhbv/Build/Intermediates/Buzz.build/Debug/Buzz.build/Buzz- project-headers.hmap -I / Users / jim / Code / breakout-juce / Builds / MacOSX / build / Debug / include -I ../../ JuceLibraryCode -I ../../../ juce / modules -I /用户/吉姆/库/开发商/ Xcode中/ DerivedData /巴兹 - gymosgfspfko fkhbahhngwelyhbv / Build / Intermediates / Buzz.build / Debug / Buzz.build / DerivedSources / x86_64 -I / Users / jim / Library / Developer / Xcode / DerivedData / Buzz-gymosgfspfkofkhbahhngwelyhbv / Build / Intermediates / Buzz.build / Debug / Buzz。 build / DerivedSources -Wreorder -F / Users / jim / Code / breakout-juce / Builds / MacOSX / build / Debug -MMD -MT dependencies -MF / Users / jim / Library / Developer / Xcode / DerivedData / Buzz-gymosgfspfkofkhbahhngwelyhbv / Build /Intermediates/Buzz.build/Debug/Buzz.build/Objects-normal/x86_64/BalLGame.d-serialize- diagnostics / Users / jim / Library / Developer / Xcode / DerivedData / Buzz-gymosgfspfkofkhbahhngwelyhbv / Build / Intermediates / Buzz。 build / Debug / Buzz.build / Objects-normal / x86_64 / BalLGame.dia -c /Users/jim/Code/breakout-juce/Source/BalLGame.cpp -o / Users / jim / Library / Developer / Xcode / DerivedData /蜂鸣gymosgfspfkofkhbahhngwelyhbv /建造/中间体/ Buzz.build /调试/ Buzz.build /对象 - 正常/ x86_64的/ BalLGame.o

2 个答案:

答案 0 :(得分:2)

如果在不生成任何可执行代码的源代码行上设置断点(例如注释,#ifdef'ed out行,一个永不使用的非导出函数)lldb将移动断点到生成可执行代码的下一个源代码行,它可能在不同的函数中。

无法从源剪辑中确定,但如果getDamage是handleCollision之后的下一个函数,那么如果没有为handleCollision发出代码,则会解释断点运动。如果你这样做:

(lldb) image lookup -n ClassName::handleCollision

或者如果你想咨询lldb以外的东西:

$ nm <Binary> | grep handleCollision

他们是否表明该功能实际上有一个符号?

答案 1 :(得分:0)

尝试将Xcode升级到最新版本,如果您使用Xcode 7.1或更低版本,可能会有很多错误我正在使用Xcode 7.1.1而且没有任何问题