| 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 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 const unsigned num_mappings = dumper_.mappings().size(); | 493 const unsigned num_mappings = dumper_.mappings().size(); |
| 494 unsigned num_output_mappings = 0; | 494 unsigned num_output_mappings = 0; |
| 495 | 495 |
| 496 for (unsigned i = 0; i < dumper_.mappings().size(); ++i) { | 496 for (unsigned i = 0; i < dumper_.mappings().size(); ++i) { |
| 497 const MappingInfo& mapping = *dumper_.mappings()[i]; | 497 const MappingInfo& mapping = *dumper_.mappings()[i]; |
| 498 if (ShouldIncludeMapping(mapping)) | 498 if (ShouldIncludeMapping(mapping)) |
| 499 num_output_mappings++; | 499 num_output_mappings++; |
| 500 } | 500 } |
| 501 | 501 |
| 502 TypedMDRVA<uint32_t> list(&minidump_writer_); | 502 TypedMDRVA<uint32_t> list(&minidump_writer_); |
| 503 if (!list.AllocateObjectAndArray(num_output_mappings, sizeof(MDRawModule))) | 503 if (!list.AllocateObjectAndArray(num_output_mappings, MD_MODULE_SIZE)) |
| 504 return false; | 504 return false; |
| 505 | 505 |
| 506 dirent->stream_type = MD_MODULE_LIST_STREAM; | 506 dirent->stream_type = MD_MODULE_LIST_STREAM; |
| 507 dirent->location = list.location(); | 507 dirent->location = list.location(); |
| 508 *list.get() = num_output_mappings; | 508 *list.get() = num_output_mappings; |
| 509 | 509 |
| 510 for (unsigned i = 0, j = 0; i < num_mappings; ++i) { | 510 for (unsigned i = 0, j = 0; i < num_mappings; ++i) { |
| 511 const MappingInfo& mapping = *dumper_.mappings()[i]; | 511 const MappingInfo& mapping = *dumper_.mappings()[i]; |
| 512 if (!ShouldIncludeMapping(mapping)) | 512 if (!ShouldIncludeMapping(mapping)) |
| 513 continue; | 513 continue; |
| 514 | 514 |
| 515 MDRawModule mod; | 515 MDRawModule mod; |
| 516 my_memset(&mod, 0, sizeof(mod)); | 516 my_memset(&mod, 0, MD_MODULE_SIZE); |
| 517 mod.base_of_image = mapping.start_addr; | 517 mod.base_of_image = mapping.start_addr; |
| 518 mod.size_of_image = mapping.size; | 518 mod.size_of_image = mapping.size; |
| 519 const size_t filepath_len = my_strlen(mapping.name); | 519 const size_t filepath_len = my_strlen(mapping.name); |
| 520 | 520 |
| 521 // Figure out file name from path | 521 // Figure out file name from path |
| 522 const char* filename_ptr = mapping.name + filepath_len - 1; | 522 const char* filename_ptr = mapping.name + filepath_len - 1; |
| 523 while (filename_ptr >= mapping.name) { | 523 while (filename_ptr >= mapping.name) { |
| 524 if (*filename_ptr == '/') | 524 if (*filename_ptr == '/') |
| 525 break; | 525 break; |
| 526 filename_ptr--; | 526 filename_ptr--; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 memcpy(cv_ptr, filename_ptr, filename_len + 1); | 562 memcpy(cv_ptr, filename_ptr, filename_len + 1); |
| 563 cv.Copy(cv_buf, MDCVInfoPDB70_minsize + filename_len + 1); | 563 cv.Copy(cv_buf, MDCVInfoPDB70_minsize + filename_len + 1); |
| 564 | 564 |
| 565 mod.cv_record = cv.location(); | 565 mod.cv_record = cv.location(); |
| 566 | 566 |
| 567 MDLocationDescriptor ld; | 567 MDLocationDescriptor ld; |
| 568 if (!minidump_writer_.WriteString(mapping.name, filepath_len, &ld)) | 568 if (!minidump_writer_.WriteString(mapping.name, filepath_len, &ld)) |
| 569 return false; | 569 return false; |
| 570 mod.module_name_rva = ld.rva; | 570 mod.module_name_rva = ld.rva; |
| 571 | 571 |
| 572 list.CopyIndexAfterObject(j++, &mod, sizeof(mod)); | 572 list.CopyIndexAfterObject(j++, &mod, MD_MODULE_SIZE); |
| 573 } | 573 } |
| 574 | 574 |
| 575 return true; | 575 return true; |
| 576 } | 576 } |
| 577 | 577 |
| 578 bool WriteExceptionStream(MDRawDirectory* dirent) { | 578 bool WriteExceptionStream(MDRawDirectory* dirent) { |
| 579 TypedMDRVA<MDRawExceptionStream> exc(&minidump_writer_); | 579 TypedMDRVA<MDRawExceptionStream> exc(&minidump_writer_); |
| 580 if (!exc.Allocate()) | 580 if (!exc.Allocate()) |
| 581 return false; | 581 return false; |
| 582 my_memset(exc.get(), 0, sizeof(MDRawExceptionStream)); | 582 my_memset(exc.get(), 0, sizeof(MDRawExceptionStream)); |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 853 return false; | 853 return false; |
| 854 const ExceptionHandler::CrashContext* context = | 854 const ExceptionHandler::CrashContext* context = |
| 855 reinterpret_cast<const ExceptionHandler::CrashContext*>(blob); | 855 reinterpret_cast<const ExceptionHandler::CrashContext*>(blob); |
| 856 MinidumpWriter writer(filename, crashing_process, context); | 856 MinidumpWriter writer(filename, crashing_process, context); |
| 857 if (!writer.Init()) | 857 if (!writer.Init()) |
| 858 return false; | 858 return false; |
| 859 return writer.Dump(); | 859 return writer.Dump(); |
| 860 } | 860 } |
| 861 | 861 |
| 862 } // namespace google_breakpad | 862 } // namespace google_breakpad |
| OLD | NEW |