Lines Matching refs:std

37 static std::string tmpnam_;
42 AssemblerTestInfrastructure(std::string architecture, in AssemblerTestInfrastructure()
43 std::string as, in AssemblerTestInfrastructure()
44 std::string as_params, in AssemblerTestInfrastructure()
45 std::string objdump, in AssemblerTestInfrastructure()
46 std::string objdump_params, in AssemblerTestInfrastructure()
47 std::string disasm, in AssemblerTestInfrastructure()
48 std::string disasm_params, in AssemblerTestInfrastructure()
81 std::string disassembler = GetDisassembleCommand(); in CheckTools()
97 void Driver(const std::vector<uint8_t>& data, std::string assembly_text, std::string test_name) { in Driver()
133 virtual std::string GetAssemblerCommand() { in GetAssemblerCommand()
139 std::string line = FindTool(assembler_cmd_name_); in GetAssemblerCommand()
150 virtual std::string GetObjdumpCommand() { in GetObjdumpCommand()
156 std::string line = FindTool(objdump_cmd_name_); in GetObjdumpCommand()
167 virtual std::string GetDisassembleCommand() { in GetDisassembleCommand()
173 std::string line = FindTool(disassembler_cmd_name_); in GetDisassembleCommand()
187 std::string error_msg;
188 std::string base_name;
189 std::unique_ptr<std::vector<uint8_t>> code;
194 bool Assemble(const char* from_file, const char* to_file, std::string* error_msg) { in Assemble()
201 std::vector<std::string> args; in Assemble()
210 std::string cmd = Join(args, ' '); in Assemble()
220 for (std::string arg : args) { in Assemble()
229 std::string Objdump(std::string file) { in Objdump()
236 std::string error_msg; in Objdump()
237 std::vector<std::string> args; in Objdump()
246 std::string cmd = Join(args, ' '); in Objdump()
257 std::ifstream dump(file+".dump"); in Objdump()
259 std::string line; in Objdump()
261 while (std::getline(dump, line)) { in Objdump()
278 bool DisassembleBinaries(const std::vector<uint8_t>& data, const std::vector<uint8_t>& as, in DisassembleBinaries()
279 std::string test_name) { in DisassembleBinaries()
280 std::string disassembler = GetDisassembleCommand(); in DisassembleBinaries()
286 std::string data_name = WriteToFile(data, test_name + ".ass"); in DisassembleBinaries()
287 std::string error_msg; in DisassembleBinaries()
290 std::remove(data_name.c_str()); in DisassembleBinaries()
294 std::string as_name = WriteToFile(as, test_name + ".gcc"); in DisassembleBinaries()
297 std::remove(data_name.c_str()); in DisassembleBinaries()
298 std::remove((data_name + ".dis").c_str()); in DisassembleBinaries()
299 std::remove(as_name.c_str()); in DisassembleBinaries()
306 std::remove(data_name.c_str()); in DisassembleBinaries()
307 std::remove(as_name.c_str()); in DisassembleBinaries()
308 std::remove((data_name + ".dis").c_str()); in DisassembleBinaries()
309 std::remove((as_name + ".dis").c_str()); in DisassembleBinaries()
315 bool DisassembleBinary(std::string file, std::string* error_msg) { in DisassembleBinary()
316 std::vector<std::string> args; in DisassembleBinary()
326 std::string cmd = Join(args, ' '); in DisassembleBinary()
336 std::string WriteToFile(const std::vector<uint8_t>& buffer, std::string test_name) { in WriteToFile()
337 std::string file_name = GetTmpnam() + std::string("---") + test_name; in WriteToFile()
339 std::ofstream s_out(file_name + ".o"); in WriteToFile()
345 bool CompareFiles(std::string f1, std::string f2) { in CompareFiles()
346 std::ifstream f1_in(f1); in CompareFiles()
347 std::ifstream f2_in(f2); in CompareFiles()
349 bool result = std::equal(std::istreambuf_iterator<char>(f1_in), in CompareFiles()
350 std::istreambuf_iterator<char>(), in CompareFiles()
351 std::istreambuf_iterator<char>(f2_in)); in CompareFiles()
360 bool Compile(std::string assembly_code, NativeAssemblerResult* res, std::string test_name) { in Compile()
364 res->base_name = GetTmpnam() + std::string("---") + test_name; in Compile()
368 std::ofstream s_out(res->base_name + ".S"); in Compile()
381 std::string odump = Objdump(res->base_name + ".o"); in Compile()
387 std::istringstream iss(odump); in Compile()
388 std::istream_iterator<std::string> start(iss); in Compile()
389 std::istream_iterator<std::string> end; in Compile()
390 std::vector<std::string> tokens(start, end); in Compile()
402 std::string lengthToken = "0x" + tokens[2]; in Compile()
403 std::istringstream(lengthToken) >> std::hex >> res->length; in Compile()
405 std::string offsetToken = "0x" + tokens[5]; in Compile()
407 std::istringstream(offsetToken) >> std::hex >> offset; in Compile()
409 std::ifstream obj(res->base_name + ".o"); in Compile()
411 res->code.reset(new std::vector<uint8_t>(res->length)); in Compile()
421 std::remove((res->base_name + ".S").c_str()); in Clean()
422 std::remove((res->base_name + ".o").c_str()); in Clean()
423 std::remove((res->base_name + ".o.dump").c_str()); in Clean()
429 static bool FileExists(std::string file) { in FileExists()
436 if (last_slash == std::string::npos) { in FileExists()
442 if (space_index == std::string::npos) { in FileExists()
443 std::ifstream infile(file.c_str()); in FileExists()
446 std::string copy = file.substr(0, space_index - 1); in FileExists()
453 static std::string GetGCCRootPath() { in GetGCCRootPath()
457 static std::string GetRootPath() { in GetRootPath()
461 return std::string(build_top) + "/"; in GetRootPath()
466 return getcwd(temp, 1024) ? std::string(temp) + "/" : std::string(""); in GetRootPath()
469 std::string FindTool(std::string tool_name) { in FindTool()
471 std::string gcc_path = GetRootPath() + GetGCCRootPath(); in FindTool()
472 std::vector<std::string> args; in FindTool()
483 std::string tmp_file = GetTmpnam(); in FindTool()
486 std::string sh_args = Join(args, ' '); in FindTool()
493 std::string error_msg; in FindTool()
499 std::ifstream in(tmp_file.c_str()); in FindTool()
500 std::string line; in FindTool()
501 if (!std::getline(in, line)) { in FindTool()
503 std::remove(tmp_file.c_str()); in FindTool()
507 std::remove(tmp_file.c_str()); in FindTool()
512 std::string GetTmpnam() { in GetTmpnam()
522 std::string architecture_string_;
525 std::string assembler_cmd_name_;
526 std::string assembler_parameters_;
528 std::string objdump_cmd_name_;
529 std::string objdump_parameters_;
531 std::string disassembler_cmd_name_;
532 std::string disassembler_parameters_;
534 std::string resolved_assembler_cmd_;
535 std::string resolved_objdump_cmd_;
536 std::string resolved_disassemble_cmd_;
538 std::string android_data_;