def __init__(self, code_file_name, input_file_name, output_file_name, id): self.code_data_id = id self.current_line = 0 self.output_file_name = output_file_name self.current_steps = 0 self.vis_arrays = {} self.last_edit = datetime.datetime.utcnow() p = subprocess.Popen(['clang-3.5', '-Xclang', '-ast-dump', '-fsyntax-only', code_file_name + "_parsing.cpp"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = p.communicate() self.vars_def_list = code_parser.getVariablesDef(out) defined_functions = code_parser.getFunctionsNames( code_file_name + ".cpp") self.gdb_process = nbsr_process("gdb " + code_file_name + " -q") os.remove(code_file_name + "_parsing.cpp") os.remove(code_file_name + ".cpp") self.gdb_process.write("python (executeGdbCommand('b main'))") self.gdb_process.write("python (executeGdbCommand('set confirm off'))") self.gdb_process.write( "python (executeGdbCommand('run < " + input_file_name + " > " + output_file_name + "'))") for function in defined_functions: self.gdb_process.write( "python (executeGdbCommand('b " + function + "'))") self.gdb_process.write("python setLastLine()") self.gdb_process.write( "python (executeGdbCommand('target record-full'))") self.gdb_process.write("python print('begin')") self.gdb_process.readTill("begin") self.graph = gdbGraph()
def next(self, number=1): self.gdb_process.write("python next('" + str(number) + "')") mess = (self.gdb_process.readTill("done")) for x in mess: if "Program received signa" in x: raise ProcRunTimeError(("\n").join(mess), "RuntimeError") self.graph = gdbGraph() self.updateGraph()
def goToLine(self, line): self.gdb_process.write("python goToLine(" + str(line) + ")") mess = (self.gdb_process.readTill("done")) for x in mess: if "Program received signa" in x: raise ProcRunTimeError(("\n").join(mess), "RuntimeError") self.graph = gdbGraph() self.updateGraph()
def __init__(self, code_file_name, input_file_name, output_file_name, id): self.code_data_id = id self.current_line = 0 self.output_file_name = output_file_name self.current_steps = 0 self.vis_arrays = {} self.last_edit = datetime.datetime.utcnow() p = subprocess.Popen([ 'clang-3.5', '-Xclang', '-ast-dump', '-fsyntax-only', code_file_name + "_parsing.cpp" ], stdout=subprocess.PIPE, stderr=subprocess.PIPE) out, err = p.communicate() self.vars_def_list = code_parser.getVariablesDef(out) defined_functions = code_parser.getFunctionsNames(code_file_name + ".cpp") self.gdb_process = nbsr_process("gdb " + code_file_name + " -q") os.remove(code_file_name + "_parsing.cpp") os.remove(code_file_name + ".cpp") self.gdb_process.write("python (executeGdbCommand('b main'))") self.gdb_process.write("python (executeGdbCommand('set confirm off'))") self.gdb_process.write("python (executeGdbCommand('run < " + input_file_name + " > " + output_file_name + "'))") for function in defined_functions: self.gdb_process.write("python (executeGdbCommand('b " + function + "'))") self.gdb_process.write("python setLastLine()") self.gdb_process.write( "python (executeGdbCommand('target record-full'))") self.gdb_process.write("python print('begin')") self.gdb_process.readTill("begin") self.graph = gdbGraph()
def prev(self, number=1): self.gdb_process.write("python prev(" + str(number) + ")") self.graph = gdbGraph() self.updateGraph()
def stackDown(self): self.gdb_process.write("python (executeGdbCommand('down'))") self.graph = gdbGraph() self.updateGraph()
def endFunciton(self): self.gdb_process.write("python (executeGdbCommand('finish'))") self.graph = gdbGraph() self.updateGraph()