0

android: Add debug logs for trace event rewriter

R=martinkong@google.com

Bug: 402434135
Change-Id: I42d09456e8d689d0179fe4dcb3e640189cd96801
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6343733
Reviewed-by: Martin Kong <martinkong@google.com>
Auto-Submit: Peter Wen <wnwen@chromium.org>
Commit-Queue: Martin Kong <martinkong@google.com>
Cr-Commit-Position: refs/heads/main@{#1431024}
This commit is contained in:
Peter Wen
2025-03-11 11:17:54 -07:00
committed by Chromium LUCI CQ
parent 2060cf3ab5
commit fdeb429acc

@ -5,6 +5,7 @@
"""Wrapper script around TraceEventAdder script."""
import argparse
import logging
import sys
import tempfile
import os
@ -19,6 +20,7 @@ _MAX_CMDLINE = 10000
def main(argv):
build_utils.InitLogging('TRACE_EVENT_REWRITER_DEBUG')
argv = build_utils.ExpandFileArgs(argv[1:])
parser = argparse.ArgumentParser()
action_helpers.add_depfile_arg(parser)
@ -46,12 +48,15 @@ def main(argv):
]
if sum(len(x) for x in cmd) > _MAX_CMDLINE:
# Cannot put --classpath in the args file because that is consumed by the
# wrapper script.
args_file = tempfile.NamedTemporaryFile(mode='w')
# wrapper script. Keep the args file on disk when debugging.
is_debug = logging.getLogger().isEnabledFor(logging.DEBUG)
args_file = tempfile.NamedTemporaryFile(mode='w', delete=not is_debug)
args_file.write('\n'.join(cmd[3:]))
args_file.flush()
cmd[3:] = ['@' + args_file.name]
logging.debug(' '.join(cmd))
build_utils.CheckOutput(cmd, print_stdout=True)
build_utils.Touch(args.stamp)