代码之家  ›  专栏  ›  技术社区  ›  Lance Samaria

swift-是否有方法触发程序断点以在其停止后继续

  •  0
  • Lance Samaria  · 技术社区  · 6 年前

    跟随 this answer 我可以在代码中创建断点。

    func sayHello() {
    
        raise(SIGTRAP) // programmatic breakpoint
        kill(getpid(), SIGSTOP)  // programmatic breakpoint
    
        print("say hello")
    }
    

    使用这两个函数中的任何一个都会停止执行,并且永远不会打印“say hello”。

    与我能够以编程方式创建断点的方法相同,是否有一种方法可以以编程方式创建其他内容,以便在这两个断点中的任何一个被命中后继续执行?

    1 回复  |  直到 6 年前
        1
  •  1
  •   matt    6 年前

    你要找的功能是内置的。这里有一个断点,打印“here”并继续:

    enter image description here

    推荐文章