Beispiel #1
0
    def parse(self, data):
        """Parse 'data' with the regexp after removing prefix.

        When successful, set the info_attribute.

        """
        try:
            remain = data[data.index(self.prefix) + len(self.prefix) :]
        except ValueError:
            debug('bad prefix in oob parsing of "%s",' ' requested prefix: "%s"', data.strip(), self.prefix)
        else:
            if self.gdblist:
                # a list of dictionaries
                parsed = [
                    x
                    for x in [
                        misc.parse_keyval(self.regexp, list_element) for list_element in re_dict_list.findall(remain)
                    ]
                    if x is not None and self.reqkeys.issubset(x)
                ]
            else:
                if self.reqkeys:
                    parsed = misc.parse_keyval(self.regexp, remain)
                    if parsed is not None and not self.reqkeys.issubset(parsed):
                        parsed = None
                else:
                    parsed = self.regexp.findall(remain)
            if parsed:
                setattr(self.gdb.info, self.info_attribute, parsed)
            else:
                debug('no match for "%s"', remain)
Beispiel #2
0
Datei: gdbmi.py Projekt: Skip/vim
 def handle_result(self, line):
     """Process gdb/mi result."""
     varlist = [VarObj(x) for x in
                     [misc.parse_keyval(re_varlistchildren, list_element)
                         for list_element in re_dict_list.findall(line)]
             if x is not None and LIST_CHILDREN_KEYS.issubset(x)]
     for varobj in varlist:
         self.varobj['children'][varobj['name']] = varobj
     self.gdb.info.varobj.dirty = True
Beispiel #3
0
 def handle_result(self, line):
     """Send the gdb command."""
     parsed = misc.parse_keyval(re_varevaluate, line)
     if parsed is not None and VAREVALUATE_ATTRIBUTES.issubset(parsed):
         self.result = line
         value = parsed["value"]
         if value != self.varobj["value"]:
             self.varobj.chged = True
             self.gdb.info.varobj.dirty = True
             self.varobj["value"] = value
Beispiel #4
0
 def handle_result(self, line):
     """Process gdb/mi result."""
     parsed = misc.parse_keyval(re_varcreate, line)
     if parsed is not None and VARCREATE_ATTRIBUTES.issubset(parsed):
         rootvarobj = self.gdb.info.varobj
         varobj = self.varobj
         varobj.update(parsed)
         try:
             rootvarobj.root[varobj["name"]] = varobj
             rootvarobj.dirty = True
             self.result = line
         except KeyError:
             error("in varobj creation of %s", str(parsed))