gnu: Add libbacktrace.
[jackhill/guix/guix.git] / gnu / packages / debug.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2014, 2015, 2016, 2017, 2019, 2020 Eric Bavier <bavier@posteo.net>
3 ;;; Copyright © 2016, 2017, 2018, 2020 Efraim Flashner <efraim@flashner.co.il>
4 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
5 ;;; Copyright © 2018, 2019 Rutger Helling <rhelling@mykolab.com>
6 ;;; Copyright © 2019 Pkill -9 <pkill9@runbox.com>
7 ;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
8 ;;; Copyright © 2020 Morgan Smith <Morgan.J.Smith@outlook.com>
9 ;;;
10 ;;; This file is part of GNU Guix.
11 ;;;
12 ;;; GNU Guix is free software; you can redistribute it and/or modify it
13 ;;; under the terms of the GNU General Public License as published by
14 ;;; the Free Software Foundation; either version 3 of the License, or (at
15 ;;; your option) any later version.
16 ;;;
17 ;;; GNU Guix is distributed in the hope that it will be useful, but
18 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;;; GNU General Public License for more details.
21 ;;;
22 ;;; You should have received a copy of the GNU General Public License
23 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
24
25 (define-module (gnu packages debug)
26 #:use-module (guix packages)
27 #:use-module ((guix licenses) #:prefix license:)
28 #:use-module (guix download)
29 #:use-module (guix git-download)
30 #:use-module (guix utils)
31 #:use-module (guix build-system gnu)
32 #:use-module (guix build-system cmake)
33 #:use-module (gnu packages)
34 #:use-module (gnu packages attr)
35 #:use-module (gnu packages autotools)
36 #:use-module (gnu packages base)
37 #:use-module (gnu packages bash)
38 #:use-module (gnu packages bison)
39 #:use-module (gnu packages code)
40 #:use-module (gnu packages compression)
41 #:use-module (gnu packages flex)
42 #:use-module (gnu packages gdb)
43 #:use-module (gnu packages glib)
44 #:use-module (gnu packages gtk)
45 #:use-module (gnu packages golang)
46 #:use-module (gnu packages image)
47 #:use-module (gnu packages libusb)
48 #:use-module (gnu packages linux)
49 #:use-module (gnu packages llvm)
50 #:use-module (gnu packages ncurses)
51 #:use-module (gnu packages ninja)
52 #:use-module (gnu packages perl)
53 #:use-module (gnu packages pkg-config)
54 #:use-module (gnu packages pretty-print)
55 #:use-module (gnu packages python)
56 #:use-module (gnu packages python-xyz)
57 #:use-module (gnu packages readline)
58 #:use-module (gnu packages serialization)
59 #:use-module (gnu packages virtualization)
60 #:use-module (gnu packages xdisorg)
61 #:use-module (ice-9 match)
62 #:use-module (srfi srfi-1))
63
64 (define-public delta
65 (package
66 (name "delta")
67 (version "2006.08.03")
68 (source
69 (origin
70 (method url-fetch)
71 (uri (list
72 (string-append "mirror://debian/pool/main/d/delta/"
73 "delta_" version ".orig.tar.gz")
74 ;; This uri seems to send guix download into an infinite loop
75 (string-append "http://delta.tigris.org/files/documents/3103/"
76 "33566/delta-" version ".tar.gz")))
77 (sha256
78 (base32
79 "184wh35pf2ddx97319s6sgkzpz48xxkbwzcjpycv009bm53lh61q"))))
80 (build-system gnu-build-system)
81 (inputs ;Installed programs are perl scripts
82 `(("perl" ,perl)))
83 (arguments
84 `(#:phases
85 (modify-phases %standard-phases
86 (replace 'install
87 (lambda* (#:key outputs #:allow-other-keys)
88 ;; Makefile contains no install target
89 (let* ((out (assoc-ref outputs "out"))
90 (bin (string-append out "/bin"))
91 (doc (string-append out "/share/doc/delta-" ,version)))
92 (begin
93 (for-each (lambda (h)
94 (install-file h doc))
95 `("License.txt" ,@(find-files "www" ".*\\.html")))
96 (for-each (lambda (b)
97 (install-file b bin))
98 `("delta" "multidelta" "topformflat"))))
99 #t))
100 (delete 'configure)))) ; no configure script
101 (home-page "http://delta.tigris.org/")
102 (synopsis "Heuristical file minimizer")
103 (description
104 "Delta assists you in minimizing \"interesting\" files subject to a test
105 of their interestingness. A common such situation is when attempting to
106 isolate a small failure-inducing substring of a large input that causes your
107 program to exhibit a bug.")
108 ;; See License.txt, which is a bsd-3 license, despite the project's
109 ;; home-page pointing to a bsd-2 license.
110 (license license:bsd-3)))
111
112 (define-public c-reduce
113 (package
114 (name "c-reduce")
115 (version "2.10.0")
116 (source
117 (origin
118 (method url-fetch)
119 (uri (list
120 (string-append "http://embed.cs.utah.edu/creduce/"
121 "creduce-" version ".tar.gz")))
122 (sha256
123 (base32 "0qx0zq8jxzx2as2zf0740g7kvgq163ayn3041di4vwk77490y76v"))))
124 (build-system gnu-build-system)
125 (native-inputs `(("flex" ,flex)))
126 (inputs
127 `(("astyle" ,astyle)
128 ("llvm" ,llvm)
129 ("clang" ,clang)
130 ("indent" ,indent)
131 ("perl" ,perl)
132 ("exporter-lite" ,perl-exporter-lite)
133 ("file-which" ,perl-file-which)
134 ("getopt-tabular" ,perl-getopt-tabular)
135 ("regex-common" ,perl-regexp-common)
136 ("term-readkey" ,perl-term-readkey)))
137 (arguments
138 `(#:phases
139 (modify-phases %standard-phases
140 (replace 'check
141 (lambda _
142 (with-directory-excursion "tests"
143 ;; Running all tests can take a looong time, and tests 4 and 5
144 ;; require frama-c or kcc. So run just one for sanity.
145 (invoke "./run_tests" "1"))))
146 (add-after 'install 'set-load-paths
147 (lambda* (#:key inputs outputs #:allow-other-keys)
148 ;; Tell creduce where to find the perl modules it needs.
149 (let* ((out (assoc-ref outputs "out"))
150 (prog (string-append out "/bin/creduce")))
151 (wrap-program
152 prog
153 `("PERL5LIB" ":" prefix
154 ,(map (lambda (p)
155 (string-append (assoc-ref inputs p)
156 "/lib/perl5/site_perl/"
157 ,(package-version perl)))
158 '("term-readkey" "exporter-lite"
159 "file-which" "getopt-tabular"
160 "regex-common")))))
161 #t)))))
162 (home-page "https://embed.cs.utah.edu/creduce")
163 (synopsis "Reducer for interesting code")
164 (description
165 "C-Reduce is a tool that takes a large C or C++ program that has a
166 property of interest (such as triggering a compiler bug) and automatically
167 produces a much smaller C/C++ program that has the same property. It is
168 intended for use by people who discover and report bugs in compilers and other
169 tools that process C/C++ code.")
170 (license license:ncsa)))
171
172 (define-public american-fuzzy-lop
173 (let ((machine (match (or (%current-target-system)
174 (%current-system))
175 ("x86_64-linux" "x86_64")
176 ("i686-linux" "i386")
177 ("aarch64-linux" "aarch64")
178 ("armhf-linux" "arm")
179 ("mips64el-linux" "mips64el")
180 ;; Prevent errors when querying this package on unsupported
181 ;; platforms, e.g. when running "guix package --search="
182 (_ "UNSUPPORTED"))))
183 (package
184 (name "american-fuzzy-lop")
185 (version "2.56b") ;It seems all releases have the 'b' suffix
186 (source
187 (origin
188 (method git-fetch)
189 (uri (git-reference
190 (url "https://github.com/google/AFL")
191 (commit (string-append "v" version))))
192 (sha256
193 (base32 "1q1g59gkm48aa4cg9h70jx4i2gapmypgp5rzs156b2avd95vwkn1"))
194 (file-name (git-file-name name version))))
195 (build-system gnu-build-system)
196 (inputs
197 `(("qemu" ,qemu-for-american-fuzzy-lop)))
198 (arguments
199 `(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
200 (string-append "DOC_PATH=$(PREFIX)/share/doc/"
201 ,name "-" ,version)
202 "CC=gcc")
203 #:phases (modify-phases %standard-phases
204 (add-after 'unpack 'make-git-checkout-writable
205 (lambda _
206 (for-each make-file-writable (find-files "."))
207 #t))
208 (delete 'configure)
209 ,@(if (string=? (%current-system) (or "x86_64-linux"
210 "i686-linux"))
211 '()
212 '((add-before 'build 'set-afl-flag
213 (lambda _ (setenv "AFL_NO_X86" "1") #t))
214 (add-after 'install 'remove-x86-programs
215 (lambda* (#:key outputs #:allow-other-keys)
216 (let* ((out (assoc-ref outputs "out"))
217 (bin (string-append out "/bin/")))
218 (delete-file (string-append bin "afl-gcc"))
219 (delete-file (string-append bin "afl-g++"))
220 (delete-file (string-append bin "afl-clang"))
221 (delete-file (string-append bin "afl-clang++")))
222 #t))))
223 (add-after
224 ;; TODO: Build and install the afl-llvm tool.
225 'install 'install-qemu
226 (lambda* (#:key inputs outputs #:allow-other-keys)
227 (let ((qemu (assoc-ref inputs "qemu"))
228 (out (assoc-ref outputs "out")))
229 (symlink (string-append qemu "/bin/qemu-" ,machine)
230 (string-append out "/bin/afl-qemu-trace"))
231 #t)))
232 (delete 'check)))) ; tests are run during 'install phase
233 (home-page "https://lcamtuf.coredump.cx/afl/")
234 (synopsis "Security-oriented fuzzer")
235 (description
236 "American fuzzy lop is a security-oriented fuzzer that employs a novel
237 type of compile-time instrumentation and genetic algorithms to automatically
238 discover clean, interesting test cases that trigger new internal states in the
239 targeted binary. This substantially improves the functional coverage for the
240 fuzzed code. The compact synthesized corpora produced by the tool are also
241 useful for seeding other, more labor- or resource-intensive testing regimes
242 down the road.")
243 (license license:asl2.0))))
244
245 (define-public qemu-for-american-fuzzy-lop
246 ;; afl only supports using a single afl-qemu-trace executable, so
247 ;; we only build qemu for the native target.
248 (let ((machine (match (or (%current-target-system)
249 (%current-system))
250 ("x86_64-linux" "x86_64")
251 ("i686-linux" "i386")
252 ("aarch64-linux" "aarch64")
253 ("armhf-linux" "arm")
254 ("mips64el-linux" "mips64el")
255 ;; Prevent errors when querying this package on unsupported
256 ;; platforms, e.g. when running "guix package --search="
257 (_ "UNSUPPORTED"))))
258 (hidden-package
259 (package
260 (name "qemu")
261 (version "2.10.2")
262 (source (origin
263 (method url-fetch)
264 (uri (string-append "https://download.qemu.org/qemu-"
265 version ".tar.xz"))
266 (sha256
267 (base32
268 "17w21spvaxaidi2am5lpsln8yjpyp2zi3s3gc6nsxj5arlgamzgw"))
269 (patches
270 (search-patches "qemu-glibc-2.27.patch"))))
271 (build-system gnu-build-system)
272 (arguments
273 `(;; Running tests in parallel can occasionally lead to failures, like:
274 ;; boot_sector_test: assertion failed (signature == SIGNATURE): (0x00000000 == 0x0000dead)
275 #:parallel-tests? #f
276 #:configure-flags
277 (list (string-append "--target-list=" ,machine "-linux-user"))
278 #:make-flags '("V=1")
279 #:phases
280 (modify-phases %standard-phases
281 (replace 'configure
282 (lambda* (#:key inputs outputs (configure-flags '())
283 #:allow-other-keys)
284 ;; The `configure' script doesn't understand some of the
285 ;; GNU options. Thus, add a new phase that's compatible.
286 (let ((out (assoc-ref outputs "out")))
287 (setenv "SHELL" (which "bash"))
288
289 ;; While we're at it, patch for tests.
290 (substitute* "tests/libqtest.c"
291 (("/bin/sh") (which "sh")))
292
293 ;; The binaries need to be linked against -lrt.
294 (setenv "LDFLAGS" "-lrt")
295 (apply invoke
296 `("./configure"
297 ,(string-append "--cc=" (which "gcc"))
298 ;; Some architectures insist on using HOST_CC
299 ,(string-append "--host-cc=" (which "gcc"))
300 "--disable-debug-info" ; save build space
301 "--enable-virtfs" ; just to be sure
302 ,(string-append "--prefix=" out)
303 ,(string-append "--sysconfdir=/etc")
304 ,@configure-flags)))))
305 (add-after
306 'unpack 'apply-afl-patches
307 (lambda* (#:key inputs #:allow-other-keys)
308 (let* ((afl-src (assoc-ref inputs "afl-source"))
309 (patch-dir "qemu_mode/patches"))
310 (copy-recursively (string-append afl-src "/"
311 patch-dir)
312 patch-dir)
313 (install-file
314 (string-append patch-dir
315 "/afl-qemu-cpu-inl.h")
316 ".")
317 (copy-file (string-append afl-src "/config.h")
318 "./afl-config.h")
319 (install-file (string-append afl-src "/types.h")
320 ".")
321 (substitute* "afl-qemu-cpu-inl.h"
322 (("\\.\\./\\.\\./config.h") "afl-config.h"))
323 (substitute* (string-append patch-dir
324 "/cpu-exec.diff")
325 (("\\.\\./patches/") ""))
326
327 ;; These were already applied to qemu-minimal-2.10.
328 (for-each (lambda (obsolete-patch)
329 (delete-file (string-append
330 patch-dir "/"
331 obsolete-patch)))
332 (list "configure.diff"
333 "memfd.diff"))
334
335 (for-each (lambda (patch-file)
336 (invoke "patch" "--force" "-p1"
337 "--input" patch-file))
338 (find-files patch-dir
339 "\\.diff$"))
340 #t)))
341 (add-before 'check 'disable-unusable-tests
342 (lambda* (#:key inputs outputs #:allow-other-keys)
343 (substitute* "tests/Makefile.include"
344 ;; Comment out the test-qga test, which needs /sys and
345 ;; fails within the build environment.
346 (("check-unit-.* tests/test-qga" all)
347 (string-append "# " all)))
348 (substitute* "tests/Makefile.include"
349 ;; Comment out the test-char test, which needs networking and
350 ;; fails within the build environment.
351 (("check-unit-.* tests/test-char" all)
352 (string-append "# " all)))
353 #t)))))
354 (native-inputs
355 `(("python-2" ,python-2) ; QEMU 2 needs Python 2
356 ("glib:bin" ,glib "bin")
357 ("perl" ,perl)
358 ("flex" ,flex)
359 ("bison" ,bison)
360 ("pkg-config" ,pkg-config)))
361 (inputs
362 `(("afl-source" ,(package-source american-fuzzy-lop))
363 ("alsa-lib" ,alsa-lib)
364 ("attr" ,attr)
365 ("glib" ,glib)
366 ("libaio" ,libaio)
367 ("libattr" ,attr)
368 ("libcap" ,libcap)
369 ("libjpeg" ,libjpeg-turbo)
370 ("libpng" ,libpng)
371 ("ncurses" ,ncurses)
372 ("pixman" ,pixman)
373 ("util-linux" ,util-linux)
374 ("zlib" ,zlib)))
375 (home-page "https://www.qemu.org")
376 (synopsis "Machine emulator and virtualizer (without GUI) for american fuzzy lop")
377 (description
378 "QEMU is a generic machine emulator and virtualizer. This package
379 of QEMU is used only by the american fuzzy lop package.
380
381 When used as a machine emulator, QEMU can run OSes and programs made for one
382 machine (e.g. an ARM board) on a different machine---e.g., your own PC. By
383 using dynamic translation, it achieves very good performance.
384
385 When used as a virtualizer, QEMU achieves near native performances by
386 executing the guest code directly on the host CPU. QEMU supports
387 virtualization when executing under the Xen hypervisor or using
388 the KVM kernel module in Linux. When using KVM, QEMU can virtualize x86,
389 server and embedded PowerPC, and S390 guests.")
390 ;; Many files are GPLv2+, but some are GPLv2-only---e.g., `memory.c'.
391 (license license:gpl2)
392 ;; Several tests fail on MIPS.
393 (supported-systems (delete "mips64el-linux" %supported-systems))))))
394
395 (define-public stress-make
396 (let ((commit "97815bed8060de33952475b3498767c91f59ffd9")
397 (revision "2")) ;No official source distribution
398 (package
399 (name "stress-make")
400 (version (git-version "1.0" revision commit))
401 (source
402 (origin
403 (method git-fetch)
404 (uri (git-reference
405 (url "https://github.com/lanl/stress-make")
406 (commit commit)))
407 (file-name (git-file-name name version))
408 (sha256
409 (base32
410 "0k55cy7x0hlc6rgpascl6ibhcfxaash3p9r9r8kwvbm3zag1rmac"))))
411 (build-system gnu-build-system)
412 (native-inputs
413 `(("autoconf" ,autoconf)
414 ("automake" ,automake)
415 ("go" ,go)))
416 (inputs
417 `(("make-source" ,(package-source gnu-make))))
418 (arguments
419 ;; stress-make's configure script insists on having a tarball and does
420 ;; not accept a directory name instead. To let the gnu-build-system's
421 ;; patch-* phases work properly, we unpack the source first, then
422 ;; repack before the configure phase.
423 (let ((make-dir (string-append "make-" (package-version gnu-make))))
424 `(#:configure-flags '("--with-make-tar=./make.tar.xz"
425 "make_cv_sys_gnu_glob=yes")
426 #:phases
427 (modify-phases %standard-phases
428 (add-after 'unpack 'unpack-make
429 (lambda* (#:key inputs #:allow-other-keys)
430 (invoke "tar" "xf" (assoc-ref inputs "make-source"))))
431 (add-after 'unpack-make 'set-default-shell
432 (lambda _
433 ;; Taken mostly directly from (@ (gnu packages base) gnu-make)
434 (substitute* (string-append ,make-dir "/src/job.c")
435 (("default_shell = .*$")
436 (format #f "default_shell = \"~a\";\n"
437 (which "sh"))))))
438 (add-before 'configure 'repack-make
439 (lambda _
440 (invoke "tar" "cJf" "./make.tar.xz" ,make-dir)))
441 (add-before 'build 'setup-go
442 ;; The Go cache is required starting in Go 1.12, and it needs
443 ;; to be writable.
444 (lambda _ (setenv "GOCACHE" "/tmp/go-cache") #t))))))
445 (home-page "https://github.com/lanl/stress-make")
446 (synopsis "Expose race conditions in Makefiles")
447 (description
448 "Stress Make is a customized GNU Make that explicitly manages the order
449 in which concurrent jobs are run to provoke erroneous behavior into becoming
450 manifest. It can run jobs in the order in which they're launched, in backwards
451 order, or in random order. The thought is that if code builds correctly with
452 Stress Make, then it is likely that the @code{Makefile} contains no race
453 conditions.")
454 ;; stress-make wrapper is under BSD-3-modifications-must-be-indicated,
455 ;; and patched GNU Make is under its own license.
456 (license (list (license:non-copyleft "LICENSE.md")
457 license:gpl3+)))))
458
459 (define-public zzuf
460 (package
461 (name "zzuf")
462 (version "0.15")
463 (source
464 (origin
465 (method url-fetch)
466 (uri (string-append
467 "https://github.com/samhocevar/zzuf/releases/download/v"
468 version "/" name "-" version ".tar.gz"))
469 (file-name (string-append name "-" version ".tar.gz"))
470 (sha256
471 (base32
472 "1mpzjaksc2qg2hzqflf39pl06p53qam2dn3hkhkcv6p00d2n4kx3"))))
473 (build-system gnu-build-system)
474 (home-page "https://github.com/samhocevar/zzuf")
475 (synopsis "Transparent application input fuzzer")
476 (description "Zzuf is a transparent application input fuzzer. It works by
477 intercepting file operations and changing random bits in the program's
478 input. Zzuf's behaviour is deterministic, making it easy to reproduce bugs.")
479 (license license:wtfpl2)))
480
481 (define-public scanmem
482 (package
483 (name "scanmem")
484 (version "0.17")
485 (source
486 (origin
487 (method git-fetch)
488 (uri (git-reference
489 (url "https://github.com/scanmem/scanmem")
490 (commit (string-append "v" version))))
491 (file-name (git-file-name name version))
492 (sha256
493 (base32
494 "17p8sh0rj8yqz36ria5bp48c8523zzw3y9g8sbm2jwq7sc27i7s9"))))
495 (build-system gnu-build-system)
496 (arguments
497 `(#:configure-flags '("--enable-gui")
498 #:phases
499 (modify-phases %standard-phases
500 (add-before 'configure 'hardcode-python
501 (lambda* (#:key inputs outputs #:allow-other-keys)
502 (substitute* "gui/GameConqueror.py"
503 (("/usr/bin/env python")
504 (string-append (assoc-ref %build-inputs
505 "python-wrapper") "/bin/python")))
506 #t))
507 (add-after 'install 'wrap-gameconqueror
508 (lambda* (#:key inputs outputs #:allow-other-keys)
509 (let ((out (assoc-ref outputs "out"))
510 (gi-typelib-path (getenv "GI_TYPELIB_PATH"))
511 (python-path (getenv "PYTHONPATH")))
512 (wrap-program (string-append out "/share/gameconqueror/GameConqueror.py")
513 `("GI_TYPELIB_PATH" ":" prefix (,gi-typelib-path))
514 `("PYTHONPATH" ":" prefix (,python-path))))
515 #t)))))
516 (native-inputs
517 `(("libtool" ,libtool)
518 ("python-wrapper" ,python-wrapper)
519 ("gobject-introspection" ,gobject-introspection)
520 ("gtk+" ,gtk+)
521 ("intltool" ,intltool)
522 ("automake" ,automake)
523 ("autoconf" ,autoconf)))
524 (inputs
525 `(("readline" ,readline)))
526 (propagated-inputs
527 `(("python-pygobject" ,python-pygobject)))
528 (home-page "https://github.com/scanmem/scanmem")
529 (synopsis "Memory scanner")
530 (description "Scanmem is a debugging utility designed to isolate the
531 address of an arbitrary variable in an executing process. Scanmem simply
532 needs to be told the pid of the process and the value of the variable at
533 several different times. After several scans of the process, scanmem isolates
534 the position of the variable and allows you to modify its value.")
535 ;; The library is covered by LGPLv3 or later; the application is covered
536 ;; by GPLv3 or later.
537 (license (list license:lgpl3+ license:gpl3+))))
538
539 (define-public remake
540 (package (inherit gnu-make)
541 (name "remake")
542 (version "4.3-1.5")
543 (source (origin
544 (method url-fetch)
545 (uri (let ((upstream-version
546 (match (string-split version #\-)
547 ((ver sub) (string-append ver "%2Bdbg-" sub)))))
548 (string-append "mirror://sourceforge/bashdb/"
549 "remake/" upstream-version "/"
550 "remake-" upstream-version ".tar.gz")))
551 (file-name (string-append "remake-" version ".tar.gz"))
552 (sha256
553 (base32
554 "0xlx2485y0israv2pfghmv74lxcv9i5y65agy69mif76yc4vfvif"))
555 (patches (search-patches "remake-impure-dirs.patch"))))
556 (inputs
557 `(("readline" ,readline)
558 ,@(package-inputs gnu-make)))
559 (home-page "http://bashdb.sourceforge.net/remake/")
560 (description "Remake is an enhanced version of GNU Make that adds improved
561 error reporting, better tracing, profiling, and a debugger.")
562 (license license:gpl3+)))
563
564 (define-public rr
565 (package
566 (name "rr")
567 (version "5.3.0")
568 (source (origin
569 (method git-fetch)
570 (uri (git-reference
571 (url "https://github.com/mozilla/rr")
572 (commit version)))
573 (sha256
574 (base32
575 "1x6l1xsdksnhz9v50p4r7hhmr077cq20kaywqy1jzdklvkjqzf64"))
576 (file-name (git-file-name name version))))
577 (build-system cmake-build-system)
578 (arguments
579 `(#:configure-flags
580 ;; The 'rr_exec_stub' is a static binary, which leads CMake to fail
581 ;; with:
582 ;;
583 ;; file RPATH_CHANGE could not write new RPATH:
584 ;;
585 ;; Clear CMAKE_INSTALL_RPATH to avoid that problem.
586 (list "-DCMAKE_INSTALL_RPATH="
587 ,@(if (and (not (%current-target-system))
588 (member (%current-system)
589 '("x86_64-linux" "aarch64-linux")))
590 ;; The toolchain doesn't support '-m32'.
591 '("-Ddisable32bit=ON")
592 '()))
593
594 ;; XXX: Most tests fail with:
595 ;;
596 ;; rr needs /proc/sys/kernel/perf_event_paranoid <= 1, but it is 2.
597 ;;
598 ;; This setting cannot be changed from the build environment, so skip
599 ;; the tests.
600 #:tests? #f
601
602 #:phases (modify-phases %standard-phases
603 (add-before 'check 'set-home
604 (lambda _
605 ;; Some tests expect 'HOME' to be set.
606 (setenv "HOME" (getcwd))
607 #t)))))
608 (native-inputs
609 `(("pkg-config" ,pkg-config)
610 ("ninja" ,ninja)
611 ("which" ,which)))
612 (inputs
613 `(("gdb" ,gdb)
614 ("cpanproto" ,capnproto)
615 ("python" ,python)
616 ("python-pexpect" ,python-pexpect)))
617 (home-page "https://rr-project.org/")
618 (synopsis "Record and reply debugging framework")
619 (description
620 "rr is a lightweight tool for recording, replaying and debugging
621 execution of applications (trees of processes and threads). Debugging extends
622 GDB with very efficient reverse-execution, which in combination with standard
623 GDB/x86 features like hardware data watchpoints, makes debugging much more
624 fun.")
625 (license license:expat)))
626
627 (define-public libbacktrace
628 ;; There are no releases nor tags.
629 (let ((revision "1")
630 (commit "5009c113981431ae1843ebd29d6ad24eb32fc1b2"))
631 (package
632 (name "libbacktrace")
633 (version (git-version "1.0" revision commit))
634 (source (origin
635 (method git-fetch)
636 (uri (git-reference
637 (url "https://github.com/ianlancetaylor/libbacktrace")
638 (commit commit)))
639 (file-name (git-file-name name version))
640 (sha256
641 (base32
642 "0663zjpfpnsyv9h3pbp7cgmg9gz79n68bqpdl97y6i0jsx93v1zg"))))
643 (build-system gnu-build-system)
644 (arguments
645 `(#:make-flags '("CFLAGS=-fPIC")))
646 (home-page "https://github.com/ianlancetaylor/libbacktrace")
647 (synopsis "C library for producing symbolic backtraces")
648 (description "The @code{libbacktrace} library can be linked into a C/C++
649 program to produce symbolic backtraces.")
650 (license license:expat))))
651
652 (define-public mspdebug
653 (package
654 (name "mspdebug")
655 (version "0.25")
656 (source (origin
657 (method git-fetch)
658 (uri (git-reference
659 (url "https://github.com/dlbeer/mspdebug")
660 (commit (string-append "v" version))))
661 (file-name (git-file-name name version))
662 (sha256
663 (base32 "0prgwb5vx6fd4bj12ss1bbb6axj2kjyriyjxqrzd58s5jyyy8d3c"))))
664 (build-system gnu-build-system)
665 (arguments
666 `(#:tests? #f ; no test suite
667 #:phases
668 (modify-phases %standard-phases
669 (delete 'configure)) ; no configure script
670 #:make-flags
671 (list (string-append "CC=" ,(cc-for-target))
672 "INSTALL=install"
673 (string-append "PREFIX=" %output))))
674 (inputs
675 `(("libusb-compat" ,libusb-compat)
676 ("readline" ,readline)))
677 (synopsis "Debugging tool for MSP430 MCUs")
678 (description "MspDebug supports FET430UIF, eZ430, RF2500 and Olimex
679 MSP430-JTAG-TINY programmers, as well as many other compatible
680 devices. It can be used as a proxy for gdb or as an independent
681 debugger with support for programming, disassembly and reverse
682 engineering.")
683 (home-page "https://github.com/dlbeer/mspdebug")
684 (license license:gpl2+)))