[Lldb-commits] [lldb] Fix a bug with cancelling "attach -w" after you have run a process previously (PR #65822)

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Tue Sep 12 15:26:53 PDT 2023


clayborg wrote:

> It seems a bit weird to have an Execution context with a thread and a stack frame but not the process they belong to. I don't know that it would really help either. Even if you removed the process so that you no longer had to check for that being invalid, if a thread or frame had been set in the execution context, you'd still have to check for them being from the wrong process. So I don't think we would made things significantly simpler by leaving out the process. I think it's easier to deal with it when we hand them out. Jim

Or we can have ExecutionContext have a single element so that it is always correct:
```
ExecutionContext {
...
   std::shared_ptr<ExecutionContextScope> m_exe_scope_sp;
```
Since target, proces, thread and frames all inherit from ExecutionContextScope, all we need to do is store one item. The ExecutionContextScope API has:
```
  virtual lldb::TargetSP CalculateTarget() = 0;
  virtual lldb::ProcessSP CalculateProcess() = 0;
  virtual lldb::ThreadSP CalculateThread() = 0;
  virtual lldb::StackFrameSP CalculateStackFrame() = 0;
```
So then everything would always be correct.


https://github.com/llvm/llvm-project/pull/65822


More information about the lldb-commits mailing list