From: ishell Date: Thu, 19 Feb 2015 14:36:12 +0000 (-0800) Subject: Minor tools/grokdump improvements: avoid some None dereferences and add some line... X-Git-Tag: upstream/4.7.83~4288 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ab641509567a2ecad57e956849095c9b8123746f;p=platform%2Fupstream%2Fv8.git Minor tools/grokdump improvements: avoid some None dereferences and add some line breaks to generated html pages. Review URL: https://codereview.chromium.org/943573002 Cr-Commit-Position: refs/heads/master@{#26752} --- diff --git a/tools/grokdump.py b/tools/grokdump.py index 9d7fe16..8986a91 100755 --- a/tools/grokdump.py +++ b/tools/grokdump.py @@ -970,8 +970,11 @@ class HeapObject(object): p.Print(str(self)) def __str__(self): + instance_type = "???" + if self.map is not None: + instance_type = INSTANCE_TYPES[self.map.instance_type] return "HeapObject(%s, %s)" % (self.heap.reader.FormatIntPtr(self.address), - INSTANCE_TYPES[self.map.instance_type]) + instance_type) def ObjectField(self, offset): field_value = self.heap.reader.ReadUIntPtr(self.address + offset) @@ -1386,9 +1389,9 @@ class JSFunction(HeapObject): def __str__(self): inferred_name = "" - if self.shared.Is(SharedFunctionInfo): + if self.shared is not None and self.shared.Is(SharedFunctionInfo): inferred_name = self.shared.inferred_name - return "JSFunction(%s, %s)" % \ + return "JSFunction(%s, %s) " % \ (self.heap.reader.FormatIntPtr(self.address), inferred_name) def _GetSource(self): @@ -2094,7 +2097,7 @@ class InspectionWebHandler(BaseHTTPServer.BaseHTTPRequestHandler): self.send_error(404, 'Web parameter error: %s' % e.message) -HTML_REG_FORMAT = "%s: %s\n" +HTML_REG_FORMAT = "%s: %s
\n" class InspectionWebFormatter(object): @@ -2263,7 +2266,7 @@ class InspectionWebFormatter(object): f.write("

Exception context

") f.write('
\n') f.write("Thread id: %d" % exception_thread.id) - f.write("   Exception code: %08X\n" % + f.write("   Exception code: %08X
\n" % self.reader.exception.exception.code) if details == InspectionWebFormatter.CONTEXT_FULL: if self.reader.exception.exception.parameter_count > 0: