Merge pull request #101179 from oxalica/vscode-lldb
This commit is contained in:
commit
e339437038
File diff suppressed because it is too large
Load Diff
|
@ -1,4 +1,4 @@
|
||||||
{ config, lib, callPackage, vscode-utils, nodePackages,llvmPackages_8, llvmPackages_latest }:
|
{ config, lib, callPackage, vscode-utils, nodePackages,llvmPackages_8 }:
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (vscode-utils) buildVscodeMarketplaceExtension;
|
inherit (vscode-utils) buildVscodeMarketplaceExtension;
|
||||||
|
@ -689,9 +689,7 @@ let
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
vadimcn.vscode-lldb = callPackage ./vscode-lldb {
|
vadimcn.vscode-lldb = callPackage ./vscode-lldb { };
|
||||||
lldb = llvmPackages_latest.lldb;
|
|
||||||
};
|
|
||||||
|
|
||||||
vincaslt.highlight-matching-tag = buildVscodeMarketplaceExtension {
|
vincaslt.highlight-matching-tag = buildVscodeMarketplaceExtension {
|
||||||
mktplcRef = {
|
mktplcRef = {
|
||||||
|
|
|
@ -1,24 +1,24 @@
|
||||||
{
|
{
|
||||||
"name": "vscode-lldb",
|
"name": "vscode-lldb",
|
||||||
"version": "1.5.3",
|
"version": "1.6.1",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/json5": "^0.0.30",
|
"string-argv": "^0.3.1",
|
||||||
"@types/mocha": "^7.0.1",
|
"yaml": "^1.10.0",
|
||||||
"@types/node": "^8.10.50",
|
"yauzl": "^2.10.0",
|
||||||
"@types/vscode": "^1.31.0",
|
"@types/vscode": "^1.31.0",
|
||||||
|
"@types/node": "^8.10.50",
|
||||||
|
"@types/mocha": "^7.0.1",
|
||||||
"@types/yauzl": "^2.9.0",
|
"@types/yauzl": "^2.9.0",
|
||||||
"json5": "^2.1.0",
|
"@types/json5": "^0.0.30",
|
||||||
"memory-streams": "^0.1.3",
|
"typescript": "^3.7.0",
|
||||||
"mocha": "^7.0.1",
|
"mocha": "^7.0.1",
|
||||||
"source-map-support": "^0.5.12",
|
"source-map-support": "^0.5.12",
|
||||||
"string-argv": "^0.3.1",
|
"memory-streams": "^0.1.3",
|
||||||
"ts-loader": "^6.2.1",
|
|
||||||
"typescript": "^3.7.0",
|
|
||||||
"vsce": "^1.73.0",
|
|
||||||
"vscode-debugadapter-testsupport": "^1.35.0",
|
|
||||||
"vscode-debugprotocol": "^1.35.0",
|
"vscode-debugprotocol": "^1.35.0",
|
||||||
|
"vscode-debugadapter-testsupport": "^1.35.0",
|
||||||
|
"vsce": "^1.73.0",
|
||||||
"webpack": "^4.39.1",
|
"webpack": "^4.39.1",
|
||||||
"webpack-cli": "^3.3.7",
|
"webpack-cli": "^3.3.7",
|
||||||
"yauzl": "^2.10.0"
|
"ts-loader": "^6.2.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,32 +1,22 @@
|
||||||
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||||
|
index 890abd4..157a8a1 100644
|
||||||
--- a/CMakeLists.txt
|
--- a/CMakeLists.txt
|
||||||
+++ b/CMakeLists.txt
|
+++ b/CMakeLists.txt
|
||||||
@@ -9,13 +9,6 @@ include(cmake/CopyFiles.cmake)
|
@@ -16,13 +16,6 @@ endif()
|
||||||
set(CMAKE_CXX_STANDARD 11)
|
set(VERSION "${VERSION}${VERSION_SUFFIX}")
|
||||||
set(CMAKE_INSTALL_PREFIX $ENV{HOME}/.vscode/extensions/vscode-lldb CACHE PATH "Install location")
|
message("Version ${VERSION}")
|
||||||
|
|
||||||
-set(LLDB_ROOT $ENV{LLDB_ROOT} CACHE PATH "Root of LLDB build directory")
|
-set(LLDB_PACKAGE $ENV{LLDB_PACKAGE} CACHE PATH "Zip archive containing LLDB files")
|
||||||
-if (LLDB_ROOT)
|
-if (LLDB_PACKAGE)
|
||||||
- message("Using LLDB from ${LLDB_ROOT}")
|
- message("Using LLDB_PACKAGE=${LLDB_PACKAGE}")
|
||||||
-else()
|
-else()
|
||||||
- message(FATAL_ERROR "LLDB_ROOT not set." )
|
- message(FATAL_ERROR "LLDB_PACKAGE not set." )
|
||||||
-endif()
|
-endif()
|
||||||
-
|
-
|
||||||
|
set(TEST_TIMEOUT 5000 CACHE STRING "Test timeout [ms]")
|
||||||
|
|
||||||
# General OS-specific definitions
|
# General OS-specific definitions
|
||||||
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
@@ -87,16 +80,6 @@ configure_file(package.json ${CMAKE_CURRENT_BINARY_DIR}/package.json @ONLY)
|
||||||
set(DylibPrefix lib)
|
|
||||||
@@ -64,8 +57,9 @@ set(UpdateFile ${CMAKE_COMMAND} -E copy_if_different)
|
|
||||||
|
|
||||||
# Adapter
|
|
||||||
|
|
||||||
-add_subdirectory(adapter)
|
|
||||||
-add_subdirectory(lldb)
|
|
||||||
+add_custom_target(adapter)
|
|
||||||
+add_custom_target(lldb)
|
|
||||||
+add_custom_target(codelldb)
|
|
||||||
|
|
||||||
# Extension package content
|
|
||||||
|
|
||||||
@@ -74,16 +68,6 @@ configure_file(package.json ${CMAKE_CURRENT_BINARY_DIR}/package.json @ONLY)
|
|
||||||
configure_file(webpack.config.js ${CMAKE_CURRENT_BINARY_DIR}/webpack.config.js @ONLY)
|
configure_file(webpack.config.js ${CMAKE_CURRENT_BINARY_DIR}/webpack.config.js @ONLY)
|
||||||
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/package-lock.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/package-lock.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
|
||||||
|
@ -42,4 +32,3 @@
|
||||||
-
|
-
|
||||||
# Copy it back, so we can commit the lock file.
|
# Copy it back, so we can commit the lock file.
|
||||||
file(COPY ${CMAKE_CURRENT_BINARY_DIR}/package-lock.json DESTINATION ${CMAKE_CURRENT_SOURCE_DIR})
|
file(COPY ${CMAKE_CURRENT_BINARY_DIR}/package-lock.json DESTINATION ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
|
@ -1,106 +1,101 @@
|
||||||
{ lib, stdenv, vscode-utils, fetchFromGitHub, rustPlatform, makeWrapper, jq
|
{ lib, stdenv, fetchFromGitHub, rustPlatform, makeWrapper, jq, callPackage
|
||||||
, nodePackages, cmake, nodejs, unzip, python3, lldb, breakpointHook
|
, nodePackages, cmake, nodejs, unzip, python3
|
||||||
, setDefaultLldbPath ? true
|
|
||||||
}:
|
}:
|
||||||
assert lib.versionAtLeast python3.version "3.5";
|
assert lib.versionAtLeast python3.version "3.5";
|
||||||
let
|
let
|
||||||
publisher = "vadimcn";
|
publisher = "vadimcn";
|
||||||
name = "vscode-lldb";
|
pname = "vscode-lldb";
|
||||||
version = "1.5.3";
|
version = "1.6.1";
|
||||||
|
|
||||||
dylibExt = stdenv.hostPlatform.extensions.sharedLibrary;
|
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "vadimcn";
|
owner = "vadimcn";
|
||||||
repo = "vscode-lldb";
|
repo = "vscode-lldb";
|
||||||
rev = "v${version}";
|
rev = "v${version}";
|
||||||
sha256 = "1139945j3z0fxc3nlyvd81k0ypymqsj051idrbgbibwshpi86y93";
|
sha256 = "sha256-mi+AeHg9zO0vjF0OZCufPkliInqxTvDGV350wqAwe90=";
|
||||||
fetchSubmodules = true;
|
fetchSubmodules = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
adapter = rustPlatform.buildRustPackage {
|
lldb = callPackage ./lldb.nix {};
|
||||||
pname = "${name}-adapter";
|
|
||||||
inherit version src;
|
|
||||||
|
|
||||||
cargoSha256 = "0jl4msf2jcjxddwqkx8fr0c35wg4vwvg5c19mihri1v34i09zc5r";
|
adapter = rustPlatform.buildRustPackage {
|
||||||
|
pname = "${pname}-adapter";
|
||||||
|
inherit version src;
|
||||||
|
|
||||||
# It will pollute the build environment of `buildRustPackage`.
|
# It will pollute the build environment of `buildRustPackage`.
|
||||||
cargoPatches = [ ./reset-cargo-config.patch ];
|
cargoPatches = [ ./reset-cargo-config.patch ];
|
||||||
|
|
||||||
|
cargoSha256 = "sha256-HPVbqYsst/iFrHn5wvmWtqeVHOHR7JT8lu+/xZq1lK0=";
|
||||||
|
|
||||||
nativeBuildInputs = [ makeWrapper ];
|
nativeBuildInputs = [ makeWrapper ];
|
||||||
|
|
||||||
buildAndTestSubdir = "adapter";
|
buildAndTestSubdir = "adapter";
|
||||||
|
|
||||||
# Hack: Need a nightly compiler.
|
cargoFlags = [
|
||||||
RUSTC_BOOTSTRAP = 1;
|
"--lib"
|
||||||
|
"--bin=codelldb"
|
||||||
|
"--features=weak-linkage"
|
||||||
|
];
|
||||||
|
|
||||||
# `adapter` expects a special hierarchy to resolve everything well.
|
# Tests are linked to liblldb but it is not available here.
|
||||||
postInstall = ''
|
doCheck = false;
|
||||||
mkdir -p $out/adapter
|
|
||||||
mv -t $out/adapter \
|
|
||||||
$out/bin/* \
|
|
||||||
$out/lib/* \
|
|
||||||
./adapter/*.py \
|
|
||||||
./formatters/*.py
|
|
||||||
rmdir $out/{bin,lib}
|
|
||||||
'';
|
|
||||||
|
|
||||||
postFixup = ''
|
|
||||||
wrapProgram $out/adapter/codelldb \
|
|
||||||
--prefix PATH : "${python3}/bin" \
|
|
||||||
--prefix LD_LIBRARY_PATH : "${python3}/lib"
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
build-deps = nodePackages."vscode-lldb-build-deps-../../misc/vscode-extensions/vscode-lldb/build-deps";
|
nodeDeps = nodePackages."vscode-lldb-build-deps-../../misc/vscode-extensions/vscode-lldb/build-deps";
|
||||||
|
|
||||||
vsix = stdenv.mkDerivation {
|
in stdenv.mkDerivation rec {
|
||||||
name = "${name}-${version}-vsix";
|
name = "vscode-extension-${pname}";
|
||||||
inherit src;
|
inherit src;
|
||||||
|
vscodeExtUniqueId = "${publisher}.${pname}";
|
||||||
|
installPrefix = "share/vscode/extensions/${vscodeExtUniqueId}";
|
||||||
|
|
||||||
|
nativeBuildInputs = [ cmake nodejs unzip makeWrapper ];
|
||||||
|
|
||||||
# Only build the extension. We handle `adapter` and `lldb` with nix.
|
|
||||||
patches = [ ./cmake-build-extension-only.patch ];
|
patches = [ ./cmake-build-extension-only.patch ];
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake nodejs unzip breakpointHook ];
|
|
||||||
|
|
||||||
postConfigure = ''
|
postConfigure = ''
|
||||||
cp -r ${build-deps}/lib/node_modules/vscode-lldb/{node_modules,package-lock.json} .
|
cp -r ${nodeDeps}/lib/node_modules/vscode-lldb/{node_modules,package-lock.json} .
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
cmakeFlags = [
|
||||||
|
# Do not append timestamp to version.
|
||||||
|
"-DVERSION_SUFFIX="
|
||||||
|
];
|
||||||
makeFlags = [ "vsix_bootstrap" ];
|
makeFlags = [ "vsix_bootstrap" ];
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
|
ext=$out/$installPrefix
|
||||||
|
runHook preInstall
|
||||||
|
|
||||||
unzip ./codelldb-bootstrap.vsix 'extension/*' -d ./vsix-extracted
|
unzip ./codelldb-bootstrap.vsix 'extension/*' -d ./vsix-extracted
|
||||||
mv vsix-extracted/extension $out
|
|
||||||
|
|
||||||
ln -s ${adapter}/adapter $out
|
mkdir -p $ext/{adapter,formatters}
|
||||||
# Mark that adapter and lldb are installed.
|
mv -t $ext vsix-extracted/extension/*
|
||||||
touch $out/platform.ok
|
cp -t $ext/adapter ${adapter}/{bin,lib}/* ../adapter/*.py
|
||||||
|
cp -t $ext/formatters ../formatters/*.py
|
||||||
|
ln -s ${lldb} $ext/lldb
|
||||||
|
# Mark that all components are installed.
|
||||||
|
touch $ext/platform.ok
|
||||||
|
|
||||||
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
|
|
||||||
dontStrip = true;
|
# `adapter` will find python binary and libraries at runtime.
|
||||||
dontPatchELF = true;
|
fixupPhase = ''
|
||||||
|
wrapProgram $out/$installPrefix/adapter/codelldb \
|
||||||
|
--prefix PATH : "${python3}/bin" \
|
||||||
|
--prefix LD_LIBRARY_PATH : "${python3}/lib"
|
||||||
|
'';
|
||||||
|
|
||||||
|
passthru = {
|
||||||
|
inherit lldb adapter;
|
||||||
};
|
};
|
||||||
|
|
||||||
in vscode-utils.buildVscodeExtension {
|
|
||||||
inherit name;
|
|
||||||
src = vsix;
|
|
||||||
|
|
||||||
nativeBuildInputs = lib.optional setDefaultLldbPath jq;
|
|
||||||
postUnpack = lib.optionalString setDefaultLldbPath ''
|
|
||||||
jq '.contributes.configuration.properties."lldb.library".default = $s' \
|
|
||||||
--arg s "${lldb}/lib/liblldb.so" \
|
|
||||||
$sourceRoot/package.json >$sourceRoot/package.json.new
|
|
||||||
mv $sourceRoot/package.json.new $sourceRoot/package.json
|
|
||||||
'';
|
|
||||||
|
|
||||||
vscodeExtUniqueId = "${publisher}.${name}";
|
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
description = "A native debugger extension for VSCode based on LLDB";
|
description = "A native debugger extension for VSCode based on LLDB";
|
||||||
homepage = "https://github.com/vadimcn/vscode-lldb";
|
homepage = "https://github.com/vadimcn/vscode-lldb";
|
||||||
license = with licenses; [ mit ];
|
license = with licenses; [ mit ];
|
||||||
maintainers = with maintainers; [ oxalica ];
|
maintainers = with maintainers; [ oxalica ];
|
||||||
platforms = platforms.all;
|
platforms = platforms.all;
|
||||||
|
broken = stdenv.isDarwin; # Build failed on x86_64-darwin currently.
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
# Patched lldb for Rust language support.
|
||||||
|
{ lldb_11, fetchFromGitHub }:
|
||||||
|
let
|
||||||
|
llvmSrc = fetchFromGitHub {
|
||||||
|
owner = "vadimcn";
|
||||||
|
repo = "llvm-project";
|
||||||
|
rev = "dd7efd9ea2d38e3227bc2e83a99772aceeb44242";
|
||||||
|
sha256 = "sha256-XY8J8Ie1cWb6ok72Gju/KUxZ4fIFQVitYVnuCezGRKQ=";
|
||||||
|
};
|
||||||
|
in lldb_11.overrideAttrs (oldAttrs: {
|
||||||
|
src = "${llvmSrc}/lldb";
|
||||||
|
|
||||||
|
passthru = (oldAttrs.passthru or {}) // {
|
||||||
|
inherit llvmSrc;
|
||||||
|
};
|
||||||
|
|
||||||
|
doInstallCheck = true;
|
||||||
|
postInstallCheck = (oldAttrs.postInstallCheck or "") + ''
|
||||||
|
versionOutput="$($out/bin/lldb --version)"
|
||||||
|
echo "'lldb --version' returns: $versionOutput"
|
||||||
|
echo "$versionOutput" | grep -q 'rust-enabled'
|
||||||
|
'';
|
||||||
|
})
|
|
@ -0,0 +1,35 @@
|
||||||
|
#!/usr/bin/env nix-shell
|
||||||
|
#!nix-shell -i bash -p jq nix-prefetch
|
||||||
|
set -eo pipefail
|
||||||
|
cd "$(dirname "${BASH_SOURCE[0]}")"
|
||||||
|
if [[ $# -ne 1 ]]; then
|
||||||
|
echo "Usage: ./update.sh <version>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "
|
||||||
|
FIXME: This script doesn't update patched lldb. Please manually check branches
|
||||||
|
of https://github.com/vadimcn/llvm-project and update lldb with correct version of LLVM.
|
||||||
|
"
|
||||||
|
|
||||||
|
nixpkgs=../../../..
|
||||||
|
nixFile=./default.nix
|
||||||
|
owner=vadimcn
|
||||||
|
repo=vscode-lldb
|
||||||
|
version="$1"
|
||||||
|
|
||||||
|
sed -E 's/\bversion = ".*?"/version = "'$version'"/' --in-place "$nixFile"
|
||||||
|
srcHash=$(nix-prefetch fetchFromGitHub --owner vadimcn --repo vscode-lldb --rev "v$version" --fetchSubmodules)
|
||||||
|
sed -E 's/\bsha256 = ".*?"/sha256 = "'$srcHash'"/' --in-place "$nixFile"
|
||||||
|
cargoHash=$(nix-prefetch "{ sha256 }: (import $nixpkgs {}).vscode-extensions.vadimcn.vscode-lldb.adapter.cargoDeps.overrideAttrs (_: { outputHash = sha256; })")
|
||||||
|
sed -E 's#\bcargoSha256 = ".*?"#cargoSha256 = "'$cargoHash'"#' --in-place "$nixFile"
|
||||||
|
|
||||||
|
src="$(nix-build $nixpkgs -A vscode-extensions.vadimcn.vscode-lldb.src --no-out-link)"
|
||||||
|
jq '{ name, version: $version, dependencies: (.dependencies + .devDependencies) }' \
|
||||||
|
--arg version "$version" \
|
||||||
|
"$src/package.json" \
|
||||||
|
> build-deps/package.json
|
||||||
|
|
||||||
|
# Regenerate nodePackages.
|
||||||
|
cd "$nixpkgs/pkgs/development/node-packages"
|
||||||
|
exec ./generate.sh
|
Loading…
Reference in New Issue