Skip to content

Commit 6735b64

Browse files
authored
Always report Dyld error message with crash stack info (#9383)
1 parent b16d0f9 commit 6735b64

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

Extension/.DS_Store

10 KB
Binary file not shown.

Extension/src/LanguageServer/extension.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -905,19 +905,32 @@ function handleMacCrashFileRead(err: NodeJS.ErrnoException | undefined | null, d
905905
binaryVersion = binaryVersionMatches && binaryVersionMatches.length > 1 ? binaryVersionMatches[1] : "";
906906
}
907907

908+
// Extract any message indicating missing dynamically loaded symbols.
909+
let dynamicLoadError: string = "";
910+
const dynamicLoadErrorStart: string = "Dyld Error Message:";
911+
const startDynamicLoadError: number = data.indexOf(dynamicLoadErrorStart);
912+
if (startDynamicLoadError >= 0) {
913+
// Scan until the next blank line.
914+
const dynamicLoadErrorEnd: string = "\n\n";
915+
const endDynamicLoadError: number = data.indexOf(dynamicLoadErrorEnd, startDynamicLoadError);
916+
if (endDynamicLoadError >= 0) {
917+
dynamicLoadError = data.substring(startDynamicLoadError, endDynamicLoadError) + "\n\n";
918+
}
919+
}
920+
908921
// Extract the crashing thread's call stack.
909922
const crashStart: string = " Crashed:";
910923
let startCrash: number = data.indexOf(crashStart);
911924
if (startCrash < 0) {
912-
return logMacCrashTelemetry("No crash start");
925+
return logMacCrashTelemetry(dynamicLoadError + "No crash start");
913926
}
914927
startCrash += crashStart.length + 1; // Skip past crashStart.
915928
let endCrash: number = data.indexOf("Thread ", startCrash);
916929
if (endCrash < 0) {
917930
endCrash = data.length - 1; // Not expected, but just in case.
918931
}
919932
if (endCrash <= startCrash) {
920-
return logMacCrashTelemetry("No crash end");
933+
return logMacCrashTelemetry(dynamicLoadError + "No crash end");
921934
}
922935
data = data.substring(startCrash, endCrash);
923936

@@ -957,6 +970,9 @@ function handleMacCrashFileRead(err: NodeJS.ErrnoException | undefined | null, d
957970
});
958971
data = data.trimRight();
959972

973+
// Prepend the dynamic load error.
974+
data = dynamicLoadError + data;
975+
960976
if (data.length > 8192) { // The API has an 8k limit.
961977
data = data.substring(0, 8189) + "...";
962978
}

0 commit comments

Comments
 (0)