Print adb output if pushing gdbserver fails
Right now the raised exception only shows the command and return code. Printing the output should make the error more clear. Test: adb root, then in adb shell touch the server and make immutable touch /data/local/tmp/x86_64-lldb-server chattr +i /data/local/tmp/x86_64-lldb-server Then on host lldbclient.py -r test Fails as expected with with "operation not permitted" Change-Id: Ie22f41bb90809c2f9bafaee0be6a151d9b017502
This commit is contained in:
@@ -21,6 +21,7 @@ import argparse
|
|||||||
import atexit
|
import atexit
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
import shlex
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
@@ -170,11 +171,18 @@ def start_gdbserver(device, gdbserver_local_path, gdbserver_remote_path,
|
|||||||
|
|
||||||
# Push gdbserver to the target.
|
# Push gdbserver to the target.
|
||||||
if gdbserver_local_path is not None:
|
if gdbserver_local_path is not None:
|
||||||
device.push(gdbserver_local_path, chroot + gdbserver_remote_path)
|
try:
|
||||||
# If the user here is potentially on Windows, adb cannot inspect execute
|
device.push(gdbserver_local_path, chroot + gdbserver_remote_path)
|
||||||
# permissions. Since we don't know where the users are, chmod
|
# If the user here is potentially on Windows, adb cannot inspect execute
|
||||||
# gdbserver_remote_path on device regardless.
|
# permissions. Since we don't know where the users are, chmod
|
||||||
device.shell(["chmod", "+x", gdbserver_remote_path])
|
# gdbserver_remote_path on device regardless.
|
||||||
|
device.shell(["chmod", "+x", gdbserver_remote_path])
|
||||||
|
except subprocess.CalledProcessError as err:
|
||||||
|
print("Command failed:")
|
||||||
|
print(shlex.join(err.cmd))
|
||||||
|
print("Output:")
|
||||||
|
print(err.output.decode("utf-8"))
|
||||||
|
raise
|
||||||
|
|
||||||
# Run gdbserver.
|
# Run gdbserver.
|
||||||
gdbserver_cmd = [gdbserver_remote_path]
|
gdbserver_cmd = [gdbserver_remote_path]
|
||||||
|
|||||||
Reference in New Issue
Block a user