#include "Plugins/Platform/MacOSX/PlatformMacOSX.h"
#include "Plugins/Platform/MacOSX/PlatformRemoteMacOSX.h"
#include "TestingSupport/TestUtilities.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Host/FileSystem.h"
#include "lldb/Host/HostInfo.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/StopInfo.h"
#include "lldb/Target/Thread.h"
#include "lldb/Utility/ArchSpec.h"
#include "lldb/Utility/Event.h"
#include "gtest/gtest.h"
usingnamespacelldb_private;
usingnamespacelldb_private::repro;
usingnamespacelldb;
namespace {
class ProcessEventDataTest : public ::testing::Test { … };
class DummyProcess : public Process { … };
class DummyThread : public Thread { … };
class DummyStopInfo : public StopInfo { … };
class DummyProcessEventData : public Process::ProcessEventData { … };
}
ProcessEventDataSP;
EventSP;
TargetSP CreateTarget(DebuggerSP &debugger_sp, ArchSpec &arch) { … }
ThreadSP CreateThread(ProcessSP &process_sp, bool should_stop,
bool has_valid_stopinfo) { … }
#if 0
TEST_F(ProcessEventDataTest, DoOnRemoval) {
ArchSpec arch("x86_64-apple-macosx-");
Platform::SetHostPlatform(PlatformRemoteMacOSX::CreateInstance(true, &arch));
DebuggerSP debugger_sp = Debugger::CreateInstance();
ASSERT_TRUE(debugger_sp);
TargetSP target_sp = CreateTarget(debugger_sp, arch);
ASSERT_TRUE(target_sp);
ListenerSP listener_sp(Listener::MakeListener("dummy"));
ProcessSP process_sp = std::make_shared<DummyProcess>(target_sp, listener_sp);
ASSERT_TRUE(process_sp);
ProcessEventDataSP event_data_sp =
std::make_shared<DummyProcessEventData>(process_sp, eStateStopped);
EventSP event_sp = std::make_shared<Event>(0, event_data_sp);
event_data_sp->SetUpdateStateOnRemoval(event_sp.get());
event_data_sp->DoOnRemoval(event_sp.get());
bool result = static_cast<DummyProcessEventData *>(event_data_sp.get())
->m_should_stop_hit_count == 1;
ASSERT_TRUE(result);
event_data_sp =
std::make_shared<DummyProcessEventData>(process_sp, eStateStepping);
event_sp = std::make_shared<Event>(0, event_data_sp);
event_data_sp->SetUpdateStateOnRemoval(event_sp.get());
event_data_sp->DoOnRemoval(event_sp.get());
result = static_cast<DummyProcessEventData *>(event_data_sp.get())
->m_should_stop_hit_count == 0;
ASSERT_TRUE(result);
}
#endif
TEST_F(ProcessEventDataTest, ShouldStop) { … }