Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(42)

Side by Side Diff: processor/minidump_stackwalk.cc

Issue 534002: Keeping track of modules without symbols during crash report processing (Closed) Base URL: http://google-breakpad.googlecode.com/svn/trunk/src/
Patch Set: Forgot to update the module list in the unittest. Created 12 years ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « processor/minidump_processor.cc ('k') | processor/process_state.cc » ('j') | 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 Google Inc. 1 // Copyright (c) 2010 Google Inc.
2 // All rights reserved. 2 // All rights reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // * Redistributions of source code must retain the above copyright 8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer. 9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above 10 // * Redistributions in binary form must reproduce the above
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 kOutputSeparator, // empty function name 326 kOutputSeparator, // empty function name
327 kOutputSeparator, // empty source file 327 kOutputSeparator, // empty source file
328 kOutputSeparator, // empty source line 328 kOutputSeparator, // empty source line
329 kOutputSeparator, 329 kOutputSeparator,
330 instruction_address); 330 instruction_address);
331 } 331 }
332 printf("\n"); 332 printf("\n");
333 } 333 }
334 } 334 }
335 335
336 static void PrintModules(const CodeModules *modules) { 336 // IsModuleMissingSymbols checks whether a given |module| is in
337 // |modules_without_symbols|.
338 static bool IsModuleMissingSymbols(
339 const CodeModule *module,
340 const vector<const CodeModule*> *modules_without_symbols) {
341 assert(module);
342 assert(modules_without_symbols);
343 if (module->debug_file().empty() || module->debug_identifier().empty()) {
344 // Not enough information to identify the module
345 return false;
346 }
347 vector<const CodeModule*>::const_iterator iter;
348 for (iter = modules_without_symbols->begin();
349 iter != modules_without_symbols->end();
350 ++iter) {
351 if (module->debug_file().compare((*iter)->debug_file()) == 0 &&
352 module->debug_identifier().compare((*iter)->debug_identifier()) == 0) {
353 // Stackwalker reported that this module is missing symbols
354 return true;
355 }
356 }
357 // Either symbols for this module were present or they were not required at
358 // all.
359 return false;
360 }
361
362 // PrintModule prints a single |module| to stdout.
363 // |modules_without_symbols| should contain the list of modules that were
364 // confrimed to be missing their symbols during the stack walk.
Jess 2013/03/05 01:39:43 confrimed -> confirmed
Ivan Penkov 2013/03/05 02:29:23 Done.
365 static void PrintModule(
366 const CodeModule *module,
367 const vector<const CodeModule*> *modules,
368 u_int64_t main_address) {
369 string missing_symbols;
370 if (IsModuleMissingSymbols(module, modules)) {
371 missing_symbols = "(WARNING: No symbols, " +
372 PathnameStripper::File(module->debug_file()) + ", " +
373 module->debug_identifier() + ")";
374 }
375 u_int64_t base_address = module->base_address();
376 printf("0x%08" PRIx64 " - 0x%08" PRIx64 " %s %s%s %s\n",
377 base_address, base_address + module->size() - 1,
378 PathnameStripper::File(module->code_file()).c_str(),
379 module->version().empty() ? "???" : module->version().c_str(),
380 main_address != 0 && base_address == main_address ? " (main)" : "",
381 missing_symbols.c_str());
382 }
383
384 // PrintModules prints the list of all loaded |modules| to stdout.
385 // |modules_without_symbols| should contain the list of modules that were
386 // confrimed to be missing their symbols during the stack walk.
Jess 2013/03/05 01:39:43 Ditto
Ivan Penkov 2013/03/05 02:29:23 Done.
387 static void PrintModules(
388 const CodeModules *modules,
389 const vector<const CodeModule*> *modules_without_symbols) {
337 if (!modules) 390 if (!modules)
338 return; 391 return;
339 392
340 printf("\n"); 393 printf("\n");
341 printf("Loaded modules:\n"); 394 printf("Loaded modules:\n");
342 395
343 u_int64_t main_address = 0; 396 u_int64_t main_address = 0;
344 const CodeModule *main_module = modules->GetMainModule(); 397 const CodeModule *main_module = modules->GetMainModule();
345 if (main_module) { 398 if (main_module) {
346 main_address = main_module->base_address(); 399 main_address = main_module->base_address();
347 } 400 }
348 401
349 unsigned int module_count = modules->module_count(); 402 unsigned int module_count = modules->module_count();
350 for (unsigned int module_sequence = 0; 403 for (unsigned int module_sequence = 0;
351 module_sequence < module_count; 404 module_sequence < module_count;
352 ++module_sequence) { 405 ++module_sequence) {
353 const CodeModule *module = modules->GetModuleAtSequence(module_sequence); 406 const CodeModule *module = modules->GetModuleAtSequence(module_sequence);
354 u_int64_t base_address = module->base_address(); 407 PrintModule(module, modules_without_symbols, main_address);
355 printf("0x%08" PRIx64 " - 0x%08" PRIx64 " %s %s%s\n",
356 base_address, base_address + module->size() - 1,
357 PathnameStripper::File(module->code_file()).c_str(),
358 module->version().empty() ? "???" : module->version().c_str(),
359 main_module != NULL && base_address == main_address ?
360 " (main)" : "");
361 } 408 }
362 } 409 }
363 410
364 // PrintModulesMachineReadable outputs a list of loaded modules, 411 // PrintModulesMachineReadable outputs a list of loaded modules,
365 // one per line, in the following machine-readable pipe-delimited 412 // one per line, in the following machine-readable pipe-delimited
366 // text format: 413 // text format:
367 // Module|{Module Filename}|{Version}|{Debug Filename}|{Debug Identifier}| 414 // Module|{Module Filename}|{Version}|{Debug Filename}|{Debug Identifier}|
368 // {Base Address}|{Max Address}|{Main} 415 // {Base Address}|{Max Address}|{Main}
369 static void PrintModulesMachineReadable(const CodeModules *modules) { 416 static void PrintModulesMachineReadable(const CodeModules *modules) {
370 if (!modules) 417 if (!modules)
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 int thread_count = process_state.threads()->size(); 489 int thread_count = process_state.threads()->size();
443 for (int thread_index = 0; thread_index < thread_count; ++thread_index) { 490 for (int thread_index = 0; thread_index < thread_count; ++thread_index) {
444 if (thread_index != requesting_thread) { 491 if (thread_index != requesting_thread) {
445 // Don't print the crash thread again, it was already printed. 492 // Don't print the crash thread again, it was already printed.
446 printf("\n"); 493 printf("\n");
447 printf("Thread %d\n", thread_index); 494 printf("Thread %d\n", thread_index);
448 PrintStack(process_state.threads()->at(thread_index), cpu); 495 PrintStack(process_state.threads()->at(thread_index), cpu);
449 } 496 }
450 } 497 }
451 498
452 PrintModules(process_state.modules()); 499 PrintModules(process_state.modules(),
500 process_state.modules_without_symbols());
453 } 501 }
454 502
455 static void PrintProcessStateMachineReadable(const ProcessState& process_state) 503 static void PrintProcessStateMachineReadable(const ProcessState& process_state)
456 { 504 {
457 // Print OS and CPU information. 505 // Print OS and CPU information.
458 // OS|{OS Name}|{OS Version} 506 // OS|{OS Name}|{OS Version}
459 // CPU|{CPU Name}|{CPU Info}|{Number of CPUs} 507 // CPU|{CPU Name}|{CPU Info}|{Number of CPUs}
460 printf("OS%c%s%c%s\n", kOutputSeparator, 508 printf("OS%c%s%c%s\n", kOutputSeparator,
461 StripSeparator(process_state.system_info()->os).c_str(), 509 StripSeparator(process_state.system_info()->os).c_str(),
462 kOutputSeparator, 510 kOutputSeparator,
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 std::vector<string> symbol_paths; 644 std::vector<string> symbol_paths;
597 if (argc > symbol_path_arg) { 645 if (argc > symbol_path_arg) {
598 for (int argi = symbol_path_arg; argi < argc; ++argi) 646 for (int argi = symbol_path_arg; argi < argc; ++argi)
599 symbol_paths.push_back(argv[argi]); 647 symbol_paths.push_back(argv[argi]);
600 } 648 }
601 649
602 return PrintMinidumpProcess(minidump_file, 650 return PrintMinidumpProcess(minidump_file,
603 symbol_paths, 651 symbol_paths,
604 machine_readable) ? 0 : 1; 652 machine_readable) ? 0 : 1;
605 } 653 }
OLDNEW
« no previous file with comments | « processor/minidump_processor.cc ('k') | processor/process_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld 1004:630ec63f810e-tainted