[all-commits] [llvm/llvm-project] 485561: [lldb][NFC] Split RegisterContextUnwind::SavedLoca...
Jason Molenda via All-commits
all-commits at lists.llvm.org
Mon Jun 9 18:36:57 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 48556108f25052a106bfbe83060775bebf9b43a4
https://github.com/llvm/llvm-project/commit/48556108f25052a106bfbe83060775bebf9b43a4
Author: Jason Molenda <jmolenda at apple.com>
Date: 2025-06-09 (Mon, 09 Jun 2025)
Changed paths:
M lldb/include/lldb/Target/RegisterContextUnwind.h
M lldb/source/Target/RegisterContextUnwind.cpp
M lldb/source/Target/RegisterNumber.cpp
Log Message:
-----------
[lldb][NFC] Split RegisterContextUnwind::SavedLocationForRegister (#139817)
RegisterContextUnwind::SavedLocationForRegister is around 450 lines that
first find an abstract register location (e.g. "CFA-8") for a register
by looking in the UnwindPlans. Then it evaluates the abstract register
location to create a concrete register location (e.g. "stored at address
0x...", "live in register at frame 0"). There are some complicated cases
in the first half of the method to handle return address register
architectures correctly, in particular.
Looking at the two halves, they're both exactly 226 lines long and
there's little involvement between them except for passing an abstract
register location along.
(there were some parts in the "abstract register location" code that
would set the concrete register location, unnecessarily)
It's also a complex enough method that there are some bits of code that
aren't actually doing anything at this point.
This patch adds a RegisterContextUnwind::GetAbstractRegisterLocation
method, which does the first half, and has a clearly defined return
values.
The code to convert an AbstractRegisterLocation into a
ConcreteRegisterLocation remains in SavedLocationForRegister.
It's a bit of a tricky patch to visually inspect, despite it not
changing functionality, the reorganizations and rewrites make the diff
unreadable. Nearly all the real changes are in the "find the abstract
register location" first half of the method. I think reading the new
code in its new form is the easiest way to inspect this PR. With a
defined interface between the two of what is expected, it's pretty easy
to look at the code and reason about whether it is written correctly.
(whereas before, that was very difficult, for me at least.)
---------
Co-authored-by: Pavel Labath <pavel at labath.sk>
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