Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(125)

Side by Side Diff: sky/tools/skydb

Issue 878163005: Make skydb --gdb work a bit better on Android (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sky/tools/android_library_cacher.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 from skypy.skyserver import SkyServer 6 from skypy.skyserver import SkyServer
7 import argparse 7 import argparse
8 import json 8 import json
9 import logging 9 import logging
10 import os 10 import os
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 self.pids['sky_server_root'], 119 self.pids['sky_server_root'],
120 self.pids['build_dir']) 120 self.pids['build_dir'])
121 shell_args += ['--origin=%s' % build_dir_url] 121 shell_args += ['--origin=%s' % build_dir_url]
122 122
123 # Desktop-only work-around for mojo crashing under chromoting. 123 # Desktop-only work-around for mojo crashing under chromoting.
124 if not is_android and args.use_osmesa: 124 if not is_android and args.use_osmesa:
125 shell_args.append( 125 shell_args.append(
126 '--args-for=mojo:native_viewport_service --use-osmesa') 126 '--args-for=mojo:native_viewport_service --use-osmesa')
127 127
128 if is_android and args.gdb: 128 if is_android and args.gdb:
129 shell_args.append('--wait_for_debugger') 129 shell_args.append('--wait-for-debugger')
130 130
131 if 'remote_sky_server_port' in self.pids: 131 if 'remote_sky_server_port' in self.pids:
132 shell_command = self._wrap_for_android(shell_args) 132 shell_command = self._wrap_for_android(shell_args)
133 else: 133 else:
134 shell_command = [self.paths.mojo_shell_path] + shell_args 134 shell_command = [self.paths.mojo_shell_path] + shell_args
135 135
136 return shell_command 136 return shell_command
137 137
138 def sky_server_for_args(self, args): 138 def sky_server_for_args(self, args):
139 # FIXME: This is a hack. sky_server should just take a build_dir 139 # FIXME: This is a hack. sky_server should just take a build_dir
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 print "mojo_shell not found in build_dir '%s'" % args.build_dir 173 print "mojo_shell not found in build_dir '%s'" % args.build_dir
174 print "Are you sure you sure that's a valid build_dir location?" 174 print "Are you sure you sure that's a valid build_dir location?"
175 print "See skydb start --help for more info" 175 print "See skydb start --help for more info"
176 sys.exit(2) 176 sys.exit(2)
177 177
178 # FIXME: This is probably not the right way to compute is_android 178 # FIXME: This is probably not the right way to compute is_android
179 # from the build directory? 179 # from the build directory?
180 gn_args = gn_args_from_build_dir(self.paths.build_dir) 180 gn_args = gn_args_from_build_dir(self.paths.build_dir)
181 is_android = 'android_sdk_version' in gn_args 181 is_android = 'android_sdk_version' in gn_args
182 182
183 if is_android and args.gdb and not 'is_debug' in gn_args:
184 # FIXME: We don't include gdbserver in the release APK...
185 print "Cannot debug Release builds on Android"
186 sys.exit(2)
187
183 sky_server = self.sky_server_for_args(args) 188 sky_server = self.sky_server_for_args(args)
184 self.pids['sky_server_pid'] = sky_server.start() 189 self.pids['sky_server_pid'] = sky_server.start()
185 self.pids['sky_server_port'] = sky_server.port 190 self.pids['sky_server_port'] = sky_server.port
186 self.pids['sky_server_root'] = sky_server.root 191 self.pids['sky_server_root'] = sky_server.root
187 192
188 self.pids['build_dir'] = self.paths.build_dir 193 self.pids['build_dir'] = self.paths.build_dir
189 self.pids['sky_command_port'] = args.command_port 194 self.pids['sky_command_port'] = args.command_port
190 195
191 if is_android: 196 if is_android:
192 # We could make installing conditional on an argument. 197 # We could make installing conditional on an argument.
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 self.pids['remote_gdbserver_port'] = GDB_PORT 263 self.pids['remote_gdbserver_port'] = GDB_PORT
259 264
260 if not args.gdb: 265 if not args.gdb:
261 if not self._wait_for_sky_command_port(): 266 if not self._wait_for_sky_command_port():
262 logging.error('Failed to start sky') 267 logging.error('Failed to start sky')
263 self.stop_command(None) 268 self.stop_command(None)
264 else: 269 else:
265 # We could just run gdb_attach_command here, but when I do that 270 # We could just run gdb_attach_command here, but when I do that
266 # it auto-suspends in my zsh. Unclear why. 271 # it auto-suspends in my zsh. Unclear why.
267 # self.gdb_attach_command(args) 272 # self.gdb_attach_command(args)
268 print "Run skydb gdb_attach to attach." 273 print "Run 'skydb gdb_attach' to attach."
269 274
270 def _kill_if_exists(self, key, name): 275 def _kill_if_exists(self, key, name):
271 pid = self.pids.pop(key, None) 276 pid = self.pids.pop(key, None)
272 if not pid: 277 if not pid:
273 logging.info('No pid for %s, nothing to do.' % name) 278 logging.info('No pid for %s, nothing to do.' % name)
274 return 279 return
275 logging.info('Killing %s (%d).' % (name, pid)) 280 logging.info('Killing %s (%d).' % (name, pid))
276 try: 281 try:
277 os.kill(pid, signal.SIGTERM) 282 os.kill(pid, signal.SIGTERM)
278 except OSError: 283 except OSError:
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 load_parser.set_defaults(func=self.load_command) 594 load_parser.set_defaults(func=self.load_command)
590 595
591 args = parser.parse_args() 596 args = parser.parse_args()
592 args.func(args) 597 args.func(args)
593 598
594 self._write_pid_file(PID_FILE_PATH, self.pids) 599 self._write_pid_file(PID_FILE_PATH, self.pids)
595 600
596 601
597 if __name__ == '__main__': 602 if __name__ == '__main__':
598 SkyDebugger().main() 603 SkyDebugger().main()
OLDNEW
« no previous file with comments | « sky/tools/android_library_cacher.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698