Bug 983022 - [tarako] Need minidump screen shot. r=ted, r=gal

This commit is contained in:
Vincent Liu 2014-04-03 10:28:07 +08:00
Родитель ee20f68db9
Коммит 988d69265c
3 изменённых файлов: 37 добавлений и 0 удалений

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

@ -127,6 +127,8 @@ CrashReporterParent::GenerateChildData(const AnnotationTable* processNotes)
ret = CrashReporter::AppendExtraData(mChildDumpID, *processNotes);
if (!ret)
NS_WARNING("problem appending child data to .extra");
if (!CrashReporter::WriteScreenShotToFile(mChildDumpID))
NS_WARNING("problem writing screen shot to .raw");
return ret;
}
#endif

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

@ -10,6 +10,7 @@
#include "mozilla/Services.h"
#include "nsIObserverService.h"
#include "mozilla/unused.h"
#include "mozilla/FileUtils.h"
#include "nsThreadUtils.h"
#include "nsXULAppAPI.h"
@ -80,6 +81,7 @@ using mozilla::InjectCrashRunnable;
#include "prprf.h"
#include <map>
#include <vector>
#include <linux/fb.h>
#include "mozilla/IOInterposer.h"
#include "mozilla/mozalloc_oom.h"
@ -2260,6 +2262,38 @@ GetExtraFileForMinidump(nsIFile* minidump, nsIFile** extraFile)
return true;
}
bool
WriteScreenShotToFile(const nsAString& id)
{
const char *envvar = PR_GetEnv("MOZ_CRASHREPORTER_DUMP_FB");
if (!envvar || !*envvar || !pendingDirectory)
return false;
ScopedClose fb(open("/dev/graphics/fb0", O_RDONLY));
if (fb.get() < 0)
return false;
struct fb_fix_screeninfo fi;
if (ioctl(fb.get(), FBIOGET_FSCREENINFO, &fi) < 0)
return false;
void* bits = mmap(0, fi.smem_len, PROT_READ, MAP_SHARED, fb.get(), 0);
if (MAP_FAILED == bits)
return false;
char path[PATH_MAX];
sprintf(path, "%s/%s.raw", pendingDirectory, NS_ConvertUTF16toUTF8(id).get());
ScopedClose fd(open(path, O_WRONLY | O_CREAT | O_TRUNC));
if (fd.get() < 0) {
munmap(bits, fi.smem_len);
return false;
}
write(fd.get(), bits, fi.smem_len);
munmap(bits, fi.smem_len);
return true;
}
bool
AppendExtraData(const nsAString& id, const AnnotationTable& data)
{

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

@ -80,6 +80,7 @@ bool GetMinidumpForID(const nsAString& id, nsIFile** minidump);
bool GetIDFromMinidump(nsIFile* minidump, nsAString& id);
bool GetExtraFileForID(const nsAString& id, nsIFile** extraFile);
bool GetExtraFileForMinidump(nsIFile* minidump, nsIFile** extraFile);
bool WriteScreenShotToFile(const nsAString& id);
bool AppendExtraData(const nsAString& id, const AnnotationTable& data);
bool AppendExtraData(nsIFile* extraFile, const AnnotationTable& data);
void RenameAdditionalHangMinidump(nsIFile* minidump, nsIFile* childMinidump,