[Lldb-commits] [PATCH] D20368: Remove Platform usages from NativeProcessLinux

Nitesh Jain via lldb-commits lldb-commits at lists.llvm.org
Tue May 24 01:25:34 PDT 2016

nitesh.jain added inline comments.

Comment at: source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp:53
@@ -22,2 +52,3 @@
 NativeRegisterContextLinux::NativeRegisterContextLinux(NativeThreadProtocol &native_thread,
                                                        uint32_t concrete_frame_idx,
labath wrote:
> jaydeep wrote:
> > We have tried executing ptrace(NT_PRSTATUS) on MIPS with 3.18. It is able to detect the arch correctly (64->64 and 64->32). However with 3.10 it fails with EIO. Is there any fallback method when ptrace(NT_PRSTATUS) fails?
> Thanks for checking that out.
> This makes things a bit tricky. We *could* fallback to the "parse the executable ELF" method of getting the architecture, but that would make this patch a bit pointless, as that is what I am trying to remove in the first place. I suppose we could make the fallback mips-only, but that will not be too ideal either.
> I don't know about any other fallbacks. It would be interesting to know how strace does that. I've tried looking at strace source code, but I could not make much out of it. Do you know if a single strace binary is capable of correctly tracing both 32- and 64-bit processes? If so, could you try running the following experiment for me:
> - create a simple c file that does a sleep(1) and exits
> - compile 32- and 64-bit versions of the executable
> - execute the following commands:
> ```
> strace -o /tmp/32.txt -- strace -o /dev/null -- a.out.32
> strace -o /tmp/64.txt -- strace -o /dev/null -- a.out.64
> ```
> Could you send me the outputs (32.txt, 64.txt). Maybe I'll be able to figure something out from that.
> If that does not work, I may have to abandon this.
> thanks.
// 32 bit ELF
gcc-4.9 -g -O0 -mabi=64 -mips64r2 simple.c -o a.out.64

// 64 bit ELF
gcc-4.9 -g -O0 -mabi=32 -mips32r2 simple.c -o a.out.32

// Strace for 32 and 64 bit
strace -o /tmp/64.txt -- strace -o /dev/null -- ./a.out.64
strace -o /tmp/32.txt -- strace -o /dev/null -- ./a.out.32

// File command output for both file

a.out.64: ELF 64-bit LSB executable, MIPS, MIPS64 rel2 version 1 (SYSV), dynamically linked, interpreter /lib64/ld.so.1, BuildID[sha1]=6e0f92a8abee292b4b6462d79ec0420a3d8aaad0, for GNU/Linux 2.6.32, not stripped

a.out.32: ELF 32-bit LSB executable, MIPS, MIPS32 rel2 version 1, dynamically linked, interpreter /lib/ld.so.1, for GNU/Linux 2.6.32, BuildID[sha1]=c4e09148526975f777e3e70bec85868616d3ce94, not stripped




More information about the lldb-commits mailing list