[all-commits] [llvm/llvm-project] 5f23b5: [lldb] Follow serial outlined functions when scann...

Augusto Noronha via All-commits all-commits at lists.llvm.org
Fri Sep 18 11:44:32 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5f23b5e1475236f51e614ea971e22bf800fbe7c8
      https://github.com/llvm/llvm-project/commit/5f23b5e1475236f51e614ea971e22bf800fbe7c8
  Author: Augusto Noronha <anoronha at apple.com>
  Date:   2026-09-18 (Fri, 18 Sep 2026)

  Changed paths:
    M lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp
    M lldb/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.h
    M lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
    M lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.h
    A lldb/test/API/functionalities/unwind/outlined-prologue/Makefile
    A lldb/test/API/functionalities/unwind/outlined-prologue/TestOutlinedPrologueUnwind.py
    A lldb/test/API/functionalities/unwind/outlined-prologue/main.c
    M lldb/unittests/UnwindAssembly/ARM64/CMakeLists.txt
    M lldb/unittests/UnwindAssembly/ARM64/TestArm64InstEmulation.cpp

  Log Message:
  -----------
  [lldb] Follow serial outlined functions when scanning for an unwind plan (#222800)

For code-size-constrained builds the compiler's instruction outliner
finds
identical instruction sequences across functions, moves them into a
single
OUTLINED_FUNCTION_<n>, and has every user call it. Instructions from a
function's prologue, body or epilogue may all be outlined.

lldb's instruction-emulation UnwindPlan creator scans the instructions
of a
function and, following the ABI's calling convention, assumes a call
leaves the
stack and registers in a known state. That assumption does not hold for
outlined functions: when prologue and epilogue instructions are outlined
out of
the function body, the UnwindPlan misses those register spills and
restores,
which leads to inaccurate variable tracking in the caller's frames.

This patch looks for call instructions in the function body, and when
the
callee is an OUTLINED_FUNCTION_<n> it evaluates the callee's
instructions too,
folding the UnwindPlan-relevant state changes -- register saves,
restores, CFA
changes -- into the plan of the function being scanned.

Only straight-line helpers are followed: a single basic block whose sole
control flow is the terminator returning to the caller. Anything else
has more
than one path through the callee is skipped entirely. In practice that
means
mid-function outlined code, which rarely changes the unwind state.
Outlined
prologues, the common and important case, are covered.

Assisted-by: Claude

rdar://187149822



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