Skip to content

Conversation

@labath
Copy link
Collaborator

@labath labath commented Apr 11, 2025

Not touching the SB API.

@labath labath requested a review from JDevlieghere as a code owner April 11, 2025 12:53
@llvmbot llvmbot added the lldb label Apr 11, 2025
@llvmbot
Copy link
Member

llvmbot commented Apr 11, 2025

@llvm/pr-subscribers-lldb

Author: Pavel Labath (labath)

Changes

Not touching the SB API.


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

15 Files Affected:

  • (modified) lldb/include/lldb/API/SBReproducer.h (-6)
  • (modified) lldb/include/lldb/Core/Debugger.h (-9)
  • (removed) lldb/scripts/reproducer-replay.py (-121)
  • (modified) lldb/source/API/SBReproducer.cpp (+2-18)
  • (modified) lldb/source/Core/Debugger.cpp (-3)
  • (modified) lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h (-3)
  • (modified) lldb/unittests/Core/DiagnosticEventTest.cpp (-1)
  • (modified) lldb/unittests/Interpreter/TestCommandPaths.cpp (-1)
  • (modified) lldb/unittests/Platform/PlatformSiginfoTest.cpp (-1)
  • (modified) lldb/unittests/Process/ProcessEventDataTest.cpp (-1)
  • (modified) lldb/unittests/ScriptInterpreter/Lua/ScriptInterpreterTests.cpp (-1)
  • (modified) lldb/unittests/Target/ExecutionContextTest.cpp (-1)
  • (modified) lldb/unittests/Target/MemoryTest.cpp (-1)
  • (modified) lldb/unittests/Target/StackFrameRecognizerTest.cpp (-1)
  • (modified) lldb/unittests/Thread/ThreadTest.cpp (-1)
diff --git a/lldb/include/lldb/API/SBReproducer.h b/lldb/include/lldb/API/SBReproducer.h
index c48b4747afe57..e11accf052f46 100644
--- a/lldb/include/lldb/API/SBReproducer.h
+++ b/lldb/include/lldb/API/SBReproducer.h
@@ -11,12 +11,6 @@
 
 #include "lldb/API/SBDefines.h"
 
-namespace lldb_private {
-namespace repro {
-struct ReplayOptions;
-}
-} // namespace lldb_private
-
 namespace lldb {
 
 #ifndef SWIG
diff --git a/lldb/include/lldb/Core/Debugger.h b/lldb/include/lldb/Core/Debugger.h
index 448e8d6a8fc6a..e9e4cabdb5732 100644
--- a/lldb/include/lldb/Core/Debugger.h
+++ b/lldb/include/lldb/Core/Debugger.h
@@ -67,10 +67,6 @@ class Stream;
 class SymbolContext;
 class Target;
 
-namespace repro {
-class DataRecorder;
-}
-
 /// \class Debugger Debugger.h "lldb/Core/Debugger.h"
 /// A class to manage flag bits.
 ///
@@ -143,8 +139,6 @@ class Debugger : public std::enable_shared_from_this<Debugger>,
     return m_error_stream_sp->GetUnlockedFileSP();
   }
 
-  repro::DataRecorder *GetInputRecorder();
-
   Status SetInputString(const char *data);
 
   void SetInputFile(lldb::FileSP file);
@@ -720,9 +714,6 @@ class Debugger : public std::enable_shared_from_this<Debugger>,
   lldb::LockableStreamFileSP m_error_stream_sp;
   LockableStreamFile::Mutex m_output_mutex;
 
-  /// Used for shadowing the input file when capturing a reproducer.
-  repro::DataRecorder *m_input_recorder;
-
   lldb::BroadcasterManagerSP m_broadcaster_manager_sp; // The debugger acts as a
                                                        // broadcaster manager of
                                                        // last resort.
diff --git a/lldb/scripts/reproducer-replay.py b/lldb/scripts/reproducer-replay.py
deleted file mode 100755
index f44e3cf493538..0000000000000
--- a/lldb/scripts/reproducer-replay.py
+++ /dev/null
@@ -1,121 +0,0 @@
-#!/usr/bin/env python3
-
-from multiprocessing import Pool
-import multiprocessing
-import argparse
-import tempfile
-import logging
-import os
-import subprocess
-
-
-def run_reproducer(path):
-    proc = subprocess.Popen(
-        [LLDB, "--replay", path], stdout=subprocess.PIPE, stderr=subprocess.PIPE
-    )
-    reason = None
-    try:
-        outs, errs = proc.communicate(timeout=TIMEOUT)
-        success = proc.returncode == 0
-        result = "PASSED" if success else "FAILED"
-        if not success:
-            outs = outs.decode()
-            errs = errs.decode()
-            # Do some pattern matching to find out the cause of the failure.
-            if "Encountered unexpected packet during replay" in errs:
-                reason = "Unexpected packet"
-            elif "Assertion failed" in errs:
-                reason = "Assertion failed"
-            elif "UNREACHABLE" in errs:
-                reason = "Unreachable executed"
-            elif "Segmentation fault" in errs:
-                reason = "Segmentation fault"
-            elif "Illegal instruction" in errs:
-                reason = "Illegal instruction"
-            else:
-                reason = f"Exit code {proc.returncode}"
-    except subprocess.TimeoutExpired:
-        proc.kill()
-        success = False
-        outs, errs = proc.communicate()
-        result = "TIMEOUT"
-
-    if not FAILURE_ONLY or not success:
-        reason_str = f" ({reason})" if reason else ""
-        print(f"{result}: {path}{reason_str}")
-        if VERBOSE:
-            if outs:
-                print(outs)
-            if errs:
-                print(errs)
-
-
-def find_reproducers(path):
-    for root, dirs, files in os.walk(path):
-        for dir in dirs:
-            _, extension = os.path.splitext(dir)
-            if dir.startswith("Test") and extension == ".py":
-                yield os.path.join(root, dir)
-
-
-if __name__ == "__main__":
-    parser = argparse.ArgumentParser(
-        description="LLDB API Test Replay Driver. "
-        "Replay one or more reproducers in parallel using the specified LLDB driver. "
-        "The script will look for reproducers generated by the API lit test suite. "
-        "To generate the reproducers, pass --param 'lldb-run-with-repro=capture' to lit."
-    )
-    parser.add_argument(
-        "-j",
-        "--threads",
-        type=int,
-        default=multiprocessing.cpu_count(),
-        help="Number of threads. The number of CPU threads if not specified.",
-    )
-    parser.add_argument(
-        "-t",
-        "--timeout",
-        type=int,
-        default=60,
-        help="Replay timeout in seconds. 60 seconds if not specified.",
-    )
-    parser.add_argument(
-        "-p",
-        "--path",
-        type=str,
-        default=os.getcwd(),
-        help="Path to the directory containing the reproducers. The current working directory if not specified.",
-    )
-    parser.add_argument(
-        "-l",
-        "--lldb",
-        type=str,
-        required=True,
-        help="Path to the LLDB command line driver",
-    )
-    parser.add_argument(
-        "-v", "--verbose", help="Print replay output.", action="store_true"
-    )
-    parser.add_argument(
-        "--failure-only", help="Only log failures.", action="store_true"
-    )
-    args = parser.parse_args()
-
-    global LLDB
-    global TIMEOUT
-    global VERBOSE
-    global FAILURE_ONLY
-    LLDB = args.lldb
-    TIMEOUT = args.timeout
-    VERBOSE = args.verbose
-    FAILURE_ONLY = args.failure_only
-
-    print(
-        f"Replaying reproducers in {args.path} with {args.threads} threads and a {args.timeout} seconds timeout"
-    )
-
-    try:
-        pool = Pool(args.threads)
-        pool.map(run_reproducer, find_reproducers(args.path))
-    except KeyboardInterrupt:
-        print("Interrupted")
diff --git a/lldb/source/API/SBReproducer.cpp b/lldb/source/API/SBReproducer.cpp
index 088dd25e3f1f3..97cbbddacac9a 100644
--- a/lldb/source/API/SBReproducer.cpp
+++ b/lldb/source/API/SBReproducer.cpp
@@ -7,30 +7,14 @@
 //===----------------------------------------------------------------------===//
 
 #include "lldb/API/SBReproducer.h"
-#include "lldb/API/LLDB.h"
-#include "lldb/API/SBAddress.h"
-#include "lldb/API/SBAttachInfo.h"
-#include "lldb/API/SBBlock.h"
-#include "lldb/API/SBBreakpoint.h"
-#include "lldb/API/SBCommandInterpreter.h"
-#include "lldb/API/SBCommandInterpreterRunOptions.h"
-#include "lldb/API/SBData.h"
-#include "lldb/API/SBDebugger.h"
-#include "lldb/API/SBDeclaration.h"
-#include "lldb/API/SBError.h"
-#include "lldb/API/SBFileSpec.h"
-#include "lldb/API/SBHostOS.h"
-#include "lldb/Host/FileSystem.h"
 #include "lldb/Utility/Instrumentation.h"
-#include "lldb/Version/Version.h"
 
 using namespace lldb;
 using namespace lldb_private;
-using namespace lldb_private::repro;
 
-SBReplayOptions::SBReplayOptions() {}
+SBReplayOptions::SBReplayOptions() = default;
 
-SBReplayOptions::SBReplayOptions(const SBReplayOptions &rhs) {}
+SBReplayOptions::SBReplayOptions(const SBReplayOptions &rhs) = default;
 
 SBReplayOptions::~SBReplayOptions() = default;
 
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index e65d71ddf6960..47b2fd08869dd 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -923,7 +923,6 @@ Debugger::Debugger(lldb::LogOutputCallback log_callback, void *baton)
           stdout, NativeFile::Unowned, m_output_mutex)),
       m_error_stream_sp(std::make_shared<LockableStreamFile>(
           stderr, NativeFile::Unowned, m_output_mutex)),
-      m_input_recorder(nullptr),
       m_broadcaster_manager_sp(BroadcasterManager::MakeBroadcasterManager()),
       m_terminal_state(), m_target_list(*this), m_platform_list(),
       m_listener_sp(Listener::MakeListener("lldb.Debugger")),
@@ -1072,8 +1071,6 @@ void Debugger::SetAsyncExecution(bool async_execution) {
   m_command_interpreter_up->SetSynchronous(!async_execution);
 }
 
-repro::DataRecorder *Debugger::GetInputRecorder() { return m_input_recorder; }
-
 static inline int OpenPipe(int fds[2], std::size_t size) {
 #ifdef _WIN32
   return _pipe(fds, size, O_BINARY);
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
index 1cbd1e82b381d..7fa2ec5bb2d9d 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
@@ -41,9 +41,6 @@
 #include "llvm/ADT/StringMap.h"
 
 namespace lldb_private {
-namespace repro {
-class Loader;
-}
 namespace process_gdb_remote {
 
 class ThreadGDBRemote;
diff --git a/lldb/unittests/Core/DiagnosticEventTest.cpp b/lldb/unittests/Core/DiagnosticEventTest.cpp
index 1423f76b8b523..82e96c4abec83 100644
--- a/lldb/unittests/Core/DiagnosticEventTest.cpp
+++ b/lldb/unittests/Core/DiagnosticEventTest.cpp
@@ -22,7 +22,6 @@
 
 using namespace lldb;
 using namespace lldb_private;
-using namespace lldb_private::repro;
 
 static const constexpr std::chrono::seconds TIMEOUT(0);
 static const constexpr size_t DEBUGGERS = 3;
diff --git a/lldb/unittests/Interpreter/TestCommandPaths.cpp b/lldb/unittests/Interpreter/TestCommandPaths.cpp
index 0f0a2791ebb80..25834ba550b7a 100644
--- a/lldb/unittests/Interpreter/TestCommandPaths.cpp
+++ b/lldb/unittests/Interpreter/TestCommandPaths.cpp
@@ -21,7 +21,6 @@
 #include "gtest/gtest.h"
 
 using namespace lldb_private;
-using namespace lldb_private::repro;
 using namespace lldb;
 
 namespace {
diff --git a/lldb/unittests/Platform/PlatformSiginfoTest.cpp b/lldb/unittests/Platform/PlatformSiginfoTest.cpp
index 2726357e65e57..4b2c93a68a94a 100644
--- a/lldb/unittests/Platform/PlatformSiginfoTest.cpp
+++ b/lldb/unittests/Platform/PlatformSiginfoTest.cpp
@@ -25,7 +25,6 @@
 
 using namespace lldb;
 using namespace lldb_private;
-using namespace lldb_private::repro;
 
 namespace {
 class PlatformSiginfoTest : public ::testing::Test {
diff --git a/lldb/unittests/Process/ProcessEventDataTest.cpp b/lldb/unittests/Process/ProcessEventDataTest.cpp
index 9f65b71fc1c31..88ea394bbb1e5 100644
--- a/lldb/unittests/Process/ProcessEventDataTest.cpp
+++ b/lldb/unittests/Process/ProcessEventDataTest.cpp
@@ -20,7 +20,6 @@
 #include "gtest/gtest.h"
 
 using namespace lldb_private;
-using namespace lldb_private::repro;
 using namespace lldb;
 
 namespace {
diff --git a/lldb/unittests/ScriptInterpreter/Lua/ScriptInterpreterTests.cpp b/lldb/unittests/ScriptInterpreter/Lua/ScriptInterpreterTests.cpp
index 5f8cd5aef56b6..4d163506892db 100644
--- a/lldb/unittests/ScriptInterpreter/Lua/ScriptInterpreterTests.cpp
+++ b/lldb/unittests/ScriptInterpreter/Lua/ScriptInterpreterTests.cpp
@@ -16,7 +16,6 @@
 #include "gtest/gtest.h"
 
 using namespace lldb_private;
-using namespace lldb_private::repro;
 using namespace lldb;
 
 namespace {
diff --git a/lldb/unittests/Target/ExecutionContextTest.cpp b/lldb/unittests/Target/ExecutionContextTest.cpp
index cba32c21423e3..7918b252ebe35 100644
--- a/lldb/unittests/Target/ExecutionContextTest.cpp
+++ b/lldb/unittests/Target/ExecutionContextTest.cpp
@@ -24,7 +24,6 @@
 #include "gtest/gtest.h"
 
 using namespace lldb_private;
-using namespace lldb_private::repro;
 using namespace lldb;
 
 namespace {
diff --git a/lldb/unittests/Target/MemoryTest.cpp b/lldb/unittests/Target/MemoryTest.cpp
index 4d7c4d5b4c784..4a96730e00464 100644
--- a/lldb/unittests/Target/MemoryTest.cpp
+++ b/lldb/unittests/Target/MemoryTest.cpp
@@ -19,7 +19,6 @@
 #include "gtest/gtest.h"
 
 using namespace lldb_private;
-using namespace lldb_private::repro;
 using namespace lldb;
 
 namespace {
diff --git a/lldb/unittests/Target/StackFrameRecognizerTest.cpp b/lldb/unittests/Target/StackFrameRecognizerTest.cpp
index 55bae3e301573..b356cd87d54ac 100644
--- a/lldb/unittests/Target/StackFrameRecognizerTest.cpp
+++ b/lldb/unittests/Target/StackFrameRecognizerTest.cpp
@@ -19,7 +19,6 @@
 #include "gtest/gtest.h"
 
 using namespace lldb_private;
-using namespace lldb_private::repro;
 using namespace lldb;
 
 namespace {
diff --git a/lldb/unittests/Thread/ThreadTest.cpp b/lldb/unittests/Thread/ThreadTest.cpp
index 542585969c07b..b3d1bfb1ee726 100644
--- a/lldb/unittests/Thread/ThreadTest.cpp
+++ b/lldb/unittests/Thread/ThreadTest.cpp
@@ -28,7 +28,6 @@
 #include "gtest/gtest.h"
 
 using namespace lldb_private;
-using namespace lldb_private::repro;
 using namespace lldb;
 
 namespace {

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.

🪦

@labath labath merged commit f4fba20 into llvm:main Apr 13, 2025
12 checks passed
@labath labath deleted the repro branch April 13, 2025 06:55
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.

3 participants