New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 878073 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner: ----
Closed: Aug 27
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug

Blocking:
issue 839769



Sign in to add a comment

Can't attach gdb to GPU process on Samsung Galaxy S7

Project Member Reported by kbr@chromium.org, Aug 27

Issue description

Chrome Version: 70.0.3531.0 (Developer Build) unknown (32-bit)
OS: Android 7.0 on Samsung Galaxy S7

What steps will reproduce the problem?
(1) Build debug ChromePublic.apk according to https://chromium.googlesource.com/chromium/src/+/master/docs/android_build_instructions.md
(2) Attempt to debug GPU process via instructions at https://chromium.googlesource.com/chromium/src/+/master/docs/android_debugging_instructions.md

Specifically:

a) quit Chromium
b) Run:
$ ./out/AndroidDebug/bin/chrome_public_apk gdb --debug-process-name privileged_process0

What is the expected result?

Expect to have gdb attached to GPU process.

What happens instead?

W    0.323s TimeoutThread-1-for-MainThread  Stale cache detected. Not using it.
W    0.620s Main  App not running. Sending launch intent.
Traceback (most recent call last):
  File "./out/AndroidDebug/bin/chrome_public_apk", line 32, in <module>
    sys.exit(main())
  File "./out/AndroidDebug/bin/chrome_public_apk", line 22, in main
    resolve(None))
  File "/usr/local/google/home/kbr/src/chrome/src/build/android/apk_operations.py", line 1396, in Run
    _RunInternal(parser, output_directory=output_directory)
  File "/usr/local/google/home/kbr/src/chrome/src/build/android/apk_operations.py", line 1377, in _RunInternal
    args.command.Run()
  File "/usr/local/google/home/kbr/src/chrome/src/build/android/apk_operations.py", line 1103, in Run
    self.args.ide, bool(self.args.verbose_count))
  File "/usr/local/google/home/kbr/src/chrome/src/build/android/apk_operations.py", line 237, in _RunGdb
    raise Exception('Unable to find process "%s"' % debug_process_name)
Exception: Unable to find process "org.chromium.chrome:privileged_process0"


Thinking that this might be a race condition in the script, I inserted a sleep between the launch and attempt to connect via gdb:

----------
diff --git a/build/android/apk_operations.py b/build/android/apk_operations.py
index 2b17c19cdd41..bc4f5bdb85a0 100755
--- a/build/android/apk_operations.py
+++ b/build/android/apk_operations.py
@@ -20,6 +20,7 @@ import shutil
 import sys
 import tempfile
 import textwrap
+import time
 
 import devil_chromium
 from devil import devil_env
@@ -228,6 +229,9 @@ def _RunGdb(device, package_name, debug_process_name, pid, output_directory,
   if not pid:
     logging.warning('App not running. Sending launch intent.')
     _LaunchUrl([device], package_name)
+    logging.warning('Waiting 5 seconds for browser to come up.')
+    time.sleep(5)
+    logging.warning('Looking for requested process name.')
     pid = device.GetApplicationPids(debug_process_name, at_most_one=True)
     if not pid:
       raise Exception('Unable to find process "%s"' % debug_process_name)
----------

This changes the error message:

$ ./out/AndroidDebug/bin/chrome_public_apk gdb --debug-process-name privileged_process0
W    0.630s Main  App not running. Sending launch intent.
W    2.137s Main  Waiting 5 seconds for browser to come up.
W    7.143s Main  Looking for requested process name.
W    7.345s Main  Running: /usr/local/google/home/kbr/src/chrome/src/build/android/adb_gdb --package-name=org.chromium.chrome --output-directory=/usr/local/google/home/kbr/src/chrome/src/out/AndroidDebug --adb=/usr/local/google/home/kbr/src/chrome/src/third_party/android_tools/sdk/platform-tools/adb --device=ce01171123569a0802 --pid=17463 --port=5039 --target-arch=arm
All subsequent output is from adb_gdb script.
ERROR: Failed to run-as org.chromium.chrome, is the app debuggable?


The subprocess shows up:

$ ./out/AndroidDebug/bin/chrome_public_apk ps
ce01171123569a0802 (heroltexx-user 7.0 NRD90M G930FXXU1DQL7 release-keys):
org.chromium.chrome 17379
org.chromium.chrome:privileged_process0 17463
org.chromium.chrome:sandboxed_process0 17433


Could I please ask for some help getting this working? I can't make progress on Issue 839769 without being able to attach to sub-processes, since Chromium doesn't support crash reporting, and I'm not sure whether the GPU process is actually crashing. (No tombstones are showing up, at least as far as I can tell.)

 
Per request from agrieve:

$ ./third_party/android_tools/sdk/platform-tools/adb shell dumpsys package org.chromium.chrome | grep pkgFlags
    pkgFlags=[ DEBUGGABLE HAS_CODE ALLOW_CLEAR_USER_DATA ]

Also per request from agrieve:

$ ./third_party/android_tools/sdk/platform-tools/adb shell run-as org.chromium.chrome echo test
run-as: Could not set capabilities: Operation not permitted

Status: WontFix (was: Untriaged)
As far as I can tell from googling around, is that Samsung has broken run-as, and thus your ability to use gdb :(.

https://stackoverflow.com/questions/37413667/run-as-could-not-set-capabilities-operation-not-permitted

Some other sites suggest disabling knox / rooting device / downgrading OS version. No easy fixes :(

Sign in to add a comment