diff options
| author | Pavel Labath <pavel@labath.sk> | 2019-04-09 08:05:11 +0000 |
|---|---|---|
| committer | Pavel Labath <pavel@labath.sk> | 2019-04-09 08:05:11 +0000 |
| commit | 9837f54843df864092be162823c6cdd0607dced0 (patch) | |
| tree | 4d6903e09ac561742240a659b6e29693620876d2 /lldb/unittests/ObjectFile/Breakpad/BreakpadRecordsTest.cpp | |
| parent | 93b497a61d205088ad14e3ec7e7abc91e33592fe (diff) | |
| download | bcm5719-llvm-9837f54843df864092be162823c6cdd0607dced0.tar.gz bcm5719-llvm-9837f54843df864092be162823c6cdd0607dced0.zip | |
Breakpad: Parse Stack CFI records
Summary:
This patch adds support for parsing STACK CFI records from breakpad
files. The expressions specifying the values of registers are not
parsed.The idea is that these will be handed off to the postfix
expression -> dwarf compiler, once it is extracted from the internals of
the NativePDB plugin.
Reviewers: clayborg, amccarth, markmentovai
Subscribers: aprantl, lldb-commits
Differential Revision: https://reviews.llvm.org/D60268
llvm-svn: 357975
Diffstat (limited to 'lldb/unittests/ObjectFile/Breakpad/BreakpadRecordsTest.cpp')
| -rw-r--r-- | lldb/unittests/ObjectFile/Breakpad/BreakpadRecordsTest.cpp | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/lldb/unittests/ObjectFile/Breakpad/BreakpadRecordsTest.cpp b/lldb/unittests/ObjectFile/Breakpad/BreakpadRecordsTest.cpp index ad0b7d377ef..a25a7076b60 100644 --- a/lldb/unittests/ObjectFile/Breakpad/BreakpadRecordsTest.cpp +++ b/lldb/unittests/ObjectFile/Breakpad/BreakpadRecordsTest.cpp @@ -19,7 +19,6 @@ TEST(Record, classify) { EXPECT_EQ(Record::File, Record::classify("FILE")); EXPECT_EQ(Record::Func, Record::classify("FUNC")); EXPECT_EQ(Record::Public, Record::classify("PUBLIC")); - EXPECT_EQ(Record::StackCFIInit, Record::classify("STACK CFI INIT")); EXPECT_EQ(Record::StackCFI, Record::classify("STACK CFI")); // Any obviously incorrect lines will be classified as such. @@ -97,3 +96,26 @@ TEST(PublicRecord, parse) { EXPECT_EQ(llvm::None, PublicRecord::parse("PUBLIC m")); EXPECT_EQ(llvm::None, PublicRecord::parse("PUBLIC")); } + +TEST(StackCFIRecord, parse) { + EXPECT_EQ(StackCFIRecord(0x47, 0x8, ".cfa: $esp 4 + $eip: .cfa 4 - ^"), + StackCFIRecord::parse( + "STACK CFI INIT 47 8 .cfa: $esp 4 + $eip: .cfa 4 - ^")); + + EXPECT_EQ(StackCFIRecord(0x47, 0x8, ".cfa: $esp 4 +"), + StackCFIRecord::parse("STACK CFI INIT 47 8 .cfa: $esp 4 + ")); + + EXPECT_EQ(StackCFIRecord(0x47, llvm::None, ".cfa: $esp 4 +"), + StackCFIRecord::parse("STACK CFI 47 .cfa: $esp 4 +")); + + // The validity of the register value expressions is not checked + EXPECT_EQ(StackCFIRecord(0x47, 0x8, ".cfa: ^ ^ ^"), + StackCFIRecord::parse("STACK CFI INIT 47 8 .cfa: ^ ^ ^")); + + EXPECT_EQ(llvm::None, StackCFIRecord::parse("STACK CFI INIT 47")); + EXPECT_EQ(llvm::None, StackCFIRecord::parse("STACK CFI INIT")); + EXPECT_EQ(llvm::None, StackCFIRecord::parse("STACK CFI")); + EXPECT_EQ(llvm::None, StackCFIRecord::parse("STACK")); + EXPECT_EQ(llvm::None, StackCFIRecord::parse("FILE 47 foo")); + EXPECT_EQ(llvm::None, StackCFIRecord::parse("42 47")); +} |

