athierry-oct wrote:

Thanks for your help!

I did a bit more digging : in `TestCallThatRestarts.py`, it seems the stop 
event is sent by `EvaluateExpression()` to the primary listener because the 
process is stopped by a signal (SIGCHLD). So, the execution of the thread plan 
that runs during expression evaluation is interrupted, and we end up in the 
following code:

Process.cpp
```c++
  // If the process exited during the run of the thread plan, notify everyone.

  if (event_to_broadcast_sp) {
    if (log)
      log->PutCString("Process::RunThreadPlan(): rebroadcasting event.");
    BroadcastEvent(event_to_broadcast_sp);
  }
```


Here's the relevant log:
```
python3          Process::RunThreadPlan(): execution interrupted: 
0x7f3748007600 Event: broadcaster = 0x133665e8 (lldb.process), type = 
0x00000001 (state-changed), data = { process = 0x133665b0 (pid = 1200636), 
state = stopped} <1 threads> <0x1251fc [ip 0x7f42dffa653b] signal SIGCHLD>
python3          Process::RunThreadPlan: ExecutionInterrupted - for plan: 
0x1307b8d0 not discarding.
python3          0x000000001335E690 
Broadcaster("lldb.process")::RestoreBroadcaster (about to pop 
listener("lldb.process.listener.run-thread-plan")=0x000000001305F8D0)
python3          Process::RunThreadPlan(): rebroadcasting event.
python3          0x000000001335e690 Broadcaster("lldb.process")::BroadcastEvent 
(event_sp = 0x7f3748007600 Event: broadcaster = 0x133665e8 (lldb.process), type 
= 0x00000001 (state-changed), data = { process = 0x133665b0 (pid = 1200636), 
state = stopped}, unique=false) hijack = 0x0000000000000000
python3          0x1242a210 Listener('lldb.Debugger')::AddEvent (event_sp = 
{0x7f3748007600})
python3          -- [UserExpression::Execute] Execution of expression completed 
--
python3          == [UserExpression::Evaluate] Execution completed abnormally ==
```


IIUC LLDB broadcasts this stop event to the primary listener to let the user 
(eg. the IDE) know that the process stopped during expression evaluation.

In light of this, do you still think `EvaluateExpression()` should consume the 
stop event instead of rebroadcasting it to the primary listener? Or should the 
test itself handle the event to clear the queue after `EvaluateExpression()` 
but before calling `ResumeSynchronous()` ?

https://github.com/llvm/llvm-project/pull/144919
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to