Skip to content

Commit

Permalink
[sancov] introducing symbolized coverage files (.symcov)
Browse files Browse the repository at this point in the history
Summary:
Answering any meaningful questions about .sancov files requires
accessing symbol information from the corresponding binary.

This change introduces a separate intermediate data structure and
format: symbolized coverage. It contains all symbol information that
is required to answer common queries:
- merging
- coverd/uncovered files and functions
- line status.

Also removing the html report functionality from sancov: generated
HTML files are too huge, and a different approach is required.
Maintaining this half-working approach in the C++ is painful.

Differential Revision: https://reviews.llvm.org/D24947

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282639 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
aizatsky-chromium committed Sep 28, 2016
1 parent 07aadc2 commit dc72d13
Show file tree
Hide file tree
Showing 7 changed files with 773 additions and 746 deletions.
4 changes: 4 additions & 0 deletions include/llvm/DebugInfo/DIContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ struct DILineInfo {
bool operator!=(const DILineInfo &RHS) const {
return !(*this == RHS);
}
bool operator<(const DILineInfo &RHS) const {
return std::tie(FileName, FunctionName, Line, Column) <
std::tie(RHS.FileName, RHS.FunctionName, RHS.Line, RHS.Column);
}
};

typedef SmallVector<std::pair<uint64_t, DILineInfo>, 16> DILineInfoTable;
Expand Down
25 changes: 25 additions & 0 deletions test/tools/sancov/Inputs/test-linux_x86_64.0.symcov
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"covered-points" : ["4e132b", "4e1472", "4e1520", "4e1553", "4e1586"],
"binary-hash" : "BB3CDD5045AED83906F6ADCC1C4DAF7E2596A6B5",
"point-symbol-info" : {
"test/tools/sancov/Inputs/foo.cpp" : {
"foo()" : {
"4e178c" : "5:0"
}
},
"test/tools/sancov/Inputs/test.cpp" : {
"bar(std::string)" : {
"4e132b" : "12:0"
},
"main" : {
"4e1472" : "14:0",
"4e14c2" : "16:9",
"4e1520" : "17:5",
"4e1553" : "17:5",
"4e1586" : "17:5",
"4e1635" : "19:1",
"4e1690" : "17:5"
}
}
}
}
25 changes: 25 additions & 0 deletions test/tools/sancov/Inputs/test-linux_x86_64.1.symcov
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"covered-points" : ["4e132b", "4e1472", "4e14c2", "4e1520", "4e1553", "4e1586", "4e178c"],
"binary-hash" : "BB3CDD5045AED83906F6ADCC1C4DAF7E2596A6B5",
"point-symbol-info" : {
"test/tools/sancov/Inputs/foo.cpp" : {
"foo()" : {
"4e178c" : "5:0"
}
},
"test/tools/sancov/Inputs/test.cpp" : {
"bar(std::string)" : {
"4e132b" : "12:0"
},
"main" : {
"4e1472" : "14:0",
"4e14c2" : "16:9",
"4e1520" : "17:5",
"4e1553" : "17:5",
"4e1586" : "17:5",
"4e1635" : "19:1",
"4e1690" : "17:5"
}
}
}
}
6 changes: 0 additions & 6 deletions test/tools/sancov/html-report.test

This file was deleted.

64 changes: 64 additions & 0 deletions test/tools/sancov/merge.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
REQUIRES: x86_64-linux
RUN: sancov -merge %p/Inputs/test-linux_x86_64.0.symcov| FileCheck --check-prefix=MERGE1 %s
RUN: sancov -merge %p/Inputs/test-linux_x86_64.0.symcov %p/Inputs/test-linux_x86_64.1.symcov| FileCheck --check-prefix=MERGE2 %s

MERGE1: {
MERGE1-NEXT: "covered-points" : ["4e132b", "4e1472", "4e1520", "4e1553", "4e1586"],
MERGE1-NEXT: "binary-hash" : "BB3CDD5045AED83906F6ADCC1C4DAF7E2596A6B5",
MERGE1-NEXT: "point-symbol-info" : {
MERGE1-NEXT: "test/tools/sancov/Inputs/foo.cpp" : {
MERGE1-NEXT: "foo()" : {
MERGE1-NEXT: "4e178c" : "5:0"
MERGE1-NEXT: }
MERGE1-NEXT: },
MERGE1-NEXT: "test/tools/sancov/Inputs/test.cpp" : {
MERGE1-NEXT: "bar(std::string)" : {
MERGE1-NEXT: "4e132b" : "12:0"
MERGE1-NEXT: },
MERGE1-NEXT: "main" : {
MERGE1-NEXT: "4e1472" : "14:0",
MERGE1-NEXT: "4e14c2" : "16:9",
MERGE1-NEXT: "4e1520" : "17:5",
MERGE1-NEXT: "4e1553" : "17:5",
MERGE1-NEXT: "4e1586" : "17:5",
MERGE1-NEXT: "4e1635" : "19:1",
MERGE1-NEXT: "4e1690" : "17:5"
MERGE1-NEXT: }
MERGE1-NEXT: }
MERGE1-NEXT: }
MERGE1-NEXT: }

MERGE2: {
MERGE2-NEXT: "covered-points" : ["BB3CDD5045AED83906F6ADCC1C4DAF7E2596A6B5:4e132b", "BB3CDD5045AED83906F6ADCC1C4DAF7E2596A6B5:4e1472", "BB3CDD5045AED83906F6ADCC1C4DAF7E2596A6B5:4e14c2", "BB3CDD5045AED83906F6ADCC1C4DAF7E2596A6B5:4e1520", "BB3CDD5045AED83906F6ADCC1C4DAF7E2596A6B5:4e1553", "BB3CDD5045AED83906F6ADCC1C4DAF7E2596A6B5:4e1586", "BB3CDD5045AED83906F6ADCC1C4DAF7E2596A6B5:4e178c"],
MERGE2-NEXT: "point-symbol-info" : {
MERGE2-NEXT: "test/tools/sancov/Inputs/foo.cpp" : {
MERGE2-NEXT: "foo()" : {
MERGE2-NEXT: "BB3CDD5045AED83906F6ADCC1C4DAF7E2596A6B5:4e178c" : "5:0",
MERGE2-NEXT: "BB3CDD5045AED83906F6ADCC1C4DAF7E2596A6B5:4e178c" : "5:0"
MERGE2-NEXT: }
MERGE2-NEXT: },
MERGE2-NEXT: "test/tools/sancov/Inputs/test.cpp" : {
MERGE2-NEXT: "bar(std::string)" : {
MERGE2-NEXT: "BB3CDD5045AED83906F6ADCC1C4DAF7E2596A6B5:4e132b" : "12:0",
MERGE2-NEXT: "BB3CDD5045AED83906F6ADCC1C4DAF7E2596A6B5:4e132b" : "12:0"
MERGE2-NEXT: },
MERGE2-NEXT: "main" : {
MERGE2-NEXT: "BB3CDD5045AED83906F6ADCC1C4DAF7E2596A6B5:4e1472" : "14:0",
MERGE2-NEXT: "BB3CDD5045AED83906F6ADCC1C4DAF7E2596A6B5:4e14c2" : "16:9",
MERGE2-NEXT: "BB3CDD5045AED83906F6ADCC1C4DAF7E2596A6B5:4e1520" : "17:5",
MERGE2-NEXT: "BB3CDD5045AED83906F6ADCC1C4DAF7E2596A6B5:4e1553" : "17:5",
MERGE2-NEXT: "BB3CDD5045AED83906F6ADCC1C4DAF7E2596A6B5:4e1586" : "17:5",
MERGE2-NEXT: "BB3CDD5045AED83906F6ADCC1C4DAF7E2596A6B5:4e1635" : "19:1",
MERGE2-NEXT: "BB3CDD5045AED83906F6ADCC1C4DAF7E2596A6B5:4e1690" : "17:5",
MERGE2-NEXT: "BB3CDD5045AED83906F6ADCC1C4DAF7E2596A6B5:4e1472" : "14:0",
MERGE2-NEXT: "BB3CDD5045AED83906F6ADCC1C4DAF7E2596A6B5:4e14c2" : "16:9",
MERGE2-NEXT: "BB3CDD5045AED83906F6ADCC1C4DAF7E2596A6B5:4e1520" : "17:5",
MERGE2-NEXT: "BB3CDD5045AED83906F6ADCC1C4DAF7E2596A6B5:4e1553" : "17:5",
MERGE2-NEXT: "BB3CDD5045AED83906F6ADCC1C4DAF7E2596A6B5:4e1586" : "17:5",
MERGE2-NEXT: "BB3CDD5045AED83906F6ADCC1C4DAF7E2596A6B5:4e1635" : "19:1",
MERGE2-NEXT: "BB3CDD5045AED83906F6ADCC1C4DAF7E2596A6B5:4e1690" : "17:5"
MERGE2-NEXT: }
MERGE2-NEXT: }
MERGE2-NEXT: }
MERGE2-NEXT: }

29 changes: 29 additions & 0 deletions test/tools/sancov/symbolize.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
REQUIRES: x86_64-linux
RUN: sancov -symbolize -strip_path_prefix="llvm/" %p/Inputs/test-linux_x86_64 %p/Inputs/test-linux_x86_64.0.sancov | FileCheck %s

CHECK: {
CHECK-NEXT: "covered-points" : ["4e132b", "4e1472", "4e1520", "4e1553", "4e1586"],
CHECK-NEXT: "binary-hash" : "BB3CDD5045AED83906F6ADCC1C4DAF7E2596A6B5",
CHECK-NEXT: "point-symbol-info" : {
CHECK-NEXT: "test/tools/sancov/Inputs/foo.cpp" : {
CHECK-NEXT: "foo()" : {
CHECK-NEXT: "4e178c" : "5:0"
CHECK-NEXT: }
CHECK-NEXT: },
CHECK-NEXT: "test/tools/sancov/Inputs/test.cpp" : {
CHECK-NEXT: "bar(std::string)" : {
CHECK-NEXT: "4e132b" : "12:0"
CHECK-NEXT: },
CHECK-NEXT: "main" : {
CHECK-NEXT: "4e1472" : "14:0",
CHECK-NEXT: "4e14c2" : "16:9",
CHECK-NEXT: "4e1520" : "17:5",
CHECK-NEXT: "4e1553" : "17:5",
CHECK-NEXT: "4e1586" : "17:5",
CHECK-NEXT: "4e1635" : "19:1",
CHECK-NEXT: "4e1690" : "17:5"
CHECK-NEXT: }
CHECK-NEXT: }
CHECK-NEXT: }
CHECK-NEXT:}

Loading

0 comments on commit dc72d13

Please sign in to comment.