def __on_var_updated(self, data): if hasattr(data,'changelist'): names = [item['name'] for item in data.changelist] for item in data.changelist: if 'value' in item: self.vars.vars[item['name']].data = item['value'] if 'new_type' in item: self.vars.vars[item['name']].type = Type.parse(item['new_type']) if 'new_num_children' in item: self.vars.vars[item['name']].children = int(item['new_num_children']) if names: self.post_event(GDBEvent(EVT_GDB_UPDATE_VARS, self, data=names))
def __on_var_created(self, expression, frame, data): # Created variable info try: type = Type.parse(data.type) numchild = int(data.numchild) name = data.name value = [] if numchild else data.value # Update the model and notify self.vars.add(name, Variable(name, expression, type, children=numchild, data=value, frame=frame)) self.post_event(GDBEvent(EVT_GDB_UPDATE_VARS, self, data=[name])) except Exception, e: print "Exception creating variable: %s" % e print data
def __on_var_list_children(self, data): kids = [] updated_kids =[] for item in data.children: child = item['child'] numchild = int(child['numchild']) value = [] if numchild else child['value'] type = Type.parse(child['type']) expression = child['exp'] name = child['name'] parent = GDBVarModel.parent_name(name) if name not in self.vars: self.vars.add(name, Variable(name, expression, type, children=numchild, data=value)) updated_kids.append(name) kids.append(name) if parent: self.vars[parent].data = kids if updated_kids: self.post_event(GDBEvent(EVT_GDB_UPDATE_VARS, self, data=kids))