OLD | NEW |
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/user_collector.h" | 5 #include "crash-reporter/user_collector.h" |
6 | 6 |
7 #include <grp.h> // For struct group. | 7 #include <grp.h> // For struct group. |
8 #include <pwd.h> // For struct passwd. | 8 #include <pwd.h> // For struct passwd. |
9 #include <sys/types.h> // For getpwuid_r and getgrnam_r. | 9 #include <sys/types.h> // For getpwuid_r and getgrnam_r. |
10 | 10 |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 | 268 |
269 bool conversion_result = true; | 269 bool conversion_result = true; |
270 if (!ConvertCoreToMinidump(core_path, | 270 if (!ConvertCoreToMinidump(core_path, |
271 container_dir, // procfs directory | 271 container_dir, // procfs directory |
272 minidump_path, | 272 minidump_path, |
273 container_dir)) { // temporary directory | 273 container_dir)) { // temporary directory |
274 // Note we leave the container directory for inspection. | 274 // Note we leave the container directory for inspection. |
275 conversion_result = false; | 275 conversion_result = false; |
276 } | 276 } |
277 | 277 |
| 278 WriteCrashMetaData( |
| 279 crash_path.Append( |
| 280 StringPrintf("%s.meta", dump_basename.c_str())), |
| 281 exec_name); |
| 282 |
278 if (conversion_result) { | 283 if (conversion_result) { |
279 logger_->LogInfo("Stored minidump to %s", minidump_path.value().c_str()); | 284 logger_->LogInfo("Stored minidump to %s", minidump_path.value().c_str()); |
280 } | 285 } |
281 | 286 |
282 if (!file_util::PathExists(FilePath(kLeaveCoreFile))) { | 287 if (!file_util::PathExists(FilePath(kLeaveCoreFile))) { |
283 file_util::Delete(core_path, false); | 288 file_util::Delete(core_path, false); |
284 } else { | 289 } else { |
285 logger_->LogInfo("Leaving core file at %s", core_path.value().c_str()); | 290 logger_->LogInfo("Leaving core file at %s", core_path.value().c_str()); |
286 } | 291 } |
287 | 292 |
288 return conversion_result; | 293 return conversion_result; |
289 } | 294 } |
290 | 295 |
291 bool UserCollector::HandleCrash(int signal, int pid, const char *force_exec) { | 296 bool UserCollector::HandleCrash(int signal, int pid, const char *force_exec) { |
292 CHECK(initialized_); | 297 CHECK(initialized_); |
293 std::string exec; | 298 std::string exec; |
294 if (force_exec) { | 299 if (force_exec) { |
295 exec.assign(force_exec); | 300 exec.assign(force_exec); |
296 } else if (!GetExecutableBaseNameFromPid(pid, &exec)) { | 301 } else if (!GetExecutableBaseNameFromPid(pid, &exec)) { |
297 // If for some reason we don't have the base name, avoid completely | 302 // If for some reason we don't have the base name, avoid completely |
298 // failing by indicating an unknown name. | 303 // failing by indicating an unknown name. |
299 exec = "unknown"; | 304 exec = "unknown"; |
300 } | 305 } |
301 logger_->LogWarning("Received crash notification for %s[%d] sig %d", | 306 bool feedback = is_feedback_allowed_function_(); |
302 exec.c_str(), pid, signal); | 307 logger_->LogWarning("Received crash notification for %s[%d] sig %d (%s)", |
| 308 exec.c_str(), pid, signal, |
| 309 feedback ? "handling" : "ignoring"); |
303 | 310 |
304 if (is_feedback_allowed_function_()) { | 311 if (feedback) { |
305 count_crash_function_(); | 312 count_crash_function_(); |
306 | 313 |
307 if (generate_diagnostics_) { | 314 if (generate_diagnostics_) { |
308 return GenerateDiagnostics(pid, exec); | 315 return GenerateDiagnostics(pid, exec); |
309 } | 316 } |
310 } | 317 } |
311 return true; | 318 return true; |
312 } | 319 } |
OLD | NEW |