Skip to content

Commit

Permalink
Update parsedump.py
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewc12 committed Oct 19, 2023
1 parent 42c8c5b commit 4151f42
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions contrib/windows/parsedump/parsedump.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,32 @@

import re
import subprocess
import pathlib
import os

pf64 = pathlib.WindowsPath(os.environ["ProgramFiles"])
pf86 = pathlib.WindowsPath(os.environ["ProgramFiles(x86)"])


def find_first_existing_file(file_paths):
for file_path in file_paths:
if os.path.exists(file_path):
if file_path.exists():
return file_path
return None # Return None if no file is found


# List of file paths to check
cdb_file_paths_to_check = [
"%ProgramFiles%\\Windows Kits\\10\\Debuggers\\x64\\cdb.exe",
"%ProgramFiles(x86)%\\Windows Kits\\10\\Debuggers\\x64\\cdb.exe",
"%ProgramFiles%\\Windows Kits\\10\\Debuggers\\x86\\cdb.exe",
"%ProgramFiles(x86)%\\Windows Kits\\10\\Debuggers\\x86\\cdb.exe"
pf64 / "Windows Kits" / "10" / "Debuggers" / "x64" / "cdb.exe",
pf86 / "Windows Kits" / "10" / "Debuggers" / "x64" / "cdb.exe",
pf64 / "Windows Kits" / "10" / "Debuggers" / "x86" / "cdb.exe",
pf86 / "Windows Kits" / "10" / "Debuggers" / "x86" / "cdb.exe"
]

cdbstr = find_first_existing_file(cdb_file_paths_to_check)
cdb = find_first_existing_file(cdb_file_paths_to_check)

if first_existing_file:
print(cdbstr)
print(cdb)
else:
print("cdb not found.")
exit()
Expand All @@ -37,7 +41,7 @@ def find_first_existing_file(file_paths):

def run(arg):
result = subprocess.run(
[cdbstr, "-z", dumpfilestr, "-c", arg, "-y", symbolstr],
[str(cdb), "-z", dumpfilestr, "-c", arg, "-y", symbolstr],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)
Expand Down

0 comments on commit 4151f42

Please sign in to comment.