Skip to content

Commit

Permalink
Update for libexecinfo crash handler change. (#12158)
Browse files Browse the repository at this point in the history
* Update for libexecinfo crash handler change.
* Update ThirdPartyNotices.txt
  • Loading branch information
sean-mcmanus authored Apr 8, 2024
1 parent d2bd18a commit 92a0494
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 11 deletions.
37 changes: 35 additions & 2 deletions Extension/ThirdPartyNotices.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1793,7 +1793,7 @@ THE SOFTWARE.

---------------------------------------------------------

follow-redirects 1.15.5 - MIT
follow-redirects 1.15.6 - MIT
https://github.com/follow-redirects/follow-redirects

Copyright 2014-present Olivier Lalonde <olalonde@gmail.com> , James Talmage <james@talmage.io> , Ruben Verborgh
Expand Down Expand Up @@ -3003,9 +3003,10 @@ The notices below are from non-npm sources.
- ANTLR (http://www.antlr2.org/)
- C++11 Sublime Text Snippets (https://github.com/Rapptz/cpp-sublime-snippet)
- Clang (https://clang.llvm.org/)
- gcc-9/libgcc (https://packages.ubuntu.com/focal/gcc-9-base)
- gcc-11/libgcc (https://packages.ubuntu.com/jammy/gcc-11-base)
- Guidelines Support Library (https://github.com/Microsoft/GSL)
- libc++ (https://libcxx.llvm.org/index.html)
- libexecinfo (https://github.com/ronchaine/libexecinfo)
- libuv (https://github.com/libuv/libuv)
- LLDB (https://lldb.llvm.org/)
- LLVM (http://llvm.org/)
Expand Down Expand Up @@ -3850,6 +3851,38 @@ obstacle to adoption, that text has been removed.
=========================================
END OF musl NOTICES AND INFORMATION

%% libexecinfo NOTICES AND INFORMATION BEGIN HERE
=========================================
libexecinfo is licensed for use as follows:

====
Copyright (c) 2003 Maxim Sobolev <sobomax@FreeBSD.org>
All rights reserved.
*
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
*
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.

=========================================
END OF libexecinfo NOTICES AND INFORMATION

%% libuv NOTICES AND INFORMATION BEGIN HERE
=========================================
libuv is licensed for use as follows:
Expand Down
4 changes: 2 additions & 2 deletions Extension/src/LanguageServer/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1489,8 +1489,8 @@ export class DefaultClient implements Client {
}
const serverName: string = this.getName(this.rootFolder);
const serverOptions: ServerOptions = {
run: { command: serverModule, options: { detached: false } },
debug: { command: serverModule, args: [serverName], options: { detached: true } }
run: { command: serverModule, options: { detached: false, cwd: util.getExtensionFilePath("bin") } },
debug: { command: serverModule, args: [serverName], options: { detached: true, cwd: util.getExtensionFilePath("bin") } }
};

// The IntelliSense process should automatically detect when AutoPCH is
Expand Down
14 changes: 7 additions & 7 deletions Extension/src/LanguageServer/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -959,7 +959,7 @@ function reportMacCrashes(): void {
}

export function watchForCrashes(crashDirectory: string): void {
if (process.platform !== "win32") {
if (process.platform !== "win32" && (process.platform === "darwin" || os.arch() === "x64")) {
prevCrashFile = "";
fs.stat(crashDirectory, (err) => {
const crashObject: Record<string, string> = {};
Expand Down Expand Up @@ -1124,9 +1124,9 @@ async function handleCrashFileRead(crashDirectory: string, crashFile: string, er
data = crashFile + "\n";
const filtPath: string | null = which.sync("c++filt", { nothrow: true });
const isMac: boolean = process.platform === "darwin";
const startStr: string = isMac ? " _" : "(";
const offsetStr: string = isMac ? " + " : "+0x";
const endOffsetStr: string = isMac ? " " : ")";
const startStr: string = isMac ? " _" : "<";
const offsetStr: string = isMac ? " + " : "+";
const endOffsetStr: string = isMac ? " " : " <";
const dotStr: string = "…";
data += lines[0]; // signal type
for (let lineNum: number = 2; lineNum < lines.length - 3; ++lineNum) { // skip first/last lines
Expand All @@ -1136,7 +1136,7 @@ async function handleCrashFileRead(crashDirectory: string, crashFile: string, er
}
const line: string = lines[lineNum];
const startPos: number = line.indexOf(startStr);
if (startPos === -1 || line[startPos + 1] === "+") {
if (startPos === -1 || line[startPos + (isMac ? 1 : 4)] === "+") {
data += dotStr;
const startAddressPos: number = line.indexOf("0x");
const endAddressPos: number = line.indexOf(endOffsetStr, startAddressPos + 2);
Expand Down Expand Up @@ -1181,9 +1181,9 @@ async function handleCrashFileRead(crashDirectory: string, crashFile: string, er
}
addressData += `${line.substring(startAddressPos, startPos)}`;
} else {
const endPos: number = line.indexOf(")", offsetPos2);
const endPos: number = line.indexOf(">", offsetPos2);
if (endPos === -1) {
data += "<Missing )>";
data += "<Missing > >";
continue; // unexpected
}
data += line.substring(offsetPos2, endPos);
Expand Down
2 changes: 2 additions & 0 deletions Extension/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ async function makeBinariesExecutable(): Promise<void> {
];
oldMacBinaries.forEach(binary => promises.push(util.allowExecution(util.getExtensionFilePath(binary))));
}
} else if (os.arch() === "x64") {
promises.push(util.allowExecution(util.getExtensionFilePath("./bin/libc.so")));
}
}
await Promise.all(promises);
Expand Down

0 comments on commit 92a0494

Please sign in to comment.