Lines Matching refs:std

40 static std::string tmpnam_;  // NOLINT [runtime/string] [4]
45 AssemblerTestInfrastructure(std::string architecture, in AssemblerTestInfrastructure()
46 std::string as, in AssemblerTestInfrastructure()
47 std::string as_params, in AssemblerTestInfrastructure()
48 std::string objdump, in AssemblerTestInfrastructure()
49 std::string objdump_params, in AssemblerTestInfrastructure()
50 std::string disasm, in AssemblerTestInfrastructure()
51 std::string disasm_params, in AssemblerTestInfrastructure()
73 std::string asm_tool = FindTool(assembler_cmd_name_); in CheckTools()
82 std::string objdump_tool = FindTool(objdump_cmd_name_); in CheckTools()
92 std::string disassembler = GetDisassembleCommand(); in CheckTools()
94 std::string disassembler_tool = FindTool(disassembler_cmd_name_); in CheckTools()
112 void Driver(const std::vector<uint8_t>& data, in Driver()
113 const std::string& assembly_text, in Driver()
114 const std::string& test_name) { in Driver()
150 virtual std::string GetAssemblerCommand() { in GetAssemblerCommand()
156 std::string line = FindTool(assembler_cmd_name_); in GetAssemblerCommand()
167 virtual std::string GetObjdumpCommand() { in GetObjdumpCommand()
173 std::string line = FindTool(objdump_cmd_name_); in GetObjdumpCommand()
184 virtual std::string GetDisassembleCommand() { in GetDisassembleCommand()
190 std::string line = FindTool(disassembler_cmd_name_); in GetDisassembleCommand()
204 std::string error_msg;
205 std::string base_name;
206 std::unique_ptr<std::vector<uint8_t>> code;
211 bool Assemble(const char* from_file, const char* to_file, std::string* error_msg) { in Assemble()
218 std::vector<std::string> args; in Assemble()
227 std::string cmd = android::base::Join(args, ' '); in Assemble()
237 for (const std::string& arg : args) { in Assemble()
246 std::string Objdump(const std::string& file) { in Objdump()
253 std::string error_msg; in Objdump()
254 std::vector<std::string> args; in Objdump()
263 std::string cmd = android::base::Join(args, ' '); in Objdump()
274 std::ifstream dump(file+".dump"); in Objdump()
276 std::string line; in Objdump()
278 while (std::getline(dump, line)) { in Objdump()
295 bool DisassembleBinaries(const std::vector<uint8_t>& data, in DisassembleBinaries()
296 const std::vector<uint8_t>& as, in DisassembleBinaries()
297 const std::string& test_name) { in DisassembleBinaries()
298 std::string disassembler = GetDisassembleCommand(); in DisassembleBinaries()
304 std::string data_name = WriteToFile(data, test_name + ".ass"); in DisassembleBinaries()
305 std::string error_msg; in DisassembleBinaries()
308 std::remove(data_name.c_str()); in DisassembleBinaries()
312 std::string as_name = WriteToFile(as, test_name + ".gcc"); in DisassembleBinaries()
315 std::remove(data_name.c_str()); in DisassembleBinaries()
316 std::remove((data_name + ".dis").c_str()); in DisassembleBinaries()
317 std::remove(as_name.c_str()); in DisassembleBinaries()
324 std::remove(data_name.c_str()); in DisassembleBinaries()
325 std::remove(as_name.c_str()); in DisassembleBinaries()
326 std::remove((data_name + ".dis").c_str()); in DisassembleBinaries()
327 std::remove((as_name + ".dis").c_str()); in DisassembleBinaries()
333 bool DisassembleBinary(const std::string& file, std::string* error_msg) { in DisassembleBinary()
334 std::vector<std::string> args; in DisassembleBinary()
344 std::string cmd = android::base::Join(args, ' '); in DisassembleBinary()
354 std::string WriteToFile(const std::vector<uint8_t>& buffer, const std::string& test_name) { in WriteToFile()
355 std::string file_name = GetTmpnam() + std::string("---") + test_name; in WriteToFile()
357 std::ofstream s_out(file_name + ".o"); in WriteToFile()
363 bool CompareFiles(const std::string& f1, const std::string& f2) { in CompareFiles()
364 std::ifstream f1_in(f1); in CompareFiles()
365 std::ifstream f2_in(f2); in CompareFiles()
367 bool result = std::equal(std::istreambuf_iterator<char>(f1_in), in CompareFiles()
368 std::istreambuf_iterator<char>(), in CompareFiles()
369 std::istreambuf_iterator<char>(f2_in)); in CompareFiles()
378 bool Compile(const std::string& assembly_code, in Compile()
380 const std::string& test_name) { in Compile()
384 res->base_name = GetTmpnam() + std::string("---") + test_name; in Compile()
388 std::ofstream s_out(res->base_name + ".S"); in Compile()
401 std::string odump = Objdump(res->base_name + ".o"); in Compile()
407 std::istringstream iss(odump); in Compile()
408 std::istream_iterator<std::string> start(iss); in Compile()
409 std::istream_iterator<std::string> end; in Compile()
410 std::vector<std::string> tokens(start, end); in Compile()
422 std::string lengthToken = "0x" + tokens[2]; in Compile()
423 std::istringstream(lengthToken) >> std::hex >> res->length; in Compile()
425 std::string offsetToken = "0x" + tokens[5]; in Compile()
427 std::istringstream(offsetToken) >> std::hex >> offset; in Compile()
429 std::ifstream obj(res->base_name + ".o"); in Compile()
431 res->code.reset(new std::vector<uint8_t>(res->length)); in Compile()
441 std::remove((res->base_name + ".S").c_str()); in Clean()
442 std::remove((res->base_name + ".o").c_str()); in Clean()
443 std::remove((res->base_name + ".o.dump").c_str()); in Clean()
449 static bool FileExists(const std::string& file) { in FileExists()
456 if (last_slash == std::string::npos) { in FileExists()
462 if (space_index == std::string::npos) { in FileExists()
463 std::ifstream infile(file.c_str()); in FileExists()
466 std::string copy = file.substr(0, space_index - 1); in FileExists()
473 static std::string GetGCCRootPath() { in GetGCCRootPath()
477 static std::string GetRootPath() { in GetRootPath()
481 return std::string(build_top) + "/"; in GetRootPath()
486 return getcwd(temp, 1024) ? std::string(temp) + "/" : std::string(""); in GetRootPath()
489 std::string FindTool(const std::string& tool_name) { in FindTool()
491 std::string gcc_path = GetRootPath() + GetGCCRootPath(); in FindTool()
492 std::vector<std::string> args; in FindTool()
503 std::string tmp_file = GetTmpnam(); in FindTool()
506 std::string sh_args = android::base::Join(args, ' '); in FindTool()
513 std::string error_msg; in FindTool()
519 std::ifstream in(tmp_file.c_str()); in FindTool()
520 std::string line; in FindTool()
521 if (!std::getline(in, line)) { in FindTool()
523 std::remove(tmp_file.c_str()); in FindTool()
527 std::remove(tmp_file.c_str()); in FindTool()
533 static void FindToolDumpPrintout(const std::string& name_predicate, in FindToolDumpPrintout()
534 const std::string& tmp_file) { in FindToolDumpPrintout()
535 std::string gcc_path = GetRootPath() + GetGCCRootPath(); in FindToolDumpPrintout()
536 std::vector<std::string> args; in FindToolDumpPrintout()
547 std::string sh_args = android::base::Join(args, ' '); in FindToolDumpPrintout()
554 std::string error_msg; in FindToolDumpPrintout()
562 std::ifstream in(tmp_file.c_str()); in FindToolDumpPrintout()
564 std::string line; in FindToolDumpPrintout()
565 while (std::getline(in, line)) { in FindToolDumpPrintout()
570 std::remove(tmp_file.c_str()); in FindToolDumpPrintout()
574 void FindToolDump(const std::string& tool_name) { in FindToolDump()
581 std::string GetTmpnam() { in GetTmpnam()
591 std::string architecture_string_;
594 std::string assembler_cmd_name_;
595 std::string assembler_parameters_;
597 std::string objdump_cmd_name_;
598 std::string objdump_parameters_;
600 std::string disassembler_cmd_name_;
601 std::string disassembler_parameters_;
603 std::string resolved_assembler_cmd_;
604 std::string resolved_objdump_cmd_;
605 std::string resolved_disassemble_cmd_;
607 std::string android_data_;