[Lldb-commits] [PATCH] 32-bit target support on x86_64 Linux

Kaylor, Andrew andrew.kaylor at intel.com
Thu Sep 6 14:45:29 PDT 2012

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.

This patch also modifies ArchSpec.h to recognize that "unknown" indicates an unspecified vendor choice.  Whether or not this comes into play seems to depend on how you build lldb.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20120906/e9594e47/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: linux-32-bit-support.patch
Type: application/octet-stream
Size: 8631 bytes
Desc: linux-32-bit-support.patch
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20120906/e9594e47/attachment.obj>

More information about the lldb-commits mailing list