Commit 348c0f08 authored by Bruce Dawson's avatar Bruce Dawson Committed by Commit Bot

Make grokdump.py work on Windows

mmap behaves differently on Windows. This change adjust how grokdump.py
uses it so that the script will run on Windows.

The disassembly doesn't work due to lack of /usr/bin/objdump - fixing
that is out of scope for this change. The output is still useful even
without the disassembly.

Change-Id: I0db2d09e3ed10f0ca666cbbd438fbd82565906d8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1866958
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64376}
parent af324e75
......@@ -616,8 +616,12 @@ class MinidumpReader(object):
def __init__(self, options, minidump_name):
self.minidump_name = minidump_name
self.minidump_file = open(minidump_name, "r")
self.minidump = mmap.mmap(self.minidump_file.fileno(), 0, mmap.MAP_PRIVATE)
if sys.platform == 'win32':
self.minidump_file = open(minidump_name, "a+")
self.minidump = mmap.mmap(self.minidump_file.fileno(), 0)
else:
self.minidump_file = open(minidump_name, "r")
self.minidump = mmap.mmap(self.minidump_file.fileno(), 0, mmap.MAP_PRIVATE)
self.header = MINIDUMP_HEADER.Read(self.minidump, 0)
if self.header.signature != MinidumpReader._HEADER_MAGIC:
print("Warning: Unsupported minidump header magic!", file=sys.stderr)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment