summaryrefslogtreecommitdiffstats
path: root/lldb/lit/SymbolFile
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2018-06-28 10:03:42 +0000
committerPavel Labath <labath@google.com>2018-06-28 10:03:42 +0000
commit9ea80d259f8a8077c9cfbbc125c824d98aad927c (patch)
treebd48a343a35d18f9377c551e6c91c146b5becbc6 /lldb/lit/SymbolFile
parentabebe4c746e34220fdd1da6783dd3920125260d0 (diff)
downloadbcm5719-llvm-9ea80d259f8a8077c9cfbbc125c824d98aad927c.tar.gz
bcm5719-llvm-9ea80d259f8a8077c9cfbbc125c824d98aad927c.zip
Retrieve a function PDB symbol correctly from nested blocks
Summary: This patch fixes a problem with retrieving a function symbol by an address in a nested block. In the current implementation of ResolveSymbolContext function it retrieves a symbol with PDB_SymType::None and then checks if found symbol's tag equals to PDB_SymType::Function. So, if nested block's symbol was found, ResolveSymbolContext does not resolve a function. Reviewers: asmith, labath, zturner Reviewed By: asmith, labath Differential Revision: https://reviews.llvm.org/D47939 Patch by Aleksandr Urakov <aleksandr.urakov@jetbrains.com> llvm-svn: 335822
Diffstat (limited to 'lldb/lit/SymbolFile')
-rw-r--r--lldb/lit/SymbolFile/PDB/Inputs/FunctionNestedBlockTest.cpp8
-rw-r--r--lldb/lit/SymbolFile/PDB/function-nested-block.test7
2 files changed, 15 insertions, 0 deletions
diff --git a/lldb/lit/SymbolFile/PDB/Inputs/FunctionNestedBlockTest.cpp b/lldb/lit/SymbolFile/PDB/Inputs/FunctionNestedBlockTest.cpp
new file mode 100644
index 00000000000..62e201df5fe
--- /dev/null
+++ b/lldb/lit/SymbolFile/PDB/Inputs/FunctionNestedBlockTest.cpp
@@ -0,0 +1,8 @@
+int main() {
+ auto r = 0;
+ for (auto i = 1; i <= 10; i++) {
+ r += i & 1 + (i - 1) & 1 - 1;
+ }
+
+ return r;
+}
diff --git a/lldb/lit/SymbolFile/PDB/function-nested-block.test b/lldb/lit/SymbolFile/PDB/function-nested-block.test
new file mode 100644
index 00000000000..0118885b706
--- /dev/null
+++ b/lldb/lit/SymbolFile/PDB/function-nested-block.test
@@ -0,0 +1,7 @@
+REQUIRES: windows, lld
+RUN: clang-cl /c /Zi %S/Inputs/FunctionNestedBlockTest.cpp /o %t.obj
+RUN: lld-link /debug:full /nodefaultlib /entry:main %t.obj /out:%t.exe
+RUN: lldb-test symbols -find=function -file FunctionNestedBlockTest.cpp -line 4 %t.exe | FileCheck %s
+
+CHECK: Found 1 functions:
+CHECK: name = "{{.*}}", mangled = "_main"
OpenPOWER on IntegriCloud