[lldb] Remove vestigial remnants of reproducers (#135361)

Not touching the SB API.
This commit is contained in:
Pavel Labath 2025-04-13 08:55:24 +02:00 committed by GitHub
parent 7940b0546b
commit f4fba20726
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 2 additions and 169 deletions

View File

@ -11,12 +11,6 @@
#include "lldb/API/SBDefines.h"
namespace lldb_private {
namespace repro {
struct ReplayOptions;
}
} // namespace lldb_private
namespace lldb {
#ifndef SWIG

View File

@ -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 @@ public:
return m_error_stream_sp->GetUnlockedFileSP();
}
repro::DataRecorder *GetInputRecorder();
Status SetInputString(const char *data);
void SetInputFile(lldb::FileSP file);
@ -720,9 +714,6 @@ protected:
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.

View File

@ -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")

View File

@ -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;

View File

@ -932,7 +932,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")),
@ -1081,8 +1080,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);

View File

@ -41,9 +41,6 @@
#include "llvm/ADT/StringMap.h"
namespace lldb_private {
namespace repro {
class Loader;
}
namespace process_gdb_remote {
class ThreadGDBRemote;

View File

@ -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;

View File

@ -21,7 +21,6 @@
#include "gtest/gtest.h"
using namespace lldb_private;
using namespace lldb_private::repro;
using namespace lldb;
namespace {

View File

@ -25,7 +25,6 @@
using namespace lldb;
using namespace lldb_private;
using namespace lldb_private::repro;
namespace {
class PlatformSiginfoTest : public ::testing::Test {

View File

@ -20,7 +20,6 @@
#include "gtest/gtest.h"
using namespace lldb_private;
using namespace lldb_private::repro;
using namespace lldb;
namespace {

View File

@ -16,7 +16,6 @@
#include "gtest/gtest.h"
using namespace lldb_private;
using namespace lldb_private::repro;
using namespace lldb;
namespace {

View File

@ -24,7 +24,6 @@
#include "gtest/gtest.h"
using namespace lldb_private;
using namespace lldb_private::repro;
using namespace lldb;
namespace {

View File

@ -19,7 +19,6 @@
#include "gtest/gtest.h"
using namespace lldb_private;
using namespace lldb_private::repro;
using namespace lldb;
namespace {

View File

@ -19,7 +19,6 @@
#include "gtest/gtest.h"
using namespace lldb_private;
using namespace lldb_private::repro;
using namespace lldb;
namespace {

View File

@ -28,7 +28,6 @@
#include "gtest/gtest.h"
using namespace lldb_private;
using namespace lldb_private::repro;
using namespace lldb;
namespace {