[PATCH] D144392: [lldb] Skip signal handlers for ignored signals on lldb-server's side when stepping

Pavel Kosov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 20 06:11:34 PST 2023


kpdev42 created this revision.
kpdev42 added reviewers: DavidSpickett, clayborg, k8stone, davide.
kpdev42 added a project: LLDB.
Herald added subscribers: JDevlieghere, s.egerton, dmgreen, simoncook, emaste.
Herald added a project: All.
kpdev42 requested review of this revision.
Herald added subscribers: lldb-commits, pcwang-thead.

Before this patch, stepping off a breakpoint in lldb might end up inside a signal handler if a signal was received, which would result in continuing and hitting the same breakpoint again, while on the surface no instruction was executed and the user is not interested in that specific signal or its handling. This patch uses the machinery set up for software single-stepping to circumvent this behavior. This changes what a eStateStepping in lldb-server does to a thread on linux platforms: if a single-step is requested right after an ignored (pass=true, stop=false, notify=false) signal is received by the inferior, then a breakpoint is installed on the current pc, and the thread is continued (not single-stepped). When that breakpoint hits (presumably after the user signal handler returns or immediately after the continue, if the handler is not installed), it is removed, the stop is ignored and the thread is continued with single-stepping again. If a stop occurs inside the handler, then the stepping ends there, and the breakpoint is removed as well.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D144392

Files:
  lldb/include/lldb/Host/common/NativeProcessProtocol.h
  lldb/source/Host/common/NativeProcessProtocol.cpp
  lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.cpp
  lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.h
  lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
  lldb/source/Plugins/Process/Linux/NativeProcessLinux.h
  lldb/source/Plugins/Process/Linux/NativeThreadLinux.cpp
  lldb/source/Plugins/Process/Utility/CMakeLists.txt
  lldb/source/Plugins/Process/Utility/NativeProcessContinueUntilBreakpoint.cpp
  lldb/source/Plugins/Process/Utility/NativeProcessContinueUntilBreakpoint.h
  lldb/source/Plugins/Process/Utility/NativeProcessSoftwareSingleStep.cpp
  lldb/source/Plugins/Process/Utility/NativeProcessSoftwareSingleStep.h
  lldb/test/API/functionalities/thread/signal_during_breakpoint_step/Makefile
  lldb/test/API/functionalities/thread/signal_during_breakpoint_step/SignalDuringBreakpointStepTestCase.py
  lldb/test/API/functionalities/thread/signal_during_breakpoint_step/TestSignalDuringBreakpointFuncStepIn.py
  lldb/test/API/functionalities/thread/signal_during_breakpoint_step/TestSignalDuringBreakpointFuncStepOut.py
  lldb/test/API/functionalities/thread/signal_during_breakpoint_step/TestSignalDuringBreakpointFuncStepOver.py
  lldb/test/API/functionalities/thread/signal_during_breakpoint_step/TestSignalDuringBreakpointFuncStepUntil.py
  lldb/test/API/functionalities/thread/signal_during_breakpoint_step/TestSignalDuringBreakpointStepOut.py
  lldb/test/API/functionalities/thread/signal_during_breakpoint_step/TestSignalDuringBreakpointStepOver.py
  lldb/test/API/functionalities/thread/signal_during_breakpoint_step/TestSignalDuringBreakpointStepUntil.py
  lldb/test/API/functionalities/thread/signal_during_breakpoint_step/TestSignalStepOverHandler.py
  lldb/test/API/functionalities/thread/signal_during_breakpoint_step/main.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144392.498820.patch
Type: text/x-patch
Size: 44854 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230220/2229ecb0/attachment-0001.bin>


More information about the llvm-commits mailing list