// Check that the objdump output contains given output. // If next is true, it must be the next line. Otherwise lines are skipped. void Check(constchar* substr, bool next, constchar* at_file, int at_line) {
expected_lines_.push_back(ExpectedLine {substr, next, at_file, at_line});
}
// Pretty-print the generated DWARF data using objdump. template<typename ElfTypes>
std::vector<std::string> ObjdumpImpl(InstructionSet isa, constchar* args) { // Write simple elf file with just the DWARF sections.
ScratchFile file;
FileOutputStream output_stream(file.GetFile());
ElfBuilder<ElfTypes> builder(isa, &output_stream);
builder.Start(); if (!debug_info_data_.empty()) {
builder.WriteSection(".debug_info", &debug_info_data_);
} if (!debug_abbrev_data_.empty()) {
builder.WriteSection(".debug_abbrev", &debug_abbrev_data_);
} if (!debug_str_data_.empty()) {
builder.WriteSection(".debug_str", &debug_str_data_);
} if (!debug_line_data_.empty()) {
builder.WriteSection(".debug_line", &debug_line_data_);
} if (!debug_frame_data_.empty()) {
builder.WriteSection(".debug_frame", &debug_frame_data_);
}
builder.End();
EXPECT_TRUE(builder.Good());
std::vector<std::string> Objdump(InstructionSet isa, constchar* args) { if (Is64BitInstructionSet(isa)) { return ObjdumpImpl<ElfTypes64>(isa, args);
} else { return ObjdumpImpl<ElfTypes32>(isa, args);
}
}
// Compare objdump output to the recorded checks. void CheckObjdumpOutput(InstructionSet isa, constchar* args) {
std::vector<std::string> actual_lines = Objdump(isa, args); auto actual_line = actual_lines.begin(); bool failed = false; for (const ExpectedLine& expected : expected_lines_) { const std::string& substring = expected.substring; auto it = std::find_if(actual_line, actual_lines.end(),
[&](const std::string& line) { return line.find(substring) != std::string::npos; }); if (it == actual_lines.end()) {
failed = true;
ADD_FAILURE_AT(expected.at_file, expected.at_line) << "'" << substring << "' not found.";
} else { if (expected.next && it != actual_line) {
failed = true;
ADD_FAILURE_AT(expected.at_file, expected.at_line)
<< "'" << substring << "' found, but not on the immediate next line as expected.";
}
actual_line = ++it;
}
} if (failed) {
LOG(ERROR) << "objdump output:"; for (const std::string& it : actual_lines) {
LOG(ERROR) << it;
}
}
}
// Buffers which are going to assembled into ELF file and passed to objdump.
std::vector<uint8_t> debug_frame_data_;
std::vector<uint8_t> debug_info_data_;
std::vector<uint8_t> debug_abbrev_data_;
std::vector<uint8_t> debug_str_data_;
std::vector<uint8_t> debug_line_data_;
// The expected output of objdump.
std::vector<ExpectedLine> expected_lines_;
};
} // namespace dwarf
} // namespace art
#endif// ART_COMPILER_DEBUG_DWARF_DWARF_TEST_H_
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.9 Sekunden
(vorverarbeitet am 2026-06-29)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.