[llvm] c5ce3b1 - [llvm-debuginfo-analyzer] Include linkage names while evaluating `--select`
Nabeel Omer via llvm-commits
llvm-commits at lists.llvm.org
Wed May 17 06:12:54 PDT 2023
Author: Nabeel Omer
Date: 2023-05-17T13:12:46Z
New Revision: c5ce3b136cfaafd656dbce3665b1d6a39845fa88
URL: https://github.com/llvm/llvm-project/commit/c5ce3b136cfaafd656dbce3665b1d6a39845fa88
DIFF: https://github.com/llvm/llvm-project/commit/c5ce3b136cfaafd656dbce3665b1d6a39845fa88.diff
LOG: [llvm-debuginfo-analyzer] Include linkage names while evaluating `--select`
This patch allows mangled names to be passed to --select.
Differential Revision: https://reviews.llvm.org/D150190
Added:
Modified:
llvm/include/llvm/DebugInfo/LogicalView/Core/LVOptions.h
llvm/test/tools/llvm-debuginfo-analyzer/COFF/01-coff-select-logical-elements.test
llvm/test/tools/llvm-debuginfo-analyzer/DWARF/01-dwarf-select-logical-elements.test
Removed:
################################################################################
diff --git a/llvm/include/llvm/DebugInfo/LogicalView/Core/LVOptions.h b/llvm/include/llvm/DebugInfo/LogicalView/Core/LVOptions.h
index e154243f44708..a0a360c0a434f 100644
--- a/llvm/include/llvm/DebugInfo/LogicalView/Core/LVOptions.h
+++ b/llvm/include/llvm/DebugInfo/LogicalView/Core/LVOptions.h
@@ -511,7 +511,9 @@ class LVPatterns final {
void resolveGenericPatternMatch(T *Element, const U &Requests) {
assert(Element && "Element must not be nullptr");
auto CheckPattern = [=]() -> bool {
- return (Element->isNamed() && matchGenericPattern(Element->getName())) ||
+ return (Element->isNamed() &&
+ (matchGenericPattern(Element->getName()) ||
+ matchGenericPattern(Element->getLinkageName()))) ||
(Element->isTyped() &&
matchGenericPattern(Element->getTypeName()));
};
diff --git a/llvm/test/tools/llvm-debuginfo-analyzer/COFF/01-coff-select-logical-elements.test b/llvm/test/tools/llvm-debuginfo-analyzer/COFF/01-coff-select-logical-elements.test
index 49142726cf585..1e50ba729bd15 100644
--- a/llvm/test/tools/llvm-debuginfo-analyzer/COFF/01-coff-select-logical-elements.test
+++ b/llvm/test/tools/llvm-debuginfo-analyzer/COFF/01-coff-select-logical-elements.test
@@ -68,3 +68,28 @@
; TWO-EMPTY:
; TWO-NEXT: [001] {CompileUnit} 'test.cpp'
; TWO-NEXT: [004] {TypeAlias} 'INTEGER' -> 'int'
+
+; Select logical elements by matching linkage names.
+; The following prints all symbols that
+; contain "?foo@@YAHPEBHI_N at Z" in their linkage names, using a tab layout
+; and given the number of matches.
+
+; RUN: llvm-debuginfo-analyzer --attribute=level \
+; RUN: --select=?foo@@YAHPEBHI_N at Z \
+; RUN: --report=list \
+; RUN: --print=symbols \
+; RUN: %p/Inputs/test-codeview-clang.o \
+; RUN: %p/Inputs/test-codeview-msvc.o 2>&1 | \
+; RUN: FileCheck --strict-whitespace -check-prefix=THREE %s
+
+; THREE: Logical View:
+; THREE-NEXT: [000] {File} 'test-codeview-clang.o'
+; THREE-EMPTY:
+; THREE-NEXT: [001] {CompileUnit} 'test.cpp'
+; THREE-NEXT: [002] {Function} extern not_inlined 'foo' -> 'int'
+; THREE-EMPTY:
+; THREE: Logical View:
+; THREE-NEXT: [000] {File} 'test-codeview-msvc.o'
+; THREE-EMPTY:
+; THREE-NEXT: [001] {CompileUnit} 'test.cpp'
+; THREE-NEXT: [002] {Function} extern not_inlined 'foo' -> 'int'
diff --git a/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/01-dwarf-select-logical-elements.test b/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/01-dwarf-select-logical-elements.test
index cb98176d81858..f84e9201d3044 100644
--- a/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/01-dwarf-select-logical-elements.test
+++ b/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/01-dwarf-select-logical-elements.test
@@ -71,3 +71,28 @@
; TWO-NEXT: [001] {CompileUnit} 'test.cpp'
; TWO-NEXT: [004] 4 {TypeAlias} 'INTEGER' -> 'int'
; TWO-NEXT: [004] 5 {Variable} 'CONSTANT' -> 'const INTEGER'
+
+; Select logical elements based on linkage names.
+; The following prints all symbols that
+; contain "_Z3fooPKijb" in their linkage names, using a tab layout
+; and given the number of matches.
+
+; RUN: llvm-debuginfo-analyzer --attribute=level \
+; RUN: --select=_Z3fooPKijb \
+; RUN: --report=list \
+; RUN: --print=symbols \
+; RUN: %p/Inputs/pr-57040-test-dwarf-clang.o \
+; RUN: %p/Inputs/pr-57040-test-dwarf-gcc.o 2>&1 | \
+; RUN: FileCheck --strict-whitespace -check-prefix=THREE %s
+
+; THREE: Logical View:
+; THREE-NEXT: [000] {File} 'pr-57040-test-dwarf-clang.o'
+; THREE-EMPTY:
+; THREE-NEXT: [001] {CompileUnit} 'test.cpp'
+; THREE-NEXT: [002] 2 {Function} extern not_inlined 'foo' -> 'int'
+; THREE-EMPTY:
+; THREE: Logical View:
+; THREE-NEXT: [000] {File} 'pr-57040-test-dwarf-gcc.o'
+; THREE-EMPTY:
+; THREE-NEXT: [001] {CompileUnit} 'test.cpp'
+; THREE-NEXT: [002] 2 {Function} extern not_inlined 'foo' -> 'int'
More information about the llvm-commits
mailing list