Skip to content

Conversation

Nerixyz
Copy link
Contributor

@Nerixyz Nerixyz commented Oct 16, 2025

The test checks that functions have the correct type assigned. Because of the differences between the two PDB plugins, I split the test.
DIA creates one named Type per function and uses identical UIDs for Type and Function, whereas native creates one unnamed type per signature and has different UIDs.
The native test has the same input and checks the same functions.

I also removed the target-windows requirement from the test, since it only uses lldb-test.

@Nerixyz Nerixyz requested a review from JDevlieghere as a code owner October 16, 2025 10:15
@llvmbot llvmbot added the lldb label Oct 16, 2025
@llvmbot
Copy link
Member

llvmbot commented Oct 16, 2025

@llvm/pr-subscribers-lldb

Author: nerix (Nerixyz)

Changes

The test checks that functions have the correct type assigned. Because of the differences between the two PDB plugins, I split the test.
DIA creates one named Type per function and uses identical UIDs for Type and Function, whereas native creates one unnamed type per signature and has different UIDs.
The native test has the same input and checks the same functions.


Full diff: https://github.com/llvm/llvm-project/pull/163733.diff

2 Files Affected:

  • (added) lldb/test/Shell/SymbolFile/NativePDB/func-symbols.test (+133)
  • (modified) lldb/test/Shell/SymbolFile/PDB/func-symbols.test (+1-1)
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/func-symbols.test b/lldb/test/Shell/SymbolFile/NativePDB/func-symbols.test
new file mode 100644
index 0000000000000..33ffad6b2f20f
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/NativePDB/func-symbols.test
@@ -0,0 +1,133 @@
+# REQUIRES: lld
+
+# Test that functions have the correct types.
+# This uses the same input as SymbolFile/PDB/func-symbols.test. However, DIA 
+# creates one named `Type` per function and uses identical UIDs for `Type` and
+# `Function`, whereas native creates one unnamed type per signature and has different UIDs.
+
+# RUN: split-file %s %t
+# RUN: %build --compiler=clang-cl --arch=32 --nodefaultlib -o %t.exe %t/main.cpp %t/second.cpp
+# RUN: lldb-test symbols %t.exe | FileCheck --check-prefix=CHECK-ONE %s
+# RUN: lldb-test symbols %t.exe | FileCheck --check-prefix=CHECK-TWO %s
+
+#--- main.cpp
+
+// Global functions
+int Func_arg_array(int array[]) { return 1; }
+void Func_arg_void(void) { return; }
+void Func_arg_none(void) { return; }
+void Func_varargs(...) { return; }
+
+// Class
+namespace MemberTest {
+  class A {
+  public:
+    int Func(int a, ...) { return 1; }
+  };
+}
+
+// Template
+template <int N=1, class ...T>
+void TemplateFunc(T ...Arg) {
+  return;
+}
+
+// namespace
+namespace {
+  void Func(int a, const long b, volatile bool c, ...) { return; }
+}
+
+namespace NS {
+  void Func(char a, int b) {
+    return;
+  }
+}
+
+// Static function
+static long StaticFunction(int a)
+{
+  return 2;
+}
+
+// Inlined function
+inline void InlinedFunction(long a) { return; }
+
+extern void FunctionCall();
+
+int main() {
+  MemberTest::A v1;
+  v1.Func('a',10);
+
+  Func(1, 5, true, 10, 8);
+  NS::Func('c', 2);
+
+  TemplateFunc(10);
+  TemplateFunc(10,11,88);
+
+  StaticFunction(2);
+  InlinedFunction(1);
+
+  FunctionCall();
+  return 0;
+}
+
+#--- main-checks
+
+# CHECK-ONE: Module [[MD:.*]]
+# CHECK-ONE-DAG: SymbolFile native-pdb ([[MD]])
+# CHECK-ONE-DAG: [[TY0:.*]]:   Type{{.*}} , size = 0, compiler_type = {{.*}} int (int *)
+# CHECK-ONE-DAG: [[TY1:.*]]:   Type{{.*}} , size = 0, compiler_type = {{.*}} void (void)
+# CHECK-ONE-DAG: [[TY2:.*]]:   Type{{.*}} , size = 0, compiler_type = {{.*}} void (...)
+# CHECK-ONE-DAG: [[TY3:.*]]:   Type{{.*}} , size = 0, compiler_type = {{.*}} void (char, int)
+# CHECK-ONE-DAG: [[TY4:.*]]:   Type{{.*}} , size = 0, compiler_type = {{.*}} int (void)
+# CHECK-ONE-DAG: [[TY5:.*]]:   Type{{.*}} , size = 0, compiler_type = {{.*}} void (int, const long, volatile _Bool, ...)
+# CHECK-ONE-DAG: [[TY6:.*]]:   Type{{.*}} , size = 0, compiler_type = {{.*}} long (int)
+# CHECK-ONE-DAG: [[TY7:.*]]:   Type{{.*}} , size = 0, compiler_type = {{.*}} int (int, ...)
+# CHECK-ONE-DAG: [[TY8:.*]]:   Type{{.*}} , size = 0, compiler_type = {{.*}} void (int)
+# CHECK-ONE-DAG: [[TY9:.*]]:   Type{{.*}} , size = 0, compiler_type = {{.*}} void (int, int, int)
+# CHECK-ONE-DAG: [[TY10:.*]]:   Type{{.*}} , size = 0, compiler_type = {{.*}} void (long)
+
+# CHECK-ONE: {{.*}}:   CompileUnit{{.*}}, language = "c++", file = '{{.*}}main.cpp'
+# CHECK-ONE-DAG: Function{{.*}}, mangled = ?Func_arg_array@@YAHQAH@Z, type = [[TY0]]
+# CHECK-ONE-DAG: Function{{.*}}, mangled = ?Func_arg_void@@YAXXZ, type = [[TY1]]
+# CHECK-ONE-DAG: Function{{.*}}, mangled = ?Func_arg_none@@YAXXZ, type = [[TY1]]
+# CHECK-ONE-DAG: Function{{.*}}, mangled = ?Func_varargs@@YAXZZ, type = [[TY2]]
+# CHECK-ONE-DAG: Function{{.*}}, mangled = ?Func@NS@@YAXDH@Z, type = [[TY3]]
+# CHECK-ONE-DAG: Function{{.*}}, demangled = main, type = [[TY4]]
+# CHECK-ONE-DAG: Function{{.*}}, demangled = {{.*}}`anonymous namespace'::Func{{.*}}, type = [[TY5]]
+# CHECK-ONE-DAG: Function{{.*}}, demangled = {{.*}}StaticFunction{{.*}}, type = [[TY6]]
+# CHECK-ONE-DAG: Function{{.*}}, mangled = ?Func@A@MemberTest@@QAAHHZZ, type = [[TY7]]
+# CHECK-ONE-DAG: Function{{.*}}, mangled = ??$TemplateFunc@$00H@@YAXH@Z, type = [[TY8]]
+# CHECK-ONE-DAG: Function{{.*}}, mangled = ??$TemplateFunc@$00HHH@@YAXHHH@Z, type = [[TY9]]
+# CHECK-ONE-DAG: Function{{.*}}, mangled = ?InlinedFunction@@YAXJ@Z, type = [[TY10]]
+
+#--- second.cpp
+
+// Static function
+namespace {
+static long StaticFunction(int a)
+{
+  return 2;
+}
+}
+
+// Inlined function
+static inline int InlinedFunction(long a) { return 10; }
+
+void FunctionCall()
+{
+  StaticFunction(1);
+  InlinedFunction(1);
+}
+
+#--- second-checks
+
+# We expect new types observed in another compile unit
+# CHECK-TWO-DAG: [[TY1:.*]]:   Type{{.*}} , size = 0, compiler_type = {{.*}} void (void)
+# CHECK-TWO-DAG: [[TY2:.*]]:   Type{{.*}} , size = 0, compiler_type = {{.*}} long (int)
+# CHECK-TWO-DAG: [[TY3:.*]]:   Type{{.*}} , size = 0, compiler_type = {{.*}} int (long)
+
+# CHECK-TWO: {{.*}}:   CompileUnit{{.*}}, language = "c++", file = '{{.*}}second.cpp'
+# CHECK-TWO-DAG: Function{{.*}}, mangled = ?FunctionCall@@YAXXZ, type = [[TY1]]
+# CHECK-TWO-DAG: Function{{.*}}, demangled = {{.*}}`anonymous namespace'::StaticFunction{{.*}}, type = [[TY2]]
+# CHECK-TWO-DAG: Function{{.*}}, demangled = {{.*}}InlinedFunction{{.*}}, type = [[TY3]]
diff --git a/lldb/test/Shell/SymbolFile/PDB/func-symbols.test b/lldb/test/Shell/SymbolFile/PDB/func-symbols.test
index 408db14ba26f1..6417bf39b0678 100644
--- a/lldb/test/Shell/SymbolFile/PDB/func-symbols.test
+++ b/lldb/test/Shell/SymbolFile/PDB/func-symbols.test
@@ -1,4 +1,4 @@
-REQUIRES: target-windows, lld
+REQUIRES: target-windows, lld, diasdk
 RUN: mkdir -p %t.dir
 RUN: %build --compiler=clang-cl --arch=32 --nodefaultlib --output=%t.dir/FuncSymbolsTest.exe %S/Inputs/FuncSymbolsTestMain.cpp %S/Inputs/FuncSymbols.cpp
 RUN: lldb-test symbols %t.dir/FuncSymbolsTest.exe | FileCheck --check-prefix=CHECK-ONE %s

@Nerixyz Nerixyz merged commit e9b6d35 into llvm:main Oct 21, 2025
12 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 21, 2025

LLVM Buildbot has detected a new failure on builder lldb-remote-linux-ubuntu running on as-builder-9 while building lldb at step 17 "test-check-lldb-shell".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/195/builds/16275

Here is the relevant piece of the build log for the reference
Step 17 (test-check-lldb-shell) failure: Test just built components: check-lldb-shell completed (failure)
******************** TEST 'lldb-shell :: SymbolFile/NativePDB/func-symbols.test' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 8
split-file /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/test/Shell/SymbolFile/NativePDB/func-symbols.test /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/tools/lldb/test/Shell/SymbolFile/NativePDB/Output/func-symbols.test.tmp
# executed command: split-file /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/test/Shell/SymbolFile/NativePDB/func-symbols.test /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/tools/lldb/test/Shell/SymbolFile/NativePDB/Output/func-symbols.test.tmp
# note: command had no output on stdout or stderr
# RUN: at line 9
'/usr/bin/python3.12' /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/test/Shell/helper/build.py --compiler=clang --arch=64 --tools-dir=/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./bin --libs-dir=/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./lib --sysroot=/mnt/fs/jetson-agx-ubuntu --compiler=clang-cl --arch=32 --nodefaultlib -o /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/tools/lldb/test/Shell/SymbolFile/NativePDB/Output/func-symbols.test.tmp.exe /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/tools/lldb/test/Shell/SymbolFile/NativePDB/Output/func-symbols.test.tmp/main.cpp /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/tools/lldb/test/Shell/SymbolFile/NativePDB/Output/func-symbols.test.tmp/second.cpp
# executed command: /usr/bin/python3.12 /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/test/Shell/helper/build.py --compiler=clang --arch=64 --tools-dir=/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./bin --libs-dir=/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./lib --sysroot=/mnt/fs/jetson-agx-ubuntu --compiler=clang-cl --arch=32 --nodefaultlib -o /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/tools/lldb/test/Shell/SymbolFile/NativePDB/Output/func-symbols.test.tmp.exe /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/tools/lldb/test/Shell/SymbolFile/NativePDB/Output/func-symbols.test.tmp/main.cpp /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/tools/lldb/test/Shell/SymbolFile/NativePDB/Output/func-symbols.test.tmp/second.cpp
# .---command stdout------------
# | Cleaning main.ilk
# | Cleaning second.ilk
# | Cleaning func-symbols.test.tmp.exe-main.obj
# | Cleaning func-symbols.test.tmp.exe-second.obj
# | Cleaning func-symbols.test.tmp.pdb
# | Cleaning func-symbols.test.tmp.exe
# | 
# | 
# | 
# | compiling main.cpp -> func-symbols.test.tmp.exe-main.obj
# |   STDOUT:
# | 
# |   STDERR:
# |     error: unable to create target: 'No available targets are compatible with triple "thumbv7-pc-windows-msvc19.0.0"'
# |     1 error generated.
# | 
# `-----------------------------
# error: command failed with exit status: 1

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 21, 2025

LLVM Buildbot has detected a new failure on builder lldb-remote-linux-win running on as-builder-10 while building lldb at step 18 "test-check-lldb-shell".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/197/builds/10070

Here is the relevant piece of the build log for the reference
Step 18 (test-check-lldb-shell) failure: Test just built components: check-lldb-shell completed (failure)
******************** TEST 'lldb-shell :: SymbolFile/NativePDB/func-symbols.test' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 8
split-file C:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\test\Shell\SymbolFile\NativePDB\func-symbols.test C:\buildbot\as-builder-10\lldb-x-aarch64\build\tools\lldb\test\Shell\SymbolFile\NativePDB\Output\func-symbols.test.tmp
# executed command: split-file 'C:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\test\Shell\SymbolFile\NativePDB\func-symbols.test' 'C:\buildbot\as-builder-10\lldb-x-aarch64\build\tools\lldb\test\Shell\SymbolFile\NativePDB\Output\func-symbols.test.tmp'
# note: command had no output on stdout or stderr
# RUN: at line 9
'C:\Python312\python.exe' C:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\test\Shell\helper\build.py --compiler=clang --arch=64 --tools-dir=C:/buildbot/as-builder-10/lldb-x-aarch64/build/./bin --libs-dir=C:/buildbot/as-builder-10/lldb-x-aarch64/build/./lib --sysroot=c:/buildbot/fs/jetson-agx-ubuntu --compiler=clang-cl --arch=32 --nodefaultlib -o C:\buildbot\as-builder-10\lldb-x-aarch64\build\tools\lldb\test\Shell\SymbolFile\NativePDB\Output\func-symbols.test.tmp.exe C:\buildbot\as-builder-10\lldb-x-aarch64\build\tools\lldb\test\Shell\SymbolFile\NativePDB\Output\func-symbols.test.tmp/main.cpp C:\buildbot\as-builder-10\lldb-x-aarch64\build\tools\lldb\test\Shell\SymbolFile\NativePDB\Output\func-symbols.test.tmp/second.cpp
# executed command: 'C:\Python312\python.exe' 'C:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\test\Shell\helper\build.py' --compiler=clang --arch=64 --tools-dir=C:/buildbot/as-builder-10/lldb-x-aarch64/build/./bin --libs-dir=C:/buildbot/as-builder-10/lldb-x-aarch64/build/./lib --sysroot=c:/buildbot/fs/jetson-agx-ubuntu --compiler=clang-cl --arch=32 --nodefaultlib -o 'C:\buildbot\as-builder-10\lldb-x-aarch64\build\tools\lldb\test\Shell\SymbolFile\NativePDB\Output\func-symbols.test.tmp.exe' 'C:\buildbot\as-builder-10\lldb-x-aarch64\build\tools\lldb\test\Shell\SymbolFile\NativePDB\Output\func-symbols.test.tmp/main.cpp' 'C:\buildbot\as-builder-10\lldb-x-aarch64\build\tools\lldb\test\Shell\SymbolFile\NativePDB\Output\func-symbols.test.tmp/second.cpp'
# .---command stdout------------
# | Cleaning main.ilk
# | Cleaning second.ilk
# | Cleaning func-symbols.test.tmp.exe-main.obj
# | Cleaning func-symbols.test.tmp.exe-second.obj
# | Cleaning func-symbols.test.tmp.pdb
# | Cleaning func-symbols.test.tmp.exe
# | 
# | 
# | 
# | compiling main.cpp -> func-symbols.test.tmp.exe-main.obj
# |   STDOUT:
# | 
# |   STDERR:
# |     error: unable to create target: 'No available targets are compatible with triple "thumbv7-pc-windows-msvc19.0.0"'
# |     1 error generated.
# | 
# `-----------------------------
# error: command failed with exit status: 1

--

********************


Nerixyz added a commit that referenced this pull request Oct 21, 2025
…164406)

The test builds files for Windows, so the target has to be required. I
didn't add this in #163733.

Fixes the failure from
#163733 (comment).
llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request Oct 21, 2025
…ls.test` (#164406)

The test builds files for Windows, so the target has to be required. I
didn't add this in #163733.

Fixes the failure from
llvm/llvm-project#163733 (comment).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants