[Lldb-commits] [PATCH] D12968: Fix for lldb-mi crash in Listener code if -exec-abort MI command was invoked without getting process stopped

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Wed Sep 23 03:23:13 PDT 2015

labath added inline comments.

Comment at: source/Target/Process.cpp:3934
@@ +3933,3 @@
+            ListenerSP listener_sp (new Listener("lldb.Process.HaltForDestroyOrDetach.hijack"));
+            HijackProcessEvents(listener_sp.get());
ki.stfu wrote:
> btw: please update this line when Process::HaltForDestroyOrDetach will be renamed to StopForDestroyOrDetach
The renaming patch has landed in r248371.

I am not sure about this, as I don't understand the full context of this change, so take this comment with a grain of salt. However, this seems to be introducing a race here... If I understand correctly, you are trying to make sure that someone else (sitting in another thread, waiting for public process events) does not snatch the process stop event from under you. If that is the case then this can still happen if the process stops very quickly (i.e., the event is broadcast after SendAsyncInterrupt(), but before HijackProcessEvents()). To avoid this, I think you should hijack the events before you interrupt the process, possibly even before StopForDestroyOrDetach is called (to handle the case when the process stops naturally just as you are about to kill it). Have you figured out what is the other thread doing that is causing the crash (i.e., where is the memory WaitForProcessToStop is referencing freed?)

I'd be interested to hear what Greg and Jim have to say about this..



More information about the lldb-commits mailing list