コード例 #1
0
ファイル: GDBCommandExtensions.py プロジェクト: TsarFox/PINCE
 def invoke(self, arg, from_tty):
     searched_str, ignore_case, enable_regex = eval(arg)
     if enable_regex:
         try:
             if ignore_case:
                 regex = re.compile(searched_str, re.IGNORECASE)
             else:
                 regex = re.compile(searched_str)
         except Exception as e:
             print(
                 "An exception occurred while trying to compile the given regex\n",
                 str(e))
             return
     str_dict = shelve.open(SysUtils.get_referenced_calls_file(pid), "r")
     returned_list = []
     for index, item in enumerate(str_dict):
         symbol = ScriptUtils.convert_address_to_symbol(item)
         if symbol is None:
             continue
         if enable_regex:
             if not regex.search(symbol):
                 continue
         else:
             if ignore_case:
                 if symbol.lower().find(searched_str.lower()) == -1:
                     continue
             else:
                 if symbol.find(searched_str) == -1:
                     continue
         returned_list.append((symbol, len(str_dict[item])))
     str_dict.close()
     send_to_pince(returned_list)
コード例 #2
0
ファイル: GDBCommandExtensions.py プロジェクト: TsarFox/PINCE
    def invoke(self, arg, from_tty):
        data_read_list = []
        contents_recv = receive_from_pince()

        # contents_recv format: [[expression1, include_address1], ...]
        for item in contents_recv:
            expression = item[0]
            try:
                include_address = item[1]
            except IndexError:
                include_address = True
            data_read = ScriptUtils.convert_address_to_symbol(
                expression, include_address)
            data_read_list.append(data_read)
        send_to_pince(data_read_list)