簡體   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