From 18d16cf2ad4773c4adb34ee50f617c05a9ff616e Mon Sep 17 00:00:00 2001 From: Andrew Innes Date: Thu, 19 Oct 2023 17:44:51 +0800 Subject: [PATCH] Search for debugger Add more locations the debugger might be in Signed-off-by: Andrew Innes --- contrib/windows/parsedump/parsedump.py | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/contrib/windows/parsedump/parsedump.py b/contrib/windows/parsedump/parsedump.py index 3f9888d03678..5c3fb20e88d4 100644 --- a/contrib/windows/parsedump/parsedump.py +++ b/contrib/windows/parsedump/parsedump.py @@ -5,8 +5,32 @@ import re import subprocess +import os + + +def find_first_existing_file(file_paths): + for file_path in file_paths: + if os.path.exists(file_path): + return file_path + return None # Return None if no file is found + + +# List of file paths to check +cdb_file_paths_to_check = [ + "C:\\Program Files\\Windows Kits\\10\\Debuggers\\x64\\cdb.exe", + "C:\\Program Files (x86)\\Windows Kits\\10\\Debuggers\\x64\\cdb.exe", + "C:\\Program Files\\Windows Kits\\10\\Debuggers\\x86\\cdb.exe", + "C:\\Program Files (x86)\\Windows Kits\\10\\Debuggers\\x86\\cdb.exe" +] + +cdbstr = find_first_existing_file(cdb_file_paths_to_check) + +if first_existing_file: + print(cdbstr) +else: + print("cdb not found.") + exit() -cdbstr = "C:\\Program Files\\Windows Kits\\10\\Debuggers\\x64\\cdb.exe" dumpfilestr = "C:\\Windows\\MEMORY.DMP" symbolstr = "srv*;C:\\Program Files\\OpenZFS On Windows\\symbols\\;"