summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2012-09-07 17:49:29 +0000
committerGreg Clayton <gclayton@apple.com>2012-09-07 17:49:29 +0000
commit542e4075816c0e8d793f28ea2d2d1186adcd65ae (patch)
tree806fc41814c30834406b760bca1c290cf5e390d0 /lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
parenta5a00e830aff07a66f8b5ddfce2eae06140c2908 (diff)
downloadbcm5719-llvm-542e4075816c0e8d793f28ea2d2d1186adcd65ae.tar.gz
bcm5719-llvm-542e4075816c0e8d793f28ea2d2d1186adcd65ae.zip
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. llvm-svn: 163398
Diffstat (limited to 'lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp')
-rw-r--r--lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
index 5cda1edd3c7..8d4ef495836 100644
--- a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
+++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
@@ -312,6 +312,17 @@ PlatformLinux::GetSupportedArchitectureAtIndex (uint32_t idx, ArchSpec &arch)
arch = Host::GetArchitecture (Host::eSystemDefaultArchitecture);
return arch.IsValid();
}
+ else if (idx == 1)
+ {
+ // If the default host architecture is 64-bit, look for a 32-bit variant
+ ArchSpec hostArch
+ = Host::GetArchitecture(Host::eSystemDefaultArchitecture);
+ if (hostArch.IsValid() && hostArch.GetTriple().isArch64Bit())
+ {
+ arch = Host::GetArchitecture (Host::eSystemDefaultArchitecture32);
+ return arch.IsValid();
+ }
+ }
return false;
}
OpenPOWER on IntegriCloud