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

Side by Side Diff: kernel_collector.cc

Issue 6599022: Add ARM support (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/crash-reporter.git@master
Patch Set: Created 9 years, 9 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 | 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 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "crash-reporter/kernel_collector.h" 5 #include "crash-reporter/kernel_collector.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "crash-reporter/system_logging.h" 10 #include "crash-reporter/system_logging.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 hash = hash * 16127 + input[i]; 85 hash = hash * 16127 + input[i];
86 return hash; 86 return hash;
87 } 87 }
88 88
89 void KernelCollector::ProcessStackTrace( 89 void KernelCollector::ProcessStackTrace(
90 pcrecpp::StringPiece kernel_dump, 90 pcrecpp::StringPiece kernel_dump,
91 bool print_diagnostics, 91 bool print_diagnostics,
92 unsigned *hash, 92 unsigned *hash,
93 float *last_stack_timestamp) { 93 float *last_stack_timestamp) {
94 pcrecpp::RE line_re("(.+)", pcrecpp::MULTILINE()); 94 pcrecpp::RE line_re("(.+)", pcrecpp::MULTILINE());
95 pcrecpp::RE stack_trace_start_re(kTimestampRegex + " Call Trace:$"); 95 pcrecpp::RE stack_trace_start_re(kTimestampRegex +
96 " (Call Trace|Backtrace):$");
96 // Match lines such as the following and grab out "error_code". 97 // Match lines such as the following and grab out "error_code".
97 // <4>[ 6066.849504] [<7937bcee>] error_code+0x66/0x6c 98 // <4>[ 6066.849504] [<7937bcee>] ? error_code+0x66/0x6c
99 // The ? may or may not be present
100
101 // For ARM:
102 // <4>[ 3498.731164] [<c0057220>] (__bug+0x20/0x2c) from [<c018062c>]
103 // (write_breakme+0xdc/0x1bc)
98 pcrecpp::RE stack_entry_re(kTimestampRegex + 104 pcrecpp::RE stack_entry_re(kTimestampRegex +
99 " \\[<.*>\\]([\\s\\?]+)([^\\+ ]+)"); 105 "\\s+\\[<[[:xdigit:]]+>\\]" // Matches " [<7937bcee>]"
kmixter1 2011/03/07 23:16:58 This went from hard to understand to really opaque
sjg 2011/03/15 19:39:35 My schange here were: a. to allow 1 or 2 spaces a
kmixter1 2011/03/17 16:53:30 Yeah, I didn't closely enough - it was already opa
106 "([\\s\\?(]+)" // Matches " ? ("
107 "([^\\+ )]+)"); // Matches until \ + space )
100 std::string line; 108 std::string line;
101 std::string hashable; 109 std::string hashable;
102 110
103 *hash = 0; 111 *hash = 0;
104 *last_stack_timestamp = 0; 112 *last_stack_timestamp = 0;
105 113
106 while (line_re.FindAndConsume(&kernel_dump, &line)) { 114 while (line_re.FindAndConsume(&kernel_dump, &line)) {
107 std::string certainty; 115 std::string certainty;
108 std::string function_name; 116 std::string function_name;
109 if (stack_trace_start_re.PartialMatch(line, last_stack_timestamp)) { 117 if (stack_trace_start_re.PartialMatch(line, last_stack_timestamp)) {
(...skipping 27 matching lines...) Expand all
137 printf("Hash based on stack trace: \"%s\" at %f.\n", 145 printf("Hash based on stack trace: \"%s\" at %f.\n",
138 hashable.c_str(), *last_stack_timestamp); 146 hashable.c_str(), *last_stack_timestamp);
139 } 147 }
140 } 148 }
141 149
142 bool KernelCollector::FindCrashingFunction( 150 bool KernelCollector::FindCrashingFunction(
143 pcrecpp::StringPiece kernel_dump, 151 pcrecpp::StringPiece kernel_dump,
144 bool print_diagnostics, 152 bool print_diagnostics,
145 float stack_trace_timestamp, 153 float stack_trace_timestamp,
146 std::string *crashing_function) { 154 std::string *crashing_function) {
147 pcrecpp::RE eip_re(kTimestampRegex + " EIP: \\[<.*>\\] ([^\\+ ]+).*", 155 std::string reg;
156 pcrecpp::RE eip_re(kTimestampRegex + " (EIP: \\[<.*>\\]|PC is at) ([^\\+ ]+).* ",
kmixter1 2011/03/07 23:16:58 Same comment here.
sjg 2011/03/15 19:39:35 I think this is fair enough, and the kernel will n
kmixter1 2011/03/17 16:53:30 You can't rely on libcros/Chrome since it's not ne
148 pcrecpp::MULTILINE()); 157 pcrecpp::MULTILINE());
149 float timestamp = 0; 158 float timestamp = 0;
150 while (eip_re.FindAndConsume(&kernel_dump, &timestamp, crashing_function)) { 159 while (eip_re.FindAndConsume(&kernel_dump, &timestamp, &reg, crashing_function )) {
151 if (print_diagnostics) { 160 if (print_diagnostics) {
152 printf("@%f: found crashing function %s\n", 161 printf("@%f: found crashing function %s\n",
153 timestamp, 162 timestamp,
154 crashing_function->c_str()); 163 crashing_function->c_str());
155 } 164 }
156 } 165 }
157 if (timestamp == 0) { 166 if (timestamp == 0) {
158 if (print_diagnostics) { 167 if (print_diagnostics) {
159 printf("Found no crashing function.\n"); 168 printf("Found no crashing function.\n");
160 } 169 }
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 307
299 logger_->LogInfo("Stored kcrash to %s", 308 logger_->LogInfo("Stored kcrash to %s",
300 kernel_crash_path.value().c_str()); 309 kernel_crash_path.value().c_str());
301 } 310 }
302 if (!ClearPreservedDump()) { 311 if (!ClearPreservedDump()) {
303 return false; 312 return false;
304 } 313 }
305 314
306 return true; 315 return true;
307 } 316 }
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