summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2017-08-09 21:18:04 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2017-08-09 21:18:04 +0000
commitc57aaaf57cd97f2a6515ef0d2726a0ff49868b7b (patch)
treebcd652dc2612afdf4bb640ddd5898216e92521ac
parenta5e2c3e3d83faa64b1c15ff151a99ebf05a2a913 (diff)
parent466e289dc83e15a88304f7c1359471d741a3551d (diff)
downloaddevelopment-ndk-r16-release.tar.gz
Merge "gdbclient.py: don't use make to dump target info."android-o-iot-preview-5o-iot-preview-5ndk-r16-release
-rwxr-xr-xscripts/gdbclient.py36
1 files changed, 14 insertions, 22 deletions
diff --git a/scripts/gdbclient.py b/scripts/gdbclient.py
index ff593b3e8..982ddc870 100755
--- a/scripts/gdbclient.py
+++ b/scripts/gdbclient.py
@@ -68,28 +68,12 @@ def parse_args():
return parser.parse_args()
-def dump_var(root, variable):
- make_args = ["make", "CALLED_FROM_SETUP=true",
- "BUILD_SYSTEM={}/build/core".format(root),
- "--no-print-directory", "-f",
- "{}/build/core/config.mk".format(root),
- "dumpvar-{}".format(variable)]
-
- # subprocess cwd argument does not change the PWD shell variable, but
- # dumpvar.mk uses PWD to create an absolute path, so we need to set it.
- saved_pwd = os.environ['PWD']
- os.environ['PWD'] = root
- make_output = subprocess.check_output(make_args, cwd=root)
- os.environ['PWD'] = saved_pwd
- return make_output.splitlines()[0]
-
-
def verify_device(root, device):
- names = set([device.get_prop("ro.build.product"), device.get_prop("ro.product.device")])
- target_device = dump_var(root, "TARGET_DEVICE")
- if target_device not in names:
- msg = "TARGET_DEVICE ({}) does not match attached device ({})"
- sys.exit(msg.format(target_device, ", ".join(names)))
+ name = device.get_prop("ro.product.name")
+ target_device = os.environ["TARGET_PRODUCT"]
+ if target_device != name:
+ msg = "TARGET_PRODUCT ({}) does not match attached device ({})"
+ sys.exit(msg.format(target_device, name))
def get_remote_pid(device, process_name):
@@ -169,6 +153,7 @@ def handle_switches(args, sysroot):
return (binary_file, pid, run_cmd)
+
def generate_gdb_script(sysroot, binary_file, is64bit, port, connect_timeout=5):
# Generate a gdb script.
# TODO: Detect the zygote and run 'art-on' automatically.
@@ -226,6 +211,13 @@ end
def main():
+ required_env = ["ANDROID_BUILD_TOP",
+ "ANDROID_PRODUCT_OUT", "TARGET_PRODUCT"]
+ for env in required_env:
+ if env not in os.environ:
+ sys.exit(
+ "Environment variable '{}' not defined, have you run lunch?".format(env))
+
args = parse_args()
device = args.device
@@ -233,7 +225,7 @@ def main():
sys.exit("ERROR: Failed to find device.")
root = os.environ["ANDROID_BUILD_TOP"]
- sysroot = dump_var(root, "abs-TARGET_OUT_UNSTRIPPED")
+ sysroot = os.path.join(os.environ["ANDROID_PRODUCT_OUT"], "symbols")
# Make sure the environment matches the attached device.
verify_device(root, device)