projects/guix·blob wip-postfix · refs

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