projects/guix·blob bootstrap-team · refs

1318 lines · 56.1 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2014, 2015, 2016, 2017, 2019-2022 Eric Bavier <[email protected]>
3;;; Copyright © 2016-2018, 2020, 2021, 2025 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, 2025 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;;; Copyright © 2024 Raven Hallsby <[email protected]>
17;;; Copyright © 2025 Nguyễn Gia Phong <[email protected]>
18;;; Copyright © 2025 Robin Templeton <[email protected]>
19;;;
20;;; This file is part of GNU Guix.
21;;;
22;;; GNU Guix is free software; you can redistribute it and/or modify it
23;;; under the terms of the GNU General Public License as published by
24;;; the Free Software Foundation; either version 3 of the License, or (at
25;;; your option) any later version.
26;;;
27;;; GNU Guix is distributed in the hope that it will be useful, but
28;;; WITHOUT ANY WARRANTY; without even the implied warranty of
29;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30;;; GNU General Public License for more details.
31;;;
32;;; You should have received a copy of the GNU General Public License
33;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
34
35(define-module (gnu packages debug)
36 #:use-module (guix packages)
37 #:use-module ((guix licenses) #:prefix license:)
38 #:use-module (guix download)
39 #:use-module (guix git-download)
40 #:use-module (guix utils)
41 #:use-module (guix build-system gnu)
42 #:use-module (guix build-system cmake)
43 #:use-module (guix build-system go)
44 #:use-module (guix build-system linux-module)
45 #:use-module (guix build-system pyproject)
46 #:use-module (guix build-system qt)
47 #:use-module (guix gexp)
48 #:use-module (gnu packages)
49 #:use-module (gnu packages attr)
50 #:use-module (gnu packages autotools)
51 #:use-module (gnu packages base)
52 #:use-module (gnu packages bash)
53 #:use-module (gnu packages bison)
54 #:use-module (gnu packages c)
55 #:use-module (gnu packages cpp)
56 #:use-module (gnu packages check)
57 #:use-module (gnu packages code)
58 #:use-module (gnu packages compression)
59 #:use-module (gnu packages flex)
60 #:use-module (gnu packages fontutils)
61 #:use-module (gnu packages gcc)
62 #:use-module (gnu packages gdb)
63 #:use-module (gnu packages glib)
64 #:use-module (gnu packages gtk)
65 #:use-module (gnu packages golang)
66 #:use-module (gnu packages golang-build)
67 #:use-module (gnu packages golang-web)
68 #:use-module (gnu packages golang-xyz)
69 #:use-module (gnu packages image)
70 #:use-module (gnu packages lesstif)
71 #:use-module (gnu packages libusb)
72 #:use-module (gnu packages linux)
73 #:use-module (gnu packages llvm)
74 #:use-module (gnu packages multiprecision)
75 #:use-module (gnu packages ncurses)
76 #:use-module (gnu packages ninja)
77 #:use-module (gnu packages perl)
78 #:use-module (gnu packages pkg-config)
79 #:use-module (gnu packages pretty-print)
80 #:use-module (gnu packages python)
81 #:use-module (gnu packages python-build)
82 #:use-module (gnu packages python-check)
83 #:use-module (gnu packages python-xyz)
84 #:use-module (gnu packages qt)
85 #:use-module (gnu packages readline)
86 #:use-module (gnu packages serialization)
87 #:use-module (gnu packages texinfo)
88 #:use-module (gnu packages virtualization)
89 #:use-module (gnu packages xdisorg)
90 #:use-module (gnu packages xorg)
91 #:use-module (ice-9 match)
92 #:use-module (srfi srfi-1))
93
94(define-public delta
95 (package
96 (name "delta")
97 (version "2006.08.03")
98 (source
99 (origin
100 (method url-fetch)
101 (uri (list
102 (string-append "mirror://debian/pool/main/d/delta/"
103 "delta_" version ".orig.tar.gz")))
104 (sha256
105 (base32
106 "184wh35pf2ddx97319s6sgkzpz48xxkbwzcjpycv009bm53lh61q"))))
107 (build-system gnu-build-system)
108 (inputs ;Installed programs are perl scripts
109 (list perl))
110 (arguments
111 `(#:phases
112 (modify-phases %standard-phases
113 (replace 'install
114 (lambda* (#:key outputs #:allow-other-keys)
115 ;; Makefile contains no install target
116 (let* ((out (assoc-ref outputs "out"))
117 (bin (string-append out "/bin"))
118 (doc (string-append out "/share/doc/delta-" ,version)))
119 (begin
120 (for-each (lambda (h)
121 (install-file h doc))
122 `("License.txt" ,@(find-files "www" ".*\\.html")))
123 (for-each (lambda (b)
124 (install-file b bin))
125 `("delta" "multidelta" "topformflat"))))
126 #t))
127 (delete 'configure)))) ; no configure script
128 (home-page
129 "https://web.archive.org/web/20200701152100/http://delta.tigris.org/")
130 (synopsis "Heuristical file minimizer")
131 (description
132 "Delta assists you in minimizing \"interesting\" files subject to a test
133of their interestingness. A common such situation is when attempting to
134isolate a small failure-inducing substring of a large input that causes your
135program to exhibit a bug.")
136 ;; See License.txt, which is a bsd-3 license, despite the project's
137 ;; home-page pointing to a bsd-2 license.
138 (license license:bsd-3)))
139
140(define-public c-reduce
141 (let ((commit "31e855e290970cba0286e5032971509c0e7c0a80")
142 (revision "0"))
143 (package
144 (name "c-reduce")
145 (version (git-version "2.10.0" revision commit))
146 (source
147 (origin
148 (method git-fetch)
149 (uri (git-reference
150 (url "https://github.com/csmith-project/creduce")
151 (commit commit)))
152 (file-name (git-file-name name version))
153 (sha256
154 (base32 "1yd3wvnkj7qgn2jj5byp58p3qq04w5d6agagrkgi5z5gb6z4qyqk"))))
155 (build-system gnu-build-system)
156 (arguments
157 (list
158 #:phases
159 #~(modify-phases %standard-phases
160 (replace 'check
161 (lambda _
162 (with-directory-excursion "tests"
163 ;; Running all tests can take a looong time, and tests 4 and 5
164 ;; require frama-c or kcc. So run just one for sanity.
165 (invoke "./run_tests" "1"))))
166 (add-after 'install 'set-load-paths
167 (lambda _
168 ;; Tell creduce where to find the perl modules it needs.
169 (wrap-program (string-append #$output "/bin/creduce")
170 `("PERL5LIB" ":" prefix (,(getenv "PERL5LIB")))))))))
171 (native-inputs (list flex))
172 (inputs (list astyle
173 bash-minimal ;for wrap-program
174 llvm-18
175 clang-18
176 indent
177 perl
178 perl-exporter-lite
179 perl-file-which
180 perl-getopt-tabular
181 perl-regexp-common
182 perl-term-readkey))
183 (home-page "https://embed.cs.utah.edu/creduce")
184 (synopsis "Reducer for interesting code")
185 (description
186 "C-Reduce is a tool that takes a large C or C++ program that has a
187property of interest (such as triggering a compiler bug) and automatically
188produces a much smaller C/C++ program that has the same property. It is
189intended for use by people who discover and report bugs in compilers and other
190tools that process C/C++ code.")
191 (license license:ncsa))))
192
193(define-public cppdap
194 (package
195 (name "cppdap")
196 (version "1.58.0-a")
197 (source
198 (origin
199 (method git-fetch)
200 (uri
201 (git-reference
202 (url "https://github.com/google/cppdap")
203 (commit (string-append "dap-" version))))
204 (modules '((guix build utils)))
205 (snippet
206 '(delete-file-recursively "third_party"))
207 (patches (search-patches
208 "cppdap-add-CPPDAP_USE_EXTERNAL_GTEST_PACKAGE.patch"))
209 (file-name (git-file-name name version))
210 (sha256
211 (base32
212 "0fq2w35fw1lb5wya1nny45pk3a13b689k48calk1cmqmqpbcjn2b"))))
213 (build-system cmake-build-system)
214 (arguments
215 (list
216 #:configure-flags
217 #~(list
218 "-DCPPDAP_BUILD_TESTS=ON"
219 "-DCPPDAP_USE_EXTERNAL_GTEST_PACKAGE=ON"
220 ;; Only one of the following three can be enabled at the same time
221 ;; "-DCPPDAP_USE_EXTERNAL_RAPIDJSON_PACKAGE=ON"
222 ;; "-DCPPDAP_USE_EXTERNAL_JSONCPP_PACKAGE=ON"
223 "-DCPPDAP_USE_EXTERNAL_NLOHMANN_JSON_PACKAGE=ON")
224 #:phases
225 (if (target-riscv64?)
226 #~(modify-phases %standard-phases
227 ;; We need to unconditionally link with libatomic on some
228 ;; architectures to successfully build cmake.
229 (add-after 'unpack 'link-with-libatomic
230 (lambda _
231 (substitute* "CMakeLists.txt"
232 (("cppdap_set_target_options\\(cppdap\\)" all)
233 (string-append
234 all "\n\n"
235 "target_link_libraries(cppdap PRIVATE atomic)"))))))
236 #~%standard-phases)))
237 (native-inputs
238 (list googletest))
239 ;; see lib/cmake/cppdap/cppdapConfig.cmake
240 ;; cmake file require propagate this.
241 (propagated-inputs
242 (list
243 ;; Only one of the following three can be enabled at the same time
244 ;; rapidjson
245 ;; jsoncpp
246 nlohmann-json))
247 (home-page "https://github.com/google/cppdap")
248 (synopsis "C++ library for the Debug Adapter Protocol")
249 (description
250 "cppdap is a C++11 library (\"SDK\") implementation of the Debug Adapter
251Protocol, providing an API for implementing a DAP client or server. cppdap
252provides C++ type-safe structures for the full DAP specification, and provides a
253simple way to add custom protocol messages.")
254 (license license:expat)))
255
256(define-public c-vise
257 (package
258 (name "c-vise")
259 (version "2.4.0")
260 (source
261 (origin
262 (method git-fetch)
263 (uri (git-reference
264 (url "https://github.com/marxin/cvise")
265 (commit (string-append "v" version))))
266 (sha256
267 (base32 "1i2z5q2pcwh1gpdqc24x1a2q5vzwhblzzq021nzwf304di7m18vl"))
268 (file-name (git-file-name name version))))
269 (build-system cmake-build-system)
270 (native-inputs
271 (list flex python-pytest python-pytest-flake8))
272 (inputs
273 (list bash-minimal clang llvm unifdef
274 python python-pebble python-psutil python-chardet))
275 (arguments
276 `(#:phases
277 (modify-phases %standard-phases
278 (add-after 'unpack 'fix-linkage
279 (lambda _
280 (substitute* "clang_delta/CMakeLists.txt"
281 (("\\$\\{LLVM_LINK_LLVM_DYLIB\\}") "True")
282 ((" LLVM") " LLVMSupport"))))
283 (add-before 'build 'hardcode-paths
284 (lambda _
285 (substitute* "cvise.py"
286 (("/bin/bash") (which "bash"))
287 (("(.*)# Special case for clang-format" & >)
288 (string-append > "# Special case for unifdef\n"
289 > "programs['unifdef'] = '" (which "unifdef") "'\n"
290 &)))))
291 (add-after 'install 'wrap
292 (lambda* (#:key outputs #:allow-other-keys)
293 (let ((out (assoc-ref outputs "out"))
294 (python-path (getenv "GUIX_PYTHONPATH")))
295 (wrap-program (string-append out "/bin/cvise")
296 `("PYTHONPATH" ":" prefix (,python-path)))
297 #t))))))
298 (home-page "https://github.com/marxin/cvise")
299 (synopsis "Reducer for interesting code")
300 (description
301 "C-Vise is a Python port of the C-Reduce tool that is fully compatible
302and uses the same efficient LLVM-based C/C++ @code{clang_delta} reduction
303tool.")
304 (license license:ncsa)))
305
306(define-public american-fuzzy-lop
307 (let ((machine (match (or (%current-target-system)
308 (%current-system))
309 ("x86_64-linux" "x86_64")
310 ("i686-linux" "i386")
311 ("aarch64-linux" "aarch64")
312 ("armhf-linux" "arm")
313 ("mips64el-linux" "mips64el")
314 ("powerpc-linux" "ppc")
315 ;; Prevent errors when querying this package on unsupported
316 ;; platforms, e.g. when running "guix package --search="
317 (_ "UNSUPPORTED"))))
318 (package
319 (name "american-fuzzy-lop")
320 (version "2.57b") ;It seems all releases have the 'b' suffix
321 (source
322 (origin
323 (method git-fetch)
324 (uri (git-reference
325 (url "https://github.com/google/AFL")
326 (commit (string-append "v" version))))
327 (sha256
328 (base32 "0ks0s8iizp7mpc9mlpv126rsny0dkljfsw68689g9jiisjz2z530"))
329 (file-name (git-file-name name version))))
330 (build-system gnu-build-system)
331 (inputs
332 (list qemu-for-american-fuzzy-lop))
333 (arguments
334 `(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
335 (string-append "DOC_PATH=$(PREFIX)/share/doc/"
336 ,name "-" ,version)
337 "CC=gcc")
338 #:phases (modify-phases %standard-phases
339 (add-after 'unpack 'make-git-checkout-writable
340 (lambda _
341 (for-each make-file-writable (find-files "."))
342 #t))
343 (delete 'configure)
344 ,@(if (string=? (%current-system) (or "x86_64-linux"
345 "i686-linux"))
346 '()
347 '((add-before 'build 'set-afl-flag
348 (lambda _ (setenv "AFL_NO_X86" "1") #t))
349 (add-after 'install 'remove-x86-programs
350 (lambda* (#:key outputs #:allow-other-keys)
351 (let* ((out (assoc-ref outputs "out"))
352 (bin (string-append out "/bin/")))
353 (delete-file (string-append bin "afl-gcc"))
354 (delete-file (string-append bin "afl-g++"))
355 (delete-file (string-append bin "afl-clang"))
356 (delete-file (string-append bin "afl-clang++")))
357 #t))))
358 (add-after
359 ;; TODO: Build and install the afl-llvm tool.
360 'install 'install-qemu
361 (lambda* (#:key inputs outputs #:allow-other-keys)
362 (let ((qemu (assoc-ref inputs "qemu"))
363 (out (assoc-ref outputs "out")))
364 (symlink (string-append qemu "/bin/qemu-" ,machine)
365 (string-append out "/bin/afl-qemu-trace"))
366 #t)))
367 (delete 'check)))) ; tests are run during 'install phase
368 (home-page "https://lcamtuf.coredump.cx/afl/")
369 (synopsis "Security-oriented fuzzer")
370 (description
371 "American fuzzy lop is a security-oriented fuzzer that employs a novel
372type of compile-time instrumentation and genetic algorithms to automatically
373discover clean, interesting test cases that trigger new internal states in the
374targeted binary. This substantially improves the functional coverage for the
375fuzzed code. The compact synthesized corpora produced by the tool are also
376useful for seeding other, more labor- or resource-intensive testing regimes
377down the road.")
378 (license license:asl2.0))))
379
380(define-public qemu-for-american-fuzzy-lop
381 ;; afl only supports using a single afl-qemu-trace executable, so
382 ;; we only build qemu for the native target.
383 (let ((machine (match (or (%current-target-system)
384 (%current-system))
385 ("x86_64-linux" "x86_64")
386 ("i686-linux" "i386")
387 ("aarch64-linux" "aarch64")
388 ("armhf-linux" "arm")
389 ("mips64el-linux" "mips64el")
390 ("powerpc-linux" "ppc")
391 ;; Prevent errors when querying this package on unsupported
392 ;; platforms, e.g. when running "guix package --search="
393 (_ "UNSUPPORTED"))))
394 (hidden-package
395 (package
396 (name "qemu")
397 (version "2.10.2")
398 (source (origin
399 (method url-fetch)
400 (uri (string-append "https://download.qemu.org/qemu-"
401 version ".tar.xz"))
402 (sha256
403 (base32
404 "17w21spvaxaidi2am5lpsln8yjpyp2zi3s3gc6nsxj5arlgamzgw"))
405 (patches
406 (search-patches "qemu-glibc-2.27.patch"
407 "qemu-glibc-2.30.patch"))))
408 (build-system gnu-build-system)
409 (arguments
410 `(;; Running tests in parallel can occasionally lead to failures, like:
411 ;; boot_sector_test: assertion failed (signature == SIGNATURE): (0x00000000 == 0x0000dead)
412 #:parallel-tests? #f
413 #:configure-flags
414 (list (string-append "--target-list=" ,machine "-linux-user"))
415 #:make-flags '("V=1")
416 #:phases
417 (modify-phases %standard-phases
418 (replace 'configure
419 (lambda* (#:key inputs outputs (configure-flags '())
420 #:allow-other-keys)
421 ;; The `configure' script doesn't understand some of the
422 ;; GNU options. Thus, add a new phase that's compatible.
423 (let ((out (assoc-ref outputs "out")))
424 (setenv "SHELL" (which "bash"))
425
426 ;; While we're at it, patch for tests.
427 (substitute* "tests/libqtest.c"
428 (("/bin/sh") (which "sh")))
429
430 ;; The binaries need to be linked against -lrt.
431 (setenv "LDFLAGS" "-lrt")
432 (apply invoke
433 `("./configure"
434 ,(string-append "--cc=" (which "gcc"))
435 ;; Some architectures insist on using HOST_CC
436 ,(string-append "--host-cc=" (which "gcc"))
437 "--disable-debug-info" ; save build space
438 "--enable-virtfs" ; just to be sure
439 ,(string-append "--prefix=" out)
440 ,(string-append "--sysconfdir=/etc")
441 ,@configure-flags)))))
442 (add-after
443 'unpack 'apply-afl-patches
444 (lambda* (#:key inputs #:allow-other-keys)
445 (let* ((afl-src (assoc-ref inputs "afl-source"))
446 (patch-dir "qemu_mode/patches"))
447 (copy-recursively (string-append afl-src "/"
448 patch-dir)
449 patch-dir)
450 (install-file
451 (string-append patch-dir
452 "/afl-qemu-cpu-inl.h")
453 ".")
454 (copy-file (string-append afl-src "/config.h")
455 "./afl-config.h")
456 (install-file (string-append afl-src "/types.h")
457 ".")
458 (substitute* "afl-qemu-cpu-inl.h"
459 (("\\.\\./\\.\\./config.h") "afl-config.h"))
460 (substitute* (string-append patch-dir
461 "/cpu-exec.diff")
462 (("\\.\\./patches/") ""))
463
464 ;; These were already applied to qemu-minimal-2.10.
465 (for-each (lambda (obsolete-patch)
466 (delete-file (string-append
467 patch-dir "/"
468 obsolete-patch)))
469 (list "configure.diff"
470 "memfd.diff"))
471
472 (for-each (lambda (patch-file)
473 (invoke "patch" "--force" "-p1"
474 "--input" patch-file))
475 (find-files patch-dir
476 "\\.diff$"))
477 #t)))
478 (add-before 'check 'disable-unusable-tests
479 (lambda* (#:key inputs outputs #:allow-other-keys)
480 (substitute* "tests/Makefile.include"
481 ;; Comment out the test-qga test, which needs /sys and
482 ;; fails within the build environment.
483 (("check-unit-.* tests/test-qga" all)
484 (string-append "# " all)))
485 (substitute* "tests/Makefile.include"
486 ;; Comment out the test-char test, which needs networking and
487 ;; fails within the build environment.
488 (("check-unit-.* tests/test-char" all)
489 (string-append "# " all)))
490 #t)))))
491 (native-inputs
492 `(("python-2" ,python-2) ; QEMU 2 needs Python 2
493 ("glib:bin" ,glib "bin")
494 ("perl" ,perl)
495 ("flex" ,flex)
496 ("bison" ,bison)
497 ("pkg-config" ,pkg-config)))
498 (inputs
499 `(("afl-source" ,(package-source american-fuzzy-lop))
500 ("alsa-lib" ,alsa-lib)
501 ("attr" ,attr)
502 ("glib" ,glib)
503 ("libaio" ,libaio)
504 ("libattr" ,attr)
505 ("libcap" ,libcap)
506 ("libjpeg" ,libjpeg-turbo)
507 ("libpng" ,libpng)
508 ("ncurses" ,ncurses)
509 ("pixman" ,pixman)
510 ("util-linux" ,util-linux)
511 ("zlib" ,zlib)))
512 (home-page "https://www.qemu.org")
513 (synopsis "Machine emulator and virtualizer (without GUI) for american fuzzy lop")
514 (description
515 "QEMU is a generic machine emulator and virtualizer. This package
516of QEMU is used only by the american fuzzy lop package.
517
518When used as a machine emulator, QEMU can run OSes and programs made for one
519machine (e.g. an ARM board) on a different machine---e.g., your own PC. By
520using dynamic translation, it achieves very good performance.
521
522When used as a virtualizer, QEMU achieves near native performances by
523executing the guest code directly on the host CPU. QEMU supports
524virtualization when executing under the Xen hypervisor or using
525the KVM kernel module in Linux. When using KVM, QEMU can virtualize x86,
526server and embedded PowerPC, and S390 guests.")
527 ;; Many files are GPLv2+, but some are GPLv2-only---e.g., `memory.c'.
528 (license license:gpl2)
529 ;; Several tests fail on MIPS.
530 (supported-systems (delete "mips64el-linux" %supported-systems))))))
531
532(define-public qemu-for-aflplusplus
533 (let ((base qemu-minimal)
534 (commit "60ebd5624c60589e276cf287516b925a9ee35b87")
535 (revision "1"))
536 (hidden-package
537 (package
538 (inherit base)
539 (name "qemu")
540 (version (git-version "5.2.50" revision commit))
541 (source
542 (origin
543 (method git-fetch)
544 (uri (git-reference (url "https://github.com/AFLplusplus/qemuafl")
545 (commit commit)
546 (recursive? #t)))
547 (file-name (git-file-name name version))
548 (sha256
549 (base32 "1vz7k1ssfnlimkpc01fqin27r2k4a23cwpxj2bbmsp7d3175bjbz"))))
550 (arguments
551 (substitute-keyword-arguments (package-arguments base)
552 ((#:configure-flags _ #~'())
553 #~(list (string-append
554 "--target-list="
555 ;; AFL++ only supports using a single afl-qemu-trace,
556 ;; so we only build qemu for the native target.
557 (match #$(let-system system system)
558 ("aarch64-linux" "aarch64-linux-user")
559 ("armhf-linux" "arm-linux-user")
560 ("i686-linux" "i386-linux-user")
561 ("mips64el-linux" "mips64el-linux-user")
562 ("powerpc-linux" "ppc-linux-user")
563 ("riscv64-linux" "riscv64-linux-user")
564 ("x86_64-linux" "x86_64-linux-user")))))
565 ((#:phases phases)
566 #~(modify-phases #$phases
567 (delete 'replace-firmwares)
568 (delete 'patch-embedded-shebangs)
569 (delete 'fix-optionrom-makefile)
570 (delete 'disable-unusable-tests)
571 (replace 'configure
572 (lambda* (#:key configure-flags #:allow-other-keys)
573 ;; The `configure' script doesn't understand some of the
574 ;; GNU options. Thus, add a new phase that's compatible.
575 (setenv "SHELL" (which "bash"))
576 ;; The binaries need to be linked against -lrt.
577 (setenv "LDFLAGS" "-lrt")
578 (apply invoke
579 "./configure"
580 (string-append "--cc=" #$(cc-for-target))
581 ;; Some architectures insist on using HOST_CC
582 (string-append "--host-cc=" #$(cc-for-target))
583 "--disable-debug-info" ; save build space
584 (string-append "--prefix=" #$output)
585 (string-append "--sysconfdir=/etc")
586 configure-flags)))
587 (add-after 'install 'install-qasan-header
588 (lambda _
589 (install-file "qemuafl/qasan.h"
590 (string-append #$output "/include"))))
591 (delete 'delete-firmwares)
592 #$@(if (target-riscv64?)
593 '((replace 'disable-some-tests
594 (lambda _
595 ;; qemu.qmp.QMPConnectError:
596 ;; Unexpected empty reply from server
597 (delete-file "tests/qemu-iotests/040")
598 (delete-file "tests/qemu-iotests/041")
599 (delete-file "tests/qemu-iotests/256")
600 ;; No 'PCI' bus found for device 'virtio-scsi-pci'
601 (delete-file "tests/qemu-iotests/127")
602 (delete-file "tests/qemu-iotests/267"))))
603 '())))))
604 (inputs (modify-inputs (package-inputs base)
605 (delete "dtc")))
606 (home-page "https://github.com/AFLplusplus/qemuafl")
607 (synopsis "QEMU for AFL++")))))
608
609(define-public aflplusplus
610 (package
611 (inherit american-fuzzy-lop)
612 (name "aflplusplus")
613 (version "4.35c")
614 (source (origin
615 (method git-fetch)
616 (uri (git-reference
617 (url "https://github.com/AFLplusplus/AFLplusplus")
618 (commit (string-append "v" version))))
619 (file-name (git-file-name name version))
620 (sha256
621 (base32
622 "0mwamvyv2ckfxrrns4cnhx9gf2dn9jjgi9dc1qp3cwjasbghg5lg"))))
623 (arguments
624 (substitute-keyword-arguments (package-arguments american-fuzzy-lop)
625 ((#:make-flags _ ''())
626 #~(list (string-append "PREFIX=" #$output)
627 (string-append "DOC_PATH=" #$output "/share/doc/"
628 #$(package-name this-package) "-"
629 #$(package-version this-package))
630 (string-append "CC=" #$(cc-for-target))
631 (string-append "CXX=" #$(cxx-for-target))
632 (string-append "LLVM_CONFIG="
633 (search-input-file %build-inputs "/bin/llvm-config"))
634 ;; Need to use LLD with the llvm_mode, because LTO in
635 ;; combination with binutils gold is currently broken.
636 ;;
637 ;; See: https://codeberg.org/guix/guix/issues/3307
638 (string-append "AFL_REAL_LD="
639 (search-input-file %build-inputs "/bin/ld.lld"))
640 (string-append "CLANG_BIN="
641 (search-input-file %build-inputs "/bin/clang"))
642 (string-append "CLANGPP_BIN="
643 (search-input-file %build-inputs "/bin/clang++"))
644 "LLVM_LTO=1"
645 "AFL_CLANG_FLTO=-flto=full"))
646 ((#:phases phases '%standard-phases)
647 #~(modify-phases #$phases
648 ;; Ensure that the build fails early if LLVM support fails to
649 ;; compile, makes the build log much easier to understand.
650 (add-after 'unpack 'fatal-llvm-failure
651 (lambda* (#:key inputs #:allow-other-keys)
652 (substitute* "GNUmakefile"
653 (("-\\$\\(MAKE\\) ..* -f GNUmakefile.llvm$" all)
654 (substring all 1))))) ; remove the leading '-'
655 ;; GNUmakefile.llvm tries to find clang/clang++ relative to the
656 ;; --bindir reported by llvm-config, but since llvm and clang
657 ;; have different store paths on Guix, this doesn't work here.
658 (add-after 'unpack 'patch-clang-path
659 (lambda* (#:key inputs #:allow-other-keys)
660 (substitute* "GNUmakefile.llvm"
661 (("^CC *= .*$")
662 (string-append
663 "override CC = "
664 (search-input-file inputs "/bin/clang")
665 "\n"))
666 (("^CXX *= .*$")
667 (string-append
668 "override CXX = "
669 (search-input-file inputs "/bin/clang++")
670 "\n")))))
671 ;; For GCC plugins.
672 (add-after 'unpack 'patch-gcc-path
673 (lambda* (#:key inputs #:allow-other-keys)
674 (substitute* "src/afl-cc.c"
675 (("alt_cc = \"gcc\";")
676 (format #f "alt_cc = \"~a\";"
677 (search-input-file inputs "bin/gcc")))
678 (("alt_cxx = \"g\\+\\+\";")
679 (format #f "alt_cxx = \"~a\";"
680 (search-input-file inputs "bin/g++"))))))
681 (add-after 'build 'build-qasan
682 (lambda* (#:key parallel-build? make-flags #:allow-other-keys)
683 (apply invoke "make" "-C" "qemu_mode/libqasan"
684 "-j" (number->string (if parallel-build?
685 (parallel-job-count)
686 "1"))
687 make-flags)))
688 ;; afl-qemu-trace is a symbolic link to QEMU's binary.
689 ;; Substituting its source code with AFL++'s output path
690 ;; would result in a dependency cycle.
691 (add-after 'install-qemu 'wrap-qemu
692 (lambda _
693 (wrap-program (string-append #$output "/bin/afl-qemu-trace")
694 `("AFL_PATH" = (,(string-append #$output "/lib/afl"))))))))))
695 ;; According to the Dockerfile, GCC 12 is producing compile errors for some
696 ;; targets, so explicitly use GCC 11 here.
697 (inputs (list llvm-20 clang-20 lld-20 gcc gmp python qemu-for-aflplusplus))
698 (native-inputs (list gcc))
699 (home-page "https://aflplus.plus/")
700 (description
701 "AFLplusplus is a security-oriented fuzzer that employs a novel type of
702compile-time instrumentation and genetic algorithms to automatically discover
703clean, interesting test cases that trigger new internal states in the targeted
704binary. This substantially improves the functional coverage for the fuzzed
705code. The compact synthesized corpora produced by the tool are also useful for
706seeding other, more labor- or resource-intensive testing regimes down the road.
707It is a fork of American Fuzzy Lop fuzzer and features:
708@itemize
709@item A more recent qemu version.
710@item More algorithms like collision-free coverage, enhanced laf-intel &
711redqueen, AFLfast++ power schedules, MOpt mutators, unicorn_mode, etc.
712@end itemize")))
713
714(define-public backward-cpp
715 (package
716 (name "backward-cpp")
717 (version "1.6")
718 (source (origin
719 (method git-fetch)
720 (uri (git-reference
721 (url "https://github.com/bombela/backward-cpp")
722 (commit (string-append "v" version))))
723 (file-name (git-file-name name version))
724 (sha256
725 (base32
726 "1b2h03iwfhcsg8i4f125mlrjf8l1y7qsr2gsbkv0z03i067lykns"))))
727 (arguments
728 (list
729 #:configure-flags
730 #~(list "-DBACKWARD_SHARED=ON")))
731 (build-system cmake-build-system)
732 (inputs
733 (list libiberty zlib))
734 (synopsis "Stack trace pretty printer for C++")
735 (description
736 "Backward-cpp is a stack trace pretty printer for C++.
737It can print annotated stack traces using debug info in the executable.")
738 (home-page "https://github.com/bombela/backward-cpp")
739 (license license:expat)))
740
741(define-public stress-make
742 (let ((commit "97815bed8060de33952475b3498767c91f59ffd9")
743 (revision "2")) ;No official source distribution
744 (package
745 (name "stress-make")
746 (version (git-version "1.0" revision commit))
747 (source
748 (origin
749 (method git-fetch)
750 (uri (git-reference
751 (url "https://github.com/lanl/stress-make")
752 (commit commit)))
753 (file-name (git-file-name name version))
754 (sha256
755 (base32
756 "0k55cy7x0hlc6rgpascl6ibhcfxaash3p9r9r8kwvbm3zag1rmac"))))
757 (build-system gnu-build-system)
758 (native-inputs
759 (list autoconf automake go))
760 (inputs
761 `(("make-source" ,(package-source gnu-make))))
762 (arguments
763 ;; stress-make's configure script insists on having a tarball and does
764 ;; not accept a directory name instead. To let the gnu-build-system's
765 ;; patch-* phases work properly, we unpack the source first, then
766 ;; repack before the configure phase.
767 (let ((make-dir (string-append "make-" (package-version gnu-make))))
768 `(#:configure-flags '("--with-make-tar=./make.tar.xz"
769 "make_cv_sys_gnu_glob=yes")
770 #:phases
771 (modify-phases %standard-phases
772 (add-after 'unpack 'unpack-make
773 (lambda* (#:key inputs #:allow-other-keys)
774 (invoke "tar" "xf" (assoc-ref inputs "make-source"))))
775 (add-after 'unpack-make 'set-default-shell
776 (lambda _
777 ;; Taken mostly directly from (@ (gnu packages base) gnu-make)
778 (substitute* (string-append ,make-dir "/src/job.c")
779 (("default_shell = .*$")
780 (format #f "default_shell = \"~a\";\n"
781 (which "sh"))))))
782 (add-before 'configure 'repack-make
783 (lambda _
784 (invoke "tar" "cJf" "./make.tar.xz" ,make-dir)))
785 (add-before 'build 'setup-go
786 ;; The Go cache is required starting in Go 1.12, and it needs
787 ;; to be writable.
788 (lambda _ (setenv "GOCACHE" "/tmp/go-cache") #t))))))
789 (home-page "https://github.com/lanl/stress-make")
790 (synopsis "Expose race conditions in Makefiles")
791 (description
792 "Stress Make is a customized GNU Make that explicitly manages the order
793in which concurrent jobs are run to provoke erroneous behavior into becoming
794manifest. It can run jobs in the order in which they're launched, in backwards
795order, or in random order. The thought is that if code builds correctly with
796Stress Make, then it is likely that the @code{Makefile} contains no race
797conditions.")
798 ;; stress-make wrapper is under BSD-3-modifications-must-be-indicated,
799 ;; and patched GNU Make is under its own license.
800 (license (list (license:non-copyleft "LICENSE.md")
801 license:gpl3+)))))
802
803(define-public zzuf
804 (package
805 (name "zzuf")
806 (version "0.15")
807 (source
808 (origin
809 (method url-fetch)
810 (uri (string-append
811 "https://github.com/samhocevar/zzuf/releases/download/v"
812 version "/" name "-" version ".tar.gz"))
813 (file-name (string-append name "-" version ".tar.gz"))
814 (sha256
815 (base32
816 "1mpzjaksc2qg2hzqflf39pl06p53qam2dn3hkhkcv6p00d2n4kx3"))))
817 (build-system gnu-build-system)
818 (native-inputs (list gcc-13))
819 (home-page "https://github.com/samhocevar/zzuf")
820 (synopsis "Transparent application input fuzzer")
821 (description "Zzuf is a transparent application input fuzzer. It works by
822intercepting file operations and changing random bits in the program's
823input. Zzuf's behaviour is deterministic, making it easy to reproduce bugs.")
824 (license license:wtfpl2)))
825
826(define-public scanmem
827 (package
828 (name "scanmem")
829 (version "0.17")
830 (source
831 (origin
832 (method git-fetch)
833 (uri (git-reference
834 (url "https://github.com/scanmem/scanmem")
835 (commit (string-append "v" version))))
836 (file-name (git-file-name name version))
837 (sha256
838 (base32
839 "17p8sh0rj8yqz36ria5bp48c8523zzw3y9g8sbm2jwq7sc27i7s9"))))
840 (build-system gnu-build-system)
841 (arguments
842 `(#:configure-flags '("--enable-gui")
843 #:phases
844 (modify-phases %standard-phases
845 (add-before 'configure 'hardcode-python
846 (lambda* (#:key inputs outputs #:allow-other-keys)
847 (substitute* "gui/GameConqueror.py"
848 (("/usr/bin/env python")
849 (search-input-file inputs "/bin/python")))))
850 (add-after 'install 'wrap-gameconqueror
851 (lambda* (#:key inputs outputs #:allow-other-keys)
852 (let ((out (assoc-ref outputs "out"))
853 (gi-typelib-path (getenv "GI_TYPELIB_PATH"))
854 (python-path (getenv "GUIX_PYTHONPATH")))
855 (wrap-program (string-append out "/share/gameconqueror/GameConqueror.py")
856 `("GI_TYPELIB_PATH" ":" prefix (,gi-typelib-path))
857 `("GUIX_PYTHONPATH" ":" prefix (,python-path))))
858 #t)))))
859 (native-inputs
860 (list libtool
861 python-wrapper
862 gobject-introspection
863 gtk+
864 intltool
865 automake
866 autoconf))
867 (inputs
868 (list bash-minimal
869 readline))
870 (propagated-inputs
871 (list python-pygobject))
872 (home-page "https://github.com/scanmem/scanmem")
873 (synopsis "Memory scanner")
874 (description "Scanmem is a debugging utility designed to isolate the
875address of an arbitrary variable in an executing process. Scanmem simply
876needs to be told the pid of the process and the value of the variable at
877several different times. After several scans of the process, scanmem isolates
878the position of the variable and allows you to modify its value.")
879 ;; The library is covered by LGPLv3 or later; the application is covered
880 ;; by GPLv3 or later.
881 (license (list license:lgpl3+ license:gpl3+))))
882
883(define-public remake
884 (package (inherit gnu-make)
885 (name "remake")
886 (version "4.3-1.6")
887 (source (origin
888 (method url-fetch)
889 (uri (let ((upstream-version
890 (match (string-split version #\-)
891 ((ver sub) (string-append ver "%2Bdbg-" sub)))))
892 (string-append "mirror://sourceforge/bashdb/"
893 "remake/" upstream-version "/"
894 "remake-" upstream-version ".tar.gz")))
895 (file-name (string-append "remake-" version ".tar.gz"))
896 (sha256
897 (base32
898 "11vvch8bi0yhjfz7gn92b3xmmm0cgi3qfiyhbnnj89frkhbwd87n"))
899 (patches (search-patches "remake-impure-dirs.patch"))))
900 (inputs
901 (modify-inputs (package-inputs gnu-make)
902 (prepend readline)))
903 (home-page "https://bashdb.sourceforge.net/remake/")
904 (description "Remake is an enhanced version of GNU Make that adds improved
905error reporting, better tracing, profiling, and a debugger.")
906 (license license:gpl3+)))
907
908(define-public rr
909 ;; Use a newer commit, which contains unreleased fixes to the
910 ;; zen-pmu-workaround.c kernel module, among others.
911 (let ((commit "7fe1e367c2b4e0df7647e020c20d66827badfad3")
912 (revision "0"))
913 (package
914 (name "rr")
915 (version (git-version "5.9.0" revision commit))
916 (source (origin
917 (method git-fetch)
918 (uri (git-reference
919 (url "https://github.com/mozilla/rr")
920 (commit commit)))
921 (sha256
922 (base32
923 "1zgxk4blwwq0bigi0g8dafgl330aid3kw9ym426825flc3pp1c3m"))
924 (file-name (git-file-name name version))))
925 (build-system cmake-build-system)
926 (arguments
927 `(#:configure-flags
928 ;; The 'rr_exec_stub' is a static binary, which leads CMake to fail
929 ;; with ‘file RPATH_CHANGE could not write new RPATH: ...’.
930 ;; Clear CMAKE_INSTALL_RPATH to avoid that problem.
931 (list "-DCMAKE_INSTALL_RPATH="
932 ;; Satisfy the ‘validate-runpath’ phase. This isn't a direct
933 ;; consequence of clearing CMAKE_INSTALL_RPATH.
934 (string-append "-DCMAKE_EXE_LINKER_FLAGS=-Wl,-rpath="
935 (assoc-ref %build-inputs "capnproto")
936 "/lib,-rpath=" (assoc-ref %build-inputs "zlib")
937 "/lib,-rpath=" (assoc-ref %build-inputs "zstd")
938 "/lib")
939 ,@(if (and (not (%current-target-system))
940 (member (%current-system)
941 '("x86_64-linux" "aarch64-linux")))
942 ;; The toolchain doesn't support '-m32'.
943 '("-Ddisable32bit=ON")
944 '()))
945
946 ;; XXX: Most tests fail with:
947 ;;
948 ;; rr needs /proc/sys/kernel/perf_event_paranoid <= 1, but it is 2.
949 ;;
950 ;; This setting cannot be changed from the build environment, so skip
951 ;; the tests.
952 #:tests? #f
953
954 #:phases (modify-phases %standard-phases
955 (add-before 'check 'set-home
956 (lambda _
957 ;; Some tests expect 'HOME' to be set.
958 (setenv "HOME" (getcwd)))))))
959 (native-inputs
960 (list lldb pkg-config which))
961 (inputs
962 (list gdb
963 capnproto
964 python
965 python-pexpect
966 zlib
967 `(,zstd "lib")))
968
969 ;; List of supported systems according to 'src/preload/raw_syscall.S'.
970 (supported-systems '("x86_64-linux" "i686-linux" "aarch64-linux"))
971
972 (home-page "https://rr-project.org/")
973 (synopsis "Record and replay debugging framework")
974 (description
975 "rr is a lightweight tool for recording, replaying and debugging
976execution of applications (trees of processes and threads). Debugging extends
977GDB with very efficient reverse-execution, which in combination with standard
978GDB/x86 features like hardware data watchpoints, makes debugging much more
979fun.")
980 (license license:expat))))
981
982(define-public rr-zen-pmu-workaround
983 (package
984 (name "rr-zen-pmu-workaround")
985 (version (package-version rr))
986 (source (package-source rr))
987 (build-system linux-module-build-system)
988 (arguments
989 (list
990 #:tests? #f ;no tests
991 #:phases
992 #~(modify-phases %standard-phases
993 (add-after 'unpack 'cd
994 (lambda _
995 (chdir "third-party/zen-pmu-workaround"))))))
996 (home-page "https://github.com/rr-debugger/rr/wiki/Zen")
997 (synopsis "AMD Zen workaround kernel module for rr")
998 (description "This is a Linux kernel module that implements
999 workarounds needed for using the @command{rr} debugger with AMD Zen
1000@acronym{CPU, Central Processing Unit}.")
1001 (license license:gpl2))) ;GPLv2 only, like the kernel
1002
1003(define-public libbacktrace
1004 ;; There are no releases nor tags.
1005 (let ((revision "2")
1006 (commit "cdb64b688dda93bbbacbc2b1ccf50ce9329d4748"))
1007 (package
1008 (name "libbacktrace")
1009 (version (git-version "1.0" revision commit))
1010 (source (origin
1011 (method git-fetch)
1012 (uri (git-reference
1013 (url "https://github.com/ianlancetaylor/libbacktrace")
1014 (commit commit)))
1015 (file-name (git-file-name name version))
1016 (sha256
1017 (base32
1018 "0iwd41pgr2nxlmghqdfwfwxac27jbqxwxp07jihhq85a8s3igjgr"))))
1019 (build-system gnu-build-system)
1020 (arguments
1021 `(#:parallel-tests? #f ;spurious failures when testing in parallel
1022 #:make-flags '("CFLAGS=-fPIC")))
1023 (home-page "https://github.com/ianlancetaylor/libbacktrace")
1024 (synopsis "C library for producing symbolic backtraces")
1025 (description "The @code{libbacktrace} library can be linked into a C/C++
1026program to produce symbolic backtraces.")
1027 (license license:bsd-3))))
1028
1029(define-public libleak
1030 (package
1031 (name "libleak")
1032 (version "0.3.6")
1033 (source (origin
1034 (method git-fetch)
1035 (uri (git-reference
1036 (url "https://github.com/WuBingzheng/libleak")
1037 (commit (string-append "v" version))))
1038 (file-name (git-file-name name version))
1039 (sha256
1040 (base32
1041 "1p6x20mm0dym2qn10d6cvwmh71m93xwcd319g94zkv88hj5q17n6"))))
1042 (build-system gnu-build-system)
1043 (arguments
1044 `(#:tests? #f ;no test suite
1045 #:parallel-build? #f ;jobserver unavailable
1046 #:phases (modify-phases %standard-phases
1047 (add-after 'unpack 'unbundle-libwuya
1048 (lambda _
1049 (substitute* "Makefile"
1050 ((".*make -C libwuya.*") ""))
1051 #t))
1052 (add-before 'build 'set-CC
1053 (lambda _
1054 (setenv "CC" "gcc")
1055 #t))
1056 (delete 'configure) ;no configure script
1057 (replace 'install
1058 (lambda* (#:key outputs #:allow-other-keys)
1059 (let* ((out (assoc-ref outputs "out")))
1060 (install-file "libleak.so" (string-append out "/lib"))
1061 #t))))))
1062 (inputs (list libbacktrace libwuya))
1063 (home-page "https://github.com/WuBingzheng/libleak")
1064 (synopsis "Memory leaks detection tool")
1065 (description "The libleak tool detects memory leaks by hooking memory
1066functions such as @code{malloc}. It comes as a shared object to be pre-loaded
1067via @code{LD_PRELOAD} when launching the application. It prints the full call
1068stack at suspicious memory leak points. Modifying or recompiling the target
1069program is not required, and the detection can be enabled or disabled while
1070the target application is running. The overhead incurred by libleak is
1071smaller than that of other tools such as Valgrind, and it aims to be easier to
1072use than similar tools like @command{mtrace}.")
1073 (license license:gpl2+)))
1074
1075(define-public cgdb
1076 (package
1077 (name "cgdb")
1078 (version "0.8.0")
1079 (source
1080 (origin
1081 (method url-fetch)
1082 (uri (string-append "https://cgdb.me/files/cgdb-" version ".tar.gz"))
1083 (sha256
1084 (base32 "1w8ib2vg3pg68d9hh97fw5042c73i9nqavdddc87n9bpscjbaf0d"))))
1085 (build-system gnu-build-system)
1086 (inputs
1087 (list bash-minimal ncurses readline gdb))
1088 (native-inputs
1089 (list flex texinfo))
1090 (arguments
1091 `(#:configure-flags
1092 (list
1093 (string-append "ac_cv_rl_version=" ,(package-version readline))
1094 "ac_cv_file__dev_ptmx=no"
1095 "ac_cv_file__proc_self_status=no"
1096 "ac_cv_func_setpgrp_void=no")
1097 #:phases
1098 (modify-phases %standard-phases
1099 (add-after 'unpack 'fix-paths
1100 (lambda* (#:key inputs #:allow-other-keys)
1101 (let ((gdb (search-input-file inputs "bin/gdb"))
1102 (sh (search-input-file inputs "bin/sh")))
1103 (substitute* "lib/util/fork_util.cpp"
1104 (("GDB = \"gdb\"") (string-append "GDB = \"" gdb "\"")))
1105 (substitute* "cgdb/cgdb.cpp" (("/bin/sh") sh))))))))
1106 (home-page "https://cgdb.github.io")
1107 (synopsis "Console front-end to the GNU debugger")
1108 (description
1109 "@code{cgdb} is a lightweight curses (terminal-based) interface to the
1110GNU Debugger (GDB). In addition to the standard gdb console, cgdb provides
1111a split screen view that displays the source code as it executes. The
1112keyboard interface is modeled after vim, so vim users should feel at home
1113using cgdb.")
1114 (license license:gpl2+)))
1115
1116(define-public mspdebug
1117 ;; Last official release was 24 July 2017
1118 (let ((commit "4c4d94e43bc4a18ecf82070ff81cd38dd5641e3b")
1119 (revision "0"))
1120 (package
1121 (name "mspdebug")
1122 (version (git-version "0.25" revision commit))
1123 (source (origin
1124 (method git-fetch)
1125 (uri (git-reference
1126 (url "https://github.com/dlbeer/mspdebug")
1127 (commit commit)))
1128 (file-name (git-file-name name version))
1129 (sha256
1130 (base32 "1lgw1dsc1aglyja610ichadvgs5b0df3wlarinczb0ykf431gjln"))))
1131 (build-system gnu-build-system)
1132 (arguments
1133 `(#:tests? #f ; no test suite
1134 #:phases
1135 (modify-phases %standard-phases
1136 (delete 'configure)) ; no configure script
1137 #:make-flags
1138 (list (string-append "CC=" ,(cc-for-target))
1139 "INSTALL=install"
1140 (string-append "PREFIX=" %output))))
1141 (inputs
1142 (list libusb-compat readline))
1143 (synopsis "Debugging tool for MSP430 MCUs")
1144 (description "MspDebug supports FET430UIF, eZ430, RF2500 and Olimex
1145MSP430-JTAG-TINY programmers, as well as many other compatible
1146devices. It can be used as a proxy for gdb or as an independent
1147debugger with support for programming, disassembly and reverse
1148engineering.")
1149 (home-page "https://github.com/dlbeer/mspdebug")
1150 (license license:gpl2+))))
1151
1152(define-public seer-gdb
1153 (package
1154 (name "seer-gdb")
1155 (version "1.16")
1156 (source (origin
1157 (method git-fetch)
1158 (uri (git-reference
1159 (url "https://github.com/epasveer/seer.git")
1160 (commit (string-append "v" version))))
1161 (file-name (string-append name "-" version "-checkout"))
1162 (sha256
1163 (base32
1164 "0jdvyg2jab1pvf36pvkyrfsg2wyy8zp1qx0v2ksclgrnr1hja6k6"))))
1165 (build-system qt-build-system)
1166 (arguments
1167 `(#:tests? #f ; Those are strangely manual
1168 #:phases
1169 (modify-phases %standard-phases
1170 (add-after 'unpack 'chdir
1171 (lambda _
1172 (chdir "src"))))))
1173 (inputs
1174 (list qtbase-5 qtcharts-5 qtwayland-5))
1175 (synopsis "GUI frontend for GDB")
1176 (description "This package provides a frontend to GDB, the GNU debugger.")
1177 (home-page "https://github.com/epasveer/seer")
1178 ;; Note: Some icons in src/resources are creative commons 3.0 and/or 4.0.
1179 (license license:gpl3+)))
1180
1181(define-public ddd
1182 (package
1183 (name "ddd")
1184 (version "3.4.1")
1185 (source (origin
1186 (method url-fetch)
1187 (uri (string-append "mirror://gnu/ddd/ddd-" version ".tar.gz"))
1188 (patches (search-patches "ddd-build.patch"))
1189 (sha256
1190 (base32
1191 "12gfyh139rim49m56lxm36ckdyiiz4n3la3y6ik1aqgrqfk1fxdq"))))
1192 (build-system gnu-build-system)
1193 (arguments
1194 (list #:tests? #f ;tests require manual intervention
1195 #:configure-flags
1196 #~(list (string-append "--with-freetype-includes="
1197 #$(this-package-input "freetype") "/include/freetype2"))))
1198 (native-inputs
1199 (list pkg-config bison flex perl))
1200 (inputs
1201 (list libxaw libxft freetype motif ncurses gdb))
1202 (synopsis "Graphical front-end for GDB and other debuggers")
1203 (description "GNU DDD, the Data Display Debugger, is a graphical front-end
1204for command-line debuggers. Many back-end debuggers are supported, notably
1205the GNU debugger, GDB. In addition to usual debugging features such as
1206viewing the source files, DDD has additional graphical, interactive features
1207to aid in debugging.")
1208 (home-page "https://www.gnu.org/software/ddd/")
1209 (license license:gpl3+)))
1210
1211(define-public delve
1212 (package
1213 (name "delve")
1214 (version "1.25.2")
1215 (source
1216 (origin
1217 (method git-fetch)
1218 (uri (git-reference
1219 (url "https://github.com/go-delve/delve")
1220 (commit (string-append "v" version))))
1221 (file-name (git-file-name name version))
1222 (sha256
1223 (base32
1224 "1b6vp6m4vjx4wfs1djhpizvz40s563jwld9lgjq82svaiilrmlqa"))
1225 (snippet
1226 #~(begin (use-modules (guix build utils))
1227 (delete-file-recursively "vendor")))))
1228 (build-system go-build-system)
1229 (arguments
1230 (list
1231 #:install-source? #f
1232 #:import-path "github.com/go-delve/delve/cmd/dlv"
1233 #:unpack-path "github.com/go-delve/delve"
1234 ;; [1] Want mod github.com/go-delve/delve and dep
1235 ;; github.com/google/go-dap in the output.
1236 ;; [2] Output of go tool nm contains MethodByName.
1237 #:test-flags #~(list "-skip" "TestVersion|TestDeadcodeEliminated")))
1238 (native-inputs
1239 (list go-github-com-cilium-ebpf
1240 go-github-com-cosiner-argv
1241 go-github-com-creack-pty
1242 go-github-com-derekparker-trie
1243 go-github-com-go-delve-liner
1244 go-github-com-google-go-dap
1245 go-github-com-hashicorp-golang-lru
1246 go-github-com-mattn-go-colorable
1247 go-github-com-mattn-go-isatty
1248 go-github-com-spf13-cobra
1249 go-github-com-spf13-pflag
1250 go-go-starlark-net
1251 go-golang-org-x-arch
1252 go-golang-org-x-sys
1253 go-golang-org-x-telemetry
1254 go-golang-org-x-tools
1255 go-gopkg-in-yaml-v3))
1256 (home-page "https://github.com/go-delve/delve")
1257 (synopsis "Debugger for the Go programming language")
1258 (description "Delve is a debugger for the Go programming language.")
1259 (license license:expat)))
1260
1261(define-public fiu
1262 (package
1263 (name "fiu")
1264 (version "1.2")
1265 (source
1266 (origin
1267 (method url-fetch)
1268 (uri (string-append "https://blitiri.com.ar/p/libfiu/files/"
1269 version "/libfiu-" version ".tar.gz"))
1270 (sha256
1271 (base32 "0x4ncvi6sv22rqi9x61byybpmch0z1zvpr6p48axkk890ysv6fim"))))
1272 (build-system gnu-build-system)
1273 (arguments
1274 (list #:make-flags #~(list (string-append "PREFIX=" #$output)
1275 (string-append "CC=" #$(cc-for-target))
1276 (string-append "LDFLAGS=-Wl,-rpath="
1277 #$output "/lib"))
1278 #:phases #~(modify-phases %standard-phases
1279 (delete 'configure)
1280 (add-before 'check 'set-env
1281 ;; Shorten paths to sockets in tests.
1282 (lambda _ (setenv "TMPDIR" "/tmp"))))
1283 #:test-target "test"))
1284 (native-inputs (list python)) ; for tests
1285 (synopsis "Fault injector in userspace")
1286 (description "Fiu provides CLI utilities and a C library
1287to mark points of failure inside your code
1288and to enable/disable the failure of those points.")
1289 (home-page "https://blitiri.com.ar/p/libfiu")
1290 (license license:public-domain)))
1291
1292(define-public python-fiu
1293 (package
1294 (name "python-fiu")
1295 (version "1.2")
1296 (source (package-source fiu))
1297 (build-system pyproject-build-system)
1298 (arguments
1299 (list #:phases #~(modify-phases %standard-phases
1300 (add-after 'unpack 'enter-python-dir
1301 (lambda _ (chdir "bindings/python")))
1302 (add-before 'build 'set-env
1303 (lambda* (#:key inputs #:allow-other-keys)
1304 (setenv "PLIBPATH"
1305 (string-append (assoc-ref inputs "fiu")
1306 "/lib")))))
1307 #:tests? #f)) ; tests run in fiu
1308 (native-inputs (list python-setuptools python-wheel))
1309 (inputs (list fiu))
1310 (synopsis "Python binding for fiu (fault injection in userspace)")
1311 (description "This package includes two Python modules:
1312@enumerate
1313@item @code{fiu} is a wrapper for @code{libfiu}, the fault injection C library.
1314@item @code{fiu_ctrl} provide an easy way run a command
1315with @code{libfiu} enabled, and controlling the failure points dynamically.
1316@end enumerate")
1317 (home-page (package-home-page fiu))
1318 (license (package-license fiu))))