summaryrefslogtreecommitdiffstats
path: root/tools/isolate/trace_child_process.py
diff options
context:
space:
mode:
authormaruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-04 23:19:53 +0000
committermaruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-04 23:19:53 +0000
commit73bfb890b9a5e1b58bcea5928ec4b643167fbc24 (patch)
tree8b4ee4c0f0704b6a18689f33bf0c626fa1462322 /tools/isolate/trace_child_process.py
parentda4b6134f1b1415aa18a3806ac29d63932cc3bb1 (diff)
downloadchromium_src-73bfb890b9a5e1b58bcea5928ec4b643167fbc24.zip
chromium_src-73bfb890b9a5e1b58bcea5928ec4b643167fbc24.tar.gz
chromium_src-73bfb890b9a5e1b58bcea5928ec4b643167fbc24.tar.bz2
Use trace_child_process.py on Windows and save information about the trace in json.
Removes much of the guesswork in the log parsing code, now the child process id is known. Remove references to logman.exe in the log parsing script since it's now called by the grand-parent process. NOTRY=true R=cmp@chromium.org BUG=98636 TEST= Review URL: https://chromiumcodereview.appspot.com/10448044 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@140421 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/isolate/trace_child_process.py')
-rwxr-xr-xtools/isolate/trace_child_process.py30
1 files changed, 16 insertions, 14 deletions
diff --git a/tools/isolate/trace_child_process.py b/tools/isolate/trace_child_process.py
index 3a8367b..07d9915 100755
--- a/tools/isolate/trace_child_process.py
+++ b/tools/isolate/trace_child_process.py
@@ -3,30 +3,32 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-"""Waits for the go signal and replaces itself with the command to be run.
+"""Executes with the command to be run and optionally waits for the go signal.
Not meant to be used directly, only meant to be used by trace_inputs.py.
+
+This script is used by the tracer as a signal for the log parser that the child
+process is the process we care about. It is especially important on kernel based
+tracer because we want it to trace the relevant process tree.
"""
-import os
import subprocess
import sys
def main():
- signal = 'Go!'
- value = sys.stdin.read(len(signal))
- assert value == signal
- sys.stdin.close()
- # Replace the executable with an absolute path to make it easier to grok.
cmd = sys.argv[1:]
- cmd[0] = os.path.abspath(cmd[0])
- if cmd[0].endswith('.py'):
- cmd.insert(0, sys.executable)
- p = subprocess.Popen(cmd)
- #print 'Child pid: %d' % p.pid
- p.wait()
- return p.returncode
+ if sys.argv[1] == '--wait':
+ cmd = cmd[1:]
+ signal = 'Go!'
+ value = sys.stdin.read(len(signal))
+ assert value == signal
+ sys.stdin.close()
+
+ # The reason os.execve() is not used is that we don't want the modules
+ # imported here to influence the executable being traced, so we need a fresh
+ # pid and need to fork.
+ return subprocess.call(cmd)
if __name__ == '__main__':