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

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Mon May 23 08:02:55 PDT 2016

labath planned changes to this revision.

Comment at: source/Plugins/Process/Linux/NativeRegisterContextLinux.cpp:53
@@ -22,2 +52,3 @@
 NativeRegisterContextLinux::NativeRegisterContextLinux(NativeThreadProtocol &native_thread,
                                                        uint32_t concrete_frame_idx,
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.



More information about the lldb-commits mailing list