[Lldb-commits] [lldb] [lldb][Windows] Fix "Invalid register name" for eax on x86_64 attach (PR #203498)

Charles Zablit via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 16 04:09:40 PDT 2026


charles-zablit wrote:

> Does your stub respond with those? We usually ask for `qHostInfo` and `qProcessInfo` before we fetch the `target.xml` register definitions. (fwiw many `target.xml` files also have a `<architecture>` key but it's never been load bearing for setting the Target's ArchSpec, I don't think)

It does, yes. We build `arch_to_use` like this: https://github.com/llvm/llvm-project/blob/9eee6c0f2ae7fc1d5419be38b1839263974191f1/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp#L475-L489

It's the same precedence you described.

The problem isn't determining the arch but rather that nothing writes it onto the Target before `AugmentRegisterInfo` reads it in this scenario: 
If the user does `process attach -p PID` without running `target create` before, `Process::CompleteAttach` calls `DidAttach` here https://github.com/llvm/llvm-project/blob/9eee6c0f2ae7fc1d5419be38b1839263974191f1/lldb/source/Target/Process.cpp#L3351 and
only then `SetArchitecture` here https://github.com/llvm/llvm-project/blob/9eee6c0f2ae7fc1d5419be38b1839263974191f1/lldb/source/Target/Process.cpp#L3358.

Inside that, `ProcessGDBRemote::DidLaunchOrAttach` builds register info first https://github.com/llvm/llvm-project/blob/9eee6c0f2ae7fc1d5419be38b1839263974191f1/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp#L1005 and sets the archictecture later https://github.com/llvm/llvm-project/blob/9eee6c0f2ae7fc1d5419be38b1839263974191f1/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp#L1046.

`AugmentRegisterInfo` runs between those 2 events.

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


More information about the lldb-commits mailing list