OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import skypy.paths | 6 import skypy.paths |
7 from skypy.skyserver import SkyServer | 7 from skypy.skyserver import SkyServer |
8 import argparse | 8 import argparse |
9 import json | 9 import json |
10 import logging | 10 import logging |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 ] | 108 ] |
109 # FIXME: This probably is wrong for android? | 109 # FIXME: This probably is wrong for android? |
110 if args.use_osmesa: | 110 if args.use_osmesa: |
111 shell_args.append('--args-for=mojo:native_viewport_service --use-osm
esa') | 111 shell_args.append('--args-for=mojo:native_viewport_service --use-osm
esa') |
112 | 112 |
113 if 'remote_sky_server_port' in self.pids: | 113 if 'remote_sky_server_port' in self.pids: |
114 shell_command = self._wrap_for_android(shell_args) | 114 shell_command = self._wrap_for_android(shell_args) |
115 else: | 115 else: |
116 shell_command = [self.paths.mojo_shell_path] + shell_args | 116 shell_command = [self.paths.mojo_shell_path] + shell_args |
117 | 117 |
118 # FIXME: This doesn't work for android | |
119 if args.gdb: | |
120 shell_command = ['gdb'] + shell_command | |
121 | |
122 return shell_command | 118 return shell_command |
123 | 119 |
124 def _connect_to_device(self): | 120 def _connect_to_device(self): |
125 device = android_commands.AndroidCommands( | 121 device = android_commands.AndroidCommands( |
126 android_commands.GetAttachedDevices()[0]) | 122 android_commands.GetAttachedDevices()[0]) |
127 device.EnableAdbRoot() | 123 device.EnableAdbRoot() |
128 return device | 124 return device |
129 | 125 |
130 def sky_server_for_args(self, args): | 126 def sky_server_for_args(self, args): |
131 # FIXME: This is a hack. sky_server should just take a build_dir | 127 # FIXME: This is a hack. sky_server should just take a build_dir |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 port_string = 'tcp:%s' % args.command_port | 170 port_string = 'tcp:%s' % args.command_port |
175 subprocess.check_call([ | 171 subprocess.check_call([ |
176 'adb', 'forward', port_string, port_string | 172 'adb', 'forward', port_string, port_string |
177 ]) | 173 ]) |
178 self.pids['remote_sky_command_port'] = args.command_port | 174 self.pids['remote_sky_command_port'] = args.command_port |
179 | 175 |
180 shell_command = self._build_mojo_shell_command(args) | 176 shell_command = self._build_mojo_shell_command(args) |
181 print ' '.join(map(pipes.quote, shell_command)) | 177 print ' '.join(map(pipes.quote, shell_command)) |
182 self.pids['mojo_shell_pid'] = subprocess.Popen(shell_command).pid | 178 self.pids['mojo_shell_pid'] = subprocess.Popen(shell_command).pid |
183 | 179 |
| 180 if args.gdb: |
| 181 print "Sorry, I'm not sure how best to wire up --gdb to work" |
| 182 print "with mojo_shell as a background process. For now use:" |
| 183 print "gdb --pid %s" % self.pids['mojo_shell_pid'] |
| 184 shell_command = ['gdb'] + shell_command |
| 185 |
184 if not self._wait_for_sky_command_port(): | 186 if not self._wait_for_sky_command_port(): |
185 logging.error('Failed to start sky') | 187 logging.error('Failed to start sky') |
186 self.stop_command(None) | 188 self.stop_command(None) |
187 else: | 189 else: |
188 self.load_command(args) | 190 self.load_command(args) |
189 | 191 |
190 def _kill_if_exists(self, key, name): | 192 def _kill_if_exists(self, key, name): |
191 pid = self.pids.pop(key, None) | 193 pid = self.pids.pop(key, None) |
192 if not pid: | 194 if not pid: |
193 logging.info('No pid for %s, nothing to do.' % name) | 195 logging.info('No pid for %s, nothing to do.' % name) |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 load_parser.set_defaults(func=self.load_command) | 331 load_parser.set_defaults(func=self.load_command) |
330 | 332 |
331 args = parser.parse_args() | 333 args = parser.parse_args() |
332 args.func(args) | 334 args.func(args) |
333 | 335 |
334 self._write_pid_file(PID_FILE_PATH, self.pids) | 336 self._write_pid_file(PID_FILE_PATH, self.pids) |
335 | 337 |
336 | 338 |
337 if __name__ == '__main__': | 339 if __name__ == '__main__': |
338 SkyDebugger().main() | 340 SkyDebugger().main() |
OLD | NEW |