| OLD | NEW |
| 1 // Copyright (c) 2009, Google Inc. | 1 // Copyright (c) 2009, 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 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 const char* line; | 662 const char* line; |
| 663 unsigned line_len; | 663 unsigned line_len; |
| 664 while (line_reader->GetNextLine(&line, &line_len)) { | 664 while (line_reader->GetNextLine(&line, &line_len)) { |
| 665 for (size_t i = 0; | 665 for (size_t i = 0; |
| 666 i < sizeof(cpu_info_table) / sizeof(cpu_info_table[0]); | 666 i < sizeof(cpu_info_table) / sizeof(cpu_info_table[0]); |
| 667 i++) { | 667 i++) { |
| 668 CpuInfoEntry* entry = &cpu_info_table[i]; | 668 CpuInfoEntry* entry = &cpu_info_table[i]; |
| 669 if (entry->found) | 669 if (entry->found) |
| 670 goto popline; | 670 goto popline; |
| 671 if (!strncmp(line, entry->info_name, strlen(entry->info_name))) { | 671 if (!strncmp(line, entry->info_name, strlen(entry->info_name))) { |
| 672 char* value = strchr(line, ':'); | 672 const char* value = strchr(line, ':'); |
| 673 if (!value) | 673 if (!value) |
| 674 goto popline; | 674 goto popline; |
| 675 | 675 |
| 676 // the above strncmp only matches the prefix, it might be the wrong | 676 // the above strncmp only matches the prefix, it might be the wrong |
| 677 // line. i.e. we matched "model name" instead of "model". | 677 // line. i.e. we matched "model name" instead of "model". |
| 678 // check and make sure there is only spaces between the prefix and | 678 // check and make sure there is only spaces between the prefix and |
| 679 // the colon. | 679 // the colon. |
| 680 const char* space_ptr = line + strlen(entry->info_name); | 680 const char* space_ptr = line + strlen(entry->info_name); |
| 681 for (; space_ptr < value; space_ptr++) { | 681 for (; space_ptr < value; space_ptr++) { |
| 682 if (!isspace(*space_ptr)) { | 682 if (!isspace(*space_ptr)) { |
| 683 break; | 683 break; |
| 684 } | 684 } |
| 685 } | 685 } |
| 686 if (space_ptr != value) | 686 if (space_ptr != value) |
| 687 goto popline; | 687 goto popline; |
| 688 | 688 |
| 689 sscanf(++value, " %d", &(entry->value)); | 689 sscanf(++value, " %d", &(entry->value)); |
| 690 entry->found = true; | 690 entry->found = true; |
| 691 } | 691 } |
| 692 } | 692 } |
| 693 | 693 |
| 694 // special case for vendor_id | 694 // special case for vendor_id |
| 695 if (!strncmp(line, vendor_id_name, vendor_id_name_length)) { | 695 if (!strncmp(line, vendor_id_name, vendor_id_name_length)) { |
| 696 char* value = strchr(line, ':'); | 696 const char* value = strchr(line, ':'); |
| 697 if (!value) | 697 if (!value) |
| 698 goto popline; | 698 goto popline; |
| 699 | 699 |
| 700 // skip ':" and all the spaces that follows | 700 // skip ':" and all the spaces that follows |
| 701 do { | 701 do { |
| 702 value++; | 702 value++; |
| 703 } while (isspace(*value)); | 703 } while (isspace(*value)); |
| 704 | 704 |
| 705 if (*value) { | 705 if (*value) { |
| 706 size_t length = strlen(value); | 706 size_t length = strlen(value); |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 852 return false; | 852 return false; |
| 853 const ExceptionHandler::CrashContext* context = | 853 const ExceptionHandler::CrashContext* context = |
| 854 reinterpret_cast<const ExceptionHandler::CrashContext*>(blob); | 854 reinterpret_cast<const ExceptionHandler::CrashContext*>(blob); |
| 855 MinidumpWriter writer(filename, crashing_process, context); | 855 MinidumpWriter writer(filename, crashing_process, context); |
| 856 if (!writer.Init()) | 856 if (!writer.Init()) |
| 857 return false; | 857 return false; |
| 858 return writer.Dump(); | 858 return writer.Dump(); |
| 859 } | 859 } |
| 860 | 860 |
| 861 } // namespace google_breakpad | 861 } // namespace google_breakpad |
| OLD | NEW |