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 function(self): instances = [] signals = [] for frame in self.frames: name = frame_name(frame) if name == "signal_emit_unlocked_R": self.read_object(frame, "instance", instances) node = self.read_var(frame, "node") if node: signal = node["name"].string() signal = self.get_detailed_signal_from_frame(frame, signal) 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: signal = self.get_detailed_signal_from_frame(frame, signal) 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: signal = self.get_detailed_signal_from_frame(frame, signal) 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) return "<emit signal %s on instance %s>" % (signal, instance)
import sys import gdb gdb.execute("file " + sys.argv[1]) type = gdb.Type(sys.argv[0]) print "sizeof %s = %d" % (sys.argv[0], type.sizeof())