Skip to content

Commit 5e7f207

Browse files
authored
Enable cross-directory ccache (flexflow#1539)
* Add support for cross-directory ccaching * Add gdb alias for ffdb * Update proj * Change from fdebug-prefix-map to ffile-prefix-map to fix __FILE__ issues * Remove unnecessary stuff from ffdb nix file * Remove commented-out code
1 parent 030bfd6 commit 5e7f207

File tree

8 files changed

+61
-180
lines changed

8 files changed

+61
-180
lines changed

.flake/pkgs/ffdb/default.nix

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{ lib
2+
, stdenv
3+
, makeWrapper
4+
, gdb
5+
, python3
6+
, proj
7+
}:
8+
9+
stdenv.mkDerivation rec {
10+
pname = "ffdb";
11+
version = "0.1";
12+
13+
pythonPath = with python3.pkgs; makePythonPath [
14+
proj
15+
];
16+
17+
dontBuild = true;
18+
19+
nativeBuildInputs = [ makeWrapper ];
20+
21+
src = ./.;
22+
23+
installPhase = ''
24+
mkdir -p $out/share/ffdb
25+
cp ffdb.py $out/share/ffdb
26+
makeWrapper ${gdb}/bin/gdb $out/bin/gdb \
27+
--add-flags "-q -x $out/share/ffdb/ffdb.py" \
28+
--set NIX_PYTHONPATH ${pythonPath} \
29+
--prefix PATH : ${lib.makeBinPath [
30+
python3
31+
]}
32+
cp $out/bin/gdb $out/bin/ffdb
33+
'';
34+
35+
nativeCheckInputs = [
36+
gdb
37+
python3
38+
proj
39+
];
40+
}

.flake/pkgs/ffdb/ffdb.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from proj.config_file import get_config_root
2+
from pathlib import Path
3+
import gdb
4+
5+
gdb.execute(f'directory {get_config_root(Path.cwd())}')
6+
gdb.prompt_hook = lambda x: '(ffdb) '
7+
gdb.execute('set history save on')

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# gdb history
2+
.gdb_history
3+
14
# dtgen files
25
*.dtg.cc
36
*.dtg.h

cmake/flexflow-utils.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function(ff_set_cxx_properties target)
3939
CXX_EXTENSIONS NO
4040
)
4141
target_compile_options(${target}
42-
PRIVATE $<$<COMPILE_LANGUAGE:CXX>:> # add C++ compile flags here
42+
PRIVATE $<$<COMPILE_LANGUAGE:CXX>:> "-ffile-prefix-map=${CMAKE_SOURCE_DIR}=." # add C++ compile flags here
4343
)
4444
endfunction()
4545

flake.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,13 @@
3535
mkShell = pkgs.mkShell.override {
3636
stdenv = pkgs.cudaPackages.backendStdenv;
3737
};
38+
39+
proj = proj-repo.packages.${system}.proj;
3840
in
3941
{
4042
packages = {
4143
legion = pkgs.callPackage ./.flake/pkgs/legion.nix { };
44+
ffdb = pkgs.callPackage ./.flake/pkgs/ffdb { inherit proj; };
4245
hpp2plantuml = pkgs.python3Packages.callPackage ./.flake/pkgs/hpp2plantuml.nix { };
4346
rapidcheckFull = pkgs.symlinkJoin {
4447
name = "rapidcheckFull";
@@ -102,9 +105,7 @@
102105
doxygen
103106
lcov # for code coverage
104107
])
105-
(with proj-repo.packages.${system}; [
106-
proj
107-
])
108+
[ proj ]
108109
(with self.packages.${system}; [
109110
legion
110111
hpp2plantuml
@@ -128,7 +129,6 @@
128129
gh-markdown-preview
129130
shellcheck
130131
plantuml
131-
gdb
132132
ruff
133133
compdb
134134
jq
@@ -148,6 +148,9 @@
148148
black
149149
toml
150150
])
151+
(with self.packages.${system}; [
152+
ffdb
153+
])
151154
];
152155
};
153156
};

scripts/format.sh

Lines changed: 0 additions & 77 deletions
This file was deleted.

scripts/gdb/pretty_print.py

Lines changed: 0 additions & 95 deletions
This file was deleted.

0 commit comments

Comments
 (0)