android: pythonthreefication kicks to stack.py

These changes made the stack tool work for me without hanging
and crashing in Python3.

I did not inspect the surrounding code and did not test with other tools
from bin/, YMMV.

Also I was confused with these things done by the tool:

1. Copying its input to the output before processing it. :butwhymeme:
   - removed this printing

2. Ignoring EOF
   - change it to stop processing input when encountering EOF (i.e.
     pressing Ctrl+D ends the session quietly)

3. Waiting for a line "not looking like backtrace" to start symbolizing
   - clarified this in the welcome message

      # Now paste a crash from logcat.

Bug: None
Test: out/AndroidRelease/bin/trichrome_chrome_google_bundle stack \
Change-Id: I36431ae7c46252aae9e21122ce931f7111b41d22
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3190107
Reviewed-by: Dirk Pranke <dpranke@google.com>
Reviewed-by: Andrew Grieve <agrieve@chromium.org>
Commit-Queue: Egor Pasko <pasko@chromium.org>
Cr-Commit-Position: refs/heads/main@{#926227}
NOKEYCHECK=True
GitOrigin-RevId: 86775be5a579b53a01d09d47d82b666aea9b251a
diff --git a/development/scripts/stack.py b/development/scripts/stack.py
index de79a05..ccf1f47 100755
--- a/development/scripts/stack.py
+++ b/development/scripts/stack.py
@@ -203,7 +203,8 @@
     rootdir, symbol.SYMBOLS_DIR = UnzipSymbols(zip_arg)
 
   if not arguments or arguments[0] == "-":
-    logging.info('Reading native crash info from stdin')
+    logging.info('Reading native crash info from stdin (symbolization starts '
+                 'on the first unrelated line or EOF)')
     with llvm_symbolizer.LLVMSymbolizer() as symbolizer:
       stack_core.StreamingConvertTrace(sys.stdin, {}, more_info,
                                        fallback_monochrome, arch_defined,
diff --git a/development/scripts/stack_core.py b/development/scripts/stack_core.py
index 4b7e67b..a61e95a 100755
--- a/development/scripts/stack_core.py
+++ b/development/scripts/stack_core.py
@@ -186,7 +186,8 @@
 
   preprocessor = PreProcessLog(load_vaddrs, apks_directory)
   for line in iter(sys.stdin.readline, b''):
-    print(line)
+    if not line: # EOF
+      break
     maybe_line, maybe_so_dir = preprocessor([line])
     useful_lines.extend(maybe_line)
     so_dirs.extend(maybe_so_dir)