[Lldb-commits] [PATCH] D10968: Use /proc/$$/stat instead of $PPID.

Chaoren Lin chaorenl at google.com
Mon Jul 6 11:11:59 PDT 2015



- Add explanatory comment.


http://reviews.llvm.org/D10968

Files:
  test/tools/lldb-server/gdbremote_testcase.py

Index: test/tools/lldb-server/gdbremote_testcase.py
===================================================================
--- test/tools/lldb-server/gdbremote_testcase.py
+++ test/tools/lldb-server/gdbremote_testcase.py
@@ -158,7 +158,10 @@
             # Remote platforms don't support named pipe based port negotiation
             use_named_pipe = False
 
-            pid = run_shell_cmd("echo $PPID")
+            # Grab the ppid from /proc/[shell pid]/stat
+            shell_stat = run_shell_cmd("cat /proc/$$/stat")
+            # [pid] ([executable]) [state] [*ppid*]
+            pid = re.match(r"^\d+ \(.+\) . (\d+)", shell_stat).group(1)
             ls_output = run_shell_cmd("ls -l /proc/%s/exe" % pid)
             exe = ls_output.split()[-1]
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10968.29108.patch
Type: text/x-patch
Size: 758 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150706/0a28aec6/attachment.bin>


More information about the lldb-commits mailing list