summaryrefslogtreecommitdiff
path: root/data/eo/eo_gdb.py
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:52:16 +0000
commit7492b67e65b48a7835c5fee671b181803a7e5896 (patch)
tree788df3c854e9833e04b316a6fc9b99aeea5fe7bc /data/eo/eo_gdb.py
parent34efbca16e954d994a26d730753b8fbd1d4a37ec (diff)
downloadefl-7492b67e65b48a7835c5fee671b181803a7e5896.tar.gz
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/eo/eo_gdb.py')
-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 e54797d68e..6a58a6c507 100644
--- a/data/eo/eo_gdb.py
+++ b/data/eo/eo_gdb.py
@@ -81,3 +81,52 @@ class Eo_resolve(gdb.Function):
Eo_resolve()
+
+
+class Eo_data_get(gdb.Function):
+ def __init__(self):
+ gdb.Function.__init__(self, 'eo_data_get')
+
+ def invoke(self, ptr, kls_name):
+ ptr = ptr.cast(null_ptr.type) # Make sure it's the right type
+
+ if int(ptr) == 0:
+ gdb.write('Object is not a valid pointer (NULL).\n')
+ return null_ptr
+
+ kls_name = kls_name.string()
+ extns = ptr['klass']['mro']
+ kls = None
+
+ i = 0
+ while int(extns[i]) != 0:
+ if extns[i]['desc']['name'].string() == kls_name:
+ kls = extns[i]
+ i += 1
+
+ if kls is None:
+ gdb.write('Class "{}" not found in the object mro.\n'
+ .format(kls_name))
+ return null_ptr
+
+ # Check if not mixin
+ if int(kls['desc']['type']) != 3:
+ return gdb.parse_and_eval('(void *) (((char *) {}) + {})'
+ .format(ptr, kls['data_offset']))
+ else:
+ extn_off = ptr['klass']['extn_data_off']
+ if int(extn_off) == 0:
+ return null_ptr
+
+ i = 0
+ while int(extn_off[i]['klass']) != 0:
+ kls = extn_off[i]['klass']
+ if kls['desc']['name'].string() == kls_name:
+ return gdb.parse_and_eval('(void *) (((char *) {}) + {})'
+ .format(ptr, kls['data_offset']))
+ i += 1
+
+ return null_ptr
+
+
+Eo_data_get()