Skip to content
This repository has been archived by the owner on Nov 15, 2024. It is now read-only.

Commit

Permalink
dev tools update
Browse files Browse the repository at this point in the history
  • Loading branch information
Antares0982 committed Jun 5, 2024
1 parent fbc0878 commit 48044e1
Show file tree
Hide file tree
Showing 10 changed files with 101 additions and 4 deletions.
1 change: 1 addition & 0 deletions dev_tools/.nix-shell-exclude
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
mkdir -p build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Debug
cmake --build . --config Debug
16 changes: 16 additions & 0 deletions dev_tools/.vscode/nix/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"compilerPath": "/nix/store/9bv7dcvmfcjnmg5mnqwqlq2wxfn8d7yi-gcc-wrapper-13.2.0/bin/gcc",
"cStandard": "c17",
"cppStandard": "gnu++17",
"intelliSenseMode": "linux-gcc-x64"
}
],
"version": 4
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,42 @@
}
],
"preLaunchTask": "CMake: build"
},
{
"name": "(gdb) 启动pytest",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/.extra-stub-path/python",
"args": [
"${workspaceFolder}/.extra-stub-path/pytest",
"-s",
"-rxX",
"../python-test"
],
"stopAtEntry": false,
"cwd": "${workspaceFolder}/build",
"environment": [{
"name": "NIX_DEBUG_INFO_DIRS",
"value": "/home/antares/Documents/GitHub/cpython-debug/Python-3.12.3/"
},{
"name":"LD_PRELOAD",
"value":"/nix/store/xvzz97yk73hw03v5dhhz3j47ggwf1yq1-gcc-13.2.0-lib/lib/libasan.so"
}],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "为 gdb 启用整齐打印",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "将反汇编风格设置为 Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
],
"preLaunchTask": "pre-pytest"
}
]
}
5 changes: 5 additions & 0 deletions dev_tools/.vscode/nix/pre-pytest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.vscode/build.sh
mkdir -p build
cd build
rm ../python-test/pyyjson.so
cp ./pyyjson.so ../python-test/
11 changes: 11 additions & 0 deletions dev_tools/.vscode/nix/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"terminal.integrated.defaultProfile.linux": "nix-shell",
"files.associations": {
"\"*.glsl\"": "\"C\"",
"*.glsl": "glsl",
"*.rgen": "glsl",
"*.rahit": "glsl",
"pyutils.h": "c",
"stdbool.h": "c"
}
}
17 changes: 17 additions & 0 deletions dev_tools/.vscode/tasks.json → dev_tools/.vscode/nix/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,23 @@
"isDefault": true
},
"detail": "调用nix-shell执行build.sh脚本"
},
{
"label": "pre-pytest",
"type": "shell",
"command": "${workspaceFolder}/.vscode/pre-pytest.sh",
"options": {
"shell": {
"executable": "nix-shell",
"args": ["--run"]
}
},
"problemMatcher": ["$gcc"], // 可以根据实际情况选择合适的问题匹配器
"group": {
"kind": "build",
"isDefault": true
},
"detail": "调用nix-shell执行build.sh脚本"
}
]
}
3 changes: 0 additions & 3 deletions dev_tools/.vscode/settings.json

This file was deleted.

1 change: 1 addition & 0 deletions dev_tools/py_requirements.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ pypkgs: with pypkgs;
pytest-random-order
pytest-xdist
pytz
objgraph
]
14 changes: 13 additions & 1 deletion dev_tools/shell.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
let
pkgs = import <nixpkgs> { };
# define version
using_python = pkgs.python312;
using_python = (pkgs.enableDebugging pkgs.python312).overrideAttrs (
oldAttrs: {
keepDebugInfo = true;
}
);
# import required python packages
required_python_packages = import ./py_requirements.nix;
#
Expand All @@ -14,6 +18,8 @@ pkgs.mkShell {
pkgs.cmake
pkgs.gdb
pkgs.valgrind
# pkgs.gcc
pkgs.clang
pkgs.gcc
];
shellHook = ''
Expand All @@ -37,5 +43,11 @@ pkgs.mkShell {
fi
done
ensure_symlink ${extra_search_directory}/python ${pyenv}/bin/python
ensure_symlink ${extra_search_directory}/valgrind ${pkgs.valgrind}/bin/valgrind
export CC=${pkgs.clang}/bin/clang
export CXX=${pkgs.clang}/bin/clang++
ensure_symlink ${extra_search_directory}/clang $CC
ensure_symlink ${extra_search_directory}/clang++ $CXX
export NIX_DEBUG_INFO_DIRS=/home/antares/Documents/GitHub/cpython-debug/Python-3.12.3/
'';
}

0 comments on commit 48044e1

Please sign in to comment.