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

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


This revision was automatically updated to reflect the committed changes.
Closed by commit rL241486: Use /proc/$$/stat instead of $PPID. (authored by chaoren).

Changed prior to commit:
  http://reviews.llvm.org/D10968?vs=29108&id=29112#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D10968

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

Index: lldb/trunk/test/tools/lldb-server/gdbremote_testcase.py
===================================================================
--- lldb/trunk/test/tools/lldb-server/gdbremote_testcase.py
+++ lldb/trunk/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.29112.patch
Type: text/x-patch
Size: 791 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150706/2f5c6a7b/attachment.bin>


More information about the lldb-commits mailing list