summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2016-05-12 11:10:01 +0000
committerPavel Labath <labath@google.com>2016-05-12 11:10:01 +0000
commit194357c5092b34ca2487da76ef828a82b4a4da34 (patch)
tree0821949e9fe367e9c9ccd14cc429c9594659aeab /lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
parent55d383319f94687e641603f66a639a673cd72eb7 (diff)
downloadbcm5719-llvm-194357c5092b34ca2487da76ef828a82b4a4da34.tar.gz
bcm5719-llvm-194357c5092b34ca2487da76ef828a82b4a4da34.zip
Fix a race in ProcessGDBRemote::MonitorDebugServerProcess
Summary: MonitorDebugServerProcess went to a lot of effort to make sure its asynchronous invocation does not cause any mischief, but it was still not race-free. Specifically, in a quick stop-restart sequence (like the one in TestAddressBreakpoints) the copying of the process shared pointer via target_sp->GetProcessSP() was racing with the resetting of the pointer in DeleteCurrentProcess, as they were both accessing the same shared_ptr object. To avoid this, I simply pass in a weak_ptr to the process when the callback is created. Locking this pointer is race-free as they are two separate object even though they point to the same process instance. This also removes the need for the complicated tap-dance around retrieving the process pointer. Reviewers: clayborg Subscribers: tberghammer, lldb-commits Differential Revision: http://reviews.llvm.org/D20107 llvm-svn: 269281
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
index 54d77a5d53a..815435c0f74 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
@@ -405,7 +405,8 @@ protected:
AsyncThread (void *arg);
static bool
- MonitorDebugserverProcess(ProcessGDBRemote *process, lldb::pid_t pid, bool exited, int signo, int exit_status);
+ MonitorDebugserverProcess(std::weak_ptr<ProcessGDBRemote> process_wp, lldb::pid_t pid, bool exited, int signo,
+ int exit_status);
lldb::StateType
SetThreadStopInfo (StringExtractor& stop_packet);
OpenPOWER on IntegriCloud