static lldb::ProcessSP FindPlugin(lldb::TargetSP target_sp,
llvm::StringRef plugin_name,
lldb::ListenerSP listener_sp,
- const FileSpec *crash_file_path);
+ const FileSpec *crash_file_path,
+ bool can_connect);
/// Static function that can be used with the \b host function
/// Host::StartMonitoringChildProcess ().
private:
static lldb::ProcessSP CreateInstance(lldb::TargetSP target_sp,
lldb::ListenerSP listener_sp,
- const FileSpec *crash_file_path);
+ const FileSpec *crash_file_path,
+ bool can_connect);
};
} // namespace lldb_private
// used.
const lldb::ProcessSP &CreateProcess(lldb::ListenerSP listener_sp,
llvm::StringRef plugin_name,
- const FileSpec *crash_file);
+ const FileSpec *crash_file,
+ bool can_connect);
const lldb::ProcessSP &GetProcessSP() const;
const ArchSpec *arch);
typedef lldb::ProcessSP (*ProcessCreateInstance)(
lldb::TargetSP target_sp, lldb::ListenerSP listener_sp,
- const FileSpec *crash_file_path);
+ const FileSpec *crash_file_path, bool can_connect);
typedef lldb::ScriptInterpreterSP (*ScriptInterpreterCreateInstance)(
Debugger &debugger);
typedef SymbolFile *(*SymbolFileCreateInstance)(lldb::ObjectFileSP objfile_sp);
FileSpec filespec(core_file);
FileSystem::Instance().Resolve(filespec);
ProcessSP process_sp(target_sp->CreateProcess(
- target_sp->GetDebugger().GetListener(), "", &filespec));
+ target_sp->GetDebugger().GetListener(), "", &filespec, false));
if (process_sp) {
error.SetError(process_sp->LoadCore());
if (error.Success())
std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
if (listener.IsValid())
process_sp =
- target_sp->CreateProcess(listener.m_opaque_sp, plugin_name, nullptr);
+ target_sp->CreateProcess(listener.m_opaque_sp, plugin_name, nullptr,
+ true);
else
process_sp = target_sp->CreateProcess(
- target_sp->GetDebugger().GetListener(), plugin_name, nullptr);
+ target_sp->GetDebugger().GetListener(), plugin_name, nullptr, true);
if (process_sp) {
sb_process.SetSP(process_sp);
target_sp->AppendExecutableSearchPaths(core_file_dir);
ProcessSP process_sp(target_sp->CreateProcess(
- GetDebugger().GetListener(), llvm::StringRef(), &core_file));
+ GetDebugger().GetListener(), llvm::StringRef(), &core_file,
+ false));
if (process_sp) {
// Seems weird that we Launch a core file, but that is what we
process_sp =
target->CreateProcess(attach_info.GetListenerForProcess(debugger),
- attach_info.GetProcessPluginName(), nullptr);
+ attach_info.GetProcessPluginName(), nullptr,
+ false);
if (process_sp) {
ListenerSP listener_sp = attach_info.GetHijackListener();
// Now create the gdb-remote process.
LLDB_LOG(log, "having target create process with gdb-remote plugin");
process_sp =
- target->CreateProcess(launch_info.GetListener(), "gdb-remote", nullptr);
+ target->CreateProcess(launch_info.GetListener(), "gdb-remote", nullptr,
+ true);
if (!process_sp) {
error.SetErrorString("CreateProcess() failed for gdb-remote process");
return Attach(attach_info, debugger, target, error);
} else {
ProcessSP process_sp = target->CreateProcess(
- launch_info.GetListener(), launch_info.GetProcessPluginName(), nullptr);
+ launch_info.GetListener(), launch_info.GetProcessPluginName(), nullptr,
+ false);
// We need to launch and attach to the process.
launch_info.GetFlags().Set(eLaunchFlagDebug);
const char *plugin_name = attach_info.GetProcessPluginName();
process_sp = target->CreateProcess(
- attach_info.GetListenerForProcess(debugger), plugin_name, nullptr);
+ attach_info.GetListenerForProcess(debugger), plugin_name, nullptr, false);
process_sp->HijackProcessEvents(attach_info.GetHijackListener());
if (process_sp)
// The darwin always currently uses the GDB remote debugger plug-in
// so even when debugging locally we are debugging remotely!
process_sp = target->CreateProcess(launch_info.GetListener(),
- "gdb-remote", nullptr);
+ "gdb-remote", nullptr, true);
if (process_sp) {
error = process_sp->ConnectRemote(connect_url.c_str());
// so even when debugging locally we are debugging remotely!
process_sp =
target->CreateProcess(attach_info.GetListenerForProcess(debugger),
- "gdb-remote", nullptr);
+ "gdb-remote", nullptr, true);
if (process_sp) {
error = process_sp->ConnectRemote(connect_url.c_str());
if (error.Success()) {
lldb::ProcessSP
ProcessFreeBSD::CreateInstance(lldb::TargetSP target_sp,
lldb::ListenerSP listener_sp,
- const FileSpec *crash_file_path) {
+ const FileSpec *crash_file_path,
+ bool can_connect) {
lldb::ProcessSP process_sp;
- if (crash_file_path == NULL)
+ if (crash_file_path == NULL && !can_connect)
process_sp.reset(
new ProcessFreeBSD(target_sp, listener_sp, GetFreeBSDSignals()));
return process_sp;
// Static functions.
static lldb::ProcessSP
CreateInstance(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp,
- const lldb_private::FileSpec *crash_file_path);
+ const lldb_private::FileSpec *crash_file_path,
+ bool can_connect);
static void Initialize();
lldb::ProcessSP ProcessKDP::CreateInstance(TargetSP target_sp,
ListenerSP listener_sp,
- const FileSpec *crash_file_path) {
+ const FileSpec *crash_file_path,
+ bool can_connect) {
lldb::ProcessSP process_sp;
if (crash_file_path == NULL)
process_sp = std::make_shared<ProcessKDP>(target_sp, listener_sp);
// Constructors and Destructors
static lldb::ProcessSP
CreateInstance(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp,
- const lldb_private::FileSpec *crash_file_path);
+ const lldb_private::FileSpec *crash_file_path,
+ bool can_connect);
static void Initialize();
ProcessSP ProcessWindows::CreateInstance(lldb::TargetSP target_sp,
lldb::ListenerSP listener_sp,
- const FileSpec *) {
+ const FileSpec *,
+ bool can_connect) {
return ProcessSP(new ProcessWindows(target_sp, listener_sp));
}
// Static functions.
static lldb::ProcessSP CreateInstance(lldb::TargetSP target_sp,
lldb::ListenerSP listener_sp,
- const FileSpec *);
+ const FileSpec *,
+ bool can_connect);
static void Initialize();
lldb::ProcessSP ProcessElfCore::CreateInstance(lldb::TargetSP target_sp,
lldb::ListenerSP listener_sp,
- const FileSpec *crash_file) {
+ const FileSpec *crash_file,
+ bool can_connect) {
lldb::ProcessSP process_sp;
- if (crash_file) {
+ if (crash_file && !can_connect) {
// Read enough data for a ELF32 header or ELF64 header Note: Here we care
// about e_type field only, so it is safe to ignore possible presence of
// the header extension.
// Constructors and Destructors
static lldb::ProcessSP
CreateInstance(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp,
- const lldb_private::FileSpec *crash_file_path);
+ const lldb_private::FileSpec *crash_file_path,
+ bool can_connect);
static void Initialize();
lldb::ProcessSP
ProcessGDBRemote::CreateInstance(lldb::TargetSP target_sp,
ListenerSP listener_sp,
- const FileSpec *crash_file_path) {
+ const FileSpec *crash_file_path,
+ bool can_connect) {
lldb::ProcessSP process_sp;
if (crash_file_path == nullptr)
process_sp = std::make_shared<ProcessGDBRemote>(target_sp, listener_sp);
static lldb::ProcessSP CreateInstance(lldb::TargetSP target_sp,
lldb::ListenerSP listener_sp,
- const FileSpec *crash_file_path);
+ const FileSpec *crash_file_path,
+ bool can_connect);
static void Initialize();
lldb::ProcessSP ProcessMachCore::CreateInstance(lldb::TargetSP target_sp,
ListenerSP listener_sp,
- const FileSpec *crash_file) {
+ const FileSpec *crash_file,
+ bool can_connect) {
lldb::ProcessSP process_sp;
- if (crash_file) {
+ if (crash_file && !can_connect) {
const size_t header_size = sizeof(llvm::MachO::mach_header);
auto data_sp = FileSystem::Instance().CreateDataBuffer(
crash_file->GetPath(), header_size, 0);
static lldb::ProcessSP
CreateInstance(lldb::TargetSP target_sp, lldb::ListenerSP listener,
- const lldb_private::FileSpec *crash_file_path);
+ const lldb_private::FileSpec *crash_file_path,
+ bool can_connect);
static void Initialize();
lldb::ProcessSP ProcessMinidump::CreateInstance(lldb::TargetSP target_sp,
lldb::ListenerSP listener_sp,
- const FileSpec *crash_file) {
- if (!crash_file)
+ const FileSpec *crash_file,
+ bool can_connect) {
+ if (!crash_file || can_connect)
return nullptr;
lldb::ProcessSP process_sp;
public:
static lldb::ProcessSP CreateInstance(lldb::TargetSP target_sp,
lldb::ListenerSP listener_sp,
- const FileSpec *crash_file_path);
+ const FileSpec *crash_file_path,
+ bool can_connect);
static void Initialize();
debugger.GetTargetList().SetSelectedTarget(target);
lldb::ProcessSP process_sp =
- target->CreateProcess(debugger.GetListener(), plugin_name, nullptr);
+ target->CreateProcess(debugger.GetListener(), plugin_name, nullptr, true);
if (!process_sp)
return nullptr;
ProcessSP Process::FindPlugin(lldb::TargetSP target_sp,
llvm::StringRef plugin_name,
ListenerSP listener_sp,
- const FileSpec *crash_file_path) {
+ const FileSpec *crash_file_path,
+ bool can_connect) {
static uint32_t g_process_unique_id = 0;
ProcessSP process_sp;
create_callback =
PluginManager::GetProcessCreateCallbackForPluginName(const_plugin_name);
if (create_callback) {
- process_sp = create_callback(target_sp, listener_sp, crash_file_path);
+ process_sp = create_callback(target_sp, listener_sp, crash_file_path,
+ can_connect);
if (process_sp) {
if (process_sp->CanDebug(target_sp, true)) {
process_sp->m_process_unique_id = ++g_process_unique_id;
(create_callback =
PluginManager::GetProcessCreateCallbackAtIndex(idx)) != nullptr;
++idx) {
- process_sp = create_callback(target_sp, listener_sp, crash_file_path);
+ process_sp = create_callback(target_sp, listener_sp, crash_file_path,
+ can_connect);
if (process_sp) {
if (process_sp->CanDebug(target_sp, false)) {
process_sp->m_process_unique_id = ++g_process_unique_id;
ProcessSP ProcessTrace::CreateInstance(TargetSP target_sp,
ListenerSP listener_sp,
- const FileSpec *crash_file) {
+ const FileSpec *crash_file,
+ bool can_connect) {
+ if (can_connect)
+ return nullptr;
return std::make_shared<ProcessTrace>(target_sp, listener_sp);
}
const lldb::ProcessSP &Target::CreateProcess(ListenerSP listener_sp,
llvm::StringRef plugin_name,
- const FileSpec *crash_file) {
+ const FileSpec *crash_file,
+ bool can_connect) {
if (!listener_sp)
listener_sp = GetDebugger().GetListener();
DeleteCurrentProcess();
m_process_sp = Process::FindPlugin(shared_from_this(), plugin_name,
- listener_sp, crash_file);
+ listener_sp, crash_file, can_connect);
return m_process_sp;
}
} else {
// Use a Process plugin to construct the process.
const char *plugin_name = launch_info.GetProcessPluginName();
- CreateProcess(launch_info.GetListener(), plugin_name, nullptr);
+ CreateProcess(launch_info.GetListener(), plugin_name, nullptr, false);
}
// Since we didn't have a platform launch the process, launch it here.
const char *plugin_name = attach_info.GetProcessPluginName();
process_sp =
CreateProcess(attach_info.GetListenerForProcess(GetDebugger()),
- plugin_name, nullptr);
+ plugin_name, nullptr, false);
if (process_sp == nullptr) {
error.SetErrorStringWithFormat(
"failed to create process using plugin %s",
ProcessSP process_sp = target_sp->CreateProcess(
/*listener*/ nullptr, "trace",
- /*crash_file*/ nullptr);
+ /*crash_file*/ nullptr,
+ /*can_connect*/ false);
process_sp->SetID(static_cast<lldb::pid_t>(process.pid));
NO_DEBUG_INFO_TESTCASE = True
- @skipIfWindows
def test_gdb_remote_sync(self):
"""Test the gdb-remote command in synchronous mode"""
try:
finally:
self.dbg.GetSelectedPlatform().DisconnectRemote()
- @skipIfWindows
@skipIfReproducer # Reproducer don't support async.
def test_gdb_remote_async(self):
"""Test the gdb-remote command in asynchronous mode"""
finally:
self.dbg.GetSelectedPlatform().DisconnectRemote()
- @skipIfWindows
- @expectedFailureAll(oslist=["freebsd"])
def test_process_connect_sync(self):
"""Test the gdb-remote command in synchronous mode"""
try:
finally:
self.dbg.GetSelectedPlatform().DisconnectRemote()
- @skipIfWindows
- @expectedFailureAll(oslist=["freebsd"])
@skipIfReproducer # Reproducer don't support async.
def test_process_connect_async(self):
"""Test the gdb-remote command in asynchronous mode"""
-# UNSUPPORTED: system-windows
-# XFAIL: system-freebsd
-
# Synchronous
# RUN: %lldb -o 'platform select remote-gdb-server' -o 'process connect connect://localhost:4321' 2>&1 | FileCheck %s