Skip to content

[lldb] Combine disassembler gtest binaries for efficiency #133539

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 30, 2025

Conversation

rnk
Copy link
Collaborator

@rnk rnk commented Mar 28, 2025

Each of these executables is 642MB for me locally with split DWARF, and we don't need 3 statically linked gtest binaries when one will do.

Each of these executables is 642MB for me locally with split DWARF, and
we don't need 3 statically linked gtest binaries when one will do.
@rnk rnk requested a review from JDevlieghere as a code owner March 28, 2025 22:41
@llvmbot llvmbot added the lldb label Mar 28, 2025
@llvmbot
Copy link
Member

llvmbot commented Mar 28, 2025

@llvm/pr-subscribers-lldb

Author: Reid Kleckner (rnk)

Changes

Each of these executables is 642MB for me locally with split DWARF, and we don't need 3 statically linked gtest binaries when one will do.


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

4 Files Affected:

  • (removed) lldb/unittests/Disassembler/ARM/CMakeLists.txt (-12)
  • (modified) lldb/unittests/Disassembler/CMakeLists.txt (+24-3)
  • (removed) lldb/unittests/Disassembler/RISCV/CMakeLists.txt (-12)
  • (removed) lldb/unittests/Disassembler/x86/CMakeLists.txt (-12)
diff --git a/lldb/unittests/Disassembler/ARM/CMakeLists.txt b/lldb/unittests/Disassembler/ARM/CMakeLists.txt
deleted file mode 100644
index 91af06fa19d6f..0000000000000
--- a/lldb/unittests/Disassembler/ARM/CMakeLists.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-add_lldb_unittest(DisassemblerTests
-  TestArm64Disassembly.cpp
-  TestArmv7Disassembly.cpp
-  LINK_LIBS
-    lldbCore
-    lldbSymbol
-    lldbTarget
-    lldbPluginDisassemblerLLVMC
-    lldbPluginProcessUtility
-  LINK_COMPONENTS
-    Support
-    ${LLVM_TARGETS_TO_BUILD})
diff --git a/lldb/unittests/Disassembler/CMakeLists.txt b/lldb/unittests/Disassembler/CMakeLists.txt
index 208f1807427f4..4d443b69f29b1 100644
--- a/lldb/unittests/Disassembler/CMakeLists.txt
+++ b/lldb/unittests/Disassembler/CMakeLists.txt
@@ -1,11 +1,32 @@
+set(disas_srcs "")
+
 if("ARM" IN_LIST LLVM_TARGETS_TO_BUILD)
-  add_subdirectory(ARM)
+  set(disas_srcs ${disas_srcs}
+    ARM/TestArm64Disassembly.cpp
+    ARM/TestArmv7Disassembly.cpp
+  )
 endif()
 
 if("X86" IN_LIST LLVM_TARGETS_TO_BUILD)
-  add_subdirectory(x86)
+  set(disas_srcs ${disas_srcs}
+    x86/TestGetControlFlowKindx86.cpp
+  )
 endif()
 
 if("RISCV" IN_LIST LLVM_TARGETS_TO_BUILD)
-	add_subdirectory(RISCV)
+  set(disas_srcs ${disas_srcs}
+    RISCV/TestMCDisasmInstanceRISCV.cpp
+  )
 endif()
+
+add_lldb_unittest(DisassemblerTests
+  ${disas_srcs}
+  LINK_LIBS
+    lldbCore
+    lldbSymbol
+    lldbTarget
+    lldbPluginDisassemblerLLVMC
+    lldbPluginProcessUtility
+  LINK_COMPONENTS
+    Support
+    ${LLVM_TARGETS_TO_BUILD})
diff --git a/lldb/unittests/Disassembler/RISCV/CMakeLists.txt b/lldb/unittests/Disassembler/RISCV/CMakeLists.txt
deleted file mode 100644
index 5bcc3e948335c..0000000000000
--- a/lldb/unittests/Disassembler/RISCV/CMakeLists.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-add_lldb_unittest(MCDisasmInstanceRISCVTests
-	TestMCDisasmInstanceRISCV.cpp
-    LINK_LIBS
-      lldbCore
-      lldbSymbol
-      lldbTarget
-      lldbPluginDisassemblerLLVMC
-      lldbPluginProcessUtility
-    LINK_COMPONENTS
-      Support
-      ${LLVM_TARGETS_TO_BUILD}
-  )
diff --git a/lldb/unittests/Disassembler/x86/CMakeLists.txt b/lldb/unittests/Disassembler/x86/CMakeLists.txt
deleted file mode 100644
index 31d84cf5d8365..0000000000000
--- a/lldb/unittests/Disassembler/x86/CMakeLists.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-add_lldb_unittest(GetControlFlowKindx86Tests
-    TestGetControlFlowKindx86.cpp
-    LINK_LIBS
-      lldbCore
-      lldbSymbol
-      lldbTarget
-      lldbPluginDisassemblerLLVMC
-      lldbPluginProcessUtility
-    LINK_COMPONENTS
-      Support
-      ${LLVM_TARGETS_TO_BUILD}
-  )

Copy link
Member

@bulbazord bulbazord left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor suggestion. Otherwise lgtm

Copy link
Member

@JDevlieghere JDevlieghere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with Alex' suggestion.

@rnk rnk merged commit 848faf4 into llvm:main Mar 30, 2025
10 checks passed
@rnk
Copy link
Collaborator Author

rnk commented Mar 30, 2025

Thanks!

@llvm-ci
Copy link
Collaborator

llvm-ci commented Mar 30, 2025

LLVM Buildbot has detected a new failure on builder lldb-remote-linux-ubuntu running on as-builder-9 while building lldb at step 6 "cmake-configure".

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

Here is the relevant piece of the build log for the reference
Step 6 (cmake-configure) failure: cmake (failure)
...
-- Enable editline support in LLDB: FALSE
-- Enable curses support in LLDB: FALSE
-- Enable LZMA compression support in LLDB: FALSE
-- Could NOT find Lua (missing: LUA_LIBRARIES LUA_INCLUDE_DIR) (Required is at least version "5.3")
-- Could NOT find LuaAndSwig (missing: LUA_LIBRARIES LUA_INCLUDE_DIR LUA_VERSION_MINOR LUA_VERSION_MAJOR) 
-- Enable Lua scripting support in LLDB: FALSE
-- Found Python3: /usr/bin/python3.12 (found version "3.12.3") found components: Interpreter Development Development.Module Development.Embed
-- Found PythonAndSwig: /usr/lib/x86_64-linux-gnu/libpython3.12.so
-- Enable Python scripting support in LLDB: TRUE
-- Enable Libxml 2 support in LLDB: FALSE
-- Enable libfbsdvmcore support in LLDB: 0
-- Performing Test CXX_SUPPORTS_STRINGOP_TRUNCATION
-- Performing Test CXX_SUPPORTS_STRINGOP_TRUNCATION - Success
-- LLDB version: 21.0.0git
-- Looking for ppoll
-- Looking for ppoll - found
-- Looking for ptsname_r
-- Looking for ptsname_r - found
-- Looking for accept4
-- Looking for accept4 - found
-- Looking for termios.h
-- Looking for termios.h - found
-- Looking for include files sys/types.h, sys/event.h
-- Looking for include files sys/types.h, sys/event.h - not found
-- Looking for process_vm_readv
-- Looking for process_vm_readv - found
-- Looking for __NR_process_vm_readv
-- Looking for __NR_process_vm_readv - found
-- Looking for compression_encode_buffer in compression
-- Looking for compression_encode_buffer in compression - not found
-- Skipping FreeBSDKernel plugin due to missing libfbsdvmcore
-- Symbols (liblldb): exporting all symbols from the lldb namespace
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) 
-- Found make: /usr/bin/gmake
-- Performing Test CXX_SUPPORTS_DOCUMENTATION
-- Performing Test CXX_SUPPORTS_DOCUMENTATION - Failed
-- Looking for gettid
-- Looking for gettid - found
-- Registering ExampleIRTransforms as a pass plugin (static build: OFF)
-- Registering Bye as a pass plugin (static build: OFF)
-- Configuring done (16.9s)
CMake Error at cmake/modules/AddLLVM.cmake:1068 (add_executable):
  No SOURCES given to target: DisassemblerTests
Call Stack (most recent call first):
  cmake/modules/AddLLVM.cmake:1768 (add_llvm_executable)
  /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/unittests/CMakeLists.txt:26 (add_unittest)
  /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/unittests/Disassembler/CMakeLists.txt:22 (add_lldb_unittest)


CMake Generate step failed.  Build files cannot be regenerated correctly.

@llvm-ci
Copy link
Collaborator

llvm-ci commented Mar 30, 2025

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

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

Here is the relevant piece of the build log for the reference
Step 16 (test-check-lldb-unit) failure: Test just built components: check-lldb-unit completed (failure)
...
0.772 [57/130/106]Building CXX object tools\lldb\unittests\TestingSupport\Symbol\CMakeFiles\lldbSymbolHelpers.dir\YAMLModuleTester.cpp.obj
0.779 [56/130/107]Building CXX object tools\lldb\unittests\Expression\CMakeFiles\ExpressionTests.dir\ClangExpressionDeclMapTest.cpp.obj
0.781 [55/130/108]Building RC object tools\lldb\unittests\tools\lldb-server\CMakeFiles\environment_check.dir\C_\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\llvm\resources\windows_version_resource.rc.res
0.783 [54/130/109]Building RC object tools\lldb\unittests\UnwindAssembly\ARM64\CMakeFiles\Arm64InstEmulationTests.dir\C_\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\llvm\resources\windows_version_resource.rc.res
0.788 [53/130/110]Building CXX object tools\lldb\unittests\Interpreter\CMakeFiles\InterpreterTests.dir\TestCommandPaths.cpp.obj
0.793 [52/130/111]Building CXX object tools\lldb\unittests\Interpreter\CMakeFiles\InterpreterTests.dir\TestCompletion.cpp.obj
0.797 [51/130/112]Building CXX object tools\lldb\unitteninja: no work to do.
sts\Core\CMakeFiles\LLDBCoreTests.dir\CommunicationTest.cpp.obj
0.797 [50/130/112]Performing build step for 'builtins-aarch64-unknown-linux-gnu'
0.821 [49/121/123]Linking CXX executable tools\lldb\unittests\Disassembler\DisassemblerTests.exe
FAILED: tools/lldb/unittests/Disassembler/DisassemblerTests.exe 
cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=tools\lldb\unittests\Disassembler\CMakeFiles\DisassemblerTests.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\mt.exe --manifests  -- C:\PROGRA~1\MICROS~1\2022\COMMUN~1\VC\Tools\MSVC\1441~1.341\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\DisassemblerTests.rsp  /out:tools\lldb\unittests\Disassembler\DisassemblerTests.exe /implib:tools\lldb\unittests\Disassembler\DisassemblerTests.lib /pdb:tools\lldb\unittests\Disassembler\DisassemblerTests.pdb /version:0.0 /machine:x64 /STACK:10000000 /INCREMENTAL:NO /subsystem:console  && cmd.exe /C "cd /D C:\buildbot\as-builder-10\lldb-x-aarch64\build\tools\lldb\unittests\Disassembler && "C:\Program Files\CMake\bin\cmake.exe" -E make_directory C:/buildbot/as-builder-10/lldb-x-aarch64/build/tools/lldb/unittests/Disassembler/./Inputs""
LINK: command "C:\PROGRA~1\MICROS~1\2022\COMMUN~1\VC\Tools\MSVC\1441~1.341\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\DisassemblerTests.rsp /out:tools\lldb\unittests\Disassembler\DisassemblerTests.exe /implib:tools\lldb\unittests\Disassembler\DisassemblerTests.lib /pdb:tools\lldb\unittests\Disassembler\DisassemblerTests.pdb /version:0.0 /machine:x64 /STACK:10000000 /INCREMENTAL:NO /subsystem:console /MANIFEST /MANIFESTFILE:tools\lldb\unittests\Disassembler\DisassemblerTests.exe.manifest" failed (exit code 1120) with the following output:
LINK : warning LNK4199: /DELAYLOAD:shell32.dll ignored; no imports found from shell32.dll

LINK : warning LNK4199: /DELAYLOAD:ole32.dll ignored; no imports found from ole32.dll

LINK : error LNK2001: unresolved external symbol mainCRTStartup

tools\lldb\unittests\Disassembler\DisassemblerTests.exe : fatal error LNK1120: 1 unresolved externals

1.187 [49/75/169]Building CXX object tools\lldb\unittests\Symbol\CMakeFiles\SymbolTests.dir\TestClangASTImporter.cpp.obj
1.188 [49/73/171]Building CXX object tools\lldb\unittests\Utility\CMakeFiles\UtilityTests.dir\StatusTest.cpp.obj
1.190 [49/72/172]Building CXX object tools\lldb\unittests\Target\CMakeFiles\TargetTests.dir\LocateModuleCallbackTest.cpp.obj
1.192 [49/71/173]Building CXX object tools\lldb\unittests\Symbol\CMakeFiles\SymbolTests.dir\SymtabTest.cpp.obj
1.193 [49/70/174]Building CXX object tools\lldb\unittests\Utility\CMakeFiles\UtilityTests.dir\EventTest.cpp.obj
1.196 [49/69/175]Building CXX object tools\lldb\unittests\Symbol\CMakeFiles\SymbolTests.dir\TestLineEntry.cpp.obj
1.197 [49/68/176]Building CXX object tools\lldb\unittests\Symbol\CMakeFiles\SymbolTests.dir\TestDWARFCallFrameInfo.cpp.obj
1.198 [49/67/177]Building CXX object tools\lldb\unittests\Target\CMakeFiles\TargetTests.dir\MemoryTest.cpp.obj
1.199 [49/66/178]Building CXX object tools\lldb\unittests\Target\CMakeFiles\TargetTests.dir\RemoteAwarePlatformTest.cpp.obj
1.200 [49/65/179]Building CXX object tools\lldb\unittests\Utility\CMakeFiles\UtilityTests.dir\RealpathPrefixesTest.cpp.obj
1.201 [49/64/180]Building CXX object tools\lldb\unittests\Utility\CMakeFiles\UtilityTests.dir\FileSpecListTest.cpp.obj
1.203 [49/63/181]Building CXX object tools\lldb\unittests\Symbol\CMakeFiles\SymbolTests.dir\TestTypeSystemClang.cpp.obj
1.205 [49/62/182]Building CXX object tools\lldb\unittests\Target\CMakeFiles\TargetTests.dir\StackFrameRecognizerTest.cpp.obj
1.206 [49/61/183]Building CXX object tools\lldb\unittests\Utility\CMakeFiles\UtilityTests.dir\OptionsWithRawTest.cpp.obj
1.207 [49/60/184]Building CXX object tools\lldb\unittests\Utility\CMakeFiles\UtilityTests.dir\SharedClusterTest.cpp.obj
1.208 [49/59/185]Building CXX object tools\lldb\unittests\Utility\CMakeFiles\UtilityTests.dir\ArgsTest.cpp.obj
1.208 [49/58/186]Building CXX object tools\lldb\unittests\Utility\CMakeFiles\UtilityTests.dir\UserIDResolverTest.cpp.obj
1.211 [49/57/187]Building CXX object tools\lldb\unittests\Platform\CMakeFiles\LLDBPlatformTests.dir\PlatformSiginfoTest.cpp.obj
1.211 [49/56/188]Building RC object tools\lldb\unittests\Thread\CMakeFiles\ThreadTests.dir\C_\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\llvm\resources\windows_version_resource.rc.res
1.212 [49/55/189]Building CXX object tools\lldb\unittests\Process\gdb-remote\CMakeFiles\ProcessGdbRemoteTests.dir\GDBRemoteCommunicationClientTest.cpp.obj
1.213 [49/54/190]Building CXX object tools\lldb\unittests\Utility\CMakeFiles\UtilityTests.dir\StructuredDataTest.cpp.obj
1.214 [49/53/191]Building CXX object tools\lldb\unittests\Utility\CMakeFiles\UtilityTests.dir\PredicateTest.cpp.obj
1.214 [49/52/192]Building CXX object tools\lldb\unittests\Utility\CMakeFiles\UtilityTests.dir\BroadcasterTest.cpp.obj
1.217 [49/51/193]Building CXX object tools\lldb\unittests\SymbolFile\DWARF\CMakeFiles\SymbolFileDWARFTests.dir\DWARFASTParserClangTests.cpp.obj
1.220 [49/50/194]Building CXX object tools\lldb\unittests\SymbolFile\DWARF\CMakeFiles\SymbolFileDWARFTests.dir\DWARFIndexCachingTest.cpp.obj
1.220 [49/49/195]Building CXX object tools\lldb\unittests\Utility\CMakeFiles\UtilityTests.dir\TraceGDBRemotePacketsTest.cpp.obj
1.223 [49/48/196]Building CXX object tools\lldb\unittests\Platform\Android\CMakeFiles\AdbClientTests.dir\PlatformAndroidTest.cpp.obj
1.225 [49/47/197]Building CXX object tools\lldb\unittests\SymbolFile\DWARF\CMakeFiles\SymbolFileDWARFTests.dir\DWARFDebugNamesIndexTest.cpp.obj

SchrodingerZhu pushed a commit to SchrodingerZhu/llvm-project that referenced this pull request Mar 31, 2025
Each of these executables is 642MB for me locally with split DWARF, and
we don't need 3 statically linked gtest binaries when one will do.
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.

5 participants