[Lldb-commits] [lldb] [lldb] Infer GPR base size from registers when target arch is unset (PR #203498)

Charles Zablit via lldb-commits lldb-commits at lists.llvm.org
Fri Jun 12 07:20:27 PDT 2026


================
@@ -207,6 +207,20 @@ void ABIX86::AugmentRegisterInfo(
 
   uint32_t gpr_base_size =
       process_sp->GetTarget().GetArchitecture().GetAddressByteSize();
+  // Determine the GPR base size. Prefer the target architecture, but fall
+  // back to the register list itself when the target arch isn't set yet
+  if (gpr_base_size == 0) {
+    for (const auto &reg : regs) {
+      if (reg.name == "rax" || reg.name == "rsp" || reg.name == "rip") {
----------------
charles-zablit wrote:

This happens with `process attach -p PID`, if the user does not create a target before. This made me reconsider my approach.

https://github.com/llvm/llvm-project/pull/203498


More information about the lldb-commits mailing list