Skip to content

Conversation

@JDevlieghere
Copy link
Member

As suggested by Augusto, add an assert to the NonNullSharedPtr move constructor.

@llvmbot
Copy link
Member

llvmbot commented Nov 21, 2025

@llvm/pr-subscribers-lldb

Author: Jonas Devlieghere (JDevlieghere)

Changes

As suggested by Augusto, add an assert to the NonNullSharedPtr move constructor.


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

1 Files Affected:

  • (modified) lldb/include/lldb/Utility/NonNullSharedPtr.h (+5-4)
diff --git a/lldb/include/lldb/Utility/NonNullSharedPtr.h b/lldb/include/lldb/Utility/NonNullSharedPtr.h
index 7e12ce72c6238..5011822503c77 100644
--- a/lldb/include/lldb/Utility/NonNullSharedPtr.h
+++ b/lldb/include/lldb/Utility/NonNullSharedPtr.h
@@ -29,12 +29,13 @@ template <typename T> class NonNullSharedPtr : private std::shared_ptr<T> {
 public:
   NonNullSharedPtr(const std::shared_ptr<T> &t)
       : Base(t ? t : std::make_shared<T>()) {
-    assert(t && "NonNullSharedPtr initialized from NULL shared_ptr");
+    assert(t && "NonNullSharedPtr constructed from nullptr");
   }
 
-  NonNullSharedPtr(std::shared_ptr<T> &&t)
-      : Base(t ? std::move(t) : std::make_shared<T>()) {
-    // Can't assert on t as it's been moved-from.
+  NonNullSharedPtr(std::shared_ptr<T> &&t) : Base(std::move(t)) {
+    assert(*this && "NonNullSharedPtr constructed from nullptr");
+    if (!t)
+      Base::operator=(std::make_shared<T>());
   }
 
   NonNullSharedPtr(const NonNullSharedPtr &other) : Base(other) {}

@JDevlieghere JDevlieghere enabled auto-merge (squash) November 21, 2025 01:10
As suggested by Augusto,  add an assert to NonNullSharedPtr move
constructor.
@JDevlieghere JDevlieghere merged commit cf837e2 into llvm:main Nov 21, 2025
7 of 9 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 21, 2025

LLVM Buildbot has detected a new failure on builder lldb-aarch64-ubuntu running on linaro-lldb-aarch64-ubuntu while building lldb at step 6 "test".

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

Here is the relevant piece of the build log for the reference
Step 6 (test) failure: build (failure)
...
PASS: lldb-api :: commands/log/basic/TestLogHandlers.py (188 of 2388)
PASS: lldb-api :: commands/help/TestHelp.py (189 of 2388)
PASS: lldb-api :: commands/log/invalid-args/TestInvalidArgsLog.py (190 of 2388)
PASS: lldb-api :: commands/frame/var/TestFrameVar.py (191 of 2388)
PASS: lldb-api :: commands/platform/basic/TestPlatformCommand.py (192 of 2388)
PASS: lldb-api :: commands/platform/basic/TestPlatformPython.py (193 of 2388)
PASS: lldb-api :: commands/memory/write/TestMemoryWrite.py (194 of 2388)
PASS: lldb-api :: commands/platform/file/close/TestPlatformFileClose.py (195 of 2388)
PASS: lldb-api :: commands/platform/file/read/TestPlatformFileRead.py (196 of 2388)
UNRESOLVED: lldb-api :: commands/gui/spawn-threads/TestGuiSpawnThreads.py (197 of 2388)
******************** TEST 'lldb-api :: commands/gui/spawn-threads/TestGuiSpawnThreads.py' FAILED ********************
Script:
--
/usr/bin/python3.10 /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/dotest.py -u CXXFLAGS -u CFLAGS --env LLVM_LIBS_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./lib --env LLVM_INCLUDE_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/include --env LLVM_TOOLS_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin --arch aarch64 --build-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex --lldb-module-cache-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/module-cache-lldb/lldb-api --clang-module-cache-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/module-cache-clang/lldb-api --executable /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/lldb --compiler /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/clang --dsymutil /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/dsymutil --make /usr/bin/gmake --llvm-tools-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin --lldb-obj-root /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/tools/lldb --lldb-libs-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./lib --cmake-build-type Release /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/commands/gui/spawn-threads -p TestGuiSpawnThreads.py
--
Exit Code: 1

Command Output (stdout):
--
lldb version 22.0.0git (https://github.com/llvm/llvm-project.git revision cf837e2ffe7b89a861f7145235190a1a000f3559)
  clang revision cf837e2ffe7b89a861f7145235190a1a000f3559
  llvm revision cf837e2ffe7b89a861f7145235190a1a000f3559
Skipping the following test categories: ['libc++', 'msvcstl', 'dsym', 'pdb', 'gmodules', 'debugserver', 'objc']

--
Command Output (stderr):
--
FAIL: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_gui (TestGuiSpawnThreads.TestGuiSpawnThreadsTest)
======================================================================
ERROR: test_gui (TestGuiSpawnThreads.TestGuiSpawnThreadsTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/decorators.py", line 156, in wrapper
    return func(*args, **kwargs)
  File "/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/commands/gui/spawn-threads/TestGuiSpawnThreads.py", line 44, in test_gui
    self.child.expect_exact(f"thread #{i + 2}: tid =")
  File "/usr/local/lib/python3.10/dist-packages/pexpect/spawnbase.py", line 432, in expect_exact
    return exp.expect_loop(timeout)
  File "/usr/local/lib/python3.10/dist-packages/pexpect/expect.py", line 179, in expect_loop
    return self.eof(e)
  File "/usr/local/lib/python3.10/dist-packages/pexpect/expect.py", line 122, in eof
    raise exc
pexpect.exceptions.EOF: End Of File (EOF). Exception style platform.
<pexpect.pty_spawn.spawn object at 0xec2e0e30d420>
command: /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/lldb
args: ['/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/lldb', '--no-lldbinit', '--no-use-colors', '-O', 'settings clear --all', '-O', 'settings set symbols.enable-external-lookup false', '-O', 'settings set target.inherit-tcc true', '-O', 'settings set target.disable-aslr false', '-O', 'settings set target.detach-on-error false', '-O', 'settings set target.auto-apply-fixits false', '-O', 'settings set plugin.process.gdb-remote.packet-timeout 60', '-O', 'settings set symbols.clang-modules-cache-path "/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/module-cache-lldb/lldb-api"', '-O', 'settings set use-color false', '-O', 'settings set show-statusline false', '--file', '/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/commands/gui/spawn-threads/TestGuiSpawnThreads.test_gui/a.out']
buffer (last 100 chars): b''
before (last 100 chars): b'thread_create.c:442:8\n#29 0x0000e0acf69a9e9c ./misc/../sysdeps/unix/sysv/linux/aarch64/clone.S:82:0\n'
after: <class 'pexpect.exceptions.EOF'>

aadeshps-mcw pushed a commit to aadeshps-mcw/llvm-project that referenced this pull request Nov 26, 2025
As suggested by Augusto, add an assert to the NonNullSharedPtr move
constructor.
Priyanshu3820 pushed a commit to Priyanshu3820/llvm-project that referenced this pull request Nov 26, 2025
As suggested by Augusto, add an assert to the NonNullSharedPtr move
constructor.
JDevlieghere added a commit to swiftlang/llvm-project that referenced this pull request Dec 1, 2025
As suggested by Augusto, add an assert to the NonNullSharedPtr move
constructor.

(cherry picked from commit cf837e2)
augusto2112 pushed a commit to augusto2112/llvm-project that referenced this pull request Dec 3, 2025
As suggested by Augusto, add an assert to the NonNullSharedPtr move
constructor.
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