[gjs: 6/11] heapgraph: Clarify address in heap dump
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs: 6/11] heapgraph: Clarify address in heap dump
- Date: Sun, 18 Aug 2019 19:22:03 +0000 (UTC)
commit 8ef98f20836dcb63dca549eef909cb66bf10f830
Author: Philip Chimento <philip chimento gmail com>
Date: Fri Aug 9 14:33:55 2019 -0700
heapgraph: Clarify address in heap dump
The native address given in the heap dump isn't the address of the
native GObject (which is unknown to the JS heap) but the address of the
JS object's private data. Rename "native" to "priv" everywhere to
clarify this.
tools/heapdot.py | 18 +++++++++---------
tools/heapgraph.py | 16 ++++++++--------
2 files changed, 17 insertions(+), 17 deletions(-)
---
diff --git a/tools/heapdot.py b/tools/heapdot.py
index 3f829cb7..69f8194e 100644
--- a/tools/heapdot.py
+++ b/tools/heapdot.py
@@ -10,7 +10,7 @@
import re
func_regex = re.compile('Function(?: ([^/]+)(?:/([<|\w]+))?)?')
-gobj_regex = re.compile('([^ ]+) (\(nil\)|0x[a-fA-F0-9]+$)')
+priv_regex = re.compile(r'([^ ]+) (\(nil\)|0x[a-fA-F0-9]+$)')
###############################################################################
@@ -51,7 +51,7 @@ def output_dot_file(args, graph, targs, fname):
color = 'black'
style = 'solid'
shape = 'rect'
- native = ''
+ priv = ''
if label.endswith('<no private>'):
label = label[:-13]
@@ -66,16 +66,16 @@ def output_dot_file(args, graph, targs, fname):
break
- # GObject or something else with a native address
- gm = gobj_regex.match(label)
+ # GObject or something else with JS instance private data
+ pm = priv_regex.match(label)
- if gm:
- label = gm.group(1)
+ if pm:
+ label = pm.group(1)
color = 'orange'
style = 'bold'
if not args.no_addr:
- native = gm.group(2)
+ priv = pm.group(2)
# Some kind of GObject
if label.startswith('GObject_'):
@@ -129,8 +129,8 @@ def output_dot_file(args, graph, targs, fname):
node_label = label
if not args.no_addr:
node_label += '\\njsobj@' + addr
- if native:
- node_label += '\\nnative@' + native
+ if priv:
+ node_label += '\\npriv@' + priv
annotation = graph.annotations.get(addr, None)
if annotation:
node_label += '\\n\\"{}\\"'.format(annotation)
diff --git a/tools/heapgraph.py b/tools/heapgraph.py
index 35c0f918..3b26673f 100755
--- a/tools/heapgraph.py
+++ b/tools/heapgraph.py
@@ -120,7 +120,7 @@ edge_regex = re.compile ('> ((?:0x)?[a-fA-F0-9]+) (?:(B|G|W) )?([^\r\n]*)\r?$')
wme_regex = re.compile(r'WeakMapEntry map=((?:0x)?[a-zA-Z0-9]+|\(nil\)) key=((?:0x)?[a-zA-Z0-9]+|\(nil\))
keyDelegate=((?:0x)?[a-zA-Z0-9]+|\(nil\)) value=((?:0x)?[a-zA-Z0-9]+)')
func_regex = re.compile('Function(?: ([^/]+)(?:/([<|\w]+))?)?')
-gobj_regex = re.compile('([^ ]+) (0x[a-fA-F0-9]+$)')
+priv_regex = re.compile(r'([^ ]+) (0x[a-fA-F0-9]+$)')
atom_regex = re.compile(r'^string <atom: length (?:\d+)> (.*)\r?$')
###############################################################################
@@ -383,7 +383,7 @@ def output_tree_graph(graph, data, base='', parent=''):
node = get_node_label(graph, addr)
annotation = get_node_annotation(graph, addr)
- has_native = gobj_regex.match(node)
+ has_priv = priv_regex.match(node)
# Color/Style
if os.isatty(1):
@@ -394,17 +394,17 @@ def output_tree_graph(graph, data, base='', parent=''):
orig = style.UNDERLINE + 'jsobj@' + addr + style.END
- if has_native:
- node = style.BOLD + has_native.group(1) + style.END
- orig += ' ' + style.UNDERLINE + 'native@' + has_native.group(2) + style.END
+ if has_priv:
+ node = style.BOLD + has_priv.group(1) + style.END
+ orig += ' ' + style.UNDERLINE + 'priv@' + has_priv.group(2) + style.END
else:
node = style.BOLD + node + style.END
else:
orig = 'jsobj@' + addr
- if has_native:
- node = has_native.group(1)
- orig += ' native@' + has_native.group(2)
+ if has_priv:
+ node = has_priv.group(1)
+ orig += ' priv@' + has_priv.group(2)
# Add the annotation
if annotation:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]