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
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to