Lines Matching refs:res

117     NativeAssemblerResult res;
118 Compile(assembly_text, &res, test_name);
120 EXPECT_TRUE(res.ok) << res.error_msg;
121 if (!res.ok) {
126 if (data == *res.code) {
127 Clean(&res);
129 if (DisassembleBinaries(data, *res.code, test_name)) {
130 if (data.size() > res.code->size()) {
134 ", gcc size=" << res.code->size();
139 Clean(&res);
143 EXPECT_EQ(*res.code, data) << "Outputs (and disassembly) not identical.";
377 // Compile the given assembly code and extract the binary, if possible. Put result into res.
379 NativeAssemblerResult* res,
381 res->ok = false;
382 res->code.reset(nullptr);
384 res->base_name = GetTmpnam() + std::string("---") + test_name;
388 std::ofstream s_out(res->base_name + ".S");
395 if (!Assemble((res->base_name + ".S").c_str(), (res->base_name + ".o").c_str(),
396 &res->error_msg)) {
397 res->error_msg = "Could not compile.";
401 std::string odump = Objdump(res->base_name + ".o");
403 res->error_msg = "Objdump failed.";
413 res->error_msg = "Objdump output not recognized: too few tokens.";
418 res->error_msg = "Objdump output not recognized: .text not second token.";
423 std::istringstream(lengthToken) >> std::hex >> res->length;
429 std::ifstream obj(res->base_name + ".o");
431 res->code.reset(new std::vector<uint8_t>(res->length));
432 obj.read(reinterpret_cast<char*>(&(*res->code)[0]), res->length);
435 res->ok = true;
440 void Clean(const NativeAssemblerResult* res) {
441 std::remove((res->base_name + ".S").c_str());
442 std::remove((res->base_name + ".o").c_str());
443 std::remove((res->base_name + ".o.dump").c_str());