1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# Pretty-printers and utilities for SpiderMonkey rooting templates:
# Rooted, Handle, MutableHandle, etc.
# Forget any printers from previous loads of this module.
# Common base class for all the rooting template pretty-printers. All these
# templates have one member holding the referent (or a pointer to it), so
# there's not much to it.
# The name of the template member holding the referent.
=
# If True, this is a handle type, and should be dereferenced. If False,
# the template member holds the referent directly.
= False
# If True, we should strip typedefs from our referent type. (Rooted<T>
# uses template magic that gives the referent a noisy type.)
= False
# Initialize a pretty-printer for |value|, using |cache|.
#
# If given, |content_printer| is a pretty-printer constructor to use for
# this handle/root/etc.'s referent. Usually, we can just omit this argument
# and let GDB choose a pretty-printer for the referent given its type, but
# when the referent is a typedef of an integral type (say, |jsid| in a
# non-|DEBUG| build), the GNU toolchain (at least) loses the typedef name,
# and all we know about the referent is its fundamental integer type ---
# |JS::Rooted<jsid>|, for example, appears in GDB as |JS::Rooted<long>| ---
# and we are left with no way to choose a meaningful pretty-printer based on
# the type of the referent alone. However, because we know that the only
# integer type for which |JS::Rooted| is likely to be instantiated is
# |jsid|, we *can* register a pretty-printer constructor for the full
# instantiation |JS::Rooted<long>|. That constructor creates a |JS::Rooted|
# pretty-printer, and explicitly specifies the constructor for the referent,
# using this initializer's |content_printer| argument.
=
=
=
=
=
=
return
# As of 2012-11, GDB suppresses printing pointers in replacement
# values; see http://sourceware.org/ml/gdb/2012-11/msg00055.html
# That means that simply returning the 'ptr' member won't work.
# Instead, just invoke GDB's formatter ourselves.
return
= True
= True
= True
=
# Return the referent of a HeapPtr, Rooted, or Handle.
= .
return
return
return
return