ProcessWindows::DoLaunch(Module *exe_module,
ProcessLaunchInfo &launch_info)
{
+ // Even though m_session_data is accessed here, it is before a debugger thread has been
+ // kicked off. So there's no race conditions, and it shouldn't be necessary to acquire
+ // the mutex.
+
Error result;
if (!launch_info.GetFlags().Test(eLaunchFlagDebug))
{
caused_stop = false;
else
{
+ llvm::sys::ScopedLock lock(m_mutex);
caused_stop = ::DebugBreakProcess(m_session_data->m_debugger->GetProcess().GetNativeProcess().GetSystemHandle());
if (!caused_stop)
error.SetError(GetLastError(), eErrorTypeWin32);
size_t size,
Error &error)
{
+ llvm::sys::ScopedLock lock(m_mutex);
+
if (!m_session_data)
return 0;
- llvm::sys::ScopedLock lock(m_mutex);
-
HostProcess process = m_session_data->m_debugger->GetProcess();
void *addr = reinterpret_cast<void *>(vm_addr);
SIZE_T bytes_read = 0;
size_t
ProcessWindows::DoWriteMemory(lldb::addr_t vm_addr, const void *buf, size_t size, Error &error)
{
+ llvm::sys::ScopedLock lock(m_mutex);
+
if (!m_session_data)
return 0;
- llvm::sys::ScopedLock lock(m_mutex);
-
HostProcess process = m_session_data->m_debugger->GetProcess();
void *addr = reinterpret_cast<void *>(vm_addr);
SIZE_T bytes_written = 0;
void
ProcessWindows::OnExitProcess(uint32_t exit_code)
{
- llvm::sys::ScopedLock lock(m_mutex);
+ // No need to acquire the lock since m_session_data isn't accessed.
ModuleSP executable_module = GetTarget().GetExecutableModule();
ModuleList unloaded_modules;
{
// Either we successfully attached to an existing process, or we successfully launched a new
// process under the debugger.
- llvm::sys::ScopedLock lock(m_mutex);
-
ModuleSP module = GetTarget().GetExecutableModule();
bool load_addr_changed;
module->SetLoadAddress(GetTarget(), image_base, false, load_addr_changed);
loaded_modules.Append(module);
GetTarget().ModulesDidLoad(loaded_modules);
+ llvm::sys::ScopedLock lock(m_mutex);
+
DebuggerThreadSP debugger = m_session_data->m_debugger;
const HostThreadWindows &wmain_thread = debugger->GetMainThread().GetNativeThread();
m_session_data->m_new_threads[wmain_thread.GetThreadId()] = debugger->GetMainThread();
void
ProcessWindows::OnLoadDll(const ModuleSpec &module_spec, lldb::addr_t module_addr)
{
- llvm::sys::ScopedLock lock(m_mutex);
-
// Confusingly, there is no Target::AddSharedModule. Instead, calling GetSharedModule() with
// a new module will add it to the module list and return a corresponding ModuleSP.
Error error;
void
ProcessWindows::OnUnloadDll(lldb::addr_t module_addr)
{
- llvm::sys::ScopedLock lock(m_mutex);
-
Address resolved_addr;
if (GetTarget().ResolveLoadAddress(module_addr, resolved_addr))
{