Skip to content

Commit 2ad5c19

Browse files
author
SkyLined
committed
fix JIT debugger info + installer
1 parent ac167f6 commit 2ad5c19

3 files changed

+68
-42
lines changed

fOutputCurrentJITDebuggerSettings.py

+60-35
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,85 @@
11

2+
import mRegistry, mWindowsAPI;
23
from mNotProvided import fbIsProvided;
34

45
from foConsoleLoader import foConsoleLoader;
56
from fsCreateBugIdCommandLine import fsCreateBugIdCommandLine;
67
from fxGetCurrentJITDebuggerCommandLine import fxGetCurrentJITDebuggerCommandLine;
78
from mColorsAndChars import *;
9+
import mJITDebuggerRegistry;
810
oConsole = foConsoleLoader();
911

1012
def fOutputCurrentJITDebuggerSettings():
13+
sOSISA = mWindowsAPI.oSystemInfo.sOSISA;
14+
dsCommandLineKeyPath_by_sTargetBinaryISA = mJITDebuggerRegistry.ddsCommandLineKeyPath_by_sTargetBinaryISA_by_sOSISA[sOSISA];
1115
oConsole.fLock();
1216
try:
13-
oConsole.fOutput("┌───[", COLOR_INFO, " Current JIT Debugger ", COLOR_NORMAL, "]", sPadding = "─");
14-
xCurrentJITDebuggerCommandLine = fxGetCurrentJITDebuggerCommandLine();
15-
if not fbIsProvided(xCurrentJITDebuggerCommandLine):
16-
oConsole.fOutput(
17-
"│ ",
18-
COLOR_INFO, CHAR_INFO,
19-
COLOR_NORMAL, "JIT debugger: ",
20-
COLOR_INFO, "None",
21-
COLOR_NORMAL, ".",
17+
oConsole.fOutput(
18+
"┌───[ ",
19+
COLOR_INFO, "Current JIT Debugger", "s" if len(dsCommandLineKeyPath_by_sTargetBinaryISA) > 1 else "",
20+
COLOR_NORMAL, " ]",
21+
sPadding = "─"
22+
);
23+
dsCommandLineKeyPath_by_sTargetBinaryISA = mJITDebuggerRegistry.ddsCommandLineKeyPath_by_sTargetBinaryISA_by_sOSISA[sOSISA];
24+
for (sTargetBinaryISA, sCommandLineKeyPath) in dsCommandLineKeyPath_by_sTargetBinaryISA.items():
25+
# Get the current JIT debugger command line for the target binary ISA if one is installed.
26+
oRegistryHiveKey = mRegistry.cRegistryHiveKey(
27+
sHiveName = mJITDebuggerRegistry.sCommandLineHiveName,
28+
sKeyPath = sCommandLineKeyPath,
2229
);
23-
elif xCurrentJITDebuggerCommandLine is None:
24-
oConsole.fOutput(
25-
"│ ",
26-
COLOR_ERROR, CHAR_ERROR,
27-
COLOR_NORMAL, " JIT debugger: ",
28-
COLOR_INFO, "Unknown",
29-
COLOR_NORMAL, " (unable to read registry).",
30-
);
31-
else:
32-
sBugIdJITDebuggerCommandLineStartsWith = fsCreateBugIdCommandLine();
33-
if xCurrentJITDebuggerCommandLine.startswith(sBugIdJITDebuggerCommandLineStartsWith):
30+
o0RegistryValue = oRegistryHiveKey.fo0GetValueForName(sValueName = "Debugger");
31+
if o0RegistryValue is None:
3432
oConsole.fOutput(
3533
"│ ",
36-
COLOR_OK, CHAR_OK,
34+
COLOR_WARNING, CHAR_WARNING,
35+
COLOR_NORMAL, " ",
36+
COLOR_INFO, sTargetBinaryISA,
3737
COLOR_NORMAL, " JIT debugger: ",
38-
COLOR_INFO, "BugId",
38+
COLOR_INFO, "None",
3939
COLOR_NORMAL, ".",
4040
);
41-
sArguments = xCurrentJITDebuggerCommandLine[len(sBugIdJITDebuggerCommandLineStartsWith) + 1:];
42-
oConsole.fOutput(
43-
"│ Arguments: ",
44-
COLOR_INFO, sArguments,
45-
);
46-
else:
41+
elif o0RegistryValue.sTypeName != "REG_SZ":
4742
oConsole.fOutput(
4843
"│ ",
49-
COLOR_WARNING, CHAR_WARNING,
44+
COLOR_ERROR, CHAR_ERROR,
45+
COLOR_NORMAL, " ",
46+
COLOR_INFO, sTargetBinaryISA,
5047
COLOR_NORMAL, " JIT debugger: ",
51-
COLOR_INFO, "Other",
52-
COLOR_NORMAL, ".",
53-
);
54-
oConsole.fOutput(
55-
"│ Command line: ",
56-
COLOR_INFO, xCurrentJITDebuggerCommandLine,
48+
COLOR_INFO, "Unknown",
49+
COLOR_NORMAL, " (registry value not a string).",
5750
);
51+
else:
52+
sCurrentJITDebuggerCommandLine = o0RegistryValue.xValue;
53+
sBugIdJITDebuggerCommandLineStartsWith = fsCreateBugIdCommandLine();
54+
if sCurrentJITDebuggerCommandLine.startswith(sBugIdJITDebuggerCommandLineStartsWith):
55+
oConsole.fOutput(
56+
"│ ",
57+
COLOR_OK, CHAR_OK,
58+
COLOR_NORMAL, " ",
59+
COLOR_INFO, sTargetBinaryISA,
60+
COLOR_NORMAL, " JIT debugger: ",
61+
COLOR_INFO, "BugId",
62+
COLOR_NORMAL, ".",
63+
);
64+
sArguments = sCurrentJITDebuggerCommandLine[len(sBugIdJITDebuggerCommandLineStartsWith) + 1:];
65+
oConsole.fOutput(
66+
"│ Arguments: ",
67+
COLOR_INFO, sArguments,
68+
);
69+
else:
70+
oConsole.fOutput(
71+
"│ ",
72+
COLOR_INFO, CHAR_INFO,
73+
COLOR_NORMAL, " ",
74+
COLOR_INFO, sTargetBinaryISA,
75+
COLOR_NORMAL, " JIT debugger: ",
76+
COLOR_INFO, "Other",
77+
COLOR_NORMAL, ".",
78+
);
79+
oConsole.fOutput(
80+
"│ Command line: ",
81+
COLOR_INFO, sCurrentJITDebuggerCommandLine,
82+
);
5883
oConsole.fOutput("└", sPadding = "─");
5984
finally:
6085
oConsole.fUnlock();

fbInstallAsJITDebugger.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def fbInstallAsJITDebugger(asAdditionalArguments):
3939
asFilteredAdditionalArguments.append(sArgument);
4040

4141
sOSISA = mWindowsAPI.oSystemInfo.sOSISA;
42-
dsCommandLineKeyPath_by_sTargetBinaryISA = mJITDebuggerRegistry.ddsCommandLineKeyPath_by_sTargetBinaryISA_by_sOSISA[sOSIA];
42+
dsCommandLineKeyPath_by_sTargetBinaryISA = mJITDebuggerRegistry.ddsCommandLineKeyPath_by_sTargetBinaryISA_by_sOSISA[sOSISA];
4343
for (sTargetBinaryISA, sCommandLineKeyPath) in dsCommandLineKeyPath_by_sTargetBinaryISA.items():
4444
sBugIdCommandLine = fsCreateBugIdCommandLine(
4545
(
@@ -77,11 +77,11 @@ def fbInstallAsJITDebugger(asAdditionalArguments):
7777
"Debugger": sBugIdCommandLine
7878
}.items():
7979
# Check if the value is already set correctly:
80-
o0RegistryValue = oRegistryHiveKey.fo0GetValueForName(sValueName = "Debugger");
80+
o0RegistryValue = oRegistryHiveKey.fo0GetValueForName(sValueName = sName);
8181

8282
if o0RegistryValue and o0RegistryValue.sTypeName == "REG_SZ" and o0RegistryValue.xValue == sValue:
8383
continue; # Yes; no need to modify it.
84-
84+
oConsole.fOutput("Modifying ", sName, "=REGSZ:", repr(sValue), " (was ", o0RegistryValue.sTypeName, ":", repr(o0RegistryValue.xValue));
8585
try:
8686
oRegistryHiveKey.foSetValueForName(sValueName = sName, sTypeName = "SZ", xValue = sValue);
8787
except WindowsError as oException:
@@ -96,6 +96,6 @@ def fbInstallAsJITDebugger(asAdditionalArguments):
9696
bSettingsForTargetBinaryISAChanged = True;
9797
oConsole.fOutput(
9898
COLOR_OK, CHAR_OK,
99-
COLOR_NORMAL, " BugId is ", "already" if bSettingsForTargetBinaryISAChanged else "now", " installed as the default JIT debugger for 64-bit binaries.");
99+
COLOR_NORMAL, " BugId ", "is now" if bSettingsForTargetBinaryISAChanged else "was already", " installed as the default JIT debugger for 64-bit binaries.");
100100
oConsole.fOutput(" Command line: ", COLOR_INFO, sBugIdCommandLine);
101101
return True;

fxGetCurrentJITDebuggerCommandLine.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@
66
import mJITDebuggerRegistry;
77
oConsole = foConsoleLoader();
88

9-
def fxGetCurrentJITDebuggerCommandLine():
9+
def fxGetCurrentJITDebuggerCommandLine(sOSISA, sTargetBinaryISA):
10+
dsCommandLineKeyPath = mJITDebuggerRegistry.ddsCommandLineKeyPath_by_sTargetBinaryISA_by_sOSISA[osISA][sTargetBinaryISA];
1011
# Returns a string with the current JIT debugger command line
1112
# or zNotProvided if no JIT debugger is installed.
1213
# or None if the registry could not be read or the value makes no sense.
1314
oRegistryHiveKey = cRegistryHiveKey(
14-
sHiveName = mJITDebuggerRegistry.sCommandLineHiveName,
15-
sKeyPath = mJITDebuggerRegistry.sCommandLineKeyPath,
15+
sHiveName = dsCommandLineKeyPath.sCommandLineHiveName,
16+
sKeyPath = dsCommandLineKeyPath.sCommandLineKeyPath,
1617
);
1718
o0RegistryValue = oRegistryHiveKey.fo0GetValueForName(sValueName = "Debugger");
1819
if o0RegistryValue is None:

0 commit comments

Comments
 (0)