summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorDavid Pursell <dpursell@google.com>2015-10-05 15:36:28 -0700
committerDavid Pursell <dpursell@google.com>2015-10-06 09:18:47 -0700
commitd1fe92f375b088ff61369d35b51673b5d524c39c (patch)
tree6618f0967eb2cf266a6636f2eb8830c11020dc5f /scripts
parent320f881efeeabe670eabf26c120abc94f901ef9b (diff)
downloadandroid_development-d1fe92f375b088ff61369d35b51673b5d524c39c.tar.gz
android_development-d1fe92f375b088ff61369d35b51673b5d524c39c.tar.bz2
android_development-d1fe92f375b088ff61369d35b51673b5d524c39c.zip
gdbclient.py: set PWD when querying makefiles.
Python's subprocess.check_output() cwd argument does not change the PWD environmental variable, which is what dumpvar.mk uses to turn relative paths into absolute paths. This led to incorrect symbol paths when gdbclient was not run from the root directory. This CL fixes the bug by manually setting PWD before calling the makefile. It's possible that dumpvar.mk should be using a different method to get the current directory, but I was scared to change any core build logic and this approach seems to work just fine. Change-Id: Ibe3db0bef6694934c512918f7562029313b1deae
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/gdbclient.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/scripts/gdbclient.py b/scripts/gdbclient.py
index 811d564e7..9d029efa7 100755
--- a/scripts/gdbclient.py
+++ b/scripts/gdbclient.py
@@ -65,7 +65,12 @@ def dump_var(root, variable):
"{}/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]