OLD | NEW |
---|---|
(Empty) | |
1 # Copyright (c) 2011 The Chromium OS Authors. All rights reserved. | |
kmixter1
2011/03/03 01:49:54
Can we name this differently? "crash_collector" is
thieule
2011/03/03 02:22:45
Unfortunately, the name is dictated by autotest in
| |
2 # Use of this source code is governed by a BSD-style license that can be | |
3 # found in the LICENSE file. | |
4 | |
5 import logging | |
6 import os | |
7 from autotest_lib.client.common_lib import utils as client_utils | |
8 from autotest_lib.server import utils | |
9 | |
10 def generate_minidump_stacktrace(minidump_path): | |
11 """ | |
12 Generates a stacktrace for the specified minidump. | |
13 | |
14 This function expects the debug symbols to reside under: | |
15 /build/<board>/usr/lib/debug | |
16 """ | |
17 symbol_dir = '%s/../../../lib/debug' % utils.get_server_dir() | |
18 logging.info('symbol_dir: %s' % symbol_dir) | |
19 result = client_utils.run('minidump_stackwalk %s %s > %s.txt' % | |
20 (minidump_path, symbol_dir, minidump_path)) | |
21 return result.exit_status | |
22 | |
23 | |
24 def find_and_generate_minidump_stacktraces(host): | |
25 """ | |
26 Finds all minidump files and generates a stack trace for each. | |
27 | |
28 Enumerates all files under the test results directory (recursively) | |
29 and generates a stack trace file for the minidumps. Minidump files are | |
30 identified as files with .dmp extension. The stack trace filename is | |
31 composed by appending the .txt extension to the minidump filename. | |
32 """ | |
33 host_resultdir = getattr(getattr(host, "job", None), "resultdir", None) | |
34 for dir, subdirs, files in os.walk(host_resultdir): | |
35 for file in files: | |
36 if not file.endswith('.dmp'): | |
37 continue | |
38 minidump = os.path.join(dir, file) | |
39 rc = generate_minidump_stacktrace(minidump) | |
40 if rc == 0: | |
41 logging.info('Generated stack trace for dump %s' % | |
42 minidump) | |
43 else: | |
44 logging.error('Failed to generate stack trace for ' \ | |
45 'dump %s (rc=%d)' % (minidump, rc)) | |
46 | |
47 | |
48 def get_site_crashdumps(host, test_start_time): | |
49 find_and_generate_minidump_stacktraces(host) | |
OLD | NEW |