Skip to content

Commit eabe500

Browse files
authored
Process sigCode and sigAddr for crashes. (#13848)
* Process sigCode and sigAddr for crashes. * Change to handle early crash file creation.
1 parent c6c2208 commit eabe500

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Extension/src/LanguageServer/extension.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,7 +1012,7 @@ export function watchForCrashes(crashDirectory: string): void {
10121012
// vscode.workspace.createFileSystemWatcher only works in workspace folders.
10131013
try {
10141014
fs.watch(crashDirectory, (event, filename) => {
1015-
if (event !== "rename") {
1015+
if (event !== "change") {
10161016
return;
10171017
}
10181018
if (!filename || filename === prevCppCrashFile) {
@@ -1177,7 +1177,7 @@ async function handleCrashFileRead(crashDirectory: string, crashFile: string, cr
11771177
}
11781178

11791179
const lines: string[] = data.split("\n");
1180-
let addressData: string = ".\n";
1180+
let addressData: string;
11811181
const isCppToolsSrv: boolean = crashFile.startsWith("cpptools-srv");
11821182
const telemetryHeader: string = (isCppToolsSrv ? "cpptools-srv.txt" : crashFile) + "\n";
11831183
const filtPath: string | null = which.sync("c++filt", { nothrow: true });
@@ -1207,17 +1207,20 @@ async function handleCrashFileRead(crashDirectory: string, crashFile: string, cr
12071207
crashStackStartLine = ++crashLogLine;
12081208
}
12091209
if (lines[crashStackStartLine].startsWith("SIG")) {
1210-
signalType = lines[crashStackStartLine] + "\n";
1210+
signalType = `${lines[crashStackStartLine]}\n`;
1211+
addressData = `${lines[crashStackStartLine + 1]}:${lines[crashStackStartLine + 2]}\n`; // signalCode:signalAddr
1212+
crashStackStartLine += 3;
12111213
} else {
12121214
// The signal type may fail to be written.
12131215
// Intentionally different from SIGUNKNOWN from cpptools,
12141216
// and not SIG-? to avoid matching the regex in containsFilteredTelemetryData.
12151217
signalType = "SIGMISSING\n";
1218+
addressData = ".\n";
12161219
}
12171220
data = telemetryHeader + signalType;
12181221
let crashCallStack: string = "";
12191222
let validFrameFound: boolean = false;
1220-
for (let lineNum: number = crashStackStartLine + 1; lineNum < lines.length - 3; ++lineNum) { // skip last lines
1223+
for (let lineNum: number = crashStackStartLine; lineNum < lines.length - 3; ++lineNum) { // skip last lines
12211224
const line: string = lines[lineNum];
12221225
const startPos: number = line.indexOf(startStr);
12231226
let pendingCallStack: string = "";

0 commit comments

Comments
 (0)