Dump all available memory regions.
(reader, heap)
| 126 | |
| 127 | |
| 128 | def FullDump(reader, heap): |
| 129 | """Dump all available memory regions.""" |
| 130 | def dump_region(reader, start, size, location): |
| 131 | print() |
| 132 | while start & 3 != 0: |
| 133 | start += 1 |
| 134 | size -= 1 |
| 135 | location += 1 |
| 136 | is_executable = reader.IsProbableExecutableRegion(location, size) |
| 137 | is_ascii = reader.IsProbableASCIIRegion(location, size) |
| 138 | |
| 139 | if is_executable is not False: |
| 140 | lines = reader.GetDisasmLines(start, size) |
| 141 | for line in lines: |
| 142 | print(FormatDisasmLine(start, heap, line)) |
| 143 | print() |
| 144 | |
| 145 | if is_ascii is not False: |
| 146 | # Output in the same format as the Unix hd command |
| 147 | addr = start |
| 148 | for i in range(0, size, 16): |
| 149 | slot = i + location |
| 150 | hex_line = "" |
| 151 | asc_line = "" |
| 152 | for i in range(16): |
| 153 | if slot + i < location + size: |
| 154 | byte = ctypes.c_uint8.from_buffer(reader.minidump, slot + i).value |
| 155 | if byte >= 0x20 and byte < 0x7f: |
| 156 | asc_line += chr(byte) |
| 157 | else: |
| 158 | asc_line += "." |
| 159 | hex_line += " %02x" % (byte) |
| 160 | else: |
| 161 | hex_line += " " |
| 162 | if i == 7: |
| 163 | hex_line += " " |
| 164 | print("%s %s |%s|" % (reader.FormatIntPtr(addr), |
| 165 | hex_line, |
| 166 | asc_line)) |
| 167 | addr += 16 |
| 168 | |
| 169 | if is_executable is not True and is_ascii is not True: |
| 170 | print("%s - %s" % (reader.FormatIntPtr(start), |
| 171 | reader.FormatIntPtr(start + size))) |
| 172 | print(start + size + 1); |
| 173 | for i in range(0, size, reader.MachinePointerSize()): |
| 174 | slot = start + i |
| 175 | maybe_address = reader.ReadUIntPtr(slot) |
| 176 | heap_object = heap.FindObject(maybe_address) |
| 177 | print("%s: %s" % (reader.FormatIntPtr(slot), |
| 178 | reader.FormatIntPtr(maybe_address))) |
| 179 | if heap_object: |
| 180 | heap_object.Print(Printer()) |
| 181 | print() |
| 182 | |
| 183 | reader.ForEachMemoryRegion(dump_region) |
| 184 | |
| 185 | # Heap constants generated by 'make grokdump' in v8heapconst module. |
no test coverage detected