Bug 1247978 - Ensure minidump header gets written during crash dump on Linux r=ted

This commit is contained in:
James Willcox 2016-02-12 11:06:31 -06:00
Родитель 4a644027c8
Коммит 67da777b83
1 изменённых файлов: 17 добавлений и 11 удалений

Просмотреть файл

@ -168,19 +168,25 @@ class MinidumpWriter {
// of stream which we write.
unsigned kNumWriters = 13;
TypedMDRVA<MDRawHeader> header(&minidump_writer_);
TypedMDRVA<MDRawDirectory> dir(&minidump_writer_);
if (!header.Allocate())
return false;
if (!dir.AllocateArray(kNumWriters))
return false;
my_memset(header.get(), 0, sizeof(MDRawHeader));
{
// Ensure the header gets flushed, as that happens in the destructor.
// If we crash somewhere below, we should have a mostly-intact dump
TypedMDRVA<MDRawHeader> header(&minidump_writer_);
if (!header.Allocate())
return false;
header.get()->signature = MD_HEADER_SIGNATURE;
header.get()->version = MD_HEADER_VERSION;
header.get()->time_date_stamp = time(NULL);
header.get()->stream_count = kNumWriters;
header.get()->stream_directory_rva = dir.position();
if (!dir.AllocateArray(kNumWriters))
return false;
my_memset(header.get(), 0, sizeof(MDRawHeader));
header.get()->signature = MD_HEADER_SIGNATURE;
header.get()->version = MD_HEADER_VERSION;
header.get()->time_date_stamp = time(NULL);
header.get()->stream_count = kNumWriters;
header.get()->stream_directory_rva = dir.position();
}
unsigned dir_index = 0;
MDRawDirectory dirent;