MCPcopy Create free account
hub / github.com/nodejs/node / IsProbableASCIIRegion

Method IsProbableASCIIRegion

deps/v8/tools/grokdump.py:869–889  ·  view source on GitHub ↗
(self, location, length)

Source from the content-addressed store, hash-verified

867 return string
868
869 def IsProbableASCIIRegion(self, location, length):
870 ascii_bytes = 0
871 non_ascii_bytes = 0
872 for i in range(length):
873 loc = location + i
874 byte = ctypes.c_uint8.from_buffer(self.minidump, loc).value
875 if byte >= 0x7f:
876 non_ascii_bytes += 1
877 if byte < 0x20 and byte != 0:
878 non_ascii_bytes += 1
879 if byte < 0x7f and byte >= 0x20:
880 ascii_bytes += 1
881 if byte == 0xa: # newline
882 ascii_bytes += 1
883 if ascii_bytes * 10 <= length:
884 return False
885 if length > 0 and ascii_bytes > non_ascii_bytes * 7:
886 return True
887 if ascii_bytes > non_ascii_bytes * 3:
888 return None # Maybe
889 return False
890
891 def IsProbableExecutableRegion(self, location, length):
892 opcode_bytes = 0

Callers 1

dump_regionFunction · 0.80

Calls 1

rangeFunction · 0.50

Tested by

no test coverage detected