Breakpad: Refine record classification code

Previously we would classify all STACK records into a single bucket.
This is not really helpful, because there are three distinct types of
records beginning with the token "STACK" (STACK CFI INIT, STACK CFI,
STACK WIN). To be consistent with how we're treating other records, we
should classify these as three different record types.

It also implements the logic to put "STACK CFI INIT" and "STACK CFI"
records into the same "section" of the breakpad file, as they are meant
to be read together (similar to how FUNC and LINE records are treated).

The code which performs actual parsing of these records will come in a
separate patch.

llvm-svn: 357691
This commit is contained in:
Pavel Labath
2019-04-04 13:23:25 +00:00
parent ca58078dc6
commit dfaafbcf4c
7 changed files with 79 additions and 41 deletions

View File

@@ -148,11 +148,14 @@ void ObjectFileBreakpad::CreateSections(SectionList &unified_section_list) {
llvm::StringRef line;
std::tie(line, text) = text.split('\n');
Record::Kind next_section = Record::classify(line);
llvm::Optional<Record::Kind> next_section = Record::classify(line);
if (next_section == Record::Line) {
// Line records logically belong to the preceding Func record, so we put
// them in the same section.
next_section = Record::Func;
} else if (next_section == Record::StackCFI) {
// Same goes for StackCFI and StackCFIInit
next_section = Record::StackCFIInit;
}
if (next_section == current_section)
continue;