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
This commit is contained in:
@@ -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]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user