[Lldb-commits] [lldb] [lldb][Windows] Fix "Invalid register name" for eax on x86_64 attach (PR #203498)
Jason Molenda via lldb-commits
lldb-commits at lists.llvm.org
Thu Jun 18 23:48:54 PDT 2026
jasonmolenda wrote:
Sorry for not following up earlier. When I do this sequence on a Mac, attaching to an x86_64 process running under Rosetta, I start lldb with `bin/lldb -x -O 'log enable gdb-remote packets' -O 'log enable lldb target'` so I get inline logging of packets and target settings.
```
<lldb.process.gdb-remote.async> < 16> send packet: $vAttach;a330#fd
<lldb.process.gdb-remote.async> < 626> read packet: $T11thread:d406a4;threads:d406a4;thread-pcs:7ff8092e25e2;00:4e01000200000000;01:38c2ad0503000000;02:0100000000000000;03:0100000000000000;04:030d000000000000;05:0000000000000000;06:10c2ad0503000000;07:d8c1ad0503000000;08:0100000000000000;09:0000000000000000;0a:0100000000000000;0b:0000000000000000;0c:08c8ad0503000000;0d:18c9ad0503000000;0e:28c2ad0503000000;0f:0000000000000000;10:e2252e09f87f0000;11:4702000000000000;12:2b00000000000000;13:0000000000000000;14:0000000000000000;metype:5;mecount:2;medata:10003;medata:11;memory:0x305adc210=50c2ad0503000000f2d41c09f87f0000;memory:0x305adc250=70c2ad05030000009c04b80001000000;#00
```
`ProcessGDBRemote::BuildDynamicRegisterInfo` is called at this point, and we hit
```
471 const ArchSpec &target_arch = GetTarget().GetArchitecture();
472 const ArchSpec &remote_host_arch = m_gdb_comm.GetHostArchitecture();
473 const ArchSpec &remote_process_arch = m_gdb_comm.GetProcessArchitecture();
474
475 // Use the process' architecture instead of the host arch, if available
476 ArchSpec arch_to_use;
477 if (remote_process_arch.IsValid())
478 arch_to_use = remote_process_arch;
479 else
480 arch_to_use = remote_host_arch;
[...]
-> 485 llvm::Error register_info_err = GetGDBServerRegisterInfo(arch_to_use);
```
which causes a `qProcessInfo` to be sent,
```
<lldb.process.gdb-remote.async> < 16> send packet: $qProcessInfo#dc
<lldb.process.gdb-remote.async> < 169> read packet: $pid:a330;parent-pid:a33f;real-uid:1f5;real-gid:14;effective-uid:1f5;effective-gid:14;cputype:1000007;cpusubtype:3;ptrsize:8;ostype:macosx;vendor:apple;endian:little;#00
```
```
(lldb) v arch_to_use
(lldb_private::ArchSpec) arch_to_use = {
m_triple = (Data = "x86_64-apple-macosx-", Arch = x86_64, SubArch = NoSubArch, Vendor = Apple, OS = MacOSX, Environment = UnknownEnvironment, ObjectFormat = MachO)
```
we got the architecture from the qProcessInfo response via `cputype`, `cpusubtype` which is a very mac specific way of communicating CPU_TYPE_X86_64, CPU_SUBTYPE_X86_64_ALL that gets turned into the correct ArchSpec.
Is lldb sending a qProcessInfo on windows, and what does the response include? Are we not able to turn it into a correct ArchSpec?
https://github.com/llvm/llvm-project/pull/203498
More information about the lldb-commits
mailing list