[tools] grokdump: Fix objdump detection for Python3

Follow-up to 032dfb827a.

No-Try: true
Change-Id: Ia12343a7ce9e1b865da4fbf562bdd9169892932c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3721816
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81332}
This commit is contained in:
Jakob Kummerow 2022-06-23 16:14:38 +02:00 committed by V8 LUCI CQ
parent da12b9ac0b
commit 5b12e62b64

View File

@ -724,29 +724,25 @@ class MinidumpReader(object):
disasm.OBJDUMP_BIN = objdump_bin disasm.OBJDUMP_BIN = objdump_bin
def _FindThirdPartyObjdump(self): def _FindThirdPartyObjdump(self):
# Try to find the platform specific objdump # Try to find the platform specific objdump.
third_party_dir = os.path.join(
os.path.dirname(os.path.dirname(__file__)), 'third_party')
objdumps = []
for root, dirs, files in os.walk(third_party_dir):
for file in files:
if file.endswith("objdump"):
objdumps.append(os.path.join(root, file))
if self.arch == MD_CPU_ARCHITECTURE_ARM: if self.arch == MD_CPU_ARCHITECTURE_ARM:
platform_filter = 'arm-linux' platform_filter = 'arm-linux'
elif self.arch == MD_CPU_ARCHITECTURE_ARM64: elif self.arch == MD_CPU_ARCHITECTURE_ARM64:
platform_filter = 'aarch64' platform_filter = 'aarch64'
else: else:
# use default otherwise # Use default otherwise.
return None return None
print(("# Looking for platform specific (%s) objdump in " print(("# Looking for platform specific (%s) objdump in "
"third_party directory.") % platform_filter) "third_party directory.") % platform_filter)
objdumps = list(filter(lambda file: platform_filter in file >= 0, objdumps)) third_party_dir = os.path.join(
if len(objdumps) == 0: os.path.dirname(os.path.dirname(__file__)), 'third_party')
print("# Could not find platform specific objdump in third_party.") for root, dirs, files in os.walk(third_party_dir):
print("# Make sure you installed the correct SDK.") for file in files:
return None if file.endswith("objdump") and platform_filter in file:
return objdumps[0] return os.path.join(root, file)
print("# Could not find platform specific objdump in third_party.")
print("# Make sure you installed the correct SDK.")
return None
def ContextDescriptor(self): def ContextDescriptor(self):
if self.arch == MD_CPU_ARCHITECTURE_X86: if self.arch == MD_CPU_ARCHITECTURE_X86: