Patch from Andrew Kaylor for linux:
The attached patch adds support for debugging 32-bit processes when running a 64-bit lldb on an x86_64 Linux system.
Making this work required two basic changes:
1) Getting lldb to report that it could debug 32-bit processes
2) Changing an assumption about how ptrace works when debugging cross-platform
For the first change, I took a conservative approach and only enabled this for x86_64 Linux platforms. It may be that the change I made in Host.cpp could be extended to other 64-bit Linux platforms, but I'm not familiar enough with the other platforms to know for sure.
For the second change, the Linux ProcessMonitor class was assuming that ptrace(PTRACE_[PEEK|POKE]DATA...) would read/write a "word" based on the child process word size. However, the ptrace documentation says that the "word" size read or written is "determined by the OS variant." I verified experimentally that when ptracing a 32-bit child from a 64-bit parent a 64-bit word is read or written.
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@163398 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Host/common/Host.cpp b/source/Host/common/Host.cpp
index 07e966b..4b23ff4 100644
--- a/source/Host/common/Host.cpp
+++ b/source/Host/common/Host.cpp
@@ -339,6 +339,12 @@
break;
case llvm::Triple::x86_64:
+ g_host_arch_64.SetTriple(triple);
+ g_supports_64 = true;
+ g_host_arch_32.SetTriple(triple.get32BitArchVariant());
+ g_supports_32 = true;
+ break;
+
case llvm::Triple::sparcv9:
case llvm::Triple::ppc64:
case llvm::Triple::cellspu: