summary refs log tree commit diff
path: root/pkgs/development/tools/analysis/rr/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/tools/analysis/rr/default.nix')
-rw-r--r--pkgs/development/tools/analysis/rr/default.nix41
1 files changed, 41 insertions, 0 deletions
diff --git a/pkgs/development/tools/analysis/rr/default.nix b/pkgs/development/tools/analysis/rr/default.nix
new file mode 100644
index 00000000000..992d797c189
--- /dev/null
+++ b/pkgs/development/tools/analysis/rr/default.nix
@@ -0,0 +1,41 @@
+{ stdenv, fetchFromGitHub, cmake, libpfm, zlib, python }:
+
+stdenv.mkDerivation rec {
+  version = "3.0.0";
+  name = "rr-${version}";
+
+  src = fetchFromGitHub {
+    owner = "mozilla";
+    repo = "rr";
+    rev = version;
+    sha256 = "1h4ddq7mmi0sfj6mh1qg2bfs3x7gz5qmn9dlnmpkrp38rqgnnhrg";
+  };
+
+  patchPhase = ''
+    substituteInPlace src/Command.cc --replace '_BSD_SOURCE' '_DEFAULT_SOURCE'
+  ''
+  # On 64bit machines, don't build the 32-bit components for debugging
+  # 32-bit binaries. This sucks but I don't know how to make 'gcc' cooperate
+  # easily with how CMake works to build 32 and 64bit binaries at once.
+  + stdenv.lib.optionalString (stdenv.system == "x86_64-linux") ''
+    substituteInPlace CMakeLists.txt --replace 'if(rr_64BIT)' 'if(false)'
+  '';
+
+  buildInputs = [ cmake libpfm zlib python ];
+  cmakeFlags = "-DCMAKE_C_FLAGS_RELEASE:STRING= -DCMAKE_CXX_FLAGS_RELEASE:STRING=";
+
+  meta = {
+    homepage = http://rr-project.org/;
+    description = "Records nondeterministic executions and debugs them deterministically";
+    longDescription = ''
+      rr aspires to be your primary debugging tool, replacing -- well,
+      enhancing -- gdb. You record a failure once, then debug the
+      recording, deterministically, as many times as you want. Every
+      time the same execution is replayed.
+    '';
+
+    license = "custom";
+    maintainers = with stdenv.lib.maintainers; [ pierron thoughtpolice ];
+    platforms = stdenv.lib.platforms.linux;
+  };
+}