繁体   English   中英

LLDB没有在正确的行上设置断点

[英]LLDB is not setting breakpoints at the correct line

这应该用服务器来说明问题。 我最初试图在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-时间破坏因素-无括号-括号-Wswitch-无使用的功能-无使用的标签-无使用的参数-无用的变量-无用的值-无空的主体-无用的未初始化- Wno-unknown-pragmas -Wno-shadow-Wno-四个字符常量-Wno-conversion-Wno-constant-conversion-Wno-int-conversion-Wno-bool-conversion-Wno-enum-conversion-Wno-shorten- 64到32 -Wno-换行符-Wno-c ++ 11扩展-D_DEBUG = 1 -DDEBUG = 1 -DJUCER_XCODE_MAC_F6D2F4CF = 1 -DJUCE_APP_VERSION = 1.0.0 -DJUCE_APP_VERSION_HEX = 0x10000 -isysroot / Applications / Xcode。 /Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -fasm-blocks -fstrict -aliasing -Wdeprecated-clarification -Winvalid-offset -mmacosx-version-min = 10.10 -g -fvisibility = hidden -fvisibility-inlines-hidden -Wno-sign-conversion -iquote / Users / jim / Limary / Library / Developer / Xcode / DerivedData /Buzz-gymosgfspfkofkhbahhngwelyhbv/Build/Intermediates/Buzz.build/Debug/Buzz.build/Buzz-produced-files.hmap -I / Users / jim / Library / Developer / Xcode / DerivedData / Buzz-gymosgfspfkofkhbahhngwelyhtes .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 /用户/ jim /代码/ breakout-juce / Builds / MacOSX / build / Debug / include -I ../../ JuceLibraryCode -I ../../../ juce / modules -I / Users /吉姆/库/开发商/ Xcode中/ DerivedData /巴兹 - gymosgfspfkofkhbahhngwelyhbv /裴 ld / 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依赖项-MF / Users / jim / Library / Developer / Xcode / DerivedData / Buzz-gymosgfspfkofkhbahhngwelyhbv / Build / Intermediates /Buzz.build/Debug/Buzz.build/Objects-normal/x86_64/BalLGame.d-串行化诊断/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 / Buzz- gymosgfspfkofkhbahhngwelyhbv /生成/中间体/ Buzz.build /调试/ Buzz.build /对象 - 正常/ x86_64的/ BalLGame.o

如果您在不生成任何可执行代码的源代码行上设置断点(例如,注释,#ifdef'ed行,从未使用过的非导出函数),则lldb会将断点移至下一个生成可执行代码的源代码行,这些代码可能具有不同的功能。

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

(lldb) image lookup -n ClassName::handleCollision

或者,如果您想咨询lldb以外的内容:

$ nm <Binary> | grep handleCollision

他们显示该功能实际上有一个符号吗?

尝试将Xcode升级到最新版本,如果您使用Xcode 7.1或更低版本,则可能是我在使用Xcode 7.1.1时遇到了许多错误,并且没有任何问题

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM