projects/guix·blob version-1.4.0 · refs

858 lines · 36.3 KiB

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