[Lldb-commits] [PATCH] D130985: [lldb] Fix TestDeletedExecutable on linux

David Spickett via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Aug 2 06:07:16 PDT 2022


DavidSpickett added a comment.

Tell me if I understand the strategy.

If you're on arm64 but the process is actually arm32 and you ask for the general registers, you'll get back something with size < the size you expect for the 64 bit register set.
If you're on arm32 then you always assume that the architecture is the host architecture (since there's no backward compatibility mode to worry about).
(though see my comment about potential cross arch shenanigans)

Ditto for x86_64 and i386.

If the architecture doesn't have a 32/64 split then assume host architecture (as you did for s390x).

And ppc64 we don't support a ppc32 so again use the host (and maybe ppc64 doesn't have a backward compatibility mode in linux anyway).

And you're looking at the size of the register context, not the number of registers or their names or whatever. So even for something like RISCV vs RISCV64 where the number and names of registers is the same, the *size* changes with the bitness (xlen I think they call it) so it would still work.

If so, sounds good to me.



================
Comment at: lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp:162
+NativeRegisterContextLinux::DetermineArchitectureViaGPR(lldb::tid_t tid,
+                                                        size_t gpr64) {
+  std::unique_ptr<uint8_t[]> data = std::make_unique<uint8_t[]>(gpr64);
----------------
Rename this `gpr64s_size` something like that. It took me a bit to realise that it wasn't the value of a register, or meant to be a return by ref of the result somehow.


================
Comment at: lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm.cpp:844
   return NativeRegisterContextLinux::ReadGPR();
 #else  // __aarch64__
   struct iovec ioVec;
----------------
Is this a problem? First time I'm seeing such code I thought to debug arm32 on arm64 you just had to use an arm32 lldb-server binary.

Host architecture would be arm64 if `__aarch64__` was defined, right? Same thing if I took an arm32 lldb-server binary and ran it on arm64, host is arm64.

Or is this not a problem. This architecture detection is a last resort so not getting a corner case right might be fine.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130985/new/

https://reviews.llvm.org/D130985



More information about the lldb-commits mailing list