def describe(self, stream, full): instances = [] signals = [] for frame in self.frames: name = frame.name() if name == "signal_emit_unlocked_R": self.read_object(frame, "instance", instances) node = self.read_var(frame, "node") if node: signal = node["name"].string() detail = self.read_var(frame, "detail") detail = glib.g_quark_to_string(detail) if detail != None: signal = signal + ":" + detail self.append(signals, signal) if name == "g_signal_emitv": instance_and_params = self.read_var(frame, "instance_and_params") if instance_and_params: instance = instance_and_params[0]["v_pointer"].cast( gdb.Type("GObject").pointer()) self.append(instances, instance) id = self.read_var(frame, "signal_id") signal = get_signal_name(id) if signal: detail = self.read_var(frame, "detail") detail = glib.g_quark_to_string(detail) if detail != None: signal = signal + ":" + detail self.append(signals, signal) if name == "g_signal_emit_valist" or name == "g_signal_emit": self.read_object(frame, "instance", instances) id = self.read_var(frame, "signal_id") signal = get_signal_name(id) if signal: detail = self.read_var(frame, "detail") detail = glib.g_quark_to_string(detail) if detail != None: signal = signal + ":" + detail self.append(signals, signal) if name == "g_signal_emit_by_name": self.read_object(frame, "instance", instances) self.read_var(frame, "detailed_signal", signals) break instance = self.or_join_array(instances) signal = self.or_join_array(signals) stream.write(" <emit signal %s on instance %s>\n" % (signal, instance))
def describe (self, stream, full): instances = [] signals = [] for frame in self.frames: name = frame.name() if name == "signal_emit_unlocked_R": self.read_object (frame, "instance", instances) node = self.read_var (frame, "node") if node: signal = node["name"].string() detail = self.read_var (frame, "detail") detail = glib.g_quark_to_string (detail) if detail != None: signal = signal + ":" + detail self.append (signals, signal) if name == "g_signal_emitv": instance_and_params = self.read_var (frame, "instance_and_params") if instance_and_params: instance = instance_and_params[0]["v_pointer"].cast (gdb.Type("GObject").pointer()) self.append (instances, instance) id = self.read_var (frame, "signal_id") signal = get_signal_name (id) if signal: detail = self.read_var (frame, "detail") detail = glib.g_quark_to_string (detail) if detail != None: signal = signal + ":" + detail self.append (signals, signal) if name == "g_signal_emit_valist" or name == "g_signal_emit": self.read_object (frame, "instance", instances) id = self.read_var (frame, "signal_id") signal = get_signal_name (id) if signal: detail = self.read_var (frame, "detail") detail = glib.g_quark_to_string (detail) if detail != None: signal = signal + ":" + detail self.append (signals, signal) if name == "g_signal_emit_by_name": self.read_object (frame, "instance", instances) self.read_var (frame, "detailed_signal", signals) break instance = self.or_join_array (instances) signal = self.or_join_array (signals) stream.write (" <emit signal %s on instance %s>\n" % (signal, instance))
def get_detailed_signal_from_frame(self, frame, signal): detail = self.read_var (frame, "detail") detail = glib.g_quark_to_string (detail) if detail is not None: return signal + ":" + detail else: return detail
def g_type_to_name (gtype): def lookup_fundamental_type (typenode): if typenode == 0: return None val = read_global_var ("static_fundamental_type_nodes") if val == None: return None return val[typenode >> 2].address() gtype = long(gtype) typenode = gtype - gtype % 4 if typenode > (255 << 2): typenode = gdb.Value(typenode).cast (gdb.lookup_type("TypeNode").pointer()) else: typenode = lookup_fundamental_type (typenode) if typenode != None: return glib.g_quark_to_string (typenode["qname"]) return None
def get_type_name(cls, typenode): return g_quark_to_string(typenode["qname"])