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

Side by Side Diff: chrome/tools/process_dumps_linux.py

Issue 342030: Add a dump-file option to process_dumps_linux.py (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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/python 1 #!/usr/bin/python
2 # Copyright (c) 2009 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2009 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 """A tool to collect crash signatures for Chrome builds on Linux.""" 6 """A tool to collect crash signatures for Chrome builds on Linux."""
7 7
8 import fnmatch 8 import fnmatch
9 import optparse 9 import optparse
10 import os 10 import os
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 symbol_dir = options.symbol_dir 215 symbol_dir = options.symbol_dir
216 if not options.symbol_dir: 216 if not options.symbol_dir:
217 symbol_dir = os.curdir 217 symbol_dir = os.curdir
218 symbol_dir = os.path.abspath(os.path.expanduser(symbol_dir)) 218 symbol_dir = os.path.abspath(os.path.expanduser(symbol_dir))
219 symbol_file = os.path.join(symbol_dir, symbol_file) 219 symbol_file = os.path.join(symbol_dir, symbol_file)
220 if not os.path.exists(symbol_file): 220 if not os.path.exists(symbol_file):
221 print 'Cannot find symbols.' 221 print 'Cannot find symbols.'
222 return 1 222 return 1
223 symbol_time = os.path.getmtime(symbol_file) 223 symbol_time = os.path.getmtime(symbol_file)
224 224
225 dump_dir = options.dump_dir 225 dump_files = []
226 if not dump_dir: 226 if options.dump_file:
227 dump_dir = GetCrashDumpDir() 227 dump_files.append(options.dump_file)
228 if not dump_dir: 228 else:
229 print 'Cannot find dump dir.' 229 dump_dir = options.dump_dir
230 return 1 230 if not dump_dir:
231 dump_dir = GetCrashDumpDir()
232 if not dump_dir:
233 print 'Cannot find dump files.'
234 return 1
235 for dump_file in LocateFiles(pattern='*.dmp', root=dump_dir):
236 file_time = os.path.getmtime(dump_file)
237 if file_time < symbol_time:
238 # Ignore dumps older than symbol file.
239 continue
240 dump_files.append(dump_file)
231 241
232 temp_dir = tempfile.mkdtemp(suffix='chromedump') 242 temp_dir = tempfile.mkdtemp(suffix='chromedump')
233 if not VerifySymbolAndCopyToTempDir(symbol_file, temp_dir): 243 if not VerifySymbolAndCopyToTempDir(symbol_file, temp_dir):
234 print 'Cannot parse symbols.' 244 print 'Cannot parse symbols.'
235 shutil.rmtree(temp_dir) 245 shutil.rmtree(temp_dir)
236 return 1 246 return 1
237 247
238 dump_count = 0 248 dump_count = 0
239 for dump_file in LocateFiles(pattern='*.dmp', root=dump_dir): 249 for dump_file in dump_files:
240 file_time = os.path.getmtime(dump_file)
241 if file_time < symbol_time:
242 # Ignore dumps older than symbol file.
243 continue
244 processed_dump_file = ProcessDump(dump_file, temp_dir) 250 processed_dump_file = ProcessDump(dump_file, temp_dir)
245 if not processed_dump_file: 251 if not processed_dump_file:
246 continue 252 continue
247 print '-------------------------' 253 print '-------------------------'
248 print GetStackTrace(processor_bin, temp_dir, processed_dump_file) 254 print GetStackTrace(processor_bin, temp_dir, processed_dump_file)
249 print 255 print
250 os.remove(processed_dump_file) 256 os.remove(processed_dump_file)
251 dump_count += 1 257 dump_count += 1
252 258
253 shutil.rmtree(temp_dir) 259 shutil.rmtree(temp_dir)
254 print '%s dumps found' % dump_count 260 print '%s dumps found' % dump_count
255 return 0 261 return 0
256 262
257 263
258 if '__main__' == __name__: 264 if '__main__' == __name__:
259 parser = optparse.OptionParser() 265 parser = optparse.OptionParser()
260 parser.add_option('', '--processor-dir', type='string', default='', 266 parser.add_option('', '--processor-dir', type='string', default='',
261 help='The directory where the processor is installed. ' 267 help='The directory where the processor is installed. '
262 'The processor is used to get stack trace from dumps. ' 268 'The processor is used to get stack trace from dumps. '
263 'Searches $PATH by default') 269 'Searches $PATH by default')
270 parser.add_option('', '--dump-file', type='string', default='',
271 help='The path of the dump file to be processed.'
272 'Overwrites dump-path')
264 parser.add_option('', '--dump-dir', type='string', default='', 273 parser.add_option('', '--dump-dir', type='string', default='',
265 help='The directory where dump files are stored. ' 274 help='The directory where dump files are stored. '
266 'Searches the Chromium crash directory by default.') 275 'Searches this directory if dump-file is not'
Lei Zhang 2009/10/28 23:17:25 nit, you need an extra space after not.
276 'specified. Default is the Chromium crash directory.')
267 parser.add_option('', '--symbol-dir', default='', 277 parser.add_option('', '--symbol-dir', default='',
268 help='The directory with the symbols file. [Required]') 278 help='The directory with the symbols file. [Required]')
269 parser.add_option('', '--architecture', type='int', default=None, 279 parser.add_option('', '--architecture', type='int', default=None,
270 help='Override automatic x86/x86-64 detection. ' 280 help='Override automatic x86/x86-64 detection. '
271 'Valid values are 32 and 64') 281 'Valid values are 32 and 64')
272 282
273 (options, args) = parser.parse_args() 283 (options, args) = parser.parse_args()
274 284
275 if sys.platform == 'linux2': 285 if sys.platform == 'linux2':
276 sys.exit(main_linux(options, args)) 286 sys.exit(main_linux(options, args))
277 else: 287 else:
278 sys.exit(1) 288 sys.exit(1)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698