2 # Copyright (c) 2015 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
26 def ApplicationIdentifier(path
):
27 identifier
= subprocess
.check_output(PLIST_BUDDY_PATH
+ [
29 'Print CFBundleIdentifier',
30 '%s/Info.plist' % path
,
32 return identifier
.strip()
36 return subprocess
.check_call(SIMCTL_PATH
+ [
43 def InstallLaunchAndWait(args
, wait
):
49 identifier
= ApplicationIdentifier(args
.path
)
51 launch_args
= [ 'launch' ]
54 launch_args
+= [ '-w' ]
61 return subprocess
.check_output(SIMCTL_PATH
+ launch_arg
).strip()
65 InstallLaunchAndWait(args
, False)
69 launch_res
= InstallLaunchAndWait(args
, True)
70 launch_pid
= re
.search('.*: (\d+)', launch_res
).group(1)
71 return os
.system(' '.join([
76 os
.path
.join(os
.path
.dirname(__file__
), 'lldb_start_commands.txt'),
83 parser
= argparse
.ArgumentParser(description
='A script that launches an'
84 ' application in the simulator and attaches'
85 ' the debugger to the same')
87 parser
.add_argument('-p', dest
='path', required
=True,
88 help='Path the the simulator application')
90 subparsers
= parser
.add_subparsers()
92 launch_parser
= subparsers
.add_parser('launch', help='Launch')
93 launch_parser
.set_defaults(func
=Launch
)
95 install_parser
= subparsers
.add_parser('install', help='Install')
96 install_parser
.set_defaults(func
=Install
)
98 debug_parser
= subparsers
.add_parser('debug', help='Debug')
99 debug_parser
.set_defaults(func
=Debug
)
101 args
= parser
.parse_args()
102 return args
.func(args
)
105 if __name__
== '__main__':