Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #400 from walac/bugz/1088683
Browse files Browse the repository at this point in the history
Bug 1088683: Deal with GECKO_TOOLS_PREFIX environment variable.
  • Loading branch information
rvandermeulen committed Oct 28, 2014
2 parents b948ccf + e38c2cf commit b5ad322
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions scripts/profile-symbolicate.py
Expand Up @@ -25,6 +25,15 @@ def fixupAddress(lib, address):
def formatAddress(address):
return "0x{:X}".format(address)

def get_tools_prefix():
if "GECKO_TOOLS_PREFIX" in os.environ:
return os.environ["GECKO_TOOLS_PREFIX"]

if "TARGET_TOOLS_PREFIX" in os.environ:
return os.environ["TARGET_TOOLS_PREFIX"]

return None

###############################################################################
#
# Library class. There is an instance of this for each library in the profile.
Expand Down Expand Up @@ -63,9 +72,8 @@ def AddressesToSymbols(self, addresses_strs):
syms = self.LookupAddressesInBreakpad(addresses_strs)
if syms is not None:
return syms
if "TARGET_TOOLS_PREFIX" in os.environ:
target_tools_prefix = os.environ["TARGET_TOOLS_PREFIX"]
else:
target_tools_prefix = get_tools_prefix()
if target_tools_prefix is None:
target_tools_prefix = "arm-eabi-"
args = [target_tools_prefix + "addr2line", "-C", "-f", "-e", self.host_name]
nm_args = ["gecko/tools/profiler/nm-symbolicate.py", self.host_name]
Expand Down Expand Up @@ -405,8 +413,8 @@ def main():
print "'GECKO_OBJDIR' needs to be defined in the environment"
sys.exit(1)

if "TARGET_TOOLS_PREFIX" not in os.environ:
print "'TARGET_TOOLS_PREFIX' needs to be defined in the environment"
if get_tools_prefix() is None:
print "'{GECKO|TARGET}_TOOLS_PREFIX' needs to be defined in the environment"
sys.exit(1)

if "PRODUCT_OUT" not in os.environ:
Expand All @@ -421,7 +429,10 @@ def print_var(var):
if verbose:
print "Filename =", args.filename
print_var("GECKO_OBJDIR")
print_var("TARGET_TOOLS_PREFIX")
if "GECKO_TOOLS_PREFIX" in os.environ:
print_var("GECKO_TOOLS_PREFIX")
else:
print_var("TARGET_TOOLS_PREFIX")
print_var("PRODUCT_OUT")

# Read in the JSON file created by the profiler.
Expand Down

0 comments on commit b5ad322

Please sign in to comment.