summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2016-12-07 12:33:59 +0000
committerTom Hacohen <tom@stosb.com>2016-12-07 12:51:54 +0000
commit5614e46f1f01aa02a779358177907fc08223f3ac (patch)
tree2a67277c1028f705d4615d42e77fd99a2614e5be /data
parentfcef8d8392b8c8d1d7b96baacaf5e7e89fcf6b45 (diff)
Eo gdb: Implement eo_data_get to get eo data.
Like 79d76fb25ece4ffbf5785b4be2b030f062ef9f2c, this is useful when debugging a core dump. It accepts a valid pointer to an object, for example as returned from $eo_resolve, and a name of a class or mixin, and returns a pointer to the private data. Essentially the same as efl_data_scope_get(), but also works on core dumps, and accepts a class name instead of a class pointer. Usage: Print the pointer: (gdb) print $eo_data_get($eo_resolve(obj), "Efl_Canvas_Object") $1 = (void *) 0x555555eb9290 Use it directly (e.g. to print a value): (gdb) print ((Evas_Object_Protected_Data *) $eo_data_get($eo_resolve(obj), "Efl_Canvas_Object"))->last_event_type $2 = EVAS_CALLBACK_MOUSE_UP @feature
Diffstat (limited to 'data')
-rw-r--r--data/eo/eo_gdb.py49
1 files changed, 49 insertions, 0 deletions
diff --git a/data/eo/eo_gdb.py b/data/eo/eo_gdb.py
index 76b8fbd..ec4d21c 100644
--- a/data/eo/eo_gdb.py
+++ b/data/eo/eo_gdb.py
@@ -93,3 +93,52 @@ class Eo_resolve(gdb.Function):
93 93
94 94
95Eo_resolve() 95Eo_resolve()
96
97
98class Eo_data_get(gdb.Function):
99 def __init__(self):
100 gdb.Function.__init__(self, 'eo_data_get')
101
102 def invoke(self, ptr, kls_name):
103 ptr = ptr.cast(null_ptr.type) # Make sure it's the right type
104
105 if int(ptr) == 0:
106 gdb.write('Object is not a valid pointer (NULL).\n')
107 return null_ptr
108
109 kls_name = kls_name.string()
110 extns = ptr['klass']['mro']
111 kls = None
112
113 i = 0
114 while int(extns[i]) != 0:
115 if extns[i]['desc']['name'].string() == kls_name:
116 kls = extns[i]
117 i += 1
118
119 if kls is None:
120 gdb.write('Class "{}" not found in the object mro.\n'
121 .format(kls_name))
122 return null_ptr
123
124 # Check if not mixin
125 if int(kls['desc']['type']) != 3:
126 return gdb.parse_and_eval('(void *) (((char *) {}) + {})'
127 .format(ptr, kls['data_offset']))
128 else:
129 extn_off = ptr['klass']['extn_data_off']
130 if int(extn_off) == 0:
131 return null_ptr
132
133 i = 0
134 while int(extn_off[i]['klass']) != 0:
135 kls = extn_off[i]['klass']
136 if kls['desc']['name'].string() == kls_name:
137 return gdb.parse_and_eval('(void *) (((char *) {}) + {})'
138 .format(ptr, kls['data_offset']))
139 i += 1
140
141 return null_ptr
142
143
144Eo_data_get()