【问题标题】:XCode 4 Debugger: Attach to process from command lineXCode 4 调试器:从命令行附加到进程
【发布时间】:2013-08-14 15:07:54
【问题描述】:

我想从命令行启动一个应用程序并立即将 XCode 4 中的图形调试器附加到它,而无需单击 Xcode 菜单 Product->Attach To Progress。是否可以使用 bash 或 Apple 脚本编写脚本?

【问题讨论】:

    标签: xcode shell debugging process applescript


    【解决方案1】:

    这似乎适用于 Xcode-Beta 版本 6.2 (6C121)。对于 Xcode,只需将“Xcode-Beta”更改为 Xcode。此外,您需要将流程名称“Staging”更改为您要附加的流程。

    tell application "Xcode-Beta"
    activate
    end tell
    
    tell application "System Events"
        tell application process "Xcode"
            click (menu item "By Process Identifier (PID) or Name…" of menu 1 of menu item "Attach to Process" of menu 1 of menu bar item "Debug" of menu bar 1)
        end tell
        tell application process "Xcode"
            set value of text field 1 of sheet 1 of window 1 to "Staging"
        end tell
        tell application process "Xcode"
            click button "Attach" of sheet 1 of window 1
        end tell
    end tell
    

    【讨论】:

      【解决方案2】:

      为 Xcode 12 工作

      tell application "Xcode"
          activate
      end tell
      
      tell application "System Events"
          tell application process "Xcode"
              click (menu item "Attach to Process by PID or Name…" of menu 1 of menu bar item "Debug" of menu bar 1)
              
          end tell
          tell application process "Xcode"
              set value of text field 1 of sheet 1 of window 1 to "Your App/Process Name"
          end tell
          tell application process "Xcode"
              click button "Attach" of sheet 1 of window 1
          end tell
      end tell
      
      tell application "our App/Process Name"
          activate
      end tell
      

      【讨论】:

        猜你喜欢
        • 2013-12-08
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-07-31
        • 2016-08-20
        • 2011-07-21
        • 1970-01-01
        • 2010-12-15
        相关资源
        最近更新 更多