[Lldb-commits] [PATCH] D148863: Make sure SelectMostRelevantFrame happens only when returning to the user

Jim Ingham via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Apr 20 17:25:08 PDT 2023


jingham created this revision.
jingham added reviewers: JDevlieghere, bulbazord, mib.
Herald added a project: All.
jingham requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

This is a user facing action, it is meant to focus the user's attention on
something other than the 0th frame when you stop somewhere where that's
helpful. For instance, stopping in pthread_kill after an assert will select
the assert frame.

      

This is not something you want to have happen internally in lldb, both
because internally you really don't want the selected frame changing out
from under you, and because the recognizers can do arbitrary work, and that
can cause deadlocks or other unexpected behavior.

      

However, it's not something that the current code does
explicitly after a stop has been delivered, it's expected to happen implicitly
as part of stopping.  I changing this to call SMRF explicitly after a user
stop, but that got pretty ugly quickly.

      

So I added a bool to control whether to run this and audited all the current
uses to determine whether we're returning to the user or not.

      

This is currently a little ad hoc because there isn't a formal way to
determine why we're fetching events.  It would certainly be cleaner to
pass around a "process control baton" that would hold the history of
who is currently running the target, and on whose behalf, so we know:
"we're stopping because we completed a user request", or "we're continuing
because we're running an expression for the user" vrs. "we're continuing
because we're running an expression to allocate memory for another expression",
etc.

      

But that's a much bigger project...


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D148863

Files:
  lldb/include/lldb/Target/Process.h
  lldb/include/lldb/Target/StackFrameList.h
  lldb/include/lldb/Target/Thread.h
  lldb/source/API/SBThread.cpp
  lldb/source/Commands/CommandObjectFrame.cpp
  lldb/source/Commands/CommandObjectThread.cpp
  lldb/source/Commands/CommandObjectType.cpp
  lldb/source/Core/Debugger.cpp
  lldb/source/Core/IOHandlerCursesGUI.cpp
  lldb/source/Core/ValueObject.cpp
  lldb/source/Expression/REPL.cpp
  lldb/source/Plugins/InstrumentationRuntime/ASan/InstrumentationRuntimeASan.cpp
  lldb/source/Plugins/InstrumentationRuntime/MainThreadChecker/InstrumentationRuntimeMainThreadChecker.cpp
  lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp
  lldb/source/Plugins/InstrumentationRuntime/UBSan/InstrumentationRuntimeUBSan.cpp
  lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
  lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp
  lldb/source/Target/ExecutionContext.cpp
  lldb/source/Target/Platform.cpp
  lldb/source/Target/Process.cpp
  lldb/source/Target/StackFrameList.cpp
  lldb/source/Target/StopInfo.cpp
  lldb/source/Target/Target.cpp
  lldb/source/Target/Thread.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148863.515540.patch
Type: text/x-patch
Size: 26530 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230421/160f11c5/attachment-0001.bin>


More information about the lldb-commits mailing list