[all-commits] [llvm/llvm-project] f14743: Add the ability to break on call-site locations, i...

jimingham via All-commits all-commits at lists.llvm.org
Mon Oct 28 10:02:20 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f14743794587db102c6d1b20f9c87a1ac20decfd
      https://github.com/llvm/llvm-project/commit/f14743794587db102c6d1b20f9c87a1ac20decfd
  Author: jimingham <jingham at apple.com>
  Date:   2024-10-28 (Mon, 28 Oct 2024)

  Changed paths:
    M lldb/include/lldb/Breakpoint/BreakpointLocation.h
    M lldb/include/lldb/Breakpoint/BreakpointSite.h
    M lldb/include/lldb/Core/Declaration.h
    M lldb/include/lldb/Target/StopInfo.h
    M lldb/include/lldb/Target/ThreadPlanStepInRange.h
    M lldb/source/Breakpoint/BreakpointLocation.cpp
    M lldb/source/Breakpoint/BreakpointResolver.cpp
    M lldb/source/Breakpoint/BreakpointSite.cpp
    M lldb/source/Core/Declaration.cpp
    M lldb/source/Symbol/Block.cpp
    M lldb/source/Symbol/CompileUnit.cpp
    M lldb/source/Target/StackFrameList.cpp
    M lldb/source/Target/StopInfo.cpp
    M lldb/source/Target/Thread.cpp
    M lldb/source/Target/ThreadPlanStepInRange.cpp
    M lldb/source/Target/ThreadPlanStepOverRange.cpp
    M lldb/test/API/functionalities/inline-stepping/TestInlineStepping.py
    M lldb/test/API/functionalities/inline-stepping/calling.cpp

  Log Message:
  -----------
  Add the ability to break on call-site locations, improve inline stepping (#112939)

Previously lldb didn't support setting breakpoints on call site
locations. This patch adds that ability.

It would be very slow if we did this by searching all the debug
information for every inlined subroutine record looking for a call-site
match, so I added one restriction to the call-site support. This change
will find all call sites for functions that also supply at least one
line to the regular line table. That way we can use the fact that the
line table search will move the location to that subsequent line (but
only within the same function). When we find an actually moved source
line match, we can search in the function that contained that line table
entry for the call-site, and set the breakpoint location back to that.

When I started writing tests for this new ability, it quickly became
obvious that our support for virtual inline stepping was pretty buggy.
We didn't print the right file & line number for the breakpoint, and we
didn't set the position in the "virtual inlined stack" correctly when we
hit the breakpoint. We also didn't step through the inlined frames
correctly. There was code to try to detect the right inlined stack
position, but it had been refactored a while back with the comment that
it was super confusing and the refactor was supposed to make it clearer,
but the refactor didn't work either.

That code was made much clearer by abstracting the job of "handling the
stack readjustment" to the various StopInfo's. Previously, there was a
big (and buggy) switch over stop info's. Moving the responsibility to
the stop info made this code much easier to reason about.

We also had no tests for virtual inlined stepping (our inlined stepping
test was actually written specifically to avoid the formation of a
virtual inlined stack... So I also added tests for that along with the
tests for setting the call-site breakpoints.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list