diff options
| author | Zachary Turner <zturner@google.com> | 2014-11-17 17:46:43 +0000 |
|---|---|---|
| committer | Zachary Turner <zturner@google.com> | 2014-11-17 17:46:43 +0000 |
| commit | 119767db851033a09030e416dcc62bf1d5118485 (patch) | |
| tree | d9371f6caf50eec39e96008d96c8605d26988d9d /lldb/source/Plugins/Process/Windows/ProcessWindows.cpp | |
| parent | a2fc3a4090bf1f7110712460a8194e169a210e9f (diff) | |
| download | bcm5719-llvm-119767db851033a09030e416dcc62bf1d5118485.tar.gz bcm5719-llvm-119767db851033a09030e416dcc62bf1d5118485.zip | |
[ProcessWindows] Create a TargetThreadWindows class.
This creates a TargetThreadWindows class and updates the thread
list of the Process with the main thread. Additionally, we
fill out a few more overrides of Process base class methods. We
do not yet update the thread list as threads are created and/or
destroyed, and we do not yet propagate stop reasons to threads as
their states change.
llvm-svn: 222148
Diffstat (limited to 'lldb/source/Plugins/Process/Windows/ProcessWindows.cpp')
| -rw-r--r-- | lldb/source/Plugins/Process/Windows/ProcessWindows.cpp | 52 |
1 files changed, 35 insertions, 17 deletions
diff --git a/lldb/source/Plugins/Process/Windows/ProcessWindows.cpp b/lldb/source/Plugins/Process/Windows/ProcessWindows.cpp index da61ba9d193..5ad671e1541 100644 --- a/lldb/source/Plugins/Process/Windows/ProcessWindows.cpp +++ b/lldb/source/Plugins/Process/Windows/ProcessWindows.cpp @@ -20,6 +20,7 @@ #include "lldb/Host/Host.h" #include "lldb/Host/HostProcess.h" #include "lldb/Host/HostNativeProcessBase.h" +#include "lldb/Host/HostNativeThreadBase.h" #include "lldb/Host/MonitoringProcessLauncher.h" #include "lldb/Host/ThreadLauncher.h" #include "lldb/Host/windows/ProcessLauncherWindows.h" @@ -32,6 +33,7 @@ #include "ExceptionRecord.h" #include "LocalDebugDelegate.h" #include "ProcessWindows.h" +#include "TargetThreadWindows.h" using namespace lldb; using namespace lldb_private; @@ -197,23 +199,6 @@ ProcessWindows::GetPluginVersion() return 1; } -void -ProcessWindows::GetPluginCommandHelp(const char *command, Stream *strm) -{ -} - -Error -ProcessWindows::ExecutePluginCommand(Args &command, Stream *strm) -{ - return Error(1, eErrorTypeGeneric); -} - -Log * -ProcessWindows::EnablePluginLogging(Stream *strm, Args &command) -{ - return NULL; -} - Error ProcessWindows::DoDetach(bool keep_stopped) { @@ -255,6 +240,22 @@ ProcessWindows::IsAlive() } } +Error +ProcessWindows::DoHalt(bool &caused_stop) +{ + Error error; + StateType state = GetPrivateState(); + if (state == eStateStopped) + caused_stop = false; + else + { + caused_stop = ::DebugBreakProcess(m_session_data->m_debugger->GetProcess().GetNativeProcess().GetSystemHandle()); + if (!caused_stop) + error.SetError(GetLastError(), eErrorTypeWin32); + } + return error; +} + size_t ProcessWindows::DoReadMemory(lldb::addr_t vm_addr, void *buf, @@ -289,6 +290,18 @@ ProcessWindows::DoWriteMemory(lldb::addr_t vm_addr, const void *buf, size_t size return bytes_written; } +lldb::addr_t +ProcessWindows::GetImageInfoAddress() +{ + Target &target = GetTarget(); + ObjectFile *obj_file = target.GetExecutableModule()->GetObjectFile(); + Address addr = obj_file->GetImageInfoAddress(&target); + if (addr.IsValid()) + return addr.GetLoadAddress(&target); + else + return LLDB_INVALID_ADDRESS; +} + bool ProcessWindows::CanDebug(Target &target, bool plugin_specified_by_name) { @@ -315,6 +328,10 @@ ProcessWindows::OnDebuggerConnected(lldb::addr_t image_base) ModuleSP module = GetTarget().GetExecutableModule(); bool load_addr_changed; module->SetLoadAddress(GetTarget(), image_base, false, load_addr_changed); + + DebuggerThreadSP debugger = m_session_data->m_debugger; + ThreadSP main_thread(new TargetThreadWindows(*this, debugger->GetMainThread())); + m_thread_list.AddThread(main_thread); } ExceptionResult @@ -365,6 +382,7 @@ ProcessWindows::OnDebugException(bool first_chance, const ExceptionRecord &recor void ProcessWindows::OnCreateThread(const HostThread &thread) { + SuspendThread(thread.GetNativeThread().GetSystemHandle()); } void |

