def prepare_gdb_script(self, new_gdb_script=None):
     if new_gdb_script is None:
         new_gdb_script = self.gdb_script
         output_file_path = self.gdb_script_path
     else:
         output_file_path = os.path.join(self.tmp_dir, get_new_output_file_name(self.tmp_dir, "gdb_script", ".txt", self.max_digets))
     #TODO: support stdin
     script_content = 'run' + os.linesep
     script_content += new_gdb_script + os.linesep
     script_content += "quit"
     file(output_file_path, "w").write(script_content)
     return output_file_path
 def _combined_stdout_stderr(self, binary, gdb_run, hint):
     executer = Executer(self.config)
     for path, _, files in os.walk(self.search_dir):
         for filename in files:
             if filename.endswith(self.config.run_extension):
                 continue
             filepath = os.path.join(path, filename)
             if gdb_run:
                 command = self.config.get_gdb_command_line(binary, filepath)
                 new_filename = filename+"-"+os.path.basename(binary)+hint+self.config.gdb_prefix
             else:
                 command = self.config.get_command_line(binary, filepath)
                 new_filename = filename+"-"+os.path.basename(binary)+hint
             Logger.debug("Looking for stdout/stderr output:", command, debug_level=4)
             if self.output_dir:
                 output_file_name = get_new_output_file_name(self.output_dir, new_filename, self.config.run_extension, self.config.max_digets)
                 new_filepath = os.path.join(self.output_dir, output_file_name)
             else:
                 output_file_name = get_new_output_file_name(path, new_filename, self.config.run_extension, self.config.max_digets)
                 new_filepath = os.path.join(path, output_file_name)
             fp = file(new_filepath, "w")
             executer.get_output_for_run(command, fp, env=self.config.env)
             fp.close()
Esempio n. 3
0
 def prepare_gdb_script(self, new_gdb_script=None, filepath=None):
     if new_gdb_script is None:
         new_gdb_script = self.gdb_script
         output_file_path = self.gdb_script_path
     else:
         output_file_path = os.path.join(self.tmp_dir, get_new_output_file_name(self.tmp_dir, "gdb_script", ".txt", self.max_digets))
     if self.is_stdin_binary:
         script_content = 'run < "' + filepath + '"' + os.linesep
     else:
         script_content = 'run' + os.linesep
     script_content += new_gdb_script + os.linesep
     script_content += "quit"
     file(output_file_path, "w").write(script_content)
     return output_file_path
Esempio n. 4
0
 def _combined_stdout_stderr(self, binary, gdb_run, hint):
     executer = Executer(self.config)
     for path, _, files in os.walk(self.search_dir):
         for filename in files:
             if filename.endswith(self.config.run_extension):
                 continue
             filepath = os.path.join(path, filename)
             if gdb_run:
                 command = self.config.get_gdb_command_line(
                     binary, filepath)
                 new_filename = filename + "-" + os.path.basename(
                     binary) + hint + self.config.gdb_prefix
             else:
                 command = self.config.get_command_line(binary, filepath)
                 new_filename = filename + "-" + os.path.basename(
                     binary) + hint
             Logger.debug("Looking for stdout/stderr output:",
                          command,
                          debug_level=4)
             if self.output_dir:
                 output_file_name = get_new_output_file_name(
                     self.output_dir, new_filename,
                     self.config.run_extension, self.config.max_digets)
                 new_filepath = os.path.join(self.output_dir,
                                             output_file_name)
             else:
                 output_file_name = get_new_output_file_name(
                     path, new_filename, self.config.run_extension,
                     self.config.max_digets)
                 new_filepath = os.path.join(path, output_file_name)
             fp = file(new_filepath, "w")
             Logger.busy()
             executer.run_command(command,
                                  env=self.config.env,
                                  stdout=fp,
                                  stderr=fp)
             fp.close()
 def prepare_gdb_script(self, new_gdb_script=None):
     if new_gdb_script is None:
         new_gdb_script = self.gdb_script
         output_file_path = self.gdb_script_path
     else:
         output_file_path = os.path.join(
             self.tmp_dir,
             get_new_output_file_name(self.tmp_dir, "gdb_script", ".txt",
                                      self.max_digets))
     #TODO: support stdin
     script_content = 'run' + os.linesep
     script_content += new_gdb_script + os.linesep
     script_content += "quit"
     file(output_file_path, "w").write(script_content)
     return output_file_path