[Lldb-commits] [PATCH] D144392: [lldb] Skip signal handlers for ignored signals on lldb-server's side when stepping
Pavel Labath via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Tue Mar 14 10:11:28 PDT 2023
labath added a comment.
In D144392#4188940 <https://reviews.llvm.org/D144392#4188940>, @kpdev42 wrote:
> Gdb does this for example:
>
>> GDB optimizes for stepping the mainline code. If a signal that has handle nostop and handle pass set arrives while a stepping command (e.g., stepi, step, next) is in progress, GDB lets the signal handler run and then resumes stepping the mainline code once the signal handler returns. In other words, GDB steps over the signal handler. This prevents signals that you’ve specified as not interesting (with handle nostop) from changing the focus of debugging unexpectedly.
>
> (https://sourceware.org/gdb/onlinedocs/gdb/Signals.html), which seems reasonable.
I agree that this is the most useful behavior in most normal situations.
> If this logic does not belong in lldb-server,
Yes, I believe this is too complex to be done inside lldb-server. I might reconsider if you can show that the gdb logic you described above is also implemented on the gdbserver side, but I'd rather not.. :)
> then it could be fixed right inside the `StepOverBreakpoint` plan, by enabling the breakpoint being stepped over when a signal is received, waiting for it to hit when the potential handler has returned, and then trying to step off again. But then doing a `step-into` from a line with a breakpoint will step over the signal handler, and from a line without a breakpoint will stop inside the handler, if a signal is received. Then probably creating a new `ThreadPlan` instead with the same logic, executing on top of the plan stack, is the way to go?
Sounds approximately right. The way I'd probably do is it to have the `StepOverBreakpoint` step into the signal handler, and then push a `StepOut` (which hopefully knows how to step out of a signal handler -- if not it may need some tuning, or creating a specialized `StepOutOfSignal` plan). After the step out is done, it can retry the step over operation.
@jingham is our thread plan guru, though, so he may have a better idea...
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D144392/new/
https://reviews.llvm.org/D144392
More information about the lldb-commits
mailing list