我遇到了一个有关LLDB修改变量的非常奇怪的问题。对我来说,我听不懂,请帮助我

问题描述 投票:0回答:1

我在第29行设置了断点,并且我想通过LLDB修改该值以使他进入== 1的情况,但是我发现该断点跳到了第33行而没有被击中,这很奇怪。

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        let v = UIView.init(frame: CGRect(x: 100, y: 100, width: 300, height: 300))
        v.backgroundColor = .yellow
        view.addSubview(v)
    }


    override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {

        let value = test()
        print(value)
    }

    func test() -> Bool {
        let m = 3
   29     if m == 1 {
            print(m)
            return true
        } else {
   33        print(m)
            return false
        }
    }
}

Where the breakpoint hit 29 but But the breakpoint jumped to line 33 without hitting

当我将m的值设置为随机数时,断点可以停留在第29行,并且可以修改该值以使他进入不同的状态,这让我感到非常困惑]]

   func test() -> Bool {
        let m = arc4random()
        if m == 1 {
            print(m)
            return true
        } else {
            print(m)
            return false
        }
    }

我在第29行设置了断点,并且我想通过LLDB修改该值以使他进入== 1的情况,但是我发现该断点跳到了第33行而没有被击中,这非常...] >

swift xcode lldb
1个回答
0
投票

很奇怪您没有注意到以下警告

<< img src =“ https://image.soinside.com/eyJ1cmwiOiAiaHR0cHM6Ly9pLnN0YWNrLmltZ3VyLmNvbS92RGlUQy5wbmcifQ==” alt =“在此处输入图像描述”>

© www.soinside.com 2019 - 2024. All rights reserved.